From ede68caefcd8f44fa6eee67e400b342e81d58da7 Mon Sep 17 00:00:00 2001 From: laxman h Date: Tue, 28 Apr 2026 13:12:20 +0530 Subject: [PATCH] stage transition issue resolved --- ...{index-DkEVuJwH.css => index-COwSK6pX.css} | 2 +- .../{index-CAe70IkM.js => index-C_7C7ZNJ.js} | 288 +-- build/index.html | 4 +- docs/RE_Dealer_System_TestStories.md | 1792 +++++++++++++++++ docs/RE_Dealer_Test_Coverage_Tracker.md | 163 ++ scripts/seed-document-configs.ts | 18 + trigger-workflow.js | 540 ++--- 7 files changed, 2390 insertions(+), 417 deletions(-) rename build/assets/{index-DkEVuJwH.css => index-COwSK6pX.css} (97%) rename build/assets/{index-CAe70IkM.js => index-C_7C7ZNJ.js} (60%) create mode 100644 docs/RE_Dealer_System_TestStories.md create mode 100644 docs/RE_Dealer_Test_Coverage_Tracker.md diff --git a/build/assets/index-DkEVuJwH.css b/build/assets/index-COwSK6pX.css similarity index 97% rename from build/assets/index-DkEVuJwH.css rename to build/assets/index-COwSK6pX.css index 6f2b71c..dbd52b5 100644 --- a/build/assets/index-DkEVuJwH.css +++ b/build/assets/index-COwSK6pX.css @@ -3,4 +3,4 @@ * https://quilljs.com/ * Copyright (c) 2014, Jason Chen * Copyright (c) 2013, salesforce.com -*/.ql-container{box-sizing:border-box;font-family:Helvetica,Arial,sans-serif;font-size:13px;height:100%;margin:0;position:relative}.ql-container.ql-disabled .ql-tooltip{visibility:hidden}.ql-container.ql-disabled .ql-editor ul[data-checked]>li:before{pointer-events:none}.ql-clipboard{left:-100000px;height:1px;overflow-y:hidden;position:absolute;top:50%}.ql-clipboard p{margin:0;padding:0}.ql-editor{box-sizing:border-box;line-height:1.42;height:100%;outline:none;overflow-y:auto;padding:12px 15px;-o-tab-size:4;tab-size:4;-moz-tab-size:4;text-align:left;white-space:pre-wrap;word-wrap:break-word}.ql-editor>*{cursor:text}.ql-editor p,.ql-editor ol,.ql-editor ul,.ql-editor pre,.ql-editor blockquote,.ql-editor h1,.ql-editor h2,.ql-editor h3,.ql-editor h4,.ql-editor h5,.ql-editor h6{margin:0;padding:0;counter-reset:list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9}.ql-editor ol,.ql-editor ul{padding-left:1.5em}.ql-editor ol>li,.ql-editor ul>li{list-style-type:none}.ql-editor ul>li:before{content:"•"}.ql-editor ul[data-checked=true],.ql-editor ul[data-checked=false]{pointer-events:none}.ql-editor ul[data-checked=true]>li *,.ql-editor ul[data-checked=false]>li *{pointer-events:all}.ql-editor ul[data-checked=true]>li:before,.ql-editor ul[data-checked=false]>li:before{color:#777;cursor:pointer;pointer-events:all}.ql-editor ul[data-checked=true]>li:before{content:"☑"}.ql-editor ul[data-checked=false]>li:before{content:"☐"}.ql-editor li:before{display:inline-block;white-space:nowrap;width:1.2em}.ql-editor li:not(.ql-direction-rtl):before{margin-left:-1.5em;margin-right:.3em;text-align:right}.ql-editor li.ql-direction-rtl:before{margin-left:.3em;margin-right:-1.5em}.ql-editor ol li:not(.ql-direction-rtl),.ql-editor ul li:not(.ql-direction-rtl){padding-left:1.5em}.ql-editor ol li.ql-direction-rtl,.ql-editor ul li.ql-direction-rtl{padding-right:1.5em}.ql-editor ol li{counter-reset:list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;counter-increment:list-0}.ql-editor ol li:before{content:counter(list-0,decimal) ". "}.ql-editor ol li.ql-indent-1{counter-increment:list-1}.ql-editor ol li.ql-indent-1:before{content:counter(list-1,lower-alpha) ". "}.ql-editor ol li.ql-indent-1{counter-reset:list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-2{counter-increment:list-2}.ql-editor ol li.ql-indent-2:before{content:counter(list-2,lower-roman) ". "}.ql-editor ol li.ql-indent-2{counter-reset:list-3 list-4 list-5 list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-3{counter-increment:list-3}.ql-editor ol li.ql-indent-3:before{content:counter(list-3,decimal) ". "}.ql-editor ol li.ql-indent-3{counter-reset:list-4 list-5 list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-4{counter-increment:list-4}.ql-editor ol li.ql-indent-4:before{content:counter(list-4,lower-alpha) ". "}.ql-editor ol li.ql-indent-4{counter-reset:list-5 list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-5{counter-increment:list-5}.ql-editor ol li.ql-indent-5:before{content:counter(list-5,lower-roman) ". "}.ql-editor ol li.ql-indent-5{counter-reset:list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-6{counter-increment:list-6}.ql-editor ol li.ql-indent-6:before{content:counter(list-6,decimal) ". "}.ql-editor ol li.ql-indent-6{counter-reset:list-7 list-8 list-9}.ql-editor ol li.ql-indent-7{counter-increment:list-7}.ql-editor ol li.ql-indent-7:before{content:counter(list-7,lower-alpha) ". "}.ql-editor ol li.ql-indent-7{counter-reset:list-8 list-9}.ql-editor ol li.ql-indent-8{counter-increment:list-8}.ql-editor ol li.ql-indent-8:before{content:counter(list-8,lower-roman) ". "}.ql-editor ol li.ql-indent-8{counter-reset:list-9}.ql-editor ol li.ql-indent-9{counter-increment:list-9}.ql-editor ol li.ql-indent-9:before{content:counter(list-9,decimal) ". "}.ql-editor .ql-indent-1:not(.ql-direction-rtl){padding-left:3em}.ql-editor li.ql-indent-1:not(.ql-direction-rtl){padding-left:4.5em}.ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right{padding-right:3em}.ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right{padding-right:4.5em}.ql-editor .ql-indent-2:not(.ql-direction-rtl){padding-left:6em}.ql-editor li.ql-indent-2:not(.ql-direction-rtl){padding-left:7.5em}.ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right{padding-right:6em}.ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right{padding-right:7.5em}.ql-editor .ql-indent-3:not(.ql-direction-rtl){padding-left:9em}.ql-editor li.ql-indent-3:not(.ql-direction-rtl){padding-left:10.5em}.ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right{padding-right:9em}.ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right{padding-right:10.5em}.ql-editor .ql-indent-4:not(.ql-direction-rtl){padding-left:12em}.ql-editor li.ql-indent-4:not(.ql-direction-rtl){padding-left:13.5em}.ql-editor .ql-indent-4.ql-direction-rtl.ql-align-right{padding-right:12em}.ql-editor li.ql-indent-4.ql-direction-rtl.ql-align-right{padding-right:13.5em}.ql-editor .ql-indent-5:not(.ql-direction-rtl){padding-left:15em}.ql-editor li.ql-indent-5:not(.ql-direction-rtl){padding-left:16.5em}.ql-editor .ql-indent-5.ql-direction-rtl.ql-align-right{padding-right:15em}.ql-editor li.ql-indent-5.ql-direction-rtl.ql-align-right{padding-right:16.5em}.ql-editor .ql-indent-6:not(.ql-direction-rtl){padding-left:18em}.ql-editor li.ql-indent-6:not(.ql-direction-rtl){padding-left:19.5em}.ql-editor .ql-indent-6.ql-direction-rtl.ql-align-right{padding-right:18em}.ql-editor li.ql-indent-6.ql-direction-rtl.ql-align-right{padding-right:19.5em}.ql-editor .ql-indent-7:not(.ql-direction-rtl){padding-left:21em}.ql-editor li.ql-indent-7:not(.ql-direction-rtl){padding-left:22.5em}.ql-editor .ql-indent-7.ql-direction-rtl.ql-align-right{padding-right:21em}.ql-editor li.ql-indent-7.ql-direction-rtl.ql-align-right{padding-right:22.5em}.ql-editor .ql-indent-8:not(.ql-direction-rtl){padding-left:24em}.ql-editor li.ql-indent-8:not(.ql-direction-rtl){padding-left:25.5em}.ql-editor .ql-indent-8.ql-direction-rtl.ql-align-right{padding-right:24em}.ql-editor li.ql-indent-8.ql-direction-rtl.ql-align-right{padding-right:25.5em}.ql-editor .ql-indent-9:not(.ql-direction-rtl){padding-left:27em}.ql-editor li.ql-indent-9:not(.ql-direction-rtl){padding-left:28.5em}.ql-editor .ql-indent-9.ql-direction-rtl.ql-align-right{padding-right:27em}.ql-editor li.ql-indent-9.ql-direction-rtl.ql-align-right{padding-right:28.5em}.ql-editor .ql-video{display:block;max-width:100%}.ql-editor .ql-video.ql-align-center{margin:0 auto}.ql-editor .ql-video.ql-align-right{margin:0 0 0 auto}.ql-editor .ql-bg-black{background-color:#000}.ql-editor .ql-bg-red{background-color:#e60000}.ql-editor .ql-bg-orange{background-color:#f90}.ql-editor .ql-bg-yellow{background-color:#ff0}.ql-editor .ql-bg-green{background-color:#008a00}.ql-editor .ql-bg-blue{background-color:#06c}.ql-editor .ql-bg-purple{background-color:#93f}.ql-editor .ql-color-white{color:#fff}.ql-editor .ql-color-red{color:#e60000}.ql-editor .ql-color-orange{color:#f90}.ql-editor .ql-color-yellow{color:#ff0}.ql-editor .ql-color-green{color:#008a00}.ql-editor .ql-color-blue{color:#06c}.ql-editor .ql-color-purple{color:#93f}.ql-editor .ql-font-serif{font-family:Georgia,Times New Roman,serif}.ql-editor .ql-font-monospace{font-family:Monaco,Courier New,monospace}.ql-editor .ql-size-small{font-size:.75em}.ql-editor .ql-size-large{font-size:1.5em}.ql-editor .ql-size-huge{font-size:2.5em}.ql-editor .ql-direction-rtl{direction:rtl;text-align:inherit}.ql-editor .ql-align-center{text-align:center}.ql-editor .ql-align-justify{text-align:justify}.ql-editor .ql-align-right{text-align:right}.ql-editor.ql-blank:before{color:#0009;content:attr(data-placeholder);font-style:italic;left:15px;pointer-events:none;position:absolute;right:15px}.ql-snow.ql-toolbar:after,.ql-snow .ql-toolbar:after{clear:both;content:"";display:table}.ql-snow.ql-toolbar button,.ql-snow .ql-toolbar button{background:none;border:none;cursor:pointer;display:inline-block;float:left;height:24px;padding:3px 5px;width:28px}.ql-snow.ql-toolbar button svg,.ql-snow .ql-toolbar button svg{float:left;height:100%}.ql-snow.ql-toolbar button:active:hover,.ql-snow .ql-toolbar button:active:hover{outline:none}.ql-snow.ql-toolbar input.ql-image[type=file],.ql-snow .ql-toolbar input.ql-image[type=file]{display:none}.ql-snow.ql-toolbar button:hover,.ql-snow .ql-toolbar button:hover,.ql-snow.ql-toolbar button:focus,.ql-snow .ql-toolbar button:focus,.ql-snow.ql-toolbar button.ql-active,.ql-snow .ql-toolbar button.ql-active,.ql-snow.ql-toolbar .ql-picker-label:hover,.ql-snow .ql-toolbar .ql-picker-label:hover,.ql-snow.ql-toolbar .ql-picker-label.ql-active,.ql-snow .ql-toolbar .ql-picker-label.ql-active,.ql-snow.ql-toolbar .ql-picker-item:hover,.ql-snow .ql-toolbar .ql-picker-item:hover,.ql-snow.ql-toolbar .ql-picker-item.ql-selected,.ql-snow .ql-toolbar .ql-picker-item.ql-selected{color:#06c}.ql-snow.ql-toolbar button:hover .ql-fill,.ql-snow .ql-toolbar button:hover .ql-fill,.ql-snow.ql-toolbar button:focus .ql-fill,.ql-snow .ql-toolbar button:focus .ql-fill,.ql-snow.ql-toolbar button.ql-active .ql-fill,.ql-snow .ql-toolbar button.ql-active .ql-fill,.ql-snow.ql-toolbar .ql-picker-label:hover .ql-fill,.ql-snow .ql-toolbar .ql-picker-label:hover .ql-fill,.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-fill,.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-fill,.ql-snow.ql-toolbar .ql-picker-item:hover .ql-fill,.ql-snow .ql-toolbar .ql-picker-item:hover .ql-fill,.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-fill,.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-fill,.ql-snow.ql-toolbar button:hover .ql-stroke.ql-fill,.ql-snow .ql-toolbar button:hover .ql-stroke.ql-fill,.ql-snow.ql-toolbar button:focus .ql-stroke.ql-fill,.ql-snow .ql-toolbar button:focus .ql-stroke.ql-fill,.ql-snow.ql-toolbar button.ql-active .ql-stroke.ql-fill,.ql-snow .ql-toolbar button.ql-active .ql-stroke.ql-fill,.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill,.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill,.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill,.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill,.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill,.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill,.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill,.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill{fill:#06c}.ql-snow.ql-toolbar button:hover .ql-stroke,.ql-snow .ql-toolbar button:hover .ql-stroke,.ql-snow.ql-toolbar button:focus .ql-stroke,.ql-snow .ql-toolbar button:focus .ql-stroke,.ql-snow.ql-toolbar button.ql-active .ql-stroke,.ql-snow .ql-toolbar button.ql-active .ql-stroke,.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke,.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke,.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke,.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke,.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke,.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke,.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke,.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke,.ql-snow.ql-toolbar button:hover .ql-stroke-miter,.ql-snow .ql-toolbar button:hover .ql-stroke-miter,.ql-snow.ql-toolbar button:focus .ql-stroke-miter,.ql-snow .ql-toolbar button:focus .ql-stroke-miter,.ql-snow.ql-toolbar button.ql-active .ql-stroke-miter,.ql-snow .ql-toolbar button.ql-active .ql-stroke-miter,.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke-miter,.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke-miter,.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter,.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter,.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke-miter,.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke-miter,.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter,.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter{stroke:#06c}@media(pointer:coarse){.ql-snow.ql-toolbar button:hover:not(.ql-active),.ql-snow .ql-toolbar button:hover:not(.ql-active){color:#444}.ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-fill,.ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-fill,.ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke.ql-fill,.ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke.ql-fill{fill:#444}.ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke,.ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke,.ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke-miter,.ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke-miter{stroke:#444}}.ql-snow,.ql-snow *{box-sizing:border-box}.ql-snow .ql-hidden{display:none}.ql-snow .ql-out-bottom,.ql-snow .ql-out-top{visibility:hidden}.ql-snow .ql-tooltip{position:absolute;transform:translateY(10px)}.ql-snow .ql-tooltip a{cursor:pointer;text-decoration:none}.ql-snow .ql-tooltip.ql-flip{transform:translateY(-10px)}.ql-snow .ql-formats{display:inline-block;vertical-align:middle}.ql-snow .ql-formats:after{clear:both;content:"";display:table}.ql-snow .ql-stroke{fill:none;stroke:#444;stroke-linecap:round;stroke-linejoin:round;stroke-width:2}.ql-snow .ql-stroke-miter{fill:none;stroke:#444;stroke-miterlimit:10;stroke-width:2}.ql-snow .ql-fill,.ql-snow .ql-stroke.ql-fill{fill:#444}.ql-snow .ql-empty{fill:none}.ql-snow .ql-even{fill-rule:evenodd}.ql-snow .ql-thin,.ql-snow .ql-stroke.ql-thin{stroke-width:1}.ql-snow .ql-transparent{opacity:.4}.ql-snow .ql-direction svg:last-child{display:none}.ql-snow .ql-direction.ql-active svg:last-child{display:inline}.ql-snow .ql-direction.ql-active svg:first-child{display:none}.ql-snow .ql-editor h1{font-size:2em}.ql-snow .ql-editor h2{font-size:1.5em}.ql-snow .ql-editor h3{font-size:1.17em}.ql-snow .ql-editor h4{font-size:1em}.ql-snow .ql-editor h5{font-size:.83em}.ql-snow .ql-editor h6{font-size:.67em}.ql-snow .ql-editor a{text-decoration:underline}.ql-snow .ql-editor blockquote{border-left:4px solid #ccc;margin-bottom:5px;margin-top:5px;padding-left:16px}.ql-snow .ql-editor code,.ql-snow .ql-editor pre{background-color:#f0f0f0;border-radius:3px}.ql-snow .ql-editor pre{white-space:pre-wrap;margin-bottom:5px;margin-top:5px;padding:5px 10px}.ql-snow .ql-editor code{font-size:85%;padding:2px 4px}.ql-snow .ql-editor pre.ql-syntax{background-color:#23241f;color:#f8f8f2;overflow:visible}.ql-snow .ql-editor img{max-width:100%}.ql-snow .ql-picker{color:#444;display:inline-block;float:left;font-size:14px;font-weight:500;height:24px;position:relative;vertical-align:middle}.ql-snow .ql-picker-label{cursor:pointer;display:inline-block;height:100%;padding-left:8px;padding-right:2px;position:relative;width:100%}.ql-snow .ql-picker-label:before{display:inline-block;line-height:22px}.ql-snow .ql-picker-options{background-color:#fff;display:none;min-width:100%;padding:4px 8px;position:absolute;white-space:nowrap}.ql-snow .ql-picker-options .ql-picker-item{cursor:pointer;display:block;padding-bottom:5px;padding-top:5px}.ql-snow .ql-picker.ql-expanded .ql-picker-label{color:#ccc;z-index:2}.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-fill{fill:#ccc}.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke{stroke:#ccc}.ql-snow .ql-picker.ql-expanded .ql-picker-options{display:block;margin-top:-1px;top:100%;z-index:1}.ql-snow .ql-color-picker,.ql-snow .ql-icon-picker{width:28px}.ql-snow .ql-color-picker .ql-picker-label,.ql-snow .ql-icon-picker .ql-picker-label{padding:2px 4px}.ql-snow .ql-color-picker .ql-picker-label svg,.ql-snow .ql-icon-picker .ql-picker-label svg{right:4px}.ql-snow .ql-icon-picker .ql-picker-options{padding:4px 0}.ql-snow .ql-icon-picker .ql-picker-item{height:24px;width:24px;padding:2px 4px}.ql-snow .ql-color-picker .ql-picker-options{padding:3px 5px;width:152px}.ql-snow .ql-color-picker .ql-picker-item{border:1px solid transparent;float:left;height:16px;margin:2px;padding:0;width:16px}.ql-snow .ql-picker:not(.ql-color-picker):not(.ql-icon-picker) svg{position:absolute;margin-top:-9px;right:0;top:50%;width:18px}.ql-snow .ql-picker.ql-header .ql-picker-label[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-font .ql-picker-label[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-size .ql-picker-label[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-font .ql-picker-item[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-size .ql-picker-item[data-label]:not([data-label=""]):before{content:attr(data-label)}.ql-snow .ql-picker.ql-header{width:98px}.ql-snow .ql-picker.ql-header .ql-picker-label:before,.ql-snow .ql-picker.ql-header .ql-picker-item:before{content:"Normal"}.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]:before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]:before{content:"Heading 1"}.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]:before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]:before{content:"Heading 2"}.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]:before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]:before{content:"Heading 3"}.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="4"]:before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]:before{content:"Heading 4"}.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="5"]:before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]:before{content:"Heading 5"}.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="6"]:before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]:before{content:"Heading 6"}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]:before{font-size:2em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]:before{font-size:1.5em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]:before{font-size:1.17em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]:before{font-size:1em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]:before{font-size:.83em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]:before{font-size:.67em}.ql-snow .ql-picker.ql-font{width:108px}.ql-snow .ql-picker.ql-font .ql-picker-label:before,.ql-snow .ql-picker.ql-font .ql-picker-item:before{content:"Sans Serif"}.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=serif]:before,.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]:before{content:"Serif"}.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=monospace]:before,.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]:before{content:"Monospace"}.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]:before{font-family:Georgia,Times New Roman,serif}.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]:before{font-family:Monaco,Courier New,monospace}.ql-snow .ql-picker.ql-size{width:98px}.ql-snow .ql-picker.ql-size .ql-picker-label:before,.ql-snow .ql-picker.ql-size .ql-picker-item:before{content:"Normal"}.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=small]:before,.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]:before{content:"Small"}.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=large]:before,.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]:before{content:"Large"}.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=huge]:before,.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]:before{content:"Huge"}.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]:before{font-size:10px}.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]:before{font-size:18px}.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]:before{font-size:32px}.ql-snow .ql-color-picker.ql-background .ql-picker-item{background-color:#fff}.ql-snow .ql-color-picker.ql-color .ql-picker-item{background-color:#000}.ql-toolbar.ql-snow{border:1px solid #ccc;box-sizing:border-box;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;padding:8px}.ql-toolbar.ql-snow .ql-formats{margin-right:15px}.ql-toolbar.ql-snow .ql-picker-label{border:1px solid transparent}.ql-toolbar.ql-snow .ql-picker-options{border:1px solid transparent;box-shadow:#0003 0 2px 8px}.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label,.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options{border-color:#ccc}.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item.ql-selected,.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item:hover{border-color:#000}.ql-toolbar.ql-snow+.ql-container.ql-snow{border-top:0px}.ql-snow .ql-tooltip{background-color:#fff;border:1px solid #ccc;box-shadow:0 0 5px #ddd;color:#444;padding:5px 12px;white-space:nowrap}.ql-snow .ql-tooltip:before{content:"Visit URL:";line-height:26px;margin-right:8px}.ql-snow .ql-tooltip input[type=text]{display:none;border:1px solid #ccc;font-size:13px;height:26px;margin:0;padding:3px 5px;width:170px}.ql-snow .ql-tooltip a.ql-preview{display:inline-block;max-width:200px;overflow-x:hidden;text-overflow:ellipsis;vertical-align:top}.ql-snow .ql-tooltip a.ql-action:after{border-right:1px solid #ccc;content:"Edit";margin-left:16px;padding-right:8px}.ql-snow .ql-tooltip a.ql-remove:before{content:"Remove";margin-left:8px}.ql-snow .ql-tooltip a{line-height:26px}.ql-snow .ql-tooltip.ql-editing a.ql-preview,.ql-snow .ql-tooltip.ql-editing a.ql-remove{display:none}.ql-snow .ql-tooltip.ql-editing input[type=text]{display:inline-block}.ql-snow .ql-tooltip.ql-editing a.ql-action:after{border-right:0px;content:"Save";padding-right:0}.ql-snow .ql-tooltip[data-mode=link]:before{content:"Enter link:"}.ql-snow .ql-tooltip[data-mode=formula]:before{content:"Enter formula:"}.ql-snow .ql-tooltip[data-mode=video]:before{content:"Enter video:"}.ql-snow a{color:#06c}.ql-container.ql-snow{border:1px solid #ccc}/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-content:""}}}@layer theme{:root,:host{--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-orange-50:oklch(98% .016 73.684);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-700:oklch(55.3% .195 38.402);--color-orange-800:oklch(47% .157 37.304);--color-orange-900:oklch(40.8% .123 38.172);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-800:oklch(47.6% .114 61.907);--color-lime-500:oklch(76.8% .233 130.85);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-emerald-900:oklch(37.8% .077 168.94);--color-teal-100:oklch(95.3% .051 180.801);--color-teal-500:oklch(70.4% .14 182.503);--color-teal-600:oklch(60% .118 184.704);--color-teal-700:oklch(51.1% .096 186.391);--color-teal-800:oklch(43.7% .078 188.216);--color-cyan-50:oklch(98.4% .019 200.873);--color-cyan-100:oklch(95.6% .045 203.388);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-700:oklch(52% .105 223.128);--color-cyan-800:oklch(45% .085 224.283);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-100:oklch(95.1% .026 236.824);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-700:oklch(50% .134 242.749);--color-sky-800:oklch(44.3% .11 240.79);--color-sky-900:oklch(39.1% .09 240.876);--color-sky-950:oklch(29.3% .066 243.157);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-indigo-800:oklch(39.8% .195 277.366);--color-violet-50:oklch(96.9% .016 293.756);--color-violet-100:oklch(94.3% .029 294.588);--color-violet-200:oklch(89.4% .057 293.283);--color-violet-500:oklch(60.6% .25 292.717);--color-violet-700:oklch(49.1% .27 292.581);--color-violet-800:oklch(43.2% .232 292.759);--color-violet-900:oklch(38% .189 293.745);--color-violet-950:oklch(28.3% .141 291.089);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-200:oklch(90.2% .063 306.703);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-700:oklch(49.6% .265 301.924);--color-purple-800:oklch(43.8% .218 303.724);--color-fuchsia-500:oklch(66.7% .295 322.15);--color-pink-100:oklch(94.8% .028 342.258);--color-pink-600:oklch(59.2% .249 .584);--color-pink-800:oklch(45.9% .187 3.815);--color-rose-50:oklch(96.9% .015 12.422);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-rose-700:oklch(51.4% .222 16.935);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-zinc-800:oklch(27.4% .006 286.033);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tighter:-.05em;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--radius-xs:.125rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--animate-bounce:bounce 1s infinite;--blur-sm:8px;--blur-md:12px;--blur-3xl:64px;--aspect-video:16 / 9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-montserrat);--default-mono-font-family:var(--font-montserrat);--font-montserrat:"Montserrat", sans-serif;--color-border:var(--border);--color-re-red:var(--re-red)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::-moz-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::-moz-placeholder{color:currentColor}::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::-moz-placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);font-family:var(--font-montserrat);outline-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){*{outline-color:color-mix(in oklab,var(--ring) 50%,transparent)}}body{background-color:var(--background);font-family:var(--font-montserrat);color:var(--foreground)}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h1{font-size:var(--text-2xl);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h2{font-size:var(--text-xl);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h3{font-size:var(--text-lg);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h4{font-size:var(--text-base);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) p{font-size:var(--text-base);font-weight:var(--font-weight-normal);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) label,:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) button{font-size:var(--text-base);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) input{font-size:var(--text-base);font-weight:var(--font-weight-normal);line-height:1.5}}@layer components;@layer utilities{.\@container\/card-header{container:card-header/inline-size}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.-top-0\.5{top:calc(var(--spacing) * -.5)}.-top-1{top:calc(var(--spacing) * -1)}.-top-3{top:calc(var(--spacing) * -3)}.-top-12{top:calc(var(--spacing) * -12)}.-top-40{top:calc(var(--spacing) * -40)}.top-0{top:calc(var(--spacing) * 0)}.top-0\.5{top:calc(var(--spacing) * .5)}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-3\.5{top:calc(var(--spacing) * 3.5)}.top-4{top:calc(var(--spacing) * 4)}.top-6{top:calc(var(--spacing) * 6)}.top-10{top:calc(var(--spacing) * 10)}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.-right-0\.5{right:calc(var(--spacing) * -.5)}.-right-1{right:calc(var(--spacing) * -1)}.-right-3{right:calc(var(--spacing) * -3)}.-right-12{right:calc(var(--spacing) * -12)}.-right-40{right:calc(var(--spacing) * -40)}.right-0{right:calc(var(--spacing) * 0)}.right-0\.5{right:calc(var(--spacing) * .5)}.right-1{right:calc(var(--spacing) * 1)}.right-2{right:calc(var(--spacing) * 2)}.right-2\.5{right:calc(var(--spacing) * 2.5)}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.-bottom-12{bottom:calc(var(--spacing) * -12)}.-bottom-40{bottom:calc(var(--spacing) * -40)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-0\.5{bottom:calc(var(--spacing) * .5)}.bottom-12{bottom:calc(var(--spacing) * 12)}.bottom-\[-1px\]{bottom:-1px}.bottom-\[-24px\]{bottom:-24px}.bottom-full{bottom:100%}.-left-12{left:calc(var(--spacing) * -12)}.-left-40{left:calc(var(--spacing) * -40)}.left-0{left:calc(var(--spacing) * 0)}.left-1{left:calc(var(--spacing) * 1)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing) * 2)}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-4{left:calc(var(--spacing) * 4)}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[1\]{z-index:1}.z-\[100\]{z-index:100}.z-\[9999\]{z-index:9999}.order-1{order:1}.order-2{order:2}.col-span-1{grid-column:span 1/span 1}.col-span-2{grid-column:span 2/span 2}.col-span-3{grid-column:span 3/span 3}.col-span-4{grid-column:span 4/span 4}.col-span-5{grid-column:span 5/span 5}.col-span-6{grid-column:span 6/span 6}.col-span-full{grid-column:1/-1}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2/span 2}.row-start-1{grid-row-start:1}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.-mx-4{margin-inline:calc(var(--spacing) * -4)}.-mx-6{margin-inline:calc(var(--spacing) * -6)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-3\.5{margin-inline:calc(var(--spacing) * 3.5)}.mx-auto{margin-inline:auto}.my-0\.5{margin-block:calc(var(--spacing) * .5)}.my-1{margin-block:calc(var(--spacing) * 1)}.my-4{margin-block:calc(var(--spacing) * 4)}.my-8{margin-block:calc(var(--spacing) * 8)}.-mt-4{margin-top:calc(var(--spacing) * -4)}.mt-0{margin-top:calc(var(--spacing) * 0)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mt-10{margin-top:calc(var(--spacing) * 10)}.mt-auto{margin-top:auto}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-3{margin-right:calc(var(--spacing) * 3)}.-mb-6{margin-bottom:calc(var(--spacing) * -6)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-7{margin-bottom:calc(var(--spacing) * 7)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.mb-10{margin-bottom:calc(var(--spacing) * 10)}.mb-12{margin-bottom:calc(var(--spacing) * 12)}.-ml-4{margin-left:calc(var(--spacing) * -4)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-5{margin-left:calc(var(--spacing) * 5)}.ml-6{margin-left:calc(var(--spacing) * 6)}.ml-8{margin-left:calc(var(--spacing) * 8)}.ml-9{margin-left:calc(var(--spacing) * 9)}.ml-11{margin-left:calc(var(--spacing) * 11)}.ml-auto{margin-left:auto}.line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-row{display:table-row}.field-sizing-content{field-sizing:content}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.size-12{width:calc(var(--spacing) * 12);height:calc(var(--spacing) * 12)}.size-full{width:100%;height:100%}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1{height:calc(var(--spacing) * 1)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-4\.5{height:calc(var(--spacing) * 4.5)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-32{height:calc(var(--spacing) * 32)}.h-40{height:calc(var(--spacing) * 40)}.h-48{height:calc(var(--spacing) * 48)}.h-64{height:calc(var(--spacing) * 64)}.h-80{height:calc(var(--spacing) * 80)}.h-96{height:calc(var(--spacing) * 96)}.h-\[1\.15rem\]{height:1.15rem}.h-\[30rem\]{height:30rem}.h-\[44px\]{height:44px}.h-\[70vh\]{height:70vh}.h-\[85vh\]{height:85vh}.h-\[90vh\]{height:90vh}.h-\[400px\]{height:400px}.h-\[calc\(100\%-1px\)\]{height:calc(100% - 1px)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.h-svh{height:100svh}.max-h-\(--radix-context-menu-content-available-height\){max-height:var(--radix-context-menu-content-available-height)}.max-h-\(--radix-dropdown-menu-content-available-height\){max-height:var(--radix-dropdown-menu-content-available-height)}.max-h-\(--radix-select-content-available-height\){max-height:var(--radix-select-content-available-height)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-56{max-height:calc(var(--spacing) * 56)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[70vh\]{max-height:70vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[95vh\]{max-height:95vh}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[600px\]{max-height:600px}.max-h-\[800px\]{max-height:800px}.max-h-full{max-height:100%}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-4{min-height:calc(var(--spacing) * 4)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-\[32px\]{min-height:32px}.min-h-\[44px\]{min-height:44px}.min-h-\[60px\]{min-height:60px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[80px\]{min-height:80px}.min-h-\[96px\]{min-height:96px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[150px\]{min-height:150px}.min-h-\[320px\]{min-height:320px}.min-h-\[400px\]{min-height:400px}.min-h-\[420px\]{min-height:420px}.min-h-\[480px\]{min-height:480px}.min-h-\[600px\]{min-height:600px}.min-h-screen{min-height:100vh}.min-h-svh{min-height:100svh}.\!w-\[80vw\]{width:80vw!important}.w-\(--sidebar-width\){width:var(--sidebar-width)}.w-0{width:calc(var(--spacing) * 0)}.w-0\.5{width:calc(var(--spacing) * .5)}.w-1{width:calc(var(--spacing) * 1)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-3\/4{width:75%}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-64{width:calc(var(--spacing) * 64)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-\[10\%\]{width:10%}.w-\[15\%\]{width:15%}.w-\[20\%\]{width:20%}.w-\[35\%\]{width:35%}.w-\[45\%\]{width:45%}.w-\[50px\]{width:50px}.w-\[100px\]{width:100px}.w-\[200px\]{width:200px}.w-\[280px\]{width:280px}.w-\[360px\]{width:360px}.w-\[calc\(100\%-2rem\)\]{width:calc(100% - 2rem)}.w-\[var\(--radix-select-trigger-width\)\]{width:var(--radix-select-trigger-width)}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.\!max-w-\[80vw\]{max-width:80vw!important}.max-w-\(--skeleton-width\){max-width:var(--skeleton-width)}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[90vw\]{max-width:90vw}.max-w-\[95vw\]{max-width:95vw}.max-w-\[140px\]{max-width:140px}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[250px\]{max-width:250px}.max-w-\[1240px\]{max-width:1240px}.max-w-\[1600px\]{max-width:1600px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-\[min\(85\%\,36rem\)\]{max-width:min(85%,36rem)}.max-w-\[min\(100\%\,42rem\)\]{max-width:min(100%,42rem)}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-8{min-width:calc(var(--spacing) * 8)}.min-w-9{min-width:calc(var(--spacing) * 9)}.min-w-10{min-width:calc(var(--spacing) * 10)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[12rem\]{min-width:12rem}.min-w-\[60px\]{min-width:60px}.min-w-\[80px\]{min-width:80px}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[150px\]{min-width:150px}.min-w-\[180px\]{min-width:180px}.min-w-\[200px\]{min-width:200px}.min-w-\[300px\]{min-width:300px}.min-w-\[900px\]{min-width:900px}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.table-auto{table-layout:auto}.table-fixed{table-layout:fixed}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\(--radix-context-menu-content-transform-origin\){transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\(--radix-dropdown-menu-content-transform-origin\){transform-origin:var(--radix-dropdown-menu-content-transform-origin)}.origin-\(--radix-hover-card-content-transform-origin\){transform-origin:var(--radix-hover-card-content-transform-origin)}.origin-\(--radix-menubar-content-transform-origin\){transform-origin:var(--radix-menubar-content-transform-origin)}.origin-\(--radix-popover-content-transform-origin\){transform-origin:var(--radix-popover-content-transform-origin)}.origin-\(--radix-select-content-transform-origin\){transform-origin:var(--radix-select-content-transform-origin)}.origin-\(--radix-tooltip-content-transform-origin\){transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-px{--tw-translate-x:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-\[-50\%\]{--tw-translate-x:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-px{--tw-translate-x:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-0\.5{--tw-translate-y:calc(var(--spacing) * .5);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[-50\%\]{--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[calc\(-50\%_-_2px\)\]{--tw-translate-y: calc(-50% - 2px) ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-45{rotate:45deg}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\[loading_1\.5s_infinite_linear\]{animation:1.5s linear infinite loading}.animate-bounce{animation:var(--animate-bounce)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize-none{resize:none}.resize-y{resize:vertical}.scroll-my-1{scroll-margin-block:calc(var(--spacing) * 1)}.scroll-py-1{scroll-padding-block:calc(var(--spacing) * 1)}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.\[appearance\:textfield\]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.auto-rows-min{grid-auto-rows:min-content}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-\[0_1fr\]{grid-template-columns:0 1fr}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.justify-items-start{justify-items:start}.gap-0{gap:calc(var(--spacing) * 0)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-10{gap:calc(var(--spacing) * 10)}.gap-12{gap:calc(var(--spacing) * 12)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 0) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 0) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-10>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 10) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 10) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{-moz-column-gap:calc(var(--spacing) * 2);column-gap:calc(var(--spacing) * 2)}.gap-x-3{-moz-column-gap:calc(var(--spacing) * 3);column-gap:calc(var(--spacing) * 3)}.gap-x-6{-moz-column-gap:calc(var(--spacing) * 6);column-gap:calc(var(--spacing) * 6)}.gap-x-8{-moz-column-gap:calc(var(--spacing) * 8);column-gap:calc(var(--spacing) * 8)}.gap-x-10{-moz-column-gap:calc(var(--spacing) * 10);column-gap:calc(var(--spacing) * 10)}:where(.-space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * -2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * -2) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-1>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 1) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-3>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 3) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-4>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 4) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-x-reverse)))}.gap-y-0\.5{row-gap:calc(var(--spacing) * .5)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-4{row-gap:calc(var(--spacing) * 4)}.gap-y-6{row-gap:calc(var(--spacing) * 6)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-100>:not(:last-child)){border-color:var(--color-gray-100)}:where(.divide-slate-50>:not(:last-child)){border-color:var(--color-slate-50)}:where(.divide-slate-100>:not(:last-child)){border-color:var(--color-slate-100)}.self-center{align-self:center}.self-start{align-self:flex-start}.self-stretch{align-self:stretch}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\[2px\]{border-radius:2px}.rounded-\[4px\]{border-radius:4px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-xs{border-radius:var(--radius-xs)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.rounded-tl-none{border-top-left-radius:0}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-tr-none{border-top-right-radius:0}.rounded-b-lg{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-8{border-style:var(--tw-border-style);border-width:8px}.border-\[1\.5px\]{border-style:var(--tw-border-style);border-width:1.5px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-t-4{border-top-style:var(--tw-border-style);border-top-width:4px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-b-4{border-bottom-style:var(--tw-border-style);border-bottom-width:4px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-none{--tw-border-style:none;border-style:none}.border-\(--color-border\){border-color:var(--color-border)}.border-\[\#cccccc\]{border-color:#ccc}.border-amber-100{border-color:var(--color-amber-100)}.border-amber-100\/50{border-color:#fef3c680}@supports (color:color-mix(in lab,red,red)){.border-amber-100\/50{border-color:color-mix(in oklab,var(--color-amber-100) 50%,transparent)}}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-300{border-color:var(--color-amber-300)}.border-amber-400{border-color:var(--color-amber-400)}.border-amber-500{border-color:var(--color-amber-500)}.border-amber-600{border-color:var(--color-amber-600)}.border-blue-100{border-color:var(--color-blue-100)}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-300{border-color:var(--color-blue-300)}.border-blue-400{border-color:var(--color-blue-400)}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-600{border-color:var(--color-blue-600)}.border-blue-700{border-color:var(--color-blue-700)}.border-border,.border-border\/50{border-color:var(--border)}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,var(--border) 50%,transparent)}}.border-cyan-300{border-color:var(--color-cyan-300)}.border-emerald-100{border-color:var(--color-emerald-100)}.border-emerald-200{border-color:var(--color-emerald-200)}.border-emerald-400{border-color:var(--color-emerald-400)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-green-100{border-color:var(--color-green-100)}.border-green-200{border-color:var(--color-green-200)}.border-green-300{border-color:var(--color-green-300)}.border-green-400{border-color:var(--color-green-400)}.border-green-500{border-color:var(--color-green-500)}.border-green-600{border-color:var(--color-green-600)}.border-indigo-200{border-color:var(--color-indigo-200)}.border-indigo-300{border-color:var(--color-indigo-300)}.border-input{border-color:var(--input)}.border-orange-200{border-color:var(--color-orange-200)}.border-orange-300{border-color:var(--color-orange-300)}.border-primary{border-color:var(--primary)}.border-purple-100{border-color:var(--color-purple-100)}.border-purple-200{border-color:var(--color-purple-200)}.border-purple-300{border-color:var(--color-purple-300)}.border-re-red{border-color:var(--re-red)}.border-red-50{border-color:var(--color-red-50)}.border-red-100{border-color:var(--color-red-100)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-red-400{border-color:var(--color-red-400)}.border-red-500{border-color:var(--color-red-500)}.border-red-600{border-color:var(--color-red-600)}.border-rose-100{border-color:var(--color-rose-100)}.border-sidebar-border{border-color:var(--sidebar-border)}.border-sky-200{border-color:var(--color-sky-200)}.border-slate-50{border-color:var(--color-slate-50)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-200\/50{border-color:#e2e8f080}@supports (color:color-mix(in lab,red,red)){.border-slate-200\/50{border-color:color-mix(in oklab,var(--color-slate-200) 50%,transparent)}}.border-slate-200\/90{border-color:#e2e8f0e6}@supports (color:color-mix(in lab,red,red)){.border-slate-200\/90{border-color:color-mix(in oklab,var(--color-slate-200) 90%,transparent)}}.border-slate-300{border-color:var(--color-slate-300)}.border-slate-400{border-color:var(--color-slate-400)}.border-slate-700{border-color:var(--color-slate-700)}.border-slate-700\/50{border-color:#31415880}@supports (color:color-mix(in lab,red,red)){.border-slate-700\/50{border-color:color-mix(in oklab,var(--color-slate-700) 50%,transparent)}}.border-slate-800{border-color:var(--color-slate-800)}.border-teal-500{border-color:var(--color-teal-500)}.border-transparent{border-color:#0000}.border-violet-200{border-color:var(--color-violet-200)}.border-white{border-color:var(--color-white)}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.border-white\/30{border-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.border-white\/30{border-color:color-mix(in oklab,var(--color-white) 30%,transparent)}}.border-yellow-200{border-color:var(--color-yellow-200)}.border-yellow-300{border-color:var(--color-yellow-300)}.border-t-slate-900{border-top-color:var(--color-slate-900)}.border-t-transparent{border-top-color:#0000}.border-t-white{border-top-color:var(--color-white)}.border-l-amber-500{border-left-color:var(--color-amber-500)}.border-l-green-500{border-left-color:var(--color-green-500)}.border-l-red-500{border-left-color:var(--color-red-500)}.border-l-transparent{border-left-color:#0000}.bg-\(--color-bg\){background-color:var(--color-bg)}.bg-accent{background-color:var(--accent)}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-50\/20{background-color:#fffbeb33}@supports (color:color-mix(in lab,red,red)){.bg-amber-50\/20{background-color:color-mix(in oklab,var(--color-amber-50) 20%,transparent)}}.bg-amber-50\/30{background-color:#fffbeb4d}@supports (color:color-mix(in lab,red,red)){.bg-amber-50\/30{background-color:color-mix(in oklab,var(--color-amber-50) 30%,transparent)}}.bg-amber-50\/50{background-color:#fffbeb80}@supports (color:color-mix(in lab,red,red)){.bg-amber-50\/50{background-color:color-mix(in oklab,var(--color-amber-50) 50%,transparent)}}.bg-amber-50\/80{background-color:#fffbebcc}@supports (color:color-mix(in lab,red,red)){.bg-amber-50\/80{background-color:color-mix(in oklab,var(--color-amber-50) 80%,transparent)}}.bg-amber-100{background-color:var(--color-amber-100)}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.bg-amber-600{background-color:var(--color-amber-600)}.bg-amber-600\/10{background-color:#dd74001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-600\/10{background-color:color-mix(in oklab,var(--color-amber-600) 10%,transparent)}}.bg-amber-600\/20{background-color:#dd740033}@supports (color:color-mix(in lab,red,red)){.bg-amber-600\/20{background-color:color-mix(in oklab,var(--color-amber-600) 20%,transparent)}}.bg-background{background-color:var(--background)}.bg-black{background-color:var(--color-black)}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-50\/30{background-color:#eff6ff4d}@supports (color:color-mix(in lab,red,red)){.bg-blue-50\/30{background-color:color-mix(in oklab,var(--color-blue-50) 30%,transparent)}}.bg-blue-50\/50{background-color:#eff6ff80}@supports (color:color-mix(in lab,red,red)){.bg-blue-50\/50{background-color:color-mix(in oklab,var(--color-blue-50) 50%,transparent)}}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-200{background-color:var(--color-blue-200)}.bg-blue-300{background-color:var(--color-blue-300)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-current{background-color:currentColor}.bg-cyan-100{background-color:var(--color-cyan-100)}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-destructive{background-color:var(--destructive)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-50\/40{background-color:#ecfdf566}@supports (color:color-mix(in lab,red,red)){.bg-emerald-50\/40{background-color:color-mix(in oklab,var(--color-emerald-50) 40%,transparent)}}.bg-emerald-50\/90{background-color:#ecfdf5e6}@supports (color:color-mix(in lab,red,red)){.bg-emerald-50\/90{background-color:color-mix(in oklab,var(--color-emerald-50) 90%,transparent)}}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.bg-emerald-600{background-color:var(--color-emerald-600)}.bg-foreground{background-color:var(--foreground)}.bg-fuchsia-500{background-color:var(--color-fuchsia-500)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-50\/30{background-color:#f0fdf44d}@supports (color:color-mix(in lab,red,red)){.bg-green-50\/30{background-color:color-mix(in oklab,var(--color-green-50) 30%,transparent)}}.bg-green-50\/50{background-color:#f0fdf480}@supports (color:color-mix(in lab,red,red)){.bg-green-50\/50{background-color:color-mix(in oklab,var(--color-green-50) 50%,transparent)}}.bg-green-100{background-color:var(--color-green-100)}.bg-green-200{background-color:var(--color-green-200)}.bg-green-300{background-color:var(--color-green-300)}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/30{background-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/30{background-color:color-mix(in oklab,var(--color-green-500) 30%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-green-700{background-color:var(--color-green-700)}.bg-indigo-50{background-color:var(--color-indigo-50)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-500{background-color:var(--color-indigo-500)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-input-background{background-color:var(--input-background)}.bg-lime-500{background-color:var(--color-lime-500)}.bg-muted,.bg-muted\/50{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.bg-muted\/50{background-color:color-mix(in oklab,var(--muted) 50%,transparent)}}.bg-orange-50{background-color:var(--color-orange-50)}.bg-orange-50\/30{background-color:#fff7ed4d}@supports (color:color-mix(in lab,red,red)){.bg-orange-50\/30{background-color:color-mix(in oklab,var(--color-orange-50) 30%,transparent)}}.bg-orange-100{background-color:var(--color-orange-100)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-600{background-color:var(--color-orange-600)}.bg-pink-100{background-color:var(--color-pink-100)}.bg-pink-600{background-color:var(--color-pink-600)}.bg-popover{background-color:var(--popover)}.bg-primary,.bg-primary\/20{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.bg-primary\/20{background-color:color-mix(in oklab,var(--primary) 20%,transparent)}}.bg-purple-50{background-color:var(--color-purple-50)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-purple-500{background-color:var(--color-purple-500)}.bg-purple-600{background-color:var(--color-purple-600)}.bg-re-black{background-color:var(--re-black)}.bg-re-red,.bg-re-red\/20{background-color:var(--re-red)}@supports (color:color-mix(in lab,red,red)){.bg-re-red\/20{background-color:color-mix(in oklab,var(--re-red) 20%,transparent)}}.bg-red-50{background-color:var(--color-red-50)}.bg-red-50\/30{background-color:#fef2f24d}@supports (color:color-mix(in lab,red,red)){.bg-red-50\/30{background-color:color-mix(in oklab,var(--color-red-50) 30%,transparent)}}.bg-red-50\/40{background-color:#fef2f266}@supports (color:color-mix(in lab,red,red)){.bg-red-50\/40{background-color:color-mix(in oklab,var(--color-red-50) 40%,transparent)}}.bg-red-50\/50{background-color:#fef2f280}@supports (color:color-mix(in lab,red,red)){.bg-red-50\/50{background-color:color-mix(in oklab,var(--color-red-50) 50%,transparent)}}.bg-red-50\/90{background-color:#fef2f2e6}@supports (color:color-mix(in lab,red,red)){.bg-red-50\/90{background-color:color-mix(in oklab,var(--color-red-50) 90%,transparent)}}.bg-red-100{background-color:var(--color-red-100)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-600{background-color:var(--color-red-600)}.bg-red-600\/20{background-color:#e4001433}@supports (color:color-mix(in lab,red,red)){.bg-red-600\/20{background-color:color-mix(in oklab,var(--color-red-600) 20%,transparent)}}.bg-red-700{background-color:var(--color-red-700)}.bg-red-700\/15{background-color:#bf000f26}@supports (color:color-mix(in lab,red,red)){.bg-red-700\/15{background-color:color-mix(in oklab,var(--color-red-700) 15%,transparent)}}.bg-rose-50{background-color:var(--color-rose-50)}.bg-rose-500\/20{background-color:#ff235733}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/20{background-color:color-mix(in oklab,var(--color-rose-500) 20%,transparent)}}.bg-secondary{background-color:var(--secondary)}.bg-sidebar{background-color:var(--sidebar)}.bg-sidebar-border{background-color:var(--sidebar-border)}.bg-sky-50{background-color:var(--color-sky-50)}.bg-sky-50\/80{background-color:#f0f9ffcc}@supports (color:color-mix(in lab,red,red)){.bg-sky-50\/80{background-color:color-mix(in oklab,var(--color-sky-50) 80%,transparent)}}.bg-sky-50\/90{background-color:#f0f9ffe6}@supports (color:color-mix(in lab,red,red)){.bg-sky-50\/90{background-color:color-mix(in oklab,var(--color-sky-50) 90%,transparent)}}.bg-sky-100{background-color:var(--color-sky-100)}.bg-sky-500{background-color:var(--color-sky-500)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-50\/30{background-color:#f8fafc4d}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/30{background-color:color-mix(in oklab,var(--color-slate-50) 30%,transparent)}}.bg-slate-50\/40{background-color:#f8fafc66}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/40{background-color:color-mix(in oklab,var(--color-slate-50) 40%,transparent)}}.bg-slate-50\/50{background-color:#f8fafc80}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/50{background-color:color-mix(in oklab,var(--color-slate-50) 50%,transparent)}}.bg-slate-50\/80{background-color:#f8fafccc}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/80{background-color:color-mix(in oklab,var(--color-slate-50) 80%,transparent)}}.bg-slate-50\/95{background-color:#f8fafcf2}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/95{background-color:color-mix(in oklab,var(--color-slate-50) 95%,transparent)}}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-100\/80{background-color:#f1f5f9cc}@supports (color:color-mix(in lab,red,red)){.bg-slate-100\/80{background-color:color-mix(in oklab,var(--color-slate-100) 80%,transparent)}}.bg-slate-200{background-color:var(--color-slate-200)}.bg-slate-300{background-color:var(--color-slate-300)}.bg-slate-400{background-color:var(--color-slate-400)}.bg-slate-500{background-color:var(--color-slate-500)}.bg-slate-700{background-color:var(--color-slate-700)}.bg-slate-700\/50{background-color:#31415880}@supports (color:color-mix(in lab,red,red)){.bg-slate-700\/50{background-color:color-mix(in oklab,var(--color-slate-700) 50%,transparent)}}.bg-slate-800{background-color:var(--color-slate-800)}.bg-slate-800\/50{background-color:#1d293d80}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/50{background-color:color-mix(in oklab,var(--color-slate-800) 50%,transparent)}}.bg-slate-900{background-color:var(--color-slate-900)}.bg-slate-900\/5{background-color:#0f172b0d}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/5{background-color:color-mix(in oklab,var(--color-slate-900) 5%,transparent)}}.bg-slate-900\/20{background-color:#0f172b33}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/20{background-color:color-mix(in oklab,var(--color-slate-900) 20%,transparent)}}.bg-slate-950{background-color:var(--color-slate-950)}.bg-teal-100{background-color:var(--color-teal-100)}.bg-teal-500{background-color:var(--color-teal-500)}.bg-teal-600{background-color:var(--color-teal-600)}.bg-transparent{background-color:#0000}.bg-violet-50\/80{background-color:#f5f3ffcc}@supports (color:color-mix(in lab,red,red)){.bg-violet-50\/80{background-color:color-mix(in oklab,var(--color-violet-50) 80%,transparent)}}.bg-violet-50\/90{background-color:#f5f3ffe6}@supports (color:color-mix(in lab,red,red)){.bg-violet-50\/90{background-color:color-mix(in oklab,var(--color-violet-50) 90%,transparent)}}.bg-violet-100{background-color:var(--color-violet-100)}.bg-violet-500{background-color:var(--color-violet-500)}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white) 20%,transparent)}}.bg-white\/40{background-color:#fff6}@supports (color:color-mix(in lab,red,red)){.bg-white\/40{background-color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.bg-white\/50{background-color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.bg-white\/50{background-color:color-mix(in oklab,var(--color-white) 50%,transparent)}}.bg-white\/60{background-color:#fff9}@supports (color:color-mix(in lab,red,red)){.bg-white\/60{background-color:color-mix(in oklab,var(--color-white) 60%,transparent)}}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\/80{background-color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.bg-yellow-50\/30{background-color:#fefce84d}@supports (color:color-mix(in lab,red,red)){.bg-yellow-50\/30{background-color:color-mix(in oklab,var(--color-yellow-50) 30%,transparent)}}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-yellow-500{background-color:var(--color-yellow-500)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-amber-50{--tw-gradient-from:var(--color-amber-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-amber-500{--tw-gradient-from:var(--color-amber-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-amber-600\/20{--tw-gradient-from:#dd740033}@supports (color:color-mix(in lab,red,red)){.from-amber-600\/20{--tw-gradient-from:color-mix(in oklab, var(--color-amber-600) 20%, transparent)}}.from-amber-600\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-50{--tw-gradient-from:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-green-50{--tw-gradient-from:var(--color-green-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-green-600{--tw-gradient-from:var(--color-green-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-50{--tw-gradient-from:var(--color-purple-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-600{--tw-gradient-from:var(--color-purple-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-600{--tw-gradient-from:var(--color-red-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-600\/20{--tw-gradient-from:#e4001433}@supports (color:color-mix(in lab,red,red)){.from-red-600\/20{--tw-gradient-from:color-mix(in oklab, var(--color-red-600) 20%, transparent)}}.from-red-600\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-slate-900{--tw-gradient-from:var(--color-slate-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-white{--tw-gradient-from:var(--color-white);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-slate-800{--tw-gradient-via:var(--color-slate-800);--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-amber-600{--tw-gradient-to:var(--color-amber-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-50{--tw-gradient-to:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-50{--tw-gradient-to:var(--color-cyan-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-50{--tw-gradient-to:var(--color-emerald-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-green-500{--tw-gradient-to:var(--color-green-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-50{--tw-gradient-to:var(--color-indigo-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-600{--tw-gradient-to:var(--color-indigo-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-50{--tw-gradient-to:var(--color-orange-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-red-500{--tw-gradient-to:var(--color-red-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-red-700{--tw-gradient-to:var(--color-red-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-50{--tw-gradient-to:var(--color-slate-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-50\/50{--tw-gradient-to:#f8fafc80}@supports (color:color-mix(in lab,red,red)){.to-slate-50\/50{--tw-gradient-to:color-mix(in oklab, var(--color-slate-50) 50%, transparent)}}.to-slate-50\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-800{--tw-gradient-to:var(--color-slate-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-900{--tw-gradient-to:var(--color-slate-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.fill-current{fill:currentColor}.fill-primary{fill:var(--primary)}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-7{padding:calc(var(--spacing) * 7)}.p-8{padding:calc(var(--spacing) * 8)}.p-10{padding:calc(var(--spacing) * 10)}.p-12{padding:calc(var(--spacing) * 12)}.p-20{padding:calc(var(--spacing) * 20)}.p-\[3px\]{padding:3px}.p-px{padding:1px}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.px-10{padding-inline:calc(var(--spacing) * 10)}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-16{padding-block:calc(var(--spacing) * 16)}.py-20{padding-block:calc(var(--spacing) * 20)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-10{padding-top:calc(var(--spacing) * 10)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pr-6{padding-right:calc(var(--spacing) * 6)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-2\.5{padding-bottom:calc(var(--spacing) * 2.5)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pb-8{padding-bottom:calc(var(--spacing) * 8)}.pb-24{padding-bottom:calc(var(--spacing) * 24)}.pl-1{padding-left:calc(var(--spacing) * 1)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-6{padding-left:calc(var(--spacing) * 6)}.pl-7{padding-left:calc(var(--spacing) * 7)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.pl-10{padding-left:calc(var(--spacing) * 10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--font-montserrat)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[0\.8rem\]{font-size:.8rem}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[28px\]{font-size:28px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.1em\]{--tw-tracking:.1em;letter-spacing:.1em}.tracking-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-tighter{--tw-tracking:var(--tracking-tighter);letter-spacing:var(--tracking-tighter)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#333333\]{color:#333}.text-\[\#666666\]{color:#666}.text-accent-foreground{color:var(--accent-foreground)}.text-amber-100{color:var(--color-amber-100)}.text-amber-100\/80{color:#fef3c6cc}@supports (color:color-mix(in lab,red,red)){.text-amber-100\/80{color:color-mix(in oklab,var(--color-amber-100) 80%,transparent)}}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-amber-800\/80{color:#953d00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-800\/80{color:color-mix(in oklab,var(--color-amber-800) 80%,transparent)}}.text-amber-900{color:var(--color-amber-900)}.text-black{color:var(--color-black)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-blue-900{color:var(--color-blue-900)}.text-card-foreground{color:var(--card-foreground)}.text-current{color:currentColor}.text-cyan-700{color:var(--color-cyan-700)}.text-cyan-800{color:var(--color-cyan-800)}.text-destructive{color:var(--destructive)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-emerald-800{color:var(--color-emerald-800)}.text-emerald-900{color:var(--color-emerald-900)}.text-foreground{color:var(--foreground)}.text-gray-300{color:var(--color-gray-300)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-green-900{color:var(--color-green-900)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-indigo-800{color:var(--color-indigo-800)}.text-muted-foreground{color:var(--muted-foreground)}.text-orange-600{color:var(--color-orange-600)}.text-orange-700{color:var(--color-orange-700)}.text-orange-800{color:var(--color-orange-800)}.text-orange-900{color:var(--color-orange-900)}.text-pink-800{color:var(--color-pink-800)}.text-popover-foreground{color:var(--popover-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-purple-600{color:var(--color-purple-600)}.text-purple-700{color:var(--color-purple-700)}.text-purple-800{color:var(--color-purple-800)}.text-re-red{color:var(--re-red)}.text-red-100{color:var(--color-red-100)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-red-900{color:var(--color-red-900)}.text-rose-400{color:var(--color-rose-400)}.text-rose-700{color:var(--color-rose-700)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-sidebar-foreground,.text-sidebar-foreground\/70{color:var(--sidebar-foreground)}@supports (color:color-mix(in lab,red,red)){.text-sidebar-foreground\/70{color:color-mix(in oklab,var(--sidebar-foreground) 70%,transparent)}}.text-sky-700{color:var(--color-sky-700)}.text-sky-800{color:var(--color-sky-800)}.text-sky-900{color:var(--color-sky-900)}.text-sky-900\/90{color:#024a70e6}@supports (color:color-mix(in lab,red,red)){.text-sky-900\/90{color:color-mix(in oklab,var(--color-sky-900) 90%,transparent)}}.text-sky-950{color:var(--color-sky-950)}.text-slate-200{color:var(--color-slate-200)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-teal-700{color:var(--color-teal-700)}.text-teal-800{color:var(--color-teal-800)}.text-violet-700{color:var(--color-violet-700)}.text-violet-800{color:var(--color-violet-800)}.text-violet-900{color:var(--color-violet-900)}.text-violet-900\/90{color:#4d179ae6}@supports (color:color-mix(in lab,red,red)){.text-violet-900\/90{color:color-mix(in oklab,var(--color-violet-900) 90%,transparent)}}.text-violet-950{color:var(--color-violet-950)}.text-white{color:var(--color-white)}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white) 70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.text-yellow-600{color:var(--color-yellow-600)}.text-yellow-700{color:var(--color-yellow-700)}.text-yellow-800{color:var(--color-yellow-800)}.capitalize{text-transform:capitalize}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.decoration-amber-500{text-decoration-color:var(--color-amber-500)}.decoration-2{text-decoration-thickness:2px}.underline-offset-4{text-underline-offset:4px}.accent-slate-900{accent-color:var(--color-slate-900)}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_-4px_10px_-5px_rgba\(0\,0\,0\,0\.05\)\]{--tw-shadow:0 -4px 10px -5px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,hsl(var(--sidebar-border)));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_8px_rgba\(34\,197\,94\,0\.4\)\]{--tw-shadow:0 0 8px var(--tw-shadow-color,#22c55e66);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_40px_rgba\(220\,38\,38\,0\.2\)\]{--tw-shadow:0 0 40px var(--tw-shadow-color,#dc262633);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_40px_rgba\(245\,158\,11\,0\.2\)\]{--tw-shadow:0 0 40px var(--tw-shadow-color,#f59e0b33);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-amber-200{--tw-shadow-color:oklch(92.4% .12 95.746)}@supports (color:color-mix(in lab,red,red)){.shadow-amber-200{--tw-shadow-color:color-mix(in oklab, var(--color-amber-200) var(--tw-shadow-alpha), transparent)}}.shadow-amber-200\/50{--tw-shadow-color:#fee68580}@supports (color:color-mix(in lab,red,red)){.shadow-amber-200\/50{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-200) 50%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-amber-600\/10{--tw-shadow-color:#dd74001a}@supports (color:color-mix(in lab,red,red)){.shadow-amber-600\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-600) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-amber-600\/15{--tw-shadow-color:#dd740026}@supports (color:color-mix(in lab,red,red)){.shadow-amber-600\/15{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-600) 15%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-green-100{--tw-shadow-color:oklch(96.2% .044 156.743)}@supports (color:color-mix(in lab,red,red)){.shadow-green-100{--tw-shadow-color:color-mix(in oklab, var(--color-green-100) var(--tw-shadow-alpha), transparent)}}.shadow-green-600\/20{--tw-shadow-color:#00a54433}@supports (color:color-mix(in lab,red,red)){.shadow-green-600\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-green-600) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-purple-200{--tw-shadow-color:oklch(90.2% .063 306.703)}@supports (color:color-mix(in lab,red,red)){.shadow-purple-200{--tw-shadow-color:color-mix(in oklab, var(--color-purple-200) var(--tw-shadow-alpha), transparent)}}.shadow-re-red\/20{--tw-shadow-color:var(--re-red)}@supports (color:color-mix(in lab,red,red)){.shadow-re-red\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--re-red) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-200{--tw-shadow-color:oklch(88.5% .062 18.334)}@supports (color:color-mix(in lab,red,red)){.shadow-red-200{--tw-shadow-color:color-mix(in oklab, var(--color-red-200) var(--tw-shadow-alpha), transparent)}}.shadow-slate-200{--tw-shadow-color:oklch(92.9% .013 255.508)}@supports (color:color-mix(in lab,red,red)){.shadow-slate-200{--tw-shadow-color:color-mix(in oklab, var(--color-slate-200) var(--tw-shadow-alpha), transparent)}}.shadow-slate-900\/10{--tw-shadow-color:#0f172b1a}@supports (color:color-mix(in lab,red,red)){.shadow-slate-900\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-slate-900) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-black\/5{--tw-ring-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.ring-black\/5{--tw-ring-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.ring-emerald-300{--tw-ring-color:var(--color-emerald-300)}.ring-emerald-300\/70{--tw-ring-color:#5ee9b5b3}@supports (color:color-mix(in lab,red,red)){.ring-emerald-300\/70{--tw-ring-color:color-mix(in oklab, var(--color-emerald-300) 70%, transparent)}}.ring-red-300\/70{--tw-ring-color:#ffa3a3b3}@supports (color:color-mix(in lab,red,red)){.ring-red-300\/70{--tw-ring-color:color-mix(in oklab, var(--color-red-300) 70%, transparent)}}.ring-ring\/50{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.ring-ring\/50{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.ring-sidebar-ring{--tw-ring-color:var(--sidebar-ring)}.ring-slate-100{--tw-ring-color:var(--color-slate-100)}.ring-slate-200{--tw-ring-color:var(--color-slate-200)}.ring-transparent{--tw-ring-color:transparent}.ring-white\/20{--tw-ring-color:#fff3}@supports (color:color-mix(in lab,red,red)){.ring-white\/20{--tw-ring-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.ring-offset-background{--tw-ring-offset-color:var(--background)}.ring-offset-white{--tw-ring-offset-color:var(--color-white)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.grayscale-\[0\.5\]{--tw-grayscale:grayscale(.5);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-\[1px\]{--tw-backdrop-blur:blur(1px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[color\,box-shadow\]{transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[margin\,opacity\]{transition-property:margin,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-none{transition-property:none}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-1000{--tw-duration:1s;transition-duration:1s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-linear{--tw-ease:linear;transition-timing-function:linear}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.group-focus-within\/menu-item\:opacity-100:is(:where(.group\/menu-item):focus-within *){opacity:1}@media(hover:hover){.group-hover\:scale-105:is(:where(.group):hover *){--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.group-hover\:scale-110:is(:where(.group):hover *){--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.group-hover\:bg-amber-100:is(:where(.group):hover *){background-color:var(--color-amber-100)}.group-hover\:bg-amber-600:is(:where(.group):hover *){background-color:var(--color-amber-600)}.group-hover\:bg-blue-50:is(:where(.group):hover *){background-color:var(--color-blue-50)}.group-hover\:bg-slate-100:is(:where(.group):hover *){background-color:var(--color-slate-100)}.group-hover\:bg-white:is(:where(.group):hover *){background-color:var(--color-white)}.group-hover\:text-amber-500:is(:where(.group):hover *){color:var(--color-amber-500)}.group-hover\:text-amber-600:is(:where(.group):hover *){color:var(--color-amber-600)}.group-hover\:text-amber-700:is(:where(.group):hover *){color:var(--color-amber-700)}.group-hover\:text-blue-600:is(:where(.group):hover *){color:var(--color-blue-600)}.group-hover\:text-emerald-900:is(:where(.group):hover *){color:var(--color-emerald-900)}.group-hover\:text-red-900:is(:where(.group):hover *){color:var(--color-red-900)}.group-hover\:text-slate-400:is(:where(.group):hover *){color:var(--color-slate-400)}.group-hover\:text-slate-900:is(:where(.group):hover *){color:var(--color-slate-900)}.group-hover\:text-white:is(:where(.group):hover *){color:var(--color-white)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}.group-hover\:ring-blue-100:is(:where(.group):hover *){--tw-ring-color:var(--color-blue-100)}.group-hover\/menu-item\:opacity-100:is(:where(.group\/menu-item):hover *),.group-hover\/num\:opacity-100:is(:where(.group\/num):hover *){opacity:1}.group-hover\/opt\:text-slate-900:is(:where(.group\/opt):hover *){color:var(--color-slate-900)}.group-hover\/opt\:opacity-100:is(:where(.group\/opt):hover *),.group-hover\/optnum\:opacity-100:is(:where(.group\/optnum):hover *){opacity:1}}.group-has-data-\[sidebar\=menu-action\]\/menu-item\:pr-8:is(:where(.group\/menu-item):has([data-sidebar=menu-action]) *){padding-right:calc(var(--spacing) * 8)}.group-data-\[collapsible\=icon\]\:-mt-8:is(:where(.group)[data-collapsible=icon] *){margin-top:calc(var(--spacing) * -8)}.group-data-\[collapsible\=icon\]\:hidden:is(:where(.group)[data-collapsible=icon] *){display:none}.group-data-\[collapsible\=icon\]\:size-8\!:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--spacing) * 8)!important;height:calc(var(--spacing) * 8)!important}.group-data-\[collapsible\=icon\]\:w-\(--sidebar-width-icon\):is(:where(.group)[data-collapsible=icon] *){width:var(--sidebar-width-icon)}.group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\)\]:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--sidebar-width-icon) + (calc(var(--spacing) * 4)))}.group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\+2px\)\]:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--sidebar-width-icon) + (calc(var(--spacing) * 4)) + 2px)}.group-data-\[collapsible\=icon\]\:overflow-hidden:is(:where(.group)[data-collapsible=icon] *){overflow:hidden}.group-data-\[collapsible\=icon\]\:p-0\!:is(:where(.group)[data-collapsible=icon] *){padding:calc(var(--spacing) * 0)!important}.group-data-\[collapsible\=icon\]\:p-2\!:is(:where(.group)[data-collapsible=icon] *){padding:calc(var(--spacing) * 2)!important}.group-data-\[collapsible\=icon\]\:opacity-0:is(:where(.group)[data-collapsible=icon] *){opacity:0}.group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\]:is(:where(.group)[data-collapsible=offcanvas] *){right:calc(var(--sidebar-width) * -1)}.group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\]:is(:where(.group)[data-collapsible=offcanvas] *){left:calc(var(--sidebar-width) * -1)}.group-data-\[collapsible\=offcanvas\]\:w-0:is(:where(.group)[data-collapsible=offcanvas] *){width:calc(var(--spacing) * 0)}.group-data-\[collapsible\=offcanvas\]\:translate-x-0:is(:where(.group)[data-collapsible=offcanvas] *){--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-data-\[disabled\=true\]\:pointer-events-none:is(:where(.group)[data-disabled=true] *){pointer-events:none}.group-data-\[disabled\=true\]\:opacity-50:is(:where(.group)[data-disabled=true] *){opacity:.5}.group-data-\[side\=left\]\:-right-4:is(:where(.group)[data-side=left] *){right:calc(var(--spacing) * -4)}.group-data-\[side\=left\]\:border-r:is(:where(.group)[data-side=left] *){border-right-style:var(--tw-border-style);border-right-width:1px}.group-data-\[side\=right\]\:left-0:is(:where(.group)[data-side=right] *){left:calc(var(--spacing) * 0)}.group-data-\[side\=right\]\:rotate-180:is(:where(.group)[data-side=right] *){rotate:180deg}.group-data-\[side\=right\]\:border-l:is(:where(.group)[data-side=right] *){border-left-style:var(--tw-border-style);border-left-width:1px}.group-data-\[state\=open\]\:rotate-180:is(:where(.group)[data-state=open] *){rotate:180deg}.group-data-\[variant\=floating\]\:rounded-lg:is(:where(.group)[data-variant=floating] *){border-radius:var(--radius)}.group-data-\[variant\=floating\]\:border:is(:where(.group)[data-variant=floating] *){border-style:var(--tw-border-style);border-width:1px}.group-data-\[variant\=floating\]\:border-sidebar-border:is(:where(.group)[data-variant=floating] *){border-color:var(--sidebar-border)}.group-data-\[variant\=floating\]\:shadow-sm:is(:where(.group)[data-variant=floating] *){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.group-data-\[vaul-drawer-direction\=bottom\]\/drawer-content\:block:is(:where(.group\/drawer-content)[data-vaul-drawer-direction=bottom] *){display:block}.group-data-\[viewport\=false\]\/navigation-menu\:top-full:is(:where(.group\/navigation-menu)[data-viewport=false] *){top:100%}.group-data-\[viewport\=false\]\/navigation-menu\:mt-1\.5:is(:where(.group\/navigation-menu)[data-viewport=false] *){margin-top:calc(var(--spacing) * 1.5)}.group-data-\[viewport\=false\]\/navigation-menu\:overflow-hidden:is(:where(.group\/navigation-menu)[data-viewport=false] *){overflow:hidden}.group-data-\[viewport\=false\]\/navigation-menu\:rounded-md:is(:where(.group\/navigation-menu)[data-viewport=false] *){border-radius:calc(var(--radius) - 2px)}.group-data-\[viewport\=false\]\/navigation-menu\:border:is(:where(.group\/navigation-menu)[data-viewport=false] *){border-style:var(--tw-border-style);border-width:1px}.group-data-\[viewport\=false\]\/navigation-menu\:bg-popover:is(:where(.group\/navigation-menu)[data-viewport=false] *){background-color:var(--popover)}.group-data-\[viewport\=false\]\/navigation-menu\:text-popover-foreground:is(:where(.group\/navigation-menu)[data-viewport=false] *){color:var(--popover-foreground)}.group-data-\[viewport\=false\]\/navigation-menu\:shadow:is(:where(.group\/navigation-menu)[data-viewport=false] *){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.group-data-\[viewport\=false\]\/navigation-menu\:duration-200:is(:where(.group\/navigation-menu)[data-viewport=false] *){--tw-duration:.2s;transition-duration:.2s}@media(hover:hover){.peer-hover\/menu-button\:text-sidebar-accent-foreground:is(:where(.peer\/menu-button):hover~*){color:var(--sidebar-accent-foreground)}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-50:is(:where(.peer):disabled~*){opacity:.5}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground:is(:where(.peer\/menu-button)[data-active=true]~*){color:var(--sidebar-accent-foreground)}.peer-data-\[size\=default\]\/menu-button\:top-1\.5:is(:where(.peer\/menu-button)[data-size=default]~*){top:calc(var(--spacing) * 1.5)}.peer-data-\[size\=lg\]\/menu-button\:top-2\.5:is(:where(.peer\/menu-button)[data-size=lg]~*){top:calc(var(--spacing) * 2.5)}.peer-data-\[size\=sm\]\/menu-button\:top-1:is(:where(.peer\/menu-button)[data-size=sm]~*){top:calc(var(--spacing) * 1)}.selection\:bg-primary ::-moz-selection{background-color:var(--primary)}.selection\:bg-primary ::selection{background-color:var(--primary)}.selection\:bg-primary::-moz-selection{background-color:var(--primary)}.selection\:bg-primary::selection{background-color:var(--primary)}.selection\:text-primary-foreground ::-moz-selection{color:var(--primary-foreground)}.selection\:text-primary-foreground ::selection{color:var(--primary-foreground)}.selection\:text-primary-foreground::-moz-selection{color:var(--primary-foreground)}.selection\:text-primary-foreground::selection{color:var(--primary-foreground)}.file\:mr-4::file-selector-button{margin-right:calc(var(--spacing) * 4)}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-7::file-selector-button{height:calc(var(--spacing) * 7)}.file\:rounded-full::file-selector-button{border-radius:3.40282e38px}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-amber-50::file-selector-button{background-color:var(--color-amber-50)}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:px-4::file-selector-button{padding-inline:calc(var(--spacing) * 4)}.file\:py-1::file-selector-button{padding-block:calc(var(--spacing) * 1)}.file\:py-2::file-selector-button{padding-block:calc(var(--spacing) * 2)}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:text-xs::file-selector-button{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\:font-semibold::file-selector-button{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.file\:text-amber-700::file-selector-button{color:var(--color-amber-700)}.file\:text-foreground::file-selector-button{color:var(--foreground)}.placeholder\:font-bold::-moz-placeholder{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.placeholder\:font-bold::placeholder{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.placeholder\:text-\[\#999999\]::-moz-placeholder{color:#999}.placeholder\:text-\[\#999999\]::placeholder{color:#999}.placeholder\:text-muted-foreground::-moz-placeholder{color:var(--muted-foreground)}.placeholder\:text-muted-foreground::placeholder{color:var(--muted-foreground)}.placeholder\:text-slate-300::-moz-placeholder{color:var(--color-slate-300)}.placeholder\:text-slate-300::placeholder{color:var(--color-slate-300)}.placeholder\:text-slate-400::-moz-placeholder{color:var(--color-slate-400)}.placeholder\:text-slate-400::placeholder{color:var(--color-slate-400)}.placeholder\:text-slate-500::-moz-placeholder{color:var(--color-slate-500)}.placeholder\:text-slate-500::placeholder{color:var(--color-slate-500)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);inset:calc(var(--spacing) * -2)}.after\:inset-y-0:after{content:var(--tw-content);inset-block:calc(var(--spacing) * 0)}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:calc(var(--spacing) * 1)}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.group-data-\[collapsible\=offcanvas\]\:after\:left-full:is(:where(.group)[data-collapsible=offcanvas] *):after{content:var(--tw-content);left:100%}.first\:rounded-l-md:first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.first\:border-l:first-child{border-left-style:var(--tw-border-style);border-left-width:1px}.last\:mb-0:last-child{margin-bottom:calc(var(--spacing) * 0)}.last\:rounded-r-md:last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.last\:pb-0:last-child{padding-bottom:calc(var(--spacing) * 0)}.focus-within\:relative:focus-within{position:relative}.focus-within\:z-20:focus-within{z-index:20}.focus-within\:border-blue-400:focus-within{border-color:var(--color-blue-400)}.focus-within\:ring-1:focus-within{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-within\:ring-blue-100:focus-within{--tw-ring-color:var(--color-blue-100)}@media(hover:hover){.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-\[1\.01\]:hover{scale:1.01}.hover\:scale-\[1\.02\]:hover{scale:1.02}.hover\:border-amber-200:hover{border-color:var(--color-amber-200)}.hover\:border-amber-300:hover{border-color:var(--color-amber-300)}.hover\:border-amber-400:hover{border-color:var(--color-amber-400)}.hover\:border-amber-500:hover{border-color:var(--color-amber-500)}.hover\:border-amber-600:hover{border-color:var(--color-amber-600)}.hover\:border-blue-300:hover{border-color:var(--color-blue-300)}.hover\:border-re-red:hover{border-color:var(--re-red)}.hover\:border-slate-100:hover{border-color:var(--color-slate-100)}.hover\:border-slate-200:hover{border-color:var(--color-slate-200)}.hover\:border-slate-300:hover{border-color:var(--color-slate-300)}.hover\:bg-accent:hover{background-color:var(--accent)}.hover\:bg-amber-50:hover{background-color:var(--color-amber-50)}.hover\:bg-amber-50\/30:hover{background-color:#fffbeb4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-50\/30:hover{background-color:color-mix(in oklab,var(--color-amber-50) 30%,transparent)}}.hover\:bg-amber-100:hover{background-color:var(--color-amber-100)}.hover\:bg-amber-200:hover{background-color:var(--color-amber-200)}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-amber-700:hover{background-color:var(--color-amber-700)}.hover\:bg-black:hover{background-color:var(--color-black)}.hover\:bg-blue-50:hover{background-color:var(--color-blue-50)}.hover\:bg-blue-50\/20:hover{background-color:#eff6ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-50\/20:hover{background-color:color-mix(in oklab,var(--color-blue-50) 20%,transparent)}}.hover\:bg-blue-100:hover{background-color:var(--color-blue-100)}.hover\:bg-blue-500:hover{background-color:var(--color-blue-500)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-destructive\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--destructive) 90%,transparent)}}.hover\:bg-emerald-50\/30:hover{background-color:#ecfdf54d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-50\/30:hover{background-color:color-mix(in oklab,var(--color-emerald-50) 30%,transparent)}}.hover\:bg-emerald-100:hover{background-color:var(--color-emerald-100)}.hover\:bg-emerald-700:hover{background-color:var(--color-emerald-700)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-green-100:hover{background-color:var(--color-green-100)}.hover\:bg-green-600:hover{background-color:var(--color-green-600)}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-indigo-50:hover{background-color:var(--color-indigo-50)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}.hover\:bg-muted:hover,.hover\:bg-muted\/50:hover{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab,var(--muted) 50%,transparent)}}.hover\:bg-orange-50:hover{background-color:var(--color-orange-50)}.hover\:bg-orange-700:hover{background-color:var(--color-orange-700)}.hover\:bg-primary:hover,.hover\:bg-primary\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--primary) 90%,transparent)}}.hover\:bg-purple-700:hover{background-color:var(--color-purple-700)}.hover\:bg-re-red-hover:hover{background-color:var(--re-red-hover)}.hover\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\:bg-red-50\/30:hover{background-color:#fef2f24d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-50\/30:hover{background-color:color-mix(in oklab,var(--color-red-50) 30%,transparent)}}.hover\:bg-red-100:hover{background-color:var(--color-red-100)}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-red-800:hover{background-color:var(--color-red-800)}.hover\:bg-secondary\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--secondary) 80%,transparent)}}.hover\:bg-sidebar-accent:hover{background-color:var(--sidebar-accent)}.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-50\/10:hover{background-color:#f8fafc1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-50\/10:hover{background-color:color-mix(in oklab,var(--color-slate-50) 10%,transparent)}}.hover\:bg-slate-50\/50:hover{background-color:#f8fafc80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-50\/50:hover{background-color:color-mix(in oklab,var(--color-slate-50) 50%,transparent)}}.hover\:bg-slate-50\/80:hover{background-color:#f8fafccc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-50\/80:hover{background-color:color-mix(in oklab,var(--color-slate-50) 80%,transparent)}}.hover\:bg-slate-100:hover{background-color:var(--color-slate-100)}.hover\:bg-slate-200:hover{background-color:var(--color-slate-200)}.hover\:bg-slate-200\/50:hover{background-color:#e2e8f080}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-200\/50:hover{background-color:color-mix(in oklab,var(--color-slate-200) 50%,transparent)}}.hover\:bg-slate-700:hover{background-color:var(--color-slate-700)}.hover\:bg-slate-800:hover{background-color:var(--color-slate-800)}.hover\:bg-slate-900:hover{background-color:var(--color-slate-900)}.hover\:bg-slate-950:hover{background-color:var(--color-slate-950)}.hover\:bg-transparent:hover{background-color:#0000}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.hover\:bg-white\/30:hover{background-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/30:hover{background-color:color-mix(in oklab,var(--color-white) 30%,transparent)}}.hover\:bg-white\/40:hover{background-color:#fff6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/40:hover{background-color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.hover\:bg-zinc-800:hover{background-color:var(--color-zinc-800)}.hover\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\:text-amber-600:hover{color:var(--color-amber-600)}.hover\:text-amber-700:hover{color:var(--color-amber-700)}.hover\:text-black:hover{color:var(--color-black)}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-blue-700:hover{color:var(--color-blue-700)}.hover\:text-blue-800:hover{color:var(--color-blue-800)}.hover\:text-destructive:hover{color:var(--destructive)}.hover\:text-foreground:hover{color:var(--foreground)}.hover\:text-green-800:hover{color:var(--color-green-800)}.hover\:text-indigo-600:hover{color:var(--color-indigo-600)}.hover\:text-muted-foreground:hover{color:var(--muted-foreground)}.hover\:text-primary-foreground:hover{color:var(--primary-foreground)}.hover\:text-re-red-hover:hover{color:var(--re-red-hover)}.hover\:text-red-500:hover{color:var(--color-red-500)}.hover\:text-red-600:hover{color:var(--color-red-600)}.hover\:text-red-700:hover{color:var(--color-red-700)}.hover\:text-sidebar-accent-foreground:hover{color:var(--sidebar-accent-foreground)}.hover\:text-slate-600:hover{color:var(--color-slate-600)}.hover\:text-slate-700:hover{color:var(--color-slate-700)}.hover\:text-slate-900:hover{color:var(--color-slate-900)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow:0 0 0 1px var(--tw-shadow-color,hsl(var(--sidebar-accent)));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-sm:hover{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:ring-4:hover{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:group-data-\[collapsible\=offcanvas\]\:bg-sidebar:hover:is(:where(.group)[data-collapsible=offcanvas] *){background-color:var(--sidebar)}.hover\:file\:bg-amber-100:hover::file-selector-button{background-color:var(--color-amber-100)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:var(--sidebar-border)}}.focus\:z-10:focus{z-index:10}.focus\:border-amber-300:focus{border-color:var(--color-amber-300)}.focus\:border-amber-500:focus{border-color:var(--color-amber-500)}.focus\:bg-accent:focus{background-color:var(--accent)}.focus\:bg-amber-50:focus{background-color:var(--color-amber-50)}.focus\:bg-primary:focus{background-color:var(--primary)}.focus\:bg-slate-50:focus{background-color:var(--color-slate-50)}.focus\:bg-white:focus{background-color:var(--color-white)}.focus\:text-accent-foreground:focus{color:var(--accent-foreground)}.focus\:text-primary-foreground:focus{color:var(--primary-foreground)}.focus\:text-slate-900:focus{color:var(--color-slate-900)}.focus\:ring-0:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-amber-200:focus{--tw-ring-color:var(--color-amber-200)}.focus\:ring-amber-500:focus{--tw-ring-color:var(--color-amber-500)}.focus\:ring-amber-500\/20:focus{--tw-ring-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.focus\:ring-amber-500\/20:focus{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.focus\:ring-amber-500\/30:focus{--tw-ring-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.focus\:ring-amber-500\/30:focus{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:ring-ring:focus{--tw-ring-color:var(--ring)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.focus\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:z-10:focus-visible{z-index:10}.focus-visible\:border-amber-500:focus-visible{border-color:var(--color-amber-500)}.focus-visible\:border-blue-500:focus-visible{border-color:var(--color-blue-500)}.focus-visible\:border-ring:focus-visible{border-color:var(--ring)}.focus-visible\:bg-white:focus-visible{background-color:var(--color-white)}.focus-visible\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-4:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-amber-500:focus-visible{--tw-ring-color:var(--color-amber-500)}.focus-visible\:ring-amber-500\/30:focus-visible{--tw-ring-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-amber-500\/30:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.focus-visible\:ring-black:focus-visible{--tw-ring-color:var(--color-black)}.focus-visible\:ring-blue-500\/30:focus-visible{--tw-ring-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-blue-500\/30:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-blue-500) 30%, transparent)}}.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.focus-visible\:ring-ring:focus-visible,.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:outline-hidden:focus-visible{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.focus-visible\:outline-hidden:focus-visible{outline-offset:2px;outline:2px solid #0000}}.focus-visible\:outline-1:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-ring:focus-visible{outline-color:var(--ring)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:scale-90:active{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%;scale:var(--tw-scale-x) var(--tw-scale-y)}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.active\:scale-\[0\.98\]:active{scale:.98}.active\:scale-\[0\.99\]:active{scale:.99}.active\:bg-sidebar-accent:active{background-color:var(--sidebar-accent)}.active\:text-sidebar-accent-foreground:active{color:var(--sidebar-accent-foreground)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-100:disabled{background-color:var(--color-gray-100)}.disabled\:bg-slate-50:disabled{background-color:var(--color-slate-50)}.disabled\:bg-slate-300:disabled{background-color:var(--color-slate-300)}.disabled\:bg-slate-400:disabled{background-color:var(--color-slate-400)}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}:where([data-side=left]) .in-data-\[side\=left\]\:cursor-w-resize{cursor:w-resize}:where([data-side=right]) .in-data-\[side\=right\]\:cursor-e-resize{cursor:e-resize}.has-disabled\:opacity-50:has(:disabled){opacity:.5}.has-data-\[slot\=card-action\]\:grid-cols-\[1fr_auto\]:has([data-slot=card-action]){grid-template-columns:1fr auto}.has-data-\[variant\=inset\]\:bg-sidebar:has([data-variant=inset]){background-color:var(--sidebar)}.has-\[\>svg\]\:grid-cols-\[calc\(var\(--spacing\)\*4\)_1fr\]:has(>svg){grid-template-columns:calc(var(--spacing) * 4) 1fr}.has-\[\>svg\]\:gap-x-3:has(>svg){-moz-column-gap:calc(var(--spacing) * 3);column-gap:calc(var(--spacing) * 3)}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing) * 2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing) * 3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing) * 4)}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-invalid\:border-destructive[aria-invalid=true]{border-color:var(--destructive)}.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.aria-selected\:bg-accent[aria-selected=true]{background-color:var(--accent)}.aria-selected\:bg-primary[aria-selected=true]{background-color:var(--primary)}.aria-selected\:text-accent-foreground[aria-selected=true]{color:var(--accent-foreground)}.aria-selected\:text-muted-foreground[aria-selected=true]{color:var(--muted-foreground)}.aria-selected\:text-primary-foreground[aria-selected=true]{color:var(--primary-foreground)}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}.data-\[active\=true\]\:z-10[data-active=true]{z-index:10}.data-\[active\=true\]\:border-ring[data-active=true]{border-color:var(--ring)}.data-\[active\=true\]\:bg-accent\/50[data-active=true]{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.data-\[active\=true\]\:bg-accent\/50[data-active=true]{background-color:color-mix(in oklab,var(--accent) 50%,transparent)}}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:var(--sidebar-accent)}.data-\[active\=true\]\:font-medium[data-active=true]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[active\=true\]\:text-accent-foreground[data-active=true]{color:var(--accent-foreground)}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:var(--sidebar-accent-foreground)}.data-\[active\=true\]\:ring-\[3px\][data-active=true]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[active\=true\]\:ring-ring\/50[data-active=true]{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.data-\[active\=true\]\:ring-ring\/50[data-active=true]{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}@media(hover:hover){.data-\[active\=true\]\:hover\:bg-accent[data-active=true]:hover{background-color:var(--accent)}}.data-\[active\=true\]\:focus\:bg-accent[data-active=true]:focus{background-color:var(--accent)}.data-\[active\=true\]\:aria-invalid\:border-destructive[data-active=true][aria-invalid=true]{border-color:var(--destructive)}.data-\[active\=true\]\:aria-invalid\:ring-destructive\/20[data-active=true][aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.data-\[active\=true\]\:aria-invalid\:ring-destructive\/20[data-active=true][aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true]{pointer-events:none}.data-\[disabled\=true\]\:opacity-50[data-disabled=true]{opacity:.5}.data-\[error\=true\]\:text-destructive[data-error=true]{color:var(--destructive)}.data-\[inset\]\:pl-8[data-inset]{padding-left:calc(var(--spacing) * 8)}.data-\[orientation\=horizontal\]\:h-4[data-orientation=horizontal]{height:calc(var(--spacing) * 4)}.data-\[orientation\=horizontal\]\:h-full[data-orientation=horizontal]{height:100%}.data-\[orientation\=horizontal\]\:h-px[data-orientation=horizontal]{height:1px}.data-\[orientation\=horizontal\]\:w-full[data-orientation=horizontal]{width:100%}.data-\[orientation\=vertical\]\:h-full[data-orientation=vertical]{height:100%}.data-\[orientation\=vertical\]\:min-h-44[data-orientation=vertical]{min-height:calc(var(--spacing) * 44)}.data-\[orientation\=vertical\]\:w-1\.5[data-orientation=vertical]{width:calc(var(--spacing) * 1.5)}.data-\[orientation\=vertical\]\:w-auto[data-orientation=vertical]{width:auto}.data-\[orientation\=vertical\]\:w-full[data-orientation=vertical]{width:100%}.data-\[orientation\=vertical\]\:w-px[data-orientation=vertical]{width:1px}.data-\[orientation\=vertical\]\:flex-col[data-orientation=vertical]{flex-direction:column}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:calc(var(--spacing) * 0)}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:calc(var(--spacing) * 1)}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:var(--muted-foreground)}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:var(--accent)}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:var(--accent-foreground)}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[size\=default\]\:h-9[data-size=default]{height:calc(var(--spacing) * 9)}.data-\[size\=sm\]\:h-8[data-size=sm]{height:calc(var(--spacing) * 8)}:is(.\*\:data-\[slot\=alert-description\]\:text-destructive\/90>*)[data-slot=alert-description]{color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){:is(.\*\:data-\[slot\=alert-description\]\:text-destructive\/90>*)[data-slot=alert-description]{color:color-mix(in oklab,var(--destructive) 90%,transparent)}}:is(.\*\*\:data-\[slot\=command-input-wrapper\]\:h-12 *)[data-slot=command-input-wrapper]{height:calc(var(--spacing) * 12)}:is(.\*\*\:data-\[slot\=navigation-menu-link\]\:focus\:ring-0 *)[data-slot=navigation-menu-link]:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}:is(.\*\*\:data-\[slot\=navigation-menu-link\]\:focus\:outline-none *)[data-slot=navigation-menu-link]:focus{--tw-outline-style:none;outline-style:none}:is(.\*\:data-\[slot\=select-value\]\:line-clamp-1>*)[data-slot=select-value]{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}:is(.\*\:data-\[slot\=select-value\]\:flex>*)[data-slot=select-value]{display:flex}:is(.\*\:data-\[slot\=select-value\]\:items-center>*)[data-slot=select-value]{align-items:center}:is(.\*\:data-\[slot\=select-value\]\:gap-2>*)[data-slot=select-value]{gap:calc(var(--spacing) * 2)}.data-\[state\=active\]\:bg-amber-600[data-state=active]{background-color:var(--color-amber-600)}.data-\[state\=active\]\:bg-card[data-state=active]{background-color:var(--card)}.data-\[state\=active\]\:bg-white[data-state=active]{background-color:var(--color-white)}.data-\[state\=active\]\:text-white[data-state=active]{color:var(--color-white)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-\[calc\(100\%-2px\)\][data-state=checked]{--tw-translate-x: calc(100% - 2px) ;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=checked\]\:border-amber-600[data-state=checked]{border-color:var(--color-amber-600)}.data-\[state\=checked\]\:border-black[data-state=checked]{border-color:var(--color-black)}.data-\[state\=checked\]\:border-emerald-600[data-state=checked]{border-color:var(--color-emerald-600)}.data-\[state\=checked\]\:border-primary[data-state=checked]{border-color:var(--primary)}.data-\[state\=checked\]\:border-purple-600[data-state=checked]{border-color:var(--color-purple-600)}.data-\[state\=checked\]\:border-red-600[data-state=checked]{border-color:var(--color-red-600)}.data-\[state\=checked\]\:bg-amber-600[data-state=checked]{background-color:var(--color-amber-600)}.data-\[state\=checked\]\:bg-black[data-state=checked]{background-color:var(--color-black)}.data-\[state\=checked\]\:bg-emerald-600[data-state=checked]{background-color:var(--color-emerald-600)}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:var(--primary)}.data-\[state\=checked\]\:bg-purple-600[data-state=checked]{background-color:var(--color-purple-600)}.data-\[state\=checked\]\:bg-red-600[data-state=checked]{background-color:var(--color-red-600)}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:var(--primary-foreground)}.data-\[state\=closed\]\:duration-300[data-state=closed]{--tw-duration:.3s;transition-duration:.3s}.data-\[state\=inactive\]\:hidden[data-state=inactive]{display:none}.data-\[state\=on\]\:bg-accent[data-state=on]{background-color:var(--accent)}.data-\[state\=on\]\:text-accent-foreground[data-state=on]{color:var(--accent-foreground)}.data-\[state\=open\]\:bg-accent[data-state=open],.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:color-mix(in oklab,var(--accent) 50%,transparent)}}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:var(--secondary)}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:var(--accent-foreground)}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:var(--muted-foreground)}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[state\=open\]\:duration-500[data-state=open]{--tw-duration:.5s;transition-duration:.5s}@media(hover:hover){.data-\[state\=open\]\:hover\:bg-accent[data-state=open]:hover{background-color:var(--accent)}.data-\[state\=open\]\:hover\:bg-sidebar-accent[data-state=open]:hover{background-color:var(--sidebar-accent)}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground[data-state=open]:hover{color:var(--sidebar-accent-foreground)}}.data-\[state\=open\]\:focus\:bg-accent[data-state=open]:focus{background-color:var(--accent)}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:var(--muted)}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-switch-background[data-state=unchecked]{background-color:var(--switch-background)}.data-\[variant\=destructive\]\:text-destructive[data-variant=destructive]{color:var(--destructive)}.data-\[variant\=destructive\]\:focus\:bg-destructive\/10[data-variant=destructive]:focus{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.data-\[variant\=destructive\]\:focus\:bg-destructive\/10[data-variant=destructive]:focus{background-color:color-mix(in oklab,var(--destructive) 10%,transparent)}}.data-\[variant\=destructive\]\:focus\:text-destructive[data-variant=destructive]:focus{color:var(--destructive)}.data-\[variant\=outline\]\:border-l-0[data-variant=outline]{border-left-style:var(--tw-border-style);border-left-width:0}.data-\[variant\=outline\]\:shadow-xs[data-variant=outline]{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[variant\=outline\]\:first\:border-l[data-variant=outline]:first-child{border-left-style:var(--tw-border-style);border-left-width:1px}.data-\[vaul-drawer-direction\=bottom\]\:inset-x-0[data-vaul-drawer-direction=bottom]{inset-inline:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=bottom\]\:bottom-0[data-vaul-drawer-direction=bottom]{bottom:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=bottom\]\:mt-24[data-vaul-drawer-direction=bottom]{margin-top:calc(var(--spacing) * 24)}.data-\[vaul-drawer-direction\=bottom\]\:max-h-\[80vh\][data-vaul-drawer-direction=bottom]{max-height:80vh}.data-\[vaul-drawer-direction\=bottom\]\:rounded-t-lg[data-vaul-drawer-direction=bottom]{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.data-\[vaul-drawer-direction\=bottom\]\:border-t[data-vaul-drawer-direction=bottom]{border-top-style:var(--tw-border-style);border-top-width:1px}.data-\[vaul-drawer-direction\=left\]\:inset-y-0[data-vaul-drawer-direction=left]{inset-block:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=left\]\:left-0[data-vaul-drawer-direction=left]{left:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=left\]\:w-3\/4[data-vaul-drawer-direction=left]{width:75%}.data-\[vaul-drawer-direction\=left\]\:border-r[data-vaul-drawer-direction=left]{border-right-style:var(--tw-border-style);border-right-width:1px}.data-\[vaul-drawer-direction\=right\]\:inset-y-0[data-vaul-drawer-direction=right]{inset-block:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=right\]\:right-0[data-vaul-drawer-direction=right]{right:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=right\]\:w-3\/4[data-vaul-drawer-direction=right]{width:75%}.data-\[vaul-drawer-direction\=right\]\:border-l[data-vaul-drawer-direction=right]{border-left-style:var(--tw-border-style);border-left-width:1px}.data-\[vaul-drawer-direction\=top\]\:inset-x-0[data-vaul-drawer-direction=top]{inset-inline:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=top\]\:top-0[data-vaul-drawer-direction=top]{top:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=top\]\:mb-24[data-vaul-drawer-direction=top]{margin-bottom:calc(var(--spacing) * 24)}.data-\[vaul-drawer-direction\=top\]\:max-h-\[80vh\][data-vaul-drawer-direction=top]{max-height:80vh}.data-\[vaul-drawer-direction\=top\]\:rounded-b-lg[data-vaul-drawer-direction=top]{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.data-\[vaul-drawer-direction\=top\]\:border-b[data-vaul-drawer-direction=top]{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}@media(min-width:40rem){.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:-mx-6{margin-inline:calc(var(--spacing) * -6)}.sm\:block{display:block}.sm\:flex{display:flex}.sm\:inline{display:inline}.sm\:w-auto{width:auto}.sm\:\!max-w-\[80vw\]{max-width:80vw!important}.sm\:max-w-2xl{max-width:var(--container-2xl)}.sm\:max-w-7xl{max-width:var(--container-7xl)}.sm\:max-w-\[460px\]{max-width:460px}.sm\:max-w-\[480px\]{max-width:480px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:max-w-md{max-width:var(--container-md)}.sm\:max-w-sm{max-width:var(--container-sm)}.sm\:flex-1{flex:1}.sm\:flex-none{flex:none}.sm\:shrink-0{flex-shrink:0}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:justify-end{justify-content:flex-end}.sm\:gap-0{gap:calc(var(--spacing) * 0)}.sm\:gap-2\.5{gap:calc(var(--spacing) * 2.5)}.sm\:p-6{padding:calc(var(--spacing) * 6)}.sm\:px-2{padding-inline:calc(var(--spacing) * 2)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}.sm\:py-5{padding-block:calc(var(--spacing) * 5)}.sm\:pt-6{padding-top:calc(var(--spacing) * 6)}.sm\:pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.sm\:pl-2\.5{padding-left:calc(var(--spacing) * 2.5)}.sm\:text-left{text-align:left}.sm\:text-\[11px\]{font-size:11px}.data-\[vaul-drawer-direction\=left\]\:sm\:max-w-sm[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:sm\:max-w-sm[data-vaul-drawer-direction=right]{max-width:var(--container-sm)}}@media(min-width:48rem){.md\:absolute{position:absolute}.md\:static{position:static}.md\:col-span-2{grid-column:span 2/span 2}.md\:col-span-4{grid-column:span 4/span 4}.md\:col-span-6{grid-column:span 6/span 6}.md\:mt-8{margin-top:calc(var(--spacing) * 8)}.md\:mr-2{margin-right:calc(var(--spacing) * 2)}.md\:block{display:block}.md\:flex{display:flex}.md\:inline{display:inline}.md\:h-12{height:calc(var(--spacing) * 12)}.md\:w-36{width:calc(var(--spacing) * 36)}.md\:w-40{width:calc(var(--spacing) * 40)}.md\:w-48{width:calc(var(--spacing) * 48)}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-3xl{max-width:var(--container-3xl)}.md\:max-w-\[300px\]{max-width:300px}.md\:flex-initial{flex:0 auto}.md\:flex-none{flex:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:border-transparent{border-color:#0000}.md\:bg-transparent{background-color:#0000}.md\:p-16{padding:calc(var(--spacing) * 16)}.md\:px-12{padding-inline:calc(var(--spacing) * 12)}.md\:pl-16{padding-left:calc(var(--spacing) * 16)}.md\:text-right{text-align:right}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.md\:opacity-0{opacity:0}.md\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.md\:peer-data-\[variant\=inset\]\:m-2:is(:where(.peer)[data-variant=inset]~*){margin:calc(var(--spacing) * 2)}.md\:peer-data-\[variant\=inset\]\:ml-0:is(:where(.peer)[data-variant=inset]~*){margin-left:calc(var(--spacing) * 0)}.md\:peer-data-\[variant\=inset\]\:rounded-xl:is(:where(.peer)[data-variant=inset]~*){border-radius:calc(var(--radius) + 4px)}.md\:peer-data-\[variant\=inset\]\:shadow-sm:is(:where(.peer)[data-variant=inset]~*){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.md\:peer-data-\[variant\=inset\]\:peer-data-\[state\=collapsed\]\:ml-2:is(:where(.peer)[data-variant=inset]~*):is(:where(.peer)[data-state=collapsed]~*){margin-left:calc(var(--spacing) * 2)}.md\:after\:hidden:after{content:var(--tw-content);display:none}}@media(min-width:64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:col-span-3{grid-column:span 3/span 3}.lg\:col-span-4{grid-column:span 4/span 4}.lg\:col-span-5{grid-column:span 5/span 5}.lg\:flex{display:flex}.lg\:w-40{width:calc(var(--spacing) * 40)}.lg\:w-48{width:calc(var(--spacing) * 48)}.lg\:w-\[320px\]{width:320px}.lg\:max-w-4xl{max-width:var(--container-4xl)}.lg\:max-w-7xl{max-width:var(--container-7xl)}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.lg\:pl-8{padding-left:calc(var(--spacing) * 8)}}@media(min-width:80rem){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}.dark\:border-input:is(.dark *){border-color:var(--input)}.dark\:bg-destructive\/60:is(.dark *){background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.dark\:bg-destructive\/60:is(.dark *){background-color:color-mix(in oklab,var(--destructive) 60%,transparent)}}.dark\:bg-input\/30:is(.dark *){background-color:var(--input)}@supports (color:color-mix(in lab,red,red)){.dark\:bg-input\/30:is(.dark *){background-color:color-mix(in oklab,var(--input) 30%,transparent)}}.dark\:text-muted-foreground:is(.dark *){color:var(--muted-foreground)}@media(hover:hover){.dark\:hover\:bg-accent\/50:is(.dark *):hover{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-accent\/50:is(.dark *):hover{background-color:color-mix(in oklab,var(--accent) 50%,transparent)}}.dark\:hover\:bg-input\/50:is(.dark *):hover{background-color:var(--input)}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-input\/50:is(.dark *):hover{background-color:color-mix(in oklab,var(--input) 50%,transparent)}}}.dark\:focus-visible\:ring-destructive\/40:is(.dark *):focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.dark\:focus-visible\:ring-destructive\/40:is(.dark *):focus-visible{--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.dark\:aria-invalid\:ring-destructive\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.dark\:aria-invalid\:ring-destructive\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.dark\:data-\[active\=true\]\:aria-invalid\:ring-destructive\/40:is(.dark *)[data-active=true][aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[active\=true\]\:aria-invalid\:ring-destructive\/40:is(.dark *)[data-active=true][aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.dark\:data-\[state\=active\]\:border-input:is(.dark *)[data-state=active]{border-color:var(--input)}.dark\:data-\[state\=active\]\:bg-input\/30:is(.dark *)[data-state=active]{background-color:var(--input)}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[state\=active\]\:bg-input\/30:is(.dark *)[data-state=active]{background-color:color-mix(in oklab,var(--input) 30%,transparent)}}.dark\:data-\[state\=active\]\:text-foreground:is(.dark *)[data-state=active]{color:var(--foreground)}.dark\:data-\[state\=checked\]\:bg-primary:is(.dark *)[data-state=checked]{background-color:var(--primary)}.dark\:data-\[state\=checked\]\:bg-primary-foreground:is(.dark *)[data-state=checked]{background-color:var(--primary-foreground)}.dark\:data-\[state\=unchecked\]\:bg-card-foreground:is(.dark *)[data-state=unchecked]{background-color:var(--card-foreground)}.dark\:data-\[state\=unchecked\]\:bg-input\/80:is(.dark *)[data-state=unchecked]{background-color:var(--input)}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[state\=unchecked\]\:bg-input\/80:is(.dark *)[data-state=unchecked]{background-color:color-mix(in oklab,var(--input) 80%,transparent)}}.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20:is(.dark *)[data-variant=destructive]:focus{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20:is(.dark *)[data-variant=destructive]:focus{background-color:color-mix(in oklab,var(--destructive) 20%,transparent)}}.\[\&_\.ql-container\]\:border-0 .ql-container{border-style:var(--tw-border-style);border-width:0}.\[\&_\.ql-editor\]\:min-h-\[380px\] .ql-editor{min-height:380px}.\[\&_\.ql-editor\]\:text-sm .ql-editor{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.\[\&_\.ql-editor\]\:text-slate-900 .ql-editor{color:var(--color-slate-900)}.\[\&_\.ql-toolbar\]\:border-slate-200 .ql-toolbar{border-color:var(--color-slate-200)}.\[\&_\.ql-toolbar\]\:bg-slate-50 .ql-toolbar{background-color:var(--color-slate-50)}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:var(--muted-foreground)}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:var(--border)}@supports (color:color-mix(in lab,red,red)){.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:color-mix(in oklab,var(--border) 50%,transparent)}}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:var(--border)}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:#0000}.\[\&_\.recharts-layer\]\:outline-hidden .recharts-layer{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.\[\&_\.recharts-layer\]\:outline-hidden .recharts-layer{outline-offset:2px;outline:2px solid #0000}}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:var(--border)}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:var(--muted)}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:var(--border)}.\[\&_\.recharts-sector\]\:outline-hidden .recharts-sector{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.\[\&_\.recharts-sector\]\:outline-hidden .recharts-sector{outline-offset:2px;outline:2px solid #0000}}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:#0000}.\[\&_\.recharts-surface\]\:outline-hidden .recharts-surface{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.\[\&_\.recharts-surface\]\:outline-hidden .recharts-surface{outline-offset:2px;outline:2px solid #0000}}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-block:calc(var(--spacing) * 1.5)}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:var(--muted-foreground)}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:calc(var(--spacing) * 0)}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:calc(var(--spacing) * 5)}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:calc(var(--spacing) * 5)}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:calc(var(--spacing) * 12)}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-block:calc(var(--spacing) * 3)}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:calc(var(--spacing) * 5)}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:calc(var(--spacing) * 5)}.\[\&_p\]\:leading-relaxed p{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\:not\(\[class\*\=\'text-\'\]\)\]\:text-muted-foreground svg:not([class*=text-]){color:var(--muted-foreground)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:has\(\>\.day-range-end\)\]\:rounded-r-md:has(>.day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\>\.day-range-start\)\]\:rounded-l-md:has(>.day-range-start){border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:rounded-md:has([aria-selected]){border-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:bg-accent:has([aria-selected]){background-color:var(--accent)}.first\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-l-md:first-child:has([aria-selected]){border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.last\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-r-md:last-child:has([aria-selected]),.\[\&\:has\(\[aria-selected\]\.day-range-end\)\]\:rounded-r-md:has([aria-selected].day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing) * 0)}.\[\.border-b\]\:pb-6.border-b{padding-bottom:calc(var(--spacing) * 6)}.\[\.border-t\]\:pt-6.border-t{padding-top:calc(var(--spacing) * 6)}:is(.\*\:\[span\]\:last\:flex>*):is(span):last-child{display:flex}:is(.\*\:\[span\]\:last\:items-center>*):is(span):last-child{align-items:center}:is(.\*\:\[span\]\:last\:gap-2>*):is(span):last-child{gap:calc(var(--spacing) * 2)}:is(.data-\[variant\=destructive\]\:\*\:\[svg\]\:\!text-destructive[data-variant=destructive]>*):is(svg){color:var(--destructive)!important}.\[\&\:last-child\]\:pb-6:last-child{padding-bottom:calc(var(--spacing) * 6)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>button\]\:text-white>button{color:var(--color-white)}.\[\&\>button\]\:opacity-100>button{opacity:1}.\[\&\>span\:last-child\]\:truncate>span:last-child{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.\[\&\>svg\]\:pointer-events-none>svg{pointer-events:none}.\[\&\>svg\]\:size-3>svg{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.\[\&\>svg\]\:size-3\.5>svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\[\&\>svg\]\:size-4>svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&\>svg\]\:h-2\.5>svg{height:calc(var(--spacing) * 2.5)}.\[\&\>svg\]\:h-3>svg{height:calc(var(--spacing) * 3)}.\[\&\>svg\]\:w-2\.5>svg{width:calc(var(--spacing) * 2.5)}.\[\&\>svg\]\:w-3>svg{width:calc(var(--spacing) * 3)}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:translate-y-0\.5>svg{--tw-translate-y:calc(var(--spacing) * .5);translate:var(--tw-translate-x) var(--tw-translate-y)}.\[\&\>svg\]\:text-current>svg{color:currentColor}.\[\&\>svg\]\:text-muted-foreground>svg{color:var(--muted-foreground)}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:var(--sidebar-accent-foreground)}.\[\&\>tr\]\:last\:border-b-0>tr:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{rotate:90deg}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{rotate:180deg}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:calc(var(--spacing) * -2)}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:calc(var(--spacing) * -2)}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}@media(hover:hover){a.\[a\&\]\:hover\:bg-accent:hover{background-color:var(--accent)}a.\[a\&\]\:hover\:bg-destructive\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--destructive) 90%,transparent)}}a.\[a\&\]\:hover\:bg-primary\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--primary) 90%,transparent)}}a.\[a\&\]\:hover\:bg-secondary\/90:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-secondary\/90:hover{background-color:color-mix(in oklab,var(--secondary) 90%,transparent)}}a.\[a\&\]\:hover\:text-accent-foreground:hover{color:var(--accent-foreground)}}button.bg-amber-600,button.hover\:bg-amber-700:hover{background-color:var(--color-re-red)!important}}:root{--font-size:16px;--background:#fff;--foreground:oklch(14.5% 0 0);--card:#fff;--card-foreground:oklch(14.5% 0 0);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.5% 0 0);--primary:#daaa00;--primary-foreground:oklch(100% 0 0);--secondary:oklch(95% .0058 264.53);--secondary-foreground:#030213;--muted:#ececf0;--muted-foreground:#717182;--accent:#e9ebef;--accent-foreground:#030213;--destructive:#d4183d;--destructive-foreground:#fff;--border:#0000001a;--input:transparent;--input-background:#f3f3f5;--switch-background:#cbced4;--font-weight-medium:500;--font-weight-normal:400;--ring:oklch(70.8% 0 0);--chart-1:oklch(64.6% .222 41.116);--chart-2:oklch(60% .118 184.704);--chart-3:oklch(39.8% .07 227.392);--chart-4:oklch(82.8% .189 84.429);--chart-5:oklch(76.9% .188 70.08);--radius:.625rem;--sidebar:oklch(98.5% 0 0);--sidebar-foreground:oklch(14.5% 0 0);--sidebar-primary:#030213;--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(97% 0 0);--sidebar-accent-foreground:oklch(20.5% 0 0);--sidebar-border:oklch(92.2% 0 0);--sidebar-ring:oklch(70.8% 0 0);--re-red:#da291c;--re-red-hover:#b82216;--re-black:#000;--re-white:#fff;--re-gray:#717171}.dark{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(14.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(14.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(98.5% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(39.6% .141 25.723);--destructive-foreground:oklch(63.7% .237 25.331);--border:oklch(26.9% 0 0);--input:oklch(26.9% 0 0);--ring:oklch(43.9% 0 0);--font-weight-medium:500;--font-weight-normal:400;--chart-1:oklch(48.8% .243 264.376);--chart-2:oklch(69.6% .17 162.48);--chart-3:oklch(76.9% .188 70.08);--chart-4:oklch(62.7% .265 303.9);--chart-5:oklch(64.5% .246 16.439);--sidebar:oklch(20.5% 0 0);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(26.9% 0 0);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(26.9% 0 0);--sidebar-ring:oklch(43.9% 0 0)}.re-heading{text-transform:uppercase;letter-spacing:.1em;font-family:Montserrat,sans-serif;font-weight:700}.re-card{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-slate-200);background-color:var(--color-white);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-radius:0}.re-input{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-slate-300);width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));--tw-duration:.2s;--tw-outline-style:none;border-radius:0;outline-style:none;transition-duration:.2s}.re-input:focus{border-color:var(--color-red-600);--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#e4001433}@supports (color:color-mix(in lab,red,red)){.re-input:focus{--tw-ring-color:color-mix(in oklab, var(--color-red-600) 20%, transparent)}}.re-label{margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide);color:var(--color-slate-800);text-transform:uppercase;display:block}.re-btn-primary{background-color:var(--color-black);padding-inline:calc(var(--spacing) * 8);padding-block:calc(var(--spacing) * 3);--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold);--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest);color:var(--color-white);text-transform:uppercase;transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){.re-btn-primary:hover{background-color:var(--color-slate-900)}}.re-btn-primary:active{scale:.98}.re-btn-outline{border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-black);padding-inline:calc(var(--spacing) * 8);padding-block:calc(var(--spacing) * 3);--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold);--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest);color:var(--color-black);text-transform:uppercase;transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){.re-btn-outline:hover{background-color:var(--color-black);color:var(--color-white)}}.re-btn-outline:active{scale:.98}.re-intro-text{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed);color:var(--color-slate-700)}.re-disclaimer{border-left-style:var(--tw-border-style);border-left-width:4px;border-color:var(--color-red-600);background-color:var(--color-slate-50);padding:calc(var(--spacing) * 4);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-slate-600);font-style:italic}html{font-size:var(--font-size)}.custom-scrollbar::-webkit-scrollbar{width:3px}.custom-scrollbar::-webkit-scrollbar-track{background:0 0}.custom-scrollbar::-webkit-scrollbar-thumb{background:#e2e8f0;border-radius:10px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#cbd5e1}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:#e2e8f0 transparent}.custom-scrollbar-x::-webkit-scrollbar{height:4px}.custom-scrollbar-x::-webkit-scrollbar-track{background:0 0}.custom-scrollbar-x::-webkit-scrollbar-thumb{background:#e2e8f0;border-radius:9999px}.custom-scrollbar-x::-webkit-scrollbar-thumb:hover{background:#cbd5e1}.custom-scrollbar-x{scrollbar-width:thin;scrollbar-color:#e2e8f0 transparent}.custom-scrollbar-slim::-webkit-scrollbar{width:2px}.custom-scrollbar-slim::-webkit-scrollbar-track{background:0 0}.custom-scrollbar-slim::-webkit-scrollbar-thumb{background:#f1f5f9;border-radius:9999px}.custom-scrollbar-slim::-webkit-scrollbar-thumb:hover{background:#e2e8f0}.custom-scrollbar-slim{scrollbar-width:thin;scrollbar-color:#f1f5f9 transparent}.no-native-password-reveal::-ms-reveal{display:none}.no-native-password-reveal::-ms-clear{display:none}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}} +*/.ql-container{box-sizing:border-box;font-family:Helvetica,Arial,sans-serif;font-size:13px;height:100%;margin:0;position:relative}.ql-container.ql-disabled .ql-tooltip{visibility:hidden}.ql-container.ql-disabled .ql-editor ul[data-checked]>li:before{pointer-events:none}.ql-clipboard{left:-100000px;height:1px;overflow-y:hidden;position:absolute;top:50%}.ql-clipboard p{margin:0;padding:0}.ql-editor{box-sizing:border-box;line-height:1.42;height:100%;outline:none;overflow-y:auto;padding:12px 15px;-o-tab-size:4;tab-size:4;-moz-tab-size:4;text-align:left;white-space:pre-wrap;word-wrap:break-word}.ql-editor>*{cursor:text}.ql-editor p,.ql-editor ol,.ql-editor ul,.ql-editor pre,.ql-editor blockquote,.ql-editor h1,.ql-editor h2,.ql-editor h3,.ql-editor h4,.ql-editor h5,.ql-editor h6{margin:0;padding:0;counter-reset:list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9}.ql-editor ol,.ql-editor ul{padding-left:1.5em}.ql-editor ol>li,.ql-editor ul>li{list-style-type:none}.ql-editor ul>li:before{content:"•"}.ql-editor ul[data-checked=true],.ql-editor ul[data-checked=false]{pointer-events:none}.ql-editor ul[data-checked=true]>li *,.ql-editor ul[data-checked=false]>li *{pointer-events:all}.ql-editor ul[data-checked=true]>li:before,.ql-editor ul[data-checked=false]>li:before{color:#777;cursor:pointer;pointer-events:all}.ql-editor ul[data-checked=true]>li:before{content:"☑"}.ql-editor ul[data-checked=false]>li:before{content:"☐"}.ql-editor li:before{display:inline-block;white-space:nowrap;width:1.2em}.ql-editor li:not(.ql-direction-rtl):before{margin-left:-1.5em;margin-right:.3em;text-align:right}.ql-editor li.ql-direction-rtl:before{margin-left:.3em;margin-right:-1.5em}.ql-editor ol li:not(.ql-direction-rtl),.ql-editor ul li:not(.ql-direction-rtl){padding-left:1.5em}.ql-editor ol li.ql-direction-rtl,.ql-editor ul li.ql-direction-rtl{padding-right:1.5em}.ql-editor ol li{counter-reset:list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;counter-increment:list-0}.ql-editor ol li:before{content:counter(list-0,decimal) ". "}.ql-editor ol li.ql-indent-1{counter-increment:list-1}.ql-editor ol li.ql-indent-1:before{content:counter(list-1,lower-alpha) ". "}.ql-editor ol li.ql-indent-1{counter-reset:list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-2{counter-increment:list-2}.ql-editor ol li.ql-indent-2:before{content:counter(list-2,lower-roman) ". "}.ql-editor ol li.ql-indent-2{counter-reset:list-3 list-4 list-5 list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-3{counter-increment:list-3}.ql-editor ol li.ql-indent-3:before{content:counter(list-3,decimal) ". "}.ql-editor ol li.ql-indent-3{counter-reset:list-4 list-5 list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-4{counter-increment:list-4}.ql-editor ol li.ql-indent-4:before{content:counter(list-4,lower-alpha) ". "}.ql-editor ol li.ql-indent-4{counter-reset:list-5 list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-5{counter-increment:list-5}.ql-editor ol li.ql-indent-5:before{content:counter(list-5,lower-roman) ". "}.ql-editor ol li.ql-indent-5{counter-reset:list-6 list-7 list-8 list-9}.ql-editor ol li.ql-indent-6{counter-increment:list-6}.ql-editor ol li.ql-indent-6:before{content:counter(list-6,decimal) ". "}.ql-editor ol li.ql-indent-6{counter-reset:list-7 list-8 list-9}.ql-editor ol li.ql-indent-7{counter-increment:list-7}.ql-editor ol li.ql-indent-7:before{content:counter(list-7,lower-alpha) ". "}.ql-editor ol li.ql-indent-7{counter-reset:list-8 list-9}.ql-editor ol li.ql-indent-8{counter-increment:list-8}.ql-editor ol li.ql-indent-8:before{content:counter(list-8,lower-roman) ". "}.ql-editor ol li.ql-indent-8{counter-reset:list-9}.ql-editor ol li.ql-indent-9{counter-increment:list-9}.ql-editor ol li.ql-indent-9:before{content:counter(list-9,decimal) ". "}.ql-editor .ql-indent-1:not(.ql-direction-rtl){padding-left:3em}.ql-editor li.ql-indent-1:not(.ql-direction-rtl){padding-left:4.5em}.ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right{padding-right:3em}.ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right{padding-right:4.5em}.ql-editor .ql-indent-2:not(.ql-direction-rtl){padding-left:6em}.ql-editor li.ql-indent-2:not(.ql-direction-rtl){padding-left:7.5em}.ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right{padding-right:6em}.ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right{padding-right:7.5em}.ql-editor .ql-indent-3:not(.ql-direction-rtl){padding-left:9em}.ql-editor li.ql-indent-3:not(.ql-direction-rtl){padding-left:10.5em}.ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right{padding-right:9em}.ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right{padding-right:10.5em}.ql-editor .ql-indent-4:not(.ql-direction-rtl){padding-left:12em}.ql-editor li.ql-indent-4:not(.ql-direction-rtl){padding-left:13.5em}.ql-editor .ql-indent-4.ql-direction-rtl.ql-align-right{padding-right:12em}.ql-editor li.ql-indent-4.ql-direction-rtl.ql-align-right{padding-right:13.5em}.ql-editor .ql-indent-5:not(.ql-direction-rtl){padding-left:15em}.ql-editor li.ql-indent-5:not(.ql-direction-rtl){padding-left:16.5em}.ql-editor .ql-indent-5.ql-direction-rtl.ql-align-right{padding-right:15em}.ql-editor li.ql-indent-5.ql-direction-rtl.ql-align-right{padding-right:16.5em}.ql-editor .ql-indent-6:not(.ql-direction-rtl){padding-left:18em}.ql-editor li.ql-indent-6:not(.ql-direction-rtl){padding-left:19.5em}.ql-editor .ql-indent-6.ql-direction-rtl.ql-align-right{padding-right:18em}.ql-editor li.ql-indent-6.ql-direction-rtl.ql-align-right{padding-right:19.5em}.ql-editor .ql-indent-7:not(.ql-direction-rtl){padding-left:21em}.ql-editor li.ql-indent-7:not(.ql-direction-rtl){padding-left:22.5em}.ql-editor .ql-indent-7.ql-direction-rtl.ql-align-right{padding-right:21em}.ql-editor li.ql-indent-7.ql-direction-rtl.ql-align-right{padding-right:22.5em}.ql-editor .ql-indent-8:not(.ql-direction-rtl){padding-left:24em}.ql-editor li.ql-indent-8:not(.ql-direction-rtl){padding-left:25.5em}.ql-editor .ql-indent-8.ql-direction-rtl.ql-align-right{padding-right:24em}.ql-editor li.ql-indent-8.ql-direction-rtl.ql-align-right{padding-right:25.5em}.ql-editor .ql-indent-9:not(.ql-direction-rtl){padding-left:27em}.ql-editor li.ql-indent-9:not(.ql-direction-rtl){padding-left:28.5em}.ql-editor .ql-indent-9.ql-direction-rtl.ql-align-right{padding-right:27em}.ql-editor li.ql-indent-9.ql-direction-rtl.ql-align-right{padding-right:28.5em}.ql-editor .ql-video{display:block;max-width:100%}.ql-editor .ql-video.ql-align-center{margin:0 auto}.ql-editor .ql-video.ql-align-right{margin:0 0 0 auto}.ql-editor .ql-bg-black{background-color:#000}.ql-editor .ql-bg-red{background-color:#e60000}.ql-editor .ql-bg-orange{background-color:#f90}.ql-editor .ql-bg-yellow{background-color:#ff0}.ql-editor .ql-bg-green{background-color:#008a00}.ql-editor .ql-bg-blue{background-color:#06c}.ql-editor .ql-bg-purple{background-color:#93f}.ql-editor .ql-color-white{color:#fff}.ql-editor .ql-color-red{color:#e60000}.ql-editor .ql-color-orange{color:#f90}.ql-editor .ql-color-yellow{color:#ff0}.ql-editor .ql-color-green{color:#008a00}.ql-editor .ql-color-blue{color:#06c}.ql-editor .ql-color-purple{color:#93f}.ql-editor .ql-font-serif{font-family:Georgia,Times New Roman,serif}.ql-editor .ql-font-monospace{font-family:Monaco,Courier New,monospace}.ql-editor .ql-size-small{font-size:.75em}.ql-editor .ql-size-large{font-size:1.5em}.ql-editor .ql-size-huge{font-size:2.5em}.ql-editor .ql-direction-rtl{direction:rtl;text-align:inherit}.ql-editor .ql-align-center{text-align:center}.ql-editor .ql-align-justify{text-align:justify}.ql-editor .ql-align-right{text-align:right}.ql-editor.ql-blank:before{color:#0009;content:attr(data-placeholder);font-style:italic;left:15px;pointer-events:none;position:absolute;right:15px}.ql-snow.ql-toolbar:after,.ql-snow .ql-toolbar:after{clear:both;content:"";display:table}.ql-snow.ql-toolbar button,.ql-snow .ql-toolbar button{background:none;border:none;cursor:pointer;display:inline-block;float:left;height:24px;padding:3px 5px;width:28px}.ql-snow.ql-toolbar button svg,.ql-snow .ql-toolbar button svg{float:left;height:100%}.ql-snow.ql-toolbar button:active:hover,.ql-snow .ql-toolbar button:active:hover{outline:none}.ql-snow.ql-toolbar input.ql-image[type=file],.ql-snow .ql-toolbar input.ql-image[type=file]{display:none}.ql-snow.ql-toolbar button:hover,.ql-snow .ql-toolbar button:hover,.ql-snow.ql-toolbar button:focus,.ql-snow .ql-toolbar button:focus,.ql-snow.ql-toolbar button.ql-active,.ql-snow .ql-toolbar button.ql-active,.ql-snow.ql-toolbar .ql-picker-label:hover,.ql-snow .ql-toolbar .ql-picker-label:hover,.ql-snow.ql-toolbar .ql-picker-label.ql-active,.ql-snow .ql-toolbar .ql-picker-label.ql-active,.ql-snow.ql-toolbar .ql-picker-item:hover,.ql-snow .ql-toolbar .ql-picker-item:hover,.ql-snow.ql-toolbar .ql-picker-item.ql-selected,.ql-snow .ql-toolbar .ql-picker-item.ql-selected{color:#06c}.ql-snow.ql-toolbar button:hover .ql-fill,.ql-snow .ql-toolbar button:hover .ql-fill,.ql-snow.ql-toolbar button:focus .ql-fill,.ql-snow .ql-toolbar button:focus .ql-fill,.ql-snow.ql-toolbar button.ql-active .ql-fill,.ql-snow .ql-toolbar button.ql-active .ql-fill,.ql-snow.ql-toolbar .ql-picker-label:hover .ql-fill,.ql-snow .ql-toolbar .ql-picker-label:hover .ql-fill,.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-fill,.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-fill,.ql-snow.ql-toolbar .ql-picker-item:hover .ql-fill,.ql-snow .ql-toolbar .ql-picker-item:hover .ql-fill,.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-fill,.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-fill,.ql-snow.ql-toolbar button:hover .ql-stroke.ql-fill,.ql-snow .ql-toolbar button:hover .ql-stroke.ql-fill,.ql-snow.ql-toolbar button:focus .ql-stroke.ql-fill,.ql-snow .ql-toolbar button:focus .ql-stroke.ql-fill,.ql-snow.ql-toolbar button.ql-active .ql-stroke.ql-fill,.ql-snow .ql-toolbar button.ql-active .ql-stroke.ql-fill,.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill,.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill,.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill,.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill,.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill,.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill,.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill,.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill{fill:#06c}.ql-snow.ql-toolbar button:hover .ql-stroke,.ql-snow .ql-toolbar button:hover .ql-stroke,.ql-snow.ql-toolbar button:focus .ql-stroke,.ql-snow .ql-toolbar button:focus .ql-stroke,.ql-snow.ql-toolbar button.ql-active .ql-stroke,.ql-snow .ql-toolbar button.ql-active .ql-stroke,.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke,.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke,.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke,.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke,.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke,.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke,.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke,.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke,.ql-snow.ql-toolbar button:hover .ql-stroke-miter,.ql-snow .ql-toolbar button:hover .ql-stroke-miter,.ql-snow.ql-toolbar button:focus .ql-stroke-miter,.ql-snow .ql-toolbar button:focus .ql-stroke-miter,.ql-snow.ql-toolbar button.ql-active .ql-stroke-miter,.ql-snow .ql-toolbar button.ql-active .ql-stroke-miter,.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke-miter,.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke-miter,.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter,.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter,.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke-miter,.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke-miter,.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter,.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter{stroke:#06c}@media(pointer:coarse){.ql-snow.ql-toolbar button:hover:not(.ql-active),.ql-snow .ql-toolbar button:hover:not(.ql-active){color:#444}.ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-fill,.ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-fill,.ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke.ql-fill,.ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke.ql-fill{fill:#444}.ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke,.ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke,.ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke-miter,.ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke-miter{stroke:#444}}.ql-snow,.ql-snow *{box-sizing:border-box}.ql-snow .ql-hidden{display:none}.ql-snow .ql-out-bottom,.ql-snow .ql-out-top{visibility:hidden}.ql-snow .ql-tooltip{position:absolute;transform:translateY(10px)}.ql-snow .ql-tooltip a{cursor:pointer;text-decoration:none}.ql-snow .ql-tooltip.ql-flip{transform:translateY(-10px)}.ql-snow .ql-formats{display:inline-block;vertical-align:middle}.ql-snow .ql-formats:after{clear:both;content:"";display:table}.ql-snow .ql-stroke{fill:none;stroke:#444;stroke-linecap:round;stroke-linejoin:round;stroke-width:2}.ql-snow .ql-stroke-miter{fill:none;stroke:#444;stroke-miterlimit:10;stroke-width:2}.ql-snow .ql-fill,.ql-snow .ql-stroke.ql-fill{fill:#444}.ql-snow .ql-empty{fill:none}.ql-snow .ql-even{fill-rule:evenodd}.ql-snow .ql-thin,.ql-snow .ql-stroke.ql-thin{stroke-width:1}.ql-snow .ql-transparent{opacity:.4}.ql-snow .ql-direction svg:last-child{display:none}.ql-snow .ql-direction.ql-active svg:last-child{display:inline}.ql-snow .ql-direction.ql-active svg:first-child{display:none}.ql-snow .ql-editor h1{font-size:2em}.ql-snow .ql-editor h2{font-size:1.5em}.ql-snow .ql-editor h3{font-size:1.17em}.ql-snow .ql-editor h4{font-size:1em}.ql-snow .ql-editor h5{font-size:.83em}.ql-snow .ql-editor h6{font-size:.67em}.ql-snow .ql-editor a{text-decoration:underline}.ql-snow .ql-editor blockquote{border-left:4px solid #ccc;margin-bottom:5px;margin-top:5px;padding-left:16px}.ql-snow .ql-editor code,.ql-snow .ql-editor pre{background-color:#f0f0f0;border-radius:3px}.ql-snow .ql-editor pre{white-space:pre-wrap;margin-bottom:5px;margin-top:5px;padding:5px 10px}.ql-snow .ql-editor code{font-size:85%;padding:2px 4px}.ql-snow .ql-editor pre.ql-syntax{background-color:#23241f;color:#f8f8f2;overflow:visible}.ql-snow .ql-editor img{max-width:100%}.ql-snow .ql-picker{color:#444;display:inline-block;float:left;font-size:14px;font-weight:500;height:24px;position:relative;vertical-align:middle}.ql-snow .ql-picker-label{cursor:pointer;display:inline-block;height:100%;padding-left:8px;padding-right:2px;position:relative;width:100%}.ql-snow .ql-picker-label:before{display:inline-block;line-height:22px}.ql-snow .ql-picker-options{background-color:#fff;display:none;min-width:100%;padding:4px 8px;position:absolute;white-space:nowrap}.ql-snow .ql-picker-options .ql-picker-item{cursor:pointer;display:block;padding-bottom:5px;padding-top:5px}.ql-snow .ql-picker.ql-expanded .ql-picker-label{color:#ccc;z-index:2}.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-fill{fill:#ccc}.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke{stroke:#ccc}.ql-snow .ql-picker.ql-expanded .ql-picker-options{display:block;margin-top:-1px;top:100%;z-index:1}.ql-snow .ql-color-picker,.ql-snow .ql-icon-picker{width:28px}.ql-snow .ql-color-picker .ql-picker-label,.ql-snow .ql-icon-picker .ql-picker-label{padding:2px 4px}.ql-snow .ql-color-picker .ql-picker-label svg,.ql-snow .ql-icon-picker .ql-picker-label svg{right:4px}.ql-snow .ql-icon-picker .ql-picker-options{padding:4px 0}.ql-snow .ql-icon-picker .ql-picker-item{height:24px;width:24px;padding:2px 4px}.ql-snow .ql-color-picker .ql-picker-options{padding:3px 5px;width:152px}.ql-snow .ql-color-picker .ql-picker-item{border:1px solid transparent;float:left;height:16px;margin:2px;padding:0;width:16px}.ql-snow .ql-picker:not(.ql-color-picker):not(.ql-icon-picker) svg{position:absolute;margin-top:-9px;right:0;top:50%;width:18px}.ql-snow .ql-picker.ql-header .ql-picker-label[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-font .ql-picker-label[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-size .ql-picker-label[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-font .ql-picker-item[data-label]:not([data-label=""]):before,.ql-snow .ql-picker.ql-size .ql-picker-item[data-label]:not([data-label=""]):before{content:attr(data-label)}.ql-snow .ql-picker.ql-header{width:98px}.ql-snow .ql-picker.ql-header .ql-picker-label:before,.ql-snow .ql-picker.ql-header .ql-picker-item:before{content:"Normal"}.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]:before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]:before{content:"Heading 1"}.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]:before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]:before{content:"Heading 2"}.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]:before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]:before{content:"Heading 3"}.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="4"]:before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]:before{content:"Heading 4"}.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="5"]:before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]:before{content:"Heading 5"}.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="6"]:before,.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]:before{content:"Heading 6"}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]:before{font-size:2em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]:before{font-size:1.5em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]:before{font-size:1.17em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]:before{font-size:1em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]:before{font-size:.83em}.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]:before{font-size:.67em}.ql-snow .ql-picker.ql-font{width:108px}.ql-snow .ql-picker.ql-font .ql-picker-label:before,.ql-snow .ql-picker.ql-font .ql-picker-item:before{content:"Sans Serif"}.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=serif]:before,.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]:before{content:"Serif"}.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=monospace]:before,.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]:before{content:"Monospace"}.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]:before{font-family:Georgia,Times New Roman,serif}.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]:before{font-family:Monaco,Courier New,monospace}.ql-snow .ql-picker.ql-size{width:98px}.ql-snow .ql-picker.ql-size .ql-picker-label:before,.ql-snow .ql-picker.ql-size .ql-picker-item:before{content:"Normal"}.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=small]:before,.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]:before{content:"Small"}.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=large]:before,.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]:before{content:"Large"}.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=huge]:before,.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]:before{content:"Huge"}.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]:before{font-size:10px}.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]:before{font-size:18px}.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]:before{font-size:32px}.ql-snow .ql-color-picker.ql-background .ql-picker-item{background-color:#fff}.ql-snow .ql-color-picker.ql-color .ql-picker-item{background-color:#000}.ql-toolbar.ql-snow{border:1px solid #ccc;box-sizing:border-box;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;padding:8px}.ql-toolbar.ql-snow .ql-formats{margin-right:15px}.ql-toolbar.ql-snow .ql-picker-label{border:1px solid transparent}.ql-toolbar.ql-snow .ql-picker-options{border:1px solid transparent;box-shadow:#0003 0 2px 8px}.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label,.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options{border-color:#ccc}.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item.ql-selected,.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item:hover{border-color:#000}.ql-toolbar.ql-snow+.ql-container.ql-snow{border-top:0px}.ql-snow .ql-tooltip{background-color:#fff;border:1px solid #ccc;box-shadow:0 0 5px #ddd;color:#444;padding:5px 12px;white-space:nowrap}.ql-snow .ql-tooltip:before{content:"Visit URL:";line-height:26px;margin-right:8px}.ql-snow .ql-tooltip input[type=text]{display:none;border:1px solid #ccc;font-size:13px;height:26px;margin:0;padding:3px 5px;width:170px}.ql-snow .ql-tooltip a.ql-preview{display:inline-block;max-width:200px;overflow-x:hidden;text-overflow:ellipsis;vertical-align:top}.ql-snow .ql-tooltip a.ql-action:after{border-right:1px solid #ccc;content:"Edit";margin-left:16px;padding-right:8px}.ql-snow .ql-tooltip a.ql-remove:before{content:"Remove";margin-left:8px}.ql-snow .ql-tooltip a{line-height:26px}.ql-snow .ql-tooltip.ql-editing a.ql-preview,.ql-snow .ql-tooltip.ql-editing a.ql-remove{display:none}.ql-snow .ql-tooltip.ql-editing input[type=text]{display:inline-block}.ql-snow .ql-tooltip.ql-editing a.ql-action:after{border-right:0px;content:"Save";padding-right:0}.ql-snow .ql-tooltip[data-mode=link]:before{content:"Enter link:"}.ql-snow .ql-tooltip[data-mode=formula]:before{content:"Enter formula:"}.ql-snow .ql-tooltip[data-mode=video]:before{content:"Enter video:"}.ql-snow a{color:#06c}.ql-container.ql-snow{border:1px solid #ccc}/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-content:""}}}@layer theme{:root,:host{--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-orange-50:oklch(98% .016 73.684);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-700:oklch(55.3% .195 38.402);--color-orange-800:oklch(47% .157 37.304);--color-orange-900:oklch(40.8% .123 38.172);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-800:oklch(47.6% .114 61.907);--color-lime-500:oklch(76.8% .233 130.85);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-emerald-900:oklch(37.8% .077 168.94);--color-teal-100:oklch(95.3% .051 180.801);--color-teal-500:oklch(70.4% .14 182.503);--color-teal-600:oklch(60% .118 184.704);--color-teal-700:oklch(51.1% .096 186.391);--color-teal-800:oklch(43.7% .078 188.216);--color-cyan-50:oklch(98.4% .019 200.873);--color-cyan-100:oklch(95.6% .045 203.388);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-700:oklch(52% .105 223.128);--color-cyan-800:oklch(45% .085 224.283);--color-sky-50:oklch(97.7% .013 236.62);--color-sky-100:oklch(95.1% .026 236.824);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-700:oklch(50% .134 242.749);--color-sky-800:oklch(44.3% .11 240.79);--color-sky-900:oklch(39.1% .09 240.876);--color-sky-950:oklch(29.3% .066 243.157);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-indigo-800:oklch(39.8% .195 277.366);--color-violet-50:oklch(96.9% .016 293.756);--color-violet-100:oklch(94.3% .029 294.588);--color-violet-200:oklch(89.4% .057 293.283);--color-violet-500:oklch(60.6% .25 292.717);--color-violet-700:oklch(49.1% .27 292.581);--color-violet-800:oklch(43.2% .232 292.759);--color-violet-900:oklch(38% .189 293.745);--color-violet-950:oklch(28.3% .141 291.089);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-200:oklch(90.2% .063 306.703);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-700:oklch(49.6% .265 301.924);--color-purple-800:oklch(43.8% .218 303.724);--color-fuchsia-500:oklch(66.7% .295 322.15);--color-pink-100:oklch(94.8% .028 342.258);--color-pink-600:oklch(59.2% .249 .584);--color-pink-800:oklch(45.9% .187 3.815);--color-rose-50:oklch(96.9% .015 12.422);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-rose-700:oklch(51.4% .222 16.935);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-zinc-800:oklch(27.4% .006 286.033);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tighter:-.05em;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--radius-xs:.125rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--animate-bounce:bounce 1s infinite;--blur-sm:8px;--blur-md:12px;--blur-3xl:64px;--aspect-video:16 / 9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-montserrat);--default-mono-font-family:var(--font-montserrat);--font-montserrat:"Montserrat", sans-serif;--color-border:var(--border);--color-re-red:var(--re-red)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::-moz-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::-moz-placeholder{color:currentColor}::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::-moz-placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);font-family:var(--font-montserrat);outline-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){*{outline-color:color-mix(in oklab,var(--ring) 50%,transparent)}}body{background-color:var(--background);font-family:var(--font-montserrat);color:var(--foreground)}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h1{font-size:var(--text-2xl);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h2{font-size:var(--text-xl);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h3{font-size:var(--text-lg);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h4{font-size:var(--text-base);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) p{font-size:var(--text-base);font-weight:var(--font-weight-normal);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) label,:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) button{font-size:var(--text-base);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) input{font-size:var(--text-base);font-weight:var(--font-weight-normal);line-height:1.5}}@layer components;@layer utilities{.\@container\/card-header{container:card-header/inline-size}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.-top-0\.5{top:calc(var(--spacing) * -.5)}.-top-1{top:calc(var(--spacing) * -1)}.-top-3{top:calc(var(--spacing) * -3)}.-top-12{top:calc(var(--spacing) * -12)}.-top-40{top:calc(var(--spacing) * -40)}.top-0{top:calc(var(--spacing) * 0)}.top-0\.5{top:calc(var(--spacing) * .5)}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-3\.5{top:calc(var(--spacing) * 3.5)}.top-4{top:calc(var(--spacing) * 4)}.top-6{top:calc(var(--spacing) * 6)}.top-10{top:calc(var(--spacing) * 10)}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.-right-0\.5{right:calc(var(--spacing) * -.5)}.-right-1{right:calc(var(--spacing) * -1)}.-right-3{right:calc(var(--spacing) * -3)}.-right-12{right:calc(var(--spacing) * -12)}.-right-40{right:calc(var(--spacing) * -40)}.right-0{right:calc(var(--spacing) * 0)}.right-0\.5{right:calc(var(--spacing) * .5)}.right-1{right:calc(var(--spacing) * 1)}.right-2{right:calc(var(--spacing) * 2)}.right-2\.5{right:calc(var(--spacing) * 2.5)}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.-bottom-12{bottom:calc(var(--spacing) * -12)}.-bottom-40{bottom:calc(var(--spacing) * -40)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-0\.5{bottom:calc(var(--spacing) * .5)}.bottom-12{bottom:calc(var(--spacing) * 12)}.bottom-\[-1px\]{bottom:-1px}.bottom-\[-24px\]{bottom:-24px}.bottom-full{bottom:100%}.-left-12{left:calc(var(--spacing) * -12)}.-left-40{left:calc(var(--spacing) * -40)}.left-0{left:calc(var(--spacing) * 0)}.left-1{left:calc(var(--spacing) * 1)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing) * 2)}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-4{left:calc(var(--spacing) * 4)}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[1\]{z-index:1}.z-\[100\]{z-index:100}.z-\[9999\]{z-index:9999}.order-1{order:1}.order-2{order:2}.col-span-1{grid-column:span 1/span 1}.col-span-2{grid-column:span 2/span 2}.col-span-3{grid-column:span 3/span 3}.col-span-4{grid-column:span 4/span 4}.col-span-5{grid-column:span 5/span 5}.col-span-6{grid-column:span 6/span 6}.col-span-full{grid-column:1/-1}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2/span 2}.row-start-1{grid-row-start:1}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.-mx-4{margin-inline:calc(var(--spacing) * -4)}.-mx-6{margin-inline:calc(var(--spacing) * -6)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-3\.5{margin-inline:calc(var(--spacing) * 3.5)}.mx-auto{margin-inline:auto}.my-0\.5{margin-block:calc(var(--spacing) * .5)}.my-1{margin-block:calc(var(--spacing) * 1)}.my-4{margin-block:calc(var(--spacing) * 4)}.my-8{margin-block:calc(var(--spacing) * 8)}.-mt-4{margin-top:calc(var(--spacing) * -4)}.mt-0{margin-top:calc(var(--spacing) * 0)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mt-10{margin-top:calc(var(--spacing) * 10)}.mt-auto{margin-top:auto}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-3{margin-right:calc(var(--spacing) * 3)}.-mb-6{margin-bottom:calc(var(--spacing) * -6)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-7{margin-bottom:calc(var(--spacing) * 7)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.mb-10{margin-bottom:calc(var(--spacing) * 10)}.mb-12{margin-bottom:calc(var(--spacing) * 12)}.-ml-4{margin-left:calc(var(--spacing) * -4)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-5{margin-left:calc(var(--spacing) * 5)}.ml-6{margin-left:calc(var(--spacing) * 6)}.ml-8{margin-left:calc(var(--spacing) * 8)}.ml-9{margin-left:calc(var(--spacing) * 9)}.ml-11{margin-left:calc(var(--spacing) * 11)}.ml-auto{margin-left:auto}.line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-row{display:table-row}.field-sizing-content{field-sizing:content}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.size-12{width:calc(var(--spacing) * 12);height:calc(var(--spacing) * 12)}.size-full{width:100%;height:100%}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1{height:calc(var(--spacing) * 1)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-4\.5{height:calc(var(--spacing) * 4.5)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-32{height:calc(var(--spacing) * 32)}.h-40{height:calc(var(--spacing) * 40)}.h-48{height:calc(var(--spacing) * 48)}.h-64{height:calc(var(--spacing) * 64)}.h-80{height:calc(var(--spacing) * 80)}.h-96{height:calc(var(--spacing) * 96)}.h-\[1\.15rem\]{height:1.15rem}.h-\[30rem\]{height:30rem}.h-\[44px\]{height:44px}.h-\[70vh\]{height:70vh}.h-\[85vh\]{height:85vh}.h-\[90vh\]{height:90vh}.h-\[400px\]{height:400px}.h-\[calc\(100\%-1px\)\]{height:calc(100% - 1px)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.h-svh{height:100svh}.max-h-\(--radix-context-menu-content-available-height\){max-height:var(--radix-context-menu-content-available-height)}.max-h-\(--radix-dropdown-menu-content-available-height\){max-height:var(--radix-dropdown-menu-content-available-height)}.max-h-\(--radix-select-content-available-height\){max-height:var(--radix-select-content-available-height)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-56{max-height:calc(var(--spacing) * 56)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[70vh\]{max-height:70vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[95vh\]{max-height:95vh}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[600px\]{max-height:600px}.max-h-\[800px\]{max-height:800px}.max-h-full{max-height:100%}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-4{min-height:calc(var(--spacing) * 4)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-\[32px\]{min-height:32px}.min-h-\[44px\]{min-height:44px}.min-h-\[60px\]{min-height:60px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[80px\]{min-height:80px}.min-h-\[96px\]{min-height:96px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[150px\]{min-height:150px}.min-h-\[320px\]{min-height:320px}.min-h-\[400px\]{min-height:400px}.min-h-\[420px\]{min-height:420px}.min-h-\[480px\]{min-height:480px}.min-h-\[600px\]{min-height:600px}.min-h-screen{min-height:100vh}.min-h-svh{min-height:100svh}.\!w-\[80vw\]{width:80vw!important}.w-\(--sidebar-width\){width:var(--sidebar-width)}.w-0{width:calc(var(--spacing) * 0)}.w-0\.5{width:calc(var(--spacing) * .5)}.w-1{width:calc(var(--spacing) * 1)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-3\/4{width:75%}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-64{width:calc(var(--spacing) * 64)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-\[10\%\]{width:10%}.w-\[15\%\]{width:15%}.w-\[20\%\]{width:20%}.w-\[35\%\]{width:35%}.w-\[45\%\]{width:45%}.w-\[50px\]{width:50px}.w-\[100px\]{width:100px}.w-\[200px\]{width:200px}.w-\[280px\]{width:280px}.w-\[360px\]{width:360px}.w-\[calc\(100\%-2rem\)\]{width:calc(100% - 2rem)}.w-\[var\(--radix-select-trigger-width\)\]{width:var(--radix-select-trigger-width)}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.\!max-w-\[80vw\]{max-width:80vw!important}.max-w-\(--skeleton-width\){max-width:var(--skeleton-width)}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[90vw\]{max-width:90vw}.max-w-\[95vw\]{max-width:95vw}.max-w-\[140px\]{max-width:140px}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[250px\]{max-width:250px}.max-w-\[1240px\]{max-width:1240px}.max-w-\[1600px\]{max-width:1600px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-\[min\(85\%\,36rem\)\]{max-width:min(85%,36rem)}.max-w-\[min\(100\%\,42rem\)\]{max-width:min(100%,42rem)}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-8{min-width:calc(var(--spacing) * 8)}.min-w-9{min-width:calc(var(--spacing) * 9)}.min-w-10{min-width:calc(var(--spacing) * 10)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[12rem\]{min-width:12rem}.min-w-\[60px\]{min-width:60px}.min-w-\[80px\]{min-width:80px}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[150px\]{min-width:150px}.min-w-\[180px\]{min-width:180px}.min-w-\[200px\]{min-width:200px}.min-w-\[300px\]{min-width:300px}.min-w-\[900px\]{min-width:900px}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.table-auto{table-layout:auto}.table-fixed{table-layout:fixed}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\(--radix-context-menu-content-transform-origin\){transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\(--radix-dropdown-menu-content-transform-origin\){transform-origin:var(--radix-dropdown-menu-content-transform-origin)}.origin-\(--radix-hover-card-content-transform-origin\){transform-origin:var(--radix-hover-card-content-transform-origin)}.origin-\(--radix-menubar-content-transform-origin\){transform-origin:var(--radix-menubar-content-transform-origin)}.origin-\(--radix-popover-content-transform-origin\){transform-origin:var(--radix-popover-content-transform-origin)}.origin-\(--radix-select-content-transform-origin\){transform-origin:var(--radix-select-content-transform-origin)}.origin-\(--radix-tooltip-content-transform-origin\){transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-x-px{--tw-translate-x:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-\[-50\%\]{--tw-translate-x:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-px{--tw-translate-x:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-0\.5{--tw-translate-y:calc(var(--spacing) * .5);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[-50\%\]{--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[calc\(-50\%_-_2px\)\]{--tw-translate-y: calc(-50% - 2px) ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-45{rotate:45deg}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\[loading_1\.5s_infinite_linear\]{animation:1.5s linear infinite loading}.animate-bounce{animation:var(--animate-bounce)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize-none{resize:none}.resize-y{resize:vertical}.scroll-my-1{scroll-margin-block:calc(var(--spacing) * 1)}.scroll-py-1{scroll-padding-block:calc(var(--spacing) * 1)}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.\[appearance\:textfield\]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.auto-rows-min{grid-auto-rows:min-content}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-\[0_1fr\]{grid-template-columns:0 1fr}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.justify-items-start{justify-items:start}.gap-0{gap:calc(var(--spacing) * 0)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-10{gap:calc(var(--spacing) * 10)}.gap-12{gap:calc(var(--spacing) * 12)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 0) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 0) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-10>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 10) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 10) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{-moz-column-gap:calc(var(--spacing) * 2);column-gap:calc(var(--spacing) * 2)}.gap-x-3{-moz-column-gap:calc(var(--spacing) * 3);column-gap:calc(var(--spacing) * 3)}.gap-x-6{-moz-column-gap:calc(var(--spacing) * 6);column-gap:calc(var(--spacing) * 6)}.gap-x-8{-moz-column-gap:calc(var(--spacing) * 8);column-gap:calc(var(--spacing) * 8)}.gap-x-10{-moz-column-gap:calc(var(--spacing) * 10);column-gap:calc(var(--spacing) * 10)}:where(.-space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * -2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * -2) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-1>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 1) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-3>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 3) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-4>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 4) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-x-reverse)))}.gap-y-0\.5{row-gap:calc(var(--spacing) * .5)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-4{row-gap:calc(var(--spacing) * 4)}.gap-y-6{row-gap:calc(var(--spacing) * 6)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-100>:not(:last-child)){border-color:var(--color-gray-100)}:where(.divide-slate-50>:not(:last-child)){border-color:var(--color-slate-50)}:where(.divide-slate-100>:not(:last-child)){border-color:var(--color-slate-100)}.self-center{align-self:center}.self-start{align-self:flex-start}.self-stretch{align-self:stretch}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\[2px\]{border-radius:2px}.rounded-\[4px\]{border-radius:4px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-xs{border-radius:var(--radius-xs)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.rounded-tl-none{border-top-left-radius:0}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-tr-none{border-top-right-radius:0}.rounded-b-lg{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-8{border-style:var(--tw-border-style);border-width:8px}.border-\[1\.5px\]{border-style:var(--tw-border-style);border-width:1.5px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-t-4{border-top-style:var(--tw-border-style);border-top-width:4px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-b-4{border-bottom-style:var(--tw-border-style);border-bottom-width:4px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-none{--tw-border-style:none;border-style:none}.border-\(--color-border\){border-color:var(--color-border)}.border-\[\#cccccc\]{border-color:#ccc}.border-amber-100{border-color:var(--color-amber-100)}.border-amber-100\/50{border-color:#fef3c680}@supports (color:color-mix(in lab,red,red)){.border-amber-100\/50{border-color:color-mix(in oklab,var(--color-amber-100) 50%,transparent)}}.border-amber-200{border-color:var(--color-amber-200)}.border-amber-300{border-color:var(--color-amber-300)}.border-amber-400{border-color:var(--color-amber-400)}.border-amber-500{border-color:var(--color-amber-500)}.border-amber-600{border-color:var(--color-amber-600)}.border-blue-100{border-color:var(--color-blue-100)}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-300{border-color:var(--color-blue-300)}.border-blue-400{border-color:var(--color-blue-400)}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-600{border-color:var(--color-blue-600)}.border-blue-700{border-color:var(--color-blue-700)}.border-border,.border-border\/50{border-color:var(--border)}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,var(--border) 50%,transparent)}}.border-cyan-300{border-color:var(--color-cyan-300)}.border-emerald-100{border-color:var(--color-emerald-100)}.border-emerald-200{border-color:var(--color-emerald-200)}.border-emerald-400{border-color:var(--color-emerald-400)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-green-100{border-color:var(--color-green-100)}.border-green-200{border-color:var(--color-green-200)}.border-green-300{border-color:var(--color-green-300)}.border-green-400{border-color:var(--color-green-400)}.border-green-500{border-color:var(--color-green-500)}.border-green-600{border-color:var(--color-green-600)}.border-indigo-200{border-color:var(--color-indigo-200)}.border-indigo-300{border-color:var(--color-indigo-300)}.border-input{border-color:var(--input)}.border-orange-200{border-color:var(--color-orange-200)}.border-orange-300{border-color:var(--color-orange-300)}.border-primary{border-color:var(--primary)}.border-purple-100{border-color:var(--color-purple-100)}.border-purple-200{border-color:var(--color-purple-200)}.border-purple-300{border-color:var(--color-purple-300)}.border-re-red{border-color:var(--re-red)}.border-red-50{border-color:var(--color-red-50)}.border-red-100{border-color:var(--color-red-100)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-red-400{border-color:var(--color-red-400)}.border-red-500{border-color:var(--color-red-500)}.border-red-600{border-color:var(--color-red-600)}.border-rose-100{border-color:var(--color-rose-100)}.border-sidebar-border{border-color:var(--sidebar-border)}.border-sky-200{border-color:var(--color-sky-200)}.border-slate-50{border-color:var(--color-slate-50)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-200\/50{border-color:#e2e8f080}@supports (color:color-mix(in lab,red,red)){.border-slate-200\/50{border-color:color-mix(in oklab,var(--color-slate-200) 50%,transparent)}}.border-slate-200\/90{border-color:#e2e8f0e6}@supports (color:color-mix(in lab,red,red)){.border-slate-200\/90{border-color:color-mix(in oklab,var(--color-slate-200) 90%,transparent)}}.border-slate-300{border-color:var(--color-slate-300)}.border-slate-400{border-color:var(--color-slate-400)}.border-slate-700{border-color:var(--color-slate-700)}.border-slate-700\/50{border-color:#31415880}@supports (color:color-mix(in lab,red,red)){.border-slate-700\/50{border-color:color-mix(in oklab,var(--color-slate-700) 50%,transparent)}}.border-slate-800{border-color:var(--color-slate-800)}.border-teal-500{border-color:var(--color-teal-500)}.border-transparent{border-color:#0000}.border-violet-200{border-color:var(--color-violet-200)}.border-white{border-color:var(--color-white)}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.border-white\/30{border-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.border-white\/30{border-color:color-mix(in oklab,var(--color-white) 30%,transparent)}}.border-yellow-200{border-color:var(--color-yellow-200)}.border-yellow-300{border-color:var(--color-yellow-300)}.border-t-slate-900{border-top-color:var(--color-slate-900)}.border-t-transparent{border-top-color:#0000}.border-t-white{border-top-color:var(--color-white)}.border-l-amber-500{border-left-color:var(--color-amber-500)}.border-l-green-500{border-left-color:var(--color-green-500)}.border-l-red-500{border-left-color:var(--color-red-500)}.border-l-transparent{border-left-color:#0000}.bg-\(--color-bg\){background-color:var(--color-bg)}.bg-accent{background-color:var(--accent)}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-50\/20{background-color:#fffbeb33}@supports (color:color-mix(in lab,red,red)){.bg-amber-50\/20{background-color:color-mix(in oklab,var(--color-amber-50) 20%,transparent)}}.bg-amber-50\/30{background-color:#fffbeb4d}@supports (color:color-mix(in lab,red,red)){.bg-amber-50\/30{background-color:color-mix(in oklab,var(--color-amber-50) 30%,transparent)}}.bg-amber-50\/50{background-color:#fffbeb80}@supports (color:color-mix(in lab,red,red)){.bg-amber-50\/50{background-color:color-mix(in oklab,var(--color-amber-50) 50%,transparent)}}.bg-amber-50\/80{background-color:#fffbebcc}@supports (color:color-mix(in lab,red,red)){.bg-amber-50\/80{background-color:color-mix(in oklab,var(--color-amber-50) 80%,transparent)}}.bg-amber-100{background-color:var(--color-amber-100)}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.bg-amber-600{background-color:var(--color-amber-600)}.bg-amber-600\/10{background-color:#dd74001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-600\/10{background-color:color-mix(in oklab,var(--color-amber-600) 10%,transparent)}}.bg-amber-600\/20{background-color:#dd740033}@supports (color:color-mix(in lab,red,red)){.bg-amber-600\/20{background-color:color-mix(in oklab,var(--color-amber-600) 20%,transparent)}}.bg-background{background-color:var(--background)}.bg-black{background-color:var(--color-black)}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-50\/30{background-color:#eff6ff4d}@supports (color:color-mix(in lab,red,red)){.bg-blue-50\/30{background-color:color-mix(in oklab,var(--color-blue-50) 30%,transparent)}}.bg-blue-50\/50{background-color:#eff6ff80}@supports (color:color-mix(in lab,red,red)){.bg-blue-50\/50{background-color:color-mix(in oklab,var(--color-blue-50) 50%,transparent)}}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-200{background-color:var(--color-blue-200)}.bg-blue-300{background-color:var(--color-blue-300)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-current{background-color:currentColor}.bg-cyan-100{background-color:var(--color-cyan-100)}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-destructive{background-color:var(--destructive)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-emerald-50\/40{background-color:#ecfdf566}@supports (color:color-mix(in lab,red,red)){.bg-emerald-50\/40{background-color:color-mix(in oklab,var(--color-emerald-50) 40%,transparent)}}.bg-emerald-50\/90{background-color:#ecfdf5e6}@supports (color:color-mix(in lab,red,red)){.bg-emerald-50\/90{background-color:color-mix(in oklab,var(--color-emerald-50) 90%,transparent)}}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.bg-emerald-600{background-color:var(--color-emerald-600)}.bg-foreground{background-color:var(--foreground)}.bg-fuchsia-500{background-color:var(--color-fuchsia-500)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-50\/30{background-color:#f0fdf44d}@supports (color:color-mix(in lab,red,red)){.bg-green-50\/30{background-color:color-mix(in oklab,var(--color-green-50) 30%,transparent)}}.bg-green-50\/50{background-color:#f0fdf480}@supports (color:color-mix(in lab,red,red)){.bg-green-50\/50{background-color:color-mix(in oklab,var(--color-green-50) 50%,transparent)}}.bg-green-100{background-color:var(--color-green-100)}.bg-green-200{background-color:var(--color-green-200)}.bg-green-300{background-color:var(--color-green-300)}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/30{background-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/30{background-color:color-mix(in oklab,var(--color-green-500) 30%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-green-700{background-color:var(--color-green-700)}.bg-indigo-50{background-color:var(--color-indigo-50)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-500{background-color:var(--color-indigo-500)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-input-background{background-color:var(--input-background)}.bg-lime-500{background-color:var(--color-lime-500)}.bg-muted,.bg-muted\/50{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.bg-muted\/50{background-color:color-mix(in oklab,var(--muted) 50%,transparent)}}.bg-orange-50{background-color:var(--color-orange-50)}.bg-orange-50\/30{background-color:#fff7ed4d}@supports (color:color-mix(in lab,red,red)){.bg-orange-50\/30{background-color:color-mix(in oklab,var(--color-orange-50) 30%,transparent)}}.bg-orange-100{background-color:var(--color-orange-100)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-600{background-color:var(--color-orange-600)}.bg-pink-100{background-color:var(--color-pink-100)}.bg-pink-600{background-color:var(--color-pink-600)}.bg-popover{background-color:var(--popover)}.bg-primary,.bg-primary\/20{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.bg-primary\/20{background-color:color-mix(in oklab,var(--primary) 20%,transparent)}}.bg-purple-50{background-color:var(--color-purple-50)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-purple-500{background-color:var(--color-purple-500)}.bg-purple-600{background-color:var(--color-purple-600)}.bg-re-black{background-color:var(--re-black)}.bg-re-red,.bg-re-red\/20{background-color:var(--re-red)}@supports (color:color-mix(in lab,red,red)){.bg-re-red\/20{background-color:color-mix(in oklab,var(--re-red) 20%,transparent)}}.bg-red-50{background-color:var(--color-red-50)}.bg-red-50\/30{background-color:#fef2f24d}@supports (color:color-mix(in lab,red,red)){.bg-red-50\/30{background-color:color-mix(in oklab,var(--color-red-50) 30%,transparent)}}.bg-red-50\/40{background-color:#fef2f266}@supports (color:color-mix(in lab,red,red)){.bg-red-50\/40{background-color:color-mix(in oklab,var(--color-red-50) 40%,transparent)}}.bg-red-50\/50{background-color:#fef2f280}@supports (color:color-mix(in lab,red,red)){.bg-red-50\/50{background-color:color-mix(in oklab,var(--color-red-50) 50%,transparent)}}.bg-red-50\/90{background-color:#fef2f2e6}@supports (color:color-mix(in lab,red,red)){.bg-red-50\/90{background-color:color-mix(in oklab,var(--color-red-50) 90%,transparent)}}.bg-red-100{background-color:var(--color-red-100)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-600{background-color:var(--color-red-600)}.bg-red-600\/20{background-color:#e4001433}@supports (color:color-mix(in lab,red,red)){.bg-red-600\/20{background-color:color-mix(in oklab,var(--color-red-600) 20%,transparent)}}.bg-red-700{background-color:var(--color-red-700)}.bg-red-700\/15{background-color:#bf000f26}@supports (color:color-mix(in lab,red,red)){.bg-red-700\/15{background-color:color-mix(in oklab,var(--color-red-700) 15%,transparent)}}.bg-rose-50{background-color:var(--color-rose-50)}.bg-rose-500\/20{background-color:#ff235733}@supports (color:color-mix(in lab,red,red)){.bg-rose-500\/20{background-color:color-mix(in oklab,var(--color-rose-500) 20%,transparent)}}.bg-secondary{background-color:var(--secondary)}.bg-sidebar{background-color:var(--sidebar)}.bg-sidebar-border{background-color:var(--sidebar-border)}.bg-sky-50{background-color:var(--color-sky-50)}.bg-sky-50\/80{background-color:#f0f9ffcc}@supports (color:color-mix(in lab,red,red)){.bg-sky-50\/80{background-color:color-mix(in oklab,var(--color-sky-50) 80%,transparent)}}.bg-sky-50\/90{background-color:#f0f9ffe6}@supports (color:color-mix(in lab,red,red)){.bg-sky-50\/90{background-color:color-mix(in oklab,var(--color-sky-50) 90%,transparent)}}.bg-sky-100{background-color:var(--color-sky-100)}.bg-sky-500{background-color:var(--color-sky-500)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-50\/30{background-color:#f8fafc4d}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/30{background-color:color-mix(in oklab,var(--color-slate-50) 30%,transparent)}}.bg-slate-50\/40{background-color:#f8fafc66}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/40{background-color:color-mix(in oklab,var(--color-slate-50) 40%,transparent)}}.bg-slate-50\/50{background-color:#f8fafc80}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/50{background-color:color-mix(in oklab,var(--color-slate-50) 50%,transparent)}}.bg-slate-50\/80{background-color:#f8fafccc}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/80{background-color:color-mix(in oklab,var(--color-slate-50) 80%,transparent)}}.bg-slate-50\/95{background-color:#f8fafcf2}@supports (color:color-mix(in lab,red,red)){.bg-slate-50\/95{background-color:color-mix(in oklab,var(--color-slate-50) 95%,transparent)}}.bg-slate-100{background-color:var(--color-slate-100)}.bg-slate-100\/80{background-color:#f1f5f9cc}@supports (color:color-mix(in lab,red,red)){.bg-slate-100\/80{background-color:color-mix(in oklab,var(--color-slate-100) 80%,transparent)}}.bg-slate-200{background-color:var(--color-slate-200)}.bg-slate-300{background-color:var(--color-slate-300)}.bg-slate-400{background-color:var(--color-slate-400)}.bg-slate-500{background-color:var(--color-slate-500)}.bg-slate-700{background-color:var(--color-slate-700)}.bg-slate-700\/50{background-color:#31415880}@supports (color:color-mix(in lab,red,red)){.bg-slate-700\/50{background-color:color-mix(in oklab,var(--color-slate-700) 50%,transparent)}}.bg-slate-800{background-color:var(--color-slate-800)}.bg-slate-800\/50{background-color:#1d293d80}@supports (color:color-mix(in lab,red,red)){.bg-slate-800\/50{background-color:color-mix(in oklab,var(--color-slate-800) 50%,transparent)}}.bg-slate-900{background-color:var(--color-slate-900)}.bg-slate-900\/5{background-color:#0f172b0d}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/5{background-color:color-mix(in oklab,var(--color-slate-900) 5%,transparent)}}.bg-slate-900\/20{background-color:#0f172b33}@supports (color:color-mix(in lab,red,red)){.bg-slate-900\/20{background-color:color-mix(in oklab,var(--color-slate-900) 20%,transparent)}}.bg-slate-950{background-color:var(--color-slate-950)}.bg-teal-100{background-color:var(--color-teal-100)}.bg-teal-500{background-color:var(--color-teal-500)}.bg-teal-600{background-color:var(--color-teal-600)}.bg-transparent{background-color:#0000}.bg-violet-50\/80{background-color:#f5f3ffcc}@supports (color:color-mix(in lab,red,red)){.bg-violet-50\/80{background-color:color-mix(in oklab,var(--color-violet-50) 80%,transparent)}}.bg-violet-50\/90{background-color:#f5f3ffe6}@supports (color:color-mix(in lab,red,red)){.bg-violet-50\/90{background-color:color-mix(in oklab,var(--color-violet-50) 90%,transparent)}}.bg-violet-100{background-color:var(--color-violet-100)}.bg-violet-500{background-color:var(--color-violet-500)}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white) 20%,transparent)}}.bg-white\/40{background-color:#fff6}@supports (color:color-mix(in lab,red,red)){.bg-white\/40{background-color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.bg-white\/50{background-color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.bg-white\/50{background-color:color-mix(in oklab,var(--color-white) 50%,transparent)}}.bg-white\/60{background-color:#fff9}@supports (color:color-mix(in lab,red,red)){.bg-white\/60{background-color:color-mix(in oklab,var(--color-white) 60%,transparent)}}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.bg-white\/80{background-color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.bg-yellow-50\/30{background-color:#fefce84d}@supports (color:color-mix(in lab,red,red)){.bg-yellow-50\/30{background-color:color-mix(in oklab,var(--color-yellow-50) 30%,transparent)}}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-yellow-500{background-color:var(--color-yellow-500)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-amber-50{--tw-gradient-from:var(--color-amber-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-amber-500{--tw-gradient-from:var(--color-amber-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-amber-600\/20{--tw-gradient-from:#dd740033}@supports (color:color-mix(in lab,red,red)){.from-amber-600\/20{--tw-gradient-from:color-mix(in oklab, var(--color-amber-600) 20%, transparent)}}.from-amber-600\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-50{--tw-gradient-from:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-green-50{--tw-gradient-from:var(--color-green-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-green-600{--tw-gradient-from:var(--color-green-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-50{--tw-gradient-from:var(--color-purple-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-600{--tw-gradient-from:var(--color-purple-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-600{--tw-gradient-from:var(--color-red-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-600\/20{--tw-gradient-from:#e4001433}@supports (color:color-mix(in lab,red,red)){.from-red-600\/20{--tw-gradient-from:color-mix(in oklab, var(--color-red-600) 20%, transparent)}}.from-red-600\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-slate-900{--tw-gradient-from:var(--color-slate-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-white{--tw-gradient-from:var(--color-white);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-slate-800{--tw-gradient-via:var(--color-slate-800);--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-amber-600{--tw-gradient-to:var(--color-amber-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-50{--tw-gradient-to:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-50{--tw-gradient-to:var(--color-cyan-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-50{--tw-gradient-to:var(--color-emerald-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-green-500{--tw-gradient-to:var(--color-green-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-50{--tw-gradient-to:var(--color-indigo-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-600{--tw-gradient-to:var(--color-indigo-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-50{--tw-gradient-to:var(--color-orange-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-red-500{--tw-gradient-to:var(--color-red-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-red-700{--tw-gradient-to:var(--color-red-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-50{--tw-gradient-to:var(--color-slate-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-50\/50{--tw-gradient-to:#f8fafc80}@supports (color:color-mix(in lab,red,red)){.to-slate-50\/50{--tw-gradient-to:color-mix(in oklab, var(--color-slate-50) 50%, transparent)}}.to-slate-50\/50{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-800{--tw-gradient-to:var(--color-slate-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-slate-900{--tw-gradient-to:var(--color-slate-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.fill-current{fill:currentColor}.fill-primary{fill:var(--primary)}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-7{padding:calc(var(--spacing) * 7)}.p-8{padding:calc(var(--spacing) * 8)}.p-10{padding:calc(var(--spacing) * 10)}.p-12{padding:calc(var(--spacing) * 12)}.p-20{padding:calc(var(--spacing) * 20)}.p-\[3px\]{padding:3px}.p-px{padding:1px}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.px-10{padding-inline:calc(var(--spacing) * 10)}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-16{padding-block:calc(var(--spacing) * 16)}.py-20{padding-block:calc(var(--spacing) * 20)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-10{padding-top:calc(var(--spacing) * 10)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pr-6{padding-right:calc(var(--spacing) * 6)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-2\.5{padding-bottom:calc(var(--spacing) * 2.5)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pb-8{padding-bottom:calc(var(--spacing) * 8)}.pb-24{padding-bottom:calc(var(--spacing) * 24)}.pl-1{padding-left:calc(var(--spacing) * 1)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-6{padding-left:calc(var(--spacing) * 6)}.pl-7{padding-left:calc(var(--spacing) * 7)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.pl-10{padding-left:calc(var(--spacing) * 10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--font-montserrat)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[0\.8rem\]{font-size:.8rem}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[28px\]{font-size:28px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.1em\]{--tw-tracking:.1em;letter-spacing:.1em}.tracking-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-tighter{--tw-tracking:var(--tracking-tighter);letter-spacing:var(--tracking-tighter)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#333333\]{color:#333}.text-\[\#666666\]{color:#666}.text-accent-foreground{color:var(--accent-foreground)}.text-amber-100{color:var(--color-amber-100)}.text-amber-100\/80{color:#fef3c6cc}@supports (color:color-mix(in lab,red,red)){.text-amber-100\/80{color:color-mix(in oklab,var(--color-amber-100) 80%,transparent)}}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-amber-800\/80{color:#953d00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-800\/80{color:color-mix(in oklab,var(--color-amber-800) 80%,transparent)}}.text-amber-900{color:var(--color-amber-900)}.text-black{color:var(--color-black)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-blue-900{color:var(--color-blue-900)}.text-card-foreground{color:var(--card-foreground)}.text-current{color:currentColor}.text-cyan-700{color:var(--color-cyan-700)}.text-cyan-800{color:var(--color-cyan-800)}.text-destructive{color:var(--destructive)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-emerald-700{color:var(--color-emerald-700)}.text-emerald-800{color:var(--color-emerald-800)}.text-emerald-900{color:var(--color-emerald-900)}.text-foreground{color:var(--foreground)}.text-gray-300{color:var(--color-gray-300)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-green-900{color:var(--color-green-900)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-700{color:var(--color-indigo-700)}.text-indigo-800{color:var(--color-indigo-800)}.text-muted-foreground{color:var(--muted-foreground)}.text-orange-600{color:var(--color-orange-600)}.text-orange-700{color:var(--color-orange-700)}.text-orange-800{color:var(--color-orange-800)}.text-orange-900{color:var(--color-orange-900)}.text-pink-800{color:var(--color-pink-800)}.text-popover-foreground{color:var(--popover-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-purple-600{color:var(--color-purple-600)}.text-purple-700{color:var(--color-purple-700)}.text-purple-800{color:var(--color-purple-800)}.text-re-red{color:var(--re-red)}.text-red-100{color:var(--color-red-100)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-red-900{color:var(--color-red-900)}.text-rose-400{color:var(--color-rose-400)}.text-rose-700{color:var(--color-rose-700)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-sidebar-foreground,.text-sidebar-foreground\/70{color:var(--sidebar-foreground)}@supports (color:color-mix(in lab,red,red)){.text-sidebar-foreground\/70{color:color-mix(in oklab,var(--sidebar-foreground) 70%,transparent)}}.text-sky-700{color:var(--color-sky-700)}.text-sky-800{color:var(--color-sky-800)}.text-sky-900{color:var(--color-sky-900)}.text-sky-900\/90{color:#024a70e6}@supports (color:color-mix(in lab,red,red)){.text-sky-900\/90{color:color-mix(in oklab,var(--color-sky-900) 90%,transparent)}}.text-sky-950{color:var(--color-sky-950)}.text-slate-200{color:var(--color-slate-200)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-teal-700{color:var(--color-teal-700)}.text-teal-800{color:var(--color-teal-800)}.text-violet-700{color:var(--color-violet-700)}.text-violet-800{color:var(--color-violet-800)}.text-violet-900{color:var(--color-violet-900)}.text-violet-900\/90{color:#4d179ae6}@supports (color:color-mix(in lab,red,red)){.text-violet-900\/90{color:color-mix(in oklab,var(--color-violet-900) 90%,transparent)}}.text-violet-950{color:var(--color-violet-950)}.text-white{color:var(--color-white)}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white) 70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.text-yellow-600{color:var(--color-yellow-600)}.text-yellow-700{color:var(--color-yellow-700)}.text-yellow-800{color:var(--color-yellow-800)}.capitalize{text-transform:capitalize}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.decoration-amber-500{text-decoration-color:var(--color-amber-500)}.decoration-2{text-decoration-thickness:2px}.underline-offset-4{text-underline-offset:4px}.accent-slate-900{accent-color:var(--color-slate-900)}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_-4px_10px_-5px_rgba\(0\,0\,0\,0\.05\)\]{--tw-shadow:0 -4px 10px -5px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,hsl(var(--sidebar-border)));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_8px_rgba\(34\,197\,94\,0\.4\)\]{--tw-shadow:0 0 8px var(--tw-shadow-color,#22c55e66);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_40px_rgba\(220\,38\,38\,0\.2\)\]{--tw-shadow:0 0 40px var(--tw-shadow-color,#dc262633);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_40px_rgba\(245\,158\,11\,0\.2\)\]{--tw-shadow:0 0 40px var(--tw-shadow-color,#f59e0b33);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-amber-200{--tw-shadow-color:oklch(92.4% .12 95.746)}@supports (color:color-mix(in lab,red,red)){.shadow-amber-200{--tw-shadow-color:color-mix(in oklab, var(--color-amber-200) var(--tw-shadow-alpha), transparent)}}.shadow-amber-200\/50{--tw-shadow-color:#fee68580}@supports (color:color-mix(in lab,red,red)){.shadow-amber-200\/50{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-200) 50%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-amber-600\/10{--tw-shadow-color:#dd74001a}@supports (color:color-mix(in lab,red,red)){.shadow-amber-600\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-600) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-amber-600\/15{--tw-shadow-color:#dd740026}@supports (color:color-mix(in lab,red,red)){.shadow-amber-600\/15{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-600) 15%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-green-100{--tw-shadow-color:oklch(96.2% .044 156.743)}@supports (color:color-mix(in lab,red,red)){.shadow-green-100{--tw-shadow-color:color-mix(in oklab, var(--color-green-100) var(--tw-shadow-alpha), transparent)}}.shadow-green-600\/20{--tw-shadow-color:#00a54433}@supports (color:color-mix(in lab,red,red)){.shadow-green-600\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-green-600) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-purple-200{--tw-shadow-color:oklch(90.2% .063 306.703)}@supports (color:color-mix(in lab,red,red)){.shadow-purple-200{--tw-shadow-color:color-mix(in oklab, var(--color-purple-200) var(--tw-shadow-alpha), transparent)}}.shadow-re-red\/20{--tw-shadow-color:var(--re-red)}@supports (color:color-mix(in lab,red,red)){.shadow-re-red\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--re-red) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-200{--tw-shadow-color:oklch(88.5% .062 18.334)}@supports (color:color-mix(in lab,red,red)){.shadow-red-200{--tw-shadow-color:color-mix(in oklab, var(--color-red-200) var(--tw-shadow-alpha), transparent)}}.shadow-slate-200{--tw-shadow-color:oklch(92.9% .013 255.508)}@supports (color:color-mix(in lab,red,red)){.shadow-slate-200{--tw-shadow-color:color-mix(in oklab, var(--color-slate-200) var(--tw-shadow-alpha), transparent)}}.shadow-slate-900\/10{--tw-shadow-color:#0f172b1a}@supports (color:color-mix(in lab,red,red)){.shadow-slate-900\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-slate-900) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-black\/5{--tw-ring-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.ring-black\/5{--tw-ring-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.ring-emerald-300{--tw-ring-color:var(--color-emerald-300)}.ring-emerald-300\/70{--tw-ring-color:#5ee9b5b3}@supports (color:color-mix(in lab,red,red)){.ring-emerald-300\/70{--tw-ring-color:color-mix(in oklab, var(--color-emerald-300) 70%, transparent)}}.ring-red-300\/70{--tw-ring-color:#ffa3a3b3}@supports (color:color-mix(in lab,red,red)){.ring-red-300\/70{--tw-ring-color:color-mix(in oklab, var(--color-red-300) 70%, transparent)}}.ring-ring\/50{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.ring-ring\/50{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.ring-sidebar-ring{--tw-ring-color:var(--sidebar-ring)}.ring-slate-100{--tw-ring-color:var(--color-slate-100)}.ring-slate-200{--tw-ring-color:var(--color-slate-200)}.ring-transparent{--tw-ring-color:transparent}.ring-white\/20{--tw-ring-color:#fff3}@supports (color:color-mix(in lab,red,red)){.ring-white\/20{--tw-ring-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.ring-offset-background{--tw-ring-offset-color:var(--background)}.ring-offset-white{--tw-ring-offset-color:var(--color-white)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.grayscale-\[0\.5\]{--tw-grayscale:grayscale(.5);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-\[1px\]{--tw-backdrop-blur:blur(1px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[color\,box-shadow\]{transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[margin\,opacity\]{transition-property:margin,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-none{transition-property:none}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-1000{--tw-duration:1s;transition-duration:1s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-linear{--tw-ease:linear;transition-timing-function:linear}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.group-focus-within\/menu-item\:opacity-100:is(:where(.group\/menu-item):focus-within *){opacity:1}@media(hover:hover){.group-hover\:scale-105:is(:where(.group):hover *){--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.group-hover\:scale-110:is(:where(.group):hover *){--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.group-hover\:bg-amber-100:is(:where(.group):hover *){background-color:var(--color-amber-100)}.group-hover\:bg-amber-600:is(:where(.group):hover *){background-color:var(--color-amber-600)}.group-hover\:bg-blue-50:is(:where(.group):hover *){background-color:var(--color-blue-50)}.group-hover\:bg-slate-100:is(:where(.group):hover *){background-color:var(--color-slate-100)}.group-hover\:bg-white:is(:where(.group):hover *){background-color:var(--color-white)}.group-hover\:text-amber-500:is(:where(.group):hover *){color:var(--color-amber-500)}.group-hover\:text-amber-600:is(:where(.group):hover *){color:var(--color-amber-600)}.group-hover\:text-amber-700:is(:where(.group):hover *){color:var(--color-amber-700)}.group-hover\:text-blue-600:is(:where(.group):hover *){color:var(--color-blue-600)}.group-hover\:text-emerald-900:is(:where(.group):hover *){color:var(--color-emerald-900)}.group-hover\:text-red-900:is(:where(.group):hover *){color:var(--color-red-900)}.group-hover\:text-slate-400:is(:where(.group):hover *){color:var(--color-slate-400)}.group-hover\:text-slate-900:is(:where(.group):hover *){color:var(--color-slate-900)}.group-hover\:text-white:is(:where(.group):hover *){color:var(--color-white)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}.group-hover\:ring-blue-100:is(:where(.group):hover *){--tw-ring-color:var(--color-blue-100)}.group-hover\/menu-item\:opacity-100:is(:where(.group\/menu-item):hover *),.group-hover\/num\:opacity-100:is(:where(.group\/num):hover *){opacity:1}.group-hover\/opt\:text-slate-900:is(:where(.group\/opt):hover *){color:var(--color-slate-900)}.group-hover\/opt\:opacity-100:is(:where(.group\/opt):hover *),.group-hover\/optnum\:opacity-100:is(:where(.group\/optnum):hover *){opacity:1}}.group-has-data-\[sidebar\=menu-action\]\/menu-item\:pr-8:is(:where(.group\/menu-item):has([data-sidebar=menu-action]) *){padding-right:calc(var(--spacing) * 8)}.group-data-\[collapsible\=icon\]\:-mt-8:is(:where(.group)[data-collapsible=icon] *){margin-top:calc(var(--spacing) * -8)}.group-data-\[collapsible\=icon\]\:hidden:is(:where(.group)[data-collapsible=icon] *){display:none}.group-data-\[collapsible\=icon\]\:size-8\!:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--spacing) * 8)!important;height:calc(var(--spacing) * 8)!important}.group-data-\[collapsible\=icon\]\:w-\(--sidebar-width-icon\):is(:where(.group)[data-collapsible=icon] *){width:var(--sidebar-width-icon)}.group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\)\]:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--sidebar-width-icon) + (calc(var(--spacing) * 4)))}.group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\+2px\)\]:is(:where(.group)[data-collapsible=icon] *){width:calc(var(--sidebar-width-icon) + (calc(var(--spacing) * 4)) + 2px)}.group-data-\[collapsible\=icon\]\:overflow-hidden:is(:where(.group)[data-collapsible=icon] *){overflow:hidden}.group-data-\[collapsible\=icon\]\:p-0\!:is(:where(.group)[data-collapsible=icon] *){padding:calc(var(--spacing) * 0)!important}.group-data-\[collapsible\=icon\]\:p-2\!:is(:where(.group)[data-collapsible=icon] *){padding:calc(var(--spacing) * 2)!important}.group-data-\[collapsible\=icon\]\:opacity-0:is(:where(.group)[data-collapsible=icon] *){opacity:0}.group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\]:is(:where(.group)[data-collapsible=offcanvas] *){right:calc(var(--sidebar-width) * -1)}.group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\]:is(:where(.group)[data-collapsible=offcanvas] *){left:calc(var(--sidebar-width) * -1)}.group-data-\[collapsible\=offcanvas\]\:w-0:is(:where(.group)[data-collapsible=offcanvas] *){width:calc(var(--spacing) * 0)}.group-data-\[collapsible\=offcanvas\]\:translate-x-0:is(:where(.group)[data-collapsible=offcanvas] *){--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-data-\[disabled\=true\]\:pointer-events-none:is(:where(.group)[data-disabled=true] *){pointer-events:none}.group-data-\[disabled\=true\]\:opacity-50:is(:where(.group)[data-disabled=true] *){opacity:.5}.group-data-\[side\=left\]\:-right-4:is(:where(.group)[data-side=left] *){right:calc(var(--spacing) * -4)}.group-data-\[side\=left\]\:border-r:is(:where(.group)[data-side=left] *){border-right-style:var(--tw-border-style);border-right-width:1px}.group-data-\[side\=right\]\:left-0:is(:where(.group)[data-side=right] *){left:calc(var(--spacing) * 0)}.group-data-\[side\=right\]\:rotate-180:is(:where(.group)[data-side=right] *){rotate:180deg}.group-data-\[side\=right\]\:border-l:is(:where(.group)[data-side=right] *){border-left-style:var(--tw-border-style);border-left-width:1px}.group-data-\[state\=open\]\:rotate-180:is(:where(.group)[data-state=open] *){rotate:180deg}.group-data-\[variant\=floating\]\:rounded-lg:is(:where(.group)[data-variant=floating] *){border-radius:var(--radius)}.group-data-\[variant\=floating\]\:border:is(:where(.group)[data-variant=floating] *){border-style:var(--tw-border-style);border-width:1px}.group-data-\[variant\=floating\]\:border-sidebar-border:is(:where(.group)[data-variant=floating] *){border-color:var(--sidebar-border)}.group-data-\[variant\=floating\]\:shadow-sm:is(:where(.group)[data-variant=floating] *){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.group-data-\[vaul-drawer-direction\=bottom\]\/drawer-content\:block:is(:where(.group\/drawer-content)[data-vaul-drawer-direction=bottom] *){display:block}.group-data-\[viewport\=false\]\/navigation-menu\:top-full:is(:where(.group\/navigation-menu)[data-viewport=false] *){top:100%}.group-data-\[viewport\=false\]\/navigation-menu\:mt-1\.5:is(:where(.group\/navigation-menu)[data-viewport=false] *){margin-top:calc(var(--spacing) * 1.5)}.group-data-\[viewport\=false\]\/navigation-menu\:overflow-hidden:is(:where(.group\/navigation-menu)[data-viewport=false] *){overflow:hidden}.group-data-\[viewport\=false\]\/navigation-menu\:rounded-md:is(:where(.group\/navigation-menu)[data-viewport=false] *){border-radius:calc(var(--radius) - 2px)}.group-data-\[viewport\=false\]\/navigation-menu\:border:is(:where(.group\/navigation-menu)[data-viewport=false] *){border-style:var(--tw-border-style);border-width:1px}.group-data-\[viewport\=false\]\/navigation-menu\:bg-popover:is(:where(.group\/navigation-menu)[data-viewport=false] *){background-color:var(--popover)}.group-data-\[viewport\=false\]\/navigation-menu\:text-popover-foreground:is(:where(.group\/navigation-menu)[data-viewport=false] *){color:var(--popover-foreground)}.group-data-\[viewport\=false\]\/navigation-menu\:shadow:is(:where(.group\/navigation-menu)[data-viewport=false] *){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.group-data-\[viewport\=false\]\/navigation-menu\:duration-200:is(:where(.group\/navigation-menu)[data-viewport=false] *){--tw-duration:.2s;transition-duration:.2s}@media(hover:hover){.peer-hover\/menu-button\:text-sidebar-accent-foreground:is(:where(.peer\/menu-button):hover~*){color:var(--sidebar-accent-foreground)}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-50:is(:where(.peer):disabled~*){opacity:.5}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground:is(:where(.peer\/menu-button)[data-active=true]~*){color:var(--sidebar-accent-foreground)}.peer-data-\[size\=default\]\/menu-button\:top-1\.5:is(:where(.peer\/menu-button)[data-size=default]~*){top:calc(var(--spacing) * 1.5)}.peer-data-\[size\=lg\]\/menu-button\:top-2\.5:is(:where(.peer\/menu-button)[data-size=lg]~*){top:calc(var(--spacing) * 2.5)}.peer-data-\[size\=sm\]\/menu-button\:top-1:is(:where(.peer\/menu-button)[data-size=sm]~*){top:calc(var(--spacing) * 1)}.selection\:bg-primary ::-moz-selection{background-color:var(--primary)}.selection\:bg-primary ::selection{background-color:var(--primary)}.selection\:bg-primary::-moz-selection{background-color:var(--primary)}.selection\:bg-primary::selection{background-color:var(--primary)}.selection\:text-primary-foreground ::-moz-selection{color:var(--primary-foreground)}.selection\:text-primary-foreground ::selection{color:var(--primary-foreground)}.selection\:text-primary-foreground::-moz-selection{color:var(--primary-foreground)}.selection\:text-primary-foreground::selection{color:var(--primary-foreground)}.file\:mr-4::file-selector-button{margin-right:calc(var(--spacing) * 4)}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-7::file-selector-button{height:calc(var(--spacing) * 7)}.file\:rounded-full::file-selector-button{border-radius:3.40282e38px}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-amber-50::file-selector-button{background-color:var(--color-amber-50)}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:px-4::file-selector-button{padding-inline:calc(var(--spacing) * 4)}.file\:py-1::file-selector-button{padding-block:calc(var(--spacing) * 1)}.file\:py-2::file-selector-button{padding-block:calc(var(--spacing) * 2)}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:text-xs::file-selector-button{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\:font-semibold::file-selector-button{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.file\:text-amber-700::file-selector-button{color:var(--color-amber-700)}.file\:text-foreground::file-selector-button{color:var(--foreground)}.placeholder\:font-bold::-moz-placeholder{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.placeholder\:font-bold::placeholder{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.placeholder\:text-\[\#999999\]::-moz-placeholder{color:#999}.placeholder\:text-\[\#999999\]::placeholder{color:#999}.placeholder\:text-muted-foreground::-moz-placeholder{color:var(--muted-foreground)}.placeholder\:text-muted-foreground::placeholder{color:var(--muted-foreground)}.placeholder\:text-slate-300::-moz-placeholder{color:var(--color-slate-300)}.placeholder\:text-slate-300::placeholder{color:var(--color-slate-300)}.placeholder\:text-slate-400::-moz-placeholder{color:var(--color-slate-400)}.placeholder\:text-slate-400::placeholder{color:var(--color-slate-400)}.placeholder\:text-slate-500::-moz-placeholder{color:var(--color-slate-500)}.placeholder\:text-slate-500::placeholder{color:var(--color-slate-500)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);inset:calc(var(--spacing) * -2)}.after\:inset-y-0:after{content:var(--tw-content);inset-block:calc(var(--spacing) * 0)}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:calc(var(--spacing) * 1)}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.group-data-\[collapsible\=offcanvas\]\:after\:left-full:is(:where(.group)[data-collapsible=offcanvas] *):after{content:var(--tw-content);left:100%}.first\:rounded-l-md:first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.first\:border-l:first-child{border-left-style:var(--tw-border-style);border-left-width:1px}.last\:mb-0:last-child{margin-bottom:calc(var(--spacing) * 0)}.last\:rounded-r-md:last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.last\:pb-0:last-child{padding-bottom:calc(var(--spacing) * 0)}.focus-within\:relative:focus-within{position:relative}.focus-within\:z-20:focus-within{z-index:20}.focus-within\:border-blue-400:focus-within{border-color:var(--color-blue-400)}.focus-within\:ring-1:focus-within{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-within\:ring-blue-100:focus-within{--tw-ring-color:var(--color-blue-100)}@media(hover:hover){.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-\[1\.01\]:hover{scale:1.01}.hover\:scale-\[1\.02\]:hover{scale:1.02}.hover\:border-amber-200:hover{border-color:var(--color-amber-200)}.hover\:border-amber-300:hover{border-color:var(--color-amber-300)}.hover\:border-amber-400:hover{border-color:var(--color-amber-400)}.hover\:border-amber-500:hover{border-color:var(--color-amber-500)}.hover\:border-amber-600:hover{border-color:var(--color-amber-600)}.hover\:border-blue-300:hover{border-color:var(--color-blue-300)}.hover\:border-re-red:hover{border-color:var(--re-red)}.hover\:border-slate-100:hover{border-color:var(--color-slate-100)}.hover\:border-slate-200:hover{border-color:var(--color-slate-200)}.hover\:border-slate-300:hover{border-color:var(--color-slate-300)}.hover\:bg-accent:hover{background-color:var(--accent)}.hover\:bg-amber-50:hover{background-color:var(--color-amber-50)}.hover\:bg-amber-50\/30:hover{background-color:#fffbeb4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-50\/30:hover{background-color:color-mix(in oklab,var(--color-amber-50) 30%,transparent)}}.hover\:bg-amber-100:hover{background-color:var(--color-amber-100)}.hover\:bg-amber-200:hover{background-color:var(--color-amber-200)}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-amber-700:hover{background-color:var(--color-amber-700)}.hover\:bg-black:hover{background-color:var(--color-black)}.hover\:bg-blue-50:hover{background-color:var(--color-blue-50)}.hover\:bg-blue-50\/20:hover{background-color:#eff6ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-50\/20:hover{background-color:color-mix(in oklab,var(--color-blue-50) 20%,transparent)}}.hover\:bg-blue-100:hover{background-color:var(--color-blue-100)}.hover\:bg-blue-500:hover{background-color:var(--color-blue-500)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-destructive\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--destructive) 90%,transparent)}}.hover\:bg-emerald-50\/30:hover{background-color:#ecfdf54d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-50\/30:hover{background-color:color-mix(in oklab,var(--color-emerald-50) 30%,transparent)}}.hover\:bg-emerald-100:hover{background-color:var(--color-emerald-100)}.hover\:bg-emerald-700:hover{background-color:var(--color-emerald-700)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-green-100:hover{background-color:var(--color-green-100)}.hover\:bg-green-600:hover{background-color:var(--color-green-600)}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-indigo-50:hover{background-color:var(--color-indigo-50)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}.hover\:bg-muted:hover,.hover\:bg-muted\/50:hover{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab,var(--muted) 50%,transparent)}}.hover\:bg-orange-50:hover{background-color:var(--color-orange-50)}.hover\:bg-orange-700:hover{background-color:var(--color-orange-700)}.hover\:bg-primary:hover,.hover\:bg-primary\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--primary) 90%,transparent)}}.hover\:bg-purple-700:hover{background-color:var(--color-purple-700)}.hover\:bg-re-red-hover:hover{background-color:var(--re-red-hover)}.hover\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\:bg-red-50\/30:hover{background-color:#fef2f24d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-50\/30:hover{background-color:color-mix(in oklab,var(--color-red-50) 30%,transparent)}}.hover\:bg-red-100:hover{background-color:var(--color-red-100)}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-red-800:hover{background-color:var(--color-red-800)}.hover\:bg-secondary\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--secondary) 80%,transparent)}}.hover\:bg-sidebar-accent:hover{background-color:var(--sidebar-accent)}.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-50\/10:hover{background-color:#f8fafc1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-50\/10:hover{background-color:color-mix(in oklab,var(--color-slate-50) 10%,transparent)}}.hover\:bg-slate-50\/50:hover{background-color:#f8fafc80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-50\/50:hover{background-color:color-mix(in oklab,var(--color-slate-50) 50%,transparent)}}.hover\:bg-slate-50\/80:hover{background-color:#f8fafccc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-50\/80:hover{background-color:color-mix(in oklab,var(--color-slate-50) 80%,transparent)}}.hover\:bg-slate-100:hover{background-color:var(--color-slate-100)}.hover\:bg-slate-200:hover{background-color:var(--color-slate-200)}.hover\:bg-slate-200\/50:hover{background-color:#e2e8f080}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-200\/50:hover{background-color:color-mix(in oklab,var(--color-slate-200) 50%,transparent)}}.hover\:bg-slate-700:hover{background-color:var(--color-slate-700)}.hover\:bg-slate-800:hover{background-color:var(--color-slate-800)}.hover\:bg-slate-900:hover{background-color:var(--color-slate-900)}.hover\:bg-slate-950:hover{background-color:var(--color-slate-950)}.hover\:bg-transparent:hover{background-color:#0000}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white) 5%,transparent)}}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.hover\:bg-white\/30:hover{background-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/30:hover{background-color:color-mix(in oklab,var(--color-white) 30%,transparent)}}.hover\:bg-white\/40:hover{background-color:#fff6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/40:hover{background-color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.hover\:bg-zinc-800:hover{background-color:var(--color-zinc-800)}.hover\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\:text-amber-600:hover{color:var(--color-amber-600)}.hover\:text-amber-700:hover{color:var(--color-amber-700)}.hover\:text-black:hover{color:var(--color-black)}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-blue-700:hover{color:var(--color-blue-700)}.hover\:text-blue-800:hover{color:var(--color-blue-800)}.hover\:text-destructive:hover{color:var(--destructive)}.hover\:text-foreground:hover{color:var(--foreground)}.hover\:text-green-800:hover{color:var(--color-green-800)}.hover\:text-indigo-600:hover{color:var(--color-indigo-600)}.hover\:text-muted-foreground:hover{color:var(--muted-foreground)}.hover\:text-primary-foreground:hover{color:var(--primary-foreground)}.hover\:text-re-red-hover:hover{color:var(--re-red-hover)}.hover\:text-red-500:hover{color:var(--color-red-500)}.hover\:text-red-600:hover{color:var(--color-red-600)}.hover\:text-red-700:hover{color:var(--color-red-700)}.hover\:text-sidebar-accent-foreground:hover{color:var(--sidebar-accent-foreground)}.hover\:text-slate-600:hover{color:var(--color-slate-600)}.hover\:text-slate-700:hover{color:var(--color-slate-700)}.hover\:text-slate-900:hover{color:var(--color-slate-900)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow:0 0 0 1px var(--tw-shadow-color,hsl(var(--sidebar-accent)));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-sm:hover{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:ring-4:hover{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:group-data-\[collapsible\=offcanvas\]\:bg-sidebar:hover:is(:where(.group)[data-collapsible=offcanvas] *){background-color:var(--sidebar)}.hover\:file\:bg-amber-100:hover::file-selector-button{background-color:var(--color-amber-100)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:var(--sidebar-border)}}.focus\:z-10:focus{z-index:10}.focus\:border-amber-300:focus{border-color:var(--color-amber-300)}.focus\:border-amber-500:focus{border-color:var(--color-amber-500)}.focus\:bg-accent:focus{background-color:var(--accent)}.focus\:bg-amber-50:focus{background-color:var(--color-amber-50)}.focus\:bg-primary:focus{background-color:var(--primary)}.focus\:bg-slate-50:focus{background-color:var(--color-slate-50)}.focus\:bg-white:focus{background-color:var(--color-white)}.focus\:text-accent-foreground:focus{color:var(--accent-foreground)}.focus\:text-primary-foreground:focus{color:var(--primary-foreground)}.focus\:text-slate-900:focus{color:var(--color-slate-900)}.focus\:ring-0:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-amber-200:focus{--tw-ring-color:var(--color-amber-200)}.focus\:ring-amber-500:focus{--tw-ring-color:var(--color-amber-500)}.focus\:ring-amber-500\/20:focus{--tw-ring-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.focus\:ring-amber-500\/20:focus{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.focus\:ring-amber-500\/30:focus{--tw-ring-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.focus\:ring-amber-500\/30:focus{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:ring-ring:focus{--tw-ring-color:var(--ring)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.focus\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:z-10:focus-visible{z-index:10}.focus-visible\:border-amber-500:focus-visible{border-color:var(--color-amber-500)}.focus-visible\:border-blue-500:focus-visible{border-color:var(--color-blue-500)}.focus-visible\:border-ring:focus-visible{border-color:var(--ring)}.focus-visible\:bg-white:focus-visible{background-color:var(--color-white)}.focus-visible\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-4:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-amber-500:focus-visible{--tw-ring-color:var(--color-amber-500)}.focus-visible\:ring-amber-500\/30:focus-visible{--tw-ring-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-amber-500\/30:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.focus-visible\:ring-black:focus-visible{--tw-ring-color:var(--color-black)}.focus-visible\:ring-blue-500\/30:focus-visible{--tw-ring-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-blue-500\/30:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-blue-500) 30%, transparent)}}.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.focus-visible\:ring-ring:focus-visible,.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:outline-hidden:focus-visible{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.focus-visible\:outline-hidden:focus-visible{outline-offset:2px;outline:2px solid #0000}}.focus-visible\:outline-1:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-ring:focus-visible{outline-color:var(--ring)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:scale-90:active{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%;scale:var(--tw-scale-x) var(--tw-scale-y)}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.active\:scale-\[0\.98\]:active{scale:.98}.active\:scale-\[0\.99\]:active{scale:.99}.active\:bg-sidebar-accent:active{background-color:var(--sidebar-accent)}.active\:text-sidebar-accent-foreground:active{color:var(--sidebar-accent-foreground)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-100:disabled{background-color:var(--color-gray-100)}.disabled\:bg-slate-50:disabled{background-color:var(--color-slate-50)}.disabled\:bg-slate-300:disabled{background-color:var(--color-slate-300)}.disabled\:bg-slate-400:disabled{background-color:var(--color-slate-400)}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}:where([data-side=left]) .in-data-\[side\=left\]\:cursor-w-resize{cursor:w-resize}:where([data-side=right]) .in-data-\[side\=right\]\:cursor-e-resize{cursor:e-resize}.has-disabled\:opacity-50:has(:disabled){opacity:.5}.has-data-\[slot\=card-action\]\:grid-cols-\[1fr_auto\]:has([data-slot=card-action]){grid-template-columns:1fr auto}.has-data-\[variant\=inset\]\:bg-sidebar:has([data-variant=inset]){background-color:var(--sidebar)}.has-\[\>svg\]\:grid-cols-\[calc\(var\(--spacing\)\*4\)_1fr\]:has(>svg){grid-template-columns:calc(var(--spacing) * 4) 1fr}.has-\[\>svg\]\:gap-x-3:has(>svg){-moz-column-gap:calc(var(--spacing) * 3);column-gap:calc(var(--spacing) * 3)}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing) * 2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing) * 3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing) * 4)}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-invalid\:border-destructive[aria-invalid=true]{border-color:var(--destructive)}.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.aria-selected\:bg-accent[aria-selected=true]{background-color:var(--accent)}.aria-selected\:bg-primary[aria-selected=true]{background-color:var(--primary)}.aria-selected\:text-accent-foreground[aria-selected=true]{color:var(--accent-foreground)}.aria-selected\:text-muted-foreground[aria-selected=true]{color:var(--muted-foreground)}.aria-selected\:text-primary-foreground[aria-selected=true]{color:var(--primary-foreground)}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}.data-\[active\=true\]\:z-10[data-active=true]{z-index:10}.data-\[active\=true\]\:border-ring[data-active=true]{border-color:var(--ring)}.data-\[active\=true\]\:bg-accent\/50[data-active=true]{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.data-\[active\=true\]\:bg-accent\/50[data-active=true]{background-color:color-mix(in oklab,var(--accent) 50%,transparent)}}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:var(--sidebar-accent)}.data-\[active\=true\]\:font-medium[data-active=true]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[active\=true\]\:text-accent-foreground[data-active=true]{color:var(--accent-foreground)}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:var(--sidebar-accent-foreground)}.data-\[active\=true\]\:ring-\[3px\][data-active=true]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[active\=true\]\:ring-ring\/50[data-active=true]{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.data-\[active\=true\]\:ring-ring\/50[data-active=true]{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}@media(hover:hover){.data-\[active\=true\]\:hover\:bg-accent[data-active=true]:hover{background-color:var(--accent)}}.data-\[active\=true\]\:focus\:bg-accent[data-active=true]:focus{background-color:var(--accent)}.data-\[active\=true\]\:aria-invalid\:border-destructive[data-active=true][aria-invalid=true]{border-color:var(--destructive)}.data-\[active\=true\]\:aria-invalid\:ring-destructive\/20[data-active=true][aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.data-\[active\=true\]\:aria-invalid\:ring-destructive\/20[data-active=true][aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 20%, transparent)}}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true]{pointer-events:none}.data-\[disabled\=true\]\:opacity-50[data-disabled=true]{opacity:.5}.data-\[error\=true\]\:text-destructive[data-error=true]{color:var(--destructive)}.data-\[inset\]\:pl-8[data-inset]{padding-left:calc(var(--spacing) * 8)}.data-\[orientation\=horizontal\]\:h-4[data-orientation=horizontal]{height:calc(var(--spacing) * 4)}.data-\[orientation\=horizontal\]\:h-full[data-orientation=horizontal]{height:100%}.data-\[orientation\=horizontal\]\:h-px[data-orientation=horizontal]{height:1px}.data-\[orientation\=horizontal\]\:w-full[data-orientation=horizontal]{width:100%}.data-\[orientation\=vertical\]\:h-full[data-orientation=vertical]{height:100%}.data-\[orientation\=vertical\]\:min-h-44[data-orientation=vertical]{min-height:calc(var(--spacing) * 44)}.data-\[orientation\=vertical\]\:w-1\.5[data-orientation=vertical]{width:calc(var(--spacing) * 1.5)}.data-\[orientation\=vertical\]\:w-auto[data-orientation=vertical]{width:auto}.data-\[orientation\=vertical\]\:w-full[data-orientation=vertical]{width:100%}.data-\[orientation\=vertical\]\:w-px[data-orientation=vertical]{width:1px}.data-\[orientation\=vertical\]\:flex-col[data-orientation=vertical]{flex-direction:column}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:calc(var(--spacing) * 0)}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:calc(var(--spacing) * 1)}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:var(--muted-foreground)}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:var(--accent)}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:var(--accent-foreground)}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[size\=default\]\:h-9[data-size=default]{height:calc(var(--spacing) * 9)}.data-\[size\=sm\]\:h-8[data-size=sm]{height:calc(var(--spacing) * 8)}:is(.\*\:data-\[slot\=alert-description\]\:text-destructive\/90>*)[data-slot=alert-description]{color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){:is(.\*\:data-\[slot\=alert-description\]\:text-destructive\/90>*)[data-slot=alert-description]{color:color-mix(in oklab,var(--destructive) 90%,transparent)}}:is(.\*\*\:data-\[slot\=command-input-wrapper\]\:h-12 *)[data-slot=command-input-wrapper]{height:calc(var(--spacing) * 12)}:is(.\*\*\:data-\[slot\=navigation-menu-link\]\:focus\:ring-0 *)[data-slot=navigation-menu-link]:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}:is(.\*\*\:data-\[slot\=navigation-menu-link\]\:focus\:outline-none *)[data-slot=navigation-menu-link]:focus{--tw-outline-style:none;outline-style:none}:is(.\*\:data-\[slot\=select-value\]\:line-clamp-1>*)[data-slot=select-value]{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}:is(.\*\:data-\[slot\=select-value\]\:flex>*)[data-slot=select-value]{display:flex}:is(.\*\:data-\[slot\=select-value\]\:items-center>*)[data-slot=select-value]{align-items:center}:is(.\*\:data-\[slot\=select-value\]\:gap-2>*)[data-slot=select-value]{gap:calc(var(--spacing) * 2)}.data-\[state\=active\]\:bg-amber-600[data-state=active]{background-color:var(--color-amber-600)}.data-\[state\=active\]\:bg-card[data-state=active]{background-color:var(--card)}.data-\[state\=active\]\:bg-white[data-state=active]{background-color:var(--color-white)}.data-\[state\=active\]\:text-white[data-state=active]{color:var(--color-white)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-\[calc\(100\%-2px\)\][data-state=checked]{--tw-translate-x: calc(100% - 2px) ;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=checked\]\:border-amber-600[data-state=checked]{border-color:var(--color-amber-600)}.data-\[state\=checked\]\:border-black[data-state=checked]{border-color:var(--color-black)}.data-\[state\=checked\]\:border-emerald-600[data-state=checked]{border-color:var(--color-emerald-600)}.data-\[state\=checked\]\:border-primary[data-state=checked]{border-color:var(--primary)}.data-\[state\=checked\]\:border-purple-600[data-state=checked]{border-color:var(--color-purple-600)}.data-\[state\=checked\]\:border-red-600[data-state=checked]{border-color:var(--color-red-600)}.data-\[state\=checked\]\:bg-amber-600[data-state=checked]{background-color:var(--color-amber-600)}.data-\[state\=checked\]\:bg-black[data-state=checked]{background-color:var(--color-black)}.data-\[state\=checked\]\:bg-emerald-600[data-state=checked]{background-color:var(--color-emerald-600)}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:var(--primary)}.data-\[state\=checked\]\:bg-purple-600[data-state=checked]{background-color:var(--color-purple-600)}.data-\[state\=checked\]\:bg-red-600[data-state=checked]{background-color:var(--color-red-600)}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:var(--primary-foreground)}.data-\[state\=closed\]\:duration-300[data-state=closed]{--tw-duration:.3s;transition-duration:.3s}.data-\[state\=inactive\]\:hidden[data-state=inactive]{display:none}.data-\[state\=on\]\:bg-accent[data-state=on]{background-color:var(--accent)}.data-\[state\=on\]\:text-accent-foreground[data-state=on]{color:var(--accent-foreground)}.data-\[state\=open\]\:bg-accent[data-state=open],.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:color-mix(in oklab,var(--accent) 50%,transparent)}}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:var(--secondary)}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:var(--accent-foreground)}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:var(--muted-foreground)}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[state\=open\]\:duration-500[data-state=open]{--tw-duration:.5s;transition-duration:.5s}@media(hover:hover){.data-\[state\=open\]\:hover\:bg-accent[data-state=open]:hover{background-color:var(--accent)}.data-\[state\=open\]\:hover\:bg-sidebar-accent[data-state=open]:hover{background-color:var(--sidebar-accent)}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground[data-state=open]:hover{color:var(--sidebar-accent-foreground)}}.data-\[state\=open\]\:focus\:bg-accent[data-state=open]:focus{background-color:var(--accent)}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:var(--muted)}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-switch-background[data-state=unchecked]{background-color:var(--switch-background)}.data-\[variant\=destructive\]\:text-destructive[data-variant=destructive]{color:var(--destructive)}.data-\[variant\=destructive\]\:focus\:bg-destructive\/10[data-variant=destructive]:focus{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.data-\[variant\=destructive\]\:focus\:bg-destructive\/10[data-variant=destructive]:focus{background-color:color-mix(in oklab,var(--destructive) 10%,transparent)}}.data-\[variant\=destructive\]\:focus\:text-destructive[data-variant=destructive]:focus{color:var(--destructive)}.data-\[variant\=outline\]\:border-l-0[data-variant=outline]{border-left-style:var(--tw-border-style);border-left-width:0}.data-\[variant\=outline\]\:shadow-xs[data-variant=outline]{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[variant\=outline\]\:first\:border-l[data-variant=outline]:first-child{border-left-style:var(--tw-border-style);border-left-width:1px}.data-\[vaul-drawer-direction\=bottom\]\:inset-x-0[data-vaul-drawer-direction=bottom]{inset-inline:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=bottom\]\:bottom-0[data-vaul-drawer-direction=bottom]{bottom:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=bottom\]\:mt-24[data-vaul-drawer-direction=bottom]{margin-top:calc(var(--spacing) * 24)}.data-\[vaul-drawer-direction\=bottom\]\:max-h-\[80vh\][data-vaul-drawer-direction=bottom]{max-height:80vh}.data-\[vaul-drawer-direction\=bottom\]\:rounded-t-lg[data-vaul-drawer-direction=bottom]{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.data-\[vaul-drawer-direction\=bottom\]\:border-t[data-vaul-drawer-direction=bottom]{border-top-style:var(--tw-border-style);border-top-width:1px}.data-\[vaul-drawer-direction\=left\]\:inset-y-0[data-vaul-drawer-direction=left]{inset-block:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=left\]\:left-0[data-vaul-drawer-direction=left]{left:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=left\]\:w-3\/4[data-vaul-drawer-direction=left]{width:75%}.data-\[vaul-drawer-direction\=left\]\:border-r[data-vaul-drawer-direction=left]{border-right-style:var(--tw-border-style);border-right-width:1px}.data-\[vaul-drawer-direction\=right\]\:inset-y-0[data-vaul-drawer-direction=right]{inset-block:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=right\]\:right-0[data-vaul-drawer-direction=right]{right:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=right\]\:w-3\/4[data-vaul-drawer-direction=right]{width:75%}.data-\[vaul-drawer-direction\=right\]\:border-l[data-vaul-drawer-direction=right]{border-left-style:var(--tw-border-style);border-left-width:1px}.data-\[vaul-drawer-direction\=top\]\:inset-x-0[data-vaul-drawer-direction=top]{inset-inline:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=top\]\:top-0[data-vaul-drawer-direction=top]{top:calc(var(--spacing) * 0)}.data-\[vaul-drawer-direction\=top\]\:mb-24[data-vaul-drawer-direction=top]{margin-bottom:calc(var(--spacing) * 24)}.data-\[vaul-drawer-direction\=top\]\:max-h-\[80vh\][data-vaul-drawer-direction=top]{max-height:80vh}.data-\[vaul-drawer-direction\=top\]\:rounded-b-lg[data-vaul-drawer-direction=top]{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.data-\[vaul-drawer-direction\=top\]\:border-b[data-vaul-drawer-direction=top]{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}@media(min-width:40rem){.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:-mx-6{margin-inline:calc(var(--spacing) * -6)}.sm\:block{display:block}.sm\:flex{display:flex}.sm\:inline{display:inline}.sm\:w-auto{width:auto}.sm\:\!max-w-\[80vw\]{max-width:80vw!important}.sm\:max-w-2xl{max-width:var(--container-2xl)}.sm\:max-w-7xl{max-width:var(--container-7xl)}.sm\:max-w-\[460px\]{max-width:460px}.sm\:max-w-\[480px\]{max-width:480px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:max-w-md{max-width:var(--container-md)}.sm\:max-w-sm{max-width:var(--container-sm)}.sm\:flex-1{flex:1}.sm\:flex-none{flex:none}.sm\:shrink-0{flex-shrink:0}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:justify-end{justify-content:flex-end}.sm\:gap-0{gap:calc(var(--spacing) * 0)}.sm\:gap-2\.5{gap:calc(var(--spacing) * 2.5)}.sm\:p-6{padding:calc(var(--spacing) * 6)}.sm\:px-2{padding-inline:calc(var(--spacing) * 2)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}.sm\:py-5{padding-block:calc(var(--spacing) * 5)}.sm\:pt-6{padding-top:calc(var(--spacing) * 6)}.sm\:pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.sm\:pl-2\.5{padding-left:calc(var(--spacing) * 2.5)}.sm\:text-left{text-align:left}.sm\:text-\[11px\]{font-size:11px}.data-\[vaul-drawer-direction\=left\]\:sm\:max-w-sm[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:sm\:max-w-sm[data-vaul-drawer-direction=right]{max-width:var(--container-sm)}}@media(min-width:48rem){.md\:absolute{position:absolute}.md\:static{position:static}.md\:col-span-2{grid-column:span 2/span 2}.md\:col-span-4{grid-column:span 4/span 4}.md\:col-span-6{grid-column:span 6/span 6}.md\:mt-8{margin-top:calc(var(--spacing) * 8)}.md\:mr-2{margin-right:calc(var(--spacing) * 2)}.md\:block{display:block}.md\:flex{display:flex}.md\:inline{display:inline}.md\:h-12{height:calc(var(--spacing) * 12)}.md\:w-36{width:calc(var(--spacing) * 36)}.md\:w-40{width:calc(var(--spacing) * 40)}.md\:w-48{width:calc(var(--spacing) * 48)}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-3xl{max-width:var(--container-3xl)}.md\:max-w-\[300px\]{max-width:300px}.md\:flex-initial{flex:0 auto}.md\:flex-none{flex:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:border-transparent{border-color:#0000}.md\:bg-transparent{background-color:#0000}.md\:p-16{padding:calc(var(--spacing) * 16)}.md\:px-12{padding-inline:calc(var(--spacing) * 12)}.md\:pl-16{padding-left:calc(var(--spacing) * 16)}.md\:text-right{text-align:right}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.md\:opacity-0{opacity:0}.md\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.md\:peer-data-\[variant\=inset\]\:m-2:is(:where(.peer)[data-variant=inset]~*){margin:calc(var(--spacing) * 2)}.md\:peer-data-\[variant\=inset\]\:ml-0:is(:where(.peer)[data-variant=inset]~*){margin-left:calc(var(--spacing) * 0)}.md\:peer-data-\[variant\=inset\]\:rounded-xl:is(:where(.peer)[data-variant=inset]~*){border-radius:calc(var(--radius) + 4px)}.md\:peer-data-\[variant\=inset\]\:shadow-sm:is(:where(.peer)[data-variant=inset]~*){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.md\:peer-data-\[variant\=inset\]\:peer-data-\[state\=collapsed\]\:ml-2:is(:where(.peer)[data-variant=inset]~*):is(:where(.peer)[data-state=collapsed]~*){margin-left:calc(var(--spacing) * 2)}.md\:after\:hidden:after{content:var(--tw-content);display:none}}@media(min-width:64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:col-span-3{grid-column:span 3/span 3}.lg\:col-span-4{grid-column:span 4/span 4}.lg\:col-span-5{grid-column:span 5/span 5}.lg\:flex{display:flex}.lg\:w-40{width:calc(var(--spacing) * 40)}.lg\:w-48{width:calc(var(--spacing) * 48)}.lg\:w-\[320px\]{width:320px}.lg\:max-w-4xl{max-width:var(--container-4xl)}.lg\:max-w-7xl{max-width:var(--container-7xl)}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.lg\:pl-8{padding-left:calc(var(--spacing) * 8)}}@media(min-width:80rem){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}.dark\:border-input:is(.dark *){border-color:var(--input)}.dark\:bg-destructive\/60:is(.dark *){background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.dark\:bg-destructive\/60:is(.dark *){background-color:color-mix(in oklab,var(--destructive) 60%,transparent)}}.dark\:bg-input\/30:is(.dark *){background-color:var(--input)}@supports (color:color-mix(in lab,red,red)){.dark\:bg-input\/30:is(.dark *){background-color:color-mix(in oklab,var(--input) 30%,transparent)}}.dark\:text-muted-foreground:is(.dark *){color:var(--muted-foreground)}@media(hover:hover){.dark\:hover\:bg-accent\/50:is(.dark *):hover{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-accent\/50:is(.dark *):hover{background-color:color-mix(in oklab,var(--accent) 50%,transparent)}}.dark\:hover\:bg-input\/50:is(.dark *):hover{background-color:var(--input)}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-input\/50:is(.dark *):hover{background-color:color-mix(in oklab,var(--input) 50%,transparent)}}}.dark\:focus-visible\:ring-destructive\/40:is(.dark *):focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.dark\:focus-visible\:ring-destructive\/40:is(.dark *):focus-visible{--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.dark\:aria-invalid\:ring-destructive\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.dark\:aria-invalid\:ring-destructive\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.dark\:data-\[active\=true\]\:aria-invalid\:ring-destructive\/40:is(.dark *)[data-active=true][aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[active\=true\]\:aria-invalid\:ring-destructive\/40:is(.dark *)[data-active=true][aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.dark\:data-\[state\=active\]\:border-input:is(.dark *)[data-state=active]{border-color:var(--input)}.dark\:data-\[state\=active\]\:bg-input\/30:is(.dark *)[data-state=active]{background-color:var(--input)}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[state\=active\]\:bg-input\/30:is(.dark *)[data-state=active]{background-color:color-mix(in oklab,var(--input) 30%,transparent)}}.dark\:data-\[state\=active\]\:text-foreground:is(.dark *)[data-state=active]{color:var(--foreground)}.dark\:data-\[state\=checked\]\:bg-primary:is(.dark *)[data-state=checked]{background-color:var(--primary)}.dark\:data-\[state\=checked\]\:bg-primary-foreground:is(.dark *)[data-state=checked]{background-color:var(--primary-foreground)}.dark\:data-\[state\=unchecked\]\:bg-card-foreground:is(.dark *)[data-state=unchecked]{background-color:var(--card-foreground)}.dark\:data-\[state\=unchecked\]\:bg-input\/80:is(.dark *)[data-state=unchecked]{background-color:var(--input)}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[state\=unchecked\]\:bg-input\/80:is(.dark *)[data-state=unchecked]{background-color:color-mix(in oklab,var(--input) 80%,transparent)}}.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20:is(.dark *)[data-variant=destructive]:focus{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20:is(.dark *)[data-variant=destructive]:focus{background-color:color-mix(in oklab,var(--destructive) 20%,transparent)}}.\[\&_\.ql-container\]\:border-0 .ql-container{border-style:var(--tw-border-style);border-width:0}.\[\&_\.ql-editor\]\:min-h-\[380px\] .ql-editor{min-height:380px}.\[\&_\.ql-editor\]\:text-sm .ql-editor{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.\[\&_\.ql-editor\]\:text-slate-900 .ql-editor{color:var(--color-slate-900)}.\[\&_\.ql-toolbar\]\:border-slate-200 .ql-toolbar{border-color:var(--color-slate-200)}.\[\&_\.ql-toolbar\]\:bg-slate-50 .ql-toolbar{background-color:var(--color-slate-50)}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:var(--muted-foreground)}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:var(--border)}@supports (color:color-mix(in lab,red,red)){.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:color-mix(in oklab,var(--border) 50%,transparent)}}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:var(--border)}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:#0000}.\[\&_\.recharts-layer\]\:outline-hidden .recharts-layer{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.\[\&_\.recharts-layer\]\:outline-hidden .recharts-layer{outline-offset:2px;outline:2px solid #0000}}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:var(--border)}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:var(--muted)}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:var(--border)}.\[\&_\.recharts-sector\]\:outline-hidden .recharts-sector{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.\[\&_\.recharts-sector\]\:outline-hidden .recharts-sector{outline-offset:2px;outline:2px solid #0000}}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:#0000}.\[\&_\.recharts-surface\]\:outline-hidden .recharts-surface{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.\[\&_\.recharts-surface\]\:outline-hidden .recharts-surface{outline-offset:2px;outline:2px solid #0000}}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-block:calc(var(--spacing) * 1.5)}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:var(--muted-foreground)}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:calc(var(--spacing) * 0)}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:calc(var(--spacing) * 5)}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:calc(var(--spacing) * 5)}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:calc(var(--spacing) * 12)}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-block:calc(var(--spacing) * 3)}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:calc(var(--spacing) * 5)}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:calc(var(--spacing) * 5)}.\[\&_p\]\:leading-relaxed p{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\:not\(\[class\*\=\'text-\'\]\)\]\:text-muted-foreground svg:not([class*=text-]){color:var(--muted-foreground)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.\[\&\:has\(\>\.day-range-end\)\]\:rounded-r-md:has(>.day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\>\.day-range-start\)\]\:rounded-l-md:has(>.day-range-start){border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:rounded-md:has([aria-selected]){border-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\)\]\:bg-accent:has([aria-selected]){background-color:var(--accent)}.first\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-l-md:first-child:has([aria-selected]){border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.last\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-r-md:last-child:has([aria-selected]),.\[\&\:has\(\[aria-selected\]\.day-range-end\)\]\:rounded-r-md:has([aria-selected].day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing) * 0)}.\[\.border-b\]\:pb-6.border-b{padding-bottom:calc(var(--spacing) * 6)}.\[\.border-t\]\:pt-6.border-t{padding-top:calc(var(--spacing) * 6)}:is(.\*\:\[span\]\:last\:flex>*):is(span):last-child{display:flex}:is(.\*\:\[span\]\:last\:items-center>*):is(span):last-child{align-items:center}:is(.\*\:\[span\]\:last\:gap-2>*):is(span):last-child{gap:calc(var(--spacing) * 2)}:is(.data-\[variant\=destructive\]\:\*\:\[svg\]\:\!text-destructive[data-variant=destructive]>*):is(svg){color:var(--destructive)!important}.\[\&\:last-child\]\:pb-6:last-child{padding-bottom:calc(var(--spacing) * 6)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>button\]\:text-white>button{color:var(--color-white)}.\[\&\>button\]\:opacity-100>button{opacity:1}.\[\&\>span\:last-child\]\:truncate>span:last-child{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.\[\&\>svg\]\:pointer-events-none>svg{pointer-events:none}.\[\&\>svg\]\:size-3>svg{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.\[\&\>svg\]\:size-3\.5>svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\[\&\>svg\]\:size-4>svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&\>svg\]\:h-2\.5>svg{height:calc(var(--spacing) * 2.5)}.\[\&\>svg\]\:h-3>svg{height:calc(var(--spacing) * 3)}.\[\&\>svg\]\:w-2\.5>svg{width:calc(var(--spacing) * 2.5)}.\[\&\>svg\]\:w-3>svg{width:calc(var(--spacing) * 3)}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:translate-y-0\.5>svg{--tw-translate-y:calc(var(--spacing) * .5);translate:var(--tw-translate-x) var(--tw-translate-y)}.\[\&\>svg\]\:text-current>svg{color:currentColor}.\[\&\>svg\]\:text-muted-foreground>svg{color:var(--muted-foreground)}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:var(--sidebar-accent-foreground)}.\[\&\>tr\]\:last\:border-b-0>tr:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{rotate:90deg}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{rotate:180deg}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:calc(var(--spacing) * -2)}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:calc(var(--spacing) * -2)}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}@media(hover:hover){a.\[a\&\]\:hover\:bg-accent:hover{background-color:var(--accent)}a.\[a\&\]\:hover\:bg-destructive\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--destructive) 90%,transparent)}}a.\[a\&\]\:hover\:bg-primary\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--primary) 90%,transparent)}}a.\[a\&\]\:hover\:bg-secondary\/90:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-secondary\/90:hover{background-color:color-mix(in oklab,var(--secondary) 90%,transparent)}}a.\[a\&\]\:hover\:text-accent-foreground:hover{color:var(--accent-foreground)}}button.bg-amber-600,button.hover\:bg-amber-700:hover{background-color:var(--color-re-red)!important}}:root{--font-size:16px;--background:#fff;--foreground:oklch(14.5% 0 0);--card:#fff;--card-foreground:oklch(14.5% 0 0);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.5% 0 0);--primary:#daaa00;--primary-foreground:oklch(100% 0 0);--secondary:oklch(95% .0058 264.53);--secondary-foreground:#030213;--muted:#ececf0;--muted-foreground:#717182;--accent:#e9ebef;--accent-foreground:#030213;--destructive:#d4183d;--destructive-foreground:#fff;--border:#0000001a;--input:transparent;--input-background:#f3f3f5;--switch-background:#cbced4;--font-weight-medium:500;--font-weight-normal:400;--ring:oklch(70.8% 0 0);--chart-1:oklch(64.6% .222 41.116);--chart-2:oklch(60% .118 184.704);--chart-3:oklch(39.8% .07 227.392);--chart-4:oklch(82.8% .189 84.429);--chart-5:oklch(76.9% .188 70.08);--radius:.625rem;--sidebar:oklch(98.5% 0 0);--sidebar-foreground:oklch(14.5% 0 0);--sidebar-primary:#030213;--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(97% 0 0);--sidebar-accent-foreground:oklch(20.5% 0 0);--sidebar-border:oklch(92.2% 0 0);--sidebar-ring:oklch(70.8% 0 0);--re-red:#da291c;--re-red-hover:#b82216;--re-black:#000;--re-white:#fff;--re-gray:#717171}.dark{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(14.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(14.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(98.5% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(39.6% .141 25.723);--destructive-foreground:oklch(63.7% .237 25.331);--border:oklch(26.9% 0 0);--input:oklch(26.9% 0 0);--ring:oklch(43.9% 0 0);--font-weight-medium:500;--font-weight-normal:400;--chart-1:oklch(48.8% .243 264.376);--chart-2:oklch(69.6% .17 162.48);--chart-3:oklch(76.9% .188 70.08);--chart-4:oklch(62.7% .265 303.9);--chart-5:oklch(64.5% .246 16.439);--sidebar:oklch(20.5% 0 0);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(26.9% 0 0);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(26.9% 0 0);--sidebar-ring:oklch(43.9% 0 0)}.re-heading{text-transform:uppercase;letter-spacing:.1em;font-family:Montserrat,sans-serif;font-weight:700}.re-card{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-slate-200);background-color:var(--color-white);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-radius:0}.re-input{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-slate-300);width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));--tw-duration:.2s;--tw-outline-style:none;border-radius:0;outline-style:none;transition-duration:.2s}.re-input:focus{border-color:var(--color-red-600);--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#e4001433}@supports (color:color-mix(in lab,red,red)){.re-input:focus{--tw-ring-color:color-mix(in oklab, var(--color-red-600) 20%, transparent)}}.re-label{margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide);color:var(--color-slate-800);text-transform:uppercase;display:block}.re-btn-primary{background-color:var(--color-black);padding-inline:calc(var(--spacing) * 8);padding-block:calc(var(--spacing) * 3);--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold);--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest);color:var(--color-white);text-transform:uppercase;transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){.re-btn-primary:hover{background-color:var(--color-slate-900)}}.re-btn-primary:active{scale:.98}.re-btn-outline{border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-black);padding-inline:calc(var(--spacing) * 8);padding-block:calc(var(--spacing) * 3);--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold);--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest);color:var(--color-black);text-transform:uppercase;transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){.re-btn-outline:hover{background-color:var(--color-black);color:var(--color-white)}}.re-btn-outline:active{scale:.98}.re-intro-text{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed);color:var(--color-slate-700)}.re-disclaimer{border-left-style:var(--tw-border-style);border-left-width:4px;border-color:var(--color-red-600);background-color:var(--color-slate-50);padding:calc(var(--spacing) * 4);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-slate-600);font-style:italic}html{font-size:var(--font-size)}.custom-scrollbar::-webkit-scrollbar{width:3px}.custom-scrollbar::-webkit-scrollbar-track{background:0 0}.custom-scrollbar::-webkit-scrollbar-thumb{background:#e2e8f0;border-radius:10px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#cbd5e1}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:#e2e8f0 transparent}.custom-scrollbar-x::-webkit-scrollbar{height:4px}.custom-scrollbar-x::-webkit-scrollbar-track{background:0 0}.custom-scrollbar-x::-webkit-scrollbar-thumb{background:#e2e8f0;border-radius:9999px}.custom-scrollbar-x::-webkit-scrollbar-thumb:hover{background:#cbd5e1}.custom-scrollbar-x{scrollbar-width:thin;scrollbar-color:#e2e8f0 transparent}.custom-scrollbar-x-slim::-webkit-scrollbar{height:3px}.custom-scrollbar-x-slim::-webkit-scrollbar-track{background:0 0}.custom-scrollbar-x-slim::-webkit-scrollbar-thumb{background:#f1f5f9;border-radius:9999px}.custom-scrollbar-x-slim::-webkit-scrollbar-thumb:hover{background:#e2e8f0}.custom-scrollbar-x-slim{scrollbar-width:thin;scrollbar-color:#f1f5f9 transparent}.custom-scrollbar-slim::-webkit-scrollbar{width:2px}.custom-scrollbar-slim::-webkit-scrollbar-track{background:0 0}.custom-scrollbar-slim::-webkit-scrollbar-thumb{background:#f1f5f9;border-radius:9999px}.custom-scrollbar-slim::-webkit-scrollbar-thumb:hover{background:#e2e8f0}.custom-scrollbar-slim{scrollbar-width:thin;scrollbar-color:#f1f5f9 transparent}.no-native-password-reveal::-ms-reveal{display:none}.no-native-password-reveal::-ms-clear{display:none}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}} diff --git a/build/assets/index-CAe70IkM.js b/build/assets/index-C_7C7ZNJ.js similarity index 60% rename from build/assets/index-CAe70IkM.js rename to build/assets/index-C_7C7ZNJ.js index 31b8d4c..9e50667 100644 --- a/build/assets/index-CAe70IkM.js +++ b/build/assets/index-C_7C7ZNJ.js @@ -1,4 +1,4 @@ -var AT=Object.defineProperty;var kT=(t,s,n)=>s in t?AT(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var ax=(t,s,n)=>kT(t,typeof s!="symbol"?s+"":s,n);function RT(t,s){for(var n=0;nr[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();var Eo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _m(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ix={exports:{}},vd={},lx={exports:{}},Us={};/** +var TT=Object.defineProperty;var _T=(t,s,n)=>s in t?TT(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var lx=(t,s,n)=>_T(t,typeof s!="symbol"?s+"":s,n);function PT(t,s){for(var n=0;nr[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();var Eo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ox={exports:{}},vd={},cx={exports:{}},Us={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var AT=Object.defineProperty;var kT=(t,s,n)=>s in t?AT(t,s,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Jj;function ET(){if(Jj)return Us;Jj=1;var t=Symbol.for("react.element"),s=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function p(D){return D===null||typeof D!="object"?null:(D=m&&D[m]||D["@@iterator"],typeof D=="function"?D:null)}var u={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,g={};function y(D,O,V){this.props=D,this.context=O,this.refs=g,this.updater=V||u}y.prototype.isReactComponent={},y.prototype.setState=function(D,O){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,O,"setState")},y.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function N(){}N.prototype=y.prototype;function S(D,O,V){this.props=D,this.context=O,this.refs=g,this.updater=V||u}var C=S.prototype=new N;C.constructor=S,j(C,y.prototype),C.isPureReactComponent=!0;var w=Array.isArray,R=Object.prototype.hasOwnProperty,P={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function I(D,O,V){var K,Y={},U=null,X=null;if(O!=null)for(K in O.ref!==void 0&&(X=O.ref),O.key!==void 0&&(U=""+O.key),O)R.call(O,K)&&!A.hasOwnProperty(K)&&(Y[K]=O[K]);var ne=arguments.length-2;if(ne===1)Y.children=V;else if(1s in t?AT(t,s,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var tN;function DT(){if(tN)return vd;tN=1;var t=Lc(),s=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(d,h,x){var f,m={},p=null,u=null;x!==void 0&&(p=""+x),h.key!==void 0&&(p=""+h.key),h.ref!==void 0&&(u=h.ref);for(f in h)r.call(h,f)&&!l.hasOwnProperty(f)&&(m[f]=h[f]);if(d&&d.defaultProps)for(f in h=d.defaultProps,h)m[f]===void 0&&(m[f]=h[f]);return{$$typeof:s,type:d,key:p,ref:u,props:m,_owner:a.current}}return vd.Fragment=n,vd.jsx=c,vd.jsxs=c,vd}var sN;function TT(){return sN||(sN=1,ix.exports=DT()),ix.exports}var e=TT(),v=Lc();const gt=_m(v),Om=RT({__proto__:null,default:gt},[v]);var jh={},ox={exports:{}},Zr={},cx={exports:{}},dx={};/** + */var rN;function LT(){if(rN)return vd;rN=1;var t=Ic(),s=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(d,m,x){var f,h={},g=null,u=null;x!==void 0&&(g=""+x),m.key!==void 0&&(g=""+m.key),m.ref!==void 0&&(u=m.ref);for(f in m)r.call(m,f)&&!l.hasOwnProperty(f)&&(h[f]=m[f]);if(d&&d.defaultProps)for(f in m=d.defaultProps,m)h[f]===void 0&&(h[f]=m[f]);return{$$typeof:s,type:d,key:g,ref:u,props:h,_owner:a.current}}return vd.Fragment=n,vd.jsx=c,vd.jsxs=c,vd}var aN;function IT(){return aN||(aN=1,ox.exports=LT()),ox.exports}var e=IT(),v=Ic();const gt=Lm(v),Im=PT({__proto__:null,default:gt},[v]);var jh={},dx={exports:{}},Zr={},ux={exports:{}},hx={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var AT=Object.defineProperty;var kT=(t,s,n)=>s in t?AT(t,s,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var nN;function PT(){return nN||(nN=1,(function(t){function s(z,F){var B=z.length;z.push(F);e:for(;0>>1,O=z[D];if(0>>1;Da(Y,B))Ua(X,Y)?(z[D]=X,z[U]=B,D=U):(z[D]=Y,z[K]=B,D=K);else if(Ua(X,B))z[D]=X,z[U]=B,D=U;else break e}}return F}function a(z,F){var B=z.sortIndex-F.sortIndex;return B!==0?B:z.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var c=Date,d=c.now();t.unstable_now=function(){return c.now()-d}}var h=[],x=[],f=1,m=null,p=3,u=!1,j=!1,g=!1,y=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(z){for(var F=n(x);F!==null;){if(F.callback===null)r(x);else if(F.startTime<=z)r(x),F.sortIndex=F.expirationTime,s(h,F);else break;F=n(x)}}function w(z){if(g=!1,C(z),!j)if(n(h)!==null)j=!0,Z(R);else{var F=n(x);F!==null&&W(w,F.startTime-z)}}function R(z,F){j=!1,g&&(g=!1,N(I),I=-1),u=!0;var B=p;try{for(C(F),m=n(h);m!==null&&(!(m.expirationTime>F)||z&&!E());){var D=m.callback;if(typeof D=="function"){m.callback=null,p=m.priorityLevel;var O=D(m.expirationTime<=F);F=t.unstable_now(),typeof O=="function"?m.callback=O:m===n(h)&&r(h),C(F)}else r(h);m=n(h)}if(m!==null)var V=!0;else{var K=n(x);K!==null&&W(w,K.startTime-F),V=!1}return V}finally{m=null,p=B,u=!1}}var P=!1,A=null,I=-1,$=5,T=-1;function E(){return!(t.unstable_now()-T<$)}function _(){if(A!==null){var z=t.unstable_now();T=z;var F=!0;try{F=A(!0,z)}finally{F?M():(P=!1,A=null)}}else P=!1}var M;if(typeof S=="function")M=function(){S(_)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,G=q.port2;q.port1.onmessage=_,M=function(){G.postMessage(null)}}else M=function(){y(_,0)};function Z(z){A=z,P||(P=!0,M())}function W(z,F){I=y(function(){z(t.unstable_now())},F)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(z){z.callback=null},t.unstable_continueExecution=function(){j||u||(j=!0,Z(R))},t.unstable_forceFrameRate=function(z){0>z||125D?(z.sortIndex=B,s(x,z),n(h)===null&&z===n(x)&&(g?(N(I),I=-1):g=!0,W(w,B-D))):(z.sortIndex=O,s(h,z),j||u||(j=!0,Z(R))),z},t.unstable_shouldYield=E,t.unstable_wrapCallback=function(z){var F=p;return function(){var B=p;p=F;try{return z.apply(this,arguments)}finally{p=B}}}})(dx)),dx}var rN;function _T(){return rN||(rN=1,cx.exports=PT()),cx.exports}/** + */var iN;function MT(){return iN||(iN=1,(function(t){function s(U,F){var B=U.length;U.push(F);e:for(;0>>1,O=U[D];if(0>>1;Da(Y,B))Va(X,Y)?(U[D]=X,U[V]=B,D=V):(U[D]=Y,U[G]=B,D=G);else if(Va(X,B))U[D]=X,U[V]=B,D=V;else break e}}return F}function a(U,F){var B=U.sortIndex-F.sortIndex;return B!==0?B:U.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var c=Date,d=c.now();t.unstable_now=function(){return c.now()-d}}var m=[],x=[],f=1,h=null,g=3,u=!1,j=!1,p=!1,y=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(U){for(var F=n(x);F!==null;){if(F.callback===null)r(x);else if(F.startTime<=U)r(x),F.sortIndex=F.expirationTime,s(m,F);else break;F=n(x)}}function w(U){if(p=!1,A(U),!j)if(n(m)!==null)j=!0,Z(E);else{var F=n(x);F!==null&&W(w,F.startTime-U)}}function E(U,F){j=!1,p&&(p=!1,N(L),L=-1),u=!0;var B=g;try{for(A(F),h=n(m);h!==null&&(!(h.expirationTime>F)||U&&!R());){var D=h.callback;if(typeof D=="function"){h.callback=null,g=h.priorityLevel;var O=D(h.expirationTime<=F);F=t.unstable_now(),typeof O=="function"?h.callback=O:h===n(m)&&r(m),A(F)}else r(m);h=n(m)}if(h!==null)var z=!0;else{var G=n(x);G!==null&&W(w,G.startTime-F),z=!1}return z}finally{h=null,g=B,u=!1}}var T=!1,C=null,L=-1,$=5,_=-1;function R(){return!(t.unstable_now()-_<$)}function P(){if(C!==null){var U=t.unstable_now();_=U;var F=!0;try{F=C(!0,U)}finally{F?M():(T=!1,C=null)}}else T=!1}var M;if(typeof S=="function")M=function(){S(P)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,K=q.port2;q.port1.onmessage=P,M=function(){K.postMessage(null)}}else M=function(){y(P,0)};function Z(U){C=U,T||(T=!0,M())}function W(U,F){L=y(function(){U(t.unstable_now())},F)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(U){U.callback=null},t.unstable_continueExecution=function(){j||u||(j=!0,Z(E))},t.unstable_forceFrameRate=function(U){0>U||125D?(U.sortIndex=B,s(x,U),n(m)===null&&U===n(x)&&(p?(N(L),L=-1):p=!0,W(w,B-D))):(U.sortIndex=O,s(m,U),j||u||(j=!0,Z(E))),U},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(U){var F=g;return function(){var B=g;g=F;try{return U.apply(this,arguments)}finally{g=B}}}})(hx)),hx}var lN;function FT(){return lN||(lN=1,ux.exports=MT()),ux.exports}/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ var AT=Object.defineProperty;var kT=(t,s,n)=>s in t?AT(t,s,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var aN;function OT(){if(aN)return Zr;aN=1;var t=Lc(),s=_T();function n(i){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+i,b=1;b"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,x=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function p(i){return h.call(m,i)?!0:h.call(f,i)?!1:x.test(i)?m[i]=!0:(f[i]=!0,!1)}function u(i,o,b,k){if(b!==null&&b.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return k?!1:b!==null?!b.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function j(i,o,b,k){if(o===null||typeof o>"u"||u(i,o,b,k))return!0;if(k)return!1;if(b!==null)switch(b.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function g(i,o,b,k,L,H,ae){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=k,this.attributeNamespace=L,this.mustUseProperty=b,this.propertyName=i,this.type=o,this.sanitizeURL=H,this.removeEmptyString=ae}var y={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){y[i]=new g(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var o=i[0];y[o]=new g(o,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){y[i]=new g(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){y[i]=new g(i,2,!1,i,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){y[i]=new g(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){y[i]=new g(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){y[i]=new g(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){y[i]=new g(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){y[i]=new g(i,5,!1,i.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function S(i){return i[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(i){var o=i.replace(N,S);y[o]=new g(o,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var o=i.replace(N,S);y[o]=new g(o,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var o=i.replace(N,S);y[o]=new g(o,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){y[i]=new g(i,1,!1,i.toLowerCase(),null,!1,!1)}),y.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){y[i]=new g(i,1,!1,i.toLowerCase(),null,!0,!0)});function C(i,o,b,k){var L=y.hasOwnProperty(o)?y[o]:null;(L!==null?L.type!==0:k||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m=Object.prototype.hasOwnProperty,x=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},h={};function g(i){return m.call(h,i)?!0:m.call(f,i)?!1:x.test(i)?h[i]=!0:(f[i]=!0,!1)}function u(i,o,b,k){if(b!==null&&b.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return k?!1:b!==null?!b.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function j(i,o,b,k){if(o===null||typeof o>"u"||u(i,o,b,k))return!0;if(k)return!1;if(b!==null)switch(b.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function p(i,o,b,k,I,H,ae){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=k,this.attributeNamespace=I,this.mustUseProperty=b,this.propertyName=i,this.type=o,this.sanitizeURL=H,this.removeEmptyString=ae}var y={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){y[i]=new p(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var o=i[0];y[o]=new p(o,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){y[i]=new p(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){y[i]=new p(i,2,!1,i,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){y[i]=new p(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){y[i]=new p(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){y[i]=new p(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){y[i]=new p(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){y[i]=new p(i,5,!1,i.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function S(i){return i[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(i){var o=i.replace(N,S);y[o]=new p(o,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var o=i.replace(N,S);y[o]=new p(o,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var o=i.replace(N,S);y[o]=new p(o,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){y[i]=new p(i,1,!1,i.toLowerCase(),null,!1,!1)}),y.xlinkHref=new p("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){y[i]=new p(i,1,!1,i.toLowerCase(),null,!0,!0)});function A(i,o,b,k){var I=y.hasOwnProperty(o)?y[o]:null;(I!==null?I.type!==0:k||!(2je||L[ae]!==H[je]){var De=` -`+L[ae].replace(" at new "," at ");return i.displayName&&De.includes("")&&(De=De.replace("",i.displayName)),De}while(1<=ae&&0<=je);break}}}finally{V=!1,Error.prepareStackTrace=b}return(i=i?i.displayName||i.name:"")?O(i):""}function Y(i){switch(i.tag){case 5:return O(i.type);case 16:return O("Lazy");case 13:return O("Suspense");case 19:return O("SuspenseList");case 0:case 2:case 15:return i=K(i.type,!1),i;case 11:return i=K(i.type.render,!1),i;case 1:return i=K(i.type,!0),i;default:return""}}function U(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case A:return"Fragment";case P:return"Portal";case $:return"Profiler";case I:return"StrictMode";case M:return"Suspense";case q:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case E:return(i.displayName||"Context")+".Consumer";case T:return(i._context.displayName||"Context")+".Provider";case _:var o=i.render;return i=i.displayName,i||(i=o.displayName||o.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case G:return o=i.displayName||null,o!==null?o:U(i.type)||"Memo";case Z:o=i._payload,i=i._init;try{return U(i(o))}catch{}}return null}function X(i){var o=i.type;switch(i.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=o.render,i=i.displayName||i.name||"",o.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return U(o);case 8:return o===I?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function ne(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function oe(i){var o=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function re(i){var o=oe(i)?"checked":"value",b=Object.getOwnPropertyDescriptor(i.constructor.prototype,o),k=""+i[o];if(!i.hasOwnProperty(o)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var L=b.get,H=b.set;return Object.defineProperty(i,o,{configurable:!0,get:function(){return L.call(this)},set:function(ae){k=""+ae,H.call(this,ae)}}),Object.defineProperty(i,o,{enumerable:b.enumerable}),{getValue:function(){return k},setValue:function(ae){k=""+ae},stopTracking:function(){i._valueTracker=null,delete i[o]}}}}function ge(i){i._valueTracker||(i._valueTracker=re(i))}function ve(i){if(!i)return!1;var o=i._valueTracker;if(!o)return!0;var b=o.getValue(),k="";return i&&(k=oe(i)?i.checked?"true":"false":i.value),i=k,i!==b?(o.setValue(i),!0):!1}function Se(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function We(i,o){var b=o.checked;return B({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:b??i._wrapperState.initialChecked})}function Ce(i,o){var b=o.defaultValue==null?"":o.defaultValue,k=o.checked!=null?o.checked:o.defaultChecked;b=ne(o.value!=null?o.value:b),i._wrapperState={initialChecked:k,initialValue:b,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function fe(i,o){o=o.checked,o!=null&&C(i,"checked",o,!1)}function Ye(i,o){fe(i,o);var b=ne(o.value),k=o.type;if(b!=null)k==="number"?(b===0&&i.value===""||i.value!=b)&&(i.value=""+b):i.value!==""+b&&(i.value=""+b);else if(k==="submit"||k==="reset"){i.removeAttribute("value");return}o.hasOwnProperty("value")?_e(i,o.type,b):o.hasOwnProperty("defaultValue")&&_e(i,o.type,ne(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(i.defaultChecked=!!o.defaultChecked)}function be(i,o,b){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var k=o.type;if(!(k!=="submit"&&k!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+i._wrapperState.initialValue,b||o===i.value||(i.value=o),i.defaultValue=o}b=i.name,b!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,b!==""&&(i.name=b)}function _e(i,o,b){(o!=="number"||Se(i.ownerDocument)!==i)&&(b==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+b&&(i.defaultValue=""+b))}var ke=Array.isArray;function qe(i,o,b,k){if(i=i.options,o){o={};for(var L=0;L"+o.valueOf().toString()+"",o=rt.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;o.firstChild;)i.appendChild(o.firstChild)}});function Rt(i,o){if(o){var b=i.firstChild;if(b&&b===i.lastChild&&b.nodeType===3){b.nodeValue=o;return}}i.textContent=o}var Re={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Qt=["Webkit","ms","Moz","O"];Object.keys(Re).forEach(function(i){Qt.forEach(function(o){o=o+i.charAt(0).toUpperCase()+i.substring(1),Re[o]=Re[i]})});function qt(i,o,b){return o==null||typeof o=="boolean"||o===""?"":b||typeof o!="number"||o===0||Re.hasOwnProperty(i)&&Re[i]?(""+o).trim():o+"px"}function ws(i,o){i=i.style;for(var b in o)if(o.hasOwnProperty(b)){var k=b.indexOf("--")===0,L=qt(b,o[b],k);b==="float"&&(b="cssFloat"),k?i.setProperty(b,L):i[b]=L}}var _s=B({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ns(i,o){if(o){if(_s[i]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,i));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function Cs(i,o){if(i.indexOf("-")===-1)return typeof o.is=="string";switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Bs=null;function Ft(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ie=null,Fe=null,Q=null;function pe(i){if(i=nd(i)){if(typeof ie!="function")throw Error(n(280));var o=i.stateNode;o&&(o=Lu(o),ie(i.stateNode,i.type,o))}}function Ne(i){Fe?Q?Q.push(i):Q=[i]:Fe=i}function Ee(){if(Fe){var i=Fe,o=Q;if(Q=Fe=null,pe(i),o)for(i=0;i>>=0,i===0?32:31-(Un(i)/yr|0)|0}var er=64,tr=4194304;function En(i){switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function Xe(i,o){var b=i.pendingLanes;if(b===0)return 0;var k=0,L=i.suspendedLanes,H=i.pingedLanes,ae=b&268435455;if(ae!==0){var je=ae&~L;je!==0?k=En(je):(H&=ae,H!==0&&(k=En(H)))}else ae=b&~L,ae!==0?k=En(ae):H!==0&&(k=En(H));if(k===0)return 0;if(o!==0&&o!==k&&(o&L)===0&&(L=k&-k,H=o&-o,L>=H||L===16&&(H&4194240)!==0))return o;if((k&4)!==0&&(k|=b&16),o=i.entangledLanes,o!==0)for(i=i.entanglements,o&=k;0b;b++)o.push(i);return o}function jr(i,o,b){i.pendingLanes|=o,o!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,o=31-on(o),i[o]=b}function Pr(i,o){var b=i.pendingLanes&~o;i.pendingLanes=o,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=o,i.mutableReadLanes&=o,i.entangledLanes&=o,o=i.entanglements;var k=i.eventTimes;for(i=i.expirationTimes;0=Ti),cl=" ",Pi=!1;function oo(i,o){switch(i){case"keyup":return pa.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ku(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var dl=!1;function Lf(i,o){switch(i){case"compositionend":return ku(o);case"keypress":return o.which!==32?null:(Pi=!0,cl);case"textInput":return i=o.data,i===cl&&Pi?null:i;default:return null}}function Mf(i,o){if(dl)return i==="compositionend"||!ol&&oo(i,o)?(i=no(),Ei=so=Or=null,dl=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1=o)return{node:b,offset:o-i};i=k}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=sy(b)}}function ry(i,o){return i&&o?i===o?!0:i&&i.nodeType===3?!1:o&&o.nodeType===3?ry(i,o.parentNode):"contains"in i?i.contains(o):i.compareDocumentPosition?!!(i.compareDocumentPosition(o)&16):!1:!1}function ay(){for(var i=window,o=Se();o instanceof i.HTMLIFrameElement;){try{var b=typeof o.contentWindow.location.href=="string"}catch{b=!1}if(b)i=o.contentWindow;else break;o=Se(i.document)}return o}function zf(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o&&(o==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||o==="textarea"||i.contentEditable==="true")}function _D(i){var o=ay(),b=i.focusedElem,k=i.selectionRange;if(o!==b&&b&&b.ownerDocument&&ry(b.ownerDocument.documentElement,b)){if(k!==null&&zf(b)){if(o=k.start,i=k.end,i===void 0&&(i=o),"selectionStart"in b)b.selectionStart=o,b.selectionEnd=Math.min(i,b.value.length);else if(i=(o=b.ownerDocument||document)&&o.defaultView||window,i.getSelection){i=i.getSelection();var L=b.textContent.length,H=Math.min(k.start,L);k=k.end===void 0?H:Math.min(k.end,L),!i.extend&&H>k&&(L=k,k=H,H=L),L=ny(b,H);var ae=ny(b,k);L&&ae&&(i.rangeCount!==1||i.anchorNode!==L.node||i.anchorOffset!==L.offset||i.focusNode!==ae.node||i.focusOffset!==ae.offset)&&(o=o.createRange(),o.setStart(L.node,L.offset),i.removeAllRanges(),H>k?(i.addRange(o),i.extend(ae.node,ae.offset)):(o.setEnd(ae.node,ae.offset),i.addRange(o)))}}for(o=[],i=b;i=i.parentNode;)i.nodeType===1&&o.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b=document.documentMode,Zo=null,Uf=null,Xc=null,Vf=!1;function iy(i,o,b){var k=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;Vf||Zo==null||Zo!==Se(k)||(k=Zo,"selectionStart"in k&&zf(k)?k={start:k.selectionStart,end:k.selectionEnd}:(k=(k.ownerDocument&&k.ownerDocument.defaultView||window).getSelection(),k={anchorNode:k.anchorNode,anchorOffset:k.anchorOffset,focusNode:k.focusNode,focusOffset:k.focusOffset}),Xc&&Qc(Xc,k)||(Xc=k,k=_u(Uf,"onSelect"),0tc||(i.current=sp[tc],sp[tc]=null,tc--)}function vn(i,o){tc++,sp[tc]=i.current,i.current=o}var pl={},Nr=fl(pl),Hr=fl(!1),ho=pl;function sc(i,o){var b=i.type.contextTypes;if(!b)return pl;var k=i.stateNode;if(k&&k.__reactInternalMemoizedUnmaskedChildContext===o)return k.__reactInternalMemoizedMaskedChildContext;var L={},H;for(H in b)L[H]=o[H];return k&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=o,i.__reactInternalMemoizedMaskedChildContext=L),L}function Wr(i){return i=i.childContextTypes,i!=null}function Mu(){yn(Hr),yn(Nr)}function jy(i,o,b){if(Nr.current!==pl)throw Error(n(168));vn(Nr,o),vn(Hr,b)}function Ny(i,o,b){var k=i.stateNode;if(o=o.childContextTypes,typeof k.getChildContext!="function")return b;k=k.getChildContext();for(var L in k)if(!(L in o))throw Error(n(108,X(i)||"Unknown",L));return B({},b,k)}function Fu(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||pl,ho=Nr.current,vn(Nr,i),vn(Hr,Hr.current),!0}function wy(i,o,b){var k=i.stateNode;if(!k)throw Error(n(169));b?(i=Ny(i,o,ho),k.__reactInternalMemoizedMergedChildContext=i,yn(Hr),yn(Nr),vn(Nr,i)):yn(Hr),vn(Hr,b)}var Oi=null,Bu=!1,np=!1;function Sy(i){Oi===null?Oi=[i]:Oi.push(i)}function HD(i){Bu=!0,Sy(i)}function xl(){if(!np&&Oi!==null){np=!0;var i=0,o=qs;try{var b=Oi;for(qs=1;i>=ae,L-=ae,Ii=1<<32-on(o)+L|b<Ps?(or=js,js=null):or=js.sibling;var sn=vt(He,js,Ke[Ps],It);if(sn===null){js===null&&(js=or);break}i&&js&&sn.alternate===null&&o(He,js),Oe=H(sn,Oe,Ps),ys===null?hs=sn:ys.sibling=sn,ys=sn,js=or}if(Ps===Ke.length)return b(He,js),Cn&&fo(He,Ps),hs;if(js===null){for(;PsPs?(or=js,js=null):or=js.sibling;var Cl=vt(He,js,sn.value,It);if(Cl===null){js===null&&(js=or);break}i&&js&&Cl.alternate===null&&o(He,js),Oe=H(Cl,Oe,Ps),ys===null?hs=Cl:ys.sibling=Cl,ys=Cl,js=or}if(sn.done)return b(He,js),Cn&&fo(He,Ps),hs;if(js===null){for(;!sn.done;Ps++,sn=Ke.next())sn=Dt(He,sn.value,It),sn!==null&&(Oe=H(sn,Oe,Ps),ys===null?hs=sn:ys.sibling=sn,ys=sn);return Cn&&fo(He,Ps),hs}for(js=k(He,js);!sn.done;Ps++,sn=Ke.next())sn=Xt(js,He,Ps,sn.value,It),sn!==null&&(i&&sn.alternate!==null&&js.delete(sn.key===null?Ps:sn.key),Oe=H(sn,Oe,Ps),ys===null?hs=sn:ys.sibling=sn,ys=sn);return i&&js.forEach(function(CT){return o(He,CT)}),Cn&&fo(He,Ps),hs}function Ln(He,Oe,Ke,It){if(typeof Ke=="object"&&Ke!==null&&Ke.type===A&&Ke.key===null&&(Ke=Ke.props.children),typeof Ke=="object"&&Ke!==null){switch(Ke.$$typeof){case R:e:{for(var hs=Ke.key,ys=Oe;ys!==null;){if(ys.key===hs){if(hs=Ke.type,hs===A){if(ys.tag===7){b(He,ys.sibling),Oe=L(ys,Ke.props.children),Oe.return=He,He=Oe;break e}}else if(ys.elementType===hs||typeof hs=="object"&&hs!==null&&hs.$$typeof===Z&&Dy(hs)===ys.type){b(He,ys.sibling),Oe=L(ys,Ke.props),Oe.ref=rd(He,ys,Ke),Oe.return=He,He=Oe;break e}b(He,ys);break}else o(He,ys);ys=ys.sibling}Ke.type===A?(Oe=No(Ke.props.children,He.mode,It,Ke.key),Oe.return=He,He=Oe):(It=mh(Ke.type,Ke.key,Ke.props,null,He.mode,It),It.ref=rd(He,Oe,Ke),It.return=He,He=It)}return ae(He);case P:e:{for(ys=Ke.key;Oe!==null;){if(Oe.key===ys)if(Oe.tag===4&&Oe.stateNode.containerInfo===Ke.containerInfo&&Oe.stateNode.implementation===Ke.implementation){b(He,Oe.sibling),Oe=L(Oe,Ke.children||[]),Oe.return=He,He=Oe;break e}else{b(He,Oe);break}else o(He,Oe);Oe=Oe.sibling}Oe=ex(Ke,He.mode,It),Oe.return=He,He=Oe}return ae(He);case Z:return ys=Ke._init,Ln(He,Oe,ys(Ke._payload),It)}if(ke(Ke))return is(He,Oe,Ke,It);if(F(Ke))return cs(He,Oe,Ke,It);Uu(He,Ke)}return typeof Ke=="string"&&Ke!==""||typeof Ke=="number"?(Ke=""+Ke,Oe!==null&&Oe.tag===6?(b(He,Oe.sibling),Oe=L(Oe,Ke),Oe.return=He,He=Oe):(b(He,Oe),Oe=Jp(Ke,He.mode,It),Oe.return=He,He=Oe),ae(He)):b(He,Oe)}return Ln}var ic=Ty(!0),Py=Ty(!1),Vu=fl(null),Hu=null,lc=null,cp=null;function dp(){cp=lc=Hu=null}function up(i){var o=Vu.current;yn(Vu),i._currentValue=o}function hp(i,o,b){for(;i!==null;){var k=i.alternate;if((i.childLanes&o)!==o?(i.childLanes|=o,k!==null&&(k.childLanes|=o)):k!==null&&(k.childLanes&o)!==o&&(k.childLanes|=o),i===b)break;i=i.return}}function oc(i,o){Hu=i,cp=lc=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&o)!==0&&(Gr=!0),i.firstContext=null)}function ya(i){var o=i._currentValue;if(cp!==i)if(i={context:i,memoizedValue:o,next:null},lc===null){if(Hu===null)throw Error(n(308));lc=i,Hu.dependencies={lanes:0,firstContext:i}}else lc=lc.next=i;return o}var po=null;function mp(i){po===null?po=[i]:po.push(i)}function _y(i,o,b,k){var L=o.interleaved;return L===null?(b.next=b,mp(o)):(b.next=L.next,L.next=b),o.interleaved=b,Mi(i,k)}function Mi(i,o){i.lanes|=o;var b=i.alternate;for(b!==null&&(b.lanes|=o),b=i,i=i.return;i!==null;)i.childLanes|=o,b=i.alternate,b!==null&&(b.childLanes|=o),b=i,i=i.return;return b.tag===3?b.stateNode:null}var gl=!1;function fp(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Oy(i,o){i=i.updateQueue,o.updateQueue===i&&(o.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function Fi(i,o){return{eventTime:i,lane:o,tag:0,payload:null,callback:null,next:null}}function vl(i,o,b){var k=i.updateQueue;if(k===null)return null;if(k=k.shared,(Xs&2)!==0){var L=k.pending;return L===null?o.next=o:(o.next=L.next,L.next=o),k.pending=o,Mi(i,b)}return L=k.interleaved,L===null?(o.next=o,mp(k)):(o.next=L.next,L.next=o),k.interleaved=o,Mi(i,b)}function Wu(i,o,b){if(o=o.updateQueue,o!==null&&(o=o.shared,(b&4194240)!==0)){var k=o.lanes;k&=i.pendingLanes,b|=k,o.lanes=b,xn(i,b)}}function Iy(i,o){var b=i.updateQueue,k=i.alternate;if(k!==null&&(k=k.updateQueue,b===k)){var L=null,H=null;if(b=b.firstBaseUpdate,b!==null){do{var ae={eventTime:b.eventTime,lane:b.lane,tag:b.tag,payload:b.payload,callback:b.callback,next:null};H===null?L=H=ae:H=H.next=ae,b=b.next}while(b!==null);H===null?L=H=o:H=H.next=o}else L=H=o;b={baseState:k.baseState,firstBaseUpdate:L,lastBaseUpdate:H,shared:k.shared,effects:k.effects},i.updateQueue=b;return}i=b.lastBaseUpdate,i===null?b.firstBaseUpdate=o:i.next=o,b.lastBaseUpdate=o}function Gu(i,o,b,k){var L=i.updateQueue;gl=!1;var H=L.firstBaseUpdate,ae=L.lastBaseUpdate,je=L.shared.pending;if(je!==null){L.shared.pending=null;var De=je,Je=De.next;De.next=null,ae===null?H=Je:ae.next=Je,ae=De;var Nt=i.alternate;Nt!==null&&(Nt=Nt.updateQueue,je=Nt.lastBaseUpdate,je!==ae&&(je===null?Nt.firstBaseUpdate=Je:je.next=Je,Nt.lastBaseUpdate=De))}if(H!==null){var Dt=L.baseState;ae=0,Nt=Je=De=null,je=H;do{var vt=je.lane,Xt=je.eventTime;if((k&vt)===vt){Nt!==null&&(Nt=Nt.next={eventTime:Xt,lane:0,tag:je.tag,payload:je.payload,callback:je.callback,next:null});e:{var is=i,cs=je;switch(vt=o,Xt=b,cs.tag){case 1:if(is=cs.payload,typeof is=="function"){Dt=is.call(Xt,Dt,vt);break e}Dt=is;break e;case 3:is.flags=is.flags&-65537|128;case 0:if(is=cs.payload,vt=typeof is=="function"?is.call(Xt,Dt,vt):is,vt==null)break e;Dt=B({},Dt,vt);break e;case 2:gl=!0}}je.callback!==null&&je.lane!==0&&(i.flags|=64,vt=L.effects,vt===null?L.effects=[je]:vt.push(je))}else Xt={eventTime:Xt,lane:vt,tag:je.tag,payload:je.payload,callback:je.callback,next:null},Nt===null?(Je=Nt=Xt,De=Dt):Nt=Nt.next=Xt,ae|=vt;if(je=je.next,je===null){if(je=L.shared.pending,je===null)break;vt=je,je=vt.next,vt.next=null,L.lastBaseUpdate=vt,L.shared.pending=null}}while(!0);if(Nt===null&&(De=Dt),L.baseState=De,L.firstBaseUpdate=Je,L.lastBaseUpdate=Nt,o=L.shared.interleaved,o!==null){L=o;do ae|=L.lane,L=L.next;while(L!==o)}else H===null&&(L.shared.lanes=0);vo|=ae,i.lanes=ae,i.memoizedState=Dt}}function Ly(i,o,b){if(i=o.effects,o.effects=null,i!==null)for(o=0;ob?b:4,i(!0);var k=bp.transition;bp.transition={};try{i(!1),o()}finally{qs=b,bp.transition=k}}function tj(){return ja().memoizedState}function YD(i,o,b){var k=Nl(i);if(b={lane:k,action:b,hasEagerState:!1,eagerState:null,next:null},sj(i))nj(o,b);else if(b=_y(i,o,b,k),b!==null){var L=Mr();Ua(b,i,k,L),rj(b,o,k)}}function ZD(i,o,b){var k=Nl(i),L={lane:k,action:b,hasEagerState:!1,eagerState:null,next:null};if(sj(i))nj(o,L);else{var H=i.alternate;if(i.lanes===0&&(H===null||H.lanes===0)&&(H=o.lastRenderedReducer,H!==null))try{var ae=o.lastRenderedState,je=H(ae,b);if(L.hasEagerState=!0,L.eagerState=je,Fa(je,ae)){var De=o.interleaved;De===null?(L.next=L,mp(o)):(L.next=De.next,De.next=L),o.interleaved=L;return}}catch{}finally{}b=_y(i,o,L,k),b!==null&&(L=Mr(),Ua(b,i,k,L),rj(b,o,k))}}function sj(i){var o=i.alternate;return i===kn||o!==null&&o===kn}function nj(i,o){od=Zu=!0;var b=i.pending;b===null?o.next=o:(o.next=b.next,b.next=o),i.pending=o}function rj(i,o,b){if((b&4194240)!==0){var k=o.lanes;k&=i.pendingLanes,b|=k,o.lanes=b,xn(i,b)}}var Ju={readContext:ya,useCallback:wr,useContext:wr,useEffect:wr,useImperativeHandle:wr,useInsertionEffect:wr,useLayoutEffect:wr,useMemo:wr,useReducer:wr,useRef:wr,useState:wr,useDebugValue:wr,useDeferredValue:wr,useTransition:wr,useMutableSource:wr,useSyncExternalStore:wr,useId:wr,unstable_isNewReconciler:!1},QD={readContext:ya,useCallback:function(i,o){return di().memoizedState=[i,o===void 0?null:o],i},useContext:ya,useEffect:Gy,useImperativeHandle:function(i,o,b){return b=b!=null?b.concat([i]):null,Qu(4194308,4,Zy.bind(null,o,i),b)},useLayoutEffect:function(i,o){return Qu(4194308,4,i,o)},useInsertionEffect:function(i,o){return Qu(4,2,i,o)},useMemo:function(i,o){var b=di();return o=o===void 0?null:o,i=i(),b.memoizedState=[i,o],i},useReducer:function(i,o,b){var k=di();return o=b!==void 0?b(o):o,k.memoizedState=k.baseState=o,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:o},k.queue=i,i=i.dispatch=YD.bind(null,kn,i),[k.memoizedState,i]},useRef:function(i){var o=di();return i={current:i},o.memoizedState=i},useState:Hy,useDebugValue:Ap,useDeferredValue:function(i){return di().memoizedState=i},useTransition:function(){var i=Hy(!1),o=i[0];return i=KD.bind(null,i[1]),di().memoizedState=i,[o,i]},useMutableSource:function(){},useSyncExternalStore:function(i,o,b){var k=kn,L=di();if(Cn){if(b===void 0)throw Error(n(407));b=b()}else{if(b=o(),lr===null)throw Error(n(349));(go&30)!==0||$y(k,o,b)}L.memoizedState=b;var H={value:b,getSnapshot:o};return L.queue=H,Gy(zy.bind(null,k,H,i),[i]),k.flags|=2048,ud(9,qy.bind(null,k,H,b,o),void 0,null),b},useId:function(){var i=di(),o=lr.identifierPrefix;if(Cn){var b=Li,k=Ii;b=(k&~(1<<32-on(k)-1)).toString(32)+b,o=":"+o+"R"+b,b=cd++,0je||I[ae]!==H[je]){var De=` +`+I[ae].replace(" at new "," at ");return i.displayName&&De.includes("")&&(De=De.replace("",i.displayName)),De}while(1<=ae&&0<=je);break}}}finally{z=!1,Error.prepareStackTrace=b}return(i=i?i.displayName||i.name:"")?O(i):""}function Y(i){switch(i.tag){case 5:return O(i.type);case 16:return O("Lazy");case 13:return O("Suspense");case 19:return O("SuspenseList");case 0:case 2:case 15:return i=G(i.type,!1),i;case 11:return i=G(i.type.render,!1),i;case 1:return i=G(i.type,!0),i;default:return""}}function V(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case C:return"Fragment";case T:return"Portal";case $:return"Profiler";case L:return"StrictMode";case M:return"Suspense";case q:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case R:return(i.displayName||"Context")+".Consumer";case _:return(i._context.displayName||"Context")+".Provider";case P:var o=i.render;return i=i.displayName,i||(i=o.displayName||o.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case K:return o=i.displayName||null,o!==null?o:V(i.type)||"Memo";case Z:o=i._payload,i=i._init;try{return V(i(o))}catch{}}return null}function X(i){var o=i.type;switch(i.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=o.render,i=i.displayName||i.name||"",o.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return V(o);case 8:return o===L?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function ne(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function oe(i){var o=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function re(i){var o=oe(i)?"checked":"value",b=Object.getOwnPropertyDescriptor(i.constructor.prototype,o),k=""+i[o];if(!i.hasOwnProperty(o)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var I=b.get,H=b.set;return Object.defineProperty(i,o,{configurable:!0,get:function(){return I.call(this)},set:function(ae){k=""+ae,H.call(this,ae)}}),Object.defineProperty(i,o,{enumerable:b.enumerable}),{getValue:function(){return k},setValue:function(ae){k=""+ae},stopTracking:function(){i._valueTracker=null,delete i[o]}}}}function ge(i){i._valueTracker||(i._valueTracker=re(i))}function ve(i){if(!i)return!1;var o=i._valueTracker;if(!o)return!0;var b=o.getValue(),k="";return i&&(k=oe(i)?i.checked?"true":"false":i.value),i=k,i!==b?(o.setValue(i),!0):!1}function Se(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function We(i,o){var b=o.checked;return B({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:b??i._wrapperState.initialChecked})}function Ce(i,o){var b=o.defaultValue==null?"":o.defaultValue,k=o.checked!=null?o.checked:o.defaultChecked;b=ne(o.value!=null?o.value:b),i._wrapperState={initialChecked:k,initialValue:b,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function fe(i,o){o=o.checked,o!=null&&A(i,"checked",o,!1)}function Ye(i,o){fe(i,o);var b=ne(o.value),k=o.type;if(b!=null)k==="number"?(b===0&&i.value===""||i.value!=b)&&(i.value=""+b):i.value!==""+b&&(i.value=""+b);else if(k==="submit"||k==="reset"){i.removeAttribute("value");return}o.hasOwnProperty("value")?Pe(i,o.type,b):o.hasOwnProperty("defaultValue")&&Pe(i,o.type,ne(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(i.defaultChecked=!!o.defaultChecked)}function be(i,o,b){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var k=o.type;if(!(k!=="submit"&&k!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+i._wrapperState.initialValue,b||o===i.value||(i.value=o),i.defaultValue=o}b=i.name,b!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,b!==""&&(i.name=b)}function Pe(i,o,b){(o!=="number"||Se(i.ownerDocument)!==i)&&(b==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+b&&(i.defaultValue=""+b))}var ke=Array.isArray;function qe(i,o,b,k){if(i=i.options,o){o={};for(var I=0;I"+o.valueOf().toString()+"",o=rt.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;o.firstChild;)i.appendChild(o.firstChild)}});function Rt(i,o){if(o){var b=i.firstChild;if(b&&b===i.lastChild&&b.nodeType===3){b.nodeValue=o;return}}i.textContent=o}var Re={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Qt=["Webkit","ms","Moz","O"];Object.keys(Re).forEach(function(i){Qt.forEach(function(o){o=o+i.charAt(0).toUpperCase()+i.substring(1),Re[o]=Re[i]})});function qt(i,o,b){return o==null||typeof o=="boolean"||o===""?"":b||typeof o!="number"||o===0||Re.hasOwnProperty(i)&&Re[i]?(""+o).trim():o+"px"}function ws(i,o){i=i.style;for(var b in o)if(o.hasOwnProperty(b)){var k=b.indexOf("--")===0,I=qt(b,o[b],k);b==="float"&&(b="cssFloat"),k?i.setProperty(b,I):i[b]=I}}var Ps=B({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ns(i,o){if(o){if(Ps[i]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,i));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function Cs(i,o){if(i.indexOf("-")===-1)return typeof o.is=="string";switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Bs=null;function Ft(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ie=null,Fe=null,Q=null;function pe(i){if(i=nd(i)){if(typeof ie!="function")throw Error(n(280));var o=i.stateNode;o&&(o=Iu(o),ie(i.stateNode,i.type,o))}}function Ne(i){Fe?Q?Q.push(i):Q=[i]:Fe=i}function Ee(){if(Fe){var i=Fe,o=Q;if(Q=Fe=null,pe(i),o)for(i=0;i>>=0,i===0?32:31-(Un(i)/yr|0)|0}var er=64,tr=4194304;function En(i){switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function Xe(i,o){var b=i.pendingLanes;if(b===0)return 0;var k=0,I=i.suspendedLanes,H=i.pingedLanes,ae=b&268435455;if(ae!==0){var je=ae&~I;je!==0?k=En(je):(H&=ae,H!==0&&(k=En(H)))}else ae=b&~I,ae!==0?k=En(ae):H!==0&&(k=En(H));if(k===0)return 0;if(o!==0&&o!==k&&(o&I)===0&&(I=k&-k,H=o&-o,I>=H||I===16&&(H&4194240)!==0))return o;if((k&4)!==0&&(k|=b&16),o=i.entangledLanes,o!==0)for(i=i.entanglements,o&=k;0b;b++)o.push(i);return o}function jr(i,o,b){i.pendingLanes|=o,o!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,o=31-on(o),i[o]=b}function _r(i,o){var b=i.pendingLanes&~o;i.pendingLanes=o,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=o,i.mutableReadLanes&=o,i.entangledLanes&=o,o=i.entanglements;var k=i.eventTimes;for(i=i.expirationTimes;0=Ti),cl=" ",_i=!1;function oo(i,o){switch(i){case"keyup":return pa.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ku(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var dl=!1;function Ff(i,o){switch(i){case"compositionend":return ku(o);case"keypress":return o.which!==32?null:(_i=!0,cl);case"textInput":return i=o.data,i===cl&&_i?null:i;default:return null}}function Bf(i,o){if(dl)return i==="compositionend"||!ol&&oo(i,o)?(i=no(),Ei=so=Or=null,dl=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1=o)return{node:b,offset:o-i};i=k}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=ay(b)}}function ly(i,o){return i&&o?i===o?!0:i&&i.nodeType===3?!1:o&&o.nodeType===3?ly(i,o.parentNode):"contains"in i?i.contains(o):i.compareDocumentPosition?!!(i.compareDocumentPosition(o)&16):!1:!1}function oy(){for(var i=window,o=Se();o instanceof i.HTMLIFrameElement;){try{var b=typeof o.contentWindow.location.href=="string"}catch{b=!1}if(b)i=o.contentWindow;else break;o=Se(i.document)}return o}function Vf(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o&&(o==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||o==="textarea"||i.contentEditable==="true")}function FD(i){var o=oy(),b=i.focusedElem,k=i.selectionRange;if(o!==b&&b&&b.ownerDocument&&ly(b.ownerDocument.documentElement,b)){if(k!==null&&Vf(b)){if(o=k.start,i=k.end,i===void 0&&(i=o),"selectionStart"in b)b.selectionStart=o,b.selectionEnd=Math.min(i,b.value.length);else if(i=(o=b.ownerDocument||document)&&o.defaultView||window,i.getSelection){i=i.getSelection();var I=b.textContent.length,H=Math.min(k.start,I);k=k.end===void 0?H:Math.min(k.end,I),!i.extend&&H>k&&(I=k,k=H,H=I),I=iy(b,H);var ae=iy(b,k);I&&ae&&(i.rangeCount!==1||i.anchorNode!==I.node||i.anchorOffset!==I.offset||i.focusNode!==ae.node||i.focusOffset!==ae.offset)&&(o=o.createRange(),o.setStart(I.node,I.offset),i.removeAllRanges(),H>k?(i.addRange(o),i.extend(ae.node,ae.offset)):(o.setEnd(ae.node,ae.offset),i.addRange(o)))}}for(o=[],i=b;i=i.parentNode;)i.nodeType===1&&o.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b=document.documentMode,Zo=null,Hf=null,Xc=null,Wf=!1;function cy(i,o,b){var k=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;Wf||Zo==null||Zo!==Se(k)||(k=Zo,"selectionStart"in k&&Vf(k)?k={start:k.selectionStart,end:k.selectionEnd}:(k=(k.ownerDocument&&k.ownerDocument.defaultView||window).getSelection(),k={anchorNode:k.anchorNode,anchorOffset:k.anchorOffset,focusNode:k.focusNode,focusOffset:k.focusOffset}),Xc&&Qc(Xc,k)||(Xc=k,k=Pu(Hf,"onSelect"),0tc||(i.current=rp[tc],rp[tc]=null,tc--)}function vn(i,o){tc++,rp[tc]=i.current,i.current=o}var pl={},Nr=fl(pl),Hr=fl(!1),ho=pl;function sc(i,o){var b=i.type.contextTypes;if(!b)return pl;var k=i.stateNode;if(k&&k.__reactInternalMemoizedUnmaskedChildContext===o)return k.__reactInternalMemoizedMaskedChildContext;var I={},H;for(H in b)I[H]=o[H];return k&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=o,i.__reactInternalMemoizedMaskedChildContext=I),I}function Wr(i){return i=i.childContextTypes,i!=null}function Mu(){yn(Hr),yn(Nr)}function Sy(i,o,b){if(Nr.current!==pl)throw Error(n(168));vn(Nr,o),vn(Hr,b)}function Cy(i,o,b){var k=i.stateNode;if(o=o.childContextTypes,typeof k.getChildContext!="function")return b;k=k.getChildContext();for(var I in k)if(!(I in o))throw Error(n(108,X(i)||"Unknown",I));return B({},b,k)}function Fu(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||pl,ho=Nr.current,vn(Nr,i),vn(Hr,Hr.current),!0}function Ay(i,o,b){var k=i.stateNode;if(!k)throw Error(n(169));b?(i=Cy(i,o,ho),k.__reactInternalMemoizedMergedChildContext=i,yn(Hr),yn(Nr),vn(Nr,i)):yn(Hr),vn(Hr,b)}var Oi=null,Bu=!1,ap=!1;function ky(i){Oi===null?Oi=[i]:Oi.push(i)}function ZD(i){Bu=!0,ky(i)}function xl(){if(!ap&&Oi!==null){ap=!0;var i=0,o=qs;try{var b=Oi;for(qs=1;i>=ae,I-=ae,Li=1<<32-on(o)+I|b<_s?(or=js,js=null):or=js.sibling;var sn=vt(He,js,Ge[_s],Lt);if(sn===null){js===null&&(js=or);break}i&&js&&sn.alternate===null&&o(He,js),Oe=H(sn,Oe,_s),ys===null?hs=sn:ys.sibling=sn,ys=sn,js=or}if(_s===Ge.length)return b(He,js),Cn&&fo(He,_s),hs;if(js===null){for(;_s_s?(or=js,js=null):or=js.sibling;var Cl=vt(He,js,sn.value,Lt);if(Cl===null){js===null&&(js=or);break}i&&js&&Cl.alternate===null&&o(He,js),Oe=H(Cl,Oe,_s),ys===null?hs=Cl:ys.sibling=Cl,ys=Cl,js=or}if(sn.done)return b(He,js),Cn&&fo(He,_s),hs;if(js===null){for(;!sn.done;_s++,sn=Ge.next())sn=Dt(He,sn.value,Lt),sn!==null&&(Oe=H(sn,Oe,_s),ys===null?hs=sn:ys.sibling=sn,ys=sn);return Cn&&fo(He,_s),hs}for(js=k(He,js);!sn.done;_s++,sn=Ge.next())sn=Xt(js,He,_s,sn.value,Lt),sn!==null&&(i&&sn.alternate!==null&&js.delete(sn.key===null?_s:sn.key),Oe=H(sn,Oe,_s),ys===null?hs=sn:ys.sibling=sn,ys=sn);return i&&js.forEach(function(DT){return o(He,DT)}),Cn&&fo(He,_s),hs}function In(He,Oe,Ge,Lt){if(typeof Ge=="object"&&Ge!==null&&Ge.type===C&&Ge.key===null&&(Ge=Ge.props.children),typeof Ge=="object"&&Ge!==null){switch(Ge.$$typeof){case E:e:{for(var hs=Ge.key,ys=Oe;ys!==null;){if(ys.key===hs){if(hs=Ge.type,hs===C){if(ys.tag===7){b(He,ys.sibling),Oe=I(ys,Ge.props.children),Oe.return=He,He=Oe;break e}}else if(ys.elementType===hs||typeof hs=="object"&&hs!==null&&hs.$$typeof===Z&&Py(hs)===ys.type){b(He,ys.sibling),Oe=I(ys,Ge.props),Oe.ref=rd(He,ys,Ge),Oe.return=He,He=Oe;break e}b(He,ys);break}else o(He,ys);ys=ys.sibling}Ge.type===C?(Oe=No(Ge.props.children,He.mode,Lt,Ge.key),Oe.return=He,He=Oe):(Lt=mh(Ge.type,Ge.key,Ge.props,null,He.mode,Lt),Lt.ref=rd(He,Oe,Ge),Lt.return=He,He=Lt)}return ae(He);case T:e:{for(ys=Ge.key;Oe!==null;){if(Oe.key===ys)if(Oe.tag===4&&Oe.stateNode.containerInfo===Ge.containerInfo&&Oe.stateNode.implementation===Ge.implementation){b(He,Oe.sibling),Oe=I(Oe,Ge.children||[]),Oe.return=He,He=Oe;break e}else{b(He,Oe);break}else o(He,Oe);Oe=Oe.sibling}Oe=sx(Ge,He.mode,Lt),Oe.return=He,He=Oe}return ae(He);case Z:return ys=Ge._init,In(He,Oe,ys(Ge._payload),Lt)}if(ke(Ge))return is(He,Oe,Ge,Lt);if(F(Ge))return cs(He,Oe,Ge,Lt);Uu(He,Ge)}return typeof Ge=="string"&&Ge!==""||typeof Ge=="number"?(Ge=""+Ge,Oe!==null&&Oe.tag===6?(b(He,Oe.sibling),Oe=I(Oe,Ge),Oe.return=He,He=Oe):(b(He,Oe),Oe=tx(Ge,He.mode,Lt),Oe.return=He,He=Oe),ae(He)):b(He,Oe)}return In}var ic=Oy(!0),Ly=Oy(!1),Vu=fl(null),Hu=null,lc=null,up=null;function hp(){up=lc=Hu=null}function mp(i){var o=Vu.current;yn(Vu),i._currentValue=o}function fp(i,o,b){for(;i!==null;){var k=i.alternate;if((i.childLanes&o)!==o?(i.childLanes|=o,k!==null&&(k.childLanes|=o)):k!==null&&(k.childLanes&o)!==o&&(k.childLanes|=o),i===b)break;i=i.return}}function oc(i,o){Hu=i,up=lc=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&o)!==0&&(Kr=!0),i.firstContext=null)}function ya(i){var o=i._currentValue;if(up!==i)if(i={context:i,memoizedValue:o,next:null},lc===null){if(Hu===null)throw Error(n(308));lc=i,Hu.dependencies={lanes:0,firstContext:i}}else lc=lc.next=i;return o}var po=null;function pp(i){po===null?po=[i]:po.push(i)}function Iy(i,o,b,k){var I=o.interleaved;return I===null?(b.next=b,pp(o)):(b.next=I.next,I.next=b),o.interleaved=b,Mi(i,k)}function Mi(i,o){i.lanes|=o;var b=i.alternate;for(b!==null&&(b.lanes|=o),b=i,i=i.return;i!==null;)i.childLanes|=o,b=i.alternate,b!==null&&(b.childLanes|=o),b=i,i=i.return;return b.tag===3?b.stateNode:null}var gl=!1;function xp(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function My(i,o){i=i.updateQueue,o.updateQueue===i&&(o.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function Fi(i,o){return{eventTime:i,lane:o,tag:0,payload:null,callback:null,next:null}}function vl(i,o,b){var k=i.updateQueue;if(k===null)return null;if(k=k.shared,(Xs&2)!==0){var I=k.pending;return I===null?o.next=o:(o.next=I.next,I.next=o),k.pending=o,Mi(i,b)}return I=k.interleaved,I===null?(o.next=o,pp(k)):(o.next=I.next,I.next=o),k.interleaved=o,Mi(i,b)}function Wu(i,o,b){if(o=o.updateQueue,o!==null&&(o=o.shared,(b&4194240)!==0)){var k=o.lanes;k&=i.pendingLanes,b|=k,o.lanes=b,xn(i,b)}}function Fy(i,o){var b=i.updateQueue,k=i.alternate;if(k!==null&&(k=k.updateQueue,b===k)){var I=null,H=null;if(b=b.firstBaseUpdate,b!==null){do{var ae={eventTime:b.eventTime,lane:b.lane,tag:b.tag,payload:b.payload,callback:b.callback,next:null};H===null?I=H=ae:H=H.next=ae,b=b.next}while(b!==null);H===null?I=H=o:H=H.next=o}else I=H=o;b={baseState:k.baseState,firstBaseUpdate:I,lastBaseUpdate:H,shared:k.shared,effects:k.effects},i.updateQueue=b;return}i=b.lastBaseUpdate,i===null?b.firstBaseUpdate=o:i.next=o,b.lastBaseUpdate=o}function Ku(i,o,b,k){var I=i.updateQueue;gl=!1;var H=I.firstBaseUpdate,ae=I.lastBaseUpdate,je=I.shared.pending;if(je!==null){I.shared.pending=null;var De=je,Je=De.next;De.next=null,ae===null?H=Je:ae.next=Je,ae=De;var Nt=i.alternate;Nt!==null&&(Nt=Nt.updateQueue,je=Nt.lastBaseUpdate,je!==ae&&(je===null?Nt.firstBaseUpdate=Je:je.next=Je,Nt.lastBaseUpdate=De))}if(H!==null){var Dt=I.baseState;ae=0,Nt=Je=De=null,je=H;do{var vt=je.lane,Xt=je.eventTime;if((k&vt)===vt){Nt!==null&&(Nt=Nt.next={eventTime:Xt,lane:0,tag:je.tag,payload:je.payload,callback:je.callback,next:null});e:{var is=i,cs=je;switch(vt=o,Xt=b,cs.tag){case 1:if(is=cs.payload,typeof is=="function"){Dt=is.call(Xt,Dt,vt);break e}Dt=is;break e;case 3:is.flags=is.flags&-65537|128;case 0:if(is=cs.payload,vt=typeof is=="function"?is.call(Xt,Dt,vt):is,vt==null)break e;Dt=B({},Dt,vt);break e;case 2:gl=!0}}je.callback!==null&&je.lane!==0&&(i.flags|=64,vt=I.effects,vt===null?I.effects=[je]:vt.push(je))}else Xt={eventTime:Xt,lane:vt,tag:je.tag,payload:je.payload,callback:je.callback,next:null},Nt===null?(Je=Nt=Xt,De=Dt):Nt=Nt.next=Xt,ae|=vt;if(je=je.next,je===null){if(je=I.shared.pending,je===null)break;vt=je,je=vt.next,vt.next=null,I.lastBaseUpdate=vt,I.shared.pending=null}}while(!0);if(Nt===null&&(De=Dt),I.baseState=De,I.firstBaseUpdate=Je,I.lastBaseUpdate=Nt,o=I.shared.interleaved,o!==null){I=o;do ae|=I.lane,I=I.next;while(I!==o)}else H===null&&(I.shared.lanes=0);vo|=ae,i.lanes=ae,i.memoizedState=Dt}}function By(i,o,b){if(i=o.effects,o.effects=null,i!==null)for(o=0;ob?b:4,i(!0);var k=jp.transition;jp.transition={};try{i(!1),o()}finally{qs=b,jp.transition=k}}function rj(){return ja().memoizedState}function eT(i,o,b){var k=Nl(i);if(b={lane:k,action:b,hasEagerState:!1,eagerState:null,next:null},aj(i))ij(o,b);else if(b=Iy(i,o,b,k),b!==null){var I=Mr();Ua(b,i,k,I),lj(b,o,k)}}function tT(i,o,b){var k=Nl(i),I={lane:k,action:b,hasEagerState:!1,eagerState:null,next:null};if(aj(i))ij(o,I);else{var H=i.alternate;if(i.lanes===0&&(H===null||H.lanes===0)&&(H=o.lastRenderedReducer,H!==null))try{var ae=o.lastRenderedState,je=H(ae,b);if(I.hasEagerState=!0,I.eagerState=je,Fa(je,ae)){var De=o.interleaved;De===null?(I.next=I,pp(o)):(I.next=De.next,De.next=I),o.interleaved=I;return}}catch{}finally{}b=Iy(i,o,I,k),b!==null&&(I=Mr(),Ua(b,i,k,I),lj(b,o,k))}}function aj(i){var o=i.alternate;return i===kn||o!==null&&o===kn}function ij(i,o){od=Zu=!0;var b=i.pending;b===null?o.next=o:(o.next=b.next,b.next=o),i.pending=o}function lj(i,o,b){if((b&4194240)!==0){var k=o.lanes;k&=i.pendingLanes,b|=k,o.lanes=b,xn(i,b)}}var Ju={readContext:ya,useCallback:wr,useContext:wr,useEffect:wr,useImperativeHandle:wr,useInsertionEffect:wr,useLayoutEffect:wr,useMemo:wr,useReducer:wr,useRef:wr,useState:wr,useDebugValue:wr,useDeferredValue:wr,useTransition:wr,useMutableSource:wr,useSyncExternalStore:wr,useId:wr,unstable_isNewReconciler:!1},sT={readContext:ya,useCallback:function(i,o){return di().memoizedState=[i,o===void 0?null:o],i},useContext:ya,useEffect:Zy,useImperativeHandle:function(i,o,b){return b=b!=null?b.concat([i]):null,Qu(4194308,4,Jy.bind(null,o,i),b)},useLayoutEffect:function(i,o){return Qu(4194308,4,i,o)},useInsertionEffect:function(i,o){return Qu(4,2,i,o)},useMemo:function(i,o){var b=di();return o=o===void 0?null:o,i=i(),b.memoizedState=[i,o],i},useReducer:function(i,o,b){var k=di();return o=b!==void 0?b(o):o,k.memoizedState=k.baseState=o,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:o},k.queue=i,i=i.dispatch=eT.bind(null,kn,i),[k.memoizedState,i]},useRef:function(i){var o=di();return i={current:i},o.memoizedState=i},useState:Gy,useDebugValue:Rp,useDeferredValue:function(i){return di().memoizedState=i},useTransition:function(){var i=Gy(!1),o=i[0];return i=JD.bind(null,i[1]),di().memoizedState=i,[o,i]},useMutableSource:function(){},useSyncExternalStore:function(i,o,b){var k=kn,I=di();if(Cn){if(b===void 0)throw Error(n(407));b=b()}else{if(b=o(),lr===null)throw Error(n(349));(go&30)!==0||Uy(k,o,b)}I.memoizedState=b;var H={value:b,getSnapshot:o};return I.queue=H,Zy(Hy.bind(null,k,H,i),[i]),k.flags|=2048,ud(9,Vy.bind(null,k,H,b,o),void 0,null),b},useId:function(){var i=di(),o=lr.identifierPrefix;if(Cn){var b=Ii,k=Li;b=(k&~(1<<32-on(k)-1)).toString(32)+b,o=":"+o+"R"+b,b=cd++,0<\/script>",i=i.removeChild(i.firstChild)):typeof k.is=="string"?i=ae.createElement(b,{is:k.is}):(i=ae.createElement(b),b==="select"&&(ae=i,k.multiple?ae.multiple=!0:k.size&&(ae.size=k.size))):i=ae.createElementNS(i,b),i[oi]=o,i[sd]=k,Sj(i,o,!1,!1),o.stateNode=i;e:{switch(ae=Cs(b,k),b){case"dialog":bn("cancel",i),bn("close",i),L=k;break;case"iframe":case"object":case"embed":bn("load",i),L=k;break;case"video":case"audio":for(L=0;Lmc&&(o.flags|=128,k=!0,hd(H,!1),o.lanes=4194304)}else{if(!k)if(i=Ku(ae),i!==null){if(o.flags|=128,k=!0,b=i.updateQueue,b!==null&&(o.updateQueue=b,o.flags|=4),hd(H,!0),H.tail===null&&H.tailMode==="hidden"&&!ae.alternate&&!Cn)return Sr(o),null}else 2*as()-H.renderingStartTime>mc&&b!==1073741824&&(o.flags|=128,k=!0,hd(H,!1),o.lanes=4194304);H.isBackwards?(ae.sibling=o.child,o.child=ae):(b=H.last,b!==null?b.sibling=ae:o.child=ae,H.last=ae)}return H.tail!==null?(o=H.tail,H.rendering=o,H.tail=o.sibling,H.renderingStartTime=as(),o.sibling=null,b=An.current,vn(An,k?b&1|2:b&1),o):(Sr(o),null);case 22:case 23:return Zp(),k=o.memoizedState!==null,i!==null&&i.memoizedState!==null!==k&&(o.flags|=8192),k&&(o.mode&1)!==0?(ra&1073741824)!==0&&(Sr(o),o.subtreeFlags&6&&(o.flags|=8192)):Sr(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function aT(i,o){switch(ap(o),o.tag){case 1:return Wr(o.type)&&Mu(),i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 3:return cc(),yn(Hr),yn(Nr),vp(),i=o.flags,(i&65536)!==0&&(i&128)===0?(o.flags=i&-65537|128,o):null;case 5:return xp(o),null;case 13:if(yn(An),i=o.memoizedState,i!==null&&i.dehydrated!==null){if(o.alternate===null)throw Error(n(340));ac()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 19:return yn(An),null;case 4:return cc(),null;case 10:return up(o.type._context),null;case 22:case 23:return Zp(),null;case 24:return null;default:return null}}var nh=!1,Cr=!1,iT=typeof WeakSet=="function"?WeakSet:Set,ts=null;function uc(i,o){var b=i.ref;if(b!==null)if(typeof b=="function")try{b(null)}catch(k){Tn(i,o,k)}else b.current=null}function Fp(i,o,b){try{b()}catch(k){Tn(i,o,k)}}var kj=!1;function lT(i,o){if(Zf=_a,i=ay(),zf(i)){if("selectionStart"in i)var b={start:i.selectionStart,end:i.selectionEnd};else e:{b=(b=i.ownerDocument)&&b.defaultView||window;var k=b.getSelection&&b.getSelection();if(k&&k.rangeCount!==0){b=k.anchorNode;var L=k.anchorOffset,H=k.focusNode;k=k.focusOffset;try{b.nodeType,H.nodeType}catch{b=null;break e}var ae=0,je=-1,De=-1,Je=0,Nt=0,Dt=i,vt=null;t:for(;;){for(var Xt;Dt!==b||L!==0&&Dt.nodeType!==3||(je=ae+L),Dt!==H||k!==0&&Dt.nodeType!==3||(De=ae+k),Dt.nodeType===3&&(ae+=Dt.nodeValue.length),(Xt=Dt.firstChild)!==null;)vt=Dt,Dt=Xt;for(;;){if(Dt===i)break t;if(vt===b&&++Je===L&&(je=ae),vt===H&&++Nt===k&&(De=ae),(Xt=Dt.nextSibling)!==null)break;Dt=vt,vt=Dt.parentNode}Dt=Xt}b=je===-1||De===-1?null:{start:je,end:De}}else b=null}b=b||{start:0,end:0}}else b=null;for(Qf={focusedElem:i,selectionRange:b},_a=!1,ts=o;ts!==null;)if(o=ts,i=o.child,(o.subtreeFlags&1028)!==0&&i!==null)i.return=o,ts=i;else for(;ts!==null;){o=ts;try{var is=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(is!==null){var cs=is.memoizedProps,Ln=is.memoizedState,He=o.stateNode,Oe=He.getSnapshotBeforeUpdate(o.elementType===o.type?cs:$a(o.type,cs),Ln);He.__reactInternalSnapshotBeforeUpdate=Oe}break;case 3:var Ke=o.stateNode.containerInfo;Ke.nodeType===1?Ke.textContent="":Ke.nodeType===9&&Ke.documentElement&&Ke.removeChild(Ke.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(It){Tn(o,o.return,It)}if(i=o.sibling,i!==null){i.return=o.return,ts=i;break}ts=o.return}return is=kj,kj=!1,is}function md(i,o,b){var k=o.updateQueue;if(k=k!==null?k.lastEffect:null,k!==null){var L=k=k.next;do{if((L.tag&i)===i){var H=L.destroy;L.destroy=void 0,H!==void 0&&Fp(o,b,H)}L=L.next}while(L!==k)}}function rh(i,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var b=o=o.next;do{if((b.tag&i)===i){var k=b.create;b.destroy=k()}b=b.next}while(b!==o)}}function Bp(i){var o=i.ref;if(o!==null){var b=i.stateNode;switch(i.tag){case 5:i=b;break;default:i=b}typeof o=="function"?o(i):o.current=i}}function Rj(i){var o=i.alternate;o!==null&&(i.alternate=null,Rj(o)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(o=i.stateNode,o!==null&&(delete o[oi],delete o[sd],delete o[tp],delete o[UD],delete o[VD])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function Ej(i){return i.tag===5||i.tag===3||i.tag===4}function Dj(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Ej(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function $p(i,o,b){var k=i.tag;if(k===5||k===6)i=i.stateNode,o?b.nodeType===8?b.parentNode.insertBefore(i,o):b.insertBefore(i,o):(b.nodeType===8?(o=b.parentNode,o.insertBefore(i,b)):(o=b,o.appendChild(i)),b=b._reactRootContainer,b!=null||o.onclick!==null||(o.onclick=Iu));else if(k!==4&&(i=i.child,i!==null))for($p(i,o,b),i=i.sibling;i!==null;)$p(i,o,b),i=i.sibling}function qp(i,o,b){var k=i.tag;if(k===5||k===6)i=i.stateNode,o?b.insertBefore(i,o):b.appendChild(i);else if(k!==4&&(i=i.child,i!==null))for(qp(i,o,b),i=i.sibling;i!==null;)qp(i,o,b),i=i.sibling}var gr=null,qa=!1;function bl(i,o,b){for(b=b.child;b!==null;)Tj(i,o,b),b=b.sibling}function Tj(i,o,b){if(Qs&&typeof Qs.onCommitFiberUnmount=="function")try{Qs.onCommitFiberUnmount(Ws,b)}catch{}switch(b.tag){case 5:Cr||uc(b,o);case 6:var k=gr,L=qa;gr=null,bl(i,o,b),gr=k,qa=L,gr!==null&&(qa?(i=gr,b=b.stateNode,i.nodeType===8?i.parentNode.removeChild(b):i.removeChild(b)):gr.removeChild(b.stateNode));break;case 18:gr!==null&&(qa?(i=gr,b=b.stateNode,i.nodeType===8?ep(i.parentNode,b):i.nodeType===1&&ep(i,b),ri(i)):ep(gr,b.stateNode));break;case 4:k=gr,L=qa,gr=b.stateNode.containerInfo,qa=!0,bl(i,o,b),gr=k,qa=L;break;case 0:case 11:case 14:case 15:if(!Cr&&(k=b.updateQueue,k!==null&&(k=k.lastEffect,k!==null))){L=k=k.next;do{var H=L,ae=H.destroy;H=H.tag,ae!==void 0&&((H&2)!==0||(H&4)!==0)&&Fp(b,o,ae),L=L.next}while(L!==k)}bl(i,o,b);break;case 1:if(!Cr&&(uc(b,o),k=b.stateNode,typeof k.componentWillUnmount=="function"))try{k.props=b.memoizedProps,k.state=b.memoizedState,k.componentWillUnmount()}catch(je){Tn(b,o,je)}bl(i,o,b);break;case 21:bl(i,o,b);break;case 22:b.mode&1?(Cr=(k=Cr)||b.memoizedState!==null,bl(i,o,b),Cr=k):bl(i,o,b);break;default:bl(i,o,b)}}function Pj(i){var o=i.updateQueue;if(o!==null){i.updateQueue=null;var b=i.stateNode;b===null&&(b=i.stateNode=new iT),o.forEach(function(k){var L=xT.bind(null,i,k);b.has(k)||(b.add(k),k.then(L,L))})}}function za(i,o){var b=o.deletions;if(b!==null)for(var k=0;kL&&(L=ae),k&=~H}if(k=L,k=as()-k,k=(120>k?120:480>k?480:1080>k?1080:1920>k?1920:3e3>k?3e3:4320>k?4320:1960*cT(k/1960))-k,10i?16:i,jl===null)var k=!1;else{if(i=jl,jl=null,ch=0,(Xs&6)!==0)throw Error(n(331));var L=Xs;for(Xs|=4,ts=i.current;ts!==null;){var H=ts,ae=H.child;if((ts.flags&16)!==0){var je=H.deletions;if(je!==null){for(var De=0;Deas()-Vp?yo(i,0):Up|=b),Yr(i,o)}function Hj(i,o){o===0&&((i.mode&1)===0?o=1:(o=tr,tr<<=1,(tr&130023424)===0&&(tr=4194304)));var b=Mr();i=Mi(i,o),i!==null&&(jr(i,o,b),Yr(i,b))}function pT(i){var o=i.memoizedState,b=0;o!==null&&(b=o.retryLane),Hj(i,b)}function xT(i,o){var b=0;switch(i.tag){case 13:var k=i.stateNode,L=i.memoizedState;L!==null&&(b=L.retryLane);break;case 19:k=i.stateNode;break;default:throw Error(n(314))}k!==null&&k.delete(o),Hj(i,b)}var Wj;Wj=function(i,o,b){if(i!==null)if(i.memoizedProps!==o.pendingProps||Hr.current)Gr=!0;else{if((i.lanes&b)===0&&(o.flags&128)===0)return Gr=!1,nT(i,o,b);Gr=(i.flags&131072)!==0}else Gr=!1,Cn&&(o.flags&1048576)!==0&&Cy(o,qu,o.index);switch(o.lanes=0,o.tag){case 2:var k=o.type;sh(i,o),i=o.pendingProps;var L=sc(o,Nr.current);oc(o,b),L=jp(null,o,k,i,L,b);var H=Np();return o.flags|=1,typeof L=="object"&&L!==null&&typeof L.render=="function"&&L.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Wr(k)?(H=!0,Fu(o)):H=!1,o.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,fp(o),L.updater=eh,o.stateNode=L,L._reactInternals=o,Rp(o,k,i,b),o=Pp(null,o,k,!0,H,b)):(o.tag=0,Cn&&H&&rp(o),Lr(null,o,L,b),o=o.child),o;case 16:k=o.elementType;e:{switch(sh(i,o),i=o.pendingProps,L=k._init,k=L(k._payload),o.type=k,L=o.tag=vT(k),i=$a(k,i),L){case 0:o=Tp(null,o,k,i,b);break e;case 1:o=vj(null,o,k,i,b);break e;case 11:o=mj(null,o,k,i,b);break e;case 14:o=fj(null,o,k,$a(k.type,i),b);break e}throw Error(n(306,k,""))}return o;case 0:return k=o.type,L=o.pendingProps,L=o.elementType===k?L:$a(k,L),Tp(i,o,k,L,b);case 1:return k=o.type,L=o.pendingProps,L=o.elementType===k?L:$a(k,L),vj(i,o,k,L,b);case 3:e:{if(bj(o),i===null)throw Error(n(387));k=o.pendingProps,H=o.memoizedState,L=H.element,Oy(i,o),Gu(o,k,null,b);var ae=o.memoizedState;if(k=ae.element,H.isDehydrated)if(H={element:k,isDehydrated:!1,cache:ae.cache,pendingSuspenseBoundaries:ae.pendingSuspenseBoundaries,transitions:ae.transitions},o.updateQueue.baseState=H,o.memoizedState=H,o.flags&256){L=dc(Error(n(423)),o),o=yj(i,o,k,b,L);break e}else if(k!==L){L=dc(Error(n(424)),o),o=yj(i,o,k,b,L);break e}else for(na=ml(o.stateNode.containerInfo.firstChild),sa=o,Cn=!0,Ba=null,b=Py(o,null,k,b),o.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(ac(),k===L){o=Bi(i,o,b);break e}Lr(i,o,k,b)}o=o.child}return o;case 5:return My(o),i===null&&lp(o),k=o.type,L=o.pendingProps,H=i!==null?i.memoizedProps:null,ae=L.children,Xf(k,L)?ae=null:H!==null&&Xf(k,H)&&(o.flags|=32),gj(i,o),Lr(i,o,ae,b),o.child;case 6:return i===null&&lp(o),null;case 13:return jj(i,o,b);case 4:return pp(o,o.stateNode.containerInfo),k=o.pendingProps,i===null?o.child=ic(o,null,k,b):Lr(i,o,k,b),o.child;case 11:return k=o.type,L=o.pendingProps,L=o.elementType===k?L:$a(k,L),mj(i,o,k,L,b);case 7:return Lr(i,o,o.pendingProps,b),o.child;case 8:return Lr(i,o,o.pendingProps.children,b),o.child;case 12:return Lr(i,o,o.pendingProps.children,b),o.child;case 10:e:{if(k=o.type._context,L=o.pendingProps,H=o.memoizedProps,ae=L.value,vn(Vu,k._currentValue),k._currentValue=ae,H!==null)if(Fa(H.value,ae)){if(H.children===L.children&&!Hr.current){o=Bi(i,o,b);break e}}else for(H=o.child,H!==null&&(H.return=o);H!==null;){var je=H.dependencies;if(je!==null){ae=H.child;for(var De=je.firstContext;De!==null;){if(De.context===k){if(H.tag===1){De=Fi(-1,b&-b),De.tag=2;var Je=H.updateQueue;if(Je!==null){Je=Je.shared;var Nt=Je.pending;Nt===null?De.next=De:(De.next=Nt.next,Nt.next=De),Je.pending=De}}H.lanes|=b,De=H.alternate,De!==null&&(De.lanes|=b),hp(H.return,b,o),je.lanes|=b;break}De=De.next}}else if(H.tag===10)ae=H.type===o.type?null:H.child;else if(H.tag===18){if(ae=H.return,ae===null)throw Error(n(341));ae.lanes|=b,je=ae.alternate,je!==null&&(je.lanes|=b),hp(ae,b,o),ae=H.sibling}else ae=H.child;if(ae!==null)ae.return=H;else for(ae=H;ae!==null;){if(ae===o){ae=null;break}if(H=ae.sibling,H!==null){H.return=ae.return,ae=H;break}ae=ae.return}H=ae}Lr(i,o,L.children,b),o=o.child}return o;case 9:return L=o.type,k=o.pendingProps.children,oc(o,b),L=ya(L),k=k(L),o.flags|=1,Lr(i,o,k,b),o.child;case 14:return k=o.type,L=$a(k,o.pendingProps),L=$a(k.type,L),fj(i,o,k,L,b);case 15:return pj(i,o,o.type,o.pendingProps,b);case 17:return k=o.type,L=o.pendingProps,L=o.elementType===k?L:$a(k,L),sh(i,o),o.tag=1,Wr(k)?(i=!0,Fu(o)):i=!1,oc(o,b),ij(o,k,L),Rp(o,k,L,b),Pp(null,o,k,!0,i,b);case 19:return wj(i,o,b);case 22:return xj(i,o,b)}throw Error(n(156,o.tag))};function Gj(i,o){return pt(i,o)}function gT(i,o,b,k){this.tag=i,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=k,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wa(i,o,b,k){return new gT(i,o,b,k)}function Xp(i){return i=i.prototype,!(!i||!i.isReactComponent)}function vT(i){if(typeof i=="function")return Xp(i)?1:0;if(i!=null){if(i=i.$$typeof,i===_)return 11;if(i===G)return 14}return 2}function Sl(i,o){var b=i.alternate;return b===null?(b=wa(i.tag,o,i.key,i.mode),b.elementType=i.elementType,b.type=i.type,b.stateNode=i.stateNode,b.alternate=i,i.alternate=b):(b.pendingProps=o,b.type=i.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=i.flags&14680064,b.childLanes=i.childLanes,b.lanes=i.lanes,b.child=i.child,b.memoizedProps=i.memoizedProps,b.memoizedState=i.memoizedState,b.updateQueue=i.updateQueue,o=i.dependencies,b.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},b.sibling=i.sibling,b.index=i.index,b.ref=i.ref,b}function mh(i,o,b,k,L,H){var ae=2;if(k=i,typeof i=="function")Xp(i)&&(ae=1);else if(typeof i=="string")ae=5;else e:switch(i){case A:return No(b.children,L,H,o);case I:ae=8,L|=8;break;case $:return i=wa(12,b,o,L|2),i.elementType=$,i.lanes=H,i;case M:return i=wa(13,b,o,L),i.elementType=M,i.lanes=H,i;case q:return i=wa(19,b,o,L),i.elementType=q,i.lanes=H,i;case W:return fh(b,L,H,o);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case T:ae=10;break e;case E:ae=9;break e;case _:ae=11;break e;case G:ae=14;break e;case Z:ae=16,k=null;break e}throw Error(n(130,i==null?i:typeof i,""))}return o=wa(ae,b,o,L),o.elementType=i,o.type=k,o.lanes=H,o}function No(i,o,b,k){return i=wa(7,i,k,o),i.lanes=b,i}function fh(i,o,b,k){return i=wa(22,i,k,o),i.elementType=W,i.lanes=b,i.stateNode={isHidden:!1},i}function Jp(i,o,b){return i=wa(6,i,null,o),i.lanes=b,i}function ex(i,o,b){return o=wa(4,i.children!==null?i.children:[],i.key,o),o.lanes=b,o.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},o}function bT(i,o,b,k,L){this.tag=o,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=In(0),this.expirationTimes=In(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=In(0),this.identifierPrefix=k,this.onRecoverableError=L,this.mutableSourceEagerHydrationData=null}function tx(i,o,b,k,L,H,ae,je,De){return i=new bT(i,o,b,je,De),o===1?(o=1,H===!0&&(o|=8)):o=0,H=wa(3,null,null,o),i.current=H,H.stateNode=i,H.memoizedState={element:k,isDehydrated:b,cache:null,transitions:null,pendingSuspenseBoundaries:null},fp(H),i}function yT(i,o,b){var k=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),ox.exports=OT(),ox.exports}var lN;function IT(){if(lN)return jh;lN=1;var t=Dv();return jh.createRoot=t.createRoot,jh.hydrateRoot=t.hydrateRoot,jh}var LT=IT();const MT=_m(LT);var ux={exports:{}},hx={};/** +`+H.stack}return{value:i,source:o,stack:I,digest:null}}function Tp(i,o,b){return{value:i,source:null,stack:b??null,digest:o??null}}function _p(i,o){try{console.error(o.value)}catch(b){setTimeout(function(){throw b})}}var aT=typeof WeakMap=="function"?WeakMap:Map;function uj(i,o,b){b=Fi(-1,b),b.tag=3,b.payload={element:null};var k=o.value;return b.callback=function(){lh||(lh=!0,Kp=k),_p(i,o)},b}function hj(i,o,b){b=Fi(-1,b),b.tag=3;var k=i.type.getDerivedStateFromError;if(typeof k=="function"){var I=o.value;b.payload=function(){return k(I)},b.callback=function(){_p(i,o)}}var H=i.stateNode;return H!==null&&typeof H.componentDidCatch=="function"&&(b.callback=function(){_p(i,o),typeof k!="function"&&(yl===null?yl=new Set([this]):yl.add(this));var ae=o.stack;this.componentDidCatch(o.value,{componentStack:ae!==null?ae:""})}),b}function mj(i,o,b){var k=i.pingCache;if(k===null){k=i.pingCache=new aT;var I=new Set;k.set(o,I)}else I=k.get(o),I===void 0&&(I=new Set,k.set(o,I));I.has(b)||(I.add(b),i=bT.bind(null,i,o,b),o.then(i,i))}function fj(i){do{var o;if((o=i.tag===13)&&(o=i.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return i;i=i.return}while(i!==null);return null}function pj(i,o,b,k,I){return(i.mode&1)===0?(i===o?i.flags|=65536:(i.flags|=128,b.flags|=131072,b.flags&=-52805,b.tag===1&&(b.alternate===null?b.tag=17:(o=Fi(-1,1),o.tag=2,vl(b,o,1))),b.lanes|=1),i):(i.flags|=65536,i.lanes=I,i)}var iT=w.ReactCurrentOwner,Kr=!1;function Ir(i,o,b,k){o.child=i===null?Ly(o,null,b,k):ic(o,i.child,b,k)}function xj(i,o,b,k,I){b=b.render;var H=o.ref;return oc(o,I),k=wp(i,o,b,k,H,I),b=Sp(),i!==null&&!Kr?(o.updateQueue=i.updateQueue,o.flags&=-2053,i.lanes&=~I,Bi(i,o,I)):(Cn&&b&&ip(o),o.flags|=1,Ir(i,o,k,I),o.child)}function gj(i,o,b,k,I){if(i===null){var H=b.type;return typeof H=="function"&&!ex(H)&&H.defaultProps===void 0&&b.compare===null&&b.defaultProps===void 0?(o.tag=15,o.type=H,vj(i,o,H,k,I)):(i=mh(b.type,null,k,o,o.mode,I),i.ref=o.ref,i.return=o,o.child=i)}if(H=i.child,(i.lanes&I)===0){var ae=H.memoizedProps;if(b=b.compare,b=b!==null?b:Qc,b(ae,k)&&i.ref===o.ref)return Bi(i,o,I)}return o.flags|=1,i=Sl(H,k),i.ref=o.ref,i.return=o,o.child=i}function vj(i,o,b,k,I){if(i!==null){var H=i.memoizedProps;if(Qc(H,k)&&i.ref===o.ref)if(Kr=!1,o.pendingProps=k=H,(i.lanes&I)!==0)(i.flags&131072)!==0&&(Kr=!0);else return o.lanes=i.lanes,Bi(i,o,I)}return Pp(i,o,b,k,I)}function bj(i,o,b){var k=o.pendingProps,I=k.children,H=i!==null?i.memoizedState:null;if(k.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},vn(hc,ra),ra|=b;else{if((b&1073741824)===0)return i=H!==null?H.baseLanes|b:b,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:i,cachePool:null,transitions:null},o.updateQueue=null,vn(hc,ra),ra|=i,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},k=H!==null?H.baseLanes:b,vn(hc,ra),ra|=k}else H!==null?(k=H.baseLanes|b,o.memoizedState=null):k=b,vn(hc,ra),ra|=k;return Ir(i,o,I,b),o.child}function yj(i,o){var b=o.ref;(i===null&&b!==null||i!==null&&i.ref!==b)&&(o.flags|=512,o.flags|=2097152)}function Pp(i,o,b,k,I){var H=Wr(b)?ho:Nr.current;return H=sc(o,H),oc(o,I),b=wp(i,o,b,k,H,I),k=Sp(),i!==null&&!Kr?(o.updateQueue=i.updateQueue,o.flags&=-2053,i.lanes&=~I,Bi(i,o,I)):(Cn&&k&&ip(o),o.flags|=1,Ir(i,o,b,I),o.child)}function jj(i,o,b,k,I){if(Wr(b)){var H=!0;Fu(o)}else H=!1;if(oc(o,I),o.stateNode===null)sh(i,o),cj(o,b,k),Dp(o,b,k,I),k=!0;else if(i===null){var ae=o.stateNode,je=o.memoizedProps;ae.props=je;var De=ae.context,Je=b.contextType;typeof Je=="object"&&Je!==null?Je=ya(Je):(Je=Wr(b)?ho:Nr.current,Je=sc(o,Je));var Nt=b.getDerivedStateFromProps,Dt=typeof Nt=="function"||typeof ae.getSnapshotBeforeUpdate=="function";Dt||typeof ae.UNSAFE_componentWillReceiveProps!="function"&&typeof ae.componentWillReceiveProps!="function"||(je!==k||De!==Je)&&dj(o,ae,k,Je),gl=!1;var vt=o.memoizedState;ae.state=vt,Ku(o,k,ae,I),De=o.memoizedState,je!==k||vt!==De||Hr.current||gl?(typeof Nt=="function"&&(Ep(o,b,Nt,k),De=o.memoizedState),(je=gl||oj(o,b,je,k,vt,De,Je))?(Dt||typeof ae.UNSAFE_componentWillMount!="function"&&typeof ae.componentWillMount!="function"||(typeof ae.componentWillMount=="function"&&ae.componentWillMount(),typeof ae.UNSAFE_componentWillMount=="function"&&ae.UNSAFE_componentWillMount()),typeof ae.componentDidMount=="function"&&(o.flags|=4194308)):(typeof ae.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=k,o.memoizedState=De),ae.props=k,ae.state=De,ae.context=Je,k=je):(typeof ae.componentDidMount=="function"&&(o.flags|=4194308),k=!1)}else{ae=o.stateNode,My(i,o),je=o.memoizedProps,Je=o.type===o.elementType?je:$a(o.type,je),ae.props=Je,Dt=o.pendingProps,vt=ae.context,De=b.contextType,typeof De=="object"&&De!==null?De=ya(De):(De=Wr(b)?ho:Nr.current,De=sc(o,De));var Xt=b.getDerivedStateFromProps;(Nt=typeof Xt=="function"||typeof ae.getSnapshotBeforeUpdate=="function")||typeof ae.UNSAFE_componentWillReceiveProps!="function"&&typeof ae.componentWillReceiveProps!="function"||(je!==Dt||vt!==De)&&dj(o,ae,k,De),gl=!1,vt=o.memoizedState,ae.state=vt,Ku(o,k,ae,I);var is=o.memoizedState;je!==Dt||vt!==is||Hr.current||gl?(typeof Xt=="function"&&(Ep(o,b,Xt,k),is=o.memoizedState),(Je=gl||oj(o,b,Je,k,vt,is,De)||!1)?(Nt||typeof ae.UNSAFE_componentWillUpdate!="function"&&typeof ae.componentWillUpdate!="function"||(typeof ae.componentWillUpdate=="function"&&ae.componentWillUpdate(k,is,De),typeof ae.UNSAFE_componentWillUpdate=="function"&&ae.UNSAFE_componentWillUpdate(k,is,De)),typeof ae.componentDidUpdate=="function"&&(o.flags|=4),typeof ae.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof ae.componentDidUpdate!="function"||je===i.memoizedProps&&vt===i.memoizedState||(o.flags|=4),typeof ae.getSnapshotBeforeUpdate!="function"||je===i.memoizedProps&&vt===i.memoizedState||(o.flags|=1024),o.memoizedProps=k,o.memoizedState=is),ae.props=k,ae.state=is,ae.context=De,k=Je):(typeof ae.componentDidUpdate!="function"||je===i.memoizedProps&&vt===i.memoizedState||(o.flags|=4),typeof ae.getSnapshotBeforeUpdate!="function"||je===i.memoizedProps&&vt===i.memoizedState||(o.flags|=1024),k=!1)}return Op(i,o,b,k,H,I)}function Op(i,o,b,k,I,H){yj(i,o);var ae=(o.flags&128)!==0;if(!k&&!ae)return I&&Ay(o,b,!1),Bi(i,o,H);k=o.stateNode,iT.current=o;var je=ae&&typeof b.getDerivedStateFromError!="function"?null:k.render();return o.flags|=1,i!==null&&ae?(o.child=ic(o,i.child,null,H),o.child=ic(o,null,je,H)):Ir(i,o,je,H),o.memoizedState=k.state,I&&Ay(o,b,!0),o.child}function Nj(i){var o=i.stateNode;o.pendingContext?Sy(i,o.pendingContext,o.pendingContext!==o.context):o.context&&Sy(i,o.context,!1),gp(i,o.containerInfo)}function wj(i,o,b,k,I){return ac(),dp(I),o.flags|=256,Ir(i,o,b,k),o.child}var Lp={dehydrated:null,treeContext:null,retryLane:0};function Ip(i){return{baseLanes:i,cachePool:null,transitions:null}}function Sj(i,o,b){var k=o.pendingProps,I=An.current,H=!1,ae=(o.flags&128)!==0,je;if((je=ae)||(je=i!==null&&i.memoizedState===null?!1:(I&2)!==0),je?(H=!0,o.flags&=-129):(i===null||i.memoizedState!==null)&&(I|=1),vn(An,I&1),i===null)return cp(o),i=o.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((o.mode&1)===0?o.lanes=1:i.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(ae=k.children,i=k.fallback,H?(k=o.mode,H=o.child,ae={mode:"hidden",children:ae},(k&1)===0&&H!==null?(H.childLanes=0,H.pendingProps=ae):H=fh(ae,k,0,null),i=No(i,k,b,null),H.return=o,i.return=o,H.sibling=i,o.child=H,o.child.memoizedState=Ip(b),o.memoizedState=Lp,i):Mp(o,ae));if(I=i.memoizedState,I!==null&&(je=I.dehydrated,je!==null))return lT(i,o,ae,k,je,I,b);if(H){H=k.fallback,ae=o.mode,I=i.child,je=I.sibling;var De={mode:"hidden",children:k.children};return(ae&1)===0&&o.child!==I?(k=o.child,k.childLanes=0,k.pendingProps=De,o.deletions=null):(k=Sl(I,De),k.subtreeFlags=I.subtreeFlags&14680064),je!==null?H=Sl(je,H):(H=No(H,ae,b,null),H.flags|=2),H.return=o,k.return=o,k.sibling=H,o.child=k,k=H,H=o.child,ae=i.child.memoizedState,ae=ae===null?Ip(b):{baseLanes:ae.baseLanes|b,cachePool:null,transitions:ae.transitions},H.memoizedState=ae,H.childLanes=i.childLanes&~b,o.memoizedState=Lp,k}return H=i.child,i=H.sibling,k=Sl(H,{mode:"visible",children:k.children}),(o.mode&1)===0&&(k.lanes=b),k.return=o,k.sibling=null,i!==null&&(b=o.deletions,b===null?(o.deletions=[i],o.flags|=16):b.push(i)),o.child=k,o.memoizedState=null,k}function Mp(i,o){return o=fh({mode:"visible",children:o},i.mode,0,null),o.return=i,i.child=o}function th(i,o,b,k){return k!==null&&dp(k),ic(o,i.child,null,b),i=Mp(o,o.pendingProps.children),i.flags|=2,o.memoizedState=null,i}function lT(i,o,b,k,I,H,ae){if(b)return o.flags&256?(o.flags&=-257,k=Tp(Error(n(422))),th(i,o,ae,k)):o.memoizedState!==null?(o.child=i.child,o.flags|=128,null):(H=k.fallback,I=o.mode,k=fh({mode:"visible",children:k.children},I,0,null),H=No(H,I,ae,null),H.flags|=2,k.return=o,H.return=o,k.sibling=H,o.child=k,(o.mode&1)!==0&&ic(o,i.child,null,ae),o.child.memoizedState=Ip(ae),o.memoizedState=Lp,H);if((o.mode&1)===0)return th(i,o,ae,null);if(I.data==="$!"){if(k=I.nextSibling&&I.nextSibling.dataset,k)var je=k.dgst;return k=je,H=Error(n(419)),k=Tp(H,k,void 0),th(i,o,ae,k)}if(je=(ae&i.childLanes)!==0,Kr||je){if(k=lr,k!==null){switch(ae&-ae){case 4:I=2;break;case 16:I=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:I=32;break;case 536870912:I=268435456;break;default:I=0}I=(I&(k.suspendedLanes|ae))!==0?0:I,I!==0&&I!==H.retryLane&&(H.retryLane=I,Mi(i,I),Ua(k,i,I,-1))}return Jp(),k=Tp(Error(n(421))),th(i,o,ae,k)}return I.data==="$?"?(o.flags|=128,o.child=i.child,o=yT.bind(null,i),I._reactRetry=o,null):(i=H.treeContext,na=ml(I.nextSibling),sa=o,Cn=!0,Ba=null,i!==null&&(va[ba++]=Li,va[ba++]=Ii,va[ba++]=mo,Li=i.id,Ii=i.overflow,mo=o),o=Mp(o,k.children),o.flags|=4096,o)}function Cj(i,o,b){i.lanes|=o;var k=i.alternate;k!==null&&(k.lanes|=o),fp(i.return,o,b)}function Fp(i,o,b,k,I){var H=i.memoizedState;H===null?i.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:k,tail:b,tailMode:I}:(H.isBackwards=o,H.rendering=null,H.renderingStartTime=0,H.last=k,H.tail=b,H.tailMode=I)}function Aj(i,o,b){var k=o.pendingProps,I=k.revealOrder,H=k.tail;if(Ir(i,o,k.children,b),k=An.current,(k&2)!==0)k=k&1|2,o.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=o.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Cj(i,b,o);else if(i.tag===19)Cj(i,b,o);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===o)break e;for(;i.sibling===null;){if(i.return===null||i.return===o)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}k&=1}if(vn(An,k),(o.mode&1)===0)o.memoizedState=null;else switch(I){case"forwards":for(b=o.child,I=null;b!==null;)i=b.alternate,i!==null&&Gu(i)===null&&(I=b),b=b.sibling;b=I,b===null?(I=o.child,o.child=null):(I=b.sibling,b.sibling=null),Fp(o,!1,I,b,H);break;case"backwards":for(b=null,I=o.child,o.child=null;I!==null;){if(i=I.alternate,i!==null&&Gu(i)===null){o.child=I;break}i=I.sibling,I.sibling=b,b=I,I=i}Fp(o,!0,b,null,H);break;case"together":Fp(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function sh(i,o){(o.mode&1)===0&&i!==null&&(i.alternate=null,o.alternate=null,o.flags|=2)}function Bi(i,o,b){if(i!==null&&(o.dependencies=i.dependencies),vo|=o.lanes,(b&o.childLanes)===0)return null;if(i!==null&&o.child!==i.child)throw Error(n(153));if(o.child!==null){for(i=o.child,b=Sl(i,i.pendingProps),o.child=b,b.return=o;i.sibling!==null;)i=i.sibling,b=b.sibling=Sl(i,i.pendingProps),b.return=o;b.sibling=null}return o.child}function oT(i,o,b){switch(o.tag){case 3:Nj(o),ac();break;case 5:$y(o);break;case 1:Wr(o.type)&&Fu(o);break;case 4:gp(o,o.stateNode.containerInfo);break;case 10:var k=o.type._context,I=o.memoizedProps.value;vn(Vu,k._currentValue),k._currentValue=I;break;case 13:if(k=o.memoizedState,k!==null)return k.dehydrated!==null?(vn(An,An.current&1),o.flags|=128,null):(b&o.child.childLanes)!==0?Sj(i,o,b):(vn(An,An.current&1),i=Bi(i,o,b),i!==null?i.sibling:null);vn(An,An.current&1);break;case 19:if(k=(b&o.childLanes)!==0,(i.flags&128)!==0){if(k)return Aj(i,o,b);o.flags|=128}if(I=o.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),vn(An,An.current),k)break;return null;case 22:case 23:return o.lanes=0,bj(i,o,b)}return Bi(i,o,b)}var kj,Bp,Rj,Ej;kj=function(i,o){for(var b=o.child;b!==null;){if(b.tag===5||b.tag===6)i.appendChild(b.stateNode);else if(b.tag!==4&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===o)break;for(;b.sibling===null;){if(b.return===null||b.return===o)return;b=b.return}b.sibling.return=b.return,b=b.sibling}},Bp=function(){},Rj=function(i,o,b,k){var I=i.memoizedProps;if(I!==k){i=o.stateNode,xo(ci.current);var H=null;switch(b){case"input":I=We(i,I),k=We(i,k),H=[];break;case"select":I=B({},I,{value:void 0}),k=B({},k,{value:void 0}),H=[];break;case"textarea":I=Ve(i,I),k=Ve(i,k),H=[];break;default:typeof I.onClick!="function"&&typeof k.onClick=="function"&&(i.onclick=Lu)}ns(b,k);var ae;b=null;for(Je in I)if(!k.hasOwnProperty(Je)&&I.hasOwnProperty(Je)&&I[Je]!=null)if(Je==="style"){var je=I[Je];for(ae in je)je.hasOwnProperty(ae)&&(b||(b={}),b[ae]="")}else Je!=="dangerouslySetInnerHTML"&&Je!=="children"&&Je!=="suppressContentEditableWarning"&&Je!=="suppressHydrationWarning"&&Je!=="autoFocus"&&(a.hasOwnProperty(Je)?H||(H=[]):(H=H||[]).push(Je,null));for(Je in k){var De=k[Je];if(je=I!=null?I[Je]:void 0,k.hasOwnProperty(Je)&&De!==je&&(De!=null||je!=null))if(Je==="style")if(je){for(ae in je)!je.hasOwnProperty(ae)||De&&De.hasOwnProperty(ae)||(b||(b={}),b[ae]="");for(ae in De)De.hasOwnProperty(ae)&&je[ae]!==De[ae]&&(b||(b={}),b[ae]=De[ae])}else b||(H||(H=[]),H.push(Je,b)),b=De;else Je==="dangerouslySetInnerHTML"?(De=De?De.__html:void 0,je=je?je.__html:void 0,De!=null&&je!==De&&(H=H||[]).push(Je,De)):Je==="children"?typeof De!="string"&&typeof De!="number"||(H=H||[]).push(Je,""+De):Je!=="suppressContentEditableWarning"&&Je!=="suppressHydrationWarning"&&(a.hasOwnProperty(Je)?(De!=null&&Je==="onScroll"&&bn("scroll",i),H||je===De||(H=[])):(H=H||[]).push(Je,De))}b&&(H=H||[]).push("style",b);var Je=H;(o.updateQueue=Je)&&(o.flags|=4)}},Ej=function(i,o,b,k){b!==k&&(o.flags|=4)};function hd(i,o){if(!Cn)switch(i.tailMode){case"hidden":o=i.tail;for(var b=null;o!==null;)o.alternate!==null&&(b=o),o=o.sibling;b===null?i.tail=null:b.sibling=null;break;case"collapsed":b=i.tail;for(var k=null;b!==null;)b.alternate!==null&&(k=b),b=b.sibling;k===null?o||i.tail===null?i.tail=null:i.tail.sibling=null:k.sibling=null}}function Sr(i){var o=i.alternate!==null&&i.alternate.child===i.child,b=0,k=0;if(o)for(var I=i.child;I!==null;)b|=I.lanes|I.childLanes,k|=I.subtreeFlags&14680064,k|=I.flags&14680064,I.return=i,I=I.sibling;else for(I=i.child;I!==null;)b|=I.lanes|I.childLanes,k|=I.subtreeFlags,k|=I.flags,I.return=i,I=I.sibling;return i.subtreeFlags|=k,i.childLanes=b,o}function cT(i,o,b){var k=o.pendingProps;switch(lp(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Sr(o),null;case 1:return Wr(o.type)&&Mu(),Sr(o),null;case 3:return k=o.stateNode,cc(),yn(Hr),yn(Nr),yp(),k.pendingContext&&(k.context=k.pendingContext,k.pendingContext=null),(i===null||i.child===null)&&(zu(o)?o.flags|=4:i===null||i.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Ba!==null&&(Zp(Ba),Ba=null))),Bp(i,o),Sr(o),null;case 5:vp(o);var I=xo(ld.current);if(b=o.type,i!==null&&o.stateNode!=null)Rj(i,o,b,k,I),i.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!k){if(o.stateNode===null)throw Error(n(166));return Sr(o),null}if(i=xo(ci.current),zu(o)){k=o.stateNode,b=o.type;var H=o.memoizedProps;switch(k[oi]=o,k[sd]=H,i=(o.mode&1)!==0,b){case"dialog":bn("cancel",k),bn("close",k);break;case"iframe":case"object":case"embed":bn("load",k);break;case"video":case"audio":for(I=0;I<\/script>",i=i.removeChild(i.firstChild)):typeof k.is=="string"?i=ae.createElement(b,{is:k.is}):(i=ae.createElement(b),b==="select"&&(ae=i,k.multiple?ae.multiple=!0:k.size&&(ae.size=k.size))):i=ae.createElementNS(i,b),i[oi]=o,i[sd]=k,kj(i,o,!1,!1),o.stateNode=i;e:{switch(ae=Cs(b,k),b){case"dialog":bn("cancel",i),bn("close",i),I=k;break;case"iframe":case"object":case"embed":bn("load",i),I=k;break;case"video":case"audio":for(I=0;Imc&&(o.flags|=128,k=!0,hd(H,!1),o.lanes=4194304)}else{if(!k)if(i=Gu(ae),i!==null){if(o.flags|=128,k=!0,b=i.updateQueue,b!==null&&(o.updateQueue=b,o.flags|=4),hd(H,!0),H.tail===null&&H.tailMode==="hidden"&&!ae.alternate&&!Cn)return Sr(o),null}else 2*as()-H.renderingStartTime>mc&&b!==1073741824&&(o.flags|=128,k=!0,hd(H,!1),o.lanes=4194304);H.isBackwards?(ae.sibling=o.child,o.child=ae):(b=H.last,b!==null?b.sibling=ae:o.child=ae,H.last=ae)}return H.tail!==null?(o=H.tail,H.rendering=o,H.tail=o.sibling,H.renderingStartTime=as(),o.sibling=null,b=An.current,vn(An,k?b&1|2:b&1),o):(Sr(o),null);case 22:case 23:return Xp(),k=o.memoizedState!==null,i!==null&&i.memoizedState!==null!==k&&(o.flags|=8192),k&&(o.mode&1)!==0?(ra&1073741824)!==0&&(Sr(o),o.subtreeFlags&6&&(o.flags|=8192)):Sr(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function dT(i,o){switch(lp(o),o.tag){case 1:return Wr(o.type)&&Mu(),i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 3:return cc(),yn(Hr),yn(Nr),yp(),i=o.flags,(i&65536)!==0&&(i&128)===0?(o.flags=i&-65537|128,o):null;case 5:return vp(o),null;case 13:if(yn(An),i=o.memoizedState,i!==null&&i.dehydrated!==null){if(o.alternate===null)throw Error(n(340));ac()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 19:return yn(An),null;case 4:return cc(),null;case 10:return mp(o.type._context),null;case 22:case 23:return Xp(),null;case 24:return null;default:return null}}var nh=!1,Cr=!1,uT=typeof WeakSet=="function"?WeakSet:Set,ts=null;function uc(i,o){var b=i.ref;if(b!==null)if(typeof b=="function")try{b(null)}catch(k){Tn(i,o,k)}else b.current=null}function $p(i,o,b){try{b()}catch(k){Tn(i,o,k)}}var Dj=!1;function hT(i,o){if(Xf=Pa,i=oy(),Vf(i)){if("selectionStart"in i)var b={start:i.selectionStart,end:i.selectionEnd};else e:{b=(b=i.ownerDocument)&&b.defaultView||window;var k=b.getSelection&&b.getSelection();if(k&&k.rangeCount!==0){b=k.anchorNode;var I=k.anchorOffset,H=k.focusNode;k=k.focusOffset;try{b.nodeType,H.nodeType}catch{b=null;break e}var ae=0,je=-1,De=-1,Je=0,Nt=0,Dt=i,vt=null;t:for(;;){for(var Xt;Dt!==b||I!==0&&Dt.nodeType!==3||(je=ae+I),Dt!==H||k!==0&&Dt.nodeType!==3||(De=ae+k),Dt.nodeType===3&&(ae+=Dt.nodeValue.length),(Xt=Dt.firstChild)!==null;)vt=Dt,Dt=Xt;for(;;){if(Dt===i)break t;if(vt===b&&++Je===I&&(je=ae),vt===H&&++Nt===k&&(De=ae),(Xt=Dt.nextSibling)!==null)break;Dt=vt,vt=Dt.parentNode}Dt=Xt}b=je===-1||De===-1?null:{start:je,end:De}}else b=null}b=b||{start:0,end:0}}else b=null;for(Jf={focusedElem:i,selectionRange:b},Pa=!1,ts=o;ts!==null;)if(o=ts,i=o.child,(o.subtreeFlags&1028)!==0&&i!==null)i.return=o,ts=i;else for(;ts!==null;){o=ts;try{var is=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(is!==null){var cs=is.memoizedProps,In=is.memoizedState,He=o.stateNode,Oe=He.getSnapshotBeforeUpdate(o.elementType===o.type?cs:$a(o.type,cs),In);He.__reactInternalSnapshotBeforeUpdate=Oe}break;case 3:var Ge=o.stateNode.containerInfo;Ge.nodeType===1?Ge.textContent="":Ge.nodeType===9&&Ge.documentElement&&Ge.removeChild(Ge.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Lt){Tn(o,o.return,Lt)}if(i=o.sibling,i!==null){i.return=o.return,ts=i;break}ts=o.return}return is=Dj,Dj=!1,is}function md(i,o,b){var k=o.updateQueue;if(k=k!==null?k.lastEffect:null,k!==null){var I=k=k.next;do{if((I.tag&i)===i){var H=I.destroy;I.destroy=void 0,H!==void 0&&$p(o,b,H)}I=I.next}while(I!==k)}}function rh(i,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var b=o=o.next;do{if((b.tag&i)===i){var k=b.create;b.destroy=k()}b=b.next}while(b!==o)}}function qp(i){var o=i.ref;if(o!==null){var b=i.stateNode;switch(i.tag){case 5:i=b;break;default:i=b}typeof o=="function"?o(i):o.current=i}}function Tj(i){var o=i.alternate;o!==null&&(i.alternate=null,Tj(o)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(o=i.stateNode,o!==null&&(delete o[oi],delete o[sd],delete o[np],delete o[GD],delete o[YD])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function _j(i){return i.tag===5||i.tag===3||i.tag===4}function Pj(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||_j(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function zp(i,o,b){var k=i.tag;if(k===5||k===6)i=i.stateNode,o?b.nodeType===8?b.parentNode.insertBefore(i,o):b.insertBefore(i,o):(b.nodeType===8?(o=b.parentNode,o.insertBefore(i,b)):(o=b,o.appendChild(i)),b=b._reactRootContainer,b!=null||o.onclick!==null||(o.onclick=Lu));else if(k!==4&&(i=i.child,i!==null))for(zp(i,o,b),i=i.sibling;i!==null;)zp(i,o,b),i=i.sibling}function Up(i,o,b){var k=i.tag;if(k===5||k===6)i=i.stateNode,o?b.insertBefore(i,o):b.appendChild(i);else if(k!==4&&(i=i.child,i!==null))for(Up(i,o,b),i=i.sibling;i!==null;)Up(i,o,b),i=i.sibling}var gr=null,qa=!1;function bl(i,o,b){for(b=b.child;b!==null;)Oj(i,o,b),b=b.sibling}function Oj(i,o,b){if(Qs&&typeof Qs.onCommitFiberUnmount=="function")try{Qs.onCommitFiberUnmount(Ws,b)}catch{}switch(b.tag){case 5:Cr||uc(b,o);case 6:var k=gr,I=qa;gr=null,bl(i,o,b),gr=k,qa=I,gr!==null&&(qa?(i=gr,b=b.stateNode,i.nodeType===8?i.parentNode.removeChild(b):i.removeChild(b)):gr.removeChild(b.stateNode));break;case 18:gr!==null&&(qa?(i=gr,b=b.stateNode,i.nodeType===8?sp(i.parentNode,b):i.nodeType===1&&sp(i,b),ri(i)):sp(gr,b.stateNode));break;case 4:k=gr,I=qa,gr=b.stateNode.containerInfo,qa=!0,bl(i,o,b),gr=k,qa=I;break;case 0:case 11:case 14:case 15:if(!Cr&&(k=b.updateQueue,k!==null&&(k=k.lastEffect,k!==null))){I=k=k.next;do{var H=I,ae=H.destroy;H=H.tag,ae!==void 0&&((H&2)!==0||(H&4)!==0)&&$p(b,o,ae),I=I.next}while(I!==k)}bl(i,o,b);break;case 1:if(!Cr&&(uc(b,o),k=b.stateNode,typeof k.componentWillUnmount=="function"))try{k.props=b.memoizedProps,k.state=b.memoizedState,k.componentWillUnmount()}catch(je){Tn(b,o,je)}bl(i,o,b);break;case 21:bl(i,o,b);break;case 22:b.mode&1?(Cr=(k=Cr)||b.memoizedState!==null,bl(i,o,b),Cr=k):bl(i,o,b);break;default:bl(i,o,b)}}function Lj(i){var o=i.updateQueue;if(o!==null){i.updateQueue=null;var b=i.stateNode;b===null&&(b=i.stateNode=new uT),o.forEach(function(k){var I=jT.bind(null,i,k);b.has(k)||(b.add(k),k.then(I,I))})}}function za(i,o){var b=o.deletions;if(b!==null)for(var k=0;kI&&(I=ae),k&=~H}if(k=I,k=as()-k,k=(120>k?120:480>k?480:1080>k?1080:1920>k?1920:3e3>k?3e3:4320>k?4320:1960*fT(k/1960))-k,10i?16:i,jl===null)var k=!1;else{if(i=jl,jl=null,ch=0,(Xs&6)!==0)throw Error(n(331));var I=Xs;for(Xs|=4,ts=i.current;ts!==null;){var H=ts,ae=H.child;if((ts.flags&16)!==0){var je=H.deletions;if(je!==null){for(var De=0;Deas()-Wp?yo(i,0):Hp|=b),Yr(i,o)}function Gj(i,o){o===0&&((i.mode&1)===0?o=1:(o=tr,tr<<=1,(tr&130023424)===0&&(tr=4194304)));var b=Mr();i=Mi(i,o),i!==null&&(jr(i,o,b),Yr(i,b))}function yT(i){var o=i.memoizedState,b=0;o!==null&&(b=o.retryLane),Gj(i,b)}function jT(i,o){var b=0;switch(i.tag){case 13:var k=i.stateNode,I=i.memoizedState;I!==null&&(b=I.retryLane);break;case 19:k=i.stateNode;break;default:throw Error(n(314))}k!==null&&k.delete(o),Gj(i,b)}var Yj;Yj=function(i,o,b){if(i!==null)if(i.memoizedProps!==o.pendingProps||Hr.current)Kr=!0;else{if((i.lanes&b)===0&&(o.flags&128)===0)return Kr=!1,oT(i,o,b);Kr=(i.flags&131072)!==0}else Kr=!1,Cn&&(o.flags&1048576)!==0&&Ry(o,qu,o.index);switch(o.lanes=0,o.tag){case 2:var k=o.type;sh(i,o),i=o.pendingProps;var I=sc(o,Nr.current);oc(o,b),I=wp(null,o,k,i,I,b);var H=Sp();return o.flags|=1,typeof I=="object"&&I!==null&&typeof I.render=="function"&&I.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Wr(k)?(H=!0,Fu(o)):H=!1,o.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,xp(o),I.updater=eh,o.stateNode=I,I._reactInternals=o,Dp(o,k,i,b),o=Op(null,o,k,!0,H,b)):(o.tag=0,Cn&&H&&ip(o),Ir(null,o,I,b),o=o.child),o;case 16:k=o.elementType;e:{switch(sh(i,o),i=o.pendingProps,I=k._init,k=I(k._payload),o.type=k,I=o.tag=wT(k),i=$a(k,i),I){case 0:o=Pp(null,o,k,i,b);break e;case 1:o=jj(null,o,k,i,b);break e;case 11:o=xj(null,o,k,i,b);break e;case 14:o=gj(null,o,k,$a(k.type,i),b);break e}throw Error(n(306,k,""))}return o;case 0:return k=o.type,I=o.pendingProps,I=o.elementType===k?I:$a(k,I),Pp(i,o,k,I,b);case 1:return k=o.type,I=o.pendingProps,I=o.elementType===k?I:$a(k,I),jj(i,o,k,I,b);case 3:e:{if(Nj(o),i===null)throw Error(n(387));k=o.pendingProps,H=o.memoizedState,I=H.element,My(i,o),Ku(o,k,null,b);var ae=o.memoizedState;if(k=ae.element,H.isDehydrated)if(H={element:k,isDehydrated:!1,cache:ae.cache,pendingSuspenseBoundaries:ae.pendingSuspenseBoundaries,transitions:ae.transitions},o.updateQueue.baseState=H,o.memoizedState=H,o.flags&256){I=dc(Error(n(423)),o),o=wj(i,o,k,b,I);break e}else if(k!==I){I=dc(Error(n(424)),o),o=wj(i,o,k,b,I);break e}else for(na=ml(o.stateNode.containerInfo.firstChild),sa=o,Cn=!0,Ba=null,b=Ly(o,null,k,b),o.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(ac(),k===I){o=Bi(i,o,b);break e}Ir(i,o,k,b)}o=o.child}return o;case 5:return $y(o),i===null&&cp(o),k=o.type,I=o.pendingProps,H=i!==null?i.memoizedProps:null,ae=I.children,ep(k,I)?ae=null:H!==null&&ep(k,H)&&(o.flags|=32),yj(i,o),Ir(i,o,ae,b),o.child;case 6:return i===null&&cp(o),null;case 13:return Sj(i,o,b);case 4:return gp(o,o.stateNode.containerInfo),k=o.pendingProps,i===null?o.child=ic(o,null,k,b):Ir(i,o,k,b),o.child;case 11:return k=o.type,I=o.pendingProps,I=o.elementType===k?I:$a(k,I),xj(i,o,k,I,b);case 7:return Ir(i,o,o.pendingProps,b),o.child;case 8:return Ir(i,o,o.pendingProps.children,b),o.child;case 12:return Ir(i,o,o.pendingProps.children,b),o.child;case 10:e:{if(k=o.type._context,I=o.pendingProps,H=o.memoizedProps,ae=I.value,vn(Vu,k._currentValue),k._currentValue=ae,H!==null)if(Fa(H.value,ae)){if(H.children===I.children&&!Hr.current){o=Bi(i,o,b);break e}}else for(H=o.child,H!==null&&(H.return=o);H!==null;){var je=H.dependencies;if(je!==null){ae=H.child;for(var De=je.firstContext;De!==null;){if(De.context===k){if(H.tag===1){De=Fi(-1,b&-b),De.tag=2;var Je=H.updateQueue;if(Je!==null){Je=Je.shared;var Nt=Je.pending;Nt===null?De.next=De:(De.next=Nt.next,Nt.next=De),Je.pending=De}}H.lanes|=b,De=H.alternate,De!==null&&(De.lanes|=b),fp(H.return,b,o),je.lanes|=b;break}De=De.next}}else if(H.tag===10)ae=H.type===o.type?null:H.child;else if(H.tag===18){if(ae=H.return,ae===null)throw Error(n(341));ae.lanes|=b,je=ae.alternate,je!==null&&(je.lanes|=b),fp(ae,b,o),ae=H.sibling}else ae=H.child;if(ae!==null)ae.return=H;else for(ae=H;ae!==null;){if(ae===o){ae=null;break}if(H=ae.sibling,H!==null){H.return=ae.return,ae=H;break}ae=ae.return}H=ae}Ir(i,o,I.children,b),o=o.child}return o;case 9:return I=o.type,k=o.pendingProps.children,oc(o,b),I=ya(I),k=k(I),o.flags|=1,Ir(i,o,k,b),o.child;case 14:return k=o.type,I=$a(k,o.pendingProps),I=$a(k.type,I),gj(i,o,k,I,b);case 15:return vj(i,o,o.type,o.pendingProps,b);case 17:return k=o.type,I=o.pendingProps,I=o.elementType===k?I:$a(k,I),sh(i,o),o.tag=1,Wr(k)?(i=!0,Fu(o)):i=!1,oc(o,b),cj(o,k,I),Dp(o,k,I,b),Op(null,o,k,!0,i,b);case 19:return Aj(i,o,b);case 22:return bj(i,o,b)}throw Error(n(156,o.tag))};function Zj(i,o){return pt(i,o)}function NT(i,o,b,k){this.tag=i,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=k,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wa(i,o,b,k){return new NT(i,o,b,k)}function ex(i){return i=i.prototype,!(!i||!i.isReactComponent)}function wT(i){if(typeof i=="function")return ex(i)?1:0;if(i!=null){if(i=i.$$typeof,i===P)return 11;if(i===K)return 14}return 2}function Sl(i,o){var b=i.alternate;return b===null?(b=wa(i.tag,o,i.key,i.mode),b.elementType=i.elementType,b.type=i.type,b.stateNode=i.stateNode,b.alternate=i,i.alternate=b):(b.pendingProps=o,b.type=i.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=i.flags&14680064,b.childLanes=i.childLanes,b.lanes=i.lanes,b.child=i.child,b.memoizedProps=i.memoizedProps,b.memoizedState=i.memoizedState,b.updateQueue=i.updateQueue,o=i.dependencies,b.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},b.sibling=i.sibling,b.index=i.index,b.ref=i.ref,b}function mh(i,o,b,k,I,H){var ae=2;if(k=i,typeof i=="function")ex(i)&&(ae=1);else if(typeof i=="string")ae=5;else e:switch(i){case C:return No(b.children,I,H,o);case L:ae=8,I|=8;break;case $:return i=wa(12,b,o,I|2),i.elementType=$,i.lanes=H,i;case M:return i=wa(13,b,o,I),i.elementType=M,i.lanes=H,i;case q:return i=wa(19,b,o,I),i.elementType=q,i.lanes=H,i;case W:return fh(b,I,H,o);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case _:ae=10;break e;case R:ae=9;break e;case P:ae=11;break e;case K:ae=14;break e;case Z:ae=16,k=null;break e}throw Error(n(130,i==null?i:typeof i,""))}return o=wa(ae,b,o,I),o.elementType=i,o.type=k,o.lanes=H,o}function No(i,o,b,k){return i=wa(7,i,k,o),i.lanes=b,i}function fh(i,o,b,k){return i=wa(22,i,k,o),i.elementType=W,i.lanes=b,i.stateNode={isHidden:!1},i}function tx(i,o,b){return i=wa(6,i,null,o),i.lanes=b,i}function sx(i,o,b){return o=wa(4,i.children!==null?i.children:[],i.key,o),o.lanes=b,o.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},o}function ST(i,o,b,k,I){this.tag=o,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ln(0),this.expirationTimes=Ln(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ln(0),this.identifierPrefix=k,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function nx(i,o,b,k,I,H,ae,je,De){return i=new ST(i,o,b,je,De),o===1?(o=1,H===!0&&(o|=8)):o=0,H=wa(3,null,null,o),i.current=H,H.stateNode=i,H.memoizedState={element:k,isDehydrated:b,cache:null,transitions:null,pendingSuspenseBoundaries:null},xp(H),i}function CT(i,o,b){var k=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),dx.exports=BT(),dx.exports}var dN;function $T(){if(dN)return jh;dN=1;var t=Pv();return jh.createRoot=t.createRoot,jh.hydrateRoot=t.hydrateRoot,jh}var qT=$T();const zT=Lm(qT);var mx={exports:{}},fx={};/** * @license React * use-sync-external-store-with-selector.production.js * @@ -45,17 +45,17 @@ Error generating stack: `+H.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var oN;function FT(){if(oN)return hx;oN=1;var t=Lc();function s(h,x){return h===x&&(h!==0||1/h===1/x)||h!==h&&x!==x}var n=typeof Object.is=="function"?Object.is:s,r=t.useSyncExternalStore,a=t.useRef,l=t.useEffect,c=t.useMemo,d=t.useDebugValue;return hx.useSyncExternalStoreWithSelector=function(h,x,f,m,p){var u=a(null);if(u.current===null){var j={hasValue:!1,value:null};u.current=j}else j=u.current;u=c(function(){function y(R){if(!N){if(N=!0,S=R,R=m(R),p!==void 0&&j.hasValue){var P=j.value;if(p(P,R))return C=P}return C=R}if(P=C,n(S,R))return P;var A=m(R);return p!==void 0&&p(P,A)?(S=R,P):(S=R,C=A)}var N=!1,S,C,w=f===void 0?null:f;return[function(){return y(x())},w===null?void 0:function(){return y(w())}]},[x,f,m,p]);var g=r(h,u[0],u[1]);return l(function(){j.hasValue=!0,j.value=g},[g]),d(g),g},hx}var cN;function BT(){return cN||(cN=1,ux.exports=FT()),ux.exports}var $T=BT();function qT(t){t()}function zT(){let t=null,s=null;return{clear(){t=null,s=null},notify(){qT(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const a=s={callback:n,next:null,prev:s};return a.prev?a.prev.next=a:t=a,function(){!r||t===null||(r=!1,a.next?a.next.prev=a.prev:s=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}var dN={notify(){},get:()=>[]};function UT(t,s){let n,r=dN,a=0,l=!1;function c(g){f();const y=r.subscribe(g);let N=!1;return()=>{N||(N=!0,y(),m())}}function d(){r.notify()}function h(){j.onStateChange&&j.onStateChange()}function x(){return l}function f(){a++,n||(n=t.subscribe(h),r=zT())}function m(){a--,n&&a===0&&(n(),n=void 0,r.clear(),r=dN)}function p(){l||(l=!0,f())}function u(){l&&(l=!1,m())}const j={addNestedSub:c,notifyNestedSubs:d,handleChangeWrapper:h,isSubscribed:x,trySubscribe:p,tryUnsubscribe:u,getListeners:()=>r};return j}var VT=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",HT=VT(),WT=()=>typeof navigator<"u"&&navigator.product==="ReactNative",GT=WT(),KT=()=>HT||GT?v.useLayoutEffect:v.useEffect,YT=KT(),mx=Symbol.for("react-redux-context"),fx=typeof globalThis<"u"?globalThis:{};function ZT(){if(!v.createContext)return{};const t=fx[mx]??(fx[mx]=new Map);let s=t.get(v.createContext);return s||(s=v.createContext(null),t.set(v.createContext,s)),s}var Ll=ZT();function QT(t){const{children:s,context:n,serverState:r,store:a}=t,l=v.useMemo(()=>{const h=UT(a);return{store:a,subscription:h,getServerState:r?()=>r:void 0}},[a,r]),c=v.useMemo(()=>a.getState(),[a]);YT(()=>{const{subscription:h}=l;return h.onStateChange=h.notifyNestedSubs,h.trySubscribe(),c!==a.getState()&&h.notifyNestedSubs(),()=>{h.tryUnsubscribe(),h.onStateChange=void 0}},[l,c]);const d=n||Ll;return v.createElement(d.Provider,{value:l},s)}var XT=QT;function Tv(t=Ll){return function(){return v.useContext(t)}}var mC=Tv();function fC(t=Ll){const s=t===Ll?mC:Tv(t),n=()=>{const{store:r}=s();return r};return Object.assign(n,{withTypes:()=>n}),n}var JT=fC();function eP(t=Ll){const s=t===Ll?JT:fC(t),n=()=>s().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var su=eP(),tP=(t,s)=>t===s;function sP(t=Ll){const s=t===Ll?mC:Tv(t),n=(r,a={})=>{const{equalityFn:l=tP}=typeof a=="function"?{equalityFn:a}:a,c=s(),{store:d,subscription:h,getServerState:x}=c;v.useRef(!0);const f=v.useCallback({[r.name](p){return r(p)}}[r.name],[r]),m=$T.useSyncExternalStoreWithSelector(h.addNestedSub,d.getState,x||d.getState,f,l);return v.useDebugValue(m),m};return Object.assign(n,{withTypes:()=>n}),n}var Nn=sP();function br(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var nP=typeof Symbol=="function"&&Symbol.observable||"@@observable",uN=nP,px=()=>Math.random().toString(36).substring(7).split("").join("."),rP={INIT:`@@redux/INIT${px()}`,REPLACE:`@@redux/REPLACE${px()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${px()}`},om=rP;function Pv(t){if(typeof t!="object"||t===null)return!1;let s=t;for(;Object.getPrototypeOf(s)!==null;)s=Object.getPrototypeOf(s);return Object.getPrototypeOf(t)===s||Object.getPrototypeOf(t)===null}function pC(t,s,n){if(typeof t!="function")throw new Error(br(2));if(typeof s=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(br(0));if(typeof s=="function"&&typeof n>"u"&&(n=s,s=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(br(1));return n(pC)(t,s)}let r=t,a=s,l=new Map,c=l,d=0,h=!1;function x(){c===l&&(c=new Map,l.forEach((y,N)=>{c.set(N,y)}))}function f(){if(h)throw new Error(br(3));return a}function m(y){if(typeof y!="function")throw new Error(br(4));if(h)throw new Error(br(5));let N=!0;x();const S=d++;return c.set(S,y),function(){if(N){if(h)throw new Error(br(6));N=!1,x(),c.delete(S),l=null}}}function p(y){if(!Pv(y))throw new Error(br(7));if(typeof y.type>"u")throw new Error(br(8));if(typeof y.type!="string")throw new Error(br(17));if(h)throw new Error(br(9));try{h=!0,a=r(a,y)}finally{h=!1}return(l=c).forEach(S=>{S()}),y}function u(y){if(typeof y!="function")throw new Error(br(10));r=y,p({type:om.REPLACE})}function j(){const y=m;return{subscribe(N){if(typeof N!="object"||N===null)throw new Error(br(11));function S(){const w=N;w.next&&w.next(f())}return S(),{unsubscribe:y(S)}},[uN](){return this}}}return p({type:om.INIT}),{dispatch:p,subscribe:m,getState:f,replaceReducer:u,[uN]:j}}function aP(t){Object.keys(t).forEach(s=>{const n=t[s];if(typeof n(void 0,{type:om.INIT})>"u")throw new Error(br(12));if(typeof n(void 0,{type:om.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(br(13))})}function iP(t){const s=Object.keys(t),n={};for(let l=0;l"u")throw d&&d.type,new Error(br(14));x[m]=j,h=h||j!==u}return h=h||r.length!==Object.keys(c).length,h?x:c}}function cm(...t){return t.length===0?s=>s:t.length===1?t[0]:t.reduce((s,n)=>(...r)=>s(n(...r)))}function lP(...t){return s=>(n,r)=>{const a=s(n,r);let l=()=>{throw new Error(br(15))};const c={getState:a.getState,dispatch:(h,...x)=>l(h,...x)},d=t.map(h=>h(c));return l=cm(...d)(a.dispatch),{...a,dispatch:l}}}function oP(t){return Pv(t)&&"type"in t&&typeof t.type=="string"}var xC=Symbol.for("immer-nothing"),hN=Symbol.for("immer-draftable"),Fr=Symbol.for("immer-state");function Ka(t,...s){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var ca=Object,Rc=ca.getPrototypeOf,dm="constructor",Im="prototype",F0="configurable",um="enumerable",Wh="writable",Vd="value",Zi=t=>!!t&&!!t[Fr];function Qa(t){var s;return t?gC(t)||Mm(t)||!!t[hN]||!!((s=t[dm])!=null&&s[hN])||Fm(t)||Bm(t):!1}var cP=ca[Im][dm].toString(),mN=new WeakMap;function gC(t){if(!t||!_v(t))return!1;const s=Rc(t);if(s===null||s===ca[Im])return!0;const n=ca.hasOwnProperty.call(s,dm)&&s[dm];if(n===Object)return!0;if(!yc(n))return!1;let r=mN.get(n);return r===void 0&&(r=Function.toString.call(n),mN.set(n,r)),r===cP}function Lm(t,s,n=!0){nu(t)===0?(n?Reflect.ownKeys(t):ca.keys(t)).forEach(a=>{s(a,t[a],t)}):t.forEach((r,a)=>s(a,r,t))}function nu(t){const s=t[Fr];return s?s.type_:Mm(t)?1:Fm(t)?2:Bm(t)?3:0}var fN=(t,s,n=nu(t))=>n===2?t.has(s):ca[Im].hasOwnProperty.call(t,s),B0=(t,s,n=nu(t))=>n===2?t.get(s):t[s],hm=(t,s,n,r=nu(t))=>{r===2?t.set(s,n):r===3?t.add(n):t[s]=n};function dP(t,s){return t===s?t!==0||1/t===1/s:t!==t&&s!==s}var Mm=Array.isArray,Fm=t=>t instanceof Map,Bm=t=>t instanceof Set,_v=t=>typeof t=="object",yc=t=>typeof t=="function",xx=t=>typeof t=="boolean";function uP(t){const s=+t;return Number.isInteger(s)&&String(s)===t}var Vi=t=>t.copy_||t.base_,Ov=t=>t.modified_?t.copy_:t.base_;function $0(t,s){if(Fm(t))return new Map(t);if(Bm(t))return new Set(t);if(Mm(t))return Array[Im].slice.call(t);const n=gC(t);if(s===!0||s==="class_only"&&!n){const r=ca.getOwnPropertyDescriptors(t);delete r[Fr];let a=Reflect.ownKeys(r);for(let l=0;l1&&ca.defineProperties(t,{set:Nh,add:Nh,clear:Nh,delete:Nh}),ca.freeze(t),s&&Lm(t,(n,r)=>{Iv(r,!0)},!1)),t}function hP(){Ka(2)}var Nh={[Vd]:hP};function $m(t){return t===null||!_v(t)?!0:ca.isFrozen(t)}var mm="MapSet",q0="Patches",pN="ArrayMethods",vC={};function Lo(t){const s=vC[t];return s||Ka(0,t),s}var xN=t=>!!vC[t],Hd,bC=()=>Hd,mP=(t,s)=>({drafts_:[],parent_:t,immer_:s,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:xN(mm)?Lo(mm):void 0,arrayMethodsPlugin_:xN(pN)?Lo(pN):void 0});function gN(t,s){s&&(t.patchPlugin_=Lo(q0),t.patches_=[],t.inversePatches_=[],t.patchListener_=s)}function z0(t){U0(t),t.drafts_.forEach(fP),t.drafts_=null}function U0(t){t===Hd&&(Hd=t.parent_)}var vN=t=>Hd=mP(Hd,t);function fP(t){const s=t[Fr];s.type_===0||s.type_===1?s.revoke_():s.revoked_=!0}function bN(t,s){s.unfinalizedDrafts_=s.drafts_.length;const n=s.drafts_[0];if(t!==void 0&&t!==n){n[Fr].modified_&&(z0(s),Ka(4)),Qa(t)&&(t=yN(s,t));const{patchPlugin_:a}=s;a&&a.generateReplacementPatches_(n[Fr].base_,t,s)}else t=yN(s,n);return pP(s,t,!0),z0(s),s.patches_&&s.patchListener_(s.patches_,s.inversePatches_),t!==xC?t:void 0}function yN(t,s){if($m(s))return s;const n=s[Fr];if(!n)return fm(s,t.handledSet_,t);if(!qm(n,t))return s;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(t);NC(n,t)}return n.copy_}function pP(t,s,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Iv(s,n)}function yC(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var qm=(t,s)=>t.scope_===s,xP=[];function jC(t,s,n,r){const a=Vi(t),l=t.type_;if(r!==void 0&&B0(a,r,l)===s){hm(a,r,n,l);return}if(!t.draftLocations_){const d=t.draftLocations_=new Map;Lm(a,(h,x)=>{if(Zi(x)){const f=d.get(x)||[];f.push(h),d.set(x,f)}})}const c=t.draftLocations_.get(s)??xP;for(const d of c)hm(a,d,n,l)}function gP(t,s,n){t.callbacks_.push(function(a){var d;const l=s;if(!l||!qm(l,a))return;(d=a.mapSetPlugin_)==null||d.fixSetContents(l);const c=Ov(l);jC(t,l.draft_??l,c,n),NC(l,a)})}function NC(t,s){var r;if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(((r=t.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:a}=s;if(a){const l=a.getPath(t);l&&a.generatePatches_(t,l,s)}yC(t)}}function vP(t,s,n){const{scope_:r}=t;if(Zi(n)){const a=n[Fr];qm(a,r)&&a.callbacks_.push(function(){Gh(t);const c=Ov(a);jC(t,n,c,s)})}else Qa(n)&&t.callbacks_.push(function(){const l=Vi(t);t.type_===3?l.has(n)&&fm(n,r.handledSet_,r):B0(l,s,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(s)??!1)===!0&&t.copy_&&fm(B0(t.copy_,s,t.type_),r.handledSet_,r)})}function fm(t,s,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Zi(t)||s.has(t)||!Qa(t)||$m(t)||(s.add(t),Lm(t,(r,a)=>{if(Zi(a)){const l=a[Fr];if(qm(l,n)){const c=Ov(l);hm(t,r,c,t.type_),yC(l)}}else Qa(a)&&fm(a,s,n)})),t}function bP(t,s){const n=Mm(t),r={type_:n?1:0,scope_:s?s.scope_:bC(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:s,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let a=r,l=pm;n&&(a=[r],l=Wd);const{revoke:c,proxy:d}=Proxy.revocable(a,l);return r.draft_=d,r.revoke_=c,[d,r]}var pm={get(t,s){if(s===Fr)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof s=="string";if(r&&n!=null&&n.isArrayOperationMethod(s))return n.createMethodInterceptor(t,s);const a=Vi(t);if(!fN(a,s,t.type_))return yP(t,a,s);const l=a[s];if(t.finalized_||!Qa(l)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&uP(s))return l;if(l===gx(t.base_,s)){Gh(t);const c=t.type_===1?+s:s,d=H0(t.scope_,l,t,c);return t.copy_[c]=d}return l},has(t,s){return s in Vi(t)},ownKeys(t){return Reflect.ownKeys(Vi(t))},set(t,s,n){const r=wC(Vi(t),s);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const a=gx(Vi(t),s),l=a==null?void 0:a[Fr];if(l&&l.base_===n)return t.copy_[s]=n,t.assigned_.set(s,!1),!0;if(dP(n,a)&&(n!==void 0||fN(t.base_,s,t.type_)))return!0;Gh(t),V0(t)}return t.copy_[s]===n&&(n!==void 0||s in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[s])||(t.copy_[s]=n,t.assigned_.set(s,!0),vP(t,s,n)),!0},deleteProperty(t,s){return Gh(t),gx(t.base_,s)!==void 0||s in t.base_?(t.assigned_.set(s,!1),V0(t)):t.assigned_.delete(s),t.copy_&&delete t.copy_[s],!0},getOwnPropertyDescriptor(t,s){const n=Vi(t),r=Reflect.getOwnPropertyDescriptor(n,s);return r&&{[Wh]:!0,[F0]:t.type_!==1||s!=="length",[um]:r[um],[Vd]:n[s]}},defineProperty(){Ka(11)},getPrototypeOf(t){return Rc(t.base_)},setPrototypeOf(){Ka(12)}},Wd={};for(let t in pm){let s=pm[t];Wd[t]=function(){const n=arguments;return n[0]=n[0][0],s.apply(this,n)}}Wd.deleteProperty=function(t,s){return Wd.set.call(this,t,s,void 0)};Wd.set=function(t,s,n){return pm.set.call(this,t[0],s,n,t[0])};function gx(t,s){const n=t[Fr];return(n?Vi(n):t)[s]}function yP(t,s,n){var a;const r=wC(s,n);return r?Vd in r?r[Vd]:(a=r.get)==null?void 0:a.call(t.draft_):void 0}function wC(t,s){if(!(s in t))return;let n=Rc(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,s);if(r)return r;n=Rc(n)}}function V0(t){t.modified_||(t.modified_=!0,t.parent_&&V0(t.parent_))}function Gh(t){t.copy_||(t.assigned_=new Map,t.copy_=$0(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var jP=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(s,n,r)=>{if(yc(s)&&!yc(n)){const l=n;n=s;const c=this;return function(h=l,...x){return c.produce(h,f=>n.call(this,f,...x))}}yc(n)||Ka(6),r!==void 0&&!yc(r)&&Ka(7);let a;if(Qa(s)){const l=vN(this),c=H0(l,s,void 0);let d=!0;try{a=n(c),d=!1}finally{d?z0(l):U0(l)}return gN(l,r),bN(a,l)}else if(!s||!_v(s)){if(a=n(s),a===void 0&&(a=s),a===xC&&(a=void 0),this.autoFreeze_&&Iv(a,!0),r){const l=[],c=[];Lo(q0).generateReplacementPatches_(s,a,{patches_:l,inversePatches_:c}),r(l,c)}return a}else Ka(1,s)},this.produceWithPatches=(s,n)=>{if(yc(s))return(c,...d)=>this.produceWithPatches(c,h=>s(h,...d));let r,a;return[this.produce(s,n,(c,d)=>{r=c,a=d}),r,a]},xx(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),xx(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),xx(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Qa(t)||Ka(8),Zi(t)&&(t=NP(t));const s=vN(this),n=H0(s,t,void 0);return n[Fr].isManual_=!0,U0(s),n}finishDraft(t,s){const n=t&&t[Fr];(!n||!n.isManual_)&&Ka(9);const{scope_:r}=n;return gN(r,s),bN(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,s){let n;for(n=s.length-1;n>=0;n--){const a=s[n];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}n>-1&&(s=s.slice(n+1));const r=Lo(q0).applyPatches_;return Zi(t)?r(t,s):this.produce(t,a=>r(a,s))}};function H0(t,s,n,r){const[a,l]=Fm(s)?Lo(mm).proxyMap_(s,n):Bm(s)?Lo(mm).proxySet_(s,n):bP(s,n);return((n==null?void 0:n.scope_)??bC()).drafts_.push(a),l.callbacks_=(n==null?void 0:n.callbacks_)??[],l.key_=r,n&&r!==void 0?gP(n,l,r):l.callbacks_.push(function(h){var f;(f=h.mapSetPlugin_)==null||f.fixSetContents(l);const{patchPlugin_:x}=h;l.modified_&&x&&x.generatePatches_(l,[],h)}),a}function NP(t){return Zi(t)||Ka(10,t),SC(t)}function SC(t){if(!Qa(t)||$m(t))return t;const s=t[Fr];let n,r=!0;if(s){if(!s.modified_)return s.base_;s.finalized_=!0,n=$0(t,s.scope_.immer_.useStrictShallowCopy_),r=s.scope_.immer_.shouldUseStrictIteration()}else n=$0(t,!0);return Lm(n,(a,l)=>{hm(n,a,SC(l))},r),s&&(s.finalized_=!1),n}var wP=new jP,CC=wP.produce;function AC(t){return({dispatch:n,getState:r})=>a=>l=>typeof l=="function"?l(n,r,t):a(l)}var SP=AC(),CP=AC,AP=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?cm:cm.apply(null,arguments)},kP=t=>t&&typeof t.match=="function";function Bd(t,s){function n(...r){if(s){let a=s(...r);if(!a)throw new Error(Gi(0));return{type:t,payload:a.payload,..."meta"in a&&{meta:a.meta},..."error"in a&&{error:a.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>oP(r)&&r.type===t,n}var kC=class Td extends Array{constructor(...s){super(...s),Object.setPrototypeOf(this,Td.prototype)}static get[Symbol.species](){return Td}concat(...s){return super.concat.apply(this,s)}prepend(...s){return s.length===1&&Array.isArray(s[0])?new Td(...s[0].concat(this)):new Td(...s.concat(this))}};function jN(t){return Qa(t)?CC(t,()=>{}):t}function wh(t,s,n){return t.has(s)?t.get(s):t.set(s,n(s)).get(s)}function RP(t){return typeof t=="boolean"}var EP=()=>function(s){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:a=!0,actionCreatorCheck:l=!0}=s??{};let c=new kC;return n&&(RP(n)?c.push(SP):c.push(CP(n.extraArgument))),c},DP="RTK_autoBatch",NN=t=>s=>{setTimeout(s,t)},TP=(t={type:"raf"})=>s=>(...n)=>{const r=s(...n);let a=!0,l=!1,c=!1;const d=new Set,h=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:NN(10):t.type==="callback"?t.queueNotification:NN(t.timeout),x=()=>{c=!1,l&&(l=!1,d.forEach(f=>f()))};return Object.assign({},r,{subscribe(f){const m=()=>a&&f(),p=r.subscribe(m);return d.add(f),()=>{p(),d.delete(f)}},dispatch(f){var m;try{return a=!((m=f==null?void 0:f.meta)!=null&&m[DP]),l=!a,l&&(c||(c=!0,h(x))),r.dispatch(f)}finally{a=!0}}})},PP=t=>function(n){const{autoBatch:r=!0}=n??{};let a=new kC(t);return r&&a.push(TP(typeof r=="object"?r:void 0)),a};function _P(t){const s=EP(),{reducer:n=void 0,middleware:r,devTools:a=!0,preloadedState:l=void 0,enhancers:c=void 0}=t||{};let d;if(typeof n=="function")d=n;else if(Pv(n))d=iP(n);else throw new Error(Gi(1));let h;typeof r=="function"?h=r(s):h=s();let x=cm;a&&(x=AP({trace:!1,...typeof a=="object"&&a}));const f=lP(...h),m=PP(f);let p=typeof c=="function"?c(m):m();const u=x(...p);return pC(d,l,u)}function RC(t){const s={},n=[];let r;const a={addCase(l,c){const d=typeof l=="string"?l:l.type;if(!d)throw new Error(Gi(28));if(d in s)throw new Error(Gi(29));return s[d]=c,a},addAsyncThunk(l,c){return c.pending&&(s[l.pending.type]=c.pending),c.rejected&&(s[l.rejected.type]=c.rejected),c.fulfilled&&(s[l.fulfilled.type]=c.fulfilled),c.settled&&n.push({matcher:l.settled,reducer:c.settled}),a},addMatcher(l,c){return n.push({matcher:l,reducer:c}),a},addDefaultCase(l){return r=l,a}};return t(a),[s,n,r]}function OP(t){return typeof t=="function"}function IP(t,s){let[n,r,a]=RC(s),l;if(OP(t))l=()=>jN(t());else{const d=jN(t);l=()=>d}function c(d=l(),h){let x=[n[h.type],...r.filter(({matcher:f})=>f(h)).map(({reducer:f})=>f)];return x.filter(f=>!!f).length===0&&(x=[a]),x.reduce((f,m)=>{if(m)if(Zi(f)){const u=m(f,h);return u===void 0?f:u}else{if(Qa(f))return CC(f,p=>m(p,h));{const p=m(f,h);if(p===void 0){if(f===null)return f;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return f},d)}return c.getInitialState=l,c}var LP=(t,s)=>kP(t)?t.match(s):t(s);function MP(...t){return s=>t.some(n=>LP(n,s))}var FP="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",BP=(t=21)=>{let s="",n=t;for(;n--;)s+=FP[Math.random()*64|0];return s},$P=["name","message","stack","code"],vx=class{constructor(t,s){ax(this,"_type");this.payload=t,this.meta=s}},wN=class{constructor(t,s){ax(this,"_type");this.payload=t,this.meta=s}},qP=t=>{if(typeof t=="object"&&t!==null){const s={};for(const n of $P)typeof t[n]=="string"&&(s[n]=t[n]);return s}return{message:String(t)}},SN="External signal was aborted",zP=(()=>{function t(s,n,r){const a=Bd(s+"/fulfilled",(h,x,f,m)=>({payload:h,meta:{...m||{},arg:f,requestId:x,requestStatus:"fulfilled"}})),l=Bd(s+"/pending",(h,x,f)=>({payload:void 0,meta:{...f||{},arg:x,requestId:h,requestStatus:"pending"}})),c=Bd(s+"/rejected",(h,x,f,m,p)=>({payload:m,error:(r&&r.serializeError||qP)(h||"Rejected"),meta:{...p||{},arg:f,requestId:x,rejectedWithValue:!!m,requestStatus:"rejected",aborted:(h==null?void 0:h.name)==="AbortError",condition:(h==null?void 0:h.name)==="ConditionError"}}));function d(h,{signal:x}={}){return(f,m,p)=>{const u=r!=null&&r.idGenerator?r.idGenerator(h):BP(),j=new AbortController;let g,y;function N(C){y=C,j.abort()}x&&(x.aborted?N(SN):x.addEventListener("abort",()=>N(SN),{once:!0}));const S=(async function(){var R,P;let C;try{let A=(R=r==null?void 0:r.condition)==null?void 0:R.call(r,h,{getState:m,extra:p});if(VP(A)&&(A=await A),A===!1||j.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const I=new Promise(($,T)=>{g=()=>{T({name:"AbortError",message:y||"Aborted"})},j.signal.addEventListener("abort",g,{once:!0})});f(l(u,h,(P=r==null?void 0:r.getPendingMeta)==null?void 0:P.call(r,{requestId:u,arg:h},{getState:m,extra:p}))),C=await Promise.race([I,Promise.resolve(n(h,{dispatch:f,getState:m,extra:p,requestId:u,signal:j.signal,abort:N,rejectWithValue:($,T)=>new vx($,T),fulfillWithValue:($,T)=>new wN($,T)})).then($=>{if($ instanceof vx)throw $;return $ instanceof wN?a($.payload,u,h,$.meta):a($,u,h)})])}catch(A){C=A instanceof vx?c(null,u,h,A.payload,A.meta):c(A,u,h)}finally{g&&j.signal.removeEventListener("abort",g)}return r&&!r.dispatchConditionRejection&&c.match(C)&&C.meta.condition||f(C),C})();return Object.assign(S,{abort:N,requestId:u,arg:h,unwrap(){return S.then(UP)}})}}return Object.assign(d,{pending:l,rejected:c,fulfilled:a,settled:MP(c,a),typePrefix:s})}return t.withTypes=()=>t,t})();function UP(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}function VP(t){return t!==null&&typeof t=="object"&&typeof t.then=="function"}var HP=Symbol.for("rtk-slice-createasyncthunk");function WP(t,s){return`${t}/${s}`}function GP({creators:t}={}){var n;const s=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[HP];return function(a){const{name:l,reducerPath:c=l}=a;if(!l)throw new Error(Gi(11));const d=(typeof a.reducers=="function"?a.reducers(YP()):a.reducers)||{},h=Object.keys(d),x={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},f={addCase(w,R){const P=typeof w=="string"?w:w.type;if(!P)throw new Error(Gi(12));if(P in x.sliceCaseReducersByType)throw new Error(Gi(13));return x.sliceCaseReducersByType[P]=R,f},addMatcher(w,R){return x.sliceMatchers.push({matcher:w,reducer:R}),f},exposeAction(w,R){return x.actionCreators[w]=R,f},exposeCaseReducer(w,R){return x.sliceCaseReducersByName[w]=R,f}};h.forEach(w=>{const R=d[w],P={reducerName:w,type:WP(l,w),createNotation:typeof a.reducers=="function"};QP(R)?JP(P,R,f,s):ZP(P,R,f)});function m(){const[w={},R=[],P=void 0]=typeof a.extraReducers=="function"?RC(a.extraReducers):[a.extraReducers],A={...w,...x.sliceCaseReducersByType};return IP(a.initialState,I=>{for(let $ in A)I.addCase($,A[$]);for(let $ of x.sliceMatchers)I.addMatcher($.matcher,$.reducer);for(let $ of R)I.addMatcher($.matcher,$.reducer);P&&I.addDefaultCase(P)})}const p=w=>w,u=new Map,j=new WeakMap;let g;function y(w,R){return g||(g=m()),g(w,R)}function N(){return g||(g=m()),g.getInitialState()}function S(w,R=!1){function P(I){let $=I[w];return typeof $>"u"&&R&&($=wh(j,P,N)),$}function A(I=p){const $=wh(u,R,()=>new WeakMap);return wh($,I,()=>{const T={};for(const[E,_]of Object.entries(a.selectors??{}))T[E]=KP(_,I,()=>wh(j,I,N),R);return T})}return{reducerPath:w,getSelectors:A,get selectors(){return A(P)},selectSlice:P}}const C={name:l,reducer:y,actions:x.actionCreators,caseReducers:x.sliceCaseReducersByName,getInitialState:N,...S(c),injectInto(w,{reducerPath:R,...P}={}){const A=R??c;return w.inject({reducerPath:A,reducer:y},P),{...C,...S(A,!0)}}};return C}}function KP(t,s,n,r){function a(l,...c){let d=s(l);return typeof d>"u"&&r&&(d=n()),t(d,...c)}return a.unwrapped=t,a}var EC=GP();function YP(){function t(s,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:s,...n}}return t.withTypes=()=>t,{reducer(s){return Object.assign({[s.name](...n){return s(...n)}}[s.name],{_reducerDefinitionType:"reducer"})},preparedReducer(s,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:s,reducer:n}},asyncThunk:t}}function ZP({type:t,reducerName:s,createNotation:n},r,a){let l,c;if("reducer"in r){if(n&&!XP(r))throw new Error(Gi(17));l=r.reducer,c=r.prepare}else l=r;a.addCase(t,l).exposeCaseReducer(s,l).exposeAction(s,c?Bd(t,c):Bd(t))}function QP(t){return t._reducerDefinitionType==="asyncThunk"}function XP(t){return t._reducerDefinitionType==="reducerWithPrepare"}function JP({type:t,reducerName:s},n,r,a){if(!a)throw new Error(Gi(18));const{payloadCreator:l,fulfilled:c,pending:d,rejected:h,settled:x,options:f}=n,m=a(t,l,f);r.exposeAction(s,m),c&&r.addCase(m.fulfilled,c),d&&r.addCase(m.pending,d),h&&r.addCase(m.rejected,h),x&&r.addMatcher(m.settled,x),r.exposeCaseReducer(s,{fulfilled:c||Sh,pending:d||Sh,rejected:h||Sh,settled:x||Sh})}function Sh(){}function Gi(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var cr={};/*! Axios v1.13.6 Copyright (c) 2026 Matt Zabriskie and contributors */var bx,CN;function e_(){if(CN)return bx;CN=1;function t(J,te){return function(){return J.apply(te,arguments)}}const{toString:s}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:r,toStringTag:a}=Symbol,l=(J=>te=>{const ue=s.call(te);return J[ue]||(J[ue]=ue.slice(8,-1).toLowerCase())})(Object.create(null)),c=J=>(J=J.toLowerCase(),te=>l(te)===J),d=J=>te=>typeof te===J,{isArray:h}=Array,x=d("undefined");function f(J){return J!==null&&!x(J)&&J.constructor!==null&&!x(J.constructor)&&j(J.constructor.isBuffer)&&J.constructor.isBuffer(J)}const m=c("ArrayBuffer");function p(J){let te;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?te=ArrayBuffer.isView(J):te=J&&J.buffer&&m(J.buffer),te}const u=d("string"),j=d("function"),g=d("number"),y=J=>J!==null&&typeof J=="object",N=J=>J===!0||J===!1,S=J=>{if(l(J)!=="object")return!1;const te=n(J);return(te===null||te===Object.prototype||Object.getPrototypeOf(te)===null)&&!(a in J)&&!(r in J)},C=J=>{if(!y(J)||f(J))return!1;try{return Object.keys(J).length===0&&Object.getPrototypeOf(J)===Object.prototype}catch{return!1}},w=c("Date"),R=c("File"),P=J=>!!(J&&typeof J.uri<"u"),A=J=>J&&typeof J.getParts<"u",I=c("Blob"),$=c("FileList"),T=J=>y(J)&&j(J.pipe);function E(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof Eo<"u"?Eo:{}}const _=E(),M=typeof _.FormData<"u"?_.FormData:void 0,q=J=>{let te;return J&&(M&&J instanceof M||j(J.append)&&((te=l(J))==="formdata"||te==="object"&&j(J.toString)&&J.toString()==="[object FormData]"))},G=c("URLSearchParams"),[Z,W,z,F]=["ReadableStream","Request","Response","Headers"].map(c),B=J=>J.trim?J.trim():J.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function D(J,te,{allOwnKeys:ue=!1}={}){if(J===null||typeof J>"u")return;let xe,we;if(typeof J!="object"&&(J=[J]),h(J))for(xe=0,we=J.length;xe0;)if(we=ue[xe],te===we.toLowerCase())return we;return null}const V=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Eo,K=J=>!x(J)&&J!==V;function Y(){const{caseless:J,skipUndefined:te}=K(this)&&this||{},ue={},xe=(we,$e)=>{if($e==="__proto__"||$e==="constructor"||$e==="prototype")return;const Be=J&&O(ue,$e)||$e;S(ue[Be])&&S(we)?ue[Be]=Y(ue[Be],we):S(we)?ue[Be]=Y({},we):h(we)?ue[Be]=we.slice():(!te||!x(we))&&(ue[Be]=we)};for(let we=0,$e=arguments.length;we<$e;we++)arguments[we]&&D(arguments[we],xe);return ue}const U=(J,te,ue,{allOwnKeys:xe}={})=>(D(te,(we,$e)=>{ue&&j(we)?Object.defineProperty(J,$e,{value:t(we,ue),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(J,$e,{value:we,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:xe}),J),X=J=>(J.charCodeAt(0)===65279&&(J=J.slice(1)),J),ne=(J,te,ue,xe)=>{J.prototype=Object.create(te.prototype,xe),Object.defineProperty(J.prototype,"constructor",{value:J,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(J,"super",{value:te.prototype}),ue&&Object.assign(J.prototype,ue)},oe=(J,te,ue,xe)=>{let we,$e,Be;const lt={};if(te=te||{},J==null)return te;do{for(we=Object.getOwnPropertyNames(J),$e=we.length;$e-- >0;)Be=we[$e],(!xe||xe(Be,J,te))&&!lt[Be]&&(te[Be]=J[Be],lt[Be]=!0);J=ue!==!1&&n(J)}while(J&&(!ue||ue(J,te))&&J!==Object.prototype);return te},re=(J,te,ue)=>{J=String(J),(ue===void 0||ue>J.length)&&(ue=J.length),ue-=te.length;const xe=J.indexOf(te,ue);return xe!==-1&&xe===ue},ge=J=>{if(!J)return null;if(h(J))return J;let te=J.length;if(!g(te))return null;const ue=new Array(te);for(;te-- >0;)ue[te]=J[te];return ue},ve=(J=>te=>J&&te instanceof J)(typeof Uint8Array<"u"&&n(Uint8Array)),Se=(J,te)=>{const xe=(J&&J[r]).call(J);let we;for(;(we=xe.next())&&!we.done;){const $e=we.value;te.call(J,$e[0],$e[1])}},We=(J,te)=>{let ue;const xe=[];for(;(ue=J.exec(te))!==null;)xe.push(ue);return xe},Ce=c("HTMLFormElement"),fe=J=>J.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(ue,xe,we){return xe.toUpperCase()+we}),Ye=(({hasOwnProperty:J})=>(te,ue)=>J.call(te,ue))(Object.prototype),be=c("RegExp"),_e=(J,te)=>{const ue=Object.getOwnPropertyDescriptors(J),xe={};D(ue,(we,$e)=>{let Be;(Be=te(we,$e,J))!==!1&&(xe[$e]=Be||we)}),Object.defineProperties(J,xe)},ke=J=>{_e(J,(te,ue)=>{if(j(J)&&["arguments","caller","callee"].indexOf(ue)!==-1)return!1;const xe=J[ue];if(j(xe)){if(te.enumerable=!1,"writable"in te){te.writable=!1;return}te.set||(te.set=()=>{throw Error("Can not rewrite read-only method '"+ue+"'")})}})},qe=(J,te)=>{const ue={},xe=we=>{we.forEach($e=>{ue[$e]=!0})};return h(J)?xe(J):xe(String(J).split(te)),ue},Ve=()=>{},dt=(J,te)=>J!=null&&Number.isFinite(J=+J)?J:te;function xt(J){return!!(J&&j(J.append)&&J[a]==="FormData"&&J[r])}const ye=J=>{const te=new Array(10),ue=(xe,we)=>{if(y(xe)){if(te.indexOf(xe)>=0)return;if(f(xe))return xe;if(!("toJSON"in xe)){te[we]=xe;const $e=h(xe)?[]:{};return D(xe,(Be,lt)=>{const Jt=ue(Be,we+1);!x(Jt)&&($e[lt]=Jt)}),te[we]=void 0,$e}}return xe};return ue(J,0)},le=c("AsyncFunction"),Qe=J=>J&&(y(J)||j(J))&&j(J.then)&&j(J.catch),rt=((J,te)=>J?setImmediate:te?((ue,xe)=>(V.addEventListener("message",({source:we,data:$e})=>{we===V&&$e===ue&&xe.length&&xe.shift()()},!1),we=>{xe.push(we),V.postMessage(ue,"*")}))(`axios@${Math.random()}`,[]):ue=>setTimeout(ue))(typeof setImmediate=="function",j(V.postMessage)),Kt=typeof queueMicrotask<"u"?queueMicrotask.bind(V):typeof process<"u"&&process.nextTick||rt;var Re={isArray:h,isArrayBuffer:m,isBuffer:f,isFormData:q,isArrayBufferView:p,isString:u,isNumber:g,isBoolean:N,isObject:y,isPlainObject:S,isEmptyObject:C,isReadableStream:Z,isRequest:W,isResponse:z,isHeaders:F,isUndefined:x,isDate:w,isFile:R,isReactNativeBlob:P,isReactNative:A,isBlob:I,isRegExp:be,isFunction:j,isStream:T,isURLSearchParams:G,isTypedArray:ve,isFileList:$,forEach:D,merge:Y,extend:U,trim:B,stripBOM:X,inherits:ne,toFlatObject:oe,kindOf:l,kindOfTest:c,endsWith:re,toArray:ge,forEachEntry:Se,matchAll:We,isHTMLForm:Ce,hasOwnProperty:Ye,hasOwnProp:Ye,reduceDescriptors:_e,freezeMethods:ke,toObjectSet:qe,toCamelCase:fe,noop:Ve,toFiniteNumber:dt,findKey:O,global:V,isContextDefined:K,isSpecCompliantForm:xt,toJSONObject:ye,isAsyncFn:le,isThenable:Qe,setImmediate:rt,asap:Kt,isIterable:J=>J!=null&&j(J[r])};class Qt extends Error{static from(te,ue,xe,we,$e,Be){const lt=new Qt(te.message,ue||te.code,xe,we,$e);return lt.cause=te,lt.name=te.name,te.status!=null&<.status==null&&(lt.status=te.status),Be&&Object.assign(lt,Be),lt}constructor(te,ue,xe,we,$e){super(te),Object.defineProperty(this,"message",{value:te,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,ue&&(this.code=ue),xe&&(this.config=xe),we&&(this.request=we),$e&&(this.response=$e,this.status=$e.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Re.toJSONObject(this.config),code:this.code,status:this.status}}}Qt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Qt.ERR_BAD_OPTION="ERR_BAD_OPTION",Qt.ECONNABORTED="ECONNABORTED",Qt.ETIMEDOUT="ETIMEDOUT",Qt.ERR_NETWORK="ERR_NETWORK",Qt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Qt.ERR_DEPRECATED="ERR_DEPRECATED",Qt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Qt.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Qt.ERR_CANCELED="ERR_CANCELED",Qt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Qt.ERR_INVALID_URL="ERR_INVALID_URL";var qt=Qt,ws=null;function _s(J){return Re.isPlainObject(J)||Re.isArray(J)}function ns(J){return Re.endsWith(J,"[]")?J.slice(0,-2):J}function Cs(J,te,ue){return J?J.concat(te).map(function(we,$e){return we=ns(we),!ue&&$e?"["+we+"]":we}).join(ue?".":""):te}function Bs(J){return Re.isArray(J)&&!J.some(_s)}const Ft=Re.toFlatObject(Re,{},null,function(te){return/^is[A-Z]/.test(te)});function ie(J,te,ue){if(!Re.isObject(J))throw new TypeError("target must be an object");te=te||new FormData,ue=Re.toFlatObject(ue,{metaTokens:!0,dots:!1,indexes:!1},!1,function(bs,es){return!Re.isUndefined(es[bs])});const xe=ue.metaTokens,we=ue.visitor||Et,$e=ue.dots,Be=ue.indexes,Jt=(ue.Blob||typeof Blob<"u"&&Blob)&&Re.isSpecCompliantForm(te);if(!Re.isFunction(we))throw new TypeError("visitor must be a function");function Mt(Ot){if(Ot===null)return"";if(Re.isDate(Ot))return Ot.toISOString();if(Re.isBoolean(Ot))return Ot.toString();if(!Jt&&Re.isBlob(Ot))throw new qt("Blob is not supported. Use a Buffer instead.");return Re.isArrayBuffer(Ot)||Re.isTypedArray(Ot)?Jt&&typeof Blob=="function"?new Blob([Ot]):Buffer.from(Ot):Ot}function Et(Ot,bs,es){let Sn=Ot;if(Re.isReactNative(te)&&Re.isReactNativeBlob(Ot))return te.append(Cs(es,bs,$e),Mt(Ot)),!1;if(Ot&&!es&&typeof Ot=="object"){if(Re.endsWith(bs,"{}"))bs=xe?bs:bs.slice(0,-2),Ot=JSON.stringify(Ot);else if(Re.isArray(Ot)&&Bs(Ot)||(Re.isFileList(Ot)||Re.endsWith(bs,"[]"))&&(Sn=Re.toArray(Ot)))return bs=ns(bs),Sn.forEach(function(Dn,nr){!(Re.isUndefined(Dn)||Dn===null)&&te.append(Be===!0?Cs([bs],nr,$e):Be===null?bs:bs+"[]",Mt(Dn))}),!1}return _s(Ot)?!0:(te.append(Cs(es,bs,$e),Mt(Ot)),!1)}const gs=[],tn=Object.assign(Ft,{defaultVisitor:Et,convertValue:Mt,isVisitable:_s});function Hn(Ot,bs){if(!Re.isUndefined(Ot)){if(gs.indexOf(Ot)!==-1)throw Error("Circular reference detected in "+bs.join("."));gs.push(Ot),Re.forEach(Ot,function(Sn,xr){(!(Re.isUndefined(Sn)||Sn===null)&&we.call(te,Sn,Re.isString(xr)?xr.trim():xr,bs,tn))===!0&&Hn(Sn,bs?bs.concat(xr):[xr])}),gs.pop()}}if(!Re.isObject(J))throw new TypeError("data must be an object");return Hn(J),te}function Fe(J){const te={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(J).replace(/[!'()~]|%20|%00/g,function(xe){return te[xe]})}function Q(J,te){this._pairs=[],J&&ie(J,this,te)}const pe=Q.prototype;pe.append=function(te,ue){this._pairs.push([te,ue])},pe.toString=function(te){const ue=te?function(xe){return te.call(this,xe,Fe)}:Fe;return this._pairs.map(function(we){return ue(we[0])+"="+ue(we[1])},"").join("&")};function Ne(J){return encodeURIComponent(J).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ee(J,te,ue){if(!te)return J;const xe=ue&&ue.encode||Ne,we=Re.isFunction(ue)?{serialize:ue}:ue,$e=we&&we.serialize;let Be;if($e?Be=$e(te,we):Be=Re.isURLSearchParams(te)?te.toString():new Q(te,we).toString(xe),Be){const lt=J.indexOf("#");lt!==-1&&(J=J.slice(0,lt)),J+=(J.indexOf("?")===-1?"?":"&")+Be}return J}class it{constructor(){this.handlers=[]}use(te,ue,xe){return this.handlers.push({fulfilled:te,rejected:ue,synchronous:xe?xe.synchronous:!1,runWhen:xe?xe.runWhen:null}),this.handlers.length-1}eject(te){this.handlers[te]&&(this.handlers[te]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(te){Re.forEach(this.handlers,function(xe){xe!==null&&te(xe)})}}var st=it,bt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ue=typeof URLSearchParams<"u"?URLSearchParams:Q,Lt=typeof FormData<"u"?FormData:null,ut=typeof Blob<"u"?Blob:null,yt={isBrowser:!0,classes:{URLSearchParams:Ue,FormData:Lt,Blob:ut},protocols:["http","https","file","blob","url","data"]};const kt=typeof window<"u"&&typeof document<"u",Ie=typeof navigator=="object"&&navigator||void 0,_t=kt&&(!Ie||["ReactNative","NativeScript","NS"].indexOf(Ie.product)<0),ht=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zt=kt&&window.location.href||"http://localhost";var rs=Object.freeze({__proto__:null,hasBrowserEnv:kt,hasStandardBrowserWebWorkerEnv:ht,hasStandardBrowserEnv:_t,navigator:Ie,origin:zt}),Yt={...rs,...yt};function Os(J,te){return ie(J,new Yt.classes.URLSearchParams,{visitor:function(ue,xe,we,$e){return Yt.isNode&&Re.isBuffer(ue)?(this.append(xe,ue.toString("base64")),!1):$e.defaultVisitor.apply(this,arguments)},...te})}function Is(J){return Re.matchAll(/\w+|\[(\w*)]/g,J).map(te=>te[0]==="[]"?"":te[1]||te[0])}function zs(J){const te={},ue=Object.keys(J);let xe;const we=ue.length;let $e;for(xe=0;xe=ue.length;return Be=!Be&&Re.isArray(we)?we.length:Be,Jt?(Re.hasOwnProp(we,Be)?we[Be]=[we[Be],xe]:we[Be]=xe,!lt):((!we[Be]||!Re.isObject(we[Be]))&&(we[Be]=[]),te(ue,xe,we[Be],$e)&&Re.isArray(we[Be])&&(we[Be]=zs(we[Be])),!lt)}if(Re.isFormData(J)&&Re.isFunction(J.entries)){const ue={};return Re.forEachEntry(J,(xe,we)=>{te(Is(xe),we,ue,0)}),ue}return null}function he(J,te,ue){if(Re.isString(J))try{return(te||JSON.parse)(J),Re.trim(J)}catch(xe){if(xe.name!=="SyntaxError")throw xe}return(ue||JSON.stringify)(J)}const Ge={transitional:bt,adapter:["xhr","http","fetch"],transformRequest:[function(te,ue){const xe=ue.getContentType()||"",we=xe.indexOf("application/json")>-1,$e=Re.isObject(te);if($e&&Re.isHTMLForm(te)&&(te=new FormData(te)),Re.isFormData(te))return we?JSON.stringify(en(te)):te;if(Re.isArrayBuffer(te)||Re.isBuffer(te)||Re.isStream(te)||Re.isFile(te)||Re.isBlob(te)||Re.isReadableStream(te))return te;if(Re.isArrayBufferView(te))return te.buffer;if(Re.isURLSearchParams(te))return ue.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),te.toString();let lt;if($e){if(xe.indexOf("application/x-www-form-urlencoded")>-1)return Os(te,this.formSerializer).toString();if((lt=Re.isFileList(te))||xe.indexOf("multipart/form-data")>-1){const Jt=this.env&&this.env.FormData;return ie(lt?{"files[]":te}:te,Jt&&new Jt,this.formSerializer)}}return $e||we?(ue.setContentType("application/json",!1),he(te)):te}],transformResponse:[function(te){const ue=this.transitional||Ge.transitional,xe=ue&&ue.forcedJSONParsing,we=this.responseType==="json";if(Re.isResponse(te)||Re.isReadableStream(te))return te;if(te&&Re.isString(te)&&(xe&&!this.responseType||we)){const Be=!(ue&&ue.silentJSONParsing)&&we;try{return JSON.parse(te,this.parseReviver)}catch(lt){if(Be)throw lt.name==="SyntaxError"?qt.from(lt,qt.ERR_BAD_RESPONSE,this,null,this.response):lt}}return te}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Yt.classes.FormData,Blob:Yt.classes.Blob},validateStatus:function(te){return te>=200&&te<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Re.forEach(["delete","get","head","post","put","patch"],J=>{Ge.headers[J]={}});var at=Ge;const pt=Re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var mt=J=>{const te={};let ue,xe,we;return J&&J.split(` -`).forEach(function(Be){we=Be.indexOf(":"),ue=Be.substring(0,we).trim().toLowerCase(),xe=Be.substring(we+1).trim(),!(!ue||te[ue]&&pt[ue])&&(ue==="set-cookie"?te[ue]?te[ue].push(xe):te[ue]=[xe]:te[ue]=te[ue]?te[ue]+", "+xe:xe)}),te};const Bt=Symbol("internals");function Ds(J){return J&&String(J).trim().toLowerCase()}function as(J){return J===!1||J==null?J:Re.isArray(J)?J.map(as):String(J)}function Vs(J){const te=Object.create(null),ue=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let xe;for(;xe=ue.exec(J);)te[xe[1]]=xe[2];return te}const Ls=J=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(J.trim());function Ts(J,te,ue,xe,we){if(Re.isFunction(xe))return xe.call(this,te,ue);if(we&&(te=ue),!!Re.isString(te)){if(Re.isString(xe))return te.indexOf(xe)!==-1;if(Re.isRegExp(xe))return xe.test(te)}}function ln(J){return J.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(te,ue,xe)=>ue.toUpperCase()+xe)}function pn(J,te){const ue=Re.toCamelCase(" "+te);["get","set","has"].forEach(xe=>{Object.defineProperty(J,xe+ue,{value:function(we,$e,Be){return this[xe].call(this,te,we,$e,Be)},configurable:!0})})}class hn{constructor(te){te&&this.set(te)}set(te,ue,xe){const we=this;function $e(lt,Jt,Mt){const Et=Ds(Jt);if(!Et)throw new Error("header name must be a non-empty string");const gs=Re.findKey(we,Et);(!gs||we[gs]===void 0||Mt===!0||Mt===void 0&&we[gs]!==!1)&&(we[gs||Jt]=as(lt))}const Be=(lt,Jt)=>Re.forEach(lt,(Mt,Et)=>$e(Mt,Et,Jt));if(Re.isPlainObject(te)||te instanceof this.constructor)Be(te,ue);else if(Re.isString(te)&&(te=te.trim())&&!Ls(te))Be(mt(te),ue);else if(Re.isObject(te)&&Re.isIterable(te)){let lt={},Jt,Mt;for(const Et of te){if(!Re.isArray(Et))throw TypeError("Object iterator must return a key-value pair");lt[Mt=Et[0]]=(Jt=lt[Mt])?Re.isArray(Jt)?[...Jt,Et[1]]:[Jt,Et[1]]:Et[1]}Be(lt,ue)}else te!=null&&$e(ue,te,xe);return this}get(te,ue){if(te=Ds(te),te){const xe=Re.findKey(this,te);if(xe){const we=this[xe];if(!ue)return we;if(ue===!0)return Vs(we);if(Re.isFunction(ue))return ue.call(this,we,xe);if(Re.isRegExp(ue))return ue.exec(we);throw new TypeError("parser must be boolean|regexp|function")}}}has(te,ue){if(te=Ds(te),te){const xe=Re.findKey(this,te);return!!(xe&&this[xe]!==void 0&&(!ue||Ts(this,this[xe],xe,ue)))}return!1}delete(te,ue){const xe=this;let we=!1;function $e(Be){if(Be=Ds(Be),Be){const lt=Re.findKey(xe,Be);lt&&(!ue||Ts(xe,xe[lt],lt,ue))&&(delete xe[lt],we=!0)}}return Re.isArray(te)?te.forEach($e):$e(te),we}clear(te){const ue=Object.keys(this);let xe=ue.length,we=!1;for(;xe--;){const $e=ue[xe];(!te||Ts(this,this[$e],$e,te,!0))&&(delete this[$e],we=!0)}return we}normalize(te){const ue=this,xe={};return Re.forEach(this,(we,$e)=>{const Be=Re.findKey(xe,$e);if(Be){ue[Be]=as(we),delete ue[$e];return}const lt=te?ln($e):String($e).trim();lt!==$e&&delete ue[$e],ue[lt]=as(we),xe[lt]=!0}),this}concat(...te){return this.constructor.concat(this,...te)}toJSON(te){const ue=Object.create(null);return Re.forEach(this,(xe,we)=>{xe!=null&&xe!==!1&&(ue[we]=te&&Re.isArray(xe)?xe.join(", "):xe)}),ue}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([te,ue])=>te+": "+ue).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(te){return te instanceof this?te:new this(te)}static concat(te,...ue){const xe=new this(te);return ue.forEach(we=>xe.set(we)),xe}static accessor(te){const xe=(this[Bt]=this[Bt]={accessors:{}}).accessors,we=this.prototype;function $e(Be){const lt=Ds(Be);xe[lt]||(pn(we,Be),xe[lt]=!0)}return Re.isArray(te)?te.forEach($e):$e(te),this}}hn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Re.reduceDescriptors(hn.prototype,({value:J},te)=>{let ue=te[0].toUpperCase()+te.slice(1);return{get:()=>J,set(xe){this[ue]=xe}}}),Re.freezeMethods(hn);var Ws=hn;function Qs(J,te){const ue=this||at,xe=te||ue,we=Ws.from(xe.headers);let $e=xe.data;return Re.forEach(J,function(lt){$e=lt.call(ue,$e,we.normalize(),te?te.status:void 0)}),we.normalize(),$e}function zn(J){return!!(J&&J.__CANCEL__)}class on extends qt{constructor(te,ue,xe){super(te??"canceled",qt.ERR_CANCELED,ue,xe),this.name="CanceledError",this.__CANCEL__=!0}}var Un=on;function yr(J,te,ue){const xe=ue.config.validateStatus;!ue.status||!xe||xe(ue.status)?J(ue):te(new qt("Request failed with status code "+ue.status,[qt.ERR_BAD_REQUEST,qt.ERR_BAD_RESPONSE][Math.floor(ue.status/100)-4],ue.config,ue.request,ue))}function Tr(J){const te=/^([-+\w]{1,25})(:?\/\/|:)/.exec(J);return te&&te[1]||""}function er(J,te){J=J||10;const ue=new Array(J),xe=new Array(J);let we=0,$e=0,Be;return te=te!==void 0?te:1e3,function(Jt){const Mt=Date.now(),Et=xe[$e];Be||(Be=Mt),ue[we]=Jt,xe[we]=Mt;let gs=$e,tn=0;for(;gs!==we;)tn+=ue[gs++],gs=gs%J;if(we=(we+1)%J,we===$e&&($e=($e+1)%J),Mt-Be{ue=Et,we=null,$e&&(clearTimeout($e),$e=null),J(...Mt)};return[(...Mt)=>{const Et=Date.now(),gs=Et-ue;gs>=xe?Be(Mt,Et):(we=Mt,$e||($e=setTimeout(()=>{$e=null,Be(we)},xe-gs)))},()=>we&&Be(we)]}const En=(J,te,ue=3)=>{let xe=0;const we=er(50,250);return tr($e=>{const Be=$e.loaded,lt=$e.lengthComputable?$e.total:void 0,Jt=Be-xe,Mt=we(Jt),Et=Be<=lt;xe=Be;const gs={loaded:Be,total:lt,progress:lt?Be/lt:void 0,bytes:Jt,rate:Mt||void 0,estimated:Mt&<&&Et?(lt-Be)/Mt:void 0,event:$e,lengthComputable:lt!=null,[te?"download":"upload"]:!0};J(gs)},ue)},Xe=(J,te)=>{const ue=J!=null;return[xe=>te[0]({lengthComputable:ue,total:J,loaded:xe}),te[1]]},$t=J=>(...te)=>Re.asap(()=>J(...te));var Ze=Yt.hasStandardBrowserEnv?((J,te)=>ue=>(ue=new URL(ue,Yt.origin),J.protocol===ue.protocol&&J.host===ue.host&&(te||J.port===ue.port)))(new URL(Yt.origin),Yt.navigator&&/(msie|trident)/i.test(Yt.navigator.userAgent)):()=>!0,Ut=Yt.hasStandardBrowserEnv?{write(J,te,ue,xe,we,$e,Be){if(typeof document>"u")return;const lt=[`${J}=${encodeURIComponent(te)}`];Re.isNumber(ue)&<.push(`expires=${new Date(ue).toUTCString()}`),Re.isString(xe)&<.push(`path=${xe}`),Re.isString(we)&<.push(`domain=${we}`),$e===!0&<.push("secure"),Re.isString(Be)&<.push(`SameSite=${Be}`),document.cookie=lt.join("; ")},read(J){if(typeof document>"u")return null;const te=document.cookie.match(new RegExp("(?:^|; )"+J+"=([^;]*)"));return te?decodeURIComponent(te[1]):null},remove(J){this.write(J,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function jt(J){return typeof J!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(J)}function In(J,te){return te?J.replace(/\/?\/$/,"")+"/"+te.replace(/^\/+/,""):J}function jr(J,te,ue){let xe=!jt(te);return J&&(xe||ue==!1)?In(J,te):te}const Pr=J=>J instanceof Ws?{...J}:J;function xn(J,te){te=te||{};const ue={};function xe(Mt,Et,gs,tn){return Re.isPlainObject(Mt)&&Re.isPlainObject(Et)?Re.merge.call({caseless:tn},Mt,Et):Re.isPlainObject(Et)?Re.merge({},Et):Re.isArray(Et)?Et.slice():Et}function we(Mt,Et,gs,tn){if(Re.isUndefined(Et)){if(!Re.isUndefined(Mt))return xe(void 0,Mt,gs,tn)}else return xe(Mt,Et,gs,tn)}function $e(Mt,Et){if(!Re.isUndefined(Et))return xe(void 0,Et)}function Be(Mt,Et){if(Re.isUndefined(Et)){if(!Re.isUndefined(Mt))return xe(void 0,Mt)}else return xe(void 0,Et)}function lt(Mt,Et,gs){if(gs in te)return xe(Mt,Et);if(gs in J)return xe(void 0,Mt)}const Jt={url:$e,method:$e,data:$e,baseURL:Be,transformRequest:Be,transformResponse:Be,paramsSerializer:Be,timeout:Be,timeoutMessage:Be,withCredentials:Be,withXSRFToken:Be,adapter:Be,responseType:Be,xsrfCookieName:Be,xsrfHeaderName:Be,onUploadProgress:Be,onDownloadProgress:Be,decompress:Be,maxContentLength:Be,maxBodyLength:Be,beforeRedirect:Be,transport:Be,httpAgent:Be,httpsAgent:Be,cancelToken:Be,socketPath:Be,responseEncoding:Be,validateStatus:lt,headers:(Mt,Et,gs)=>we(Pr(Mt),Pr(Et),gs,!0)};return Re.forEach(Object.keys({...J,...te}),function(Et){if(Et==="__proto__"||Et==="constructor"||Et==="prototype")return;const gs=Re.hasOwnProp(Jt,Et)?Jt[Et]:we,tn=gs(J[Et],te[Et],Et);Re.isUndefined(tn)&&gs!==lt||(ue[Et]=tn)}),ue}var qs=J=>{const te=xn({},J);let{data:ue,withXSRFToken:xe,xsrfHeaderName:we,xsrfCookieName:$e,headers:Be,auth:lt}=te;if(te.headers=Be=Ws.from(Be),te.url=Ee(jr(te.baseURL,te.url,te.allowAbsoluteUrls),J.params,J.paramsSerializer),lt&&Be.set("Authorization","Basic "+btoa((lt.username||"")+":"+(lt.password?unescape(encodeURIComponent(lt.password)):""))),Re.isFormData(ue)){if(Yt.hasStandardBrowserEnv||Yt.hasStandardBrowserWebWorkerEnv)Be.setContentType(void 0);else if(Re.isFunction(ue.getHeaders)){const Jt=ue.getHeaders(),Mt=["content-type","content-length"];Object.entries(Jt).forEach(([Et,gs])=>{Mt.includes(Et.toLowerCase())&&Be.set(Et,gs)})}}if(Yt.hasStandardBrowserEnv&&(xe&&Re.isFunction(xe)&&(xe=xe(te)),xe||xe!==!1&&Ze(te.url))){const Jt=we&&$e&&Ut.read($e);Jt&&Be.set(we,Jt)}return te},Tt=typeof XMLHttpRequest<"u"&&function(J){return new Promise(function(ue,xe){const we=qs(J);let $e=we.data;const Be=Ws.from(we.headers).normalize();let{responseType:lt,onUploadProgress:Jt,onDownloadProgress:Mt}=we,Et,gs,tn,Hn,Ot;function bs(){Hn&&Hn(),Ot&&Ot(),we.cancelToken&&we.cancelToken.unsubscribe(Et),we.signal&&we.signal.removeEventListener("abort",Et)}let es=new XMLHttpRequest;es.open(we.method.toUpperCase(),we.url,!0),es.timeout=we.timeout;function Sn(){if(!es)return;const Dn=Ws.from("getAllResponseHeaders"in es&&es.getAllResponseHeaders()),Ir={data:!lt||lt==="text"||lt==="json"?es.responseText:es.response,status:es.status,statusText:es.statusText,headers:Dn,config:J,request:es};yr(function(rr){ue(rr),bs()},function(rr){xe(rr),bs()},Ir),es=null}"onloadend"in es?es.onloadend=Sn:es.onreadystatechange=function(){!es||es.readyState!==4||es.status===0&&!(es.responseURL&&es.responseURL.indexOf("file:")===0)||setTimeout(Sn)},es.onabort=function(){es&&(xe(new qt("Request aborted",qt.ECONNABORTED,J,es)),es=null)},es.onerror=function(nr){const Ir=nr&&nr.message?nr.message:"Network Error",Ia=new qt(Ir,qt.ERR_NETWORK,J,es);Ia.event=nr||null,xe(Ia),es=null},es.ontimeout=function(){let nr=we.timeout?"timeout of "+we.timeout+"ms exceeded":"timeout exceeded";const Ir=we.transitional||bt;we.timeoutErrorMessage&&(nr=we.timeoutErrorMessage),xe(new qt(nr,Ir.clarifyTimeoutError?qt.ETIMEDOUT:qt.ECONNABORTED,J,es)),es=null},$e===void 0&&Be.setContentType(null),"setRequestHeader"in es&&Re.forEach(Be.toJSON(),function(nr,Ir){es.setRequestHeader(Ir,nr)}),Re.isUndefined(we.withCredentials)||(es.withCredentials=!!we.withCredentials),lt&<!=="json"&&(es.responseType=we.responseType),Mt&&([tn,Ot]=En(Mt,!0),es.addEventListener("progress",tn)),Jt&&es.upload&&([gs,Hn]=En(Jt),es.upload.addEventListener("progress",gs),es.upload.addEventListener("loadend",Hn)),(we.cancelToken||we.signal)&&(Et=Dn=>{es&&(xe(!Dn||Dn.type?new Un(null,J,es):Dn),es.abort(),es=null)},we.cancelToken&&we.cancelToken.subscribe(Et),we.signal&&(we.signal.aborted?Et():we.signal.addEventListener("abort",Et)));const xr=Tr(we.url);if(xr&&Yt.protocols.indexOf(xr)===-1){xe(new qt("Unsupported protocol "+xr+":",qt.ERR_BAD_REQUEST,J));return}es.send($e||null)})},Vr=(J,te)=>{const{length:ue}=J=J?J.filter(Boolean):[];if(te||ue){let xe=new AbortController,we;const $e=function(Mt){if(!we){we=!0,lt();const Et=Mt instanceof Error?Mt:this.reason;xe.abort(Et instanceof qt?Et:new Un(Et instanceof Error?Et.message:Et))}};let Be=te&&setTimeout(()=>{Be=null,$e(new qt(`timeout of ${te}ms exceeded`,qt.ETIMEDOUT))},te);const lt=()=>{J&&(Be&&clearTimeout(Be),Be=null,J.forEach(Mt=>{Mt.unsubscribe?Mt.unsubscribe($e):Mt.removeEventListener("abort",$e)}),J=null)};J.forEach(Mt=>Mt.addEventListener("abort",$e));const{signal:Jt}=xe;return Jt.unsubscribe=()=>Re.asap(lt),Jt}};const ta=function*(J,te){let ue=J.byteLength;if(ue{const we=ma(J,te);let $e=0,Be,lt=Jt=>{Be||(Be=!0,xe&&xe(Jt))};return new ReadableStream({async pull(Jt){try{const{done:Mt,value:Et}=await we.next();if(Mt){lt(),Jt.close();return}let gs=Et.byteLength;if(ue){let tn=$e+=gs;ue(tn)}Jt.enqueue(new Uint8Array(Et))}catch(Mt){throw lt(Mt),Mt}},cancel(Jt){return lt(Jt),we.return()}},{highWaterMark:2})},gn=64*1024,{isFunction:mn}=Re,Qn=(({Request:J,Response:te})=>({Request:J,Response:te}))(Re.global),{ReadableStream:fr,TextEncoder:pr}=Re.global,dn=(J,...te)=>{try{return!!J(...te)}catch{return!1}},wn=J=>{J=Re.merge.call({skipUndefined:!0},Qn,J);const{fetch:te,Request:ue,Response:xe}=J,we=te?mn(te):typeof fetch=="function",$e=mn(ue),Be=mn(xe);if(!we)return!1;const lt=we&&mn(fr),Jt=we&&(typeof pr=="function"?(Ot=>bs=>Ot.encode(bs))(new pr):async Ot=>new Uint8Array(await new ue(Ot).arrayBuffer())),Mt=$e&<&&dn(()=>{let Ot=!1;const bs=new ue(Yt.origin,{body:new fr,method:"POST",get duplex(){return Ot=!0,"half"}}).headers.has("Content-Type");return Ot&&!bs}),Et=Be&<&&dn(()=>Re.isReadableStream(new xe("").body)),gs={stream:Et&&(Ot=>Ot.body)};we&&["text","arrayBuffer","blob","formData","stream"].forEach(Ot=>{!gs[Ot]&&(gs[Ot]=(bs,es)=>{let Sn=bs&&bs[Ot];if(Sn)return Sn.call(bs);throw new qt(`Response type '${Ot}' is not supported`,qt.ERR_NOT_SUPPORT,es)})});const tn=async Ot=>{if(Ot==null)return 0;if(Re.isBlob(Ot))return Ot.size;if(Re.isSpecCompliantForm(Ot))return(await new ue(Yt.origin,{method:"POST",body:Ot}).arrayBuffer()).byteLength;if(Re.isArrayBufferView(Ot)||Re.isArrayBuffer(Ot))return Ot.byteLength;if(Re.isURLSearchParams(Ot)&&(Ot=Ot+""),Re.isString(Ot))return(await Jt(Ot)).byteLength},Hn=async(Ot,bs)=>{const es=Re.toFiniteNumber(Ot.getContentLength());return es??tn(bs)};return async Ot=>{let{url:bs,method:es,data:Sn,signal:xr,cancelToken:Dn,timeout:nr,onDownloadProgress:Ir,onUploadProgress:Ia,responseType:rr,headers:ao,withCredentials:il="same-origin",fetchOptions:io}=qs(Ot),lo=te||fetch;rr=rr?(rr+"").toLowerCase():"text";let ll=Vr([xr,Dn&&Dn.toAbortSignal()],nr),Di=null;const La=ll&&ll.unsubscribe&&(()=>{ll.unsubscribe()});let Ko;try{if(Ia&&Mt&&es!=="get"&&es!=="head"&&(Ko=await Hn(ao,Sn))!==0){let xa=new ue(bs,{method:"POST",body:Sn,duplex:"half"}),Ma;if(Re.isFormData(Sn)&&(Ma=xa.headers.get("content-type"))&&ao.setContentType(Ma),xa.body){const[cl,Pi]=Xe(Ko,En($t(Ia)));Sn=sr(xa.body,gn,cl,Pi)}}Re.isString(il)||(il=il?"include":"omit");const ar=$e&&"credentials"in ue.prototype,Yo={...io,signal:ll,method:es.toUpperCase(),headers:ao.normalize().toJSON(),body:Sn,duplex:"half",credentials:ar?il:void 0};Di=$e&&new ue(bs,Yo);let pa=await($e?lo(Di,io):lo(bs,Yo));const ol=Et&&(rr==="stream"||rr==="response");if(Et&&(Ir||ol&&La)){const xa={};["status","statusText","headers"].forEach(oo=>{xa[oo]=pa[oo]});const Ma=Re.toFiniteNumber(pa.headers.get("content-length")),[cl,Pi]=Ir&&Xe(Ma,En($t(Ir),!0))||[];pa=new xe(sr(pa.body,gn,cl,()=>{Pi&&Pi(),La&&La()}),xa)}rr=rr||"text";let Ti=await gs[Re.findKey(gs,rr)||"text"](pa,Ot);return!ol&&La&&La(),await new Promise((xa,Ma)=>{yr(xa,Ma,{data:Ti,headers:Ws.from(pa.headers),status:pa.status,statusText:pa.statusText,config:Ot,request:Di})})}catch(ar){throw La&&La(),ar&&ar.name==="TypeError"&&/Load failed|fetch/i.test(ar.message)?Object.assign(new qt("Network Error",qt.ERR_NETWORK,Ot,Di,ar&&ar.response),{cause:ar.cause||ar}):qt.from(ar,ar&&ar.code,Ot,Di,ar&&ar.response)}}},Da=new Map,fa=J=>{let te=J&&J.env||{};const{fetch:ue,Request:xe,Response:we}=te,$e=[xe,we,ue];let Be=$e.length,lt=Be,Jt,Mt,Et=Da;for(;lt--;)Jt=$e[lt],Mt=Et.get(Jt),Mt===void 0&&Et.set(Jt,Mt=lt?new Map:wn(te)),Et=Mt;return Mt};fa();const Ai={http:ws,xhr:Tt,fetch:{get:fa}};Re.forEach(Ai,(J,te)=>{if(J){try{Object.defineProperty(J,"name",{value:te})}catch{}Object.defineProperty(J,"adapterName",{value:te})}});const ki=J=>`- ${J}`,ni=J=>Re.isFunction(J)||J===null||J===!1;function rl(J,te){J=Re.isArray(J)?J:[J];const{length:ue}=J;let xe,we;const $e={};for(let Be=0;Be`adapter ${Jt} `+(Mt===!1?"is not supported by the environment":"is not available in the build"));let lt=ue?Be.length>1?`since : + */var uN;function UT(){if(uN)return fx;uN=1;var t=Ic();function s(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var n=typeof Object.is=="function"?Object.is:s,r=t.useSyncExternalStore,a=t.useRef,l=t.useEffect,c=t.useMemo,d=t.useDebugValue;return fx.useSyncExternalStoreWithSelector=function(m,x,f,h,g){var u=a(null);if(u.current===null){var j={hasValue:!1,value:null};u.current=j}else j=u.current;u=c(function(){function y(E){if(!N){if(N=!0,S=E,E=h(E),g!==void 0&&j.hasValue){var T=j.value;if(g(T,E))return A=T}return A=E}if(T=A,n(S,E))return T;var C=h(E);return g!==void 0&&g(T,C)?(S=E,T):(S=E,A=C)}var N=!1,S,A,w=f===void 0?null:f;return[function(){return y(x())},w===null?void 0:function(){return y(w())}]},[x,f,h,g]);var p=r(m,u[0],u[1]);return l(function(){j.hasValue=!0,j.value=p},[p]),d(p),p},fx}var hN;function VT(){return hN||(hN=1,mx.exports=UT()),mx.exports}var HT=VT();function WT(t){t()}function KT(){let t=null,s=null;return{clear(){t=null,s=null},notify(){WT(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const a=s={callback:n,next:null,prev:s};return a.prev?a.prev.next=a:t=a,function(){!r||t===null||(r=!1,a.next?a.next.prev=a.prev:s=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}var mN={notify(){},get:()=>[]};function GT(t,s){let n,r=mN,a=0,l=!1;function c(p){f();const y=r.subscribe(p);let N=!1;return()=>{N||(N=!0,y(),h())}}function d(){r.notify()}function m(){j.onStateChange&&j.onStateChange()}function x(){return l}function f(){a++,n||(n=t.subscribe(m),r=KT())}function h(){a--,n&&a===0&&(n(),n=void 0,r.clear(),r=mN)}function g(){l||(l=!0,f())}function u(){l&&(l=!1,h())}const j={addNestedSub:c,notifyNestedSubs:d,handleChangeWrapper:m,isSubscribed:x,trySubscribe:g,tryUnsubscribe:u,getListeners:()=>r};return j}var YT=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ZT=YT(),QT=()=>typeof navigator<"u"&&navigator.product==="ReactNative",XT=QT(),JT=()=>ZT||XT?v.useLayoutEffect:v.useEffect,e_=JT(),px=Symbol.for("react-redux-context"),xx=typeof globalThis<"u"?globalThis:{};function t_(){if(!v.createContext)return{};const t=xx[px]??(xx[px]=new Map);let s=t.get(v.createContext);return s||(s=v.createContext(null),t.set(v.createContext,s)),s}var Il=t_();function s_(t){const{children:s,context:n,serverState:r,store:a}=t,l=v.useMemo(()=>{const m=GT(a);return{store:a,subscription:m,getServerState:r?()=>r:void 0}},[a,r]),c=v.useMemo(()=>a.getState(),[a]);e_(()=>{const{subscription:m}=l;return m.onStateChange=m.notifyNestedSubs,m.trySubscribe(),c!==a.getState()&&m.notifyNestedSubs(),()=>{m.tryUnsubscribe(),m.onStateChange=void 0}},[l,c]);const d=n||Il;return v.createElement(d.Provider,{value:l},s)}var n_=s_;function Ov(t=Il){return function(){return v.useContext(t)}}var gC=Ov();function vC(t=Il){const s=t===Il?gC:Ov(t),n=()=>{const{store:r}=s();return r};return Object.assign(n,{withTypes:()=>n}),n}var r_=vC();function a_(t=Il){const s=t===Il?r_:vC(t),n=()=>s().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var su=a_(),i_=(t,s)=>t===s;function l_(t=Il){const s=t===Il?gC:Ov(t),n=(r,a={})=>{const{equalityFn:l=i_}=typeof a=="function"?{equalityFn:a}:a,c=s(),{store:d,subscription:m,getServerState:x}=c;v.useRef(!0);const f=v.useCallback({[r.name](g){return r(g)}}[r.name],[r]),h=HT.useSyncExternalStoreWithSelector(m.addNestedSub,d.getState,x||d.getState,f,l);return v.useDebugValue(h),h};return Object.assign(n,{withTypes:()=>n}),n}var Nn=l_();function br(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var o_=typeof Symbol=="function"&&Symbol.observable||"@@observable",fN=o_,gx=()=>Math.random().toString(36).substring(7).split("").join("."),c_={INIT:`@@redux/INIT${gx()}`,REPLACE:`@@redux/REPLACE${gx()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${gx()}`},cm=c_;function Lv(t){if(typeof t!="object"||t===null)return!1;let s=t;for(;Object.getPrototypeOf(s)!==null;)s=Object.getPrototypeOf(s);return Object.getPrototypeOf(t)===s||Object.getPrototypeOf(t)===null}function bC(t,s,n){if(typeof t!="function")throw new Error(br(2));if(typeof s=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(br(0));if(typeof s=="function"&&typeof n>"u"&&(n=s,s=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(br(1));return n(bC)(t,s)}let r=t,a=s,l=new Map,c=l,d=0,m=!1;function x(){c===l&&(c=new Map,l.forEach((y,N)=>{c.set(N,y)}))}function f(){if(m)throw new Error(br(3));return a}function h(y){if(typeof y!="function")throw new Error(br(4));if(m)throw new Error(br(5));let N=!0;x();const S=d++;return c.set(S,y),function(){if(N){if(m)throw new Error(br(6));N=!1,x(),c.delete(S),l=null}}}function g(y){if(!Lv(y))throw new Error(br(7));if(typeof y.type>"u")throw new Error(br(8));if(typeof y.type!="string")throw new Error(br(17));if(m)throw new Error(br(9));try{m=!0,a=r(a,y)}finally{m=!1}return(l=c).forEach(S=>{S()}),y}function u(y){if(typeof y!="function")throw new Error(br(10));r=y,g({type:cm.REPLACE})}function j(){const y=h;return{subscribe(N){if(typeof N!="object"||N===null)throw new Error(br(11));function S(){const w=N;w.next&&w.next(f())}return S(),{unsubscribe:y(S)}},[fN](){return this}}}return g({type:cm.INIT}),{dispatch:g,subscribe:h,getState:f,replaceReducer:u,[fN]:j}}function d_(t){Object.keys(t).forEach(s=>{const n=t[s];if(typeof n(void 0,{type:cm.INIT})>"u")throw new Error(br(12));if(typeof n(void 0,{type:cm.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(br(13))})}function u_(t){const s=Object.keys(t),n={};for(let l=0;l"u")throw d&&d.type,new Error(br(14));x[h]=j,m=m||j!==u}return m=m||r.length!==Object.keys(c).length,m?x:c}}function dm(...t){return t.length===0?s=>s:t.length===1?t[0]:t.reduce((s,n)=>(...r)=>s(n(...r)))}function h_(...t){return s=>(n,r)=>{const a=s(n,r);let l=()=>{throw new Error(br(15))};const c={getState:a.getState,dispatch:(m,...x)=>l(m,...x)},d=t.map(m=>m(c));return l=dm(...d)(a.dispatch),{...a,dispatch:l}}}function m_(t){return Lv(t)&&"type"in t&&typeof t.type=="string"}var yC=Symbol.for("immer-nothing"),pN=Symbol.for("immer-draftable"),Fr=Symbol.for("immer-state");function Ga(t,...s){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var ca=Object,Rc=ca.getPrototypeOf,um="constructor",Mm="prototype",q0="configurable",hm="enumerable",Kh="writable",Vd="value",Zi=t=>!!t&&!!t[Fr];function Qa(t){var s;return t?jC(t)||Bm(t)||!!t[pN]||!!((s=t[um])!=null&&s[pN])||$m(t)||qm(t):!1}var f_=ca[Mm][um].toString(),xN=new WeakMap;function jC(t){if(!t||!Iv(t))return!1;const s=Rc(t);if(s===null||s===ca[Mm])return!0;const n=ca.hasOwnProperty.call(s,um)&&s[um];if(n===Object)return!0;if(!yc(n))return!1;let r=xN.get(n);return r===void 0&&(r=Function.toString.call(n),xN.set(n,r)),r===f_}function Fm(t,s,n=!0){nu(t)===0?(n?Reflect.ownKeys(t):ca.keys(t)).forEach(a=>{s(a,t[a],t)}):t.forEach((r,a)=>s(a,r,t))}function nu(t){const s=t[Fr];return s?s.type_:Bm(t)?1:$m(t)?2:qm(t)?3:0}var gN=(t,s,n=nu(t))=>n===2?t.has(s):ca[Mm].hasOwnProperty.call(t,s),z0=(t,s,n=nu(t))=>n===2?t.get(s):t[s],mm=(t,s,n,r=nu(t))=>{r===2?t.set(s,n):r===3?t.add(n):t[s]=n};function p_(t,s){return t===s?t!==0||1/t===1/s:t!==t&&s!==s}var Bm=Array.isArray,$m=t=>t instanceof Map,qm=t=>t instanceof Set,Iv=t=>typeof t=="object",yc=t=>typeof t=="function",vx=t=>typeof t=="boolean";function x_(t){const s=+t;return Number.isInteger(s)&&String(s)===t}var Vi=t=>t.copy_||t.base_,Mv=t=>t.modified_?t.copy_:t.base_;function U0(t,s){if($m(t))return new Map(t);if(qm(t))return new Set(t);if(Bm(t))return Array[Mm].slice.call(t);const n=jC(t);if(s===!0||s==="class_only"&&!n){const r=ca.getOwnPropertyDescriptors(t);delete r[Fr];let a=Reflect.ownKeys(r);for(let l=0;l1&&ca.defineProperties(t,{set:Nh,add:Nh,clear:Nh,delete:Nh}),ca.freeze(t),s&&Fm(t,(n,r)=>{Fv(r,!0)},!1)),t}function g_(){Ga(2)}var Nh={[Vd]:g_};function zm(t){return t===null||!Iv(t)?!0:ca.isFrozen(t)}var fm="MapSet",V0="Patches",vN="ArrayMethods",NC={};function Io(t){const s=NC[t];return s||Ga(0,t),s}var bN=t=>!!NC[t],Hd,wC=()=>Hd,v_=(t,s)=>({drafts_:[],parent_:t,immer_:s,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:bN(fm)?Io(fm):void 0,arrayMethodsPlugin_:bN(vN)?Io(vN):void 0});function yN(t,s){s&&(t.patchPlugin_=Io(V0),t.patches_=[],t.inversePatches_=[],t.patchListener_=s)}function H0(t){W0(t),t.drafts_.forEach(b_),t.drafts_=null}function W0(t){t===Hd&&(Hd=t.parent_)}var jN=t=>Hd=v_(Hd,t);function b_(t){const s=t[Fr];s.type_===0||s.type_===1?s.revoke_():s.revoked_=!0}function NN(t,s){s.unfinalizedDrafts_=s.drafts_.length;const n=s.drafts_[0];if(t!==void 0&&t!==n){n[Fr].modified_&&(H0(s),Ga(4)),Qa(t)&&(t=wN(s,t));const{patchPlugin_:a}=s;a&&a.generateReplacementPatches_(n[Fr].base_,t,s)}else t=wN(s,n);return y_(s,t,!0),H0(s),s.patches_&&s.patchListener_(s.patches_,s.inversePatches_),t!==yC?t:void 0}function wN(t,s){if(zm(s))return s;const n=s[Fr];if(!n)return pm(s,t.handledSet_,t);if(!Um(n,t))return s;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(t);AC(n,t)}return n.copy_}function y_(t,s,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Fv(s,n)}function SC(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var Um=(t,s)=>t.scope_===s,j_=[];function CC(t,s,n,r){const a=Vi(t),l=t.type_;if(r!==void 0&&z0(a,r,l)===s){mm(a,r,n,l);return}if(!t.draftLocations_){const d=t.draftLocations_=new Map;Fm(a,(m,x)=>{if(Zi(x)){const f=d.get(x)||[];f.push(m),d.set(x,f)}})}const c=t.draftLocations_.get(s)??j_;for(const d of c)mm(a,d,n,l)}function N_(t,s,n){t.callbacks_.push(function(a){var d;const l=s;if(!l||!Um(l,a))return;(d=a.mapSetPlugin_)==null||d.fixSetContents(l);const c=Mv(l);CC(t,l.draft_??l,c,n),AC(l,a)})}function AC(t,s){var r;if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(((r=t.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:a}=s;if(a){const l=a.getPath(t);l&&a.generatePatches_(t,l,s)}SC(t)}}function w_(t,s,n){const{scope_:r}=t;if(Zi(n)){const a=n[Fr];Um(a,r)&&a.callbacks_.push(function(){Gh(t);const c=Mv(a);CC(t,n,c,s)})}else Qa(n)&&t.callbacks_.push(function(){const l=Vi(t);t.type_===3?l.has(n)&&pm(n,r.handledSet_,r):z0(l,s,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(s)??!1)===!0&&t.copy_&&pm(z0(t.copy_,s,t.type_),r.handledSet_,r)})}function pm(t,s,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Zi(t)||s.has(t)||!Qa(t)||zm(t)||(s.add(t),Fm(t,(r,a)=>{if(Zi(a)){const l=a[Fr];if(Um(l,n)){const c=Mv(l);mm(t,r,c,t.type_),SC(l)}}else Qa(a)&&pm(a,s,n)})),t}function S_(t,s){const n=Bm(t),r={type_:n?1:0,scope_:s?s.scope_:wC(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:s,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let a=r,l=xm;n&&(a=[r],l=Wd);const{revoke:c,proxy:d}=Proxy.revocable(a,l);return r.draft_=d,r.revoke_=c,[d,r]}var xm={get(t,s){if(s===Fr)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof s=="string";if(r&&n!=null&&n.isArrayOperationMethod(s))return n.createMethodInterceptor(t,s);const a=Vi(t);if(!gN(a,s,t.type_))return C_(t,a,s);const l=a[s];if(t.finalized_||!Qa(l)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&x_(s))return l;if(l===bx(t.base_,s)){Gh(t);const c=t.type_===1?+s:s,d=G0(t.scope_,l,t,c);return t.copy_[c]=d}return l},has(t,s){return s in Vi(t)},ownKeys(t){return Reflect.ownKeys(Vi(t))},set(t,s,n){const r=kC(Vi(t),s);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const a=bx(Vi(t),s),l=a==null?void 0:a[Fr];if(l&&l.base_===n)return t.copy_[s]=n,t.assigned_.set(s,!1),!0;if(p_(n,a)&&(n!==void 0||gN(t.base_,s,t.type_)))return!0;Gh(t),K0(t)}return t.copy_[s]===n&&(n!==void 0||s in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[s])||(t.copy_[s]=n,t.assigned_.set(s,!0),w_(t,s,n)),!0},deleteProperty(t,s){return Gh(t),bx(t.base_,s)!==void 0||s in t.base_?(t.assigned_.set(s,!1),K0(t)):t.assigned_.delete(s),t.copy_&&delete t.copy_[s],!0},getOwnPropertyDescriptor(t,s){const n=Vi(t),r=Reflect.getOwnPropertyDescriptor(n,s);return r&&{[Kh]:!0,[q0]:t.type_!==1||s!=="length",[hm]:r[hm],[Vd]:n[s]}},defineProperty(){Ga(11)},getPrototypeOf(t){return Rc(t.base_)},setPrototypeOf(){Ga(12)}},Wd={};for(let t in xm){let s=xm[t];Wd[t]=function(){const n=arguments;return n[0]=n[0][0],s.apply(this,n)}}Wd.deleteProperty=function(t,s){return Wd.set.call(this,t,s,void 0)};Wd.set=function(t,s,n){return xm.set.call(this,t[0],s,n,t[0])};function bx(t,s){const n=t[Fr];return(n?Vi(n):t)[s]}function C_(t,s,n){var a;const r=kC(s,n);return r?Vd in r?r[Vd]:(a=r.get)==null?void 0:a.call(t.draft_):void 0}function kC(t,s){if(!(s in t))return;let n=Rc(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,s);if(r)return r;n=Rc(n)}}function K0(t){t.modified_||(t.modified_=!0,t.parent_&&K0(t.parent_))}function Gh(t){t.copy_||(t.assigned_=new Map,t.copy_=U0(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var A_=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(s,n,r)=>{if(yc(s)&&!yc(n)){const l=n;n=s;const c=this;return function(m=l,...x){return c.produce(m,f=>n.call(this,f,...x))}}yc(n)||Ga(6),r!==void 0&&!yc(r)&&Ga(7);let a;if(Qa(s)){const l=jN(this),c=G0(l,s,void 0);let d=!0;try{a=n(c),d=!1}finally{d?H0(l):W0(l)}return yN(l,r),NN(a,l)}else if(!s||!Iv(s)){if(a=n(s),a===void 0&&(a=s),a===yC&&(a=void 0),this.autoFreeze_&&Fv(a,!0),r){const l=[],c=[];Io(V0).generateReplacementPatches_(s,a,{patches_:l,inversePatches_:c}),r(l,c)}return a}else Ga(1,s)},this.produceWithPatches=(s,n)=>{if(yc(s))return(c,...d)=>this.produceWithPatches(c,m=>s(m,...d));let r,a;return[this.produce(s,n,(c,d)=>{r=c,a=d}),r,a]},vx(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),vx(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),vx(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Qa(t)||Ga(8),Zi(t)&&(t=k_(t));const s=jN(this),n=G0(s,t,void 0);return n[Fr].isManual_=!0,W0(s),n}finishDraft(t,s){const n=t&&t[Fr];(!n||!n.isManual_)&&Ga(9);const{scope_:r}=n;return yN(r,s),NN(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,s){let n;for(n=s.length-1;n>=0;n--){const a=s[n];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}n>-1&&(s=s.slice(n+1));const r=Io(V0).applyPatches_;return Zi(t)?r(t,s):this.produce(t,a=>r(a,s))}};function G0(t,s,n,r){const[a,l]=$m(s)?Io(fm).proxyMap_(s,n):qm(s)?Io(fm).proxySet_(s,n):S_(s,n);return((n==null?void 0:n.scope_)??wC()).drafts_.push(a),l.callbacks_=(n==null?void 0:n.callbacks_)??[],l.key_=r,n&&r!==void 0?N_(n,l,r):l.callbacks_.push(function(m){var f;(f=m.mapSetPlugin_)==null||f.fixSetContents(l);const{patchPlugin_:x}=m;l.modified_&&x&&x.generatePatches_(l,[],m)}),a}function k_(t){return Zi(t)||Ga(10,t),RC(t)}function RC(t){if(!Qa(t)||zm(t))return t;const s=t[Fr];let n,r=!0;if(s){if(!s.modified_)return s.base_;s.finalized_=!0,n=U0(t,s.scope_.immer_.useStrictShallowCopy_),r=s.scope_.immer_.shouldUseStrictIteration()}else n=U0(t,!0);return Fm(n,(a,l)=>{mm(n,a,RC(l))},r),s&&(s.finalized_=!1),n}var R_=new A_,EC=R_.produce;function DC(t){return({dispatch:n,getState:r})=>a=>l=>typeof l=="function"?l(n,r,t):a(l)}var E_=DC(),D_=DC,T_=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?dm:dm.apply(null,arguments)},__=t=>t&&typeof t.match=="function";function Bd(t,s){function n(...r){if(s){let a=s(...r);if(!a)throw new Error(Ki(0));return{type:t,payload:a.payload,..."meta"in a&&{meta:a.meta},..."error"in a&&{error:a.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>m_(r)&&r.type===t,n}var TC=class Td extends Array{constructor(...s){super(...s),Object.setPrototypeOf(this,Td.prototype)}static get[Symbol.species](){return Td}concat(...s){return super.concat.apply(this,s)}prepend(...s){return s.length===1&&Array.isArray(s[0])?new Td(...s[0].concat(this)):new Td(...s.concat(this))}};function SN(t){return Qa(t)?EC(t,()=>{}):t}function wh(t,s,n){return t.has(s)?t.get(s):t.set(s,n(s)).get(s)}function P_(t){return typeof t=="boolean"}var O_=()=>function(s){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:a=!0,actionCreatorCheck:l=!0}=s??{};let c=new TC;return n&&(P_(n)?c.push(E_):c.push(D_(n.extraArgument))),c},L_="RTK_autoBatch",CN=t=>s=>{setTimeout(s,t)},I_=(t={type:"raf"})=>s=>(...n)=>{const r=s(...n);let a=!0,l=!1,c=!1;const d=new Set,m=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:CN(10):t.type==="callback"?t.queueNotification:CN(t.timeout),x=()=>{c=!1,l&&(l=!1,d.forEach(f=>f()))};return Object.assign({},r,{subscribe(f){const h=()=>a&&f(),g=r.subscribe(h);return d.add(f),()=>{g(),d.delete(f)}},dispatch(f){var h;try{return a=!((h=f==null?void 0:f.meta)!=null&&h[L_]),l=!a,l&&(c||(c=!0,m(x))),r.dispatch(f)}finally{a=!0}}})},M_=t=>function(n){const{autoBatch:r=!0}=n??{};let a=new TC(t);return r&&a.push(I_(typeof r=="object"?r:void 0)),a};function F_(t){const s=O_(),{reducer:n=void 0,middleware:r,devTools:a=!0,preloadedState:l=void 0,enhancers:c=void 0}=t||{};let d;if(typeof n=="function")d=n;else if(Lv(n))d=u_(n);else throw new Error(Ki(1));let m;typeof r=="function"?m=r(s):m=s();let x=dm;a&&(x=T_({trace:!1,...typeof a=="object"&&a}));const f=h_(...m),h=M_(f);let g=typeof c=="function"?c(h):h();const u=x(...g);return bC(d,l,u)}function _C(t){const s={},n=[];let r;const a={addCase(l,c){const d=typeof l=="string"?l:l.type;if(!d)throw new Error(Ki(28));if(d in s)throw new Error(Ki(29));return s[d]=c,a},addAsyncThunk(l,c){return c.pending&&(s[l.pending.type]=c.pending),c.rejected&&(s[l.rejected.type]=c.rejected),c.fulfilled&&(s[l.fulfilled.type]=c.fulfilled),c.settled&&n.push({matcher:l.settled,reducer:c.settled}),a},addMatcher(l,c){return n.push({matcher:l,reducer:c}),a},addDefaultCase(l){return r=l,a}};return t(a),[s,n,r]}function B_(t){return typeof t=="function"}function $_(t,s){let[n,r,a]=_C(s),l;if(B_(t))l=()=>SN(t());else{const d=SN(t);l=()=>d}function c(d=l(),m){let x=[n[m.type],...r.filter(({matcher:f})=>f(m)).map(({reducer:f})=>f)];return x.filter(f=>!!f).length===0&&(x=[a]),x.reduce((f,h)=>{if(h)if(Zi(f)){const u=h(f,m);return u===void 0?f:u}else{if(Qa(f))return EC(f,g=>h(g,m));{const g=h(f,m);if(g===void 0){if(f===null)return f;throw Error("A case reducer on a non-draftable value must not return undefined")}return g}}return f},d)}return c.getInitialState=l,c}var q_=(t,s)=>__(t)?t.match(s):t(s);function z_(...t){return s=>t.some(n=>q_(n,s))}var U_="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",V_=(t=21)=>{let s="",n=t;for(;n--;)s+=U_[Math.random()*64|0];return s},H_=["name","message","stack","code"],yx=class{constructor(t,s){lx(this,"_type");this.payload=t,this.meta=s}},AN=class{constructor(t,s){lx(this,"_type");this.payload=t,this.meta=s}},W_=t=>{if(typeof t=="object"&&t!==null){const s={};for(const n of H_)typeof t[n]=="string"&&(s[n]=t[n]);return s}return{message:String(t)}},kN="External signal was aborted",K_=(()=>{function t(s,n,r){const a=Bd(s+"/fulfilled",(m,x,f,h)=>({payload:m,meta:{...h||{},arg:f,requestId:x,requestStatus:"fulfilled"}})),l=Bd(s+"/pending",(m,x,f)=>({payload:void 0,meta:{...f||{},arg:x,requestId:m,requestStatus:"pending"}})),c=Bd(s+"/rejected",(m,x,f,h,g)=>({payload:h,error:(r&&r.serializeError||W_)(m||"Rejected"),meta:{...g||{},arg:f,requestId:x,rejectedWithValue:!!h,requestStatus:"rejected",aborted:(m==null?void 0:m.name)==="AbortError",condition:(m==null?void 0:m.name)==="ConditionError"}}));function d(m,{signal:x}={}){return(f,h,g)=>{const u=r!=null&&r.idGenerator?r.idGenerator(m):V_(),j=new AbortController;let p,y;function N(A){y=A,j.abort()}x&&(x.aborted?N(kN):x.addEventListener("abort",()=>N(kN),{once:!0}));const S=(async function(){var E,T;let A;try{let C=(E=r==null?void 0:r.condition)==null?void 0:E.call(r,m,{getState:h,extra:g});if(Y_(C)&&(C=await C),C===!1||j.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const L=new Promise(($,_)=>{p=()=>{_({name:"AbortError",message:y||"Aborted"})},j.signal.addEventListener("abort",p,{once:!0})});f(l(u,m,(T=r==null?void 0:r.getPendingMeta)==null?void 0:T.call(r,{requestId:u,arg:m},{getState:h,extra:g}))),A=await Promise.race([L,Promise.resolve(n(m,{dispatch:f,getState:h,extra:g,requestId:u,signal:j.signal,abort:N,rejectWithValue:($,_)=>new yx($,_),fulfillWithValue:($,_)=>new AN($,_)})).then($=>{if($ instanceof yx)throw $;return $ instanceof AN?a($.payload,u,m,$.meta):a($,u,m)})])}catch(C){A=C instanceof yx?c(null,u,m,C.payload,C.meta):c(C,u,m)}finally{p&&j.signal.removeEventListener("abort",p)}return r&&!r.dispatchConditionRejection&&c.match(A)&&A.meta.condition||f(A),A})();return Object.assign(S,{abort:N,requestId:u,arg:m,unwrap(){return S.then(G_)}})}}return Object.assign(d,{pending:l,rejected:c,fulfilled:a,settled:z_(c,a),typePrefix:s})}return t.withTypes=()=>t,t})();function G_(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}function Y_(t){return t!==null&&typeof t=="object"&&typeof t.then=="function"}var Z_=Symbol.for("rtk-slice-createasyncthunk");function Q_(t,s){return`${t}/${s}`}function X_({creators:t}={}){var n;const s=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[Z_];return function(a){const{name:l,reducerPath:c=l}=a;if(!l)throw new Error(Ki(11));const d=(typeof a.reducers=="function"?a.reducers(eP()):a.reducers)||{},m=Object.keys(d),x={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},f={addCase(w,E){const T=typeof w=="string"?w:w.type;if(!T)throw new Error(Ki(12));if(T in x.sliceCaseReducersByType)throw new Error(Ki(13));return x.sliceCaseReducersByType[T]=E,f},addMatcher(w,E){return x.sliceMatchers.push({matcher:w,reducer:E}),f},exposeAction(w,E){return x.actionCreators[w]=E,f},exposeCaseReducer(w,E){return x.sliceCaseReducersByName[w]=E,f}};m.forEach(w=>{const E=d[w],T={reducerName:w,type:Q_(l,w),createNotation:typeof a.reducers=="function"};sP(E)?rP(T,E,f,s):tP(T,E,f)});function h(){const[w={},E=[],T=void 0]=typeof a.extraReducers=="function"?_C(a.extraReducers):[a.extraReducers],C={...w,...x.sliceCaseReducersByType};return $_(a.initialState,L=>{for(let $ in C)L.addCase($,C[$]);for(let $ of x.sliceMatchers)L.addMatcher($.matcher,$.reducer);for(let $ of E)L.addMatcher($.matcher,$.reducer);T&&L.addDefaultCase(T)})}const g=w=>w,u=new Map,j=new WeakMap;let p;function y(w,E){return p||(p=h()),p(w,E)}function N(){return p||(p=h()),p.getInitialState()}function S(w,E=!1){function T(L){let $=L[w];return typeof $>"u"&&E&&($=wh(j,T,N)),$}function C(L=g){const $=wh(u,E,()=>new WeakMap);return wh($,L,()=>{const _={};for(const[R,P]of Object.entries(a.selectors??{}))_[R]=J_(P,L,()=>wh(j,L,N),E);return _})}return{reducerPath:w,getSelectors:C,get selectors(){return C(T)},selectSlice:T}}const A={name:l,reducer:y,actions:x.actionCreators,caseReducers:x.sliceCaseReducersByName,getInitialState:N,...S(c),injectInto(w,{reducerPath:E,...T}={}){const C=E??c;return w.inject({reducerPath:C,reducer:y},T),{...A,...S(C,!0)}}};return A}}function J_(t,s,n,r){function a(l,...c){let d=s(l);return typeof d>"u"&&r&&(d=n()),t(d,...c)}return a.unwrapped=t,a}var PC=X_();function eP(){function t(s,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:s,...n}}return t.withTypes=()=>t,{reducer(s){return Object.assign({[s.name](...n){return s(...n)}}[s.name],{_reducerDefinitionType:"reducer"})},preparedReducer(s,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:s,reducer:n}},asyncThunk:t}}function tP({type:t,reducerName:s,createNotation:n},r,a){let l,c;if("reducer"in r){if(n&&!nP(r))throw new Error(Ki(17));l=r.reducer,c=r.prepare}else l=r;a.addCase(t,l).exposeCaseReducer(s,l).exposeAction(s,c?Bd(t,c):Bd(t))}function sP(t){return t._reducerDefinitionType==="asyncThunk"}function nP(t){return t._reducerDefinitionType==="reducerWithPrepare"}function rP({type:t,reducerName:s},n,r,a){if(!a)throw new Error(Ki(18));const{payloadCreator:l,fulfilled:c,pending:d,rejected:m,settled:x,options:f}=n,h=a(t,l,f);r.exposeAction(s,h),c&&r.addCase(h.fulfilled,c),d&&r.addCase(h.pending,d),m&&r.addCase(h.rejected,m),x&&r.addMatcher(h.settled,x),r.exposeCaseReducer(s,{fulfilled:c||Sh,pending:d||Sh,rejected:m||Sh,settled:x||Sh})}function Sh(){}function Ki(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var cr={};/*! Axios v1.13.6 Copyright (c) 2026 Matt Zabriskie and contributors */var jx,RN;function aP(){if(RN)return jx;RN=1;function t(J,te){return function(){return J.apply(te,arguments)}}const{toString:s}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:r,toStringTag:a}=Symbol,l=(J=>te=>{const ue=s.call(te);return J[ue]||(J[ue]=ue.slice(8,-1).toLowerCase())})(Object.create(null)),c=J=>(J=J.toLowerCase(),te=>l(te)===J),d=J=>te=>typeof te===J,{isArray:m}=Array,x=d("undefined");function f(J){return J!==null&&!x(J)&&J.constructor!==null&&!x(J.constructor)&&j(J.constructor.isBuffer)&&J.constructor.isBuffer(J)}const h=c("ArrayBuffer");function g(J){let te;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?te=ArrayBuffer.isView(J):te=J&&J.buffer&&h(J.buffer),te}const u=d("string"),j=d("function"),p=d("number"),y=J=>J!==null&&typeof J=="object",N=J=>J===!0||J===!1,S=J=>{if(l(J)!=="object")return!1;const te=n(J);return(te===null||te===Object.prototype||Object.getPrototypeOf(te)===null)&&!(a in J)&&!(r in J)},A=J=>{if(!y(J)||f(J))return!1;try{return Object.keys(J).length===0&&Object.getPrototypeOf(J)===Object.prototype}catch{return!1}},w=c("Date"),E=c("File"),T=J=>!!(J&&typeof J.uri<"u"),C=J=>J&&typeof J.getParts<"u",L=c("Blob"),$=c("FileList"),_=J=>y(J)&&j(J.pipe);function R(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof Eo<"u"?Eo:{}}const P=R(),M=typeof P.FormData<"u"?P.FormData:void 0,q=J=>{let te;return J&&(M&&J instanceof M||j(J.append)&&((te=l(J))==="formdata"||te==="object"&&j(J.toString)&&J.toString()==="[object FormData]"))},K=c("URLSearchParams"),[Z,W,U,F]=["ReadableStream","Request","Response","Headers"].map(c),B=J=>J.trim?J.trim():J.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function D(J,te,{allOwnKeys:ue=!1}={}){if(J===null||typeof J>"u")return;let xe,we;if(typeof J!="object"&&(J=[J]),m(J))for(xe=0,we=J.length;xe0;)if(we=ue[xe],te===we.toLowerCase())return we;return null}const z=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:Eo,G=J=>!x(J)&&J!==z;function Y(){const{caseless:J,skipUndefined:te}=G(this)&&this||{},ue={},xe=(we,$e)=>{if($e==="__proto__"||$e==="constructor"||$e==="prototype")return;const Be=J&&O(ue,$e)||$e;S(ue[Be])&&S(we)?ue[Be]=Y(ue[Be],we):S(we)?ue[Be]=Y({},we):m(we)?ue[Be]=we.slice():(!te||!x(we))&&(ue[Be]=we)};for(let we=0,$e=arguments.length;we<$e;we++)arguments[we]&&D(arguments[we],xe);return ue}const V=(J,te,ue,{allOwnKeys:xe}={})=>(D(te,(we,$e)=>{ue&&j(we)?Object.defineProperty(J,$e,{value:t(we,ue),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(J,$e,{value:we,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:xe}),J),X=J=>(J.charCodeAt(0)===65279&&(J=J.slice(1)),J),ne=(J,te,ue,xe)=>{J.prototype=Object.create(te.prototype,xe),Object.defineProperty(J.prototype,"constructor",{value:J,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(J,"super",{value:te.prototype}),ue&&Object.assign(J.prototype,ue)},oe=(J,te,ue,xe)=>{let we,$e,Be;const lt={};if(te=te||{},J==null)return te;do{for(we=Object.getOwnPropertyNames(J),$e=we.length;$e-- >0;)Be=we[$e],(!xe||xe(Be,J,te))&&!lt[Be]&&(te[Be]=J[Be],lt[Be]=!0);J=ue!==!1&&n(J)}while(J&&(!ue||ue(J,te))&&J!==Object.prototype);return te},re=(J,te,ue)=>{J=String(J),(ue===void 0||ue>J.length)&&(ue=J.length),ue-=te.length;const xe=J.indexOf(te,ue);return xe!==-1&&xe===ue},ge=J=>{if(!J)return null;if(m(J))return J;let te=J.length;if(!p(te))return null;const ue=new Array(te);for(;te-- >0;)ue[te]=J[te];return ue},ve=(J=>te=>J&&te instanceof J)(typeof Uint8Array<"u"&&n(Uint8Array)),Se=(J,te)=>{const xe=(J&&J[r]).call(J);let we;for(;(we=xe.next())&&!we.done;){const $e=we.value;te.call(J,$e[0],$e[1])}},We=(J,te)=>{let ue;const xe=[];for(;(ue=J.exec(te))!==null;)xe.push(ue);return xe},Ce=c("HTMLFormElement"),fe=J=>J.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(ue,xe,we){return xe.toUpperCase()+we}),Ye=(({hasOwnProperty:J})=>(te,ue)=>J.call(te,ue))(Object.prototype),be=c("RegExp"),Pe=(J,te)=>{const ue=Object.getOwnPropertyDescriptors(J),xe={};D(ue,(we,$e)=>{let Be;(Be=te(we,$e,J))!==!1&&(xe[$e]=Be||we)}),Object.defineProperties(J,xe)},ke=J=>{Pe(J,(te,ue)=>{if(j(J)&&["arguments","caller","callee"].indexOf(ue)!==-1)return!1;const xe=J[ue];if(j(xe)){if(te.enumerable=!1,"writable"in te){te.writable=!1;return}te.set||(te.set=()=>{throw Error("Can not rewrite read-only method '"+ue+"'")})}})},qe=(J,te)=>{const ue={},xe=we=>{we.forEach($e=>{ue[$e]=!0})};return m(J)?xe(J):xe(String(J).split(te)),ue},Ve=()=>{},dt=(J,te)=>J!=null&&Number.isFinite(J=+J)?J:te;function xt(J){return!!(J&&j(J.append)&&J[a]==="FormData"&&J[r])}const ye=J=>{const te=new Array(10),ue=(xe,we)=>{if(y(xe)){if(te.indexOf(xe)>=0)return;if(f(xe))return xe;if(!("toJSON"in xe)){te[we]=xe;const $e=m(xe)?[]:{};return D(xe,(Be,lt)=>{const Jt=ue(Be,we+1);!x(Jt)&&($e[lt]=Jt)}),te[we]=void 0,$e}}return xe};return ue(J,0)},le=c("AsyncFunction"),Qe=J=>J&&(y(J)||j(J))&&j(J.then)&&j(J.catch),rt=((J,te)=>J?setImmediate:te?((ue,xe)=>(z.addEventListener("message",({source:we,data:$e})=>{we===z&&$e===ue&&xe.length&&xe.shift()()},!1),we=>{xe.push(we),z.postMessage(ue,"*")}))(`axios@${Math.random()}`,[]):ue=>setTimeout(ue))(typeof setImmediate=="function",j(z.postMessage)),Gt=typeof queueMicrotask<"u"?queueMicrotask.bind(z):typeof process<"u"&&process.nextTick||rt;var Re={isArray:m,isArrayBuffer:h,isBuffer:f,isFormData:q,isArrayBufferView:g,isString:u,isNumber:p,isBoolean:N,isObject:y,isPlainObject:S,isEmptyObject:A,isReadableStream:Z,isRequest:W,isResponse:U,isHeaders:F,isUndefined:x,isDate:w,isFile:E,isReactNativeBlob:T,isReactNative:C,isBlob:L,isRegExp:be,isFunction:j,isStream:_,isURLSearchParams:K,isTypedArray:ve,isFileList:$,forEach:D,merge:Y,extend:V,trim:B,stripBOM:X,inherits:ne,toFlatObject:oe,kindOf:l,kindOfTest:c,endsWith:re,toArray:ge,forEachEntry:Se,matchAll:We,isHTMLForm:Ce,hasOwnProperty:Ye,hasOwnProp:Ye,reduceDescriptors:Pe,freezeMethods:ke,toObjectSet:qe,toCamelCase:fe,noop:Ve,toFiniteNumber:dt,findKey:O,global:z,isContextDefined:G,isSpecCompliantForm:xt,toJSONObject:ye,isAsyncFn:le,isThenable:Qe,setImmediate:rt,asap:Gt,isIterable:J=>J!=null&&j(J[r])};class Qt extends Error{static from(te,ue,xe,we,$e,Be){const lt=new Qt(te.message,ue||te.code,xe,we,$e);return lt.cause=te,lt.name=te.name,te.status!=null&<.status==null&&(lt.status=te.status),Be&&Object.assign(lt,Be),lt}constructor(te,ue,xe,we,$e){super(te),Object.defineProperty(this,"message",{value:te,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,ue&&(this.code=ue),xe&&(this.config=xe),we&&(this.request=we),$e&&(this.response=$e,this.status=$e.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Re.toJSONObject(this.config),code:this.code,status:this.status}}}Qt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Qt.ERR_BAD_OPTION="ERR_BAD_OPTION",Qt.ECONNABORTED="ECONNABORTED",Qt.ETIMEDOUT="ETIMEDOUT",Qt.ERR_NETWORK="ERR_NETWORK",Qt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Qt.ERR_DEPRECATED="ERR_DEPRECATED",Qt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Qt.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Qt.ERR_CANCELED="ERR_CANCELED",Qt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Qt.ERR_INVALID_URL="ERR_INVALID_URL";var qt=Qt,ws=null;function Ps(J){return Re.isPlainObject(J)||Re.isArray(J)}function ns(J){return Re.endsWith(J,"[]")?J.slice(0,-2):J}function Cs(J,te,ue){return J?J.concat(te).map(function(we,$e){return we=ns(we),!ue&&$e?"["+we+"]":we}).join(ue?".":""):te}function Bs(J){return Re.isArray(J)&&!J.some(Ps)}const Ft=Re.toFlatObject(Re,{},null,function(te){return/^is[A-Z]/.test(te)});function ie(J,te,ue){if(!Re.isObject(J))throw new TypeError("target must be an object");te=te||new FormData,ue=Re.toFlatObject(ue,{metaTokens:!0,dots:!1,indexes:!1},!1,function(bs,es){return!Re.isUndefined(es[bs])});const xe=ue.metaTokens,we=ue.visitor||Et,$e=ue.dots,Be=ue.indexes,Jt=(ue.Blob||typeof Blob<"u"&&Blob)&&Re.isSpecCompliantForm(te);if(!Re.isFunction(we))throw new TypeError("visitor must be a function");function Mt(Ot){if(Ot===null)return"";if(Re.isDate(Ot))return Ot.toISOString();if(Re.isBoolean(Ot))return Ot.toString();if(!Jt&&Re.isBlob(Ot))throw new qt("Blob is not supported. Use a Buffer instead.");return Re.isArrayBuffer(Ot)||Re.isTypedArray(Ot)?Jt&&typeof Blob=="function"?new Blob([Ot]):Buffer.from(Ot):Ot}function Et(Ot,bs,es){let Sn=Ot;if(Re.isReactNative(te)&&Re.isReactNativeBlob(Ot))return te.append(Cs(es,bs,$e),Mt(Ot)),!1;if(Ot&&!es&&typeof Ot=="object"){if(Re.endsWith(bs,"{}"))bs=xe?bs:bs.slice(0,-2),Ot=JSON.stringify(Ot);else if(Re.isArray(Ot)&&Bs(Ot)||(Re.isFileList(Ot)||Re.endsWith(bs,"[]"))&&(Sn=Re.toArray(Ot)))return bs=ns(bs),Sn.forEach(function(Dn,nr){!(Re.isUndefined(Dn)||Dn===null)&&te.append(Be===!0?Cs([bs],nr,$e):Be===null?bs:bs+"[]",Mt(Dn))}),!1}return Ps(Ot)?!0:(te.append(Cs(es,bs,$e),Mt(Ot)),!1)}const gs=[],tn=Object.assign(Ft,{defaultVisitor:Et,convertValue:Mt,isVisitable:Ps});function Hn(Ot,bs){if(!Re.isUndefined(Ot)){if(gs.indexOf(Ot)!==-1)throw Error("Circular reference detected in "+bs.join("."));gs.push(Ot),Re.forEach(Ot,function(Sn,xr){(!(Re.isUndefined(Sn)||Sn===null)&&we.call(te,Sn,Re.isString(xr)?xr.trim():xr,bs,tn))===!0&&Hn(Sn,bs?bs.concat(xr):[xr])}),gs.pop()}}if(!Re.isObject(J))throw new TypeError("data must be an object");return Hn(J),te}function Fe(J){const te={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(J).replace(/[!'()~]|%20|%00/g,function(xe){return te[xe]})}function Q(J,te){this._pairs=[],J&&ie(J,this,te)}const pe=Q.prototype;pe.append=function(te,ue){this._pairs.push([te,ue])},pe.toString=function(te){const ue=te?function(xe){return te.call(this,xe,Fe)}:Fe;return this._pairs.map(function(we){return ue(we[0])+"="+ue(we[1])},"").join("&")};function Ne(J){return encodeURIComponent(J).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ee(J,te,ue){if(!te)return J;const xe=ue&&ue.encode||Ne,we=Re.isFunction(ue)?{serialize:ue}:ue,$e=we&&we.serialize;let Be;if($e?Be=$e(te,we):Be=Re.isURLSearchParams(te)?te.toString():new Q(te,we).toString(xe),Be){const lt=J.indexOf("#");lt!==-1&&(J=J.slice(0,lt)),J+=(J.indexOf("?")===-1?"?":"&")+Be}return J}class it{constructor(){this.handlers=[]}use(te,ue,xe){return this.handlers.push({fulfilled:te,rejected:ue,synchronous:xe?xe.synchronous:!1,runWhen:xe?xe.runWhen:null}),this.handlers.length-1}eject(te){this.handlers[te]&&(this.handlers[te]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(te){Re.forEach(this.handlers,function(xe){xe!==null&&te(xe)})}}var st=it,bt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ue=typeof URLSearchParams<"u"?URLSearchParams:Q,It=typeof FormData<"u"?FormData:null,ut=typeof Blob<"u"?Blob:null,yt={isBrowser:!0,classes:{URLSearchParams:Ue,FormData:It,Blob:ut},protocols:["http","https","file","blob","url","data"]};const kt=typeof window<"u"&&typeof document<"u",Le=typeof navigator=="object"&&navigator||void 0,Pt=kt&&(!Le||["ReactNative","NativeScript","NS"].indexOf(Le.product)<0),ht=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zt=kt&&window.location.href||"http://localhost";var rs=Object.freeze({__proto__:null,hasBrowserEnv:kt,hasStandardBrowserWebWorkerEnv:ht,hasStandardBrowserEnv:Pt,navigator:Le,origin:zt}),Yt={...rs,...yt};function Os(J,te){return ie(J,new Yt.classes.URLSearchParams,{visitor:function(ue,xe,we,$e){return Yt.isNode&&Re.isBuffer(ue)?(this.append(xe,ue.toString("base64")),!1):$e.defaultVisitor.apply(this,arguments)},...te})}function Ls(J){return Re.matchAll(/\w+|\[(\w*)]/g,J).map(te=>te[0]==="[]"?"":te[1]||te[0])}function zs(J){const te={},ue=Object.keys(J);let xe;const we=ue.length;let $e;for(xe=0;xe=ue.length;return Be=!Be&&Re.isArray(we)?we.length:Be,Jt?(Re.hasOwnProp(we,Be)?we[Be]=[we[Be],xe]:we[Be]=xe,!lt):((!we[Be]||!Re.isObject(we[Be]))&&(we[Be]=[]),te(ue,xe,we[Be],$e)&&Re.isArray(we[Be])&&(we[Be]=zs(we[Be])),!lt)}if(Re.isFormData(J)&&Re.isFunction(J.entries)){const ue={};return Re.forEachEntry(J,(xe,we)=>{te(Ls(xe),we,ue,0)}),ue}return null}function he(J,te,ue){if(Re.isString(J))try{return(te||JSON.parse)(J),Re.trim(J)}catch(xe){if(xe.name!=="SyntaxError")throw xe}return(ue||JSON.stringify)(J)}const Ke={transitional:bt,adapter:["xhr","http","fetch"],transformRequest:[function(te,ue){const xe=ue.getContentType()||"",we=xe.indexOf("application/json")>-1,$e=Re.isObject(te);if($e&&Re.isHTMLForm(te)&&(te=new FormData(te)),Re.isFormData(te))return we?JSON.stringify(en(te)):te;if(Re.isArrayBuffer(te)||Re.isBuffer(te)||Re.isStream(te)||Re.isFile(te)||Re.isBlob(te)||Re.isReadableStream(te))return te;if(Re.isArrayBufferView(te))return te.buffer;if(Re.isURLSearchParams(te))return ue.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),te.toString();let lt;if($e){if(xe.indexOf("application/x-www-form-urlencoded")>-1)return Os(te,this.formSerializer).toString();if((lt=Re.isFileList(te))||xe.indexOf("multipart/form-data")>-1){const Jt=this.env&&this.env.FormData;return ie(lt?{"files[]":te}:te,Jt&&new Jt,this.formSerializer)}}return $e||we?(ue.setContentType("application/json",!1),he(te)):te}],transformResponse:[function(te){const ue=this.transitional||Ke.transitional,xe=ue&&ue.forcedJSONParsing,we=this.responseType==="json";if(Re.isResponse(te)||Re.isReadableStream(te))return te;if(te&&Re.isString(te)&&(xe&&!this.responseType||we)){const Be=!(ue&&ue.silentJSONParsing)&&we;try{return JSON.parse(te,this.parseReviver)}catch(lt){if(Be)throw lt.name==="SyntaxError"?qt.from(lt,qt.ERR_BAD_RESPONSE,this,null,this.response):lt}}return te}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Yt.classes.FormData,Blob:Yt.classes.Blob},validateStatus:function(te){return te>=200&&te<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Re.forEach(["delete","get","head","post","put","patch"],J=>{Ke.headers[J]={}});var at=Ke;const pt=Re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var mt=J=>{const te={};let ue,xe,we;return J&&J.split(` +`).forEach(function(Be){we=Be.indexOf(":"),ue=Be.substring(0,we).trim().toLowerCase(),xe=Be.substring(we+1).trim(),!(!ue||te[ue]&&pt[ue])&&(ue==="set-cookie"?te[ue]?te[ue].push(xe):te[ue]=[xe]:te[ue]=te[ue]?te[ue]+", "+xe:xe)}),te};const Bt=Symbol("internals");function Ds(J){return J&&String(J).trim().toLowerCase()}function as(J){return J===!1||J==null?J:Re.isArray(J)?J.map(as):String(J)}function Vs(J){const te=Object.create(null),ue=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let xe;for(;xe=ue.exec(J);)te[xe[1]]=xe[2];return te}const Is=J=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(J.trim());function Ts(J,te,ue,xe,we){if(Re.isFunction(xe))return xe.call(this,te,ue);if(we&&(te=ue),!!Re.isString(te)){if(Re.isString(xe))return te.indexOf(xe)!==-1;if(Re.isRegExp(xe))return xe.test(te)}}function ln(J){return J.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(te,ue,xe)=>ue.toUpperCase()+xe)}function pn(J,te){const ue=Re.toCamelCase(" "+te);["get","set","has"].forEach(xe=>{Object.defineProperty(J,xe+ue,{value:function(we,$e,Be){return this[xe].call(this,te,we,$e,Be)},configurable:!0})})}class hn{constructor(te){te&&this.set(te)}set(te,ue,xe){const we=this;function $e(lt,Jt,Mt){const Et=Ds(Jt);if(!Et)throw new Error("header name must be a non-empty string");const gs=Re.findKey(we,Et);(!gs||we[gs]===void 0||Mt===!0||Mt===void 0&&we[gs]!==!1)&&(we[gs||Jt]=as(lt))}const Be=(lt,Jt)=>Re.forEach(lt,(Mt,Et)=>$e(Mt,Et,Jt));if(Re.isPlainObject(te)||te instanceof this.constructor)Be(te,ue);else if(Re.isString(te)&&(te=te.trim())&&!Is(te))Be(mt(te),ue);else if(Re.isObject(te)&&Re.isIterable(te)){let lt={},Jt,Mt;for(const Et of te){if(!Re.isArray(Et))throw TypeError("Object iterator must return a key-value pair");lt[Mt=Et[0]]=(Jt=lt[Mt])?Re.isArray(Jt)?[...Jt,Et[1]]:[Jt,Et[1]]:Et[1]}Be(lt,ue)}else te!=null&&$e(ue,te,xe);return this}get(te,ue){if(te=Ds(te),te){const xe=Re.findKey(this,te);if(xe){const we=this[xe];if(!ue)return we;if(ue===!0)return Vs(we);if(Re.isFunction(ue))return ue.call(this,we,xe);if(Re.isRegExp(ue))return ue.exec(we);throw new TypeError("parser must be boolean|regexp|function")}}}has(te,ue){if(te=Ds(te),te){const xe=Re.findKey(this,te);return!!(xe&&this[xe]!==void 0&&(!ue||Ts(this,this[xe],xe,ue)))}return!1}delete(te,ue){const xe=this;let we=!1;function $e(Be){if(Be=Ds(Be),Be){const lt=Re.findKey(xe,Be);lt&&(!ue||Ts(xe,xe[lt],lt,ue))&&(delete xe[lt],we=!0)}}return Re.isArray(te)?te.forEach($e):$e(te),we}clear(te){const ue=Object.keys(this);let xe=ue.length,we=!1;for(;xe--;){const $e=ue[xe];(!te||Ts(this,this[$e],$e,te,!0))&&(delete this[$e],we=!0)}return we}normalize(te){const ue=this,xe={};return Re.forEach(this,(we,$e)=>{const Be=Re.findKey(xe,$e);if(Be){ue[Be]=as(we),delete ue[$e];return}const lt=te?ln($e):String($e).trim();lt!==$e&&delete ue[$e],ue[lt]=as(we),xe[lt]=!0}),this}concat(...te){return this.constructor.concat(this,...te)}toJSON(te){const ue=Object.create(null);return Re.forEach(this,(xe,we)=>{xe!=null&&xe!==!1&&(ue[we]=te&&Re.isArray(xe)?xe.join(", "):xe)}),ue}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([te,ue])=>te+": "+ue).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(te){return te instanceof this?te:new this(te)}static concat(te,...ue){const xe=new this(te);return ue.forEach(we=>xe.set(we)),xe}static accessor(te){const xe=(this[Bt]=this[Bt]={accessors:{}}).accessors,we=this.prototype;function $e(Be){const lt=Ds(Be);xe[lt]||(pn(we,Be),xe[lt]=!0)}return Re.isArray(te)?te.forEach($e):$e(te),this}}hn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Re.reduceDescriptors(hn.prototype,({value:J},te)=>{let ue=te[0].toUpperCase()+te.slice(1);return{get:()=>J,set(xe){this[ue]=xe}}}),Re.freezeMethods(hn);var Ws=hn;function Qs(J,te){const ue=this||at,xe=te||ue,we=Ws.from(xe.headers);let $e=xe.data;return Re.forEach(J,function(lt){$e=lt.call(ue,$e,we.normalize(),te?te.status:void 0)}),we.normalize(),$e}function zn(J){return!!(J&&J.__CANCEL__)}class on extends qt{constructor(te,ue,xe){super(te??"canceled",qt.ERR_CANCELED,ue,xe),this.name="CanceledError",this.__CANCEL__=!0}}var Un=on;function yr(J,te,ue){const xe=ue.config.validateStatus;!ue.status||!xe||xe(ue.status)?J(ue):te(new qt("Request failed with status code "+ue.status,[qt.ERR_BAD_REQUEST,qt.ERR_BAD_RESPONSE][Math.floor(ue.status/100)-4],ue.config,ue.request,ue))}function Tr(J){const te=/^([-+\w]{1,25})(:?\/\/|:)/.exec(J);return te&&te[1]||""}function er(J,te){J=J||10;const ue=new Array(J),xe=new Array(J);let we=0,$e=0,Be;return te=te!==void 0?te:1e3,function(Jt){const Mt=Date.now(),Et=xe[$e];Be||(Be=Mt),ue[we]=Jt,xe[we]=Mt;let gs=$e,tn=0;for(;gs!==we;)tn+=ue[gs++],gs=gs%J;if(we=(we+1)%J,we===$e&&($e=($e+1)%J),Mt-Be{ue=Et,we=null,$e&&(clearTimeout($e),$e=null),J(...Mt)};return[(...Mt)=>{const Et=Date.now(),gs=Et-ue;gs>=xe?Be(Mt,Et):(we=Mt,$e||($e=setTimeout(()=>{$e=null,Be(we)},xe-gs)))},()=>we&&Be(we)]}const En=(J,te,ue=3)=>{let xe=0;const we=er(50,250);return tr($e=>{const Be=$e.loaded,lt=$e.lengthComputable?$e.total:void 0,Jt=Be-xe,Mt=we(Jt),Et=Be<=lt;xe=Be;const gs={loaded:Be,total:lt,progress:lt?Be/lt:void 0,bytes:Jt,rate:Mt||void 0,estimated:Mt&<&&Et?(lt-Be)/Mt:void 0,event:$e,lengthComputable:lt!=null,[te?"download":"upload"]:!0};J(gs)},ue)},Xe=(J,te)=>{const ue=J!=null;return[xe=>te[0]({lengthComputable:ue,total:J,loaded:xe}),te[1]]},$t=J=>(...te)=>Re.asap(()=>J(...te));var Ze=Yt.hasStandardBrowserEnv?((J,te)=>ue=>(ue=new URL(ue,Yt.origin),J.protocol===ue.protocol&&J.host===ue.host&&(te||J.port===ue.port)))(new URL(Yt.origin),Yt.navigator&&/(msie|trident)/i.test(Yt.navigator.userAgent)):()=>!0,Ut=Yt.hasStandardBrowserEnv?{write(J,te,ue,xe,we,$e,Be){if(typeof document>"u")return;const lt=[`${J}=${encodeURIComponent(te)}`];Re.isNumber(ue)&<.push(`expires=${new Date(ue).toUTCString()}`),Re.isString(xe)&<.push(`path=${xe}`),Re.isString(we)&<.push(`domain=${we}`),$e===!0&<.push("secure"),Re.isString(Be)&<.push(`SameSite=${Be}`),document.cookie=lt.join("; ")},read(J){if(typeof document>"u")return null;const te=document.cookie.match(new RegExp("(?:^|; )"+J+"=([^;]*)"));return te?decodeURIComponent(te[1]):null},remove(J){this.write(J,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function jt(J){return typeof J!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(J)}function Ln(J,te){return te?J.replace(/\/?\/$/,"")+"/"+te.replace(/^\/+/,""):J}function jr(J,te,ue){let xe=!jt(te);return J&&(xe||ue==!1)?Ln(J,te):te}const _r=J=>J instanceof Ws?{...J}:J;function xn(J,te){te=te||{};const ue={};function xe(Mt,Et,gs,tn){return Re.isPlainObject(Mt)&&Re.isPlainObject(Et)?Re.merge.call({caseless:tn},Mt,Et):Re.isPlainObject(Et)?Re.merge({},Et):Re.isArray(Et)?Et.slice():Et}function we(Mt,Et,gs,tn){if(Re.isUndefined(Et)){if(!Re.isUndefined(Mt))return xe(void 0,Mt,gs,tn)}else return xe(Mt,Et,gs,tn)}function $e(Mt,Et){if(!Re.isUndefined(Et))return xe(void 0,Et)}function Be(Mt,Et){if(Re.isUndefined(Et)){if(!Re.isUndefined(Mt))return xe(void 0,Mt)}else return xe(void 0,Et)}function lt(Mt,Et,gs){if(gs in te)return xe(Mt,Et);if(gs in J)return xe(void 0,Mt)}const Jt={url:$e,method:$e,data:$e,baseURL:Be,transformRequest:Be,transformResponse:Be,paramsSerializer:Be,timeout:Be,timeoutMessage:Be,withCredentials:Be,withXSRFToken:Be,adapter:Be,responseType:Be,xsrfCookieName:Be,xsrfHeaderName:Be,onUploadProgress:Be,onDownloadProgress:Be,decompress:Be,maxContentLength:Be,maxBodyLength:Be,beforeRedirect:Be,transport:Be,httpAgent:Be,httpsAgent:Be,cancelToken:Be,socketPath:Be,responseEncoding:Be,validateStatus:lt,headers:(Mt,Et,gs)=>we(_r(Mt),_r(Et),gs,!0)};return Re.forEach(Object.keys({...J,...te}),function(Et){if(Et==="__proto__"||Et==="constructor"||Et==="prototype")return;const gs=Re.hasOwnProp(Jt,Et)?Jt[Et]:we,tn=gs(J[Et],te[Et],Et);Re.isUndefined(tn)&&gs!==lt||(ue[Et]=tn)}),ue}var qs=J=>{const te=xn({},J);let{data:ue,withXSRFToken:xe,xsrfHeaderName:we,xsrfCookieName:$e,headers:Be,auth:lt}=te;if(te.headers=Be=Ws.from(Be),te.url=Ee(jr(te.baseURL,te.url,te.allowAbsoluteUrls),J.params,J.paramsSerializer),lt&&Be.set("Authorization","Basic "+btoa((lt.username||"")+":"+(lt.password?unescape(encodeURIComponent(lt.password)):""))),Re.isFormData(ue)){if(Yt.hasStandardBrowserEnv||Yt.hasStandardBrowserWebWorkerEnv)Be.setContentType(void 0);else if(Re.isFunction(ue.getHeaders)){const Jt=ue.getHeaders(),Mt=["content-type","content-length"];Object.entries(Jt).forEach(([Et,gs])=>{Mt.includes(Et.toLowerCase())&&Be.set(Et,gs)})}}if(Yt.hasStandardBrowserEnv&&(xe&&Re.isFunction(xe)&&(xe=xe(te)),xe||xe!==!1&&Ze(te.url))){const Jt=we&&$e&&Ut.read($e);Jt&&Be.set(we,Jt)}return te},Tt=typeof XMLHttpRequest<"u"&&function(J){return new Promise(function(ue,xe){const we=qs(J);let $e=we.data;const Be=Ws.from(we.headers).normalize();let{responseType:lt,onUploadProgress:Jt,onDownloadProgress:Mt}=we,Et,gs,tn,Hn,Ot;function bs(){Hn&&Hn(),Ot&&Ot(),we.cancelToken&&we.cancelToken.unsubscribe(Et),we.signal&&we.signal.removeEventListener("abort",Et)}let es=new XMLHttpRequest;es.open(we.method.toUpperCase(),we.url,!0),es.timeout=we.timeout;function Sn(){if(!es)return;const Dn=Ws.from("getAllResponseHeaders"in es&&es.getAllResponseHeaders()),Lr={data:!lt||lt==="text"||lt==="json"?es.responseText:es.response,status:es.status,statusText:es.statusText,headers:Dn,config:J,request:es};yr(function(rr){ue(rr),bs()},function(rr){xe(rr),bs()},Lr),es=null}"onloadend"in es?es.onloadend=Sn:es.onreadystatechange=function(){!es||es.readyState!==4||es.status===0&&!(es.responseURL&&es.responseURL.indexOf("file:")===0)||setTimeout(Sn)},es.onabort=function(){es&&(xe(new qt("Request aborted",qt.ECONNABORTED,J,es)),es=null)},es.onerror=function(nr){const Lr=nr&&nr.message?nr.message:"Network Error",La=new qt(Lr,qt.ERR_NETWORK,J,es);La.event=nr||null,xe(La),es=null},es.ontimeout=function(){let nr=we.timeout?"timeout of "+we.timeout+"ms exceeded":"timeout exceeded";const Lr=we.transitional||bt;we.timeoutErrorMessage&&(nr=we.timeoutErrorMessage),xe(new qt(nr,Lr.clarifyTimeoutError?qt.ETIMEDOUT:qt.ECONNABORTED,J,es)),es=null},$e===void 0&&Be.setContentType(null),"setRequestHeader"in es&&Re.forEach(Be.toJSON(),function(nr,Lr){es.setRequestHeader(Lr,nr)}),Re.isUndefined(we.withCredentials)||(es.withCredentials=!!we.withCredentials),lt&<!=="json"&&(es.responseType=we.responseType),Mt&&([tn,Ot]=En(Mt,!0),es.addEventListener("progress",tn)),Jt&&es.upload&&([gs,Hn]=En(Jt),es.upload.addEventListener("progress",gs),es.upload.addEventListener("loadend",Hn)),(we.cancelToken||we.signal)&&(Et=Dn=>{es&&(xe(!Dn||Dn.type?new Un(null,J,es):Dn),es.abort(),es=null)},we.cancelToken&&we.cancelToken.subscribe(Et),we.signal&&(we.signal.aborted?Et():we.signal.addEventListener("abort",Et)));const xr=Tr(we.url);if(xr&&Yt.protocols.indexOf(xr)===-1){xe(new qt("Unsupported protocol "+xr+":",qt.ERR_BAD_REQUEST,J));return}es.send($e||null)})},Vr=(J,te)=>{const{length:ue}=J=J?J.filter(Boolean):[];if(te||ue){let xe=new AbortController,we;const $e=function(Mt){if(!we){we=!0,lt();const Et=Mt instanceof Error?Mt:this.reason;xe.abort(Et instanceof qt?Et:new Un(Et instanceof Error?Et.message:Et))}};let Be=te&&setTimeout(()=>{Be=null,$e(new qt(`timeout of ${te}ms exceeded`,qt.ETIMEDOUT))},te);const lt=()=>{J&&(Be&&clearTimeout(Be),Be=null,J.forEach(Mt=>{Mt.unsubscribe?Mt.unsubscribe($e):Mt.removeEventListener("abort",$e)}),J=null)};J.forEach(Mt=>Mt.addEventListener("abort",$e));const{signal:Jt}=xe;return Jt.unsubscribe=()=>Re.asap(lt),Jt}};const ta=function*(J,te){let ue=J.byteLength;if(ue{const we=ma(J,te);let $e=0,Be,lt=Jt=>{Be||(Be=!0,xe&&xe(Jt))};return new ReadableStream({async pull(Jt){try{const{done:Mt,value:Et}=await we.next();if(Mt){lt(),Jt.close();return}let gs=Et.byteLength;if(ue){let tn=$e+=gs;ue(tn)}Jt.enqueue(new Uint8Array(Et))}catch(Mt){throw lt(Mt),Mt}},cancel(Jt){return lt(Jt),we.return()}},{highWaterMark:2})},gn=64*1024,{isFunction:mn}=Re,Qn=(({Request:J,Response:te})=>({Request:J,Response:te}))(Re.global),{ReadableStream:fr,TextEncoder:pr}=Re.global,dn=(J,...te)=>{try{return!!J(...te)}catch{return!1}},wn=J=>{J=Re.merge.call({skipUndefined:!0},Qn,J);const{fetch:te,Request:ue,Response:xe}=J,we=te?mn(te):typeof fetch=="function",$e=mn(ue),Be=mn(xe);if(!we)return!1;const lt=we&&mn(fr),Jt=we&&(typeof pr=="function"?(Ot=>bs=>Ot.encode(bs))(new pr):async Ot=>new Uint8Array(await new ue(Ot).arrayBuffer())),Mt=$e&<&&dn(()=>{let Ot=!1;const bs=new ue(Yt.origin,{body:new fr,method:"POST",get duplex(){return Ot=!0,"half"}}).headers.has("Content-Type");return Ot&&!bs}),Et=Be&<&&dn(()=>Re.isReadableStream(new xe("").body)),gs={stream:Et&&(Ot=>Ot.body)};we&&["text","arrayBuffer","blob","formData","stream"].forEach(Ot=>{!gs[Ot]&&(gs[Ot]=(bs,es)=>{let Sn=bs&&bs[Ot];if(Sn)return Sn.call(bs);throw new qt(`Response type '${Ot}' is not supported`,qt.ERR_NOT_SUPPORT,es)})});const tn=async Ot=>{if(Ot==null)return 0;if(Re.isBlob(Ot))return Ot.size;if(Re.isSpecCompliantForm(Ot))return(await new ue(Yt.origin,{method:"POST",body:Ot}).arrayBuffer()).byteLength;if(Re.isArrayBufferView(Ot)||Re.isArrayBuffer(Ot))return Ot.byteLength;if(Re.isURLSearchParams(Ot)&&(Ot=Ot+""),Re.isString(Ot))return(await Jt(Ot)).byteLength},Hn=async(Ot,bs)=>{const es=Re.toFiniteNumber(Ot.getContentLength());return es??tn(bs)};return async Ot=>{let{url:bs,method:es,data:Sn,signal:xr,cancelToken:Dn,timeout:nr,onDownloadProgress:Lr,onUploadProgress:La,responseType:rr,headers:ao,withCredentials:il="same-origin",fetchOptions:io}=qs(Ot),lo=te||fetch;rr=rr?(rr+"").toLowerCase():"text";let ll=Vr([xr,Dn&&Dn.toAbortSignal()],nr),Di=null;const Ia=ll&&ll.unsubscribe&&(()=>{ll.unsubscribe()});let Go;try{if(La&&Mt&&es!=="get"&&es!=="head"&&(Go=await Hn(ao,Sn))!==0){let xa=new ue(bs,{method:"POST",body:Sn,duplex:"half"}),Ma;if(Re.isFormData(Sn)&&(Ma=xa.headers.get("content-type"))&&ao.setContentType(Ma),xa.body){const[cl,_i]=Xe(Go,En($t(La)));Sn=sr(xa.body,gn,cl,_i)}}Re.isString(il)||(il=il?"include":"omit");const ar=$e&&"credentials"in ue.prototype,Yo={...io,signal:ll,method:es.toUpperCase(),headers:ao.normalize().toJSON(),body:Sn,duplex:"half",credentials:ar?il:void 0};Di=$e&&new ue(bs,Yo);let pa=await($e?lo(Di,io):lo(bs,Yo));const ol=Et&&(rr==="stream"||rr==="response");if(Et&&(Lr||ol&&Ia)){const xa={};["status","statusText","headers"].forEach(oo=>{xa[oo]=pa[oo]});const Ma=Re.toFiniteNumber(pa.headers.get("content-length")),[cl,_i]=Lr&&Xe(Ma,En($t(Lr),!0))||[];pa=new xe(sr(pa.body,gn,cl,()=>{_i&&_i(),Ia&&Ia()}),xa)}rr=rr||"text";let Ti=await gs[Re.findKey(gs,rr)||"text"](pa,Ot);return!ol&&Ia&&Ia(),await new Promise((xa,Ma)=>{yr(xa,Ma,{data:Ti,headers:Ws.from(pa.headers),status:pa.status,statusText:pa.statusText,config:Ot,request:Di})})}catch(ar){throw Ia&&Ia(),ar&&ar.name==="TypeError"&&/Load failed|fetch/i.test(ar.message)?Object.assign(new qt("Network Error",qt.ERR_NETWORK,Ot,Di,ar&&ar.response),{cause:ar.cause||ar}):qt.from(ar,ar&&ar.code,Ot,Di,ar&&ar.response)}}},Da=new Map,fa=J=>{let te=J&&J.env||{};const{fetch:ue,Request:xe,Response:we}=te,$e=[xe,we,ue];let Be=$e.length,lt=Be,Jt,Mt,Et=Da;for(;lt--;)Jt=$e[lt],Mt=Et.get(Jt),Mt===void 0&&Et.set(Jt,Mt=lt?new Map:wn(te)),Et=Mt;return Mt};fa();const Ai={http:ws,xhr:Tt,fetch:{get:fa}};Re.forEach(Ai,(J,te)=>{if(J){try{Object.defineProperty(J,"name",{value:te})}catch{}Object.defineProperty(J,"adapterName",{value:te})}});const ki=J=>`- ${J}`,ni=J=>Re.isFunction(J)||J===null||J===!1;function rl(J,te){J=Re.isArray(J)?J:[J];const{length:ue}=J;let xe,we;const $e={};for(let Be=0;Be`adapter ${Jt} `+(Mt===!1?"is not supported by the environment":"is not available in the build"));let lt=ue?Be.length>1?`since : `+Be.map(ki).join(` -`):" "+ki(Be[0]):"as no adapter specified";throw new qt("There is no suitable adapter to dispatch the request "+lt,"ERR_NOT_SUPPORT")}return we}var Go={getAdapter:rl,adapters:Ai};function Ta(J){if(J.cancelToken&&J.cancelToken.throwIfRequested(),J.signal&&J.signal.aborted)throw new Un(null,J)}function ri(J){return Ta(J),J.headers=Ws.from(J.headers),J.data=Qs.call(J,J.transformRequest),["post","put","patch"].indexOf(J.method)!==-1&&J.headers.setContentType("application/x-www-form-urlencoded",!1),Go.getAdapter(J.adapter||at.adapter,J)(J).then(function(xe){return Ta(J),xe.data=Qs.call(J,J.transformResponse,xe),xe.headers=Ws.from(xe.headers),xe},function(xe){return zn(xe)||(Ta(J),xe&&xe.response&&(xe.response.data=Qs.call(J,J.transformResponse,xe.response),xe.response.headers=Ws.from(xe.response.headers))),Promise.reject(xe)})}const Pa="1.13.6",_a={};["object","boolean","number","function","string","symbol"].forEach((J,te)=>{_a[J]=function(xe){return typeof xe===J||"a"+(te<1?"n ":" ")+J}});const to={};_a.transitional=function(te,ue,xe){function we($e,Be){return"[Axios v"+Pa+"] Transitional option '"+$e+"'"+Be+(xe?". "+xe:"")}return($e,Be,lt)=>{if(te===!1)throw new qt(we(Be," has been removed"+(ue?" in "+ue:"")),qt.ERR_DEPRECATED);return ue&&!to[Be]&&(to[Be]=!0,console.warn(we(Be," has been deprecated since v"+ue+" and will be removed in the near future"))),te?te($e,Be,lt):!0}},_a.spelling=function(te){return(ue,xe)=>(console.warn(`${xe} is likely a misspelling of ${te}`),!0)};function Zc(J,te,ue){if(typeof J!="object")throw new qt("options must be an object",qt.ERR_BAD_OPTION_VALUE);const xe=Object.keys(J);let we=xe.length;for(;we-- >0;){const $e=xe[we],Be=te[$e];if(Be){const lt=J[$e],Jt=lt===void 0||Be(lt,$e,J);if(Jt!==!0)throw new qt("option "+$e+" must be "+Jt,qt.ERR_BAD_OPTION_VALUE);continue}if(ue!==!0)throw new qt("Unknown option "+$e,qt.ERR_BAD_OPTION)}}var Oa={assertOptions:Zc,validators:_a};const Vn=Oa.validators;class ai{constructor(te){this.defaults=te||{},this.interceptors={request:new st,response:new st}}async request(te,ue){try{return await this._request(te,ue)}catch(xe){if(xe instanceof Error){let we={};Error.captureStackTrace?Error.captureStackTrace(we):we=new Error;const $e=we.stack?we.stack.replace(/^.+\n/,""):"";try{xe.stack?$e&&!String(xe.stack).endsWith($e.replace(/^.+\n.+\n/,""))&&(xe.stack+=` -`+$e):xe.stack=$e}catch{}}throw xe}}_request(te,ue){typeof te=="string"?(ue=ue||{},ue.url=te):ue=te||{},ue=xn(this.defaults,ue);const{transitional:xe,paramsSerializer:we,headers:$e}=ue;xe!==void 0&&Oa.assertOptions(xe,{silentJSONParsing:Vn.transitional(Vn.boolean),forcedJSONParsing:Vn.transitional(Vn.boolean),clarifyTimeoutError:Vn.transitional(Vn.boolean),legacyInterceptorReqResOrdering:Vn.transitional(Vn.boolean)},!1),we!=null&&(Re.isFunction(we)?ue.paramsSerializer={serialize:we}:Oa.assertOptions(we,{encode:Vn.function,serialize:Vn.function},!0)),ue.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?ue.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:ue.allowAbsoluteUrls=!0),Oa.assertOptions(ue,{baseUrl:Vn.spelling("baseURL"),withXsrfToken:Vn.spelling("withXSRFToken")},!0),ue.method=(ue.method||this.defaults.method||"get").toLowerCase();let Be=$e&&Re.merge($e.common,$e[ue.method]);$e&&Re.forEach(["delete","get","head","post","put","patch","common"],Ot=>{delete $e[Ot]}),ue.headers=Ws.concat(Be,$e);const lt=[];let Jt=!0;this.interceptors.request.forEach(function(bs){if(typeof bs.runWhen=="function"&&bs.runWhen(ue)===!1)return;Jt=Jt&&bs.synchronous;const es=ue.transitional||bt;es&&es.legacyInterceptorReqResOrdering?lt.unshift(bs.fulfilled,bs.rejected):lt.push(bs.fulfilled,bs.rejected)});const Mt=[];this.interceptors.response.forEach(function(bs){Mt.push(bs.fulfilled,bs.rejected)});let Et,gs=0,tn;if(!Jt){const Ot=[ri.bind(this),void 0];for(Ot.unshift(...lt),Ot.push(...Mt),tn=Ot.length,Et=Promise.resolve(ue);gs{if(!xe._listeners)return;let $e=xe._listeners.length;for(;$e-- >0;)xe._listeners[$e](we);xe._listeners=null}),this.promise.then=we=>{let $e;const Be=new Promise(lt=>{xe.subscribe(lt),$e=lt}).then(we);return Be.cancel=function(){xe.unsubscribe($e)},Be},te(function($e,Be,lt){xe.reason||(xe.reason=new Un($e,Be,lt),ue(xe.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(te){if(this.reason){te(this.reason);return}this._listeners?this._listeners.push(te):this._listeners=[te]}unsubscribe(te){if(!this._listeners)return;const ue=this._listeners.indexOf(te);ue!==-1&&this._listeners.splice(ue,1)}toAbortSignal(){const te=new AbortController,ue=xe=>{te.abort(xe)};return this.subscribe(ue),te.signal.unsubscribe=()=>this.unsubscribe(ue),te.signal}static source(){let te;return{token:new Or(function(we){te=we}),cancel:te}}}var so=Or;function Ei(J){return function(ue){return J.apply(null,ue)}}function no(J){return Re.isObject(J)&&J.isAxiosError===!0}const ii={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ii).forEach(([J,te])=>{ii[te]=J});var al=ii;function ro(J){const te=new Ri(J),ue=t(Ri.prototype.request,te);return Re.extend(ue,Ri.prototype,te,{allOwnKeys:!0}),Re.extend(ue,te,null,{allOwnKeys:!0}),ue.create=function(we){return ro(xn(J,we))},ue}const Hs=ro(at);return Hs.Axios=Ri,Hs.CanceledError=Un,Hs.CancelToken=so,Hs.isCancel=zn,Hs.VERSION=Pa,Hs.toFormData=ie,Hs.AxiosError=qt,Hs.Cancel=Hs.CanceledError,Hs.all=function(te){return Promise.all(te)},Hs.spread=Ei,Hs.isAxiosError=no,Hs.mergeConfig=xn,Hs.AxiosHeaders=Ws,Hs.formToJSON=J=>en(Re.isHTMLForm(J)?new FormData(J):J),Hs.getAdapter=Go.getAdapter,Hs.HttpStatusCode=al,Hs.default=Hs,bx=Hs,bx}var AN;function t_(){if(AN)return cr;AN=1;function t(q){return q&&typeof q=="object"&&"default"in q?q.default:q}Object.defineProperty(cr,"__esModule",{value:!0});var s=t(e_()),n=function(){return(n=Object.assign||function(q){for(var G,Z=1,W=arguments.length;Z0&&z[z.length-1])&&(K[0]===6||K[0]===2)){B=0;continue}if(K[0]===3&&(!z||K[1]>z[0]&&K[1]=q&&Z<=G},d=function(q){return!!q&&(typeof q=="object"||typeof q=="function")&&typeof q.then=="function"},h={Accept:"application/json","Content-Type":"application/json"},x={timeout:0},f=null,m="CLIENT_ERROR",p="SERVER_ERROR",u="TIMEOUT_ERROR",j="CONNECTION_ERROR",g="NETWORK_ERROR",y="UNKNOWN_ERROR",N="CANCEL_ERROR",S=["ECONNABORTED"],C=["ENOTFOUND","ECONNREFUSED","ECONNRESET"],w=["ERR_BAD_REQUEST","ERR_BAD_RESPONSE"],R=function(q){return c(200,299,q)},P=function(q){return c(400,499,q)},A=function(q){return c(500,599,q)},I=function(q){return q.message==="Network Error"?g:s.isCancel(q)?N:q.code?w.includes(q.code)?$(q.response.status):S.includes(q.code)?u:C.includes(q.code)?j:y:$(q.response?q.response.status:null)},$=function(q){return q?R(q)?f:P(q)?m:A(q)?p:y:y},T=function(q){var G,Z=n(n({},h),q.headers||{});if(q.axiosInstance)G=q.axiosInstance;else{var W=n(n({},q),{headers:void 0}),z=n(n({},x),W);G=s.create(z)}var F=[],B=[],D=[],O=[],V=[],K=function(re,ge){return Z[re]=ge,G},Y=function(re){return function(ge,ve,Se){return ve===void 0&&(ve={}),Se===void 0&&(Se={}),X(n(n({},Se),{url:ge,params:ve,method:re}))}},U=function(re){return function(ge,ve,Se){return Se===void 0&&(Se={}),X(n(n({},Se),{url:ge,method:re,data:ve}))}},X=function(re){return r(void 0,void 0,void 0,function(){var ge,ve,Se,We;return a(this,function(Ce){switch(Ce.label){case 0:if(re.headers=n(n({},Z),re.headers),B.length>0&&B.forEach(function(fe){return fe(re)}),!(D.length>0))return[3,6];ge=0,Ce.label=1;case 1:return ge0&&O.forEach(function(Rt){return Rt(ye)}),!(V.length>0))return[3,6];le=0,Kt.label=1;case 1:return le{const s=localStorage.getItem("token");s&&t.headers&&(t.headers.Authorization=`Bearer ${s}`)});ze.addResponseTransform(t=>{var s,n;if(!t.ok&&t.status===401){const r=localStorage.getItem("token");console.error("Unauthorized access - potential token expiration. Token exists in localStorage:",!!r),console.error("Full 401 Response Details:",{url:(s=t.config)==null?void 0:s.url,method:(n=t.config)==null?void 0:n.method,data:t.data}),window.dispatchEvent(new Event("auth:logout"))}});function DC(t,s){return function(){return t.apply(s,arguments)}}const{toString:r_}=Object.prototype,{getPrototypeOf:Lv}=Object,{iterator:zm,toStringTag:TC}=Symbol,Um=(t=>s=>{const n=r_.call(s);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ti=t=>(t=t.toLowerCase(),s=>Um(s)===t),Vm=t=>s=>typeof s===t,{isArray:Mc}=Array,Ec=Vm("undefined");function ru(t){return t!==null&&!Ec(t)&&t.constructor!==null&&!Ec(t.constructor)&&Xr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const PC=ti("ArrayBuffer");function a_(t){let s;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?s=ArrayBuffer.isView(t):s=t&&t.buffer&&PC(t.buffer),s}const i_=Vm("string"),Xr=Vm("function"),_C=Vm("number"),au=t=>t!==null&&typeof t=="object",l_=t=>t===!0||t===!1,Kh=t=>{if(Um(t)!=="object")return!1;const s=Lv(t);return(s===null||s===Object.prototype||Object.getPrototypeOf(s)===null)&&!(TC in t)&&!(zm in t)},o_=t=>{if(!au(t)||ru(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},c_=ti("Date"),d_=ti("File"),u_=t=>!!(t&&typeof t.uri<"u"),h_=t=>t&&typeof t.getParts<"u",m_=ti("Blob"),f_=ti("FileList"),p_=t=>au(t)&&Xr(t.pipe);function x_(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const kN=x_(),RN=typeof kN.FormData<"u"?kN.FormData:void 0,g_=t=>{let s;return t&&(RN&&t instanceof RN||Xr(t.append)&&((s=Um(t))==="formdata"||s==="object"&&Xr(t.toString)&&t.toString()==="[object FormData]"))},v_=ti("URLSearchParams"),[b_,y_,j_,N_]=["ReadableStream","Request","Response","Headers"].map(ti),w_=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function iu(t,s,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,a;if(typeof t!="object"&&(t=[t]),Mc(t))for(r=0,a=t.length;r0;)if(a=n[r],s===a.toLowerCase())return a;return null}const Do=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,IC=t=>!Ec(t)&&t!==Do;function W0(){const{caseless:t,skipUndefined:s}=IC(this)&&this||{},n={},r=(a,l)=>{if(l==="__proto__"||l==="constructor"||l==="prototype")return;const c=t&&OC(n,l)||l;Kh(n[c])&&Kh(a)?n[c]=W0(n[c],a):Kh(a)?n[c]=W0({},a):Mc(a)?n[c]=a.slice():(!s||!Ec(a))&&(n[c]=a)};for(let a=0,l=arguments.length;a(iu(s,(a,l)=>{n&&Xr(a)?Object.defineProperty(t,l,{value:DC(a,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,l,{value:a,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),C_=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),A_=(t,s,n,r)=>{t.prototype=Object.create(s.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:s.prototype}),n&&Object.assign(t.prototype,n)},k_=(t,s,n,r)=>{let a,l,c;const d={};if(s=s||{},t==null)return s;do{for(a=Object.getOwnPropertyNames(t),l=a.length;l-- >0;)c=a[l],(!r||r(c,t,s))&&!d[c]&&(s[c]=t[c],d[c]=!0);t=n!==!1&&Lv(t)}while(t&&(!n||n(t,s))&&t!==Object.prototype);return s},R_=(t,s,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=s.length;const r=t.indexOf(s,n);return r!==-1&&r===n},E_=t=>{if(!t)return null;if(Mc(t))return t;let s=t.length;if(!_C(s))return null;const n=new Array(s);for(;s-- >0;)n[s]=t[s];return n},D_=(t=>s=>t&&s instanceof t)(typeof Uint8Array<"u"&&Lv(Uint8Array)),T_=(t,s)=>{const r=(t&&t[zm]).call(t);let a;for(;(a=r.next())&&!a.done;){const l=a.value;s.call(t,l[0],l[1])}},P_=(t,s)=>{let n;const r=[];for(;(n=t.exec(s))!==null;)r.push(n);return r},__=ti("HTMLFormElement"),O_=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,a){return r.toUpperCase()+a}),EN=(({hasOwnProperty:t})=>(s,n)=>t.call(s,n))(Object.prototype),I_=ti("RegExp"),LC=(t,s)=>{const n=Object.getOwnPropertyDescriptors(t),r={};iu(n,(a,l)=>{let c;(c=s(a,l,t))!==!1&&(r[l]=c||a)}),Object.defineProperties(t,r)},L_=t=>{LC(t,(s,n)=>{if(Xr(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Xr(r)){if(s.enumerable=!1,"writable"in s){s.writable=!1;return}s.set||(s.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},M_=(t,s)=>{const n={},r=a=>{a.forEach(l=>{n[l]=!0})};return Mc(t)?r(t):r(String(t).split(s)),n},F_=()=>{},B_=(t,s)=>t!=null&&Number.isFinite(t=+t)?t:s;function $_(t){return!!(t&&Xr(t.append)&&t[TC]==="FormData"&&t[zm])}const q_=t=>{const s=new Array(10),n=(r,a)=>{if(au(r)){if(s.indexOf(r)>=0)return;if(ru(r))return r;if(!("toJSON"in r)){s[a]=r;const l=Mc(r)?[]:{};return iu(r,(c,d)=>{const h=n(c,a+1);!Ec(h)&&(l[d]=h)}),s[a]=void 0,l}}return r};return n(t,0)},z_=ti("AsyncFunction"),U_=t=>t&&(au(t)||Xr(t))&&Xr(t.then)&&Xr(t.catch),MC=((t,s)=>t?setImmediate:s?((n,r)=>(Do.addEventListener("message",({source:a,data:l})=>{a===Do&&l===n&&r.length&&r.shift()()},!1),a=>{r.push(a),Do.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Xr(Do.postMessage)),V_=typeof queueMicrotask<"u"?queueMicrotask.bind(Do):typeof process<"u"&&process.nextTick||MC,H_=t=>t!=null&&Xr(t[zm]),et={isArray:Mc,isArrayBuffer:PC,isBuffer:ru,isFormData:g_,isArrayBufferView:a_,isString:i_,isNumber:_C,isBoolean:l_,isObject:au,isPlainObject:Kh,isEmptyObject:o_,isReadableStream:b_,isRequest:y_,isResponse:j_,isHeaders:N_,isUndefined:Ec,isDate:c_,isFile:d_,isReactNativeBlob:u_,isReactNative:h_,isBlob:m_,isRegExp:I_,isFunction:Xr,isStream:p_,isURLSearchParams:v_,isTypedArray:D_,isFileList:f_,forEach:iu,merge:W0,extend:S_,trim:w_,stripBOM:C_,inherits:A_,toFlatObject:k_,kindOf:Um,kindOfTest:ti,endsWith:R_,toArray:E_,forEachEntry:T_,matchAll:P_,isHTMLForm:__,hasOwnProperty:EN,hasOwnProp:EN,reduceDescriptors:LC,freezeMethods:L_,toObjectSet:M_,toCamelCase:O_,noop:F_,toFiniteNumber:B_,findKey:OC,global:Do,isContextDefined:IC,isSpecCompliantForm:$_,toJSONObject:q_,isAsyncFn:z_,isThenable:U_,setImmediate:MC,asap:V_,isIterable:H_};let As=class FC extends Error{static from(s,n,r,a,l,c){const d=new FC(s.message,n||s.code,r,a,l);return d.cause=s,d.name=s.name,s.status!=null&&d.status==null&&(d.status=s.status),c&&Object.assign(d,c),d}constructor(s,n,r,a,l){super(s),Object.defineProperty(this,"message",{value:s,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),a&&(this.request=a),l&&(this.response=l,this.status=l.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:et.toJSONObject(this.config),code:this.code,status:this.status}}};As.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";As.ERR_BAD_OPTION="ERR_BAD_OPTION";As.ECONNABORTED="ECONNABORTED";As.ETIMEDOUT="ETIMEDOUT";As.ERR_NETWORK="ERR_NETWORK";As.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";As.ERR_DEPRECATED="ERR_DEPRECATED";As.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";As.ERR_BAD_REQUEST="ERR_BAD_REQUEST";As.ERR_CANCELED="ERR_CANCELED";As.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";As.ERR_INVALID_URL="ERR_INVALID_URL";const W_=null;function G0(t){return et.isPlainObject(t)||et.isArray(t)}function BC(t){return et.endsWith(t,"[]")?t.slice(0,-2):t}function yx(t,s,n){return t?t.concat(s).map(function(a,l){return a=BC(a),!n&&l?"["+a+"]":a}).join(n?".":""):s}function G_(t){return et.isArray(t)&&!t.some(G0)}const K_=et.toFlatObject(et,{},null,function(s){return/^is[A-Z]/.test(s)});function Hm(t,s,n){if(!et.isObject(t))throw new TypeError("target must be an object");s=s||new FormData,n=et.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,y){return!et.isUndefined(y[g])});const r=n.metaTokens,a=n.visitor||f,l=n.dots,c=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&et.isSpecCompliantForm(s);if(!et.isFunction(a))throw new TypeError("visitor must be a function");function x(j){if(j===null)return"";if(et.isDate(j))return j.toISOString();if(et.isBoolean(j))return j.toString();if(!h&&et.isBlob(j))throw new As("Blob is not supported. Use a Buffer instead.");return et.isArrayBuffer(j)||et.isTypedArray(j)?h&&typeof Blob=="function"?new Blob([j]):Buffer.from(j):j}function f(j,g,y){let N=j;if(et.isReactNative(s)&&et.isReactNativeBlob(j))return s.append(yx(y,g,l),x(j)),!1;if(j&&!y&&typeof j=="object"){if(et.endsWith(g,"{}"))g=r?g:g.slice(0,-2),j=JSON.stringify(j);else if(et.isArray(j)&&G_(j)||(et.isFileList(j)||et.endsWith(g,"[]"))&&(N=et.toArray(j)))return g=BC(g),N.forEach(function(C,w){!(et.isUndefined(C)||C===null)&&s.append(c===!0?yx([g],w,l):c===null?g:g+"[]",x(C))}),!1}return G0(j)?!0:(s.append(yx(y,g,l),x(j)),!1)}const m=[],p=Object.assign(K_,{defaultVisitor:f,convertValue:x,isVisitable:G0});function u(j,g){if(!et.isUndefined(j)){if(m.indexOf(j)!==-1)throw Error("Circular reference detected in "+g.join("."));m.push(j),et.forEach(j,function(N,S){(!(et.isUndefined(N)||N===null)&&a.call(s,N,et.isString(S)?S.trim():S,g,p))===!0&&u(N,g?g.concat(S):[S])}),m.pop()}}if(!et.isObject(t))throw new TypeError("data must be an object");return u(t),s}function DN(t){const s={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return s[r]})}function Mv(t,s){this._pairs=[],t&&Hm(t,this,s)}const $C=Mv.prototype;$C.append=function(s,n){this._pairs.push([s,n])};$C.toString=function(s){const n=s?function(r){return s.call(this,r,DN)}:DN;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function Y_(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function qC(t,s,n){if(!s)return t;const r=n&&n.encode||Y_,a=et.isFunction(n)?{serialize:n}:n,l=a&&a.serialize;let c;if(l?c=l(s,a):c=et.isURLSearchParams(s)?s.toString():new Mv(s,a).toString(r),c){const d=t.indexOf("#");d!==-1&&(t=t.slice(0,d)),t+=(t.indexOf("?")===-1?"?":"&")+c}return t}class TN{constructor(){this.handlers=[]}use(s,n,r){return this.handlers.push({fulfilled:s,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(s){this.handlers[s]&&(this.handlers[s]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(s){et.forEach(this.handlers,function(r){r!==null&&s(r)})}}const Fv={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Z_=typeof URLSearchParams<"u"?URLSearchParams:Mv,Q_=typeof FormData<"u"?FormData:null,X_=typeof Blob<"u"?Blob:null,J_={isBrowser:!0,classes:{URLSearchParams:Z_,FormData:Q_,Blob:X_},protocols:["http","https","file","blob","url","data"]},Bv=typeof window<"u"&&typeof document<"u",K0=typeof navigator=="object"&&navigator||void 0,eO=Bv&&(!K0||["ReactNative","NativeScript","NS"].indexOf(K0.product)<0),tO=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",sO=Bv&&window.location.href||"http://localhost",nO=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Bv,hasStandardBrowserEnv:eO,hasStandardBrowserWebWorkerEnv:tO,navigator:K0,origin:sO},Symbol.toStringTag,{value:"Module"})),Ar={...nO,...J_};function rO(t,s){return Hm(t,new Ar.classes.URLSearchParams,{visitor:function(n,r,a,l){return Ar.isNode&&et.isBuffer(n)?(this.append(r,n.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...s})}function aO(t){return et.matchAll(/\w+|\[(\w*)]/g,t).map(s=>s[0]==="[]"?"":s[1]||s[0])}function iO(t){const s={},n=Object.keys(t);let r;const a=n.length;let l;for(r=0;r=n.length;return c=!c&&et.isArray(a)?a.length:c,h?(et.hasOwnProp(a,c)?a[c]=[a[c],r]:a[c]=r,!d):((!a[c]||!et.isObject(a[c]))&&(a[c]=[]),s(n,r,a[c],l)&&et.isArray(a[c])&&(a[c]=iO(a[c])),!d)}if(et.isFormData(t)&&et.isFunction(t.entries)){const n={};return et.forEachEntry(t,(r,a)=>{s(aO(r),a,n,0)}),n}return null}function lO(t,s,n){if(et.isString(t))try{return(s||JSON.parse)(t),et.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const lu={transitional:Fv,adapter:["xhr","http","fetch"],transformRequest:[function(s,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,l=et.isObject(s);if(l&&et.isHTMLForm(s)&&(s=new FormData(s)),et.isFormData(s))return a?JSON.stringify(zC(s)):s;if(et.isArrayBuffer(s)||et.isBuffer(s)||et.isStream(s)||et.isFile(s)||et.isBlob(s)||et.isReadableStream(s))return s;if(et.isArrayBufferView(s))return s.buffer;if(et.isURLSearchParams(s))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),s.toString();let d;if(l){if(r.indexOf("application/x-www-form-urlencoded")>-1)return rO(s,this.formSerializer).toString();if((d=et.isFileList(s))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return Hm(d?{"files[]":s}:s,h&&new h,this.formSerializer)}}return l||a?(n.setContentType("application/json",!1),lO(s)):s}],transformResponse:[function(s){const n=this.transitional||lu.transitional,r=n&&n.forcedJSONParsing,a=this.responseType==="json";if(et.isResponse(s)||et.isReadableStream(s))return s;if(s&&et.isString(s)&&(r&&!this.responseType||a)){const c=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(s,this.parseReviver)}catch(d){if(c)throw d.name==="SyntaxError"?As.from(d,As.ERR_BAD_RESPONSE,this,null,this.response):d}}return s}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ar.classes.FormData,Blob:Ar.classes.Blob},validateStatus:function(s){return s>=200&&s<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};et.forEach(["delete","get","head","post","put","patch"],t=>{lu.headers[t]={}});const oO=et.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),cO=t=>{const s={};let n,r,a;return t&&t.split(` -`).forEach(function(c){a=c.indexOf(":"),n=c.substring(0,a).trim().toLowerCase(),r=c.substring(a+1).trim(),!(!n||s[n]&&oO[n])&&(n==="set-cookie"?s[n]?s[n].push(r):s[n]=[r]:s[n]=s[n]?s[n]+", "+r:r)}),s},PN=Symbol("internals");function bd(t){return t&&String(t).trim().toLowerCase()}function Yh(t){return t===!1||t==null?t:et.isArray(t)?t.map(Yh):String(t)}function dO(t){const s=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)s[r[1]]=r[2];return s}const uO=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function jx(t,s,n,r,a){if(et.isFunction(r))return r.call(this,s,n);if(a&&(s=n),!!et.isString(s)){if(et.isString(r))return s.indexOf(r)!==-1;if(et.isRegExp(r))return r.test(s)}}function hO(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(s,n,r)=>n.toUpperCase()+r)}function mO(t,s){const n=et.toCamelCase(" "+s);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(a,l,c){return this[r].call(this,s,a,l,c)},configurable:!0})})}let Jr=class{constructor(s){s&&this.set(s)}set(s,n,r){const a=this;function l(d,h,x){const f=bd(h);if(!f)throw new Error("header name must be a non-empty string");const m=et.findKey(a,f);(!m||a[m]===void 0||x===!0||x===void 0&&a[m]!==!1)&&(a[m||h]=Yh(d))}const c=(d,h)=>et.forEach(d,(x,f)=>l(x,f,h));if(et.isPlainObject(s)||s instanceof this.constructor)c(s,n);else if(et.isString(s)&&(s=s.trim())&&!uO(s))c(cO(s),n);else if(et.isObject(s)&&et.isIterable(s)){let d={},h,x;for(const f of s){if(!et.isArray(f))throw TypeError("Object iterator must return a key-value pair");d[x=f[0]]=(h=d[x])?et.isArray(h)?[...h,f[1]]:[h,f[1]]:f[1]}c(d,n)}else s!=null&&l(n,s,r);return this}get(s,n){if(s=bd(s),s){const r=et.findKey(this,s);if(r){const a=this[r];if(!n)return a;if(n===!0)return dO(a);if(et.isFunction(n))return n.call(this,a,r);if(et.isRegExp(n))return n.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(s,n){if(s=bd(s),s){const r=et.findKey(this,s);return!!(r&&this[r]!==void 0&&(!n||jx(this,this[r],r,n)))}return!1}delete(s,n){const r=this;let a=!1;function l(c){if(c=bd(c),c){const d=et.findKey(r,c);d&&(!n||jx(r,r[d],d,n))&&(delete r[d],a=!0)}}return et.isArray(s)?s.forEach(l):l(s),a}clear(s){const n=Object.keys(this);let r=n.length,a=!1;for(;r--;){const l=n[r];(!s||jx(this,this[l],l,s,!0))&&(delete this[l],a=!0)}return a}normalize(s){const n=this,r={};return et.forEach(this,(a,l)=>{const c=et.findKey(r,l);if(c){n[c]=Yh(a),delete n[l];return}const d=s?hO(l):String(l).trim();d!==l&&delete n[l],n[d]=Yh(a),r[d]=!0}),this}concat(...s){return this.constructor.concat(this,...s)}toJSON(s){const n=Object.create(null);return et.forEach(this,(r,a)=>{r!=null&&r!==!1&&(n[a]=s&&et.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([s,n])=>s+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(s){return s instanceof this?s:new this(s)}static concat(s,...n){const r=new this(s);return n.forEach(a=>r.set(a)),r}static accessor(s){const r=(this[PN]=this[PN]={accessors:{}}).accessors,a=this.prototype;function l(c){const d=bd(c);r[d]||(mO(a,c),r[d]=!0)}return et.isArray(s)?s.forEach(l):l(s),this}};Jr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);et.reduceDescriptors(Jr.prototype,({value:t},s)=>{let n=s[0].toUpperCase()+s.slice(1);return{get:()=>t,set(r){this[n]=r}}});et.freezeMethods(Jr);function Nx(t,s){const n=this||lu,r=s||n,a=Jr.from(r.headers);let l=r.data;return et.forEach(t,function(d){l=d.call(n,l,a.normalize(),s?s.status:void 0)}),a.normalize(),l}function UC(t){return!!(t&&t.__CANCEL__)}let ou=class extends As{constructor(s,n,r){super(s??"canceled",As.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function VC(t,s,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):s(new As("Request failed with status code "+n.status,[As.ERR_BAD_REQUEST,As.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function fO(t){const s=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return s&&s[1]||""}function pO(t,s){t=t||10;const n=new Array(t),r=new Array(t);let a=0,l=0,c;return s=s!==void 0?s:1e3,function(h){const x=Date.now(),f=r[l];c||(c=x),n[a]=h,r[a]=x;let m=l,p=0;for(;m!==a;)p+=n[m++],m=m%t;if(a=(a+1)%t,a===l&&(l=(l+1)%t),x-c{n=f,a=null,l&&(clearTimeout(l),l=null),t(...x)};return[(...x)=>{const f=Date.now(),m=f-n;m>=r?c(x,f):(a=x,l||(l=setTimeout(()=>{l=null,c(a)},r-m)))},()=>a&&c(a)]}const xm=(t,s,n=3)=>{let r=0;const a=pO(50,250);return xO(l=>{const c=l.loaded,d=l.lengthComputable?l.total:void 0,h=c-r,x=a(h),f=c<=d;r=c;const m={loaded:c,total:d,progress:d?c/d:void 0,bytes:h,rate:x||void 0,estimated:x&&d&&f?(d-c)/x:void 0,event:l,lengthComputable:d!=null,[s?"download":"upload"]:!0};t(m)},n)},_N=(t,s)=>{const n=t!=null;return[r=>s[0]({lengthComputable:n,total:t,loaded:r}),s[1]]},ON=t=>(...s)=>et.asap(()=>t(...s)),gO=Ar.hasStandardBrowserEnv?((t,s)=>n=>(n=new URL(n,Ar.origin),t.protocol===n.protocol&&t.host===n.host&&(s||t.port===n.port)))(new URL(Ar.origin),Ar.navigator&&/(msie|trident)/i.test(Ar.navigator.userAgent)):()=>!0,vO=Ar.hasStandardBrowserEnv?{write(t,s,n,r,a,l,c){if(typeof document>"u")return;const d=[`${t}=${encodeURIComponent(s)}`];et.isNumber(n)&&d.push(`expires=${new Date(n).toUTCString()}`),et.isString(r)&&d.push(`path=${r}`),et.isString(a)&&d.push(`domain=${a}`),l===!0&&d.push("secure"),et.isString(c)&&d.push(`SameSite=${c}`),document.cookie=d.join("; ")},read(t){if(typeof document>"u")return null;const s=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return s?decodeURIComponent(s[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function bO(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function yO(t,s){return s?t.replace(/\/?\/$/,"")+"/"+s.replace(/^\/+/,""):t}function HC(t,s,n){let r=!bO(s);return t&&(r||n==!1)?yO(t,s):s}const IN=t=>t instanceof Jr?{...t}:t;function Mo(t,s){s=s||{};const n={};function r(x,f,m,p){return et.isPlainObject(x)&&et.isPlainObject(f)?et.merge.call({caseless:p},x,f):et.isPlainObject(f)?et.merge({},f):et.isArray(f)?f.slice():f}function a(x,f,m,p){if(et.isUndefined(f)){if(!et.isUndefined(x))return r(void 0,x,m,p)}else return r(x,f,m,p)}function l(x,f){if(!et.isUndefined(f))return r(void 0,f)}function c(x,f){if(et.isUndefined(f)){if(!et.isUndefined(x))return r(void 0,x)}else return r(void 0,f)}function d(x,f,m){if(m in s)return r(x,f);if(m in t)return r(void 0,x)}const h={url:l,method:l,data:l,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:d,headers:(x,f,m)=>a(IN(x),IN(f),m,!0)};return et.forEach(Object.keys({...t,...s}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const m=et.hasOwnProp(h,f)?h[f]:a,p=m(t[f],s[f],f);et.isUndefined(p)&&m!==d||(n[f]=p)}),n}const WC=t=>{const s=Mo({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:l,headers:c,auth:d}=s;if(s.headers=c=Jr.from(c),s.url=qC(HC(s.baseURL,s.url,s.allowAbsoluteUrls),t.params,t.paramsSerializer),d&&c.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),et.isFormData(n)){if(Ar.hasStandardBrowserEnv||Ar.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(et.isFunction(n.getHeaders)){const h=n.getHeaders(),x=["content-type","content-length"];Object.entries(h).forEach(([f,m])=>{x.includes(f.toLowerCase())&&c.set(f,m)})}}if(Ar.hasStandardBrowserEnv&&(r&&et.isFunction(r)&&(r=r(s)),r||r!==!1&&gO(s.url))){const h=a&&l&&vO.read(l);h&&c.set(a,h)}return s},jO=typeof XMLHttpRequest<"u",NO=jO&&function(t){return new Promise(function(n,r){const a=WC(t);let l=a.data;const c=Jr.from(a.headers).normalize();let{responseType:d,onUploadProgress:h,onDownloadProgress:x}=a,f,m,p,u,j;function g(){u&&u(),j&&j(),a.cancelToken&&a.cancelToken.unsubscribe(f),a.signal&&a.signal.removeEventListener("abort",f)}let y=new XMLHttpRequest;y.open(a.method.toUpperCase(),a.url,!0),y.timeout=a.timeout;function N(){if(!y)return;const C=Jr.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),R={data:!d||d==="text"||d==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:C,config:t,request:y};VC(function(A){n(A),g()},function(A){r(A),g()},R),y=null}"onloadend"in y?y.onloadend=N:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(N)},y.onabort=function(){y&&(r(new As("Request aborted",As.ECONNABORTED,t,y)),y=null)},y.onerror=function(w){const R=w&&w.message?w.message:"Network Error",P=new As(R,As.ERR_NETWORK,t,y);P.event=w||null,r(P),y=null},y.ontimeout=function(){let w=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const R=a.transitional||Fv;a.timeoutErrorMessage&&(w=a.timeoutErrorMessage),r(new As(w,R.clarifyTimeoutError?As.ETIMEDOUT:As.ECONNABORTED,t,y)),y=null},l===void 0&&c.setContentType(null),"setRequestHeader"in y&&et.forEach(c.toJSON(),function(w,R){y.setRequestHeader(R,w)}),et.isUndefined(a.withCredentials)||(y.withCredentials=!!a.withCredentials),d&&d!=="json"&&(y.responseType=a.responseType),x&&([p,j]=xm(x,!0),y.addEventListener("progress",p)),h&&y.upload&&([m,u]=xm(h),y.upload.addEventListener("progress",m),y.upload.addEventListener("loadend",u)),(a.cancelToken||a.signal)&&(f=C=>{y&&(r(!C||C.type?new ou(null,t,y):C),y.abort(),y=null)},a.cancelToken&&a.cancelToken.subscribe(f),a.signal&&(a.signal.aborted?f():a.signal.addEventListener("abort",f)));const S=fO(a.url);if(S&&Ar.protocols.indexOf(S)===-1){r(new As("Unsupported protocol "+S+":",As.ERR_BAD_REQUEST,t));return}y.send(l||null)})},wO=(t,s)=>{const{length:n}=t=t?t.filter(Boolean):[];if(s||n){let r=new AbortController,a;const l=function(x){if(!a){a=!0,d();const f=x instanceof Error?x:this.reason;r.abort(f instanceof As?f:new ou(f instanceof Error?f.message:f))}};let c=s&&setTimeout(()=>{c=null,l(new As(`timeout of ${s}ms exceeded`,As.ETIMEDOUT))},s);const d=()=>{t&&(c&&clearTimeout(c),c=null,t.forEach(x=>{x.unsubscribe?x.unsubscribe(l):x.removeEventListener("abort",l)}),t=null)};t.forEach(x=>x.addEventListener("abort",l));const{signal:h}=r;return h.unsubscribe=()=>et.asap(d),h}},SO=function*(t,s){let n=t.byteLength;if(n{const a=CO(t,s);let l=0,c,d=h=>{c||(c=!0,r&&r(h))};return new ReadableStream({async pull(h){try{const{done:x,value:f}=await a.next();if(x){d(),h.close();return}let m=f.byteLength;if(n){let p=l+=m;n(p)}h.enqueue(new Uint8Array(f))}catch(x){throw d(x),x}},cancel(h){return d(h),a.return()}},{highWaterMark:2})},MN=64*1024,{isFunction:Ch}=et,kO=(({Request:t,Response:s})=>({Request:t,Response:s}))(et.global),{ReadableStream:FN,TextEncoder:BN}=et.global,$N=(t,...s)=>{try{return!!t(...s)}catch{return!1}},RO=t=>{t=et.merge.call({skipUndefined:!0},kO,t);const{fetch:s,Request:n,Response:r}=t,a=s?Ch(s):typeof fetch=="function",l=Ch(n),c=Ch(r);if(!a)return!1;const d=a&&Ch(FN),h=a&&(typeof BN=="function"?(j=>g=>j.encode(g))(new BN):async j=>new Uint8Array(await new n(j).arrayBuffer())),x=l&&d&&$N(()=>{let j=!1;const g=new n(Ar.origin,{body:new FN,method:"POST",get duplex(){return j=!0,"half"}}).headers.has("Content-Type");return j&&!g}),f=c&&d&&$N(()=>et.isReadableStream(new r("").body)),m={stream:f&&(j=>j.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(j=>{!m[j]&&(m[j]=(g,y)=>{let N=g&&g[j];if(N)return N.call(g);throw new As(`Response type '${j}' is not supported`,As.ERR_NOT_SUPPORT,y)})});const p=async j=>{if(j==null)return 0;if(et.isBlob(j))return j.size;if(et.isSpecCompliantForm(j))return(await new n(Ar.origin,{method:"POST",body:j}).arrayBuffer()).byteLength;if(et.isArrayBufferView(j)||et.isArrayBuffer(j))return j.byteLength;if(et.isURLSearchParams(j)&&(j=j+""),et.isString(j))return(await h(j)).byteLength},u=async(j,g)=>{const y=et.toFiniteNumber(j.getContentLength());return y??p(g)};return async j=>{let{url:g,method:y,data:N,signal:S,cancelToken:C,timeout:w,onDownloadProgress:R,onUploadProgress:P,responseType:A,headers:I,withCredentials:$="same-origin",fetchOptions:T}=WC(j),E=s||fetch;A=A?(A+"").toLowerCase():"text";let _=wO([S,C&&C.toAbortSignal()],w),M=null;const q=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let G;try{if(P&&x&&y!=="get"&&y!=="head"&&(G=await u(I,N))!==0){let D=new n(g,{method:"POST",body:N,duplex:"half"}),O;if(et.isFormData(N)&&(O=D.headers.get("content-type"))&&I.setContentType(O),D.body){const[V,K]=_N(G,xm(ON(P)));N=LN(D.body,MN,V,K)}}et.isString($)||($=$?"include":"omit");const Z=l&&"credentials"in n.prototype,W={...T,signal:_,method:y.toUpperCase(),headers:I.normalize().toJSON(),body:N,duplex:"half",credentials:Z?$:void 0};M=l&&new n(g,W);let z=await(l?E(M,T):E(g,W));const F=f&&(A==="stream"||A==="response");if(f&&(R||F&&q)){const D={};["status","statusText","headers"].forEach(Y=>{D[Y]=z[Y]});const O=et.toFiniteNumber(z.headers.get("content-length")),[V,K]=R&&_N(O,xm(ON(R),!0))||[];z=new r(LN(z.body,MN,V,()=>{K&&K(),q&&q()}),D)}A=A||"text";let B=await m[et.findKey(m,A)||"text"](z,j);return!F&&q&&q(),await new Promise((D,O)=>{VC(D,O,{data:B,headers:Jr.from(z.headers),status:z.status,statusText:z.statusText,config:j,request:M})})}catch(Z){throw q&&q(),Z&&Z.name==="TypeError"&&/Load failed|fetch/i.test(Z.message)?Object.assign(new As("Network Error",As.ERR_NETWORK,j,M,Z&&Z.response),{cause:Z.cause||Z}):As.from(Z,Z&&Z.code,j,M,Z&&Z.response)}}},EO=new Map,GC=t=>{let s=t&&t.env||{};const{fetch:n,Request:r,Response:a}=s,l=[r,a,n];let c=l.length,d=c,h,x,f=EO;for(;d--;)h=l[d],x=f.get(h),x===void 0&&f.set(h,x=d?new Map:RO(s)),f=x;return x};GC();const $v={http:W_,xhr:NO,fetch:{get:GC}};et.forEach($v,(t,s)=>{if(t){try{Object.defineProperty(t,"name",{value:s})}catch{}Object.defineProperty(t,"adapterName",{value:s})}});const qN=t=>`- ${t}`,DO=t=>et.isFunction(t)||t===null||t===!1;function TO(t,s){t=et.isArray(t)?t:[t];const{length:n}=t;let r,a;const l={};for(let c=0;c`adapter ${h} `+(x===!1?"is not supported by the environment":"is not available in the build"));let d=n?c.length>1?`since : -`+c.map(qN).join(` -`):" "+qN(c[0]):"as no adapter specified";throw new As("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return a}const KC={getAdapter:TO,adapters:$v};function wx(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ou(null,t)}function zN(t){return wx(t),t.headers=Jr.from(t.headers),t.data=Nx.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),KC.getAdapter(t.adapter||lu.adapter,t)(t).then(function(r){return wx(t),r.data=Nx.call(t,t.transformResponse,r),r.headers=Jr.from(r.headers),r},function(r){return UC(r)||(wx(t),r&&r.response&&(r.response.data=Nx.call(t,t.transformResponse,r.response),r.response.headers=Jr.from(r.response.headers))),Promise.reject(r)})}const YC="1.13.6",Wm={};["object","boolean","number","function","string","symbol"].forEach((t,s)=>{Wm[t]=function(r){return typeof r===t||"a"+(s<1?"n ":" ")+t}});const UN={};Wm.transitional=function(s,n,r){function a(l,c){return"[Axios v"+YC+"] Transitional option '"+l+"'"+c+(r?". "+r:"")}return(l,c,d)=>{if(s===!1)throw new As(a(c," has been removed"+(n?" in "+n:"")),As.ERR_DEPRECATED);return n&&!UN[c]&&(UN[c]=!0,console.warn(a(c," has been deprecated since v"+n+" and will be removed in the near future"))),s?s(l,c,d):!0}};Wm.spelling=function(s){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${s}`),!0)};function PO(t,s,n){if(typeof t!="object")throw new As("options must be an object",As.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let a=r.length;for(;a-- >0;){const l=r[a],c=s[l];if(c){const d=t[l],h=d===void 0||c(d,l,t);if(h!==!0)throw new As("option "+l+" must be "+h,As.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new As("Unknown option "+l,As.ERR_BAD_OPTION)}}const Zh={assertOptions:PO,validators:Wm},Sa=Zh.validators;let Oo=class{constructor(s){this.defaults=s||{},this.interceptors={request:new TN,response:new TN}}async request(s,n){try{return await this._request(s,n)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const l=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?l&&!String(r.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+l):r.stack=l}catch{}}throw r}}_request(s,n){typeof s=="string"?(n=n||{},n.url=s):n=s||{},n=Mo(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:l}=n;r!==void 0&&Zh.assertOptions(r,{silentJSONParsing:Sa.transitional(Sa.boolean),forcedJSONParsing:Sa.transitional(Sa.boolean),clarifyTimeoutError:Sa.transitional(Sa.boolean),legacyInterceptorReqResOrdering:Sa.transitional(Sa.boolean)},!1),a!=null&&(et.isFunction(a)?n.paramsSerializer={serialize:a}:Zh.assertOptions(a,{encode:Sa.function,serialize:Sa.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Zh.assertOptions(n,{baseUrl:Sa.spelling("baseURL"),withXsrfToken:Sa.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let c=l&&et.merge(l.common,l[n.method]);l&&et.forEach(["delete","get","head","post","put","patch","common"],j=>{delete l[j]}),n.headers=Jr.concat(c,l);const d=[];let h=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(n)===!1)return;h=h&&g.synchronous;const y=n.transitional||Fv;y&&y.legacyInterceptorReqResOrdering?d.unshift(g.fulfilled,g.rejected):d.push(g.fulfilled,g.rejected)});const x=[];this.interceptors.response.forEach(function(g){x.push(g.fulfilled,g.rejected)});let f,m=0,p;if(!h){const j=[zN.bind(this),void 0];for(j.unshift(...d),j.push(...x),p=j.length,f=Promise.resolve(n);m{if(!r._listeners)return;let l=r._listeners.length;for(;l-- >0;)r._listeners[l](a);r._listeners=null}),this.promise.then=a=>{let l;const c=new Promise(d=>{r.subscribe(d),l=d}).then(a);return c.cancel=function(){r.unsubscribe(l)},c},s(function(l,c,d){r.reason||(r.reason=new ou(l,c,d),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(s){if(this.reason){s(this.reason);return}this._listeners?this._listeners.push(s):this._listeners=[s]}unsubscribe(s){if(!this._listeners)return;const n=this._listeners.indexOf(s);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const s=new AbortController,n=r=>{s.abort(r)};return this.subscribe(n),s.signal.unsubscribe=()=>this.unsubscribe(n),s.signal}static source(){let s;return{token:new ZC(function(a){s=a}),cancel:s}}};function OO(t){return function(n){return t.apply(null,n)}}function IO(t){return et.isObject(t)&&t.isAxiosError===!0}const Y0={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Y0).forEach(([t,s])=>{Y0[s]=t});function QC(t){const s=new Oo(t),n=DC(Oo.prototype.request,s);return et.extend(n,Oo.prototype,s,{allOwnKeys:!0}),et.extend(n,s,null,{allOwnKeys:!0}),n.create=function(a){return QC(Mo(t,a))},n}const On=QC(lu);On.Axios=Oo;On.CanceledError=ou;On.CancelToken=_O;On.isCancel=UC;On.VERSION=YC;On.toFormData=Hm;On.AxiosError=As;On.Cancel=On.CanceledError;On.all=function(s){return Promise.all(s)};On.spread=OO;On.isAxiosError=IO;On.mergeConfig=Mo;On.AxiosHeaders=Jr;On.formToJSON=t=>zC(et.isHTMLForm(t)?new FormData(t):t);On.getAdapter=KC.getAdapter;On.HttpStatusCode=Y0;On.default=On;const{Axios:pH,AxiosError:xH,CanceledError:gH,isCancel:vH,CancelToken:bH,VERSION:yH,all:jH,Cancel:NH,isAxiosError:wH,spread:SH,toFormData:CH,AxiosHeaders:AH,HttpStatusCode:kH,formToJSON:RH,getAdapter:EH,mergeConfig:DH}=On,VN="https://dealeronboarding-uat.royalenfield.com/api",Te={login:t=>ze.post("/auth/login",t),logout:()=>ze.post("/auth/logout"),getCurrentUser:()=>ze.get("/auth/me"),getRoles:()=>ze.get("/admin/roles"),createRole:t=>ze.post("/admin/roles",t),getPermissions:()=>ze.get("/admin/permissions"),updateRole:(t,s)=>ze.put(`/admin/roles/${t}`,s),getZones:()=>ze.get("/master/zones"),createZone:t=>ze.post("/master/zones",t),updateZone:(t,s)=>ze.put(`/master/zones/${t}`,s),createRegion:t=>ze.post("/master/regions",t),updateRegion:(t,s)=>ze.put(`/master/regions/${t}`,s),getRegions:()=>ze.get("/master/regions"),getOutlets:()=>ze.get("/outlets"),getOutletByCode:t=>ze.get(`/master/outlets/code/${t}`),getStates:t=>ze.get("/master/states",typeof t=="string"?{zoneId:t}:t),getDistricts:t=>ze.get("/master/districts",typeof t=="string"?{stateId:t}:t),getAreas:t=>ze.get("/master/areas",t),updateArea:(t,s)=>ze.put(`/master/areas/${t}`,s),createArea:t=>ze.post("/master/areas",t),getAreaManagers:()=>ze.get("/master/area-managers"),getASMs:()=>ze.get("/master/asms"),getZonalManagers:()=>ze.get("/master/zonal-managers"),saveZonalManager:t=>ze.post("/master/zonal-managers",t),getDDLeads:()=>ze.get("/master/dd-leads"),saveDDLead:t=>ze.post("/master/dd-leads",t),getManagersByRole:t=>ze.get("/master/managers",t),submitApplication:t=>ze.post("/onboarding/apply",t),exportApplicationResponses:t=>ze.get("/onboarding/applications/export-responses",t),getApplications:t=>ze.get("/onboarding/applications",t),shortlistApplications:t=>ze.post("/onboarding/applications/shortlist",t),getApplicationById:t=>ze.get(`/onboarding/applications/${t}`),updateApplication:(t,s)=>ze.put(`/onboarding/applications/${t}`,s),getLatestQuestionnaire:()=>ze.get("/questionnaire/latest"),createQuestionnaireVersion:t=>ze.post("/questionnaire/version",t),submitQuestionnaireResponse:t=>ze.post("/questionnaire/response",t),getAllQuestionnaires:()=>ze.get("/onboarding/questionnaires"),getQuestionnaireById:t=>ze.get(`/onboarding/questionnaires/${t}`),assignArchitectureTeam:(t,s)=>ze.post(`/onboarding/applications/${t}/assign-architecture`,{assignedTo:s}),updateArchitectureStatus:(t,s,n)=>ze.post(`/onboarding/applications/${t}/architecture-status`,{status:s,remarks:n}),generateDealerCodes:t=>ze.post(`/onboarding/applications/${t}/generate-codes`),updateApplicationStatus:(t,s)=>ze.put(`/onboarding/applications/${t}/status`,s),convertToOpportunity:(t,s)=>ze.post(`/onboarding/applications/${t}/convert-to-opportunity`,s),bulkConvertToOpportunity:t=>ze.post("/onboarding/applications/bulk-convert-to-opportunity",t),retriggerEvaluators:t=>ze.post(`/onboarding/applications/${t}/retrigger-evaluators`),getSecurityDeposit:t=>ze.get(`/loa/security-deposit/${t}`),updateSecurityDeposit:t=>ze.post("/loa/security-deposit",t),uploadDocument:(t,s)=>ze.post(`/onboarding/applications/${t}/documents`,s,{headers:{"Content-Type":"multipart/form-data"}}),getDocuments:t=>ze.get(`/onboarding/applications/${t}/documents`),getDocumentConfigMetadata:()=>ze.get("/onboarding/document-configs/metadata"),getDocumentConfigs:t=>ze.get("/onboarding/document-configs",t),createDocumentConfig:t=>ze.post("/onboarding/document-configs",t),updateDocumentConfig:(t,s)=>ze.put(`/onboarding/document-configs/${t}`,s),deleteDocumentConfig:t=>ze.delete(`/onboarding/document-configs/${t}`),getPublicQuestionnaire:t=>On.get(`${VN}/questionnaire/public/${t}`),submitPublicResponse:t=>On.post(`${VN}/questionnaire/public/submit`,t),getAiSummary:t=>ze.get(`/assessment/ai-summary/${t}`),scheduleInterview:t=>ze.post("/assessment/interviews",t),updateInterview:(t,s)=>ze.put(`/assessment/interviews/${t}`,s),submitEvaluation:(t,s)=>ze.post(`/assessment/interviews/${t}/evaluation`,s),submitKTMatrix:t=>ze.post("/assessment/kt-matrix",t),submitLevel2Feedback:t=>ze.post("/assessment/level2-feedback",t),getInterviews:t=>ze.get(`/assessment/interviews/${t}`),updateRecommendation:t=>ze.post("/assessment/recommendation",t),updateInterviewDecision:t=>ze.post("/assessment/decision",t),submitStageDecision:t=>ze.post("/assessment/stage-decision",t),getInterviewApprovalStatus:t=>ze.get(`/assessment/interviews/${t}/approval-status`),getApprovalPolicies:()=>ze.get("/assessment/approval-policies"),upsertApprovalPolicy:(t,s)=>ze.put(`/assessment/approval-policies/${t}`,s),getWorknotes:(t,s)=>ze.get("/collaboration/worknotes",{requestId:t,requestType:s}),addWorknote:t=>ze.post("/collaboration/worknotes",t),addParticipant:t=>ze.post("/collaboration/participants",t),removeParticipant:t=>ze.delete(`/collaboration/participants/${t}`),getUsers:t=>ze.get("/admin/users",t),createUser:t=>ze.post("/admin/users",t),updateUser:(t,s)=>ze.put(`/admin/users/${t}`,s),updateUserStatus:(t,s)=>ze.patch(`/admin/users/${t}/status`,s),deleteUser:t=>ze.delete(`/admin/users/${t}`),getDealers:t=>ze.get("/dealer",t),createDealer:t=>ze.post("/dealer",t),getDealerById:t=>ze.get(`/dealer/${t}`),updateDealer:(t,s)=>ze.put(`/dealer/${t}`,s),getDealerDashboard:()=>ze.get("/dealer/dashboard"),getDealerBankDetails:t=>ze.get(`/dealer/${t}/bank-details`),saveBankDetail:(t,s)=>ze.post(`/dealer/${t}/bank-details`,s),deleteBankDetail:t=>ze.delete(`/dealer/bank-details/${t}`),getEmailTemplates:()=>ze.get("/admin/email-templates"),getEmailTemplate:t=>ze.get(`/admin/email-templates/${t}`),createEmailTemplate:t=>ze.post("/admin/email-templates",t),updateEmailTemplate:(t,s)=>ze.put(`/admin/email-templates/${t}`,s),deleteEmailTemplate:t=>ze.delete(`/admin/email-templates/${t}`),previewEmailTemplate:t=>ze.post("/admin/email-templates/preview",t),getAuditLogs:(t,s,n=1,r=50)=>ze.get("/audit/logs",{entityType:t,entityId:s,page:n,limit:r}),getAuditSummary:(t,s)=>ze.get("/audit/summary",{entityType:t,entityId:s}),sendOtp:t=>ze.post("/prospective-login/send-otp",{phone:t}),verifyOtp:(t,s)=>ze.post("/prospective-login/verify-otp",{phone:t,otp:s}),getResignationById:t=>ze.get(`/resignation/${t}`),uploadResignationDocument:(t,s)=>ze.post(`/resignation/${t}/documents`,s,{headers:{"Content-Type":"multipart/form-data"}}),updateClearance:(t,s)=>ze.put(`/resignation/${t}/clearance`,s,{headers:s instanceof FormData?{"Content-Type":"multipart/form-data"}:{}}),updateResignationStatus:(t,s)=>ze.post(`/resignation/${t}/status`,s),getTerminationById:t=>ze.get(`/termination/${t}`),uploadTerminationDocument:(t,s)=>ze.post(`/termination/${t}/documents`,s,{headers:{"Content-Type":"multipart/form-data"}}),updateTerminationStatus:(t,s)=>ze.post(`/termination/${t}/status`,s),issueSCN:(t,s)=>ze.post(`/termination/${t}/scn`,s),uploadSCNResponse:(t,s)=>ze.post(`/termination/${t}/scn-response`,s,{headers:{"Content-Type":"multipart/form-data"}}),finalizeTermination:(t,s)=>ze.post(`/termination/${t}/finalize`,s),getResignations:t=>ze.get("/resignation",t),createResignation:t=>ze.post("/resignation",t),approveResignation:(t,s)=>ze.post(`/resignation/${t}/approve`,s),rejectResignation:(t,s)=>ze.post(`/resignation/${t}/reject`,s),withdrawResignation:(t,s)=>ze.post(`/resignation/${t}/withdraw`,{reason:s}),getTerminations:t=>ze.get("/termination",t),createTermination:t=>ze.post("/termination",t),updateTermination:(t,s)=>ze.post(`/termination/${t}/status`,s),getOnboardingPayments:()=>ze.get("/settlement/onboarding"),updatePayment:(t,s)=>ze.put(`/settlement/payments/${t}`,s),getFnFSettlements:()=>ze.get("/settlement/fnf"),getFnFSettlementById:t=>ze.get(`/settlement/fnf/${t}`),calculateFnF:t=>ze.post(`/settlement/fnf/${t}/calculate`),updateFnF:(t,s)=>ze.put(`/settlement/fnf/${t}`,s),uploadFnFDocument:(t,s)=>ze.post(`/settlement/fnf/${t}/documents`,s,{headers:{"Content-Type":"multipart/form-data"}}),getSettlementDepartments:()=>ze.get("/settlement/departments"),addLineItem:(t,s)=>ze.post(`/settlement/fnf/${t}/line-items`,s),updateFnFClearance:(t,s,n)=>ze.put(`/settlement/fnf/${t}/clearances/${s}`,n,{headers:{"Content-Type":"multipart/form-data"}}),updateLineItem:(t,s)=>ze.put(`/settlement/fnf/line-items/${t}`,s),deleteLineItem:t=>ze.delete(`/settlement/fnf/line-items/${t}`),getRelocationRequests:t=>ze.get("/relocation",t),getRelocationRequestById:t=>ze.get(`/relocation/${t}`),createRelocationRequest:t=>ze.post("/relocation",t),updateRelocationRequest:(t,s,n)=>ze.post(`/relocation/${t}/action`,{action:s,...n}),uploadRelocationDocument:(t,s)=>ze.post(`/relocation/${t}/documents`,s,{headers:{"Content-Type":"multipart/form-data"}}),verifyRelocationDocument:(t,s)=>ze.post(`/relocation/${t}/documents/${s}/verify`),rejectRelocationDocument:(t,s,n)=>ze.post(`/relocation/${t}/documents/${s}/reject`,n||{}),getConstitutionalChanges:t=>ze.get("/constitutional-change",t),getConstitutionalChangeMeta:()=>ze.get("/constitutional-change/meta"),getConstitutionalChangeById:t=>ze.get(`/constitutional-change/${t}`),createConstitutionalChange:t=>ze.post("/constitutional-change",t),updateConstitutionalChange:(t,s,n)=>ze.post(`/constitutional-change/${t}/action`,{action:s,...n}),uploadConstitutionalDocuments:(t,s)=>ze.post(`/constitutional-change/${t}/documents`,{documents:s}),getSlaConfigs:()=>ze.get("/master/sla-configs"),saveSlaConfig:t=>ze.post("/master/sla-configs",t),initializeDefaultSlas:()=>ze.post("/master/sla-configs/initialize"),getInterviewConfigs:t=>ze.get("/master/interview-configs",t),getInterviewConfigById:t=>ze.get(`/master/interview-configs/${t}`),getInterviewConfigByType:t=>ze.get(`/master/interview-configs/active/${t}`),createInterviewConfig:t=>ze.post("/master/interview-configs",t),updateInterviewConfig:(t,s)=>ze.put(`/master/interview-configs/${t}`,s),deleteInterviewConfig:t=>ze.delete(`/master/interview-configs/${t}`),initializeDefaultInterviewConfigs:()=>ze.post("/master/interview-configs/initialize"),getSystemConfigs:t=>ze.get("/master/system-configs",t),saveSystemConfig:t=>ze.post("/master/system-configs",t),getDealerAsmMappings:()=>ze.get("/master/dealer-asm-mappings"),saveDealerAsmMapping:t=>ze.post("/master/dealer-asm-mappings",t),getEorChecklistForApplication:t=>ze.get(`/eor/application/${t}`),getEorChecklistForRelocation:t=>ze.get(`/eor/relocation/${t}`),updateEorChecklistItem:(t,s)=>ze.post(`/eor/item/${t}`,s),submitEorAudit:(t,s)=>ze.post(`/eor/audit/${t}`,s),submitFddReport:t=>ze.post("/fdd/report",t),getFddAssignment:t=>ze.get(`/fdd/${t}`),assignFddAgency:t=>ze.post("/fdd/assign",t),flagNonResponsive:t=>ze.post("/flag",t)},Pd=Object.freeze(Object.defineProperty({__proto__:null,API:Te,default:Te},Symbol.toStringTag,{value:"Module"})),LO={user:null,token:localStorage.getItem("token"),isAuthenticated:!1,loading:!0,error:null},Qh=zP("auth/initializeAuth",async(t,{rejectWithValue:s})=>{const n=localStorage.getItem("token");if(!n)return s("No token found");try{const r=await Te.getCurrentUser();if(r.ok&&r.data){const{user:a}=r.data;return{user:{id:a.id,name:a.fullName||a.email.split("@")[0],email:a.email,password:"",role:typeof a.role=="string"?a.role:a.roleCode||"User",roleCode:a.roleCode||(typeof a.role=="string"?a.role:"User")},token:n}}return s("Failed to fetch user")}catch(r){return s(r.message||"Session restoration failed")}}),XC=EC({name:"auth",initialState:LO,reducers:{setCredentials:(t,s)=>{t.user=s.payload.user,t.token=s.payload.token,t.isAuthenticated=!0,t.loading=!1,localStorage.setItem("token",s.payload.token)},logout:t=>{t.user=null,t.token=null,t.isAuthenticated=!1,t.loading=!1,localStorage.removeItem("token")},setLoading:(t,s)=>{t.loading=s.payload}},extraReducers:t=>{t.addCase(Qh.pending,s=>{s.loading=!0}).addCase(Qh.fulfilled,(s,n)=>{s.user=n.payload.user,s.token=n.payload.token,s.isAuthenticated=!0,s.loading=!1}).addCase(Qh.rejected,s=>{s.user=null,s.token=null,s.isAuthenticated=!1,s.loading=!1,localStorage.removeItem("token")})}}),{setCredentials:JC,logout:e2,setLoading:TH}=XC.actions,MO=XC.reducer,FO={zones:[],regionalOffices:[],asms:[],zonalManagerMappings:[],zonalManagers:[],roles:[],allStates:[],allDistricts:[],allAreas:[],availablePermissions:[],emailTemplates:[],slaConfigs:[],users:[],ddLeads:[],areasPagination:{total:0,page:1,limit:10,totalPages:0},loading:!1,isAreasLoading:!1,error:null},t2=EC({name:"master",initialState:FO,reducers:{setMasterData:(t,s)=>({...t,...s.payload}),setAreasData:(t,s)=>{t.allAreas=s.payload.data,t.areasPagination=s.payload.pagination},setAreasLoading:(t,s)=>{t.isAreasLoading=s.payload},setZones:(t,s)=>{t.zones=s.payload},setRegionalOffices:(t,s)=>{t.regionalOffices=s.payload},setAsms:(t,s)=>{t.asms=s.payload},setZonalManagerMappings:(t,s)=>{t.zonalManagerMappings=s.payload},setUsers:(t,s)=>{t.users=s.payload},setLoading:(t,s)=>{t.loading=s.payload},setError:(t,s)=>{t.error=s.payload},setDdLeads:(t,s)=>{t.ddLeads=s.payload}}}),{setMasterData:s2,setZones:PH,setRegionalOffices:_H,setAsms:OH,setZonalManagerMappings:IH,setUsers:LH,setLoading:HN,setError:BO,setAreasData:$O,setAreasLoading:WN,setDdLeads:MH}=t2.actions,qO=t2.reducer,zO=_P({reducer:{auth:MO,master:qO}});var cu=Dv();const qv=_m(cu);/** +`):" "+ki(Be[0]):"as no adapter specified";throw new qt("There is no suitable adapter to dispatch the request "+lt,"ERR_NOT_SUPPORT")}return we}var Ko={getAdapter:rl,adapters:Ai};function Ta(J){if(J.cancelToken&&J.cancelToken.throwIfRequested(),J.signal&&J.signal.aborted)throw new Un(null,J)}function ri(J){return Ta(J),J.headers=Ws.from(J.headers),J.data=Qs.call(J,J.transformRequest),["post","put","patch"].indexOf(J.method)!==-1&&J.headers.setContentType("application/x-www-form-urlencoded",!1),Ko.getAdapter(J.adapter||at.adapter,J)(J).then(function(xe){return Ta(J),xe.data=Qs.call(J,J.transformResponse,xe),xe.headers=Ws.from(xe.headers),xe},function(xe){return zn(xe)||(Ta(J),xe&&xe.response&&(xe.response.data=Qs.call(J,J.transformResponse,xe.response),xe.response.headers=Ws.from(xe.response.headers))),Promise.reject(xe)})}const _a="1.13.6",Pa={};["object","boolean","number","function","string","symbol"].forEach((J,te)=>{Pa[J]=function(xe){return typeof xe===J||"a"+(te<1?"n ":" ")+J}});const to={};Pa.transitional=function(te,ue,xe){function we($e,Be){return"[Axios v"+_a+"] Transitional option '"+$e+"'"+Be+(xe?". "+xe:"")}return($e,Be,lt)=>{if(te===!1)throw new qt(we(Be," has been removed"+(ue?" in "+ue:"")),qt.ERR_DEPRECATED);return ue&&!to[Be]&&(to[Be]=!0,console.warn(we(Be," has been deprecated since v"+ue+" and will be removed in the near future"))),te?te($e,Be,lt):!0}},Pa.spelling=function(te){return(ue,xe)=>(console.warn(`${xe} is likely a misspelling of ${te}`),!0)};function Zc(J,te,ue){if(typeof J!="object")throw new qt("options must be an object",qt.ERR_BAD_OPTION_VALUE);const xe=Object.keys(J);let we=xe.length;for(;we-- >0;){const $e=xe[we],Be=te[$e];if(Be){const lt=J[$e],Jt=lt===void 0||Be(lt,$e,J);if(Jt!==!0)throw new qt("option "+$e+" must be "+Jt,qt.ERR_BAD_OPTION_VALUE);continue}if(ue!==!0)throw new qt("Unknown option "+$e,qt.ERR_BAD_OPTION)}}var Oa={assertOptions:Zc,validators:Pa};const Vn=Oa.validators;class ai{constructor(te){this.defaults=te||{},this.interceptors={request:new st,response:new st}}async request(te,ue){try{return await this._request(te,ue)}catch(xe){if(xe instanceof Error){let we={};Error.captureStackTrace?Error.captureStackTrace(we):we=new Error;const $e=we.stack?we.stack.replace(/^.+\n/,""):"";try{xe.stack?$e&&!String(xe.stack).endsWith($e.replace(/^.+\n.+\n/,""))&&(xe.stack+=` +`+$e):xe.stack=$e}catch{}}throw xe}}_request(te,ue){typeof te=="string"?(ue=ue||{},ue.url=te):ue=te||{},ue=xn(this.defaults,ue);const{transitional:xe,paramsSerializer:we,headers:$e}=ue;xe!==void 0&&Oa.assertOptions(xe,{silentJSONParsing:Vn.transitional(Vn.boolean),forcedJSONParsing:Vn.transitional(Vn.boolean),clarifyTimeoutError:Vn.transitional(Vn.boolean),legacyInterceptorReqResOrdering:Vn.transitional(Vn.boolean)},!1),we!=null&&(Re.isFunction(we)?ue.paramsSerializer={serialize:we}:Oa.assertOptions(we,{encode:Vn.function,serialize:Vn.function},!0)),ue.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?ue.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:ue.allowAbsoluteUrls=!0),Oa.assertOptions(ue,{baseUrl:Vn.spelling("baseURL"),withXsrfToken:Vn.spelling("withXSRFToken")},!0),ue.method=(ue.method||this.defaults.method||"get").toLowerCase();let Be=$e&&Re.merge($e.common,$e[ue.method]);$e&&Re.forEach(["delete","get","head","post","put","patch","common"],Ot=>{delete $e[Ot]}),ue.headers=Ws.concat(Be,$e);const lt=[];let Jt=!0;this.interceptors.request.forEach(function(bs){if(typeof bs.runWhen=="function"&&bs.runWhen(ue)===!1)return;Jt=Jt&&bs.synchronous;const es=ue.transitional||bt;es&&es.legacyInterceptorReqResOrdering?lt.unshift(bs.fulfilled,bs.rejected):lt.push(bs.fulfilled,bs.rejected)});const Mt=[];this.interceptors.response.forEach(function(bs){Mt.push(bs.fulfilled,bs.rejected)});let Et,gs=0,tn;if(!Jt){const Ot=[ri.bind(this),void 0];for(Ot.unshift(...lt),Ot.push(...Mt),tn=Ot.length,Et=Promise.resolve(ue);gs{if(!xe._listeners)return;let $e=xe._listeners.length;for(;$e-- >0;)xe._listeners[$e](we);xe._listeners=null}),this.promise.then=we=>{let $e;const Be=new Promise(lt=>{xe.subscribe(lt),$e=lt}).then(we);return Be.cancel=function(){xe.unsubscribe($e)},Be},te(function($e,Be,lt){xe.reason||(xe.reason=new Un($e,Be,lt),ue(xe.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(te){if(this.reason){te(this.reason);return}this._listeners?this._listeners.push(te):this._listeners=[te]}unsubscribe(te){if(!this._listeners)return;const ue=this._listeners.indexOf(te);ue!==-1&&this._listeners.splice(ue,1)}toAbortSignal(){const te=new AbortController,ue=xe=>{te.abort(xe)};return this.subscribe(ue),te.signal.unsubscribe=()=>this.unsubscribe(ue),te.signal}static source(){let te;return{token:new Or(function(we){te=we}),cancel:te}}}var so=Or;function Ei(J){return function(ue){return J.apply(null,ue)}}function no(J){return Re.isObject(J)&&J.isAxiosError===!0}const ii={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ii).forEach(([J,te])=>{ii[te]=J});var al=ii;function ro(J){const te=new Ri(J),ue=t(Ri.prototype.request,te);return Re.extend(ue,Ri.prototype,te,{allOwnKeys:!0}),Re.extend(ue,te,null,{allOwnKeys:!0}),ue.create=function(we){return ro(xn(J,we))},ue}const Hs=ro(at);return Hs.Axios=Ri,Hs.CanceledError=Un,Hs.CancelToken=so,Hs.isCancel=zn,Hs.VERSION=_a,Hs.toFormData=ie,Hs.AxiosError=qt,Hs.Cancel=Hs.CanceledError,Hs.all=function(te){return Promise.all(te)},Hs.spread=Ei,Hs.isAxiosError=no,Hs.mergeConfig=xn,Hs.AxiosHeaders=Ws,Hs.formToJSON=J=>en(Re.isHTMLForm(J)?new FormData(J):J),Hs.getAdapter=Ko.getAdapter,Hs.HttpStatusCode=al,Hs.default=Hs,jx=Hs,jx}var EN;function iP(){if(EN)return cr;EN=1;function t(q){return q&&typeof q=="object"&&"default"in q?q.default:q}Object.defineProperty(cr,"__esModule",{value:!0});var s=t(aP()),n=function(){return(n=Object.assign||function(q){for(var K,Z=1,W=arguments.length;Z0&&U[U.length-1])&&(G[0]===6||G[0]===2)){B=0;continue}if(G[0]===3&&(!U||G[1]>U[0]&&G[1]=q&&Z<=K},d=function(q){return!!q&&(typeof q=="object"||typeof q=="function")&&typeof q.then=="function"},m={Accept:"application/json","Content-Type":"application/json"},x={timeout:0},f=null,h="CLIENT_ERROR",g="SERVER_ERROR",u="TIMEOUT_ERROR",j="CONNECTION_ERROR",p="NETWORK_ERROR",y="UNKNOWN_ERROR",N="CANCEL_ERROR",S=["ECONNABORTED"],A=["ENOTFOUND","ECONNREFUSED","ECONNRESET"],w=["ERR_BAD_REQUEST","ERR_BAD_RESPONSE"],E=function(q){return c(200,299,q)},T=function(q){return c(400,499,q)},C=function(q){return c(500,599,q)},L=function(q){return q.message==="Network Error"?p:s.isCancel(q)?N:q.code?w.includes(q.code)?$(q.response.status):S.includes(q.code)?u:A.includes(q.code)?j:y:$(q.response?q.response.status:null)},$=function(q){return q?E(q)?f:T(q)?h:C(q)?g:y:y},_=function(q){var K,Z=n(n({},m),q.headers||{});if(q.axiosInstance)K=q.axiosInstance;else{var W=n(n({},q),{headers:void 0}),U=n(n({},x),W);K=s.create(U)}var F=[],B=[],D=[],O=[],z=[],G=function(re,ge){return Z[re]=ge,K},Y=function(re){return function(ge,ve,Se){return ve===void 0&&(ve={}),Se===void 0&&(Se={}),X(n(n({},Se),{url:ge,params:ve,method:re}))}},V=function(re){return function(ge,ve,Se){return Se===void 0&&(Se={}),X(n(n({},Se),{url:ge,method:re,data:ve}))}},X=function(re){return r(void 0,void 0,void 0,function(){var ge,ve,Se,We;return a(this,function(Ce){switch(Ce.label){case 0:if(re.headers=n(n({},Z),re.headers),B.length>0&&B.forEach(function(fe){return fe(re)}),!(D.length>0))return[3,6];ge=0,Ce.label=1;case 1:return ge0&&O.forEach(function(Rt){return Rt(ye)}),!(z.length>0))return[3,6];le=0,Gt.label=1;case 1:return le{const s=localStorage.getItem("token");s&&t.headers&&(t.headers.Authorization=`Bearer ${s}`)});ze.addResponseTransform(t=>{var s,n;if(!t.ok&&t.status===401){const r=localStorage.getItem("token");console.error("Unauthorized access - potential token expiration. Token exists in localStorage:",!!r),console.error("Full 401 Response Details:",{url:(s=t.config)==null?void 0:s.url,method:(n=t.config)==null?void 0:n.method,data:t.data}),window.dispatchEvent(new Event("auth:logout"))}});function OC(t,s){return function(){return t.apply(s,arguments)}}const{toString:cP}=Object.prototype,{getPrototypeOf:Bv}=Object,{iterator:Vm,toStringTag:LC}=Symbol,Hm=(t=>s=>{const n=cP.call(s);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ti=t=>(t=t.toLowerCase(),s=>Hm(s)===t),Wm=t=>s=>typeof s===t,{isArray:Mc}=Array,Ec=Wm("undefined");function ru(t){return t!==null&&!Ec(t)&&t.constructor!==null&&!Ec(t.constructor)&&Xr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const IC=ti("ArrayBuffer");function dP(t){let s;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?s=ArrayBuffer.isView(t):s=t&&t.buffer&&IC(t.buffer),s}const uP=Wm("string"),Xr=Wm("function"),MC=Wm("number"),au=t=>t!==null&&typeof t=="object",hP=t=>t===!0||t===!1,Yh=t=>{if(Hm(t)!=="object")return!1;const s=Bv(t);return(s===null||s===Object.prototype||Object.getPrototypeOf(s)===null)&&!(LC in t)&&!(Vm in t)},mP=t=>{if(!au(t)||ru(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},fP=ti("Date"),pP=ti("File"),xP=t=>!!(t&&typeof t.uri<"u"),gP=t=>t&&typeof t.getParts<"u",vP=ti("Blob"),bP=ti("FileList"),yP=t=>au(t)&&Xr(t.pipe);function jP(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const DN=jP(),TN=typeof DN.FormData<"u"?DN.FormData:void 0,NP=t=>{let s;return t&&(TN&&t instanceof TN||Xr(t.append)&&((s=Hm(t))==="formdata"||s==="object"&&Xr(t.toString)&&t.toString()==="[object FormData]"))},wP=ti("URLSearchParams"),[SP,CP,AP,kP]=["ReadableStream","Request","Response","Headers"].map(ti),RP=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function iu(t,s,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,a;if(typeof t!="object"&&(t=[t]),Mc(t))for(r=0,a=t.length;r0;)if(a=n[r],s===a.toLowerCase())return a;return null}const Do=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,BC=t=>!Ec(t)&&t!==Do;function Y0(){const{caseless:t,skipUndefined:s}=BC(this)&&this||{},n={},r=(a,l)=>{if(l==="__proto__"||l==="constructor"||l==="prototype")return;const c=t&&FC(n,l)||l;Yh(n[c])&&Yh(a)?n[c]=Y0(n[c],a):Yh(a)?n[c]=Y0({},a):Mc(a)?n[c]=a.slice():(!s||!Ec(a))&&(n[c]=a)};for(let a=0,l=arguments.length;a(iu(s,(a,l)=>{n&&Xr(a)?Object.defineProperty(t,l,{value:OC(a,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,l,{value:a,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),DP=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),TP=(t,s,n,r)=>{t.prototype=Object.create(s.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:s.prototype}),n&&Object.assign(t.prototype,n)},_P=(t,s,n,r)=>{let a,l,c;const d={};if(s=s||{},t==null)return s;do{for(a=Object.getOwnPropertyNames(t),l=a.length;l-- >0;)c=a[l],(!r||r(c,t,s))&&!d[c]&&(s[c]=t[c],d[c]=!0);t=n!==!1&&Bv(t)}while(t&&(!n||n(t,s))&&t!==Object.prototype);return s},PP=(t,s,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=s.length;const r=t.indexOf(s,n);return r!==-1&&r===n},OP=t=>{if(!t)return null;if(Mc(t))return t;let s=t.length;if(!MC(s))return null;const n=new Array(s);for(;s-- >0;)n[s]=t[s];return n},LP=(t=>s=>t&&s instanceof t)(typeof Uint8Array<"u"&&Bv(Uint8Array)),IP=(t,s)=>{const r=(t&&t[Vm]).call(t);let a;for(;(a=r.next())&&!a.done;){const l=a.value;s.call(t,l[0],l[1])}},MP=(t,s)=>{let n;const r=[];for(;(n=t.exec(s))!==null;)r.push(n);return r},FP=ti("HTMLFormElement"),BP=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,a){return r.toUpperCase()+a}),_N=(({hasOwnProperty:t})=>(s,n)=>t.call(s,n))(Object.prototype),$P=ti("RegExp"),$C=(t,s)=>{const n=Object.getOwnPropertyDescriptors(t),r={};iu(n,(a,l)=>{let c;(c=s(a,l,t))!==!1&&(r[l]=c||a)}),Object.defineProperties(t,r)},qP=t=>{$C(t,(s,n)=>{if(Xr(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Xr(r)){if(s.enumerable=!1,"writable"in s){s.writable=!1;return}s.set||(s.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},zP=(t,s)=>{const n={},r=a=>{a.forEach(l=>{n[l]=!0})};return Mc(t)?r(t):r(String(t).split(s)),n},UP=()=>{},VP=(t,s)=>t!=null&&Number.isFinite(t=+t)?t:s;function HP(t){return!!(t&&Xr(t.append)&&t[LC]==="FormData"&&t[Vm])}const WP=t=>{const s=new Array(10),n=(r,a)=>{if(au(r)){if(s.indexOf(r)>=0)return;if(ru(r))return r;if(!("toJSON"in r)){s[a]=r;const l=Mc(r)?[]:{};return iu(r,(c,d)=>{const m=n(c,a+1);!Ec(m)&&(l[d]=m)}),s[a]=void 0,l}}return r};return n(t,0)},KP=ti("AsyncFunction"),GP=t=>t&&(au(t)||Xr(t))&&Xr(t.then)&&Xr(t.catch),qC=((t,s)=>t?setImmediate:s?((n,r)=>(Do.addEventListener("message",({source:a,data:l})=>{a===Do&&l===n&&r.length&&r.shift()()},!1),a=>{r.push(a),Do.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Xr(Do.postMessage)),YP=typeof queueMicrotask<"u"?queueMicrotask.bind(Do):typeof process<"u"&&process.nextTick||qC,ZP=t=>t!=null&&Xr(t[Vm]),et={isArray:Mc,isArrayBuffer:IC,isBuffer:ru,isFormData:NP,isArrayBufferView:dP,isString:uP,isNumber:MC,isBoolean:hP,isObject:au,isPlainObject:Yh,isEmptyObject:mP,isReadableStream:SP,isRequest:CP,isResponse:AP,isHeaders:kP,isUndefined:Ec,isDate:fP,isFile:pP,isReactNativeBlob:xP,isReactNative:gP,isBlob:vP,isRegExp:$P,isFunction:Xr,isStream:yP,isURLSearchParams:wP,isTypedArray:LP,isFileList:bP,forEach:iu,merge:Y0,extend:EP,trim:RP,stripBOM:DP,inherits:TP,toFlatObject:_P,kindOf:Hm,kindOfTest:ti,endsWith:PP,toArray:OP,forEachEntry:IP,matchAll:MP,isHTMLForm:FP,hasOwnProperty:_N,hasOwnProp:_N,reduceDescriptors:$C,freezeMethods:qP,toObjectSet:zP,toCamelCase:BP,noop:UP,toFiniteNumber:VP,findKey:FC,global:Do,isContextDefined:BC,isSpecCompliantForm:HP,toJSONObject:WP,isAsyncFn:KP,isThenable:GP,setImmediate:qC,asap:YP,isIterable:ZP};let As=class zC extends Error{static from(s,n,r,a,l,c){const d=new zC(s.message,n||s.code,r,a,l);return d.cause=s,d.name=s.name,s.status!=null&&d.status==null&&(d.status=s.status),c&&Object.assign(d,c),d}constructor(s,n,r,a,l){super(s),Object.defineProperty(this,"message",{value:s,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),a&&(this.request=a),l&&(this.response=l,this.status=l.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:et.toJSONObject(this.config),code:this.code,status:this.status}}};As.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";As.ERR_BAD_OPTION="ERR_BAD_OPTION";As.ECONNABORTED="ECONNABORTED";As.ETIMEDOUT="ETIMEDOUT";As.ERR_NETWORK="ERR_NETWORK";As.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";As.ERR_DEPRECATED="ERR_DEPRECATED";As.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";As.ERR_BAD_REQUEST="ERR_BAD_REQUEST";As.ERR_CANCELED="ERR_CANCELED";As.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";As.ERR_INVALID_URL="ERR_INVALID_URL";const QP=null;function Z0(t){return et.isPlainObject(t)||et.isArray(t)}function UC(t){return et.endsWith(t,"[]")?t.slice(0,-2):t}function Nx(t,s,n){return t?t.concat(s).map(function(a,l){return a=UC(a),!n&&l?"["+a+"]":a}).join(n?".":""):s}function XP(t){return et.isArray(t)&&!t.some(Z0)}const JP=et.toFlatObject(et,{},null,function(s){return/^is[A-Z]/.test(s)});function Km(t,s,n){if(!et.isObject(t))throw new TypeError("target must be an object");s=s||new FormData,n=et.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,y){return!et.isUndefined(y[p])});const r=n.metaTokens,a=n.visitor||f,l=n.dots,c=n.indexes,m=(n.Blob||typeof Blob<"u"&&Blob)&&et.isSpecCompliantForm(s);if(!et.isFunction(a))throw new TypeError("visitor must be a function");function x(j){if(j===null)return"";if(et.isDate(j))return j.toISOString();if(et.isBoolean(j))return j.toString();if(!m&&et.isBlob(j))throw new As("Blob is not supported. Use a Buffer instead.");return et.isArrayBuffer(j)||et.isTypedArray(j)?m&&typeof Blob=="function"?new Blob([j]):Buffer.from(j):j}function f(j,p,y){let N=j;if(et.isReactNative(s)&&et.isReactNativeBlob(j))return s.append(Nx(y,p,l),x(j)),!1;if(j&&!y&&typeof j=="object"){if(et.endsWith(p,"{}"))p=r?p:p.slice(0,-2),j=JSON.stringify(j);else if(et.isArray(j)&&XP(j)||(et.isFileList(j)||et.endsWith(p,"[]"))&&(N=et.toArray(j)))return p=UC(p),N.forEach(function(A,w){!(et.isUndefined(A)||A===null)&&s.append(c===!0?Nx([p],w,l):c===null?p:p+"[]",x(A))}),!1}return Z0(j)?!0:(s.append(Nx(y,p,l),x(j)),!1)}const h=[],g=Object.assign(JP,{defaultVisitor:f,convertValue:x,isVisitable:Z0});function u(j,p){if(!et.isUndefined(j)){if(h.indexOf(j)!==-1)throw Error("Circular reference detected in "+p.join("."));h.push(j),et.forEach(j,function(N,S){(!(et.isUndefined(N)||N===null)&&a.call(s,N,et.isString(S)?S.trim():S,p,g))===!0&&u(N,p?p.concat(S):[S])}),h.pop()}}if(!et.isObject(t))throw new TypeError("data must be an object");return u(t),s}function PN(t){const s={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return s[r]})}function $v(t,s){this._pairs=[],t&&Km(t,this,s)}const VC=$v.prototype;VC.append=function(s,n){this._pairs.push([s,n])};VC.toString=function(s){const n=s?function(r){return s.call(this,r,PN)}:PN;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function e4(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function HC(t,s,n){if(!s)return t;const r=n&&n.encode||e4,a=et.isFunction(n)?{serialize:n}:n,l=a&&a.serialize;let c;if(l?c=l(s,a):c=et.isURLSearchParams(s)?s.toString():new $v(s,a).toString(r),c){const d=t.indexOf("#");d!==-1&&(t=t.slice(0,d)),t+=(t.indexOf("?")===-1?"?":"&")+c}return t}class ON{constructor(){this.handlers=[]}use(s,n,r){return this.handlers.push({fulfilled:s,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(s){this.handlers[s]&&(this.handlers[s]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(s){et.forEach(this.handlers,function(r){r!==null&&s(r)})}}const qv={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},t4=typeof URLSearchParams<"u"?URLSearchParams:$v,s4=typeof FormData<"u"?FormData:null,n4=typeof Blob<"u"?Blob:null,r4={isBrowser:!0,classes:{URLSearchParams:t4,FormData:s4,Blob:n4},protocols:["http","https","file","blob","url","data"]},zv=typeof window<"u"&&typeof document<"u",Q0=typeof navigator=="object"&&navigator||void 0,a4=zv&&(!Q0||["ReactNative","NativeScript","NS"].indexOf(Q0.product)<0),i4=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",l4=zv&&window.location.href||"http://localhost",o4=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:zv,hasStandardBrowserEnv:a4,hasStandardBrowserWebWorkerEnv:i4,navigator:Q0,origin:l4},Symbol.toStringTag,{value:"Module"})),Ar={...o4,...r4};function c4(t,s){return Km(t,new Ar.classes.URLSearchParams,{visitor:function(n,r,a,l){return Ar.isNode&&et.isBuffer(n)?(this.append(r,n.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...s})}function d4(t){return et.matchAll(/\w+|\[(\w*)]/g,t).map(s=>s[0]==="[]"?"":s[1]||s[0])}function u4(t){const s={},n=Object.keys(t);let r;const a=n.length;let l;for(r=0;r=n.length;return c=!c&&et.isArray(a)?a.length:c,m?(et.hasOwnProp(a,c)?a[c]=[a[c],r]:a[c]=r,!d):((!a[c]||!et.isObject(a[c]))&&(a[c]=[]),s(n,r,a[c],l)&&et.isArray(a[c])&&(a[c]=u4(a[c])),!d)}if(et.isFormData(t)&&et.isFunction(t.entries)){const n={};return et.forEachEntry(t,(r,a)=>{s(d4(r),a,n,0)}),n}return null}function h4(t,s,n){if(et.isString(t))try{return(s||JSON.parse)(t),et.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const lu={transitional:qv,adapter:["xhr","http","fetch"],transformRequest:[function(s,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,l=et.isObject(s);if(l&&et.isHTMLForm(s)&&(s=new FormData(s)),et.isFormData(s))return a?JSON.stringify(WC(s)):s;if(et.isArrayBuffer(s)||et.isBuffer(s)||et.isStream(s)||et.isFile(s)||et.isBlob(s)||et.isReadableStream(s))return s;if(et.isArrayBufferView(s))return s.buffer;if(et.isURLSearchParams(s))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),s.toString();let d;if(l){if(r.indexOf("application/x-www-form-urlencoded")>-1)return c4(s,this.formSerializer).toString();if((d=et.isFileList(s))||r.indexOf("multipart/form-data")>-1){const m=this.env&&this.env.FormData;return Km(d?{"files[]":s}:s,m&&new m,this.formSerializer)}}return l||a?(n.setContentType("application/json",!1),h4(s)):s}],transformResponse:[function(s){const n=this.transitional||lu.transitional,r=n&&n.forcedJSONParsing,a=this.responseType==="json";if(et.isResponse(s)||et.isReadableStream(s))return s;if(s&&et.isString(s)&&(r&&!this.responseType||a)){const c=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(s,this.parseReviver)}catch(d){if(c)throw d.name==="SyntaxError"?As.from(d,As.ERR_BAD_RESPONSE,this,null,this.response):d}}return s}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ar.classes.FormData,Blob:Ar.classes.Blob},validateStatus:function(s){return s>=200&&s<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};et.forEach(["delete","get","head","post","put","patch"],t=>{lu.headers[t]={}});const m4=et.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),f4=t=>{const s={};let n,r,a;return t&&t.split(` +`).forEach(function(c){a=c.indexOf(":"),n=c.substring(0,a).trim().toLowerCase(),r=c.substring(a+1).trim(),!(!n||s[n]&&m4[n])&&(n==="set-cookie"?s[n]?s[n].push(r):s[n]=[r]:s[n]=s[n]?s[n]+", "+r:r)}),s},LN=Symbol("internals");function bd(t){return t&&String(t).trim().toLowerCase()}function Zh(t){return t===!1||t==null?t:et.isArray(t)?t.map(Zh):String(t)}function p4(t){const s=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)s[r[1]]=r[2];return s}const x4=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function wx(t,s,n,r,a){if(et.isFunction(r))return r.call(this,s,n);if(a&&(s=n),!!et.isString(s)){if(et.isString(r))return s.indexOf(r)!==-1;if(et.isRegExp(r))return r.test(s)}}function g4(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(s,n,r)=>n.toUpperCase()+r)}function v4(t,s){const n=et.toCamelCase(" "+s);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(a,l,c){return this[r].call(this,s,a,l,c)},configurable:!0})})}let Jr=class{constructor(s){s&&this.set(s)}set(s,n,r){const a=this;function l(d,m,x){const f=bd(m);if(!f)throw new Error("header name must be a non-empty string");const h=et.findKey(a,f);(!h||a[h]===void 0||x===!0||x===void 0&&a[h]!==!1)&&(a[h||m]=Zh(d))}const c=(d,m)=>et.forEach(d,(x,f)=>l(x,f,m));if(et.isPlainObject(s)||s instanceof this.constructor)c(s,n);else if(et.isString(s)&&(s=s.trim())&&!x4(s))c(f4(s),n);else if(et.isObject(s)&&et.isIterable(s)){let d={},m,x;for(const f of s){if(!et.isArray(f))throw TypeError("Object iterator must return a key-value pair");d[x=f[0]]=(m=d[x])?et.isArray(m)?[...m,f[1]]:[m,f[1]]:f[1]}c(d,n)}else s!=null&&l(n,s,r);return this}get(s,n){if(s=bd(s),s){const r=et.findKey(this,s);if(r){const a=this[r];if(!n)return a;if(n===!0)return p4(a);if(et.isFunction(n))return n.call(this,a,r);if(et.isRegExp(n))return n.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(s,n){if(s=bd(s),s){const r=et.findKey(this,s);return!!(r&&this[r]!==void 0&&(!n||wx(this,this[r],r,n)))}return!1}delete(s,n){const r=this;let a=!1;function l(c){if(c=bd(c),c){const d=et.findKey(r,c);d&&(!n||wx(r,r[d],d,n))&&(delete r[d],a=!0)}}return et.isArray(s)?s.forEach(l):l(s),a}clear(s){const n=Object.keys(this);let r=n.length,a=!1;for(;r--;){const l=n[r];(!s||wx(this,this[l],l,s,!0))&&(delete this[l],a=!0)}return a}normalize(s){const n=this,r={};return et.forEach(this,(a,l)=>{const c=et.findKey(r,l);if(c){n[c]=Zh(a),delete n[l];return}const d=s?g4(l):String(l).trim();d!==l&&delete n[l],n[d]=Zh(a),r[d]=!0}),this}concat(...s){return this.constructor.concat(this,...s)}toJSON(s){const n=Object.create(null);return et.forEach(this,(r,a)=>{r!=null&&r!==!1&&(n[a]=s&&et.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([s,n])=>s+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(s){return s instanceof this?s:new this(s)}static concat(s,...n){const r=new this(s);return n.forEach(a=>r.set(a)),r}static accessor(s){const r=(this[LN]=this[LN]={accessors:{}}).accessors,a=this.prototype;function l(c){const d=bd(c);r[d]||(v4(a,c),r[d]=!0)}return et.isArray(s)?s.forEach(l):l(s),this}};Jr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);et.reduceDescriptors(Jr.prototype,({value:t},s)=>{let n=s[0].toUpperCase()+s.slice(1);return{get:()=>t,set(r){this[n]=r}}});et.freezeMethods(Jr);function Sx(t,s){const n=this||lu,r=s||n,a=Jr.from(r.headers);let l=r.data;return et.forEach(t,function(d){l=d.call(n,l,a.normalize(),s?s.status:void 0)}),a.normalize(),l}function KC(t){return!!(t&&t.__CANCEL__)}let ou=class extends As{constructor(s,n,r){super(s??"canceled",As.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function GC(t,s,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):s(new As("Request failed with status code "+n.status,[As.ERR_BAD_REQUEST,As.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function b4(t){const s=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return s&&s[1]||""}function y4(t,s){t=t||10;const n=new Array(t),r=new Array(t);let a=0,l=0,c;return s=s!==void 0?s:1e3,function(m){const x=Date.now(),f=r[l];c||(c=x),n[a]=m,r[a]=x;let h=l,g=0;for(;h!==a;)g+=n[h++],h=h%t;if(a=(a+1)%t,a===l&&(l=(l+1)%t),x-c{n=f,a=null,l&&(clearTimeout(l),l=null),t(...x)};return[(...x)=>{const f=Date.now(),h=f-n;h>=r?c(x,f):(a=x,l||(l=setTimeout(()=>{l=null,c(a)},r-h)))},()=>a&&c(a)]}const gm=(t,s,n=3)=>{let r=0;const a=y4(50,250);return j4(l=>{const c=l.loaded,d=l.lengthComputable?l.total:void 0,m=c-r,x=a(m),f=c<=d;r=c;const h={loaded:c,total:d,progress:d?c/d:void 0,bytes:m,rate:x||void 0,estimated:x&&d&&f?(d-c)/x:void 0,event:l,lengthComputable:d!=null,[s?"download":"upload"]:!0};t(h)},n)},IN=(t,s)=>{const n=t!=null;return[r=>s[0]({lengthComputable:n,total:t,loaded:r}),s[1]]},MN=t=>(...s)=>et.asap(()=>t(...s)),N4=Ar.hasStandardBrowserEnv?((t,s)=>n=>(n=new URL(n,Ar.origin),t.protocol===n.protocol&&t.host===n.host&&(s||t.port===n.port)))(new URL(Ar.origin),Ar.navigator&&/(msie|trident)/i.test(Ar.navigator.userAgent)):()=>!0,w4=Ar.hasStandardBrowserEnv?{write(t,s,n,r,a,l,c){if(typeof document>"u")return;const d=[`${t}=${encodeURIComponent(s)}`];et.isNumber(n)&&d.push(`expires=${new Date(n).toUTCString()}`),et.isString(r)&&d.push(`path=${r}`),et.isString(a)&&d.push(`domain=${a}`),l===!0&&d.push("secure"),et.isString(c)&&d.push(`SameSite=${c}`),document.cookie=d.join("; ")},read(t){if(typeof document>"u")return null;const s=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return s?decodeURIComponent(s[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function S4(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function C4(t,s){return s?t.replace(/\/?\/$/,"")+"/"+s.replace(/^\/+/,""):t}function YC(t,s,n){let r=!S4(s);return t&&(r||n==!1)?C4(t,s):s}const FN=t=>t instanceof Jr?{...t}:t;function Mo(t,s){s=s||{};const n={};function r(x,f,h,g){return et.isPlainObject(x)&&et.isPlainObject(f)?et.merge.call({caseless:g},x,f):et.isPlainObject(f)?et.merge({},f):et.isArray(f)?f.slice():f}function a(x,f,h,g){if(et.isUndefined(f)){if(!et.isUndefined(x))return r(void 0,x,h,g)}else return r(x,f,h,g)}function l(x,f){if(!et.isUndefined(f))return r(void 0,f)}function c(x,f){if(et.isUndefined(f)){if(!et.isUndefined(x))return r(void 0,x)}else return r(void 0,f)}function d(x,f,h){if(h in s)return r(x,f);if(h in t)return r(void 0,x)}const m={url:l,method:l,data:l,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:d,headers:(x,f,h)=>a(FN(x),FN(f),h,!0)};return et.forEach(Object.keys({...t,...s}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const h=et.hasOwnProp(m,f)?m[f]:a,g=h(t[f],s[f],f);et.isUndefined(g)&&h!==d||(n[f]=g)}),n}const ZC=t=>{const s=Mo({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:l,headers:c,auth:d}=s;if(s.headers=c=Jr.from(c),s.url=HC(YC(s.baseURL,s.url,s.allowAbsoluteUrls),t.params,t.paramsSerializer),d&&c.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):""))),et.isFormData(n)){if(Ar.hasStandardBrowserEnv||Ar.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(et.isFunction(n.getHeaders)){const m=n.getHeaders(),x=["content-type","content-length"];Object.entries(m).forEach(([f,h])=>{x.includes(f.toLowerCase())&&c.set(f,h)})}}if(Ar.hasStandardBrowserEnv&&(r&&et.isFunction(r)&&(r=r(s)),r||r!==!1&&N4(s.url))){const m=a&&l&&w4.read(l);m&&c.set(a,m)}return s},A4=typeof XMLHttpRequest<"u",k4=A4&&function(t){return new Promise(function(n,r){const a=ZC(t);let l=a.data;const c=Jr.from(a.headers).normalize();let{responseType:d,onUploadProgress:m,onDownloadProgress:x}=a,f,h,g,u,j;function p(){u&&u(),j&&j(),a.cancelToken&&a.cancelToken.unsubscribe(f),a.signal&&a.signal.removeEventListener("abort",f)}let y=new XMLHttpRequest;y.open(a.method.toUpperCase(),a.url,!0),y.timeout=a.timeout;function N(){if(!y)return;const A=Jr.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),E={data:!d||d==="text"||d==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:A,config:t,request:y};GC(function(C){n(C),p()},function(C){r(C),p()},E),y=null}"onloadend"in y?y.onloadend=N:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(N)},y.onabort=function(){y&&(r(new As("Request aborted",As.ECONNABORTED,t,y)),y=null)},y.onerror=function(w){const E=w&&w.message?w.message:"Network Error",T=new As(E,As.ERR_NETWORK,t,y);T.event=w||null,r(T),y=null},y.ontimeout=function(){let w=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const E=a.transitional||qv;a.timeoutErrorMessage&&(w=a.timeoutErrorMessage),r(new As(w,E.clarifyTimeoutError?As.ETIMEDOUT:As.ECONNABORTED,t,y)),y=null},l===void 0&&c.setContentType(null),"setRequestHeader"in y&&et.forEach(c.toJSON(),function(w,E){y.setRequestHeader(E,w)}),et.isUndefined(a.withCredentials)||(y.withCredentials=!!a.withCredentials),d&&d!=="json"&&(y.responseType=a.responseType),x&&([g,j]=gm(x,!0),y.addEventListener("progress",g)),m&&y.upload&&([h,u]=gm(m),y.upload.addEventListener("progress",h),y.upload.addEventListener("loadend",u)),(a.cancelToken||a.signal)&&(f=A=>{y&&(r(!A||A.type?new ou(null,t,y):A),y.abort(),y=null)},a.cancelToken&&a.cancelToken.subscribe(f),a.signal&&(a.signal.aborted?f():a.signal.addEventListener("abort",f)));const S=b4(a.url);if(S&&Ar.protocols.indexOf(S)===-1){r(new As("Unsupported protocol "+S+":",As.ERR_BAD_REQUEST,t));return}y.send(l||null)})},R4=(t,s)=>{const{length:n}=t=t?t.filter(Boolean):[];if(s||n){let r=new AbortController,a;const l=function(x){if(!a){a=!0,d();const f=x instanceof Error?x:this.reason;r.abort(f instanceof As?f:new ou(f instanceof Error?f.message:f))}};let c=s&&setTimeout(()=>{c=null,l(new As(`timeout of ${s}ms exceeded`,As.ETIMEDOUT))},s);const d=()=>{t&&(c&&clearTimeout(c),c=null,t.forEach(x=>{x.unsubscribe?x.unsubscribe(l):x.removeEventListener("abort",l)}),t=null)};t.forEach(x=>x.addEventListener("abort",l));const{signal:m}=r;return m.unsubscribe=()=>et.asap(d),m}},E4=function*(t,s){let n=t.byteLength;if(n{const a=D4(t,s);let l=0,c,d=m=>{c||(c=!0,r&&r(m))};return new ReadableStream({async pull(m){try{const{done:x,value:f}=await a.next();if(x){d(),m.close();return}let h=f.byteLength;if(n){let g=l+=h;n(g)}m.enqueue(new Uint8Array(f))}catch(x){throw d(x),x}},cancel(m){return d(m),a.return()}},{highWaterMark:2})},$N=64*1024,{isFunction:Ch}=et,_4=(({Request:t,Response:s})=>({Request:t,Response:s}))(et.global),{ReadableStream:qN,TextEncoder:zN}=et.global,UN=(t,...s)=>{try{return!!t(...s)}catch{return!1}},P4=t=>{t=et.merge.call({skipUndefined:!0},_4,t);const{fetch:s,Request:n,Response:r}=t,a=s?Ch(s):typeof fetch=="function",l=Ch(n),c=Ch(r);if(!a)return!1;const d=a&&Ch(qN),m=a&&(typeof zN=="function"?(j=>p=>j.encode(p))(new zN):async j=>new Uint8Array(await new n(j).arrayBuffer())),x=l&&d&&UN(()=>{let j=!1;const p=new n(Ar.origin,{body:new qN,method:"POST",get duplex(){return j=!0,"half"}}).headers.has("Content-Type");return j&&!p}),f=c&&d&&UN(()=>et.isReadableStream(new r("").body)),h={stream:f&&(j=>j.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(j=>{!h[j]&&(h[j]=(p,y)=>{let N=p&&p[j];if(N)return N.call(p);throw new As(`Response type '${j}' is not supported`,As.ERR_NOT_SUPPORT,y)})});const g=async j=>{if(j==null)return 0;if(et.isBlob(j))return j.size;if(et.isSpecCompliantForm(j))return(await new n(Ar.origin,{method:"POST",body:j}).arrayBuffer()).byteLength;if(et.isArrayBufferView(j)||et.isArrayBuffer(j))return j.byteLength;if(et.isURLSearchParams(j)&&(j=j+""),et.isString(j))return(await m(j)).byteLength},u=async(j,p)=>{const y=et.toFiniteNumber(j.getContentLength());return y??g(p)};return async j=>{let{url:p,method:y,data:N,signal:S,cancelToken:A,timeout:w,onDownloadProgress:E,onUploadProgress:T,responseType:C,headers:L,withCredentials:$="same-origin",fetchOptions:_}=ZC(j),R=s||fetch;C=C?(C+"").toLowerCase():"text";let P=R4([S,A&&A.toAbortSignal()],w),M=null;const q=P&&P.unsubscribe&&(()=>{P.unsubscribe()});let K;try{if(T&&x&&y!=="get"&&y!=="head"&&(K=await u(L,N))!==0){let D=new n(p,{method:"POST",body:N,duplex:"half"}),O;if(et.isFormData(N)&&(O=D.headers.get("content-type"))&&L.setContentType(O),D.body){const[z,G]=IN(K,gm(MN(T)));N=BN(D.body,$N,z,G)}}et.isString($)||($=$?"include":"omit");const Z=l&&"credentials"in n.prototype,W={..._,signal:P,method:y.toUpperCase(),headers:L.normalize().toJSON(),body:N,duplex:"half",credentials:Z?$:void 0};M=l&&new n(p,W);let U=await(l?R(M,_):R(p,W));const F=f&&(C==="stream"||C==="response");if(f&&(E||F&&q)){const D={};["status","statusText","headers"].forEach(Y=>{D[Y]=U[Y]});const O=et.toFiniteNumber(U.headers.get("content-length")),[z,G]=E&&IN(O,gm(MN(E),!0))||[];U=new r(BN(U.body,$N,z,()=>{G&&G(),q&&q()}),D)}C=C||"text";let B=await h[et.findKey(h,C)||"text"](U,j);return!F&&q&&q(),await new Promise((D,O)=>{GC(D,O,{data:B,headers:Jr.from(U.headers),status:U.status,statusText:U.statusText,config:j,request:M})})}catch(Z){throw q&&q(),Z&&Z.name==="TypeError"&&/Load failed|fetch/i.test(Z.message)?Object.assign(new As("Network Error",As.ERR_NETWORK,j,M,Z&&Z.response),{cause:Z.cause||Z}):As.from(Z,Z&&Z.code,j,M,Z&&Z.response)}}},O4=new Map,QC=t=>{let s=t&&t.env||{};const{fetch:n,Request:r,Response:a}=s,l=[r,a,n];let c=l.length,d=c,m,x,f=O4;for(;d--;)m=l[d],x=f.get(m),x===void 0&&f.set(m,x=d?new Map:P4(s)),f=x;return x};QC();const Uv={http:QP,xhr:k4,fetch:{get:QC}};et.forEach(Uv,(t,s)=>{if(t){try{Object.defineProperty(t,"name",{value:s})}catch{}Object.defineProperty(t,"adapterName",{value:s})}});const VN=t=>`- ${t}`,L4=t=>et.isFunction(t)||t===null||t===!1;function I4(t,s){t=et.isArray(t)?t:[t];const{length:n}=t;let r,a;const l={};for(let c=0;c`adapter ${m} `+(x===!1?"is not supported by the environment":"is not available in the build"));let d=n?c.length>1?`since : +`+c.map(VN).join(` +`):" "+VN(c[0]):"as no adapter specified";throw new As("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return a}const XC={getAdapter:I4,adapters:Uv};function Cx(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ou(null,t)}function HN(t){return Cx(t),t.headers=Jr.from(t.headers),t.data=Sx.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),XC.getAdapter(t.adapter||lu.adapter,t)(t).then(function(r){return Cx(t),r.data=Sx.call(t,t.transformResponse,r),r.headers=Jr.from(r.headers),r},function(r){return KC(r)||(Cx(t),r&&r.response&&(r.response.data=Sx.call(t,t.transformResponse,r.response),r.response.headers=Jr.from(r.response.headers))),Promise.reject(r)})}const JC="1.13.6",Gm={};["object","boolean","number","function","string","symbol"].forEach((t,s)=>{Gm[t]=function(r){return typeof r===t||"a"+(s<1?"n ":" ")+t}});const WN={};Gm.transitional=function(s,n,r){function a(l,c){return"[Axios v"+JC+"] Transitional option '"+l+"'"+c+(r?". "+r:"")}return(l,c,d)=>{if(s===!1)throw new As(a(c," has been removed"+(n?" in "+n:"")),As.ERR_DEPRECATED);return n&&!WN[c]&&(WN[c]=!0,console.warn(a(c," has been deprecated since v"+n+" and will be removed in the near future"))),s?s(l,c,d):!0}};Gm.spelling=function(s){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${s}`),!0)};function M4(t,s,n){if(typeof t!="object")throw new As("options must be an object",As.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let a=r.length;for(;a-- >0;){const l=r[a],c=s[l];if(c){const d=t[l],m=d===void 0||c(d,l,t);if(m!==!0)throw new As("option "+l+" must be "+m,As.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new As("Unknown option "+l,As.ERR_BAD_OPTION)}}const Qh={assertOptions:M4,validators:Gm},Sa=Qh.validators;let Oo=class{constructor(s){this.defaults=s||{},this.interceptors={request:new ON,response:new ON}}async request(s,n){try{return await this._request(s,n)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const l=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?l&&!String(r.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+l):r.stack=l}catch{}}throw r}}_request(s,n){typeof s=="string"?(n=n||{},n.url=s):n=s||{},n=Mo(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:l}=n;r!==void 0&&Qh.assertOptions(r,{silentJSONParsing:Sa.transitional(Sa.boolean),forcedJSONParsing:Sa.transitional(Sa.boolean),clarifyTimeoutError:Sa.transitional(Sa.boolean),legacyInterceptorReqResOrdering:Sa.transitional(Sa.boolean)},!1),a!=null&&(et.isFunction(a)?n.paramsSerializer={serialize:a}:Qh.assertOptions(a,{encode:Sa.function,serialize:Sa.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Qh.assertOptions(n,{baseUrl:Sa.spelling("baseURL"),withXsrfToken:Sa.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let c=l&&et.merge(l.common,l[n.method]);l&&et.forEach(["delete","get","head","post","put","patch","common"],j=>{delete l[j]}),n.headers=Jr.concat(c,l);const d=[];let m=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(n)===!1)return;m=m&&p.synchronous;const y=n.transitional||qv;y&&y.legacyInterceptorReqResOrdering?d.unshift(p.fulfilled,p.rejected):d.push(p.fulfilled,p.rejected)});const x=[];this.interceptors.response.forEach(function(p){x.push(p.fulfilled,p.rejected)});let f,h=0,g;if(!m){const j=[HN.bind(this),void 0];for(j.unshift(...d),j.push(...x),g=j.length,f=Promise.resolve(n);h{if(!r._listeners)return;let l=r._listeners.length;for(;l-- >0;)r._listeners[l](a);r._listeners=null}),this.promise.then=a=>{let l;const c=new Promise(d=>{r.subscribe(d),l=d}).then(a);return c.cancel=function(){r.unsubscribe(l)},c},s(function(l,c,d){r.reason||(r.reason=new ou(l,c,d),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(s){if(this.reason){s(this.reason);return}this._listeners?this._listeners.push(s):this._listeners=[s]}unsubscribe(s){if(!this._listeners)return;const n=this._listeners.indexOf(s);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const s=new AbortController,n=r=>{s.abort(r)};return this.subscribe(n),s.signal.unsubscribe=()=>this.unsubscribe(n),s.signal}static source(){let s;return{token:new e2(function(a){s=a}),cancel:s}}};function B4(t){return function(n){return t.apply(null,n)}}function $4(t){return et.isObject(t)&&t.isAxiosError===!0}const X0={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(X0).forEach(([t,s])=>{X0[s]=t});function t2(t){const s=new Oo(t),n=OC(Oo.prototype.request,s);return et.extend(n,Oo.prototype,s,{allOwnKeys:!0}),et.extend(n,s,null,{allOwnKeys:!0}),n.create=function(a){return t2(Mo(t,a))},n}const On=t2(lu);On.Axios=Oo;On.CanceledError=ou;On.CancelToken=F4;On.isCancel=KC;On.VERSION=JC;On.toFormData=Km;On.AxiosError=As;On.Cancel=On.CanceledError;On.all=function(s){return Promise.all(s)};On.spread=B4;On.isAxiosError=$4;On.mergeConfig=Mo;On.AxiosHeaders=Jr;On.formToJSON=t=>WC(et.isHTMLForm(t)?new FormData(t):t);On.getAdapter=XC.getAdapter;On.HttpStatusCode=X0;On.default=On;const{Axios:wH,AxiosError:SH,CanceledError:CH,isCancel:AH,CancelToken:kH,VERSION:RH,all:EH,Cancel:DH,isAxiosError:TH,spread:_H,toFormData:PH,AxiosHeaders:OH,HttpStatusCode:LH,formToJSON:IH,getAdapter:MH,mergeConfig:FH}=On,KN="https://dealeronboarding-uat.royalenfield.com/api",Te={login:t=>ze.post("/auth/login",t),logout:()=>ze.post("/auth/logout"),getCurrentUser:()=>ze.get("/auth/me"),getRoles:()=>ze.get("/admin/roles"),createRole:t=>ze.post("/admin/roles",t),getPermissions:()=>ze.get("/admin/permissions"),updateRole:(t,s)=>ze.put(`/admin/roles/${t}`,s),getZones:()=>ze.get("/master/zones"),createZone:t=>ze.post("/master/zones",t),updateZone:(t,s)=>ze.put(`/master/zones/${t}`,s),createRegion:t=>ze.post("/master/regions",t),updateRegion:(t,s)=>ze.put(`/master/regions/${t}`,s),getRegions:()=>ze.get("/master/regions"),getOutlets:()=>ze.get("/outlets"),getOutletByCode:t=>ze.get(`/master/outlets/code/${t}`),getStates:t=>ze.get("/master/states",typeof t=="string"?{zoneId:t}:t),getDistricts:t=>ze.get("/master/districts",typeof t=="string"?{stateId:t}:t),getAreas:t=>ze.get("/master/areas",t),updateArea:(t,s)=>ze.put(`/master/areas/${t}`,s),createArea:t=>ze.post("/master/areas",t),getAreaManagers:()=>ze.get("/master/area-managers"),getASMs:()=>ze.get("/master/asms"),getZonalManagers:()=>ze.get("/master/zonal-managers"),saveZonalManager:t=>ze.post("/master/zonal-managers",t),getDDLeads:()=>ze.get("/master/dd-leads"),saveDDLead:t=>ze.post("/master/dd-leads",t),getManagersByRole:t=>ze.get("/master/managers",t),submitApplication:t=>ze.post("/onboarding/apply",t),exportApplicationResponses:t=>ze.get("/onboarding/applications/export-responses",t),getApplications:t=>ze.get("/onboarding/applications",t),shortlistApplications:t=>ze.post("/onboarding/applications/shortlist",t),getApplicationById:t=>ze.get(`/onboarding/applications/${t}`),updateApplication:(t,s)=>ze.put(`/onboarding/applications/${t}`,s),getLatestQuestionnaire:()=>ze.get("/questionnaire/latest"),createQuestionnaireVersion:t=>ze.post("/questionnaire/version",t),submitQuestionnaireResponse:t=>ze.post("/questionnaire/response",t),getAllQuestionnaires:()=>ze.get("/onboarding/questionnaires"),getQuestionnaireById:t=>ze.get(`/onboarding/questionnaires/${t}`),assignArchitectureTeam:(t,s)=>ze.post(`/onboarding/applications/${t}/assign-architecture`,{assignedTo:s}),updateArchitectureStatus:(t,s,n)=>ze.post(`/onboarding/applications/${t}/architecture-status`,{status:s,remarks:n}),generateDealerCodes:t=>ze.post(`/onboarding/applications/${t}/generate-codes`),updateApplicationStatus:(t,s)=>ze.put(`/onboarding/applications/${t}/status`,s),convertToOpportunity:(t,s)=>ze.post(`/onboarding/applications/${t}/convert-to-opportunity`,s),bulkConvertToOpportunity:t=>ze.post("/onboarding/applications/bulk-convert-to-opportunity",t),retriggerEvaluators:t=>ze.post(`/onboarding/applications/${t}/retrigger-evaluators`),getSecurityDeposit:t=>ze.get(`/loa/security-deposit/${t}`),updateSecurityDeposit:t=>ze.post("/loa/security-deposit",t),uploadDocument:(t,s)=>ze.post(`/onboarding/applications/${t}/documents`,s,{headers:{"Content-Type":"multipart/form-data"}}),getDocuments:t=>ze.get(`/onboarding/applications/${t}/documents`),getDocumentConfigMetadata:()=>ze.get("/onboarding/document-configs/metadata"),getDocumentConfigs:t=>ze.get("/onboarding/document-configs",t),createDocumentConfig:t=>ze.post("/onboarding/document-configs",t),updateDocumentConfig:(t,s)=>ze.put(`/onboarding/document-configs/${t}`,s),deleteDocumentConfig:t=>ze.delete(`/onboarding/document-configs/${t}`),getPublicQuestionnaire:t=>On.get(`${KN}/questionnaire/public/${t}`),submitPublicResponse:t=>On.post(`${KN}/questionnaire/public/submit`,t),getAiSummary:t=>ze.get(`/assessment/ai-summary/${t}`),scheduleInterview:t=>ze.post("/assessment/interviews",t),updateInterview:(t,s)=>ze.put(`/assessment/interviews/${t}`,s),submitEvaluation:(t,s)=>ze.post(`/assessment/interviews/${t}/evaluation`,s),submitKTMatrix:t=>ze.post("/assessment/kt-matrix",t),submitLevel2Feedback:t=>ze.post("/assessment/level2-feedback",t),getInterviews:t=>ze.get(`/assessment/interviews/${t}`),updateRecommendation:t=>ze.post("/assessment/recommendation",t),updateInterviewDecision:t=>ze.post("/assessment/decision",t),submitStageDecision:t=>ze.post("/assessment/stage-decision",t),getInterviewApprovalStatus:t=>ze.get(`/assessment/interviews/${t}/approval-status`),getApprovalPolicies:()=>ze.get("/assessment/approval-policies"),upsertApprovalPolicy:(t,s)=>ze.put(`/assessment/approval-policies/${t}`,s),getWorknotes:(t,s)=>ze.get("/collaboration/worknotes",{requestId:t,requestType:s}),addWorknote:t=>ze.post("/collaboration/worknotes",t),addParticipant:t=>ze.post("/collaboration/participants",t),removeParticipant:t=>ze.delete(`/collaboration/participants/${t}`),getUsers:t=>ze.get("/admin/users",t),createUser:t=>ze.post("/admin/users",t),updateUser:(t,s)=>ze.put(`/admin/users/${t}`,s),updateUserStatus:(t,s)=>ze.patch(`/admin/users/${t}/status`,s),deleteUser:t=>ze.delete(`/admin/users/${t}`),getDealers:t=>ze.get("/dealer",t),createDealer:t=>ze.post("/dealer",t),getDealerById:t=>ze.get(`/dealer/${t}`),updateDealer:(t,s)=>ze.put(`/dealer/${t}`,s),getDealerDashboard:()=>ze.get("/dealer/dashboard"),getDealerBankDetails:t=>ze.get(`/dealer/${t}/bank-details`),saveBankDetail:(t,s)=>ze.post(`/dealer/${t}/bank-details`,s),deleteBankDetail:t=>ze.delete(`/dealer/bank-details/${t}`),getEmailTemplates:()=>ze.get("/admin/email-templates"),getEmailTemplate:t=>ze.get(`/admin/email-templates/${t}`),createEmailTemplate:t=>ze.post("/admin/email-templates",t),updateEmailTemplate:(t,s)=>ze.put(`/admin/email-templates/${t}`,s),deleteEmailTemplate:t=>ze.delete(`/admin/email-templates/${t}`),previewEmailTemplate:t=>ze.post("/admin/email-templates/preview",t),getAuditLogs:(t,s,n=1,r=50)=>ze.get("/audit/logs",{entityType:t,entityId:s,page:n,limit:r}),getAuditSummary:(t,s)=>ze.get("/audit/summary",{entityType:t,entityId:s}),sendOtp:t=>ze.post("/prospective-login/send-otp",{phone:t}),verifyOtp:(t,s)=>ze.post("/prospective-login/verify-otp",{phone:t,otp:s}),getResignationById:t=>ze.get(`/resignation/${t}`),uploadResignationDocument:(t,s)=>ze.post(`/resignation/${t}/documents`,s,{headers:{"Content-Type":"multipart/form-data"}}),updateClearance:(t,s)=>ze.put(`/resignation/${t}/clearance`,s,{headers:s instanceof FormData?{"Content-Type":"multipart/form-data"}:{}}),updateResignationStatus:(t,s)=>ze.post(`/resignation/${t}/status`,s),getTerminationById:t=>ze.get(`/termination/${t}`),uploadTerminationDocument:(t,s)=>ze.post(`/termination/${t}/documents`,s,{headers:{"Content-Type":"multipart/form-data"}}),updateTerminationStatus:(t,s)=>ze.post(`/termination/${t}/status`,s),issueSCN:(t,s)=>ze.post(`/termination/${t}/scn`,s),uploadSCNResponse:(t,s)=>ze.post(`/termination/${t}/scn-response`,s,{headers:{"Content-Type":"multipart/form-data"}}),finalizeTermination:(t,s)=>ze.post(`/termination/${t}/finalize`,s),getResignations:t=>ze.get("/resignation",t),createResignation:t=>ze.post("/resignation",t),approveResignation:(t,s)=>ze.post(`/resignation/${t}/approve`,s),rejectResignation:(t,s)=>ze.post(`/resignation/${t}/reject`,s),withdrawResignation:(t,s)=>ze.post(`/resignation/${t}/withdraw`,{reason:s}),getTerminations:t=>ze.get("/termination",t),createTermination:t=>ze.post("/termination",t),updateTermination:(t,s)=>ze.post(`/termination/${t}/status`,s),getOnboardingPayments:()=>ze.get("/settlement/onboarding"),updatePayment:(t,s)=>ze.put(`/settlement/payments/${t}`,s),getFnFSettlements:()=>ze.get("/settlement/fnf"),getFnFSettlementById:t=>ze.get(`/settlement/fnf/${t}`),calculateFnF:t=>ze.post(`/settlement/fnf/${t}/calculate`),updateFnF:(t,s)=>ze.put(`/settlement/fnf/${t}`,s),uploadFnFDocument:(t,s)=>ze.post(`/settlement/fnf/${t}/documents`,s,{headers:{"Content-Type":"multipart/form-data"}}),getSettlementDepartments:()=>ze.get("/settlement/departments"),addLineItem:(t,s)=>ze.post(`/settlement/fnf/${t}/line-items`,s),updateFnFClearance:(t,s,n)=>ze.put(`/settlement/fnf/${t}/clearances/${s}`,n,{headers:{"Content-Type":"multipart/form-data"}}),updateLineItem:(t,s)=>ze.put(`/settlement/fnf/line-items/${t}`,s),deleteLineItem:t=>ze.delete(`/settlement/fnf/line-items/${t}`),getRelocationRequests:t=>ze.get("/relocation",t),getRelocationRequestById:t=>ze.get(`/relocation/${t}`),createRelocationRequest:t=>ze.post("/relocation",t),updateRelocationRequest:(t,s,n)=>ze.post(`/relocation/${t}/action`,{action:s,...n}),uploadRelocationDocument:(t,s)=>ze.post(`/relocation/${t}/documents`,s,{headers:{"Content-Type":"multipart/form-data"}}),verifyRelocationDocument:(t,s)=>ze.post(`/relocation/${t}/documents/${s}/verify`),rejectRelocationDocument:(t,s,n)=>ze.post(`/relocation/${t}/documents/${s}/reject`,n||{}),getConstitutionalChanges:t=>ze.get("/constitutional-change",t),getConstitutionalChangeMeta:()=>ze.get("/constitutional-change/meta"),getConstitutionalChangeById:t=>ze.get(`/constitutional-change/${t}`),createConstitutionalChange:t=>ze.post("/constitutional-change",t),updateConstitutionalChange:(t,s,n)=>ze.post(`/constitutional-change/${t}/action`,{action:s,...n}),uploadConstitutionalDocuments:(t,s)=>ze.post(`/constitutional-change/${t}/documents`,{documents:s}),getSlaConfigs:()=>ze.get("/master/sla-configs"),saveSlaConfig:t=>ze.post("/master/sla-configs",t),initializeDefaultSlas:()=>ze.post("/master/sla-configs/initialize"),getInterviewConfigs:t=>ze.get("/master/interview-configs",t),getInterviewConfigById:t=>ze.get(`/master/interview-configs/${t}`),getInterviewConfigByType:t=>ze.get(`/master/interview-configs/active/${t}`),createInterviewConfig:t=>ze.post("/master/interview-configs",t),updateInterviewConfig:(t,s)=>ze.put(`/master/interview-configs/${t}`,s),deleteInterviewConfig:t=>ze.delete(`/master/interview-configs/${t}`),initializeDefaultInterviewConfigs:()=>ze.post("/master/interview-configs/initialize"),getSystemConfigs:t=>ze.get("/master/system-configs",t),saveSystemConfig:t=>ze.post("/master/system-configs",t),getDealerAsmMappings:()=>ze.get("/master/dealer-asm-mappings"),saveDealerAsmMapping:t=>ze.post("/master/dealer-asm-mappings",t),getEorChecklistForApplication:t=>ze.get(`/eor/application/${t}`),getEorChecklistForRelocation:t=>ze.get(`/eor/relocation/${t}`),updateEorChecklistItem:(t,s)=>ze.post(`/eor/item/${t}`,s),submitEorAudit:(t,s)=>ze.post(`/eor/audit/${t}`,s),submitFddReport:t=>ze.post("/fdd/report",t),getFddAssignment:t=>ze.get(`/fdd/${t}`),assignFddAgency:t=>ze.post("/fdd/assign",t),flagNonResponsive:t=>ze.post("/flag",t)},_d=Object.freeze(Object.defineProperty({__proto__:null,API:Te,default:Te},Symbol.toStringTag,{value:"Module"})),q4={user:null,token:localStorage.getItem("token"),isAuthenticated:!1,loading:!0,error:null},Xh=K_("auth/initializeAuth",async(t,{rejectWithValue:s})=>{const n=localStorage.getItem("token");if(!n)return s("No token found");try{const r=await Te.getCurrentUser();if(r.ok&&r.data){const{user:a}=r.data;return{user:{id:a.id,name:a.fullName||a.email.split("@")[0],email:a.email,password:"",role:typeof a.role=="string"?a.role:a.roleCode||"User",roleCode:a.roleCode||(typeof a.role=="string"?a.role:"User")},token:n}}return s("Failed to fetch user")}catch(r){return s(r.message||"Session restoration failed")}}),s2=PC({name:"auth",initialState:q4,reducers:{setCredentials:(t,s)=>{t.user=s.payload.user,t.token=s.payload.token,t.isAuthenticated=!0,t.loading=!1,localStorage.setItem("token",s.payload.token)},logout:t=>{t.user=null,t.token=null,t.isAuthenticated=!1,t.loading=!1,localStorage.removeItem("token")},setLoading:(t,s)=>{t.loading=s.payload}},extraReducers:t=>{t.addCase(Xh.pending,s=>{s.loading=!0}).addCase(Xh.fulfilled,(s,n)=>{s.user=n.payload.user,s.token=n.payload.token,s.isAuthenticated=!0,s.loading=!1}).addCase(Xh.rejected,s=>{s.user=null,s.token=null,s.isAuthenticated=!1,s.loading=!1,localStorage.removeItem("token")})}}),{setCredentials:n2,logout:r2,setLoading:BH}=s2.actions,z4=s2.reducer,U4={zones:[],regionalOffices:[],asms:[],zonalManagerMappings:[],zonalManagers:[],roles:[],allStates:[],allDistricts:[],allAreas:[],availablePermissions:[],emailTemplates:[],slaConfigs:[],users:[],ddLeads:[],areasPagination:{total:0,page:1,limit:10,totalPages:0},loading:!1,isAreasLoading:!1,error:null},a2=PC({name:"master",initialState:U4,reducers:{setMasterData:(t,s)=>({...t,...s.payload}),setAreasData:(t,s)=>{t.allAreas=s.payload.data,t.areasPagination=s.payload.pagination},setAreasLoading:(t,s)=>{t.isAreasLoading=s.payload},setZones:(t,s)=>{t.zones=s.payload},setRegionalOffices:(t,s)=>{t.regionalOffices=s.payload},setAsms:(t,s)=>{t.asms=s.payload},setZonalManagerMappings:(t,s)=>{t.zonalManagerMappings=s.payload},setUsers:(t,s)=>{t.users=s.payload},setLoading:(t,s)=>{t.loading=s.payload},setError:(t,s)=>{t.error=s.payload},setDdLeads:(t,s)=>{t.ddLeads=s.payload}}}),{setMasterData:i2,setZones:$H,setRegionalOffices:qH,setAsms:zH,setZonalManagerMappings:UH,setUsers:VH,setLoading:GN,setError:V4,setAreasData:H4,setAreasLoading:YN,setDdLeads:HH}=a2.actions,W4=a2.reducer,K4=F_({reducer:{auth:z4,master:W4}});var cu=Pv();const Vv=Lm(cu);/** * @remix-run/router v1.23.2 * * Copyright (c) Remix Software Inc. @@ -64,7 +64,7 @@ Error generating stack: `+H.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Gd(){return Gd=Object.assign?Object.assign.bind():function(t){for(var s=1;s"u")throw new Error(s)}function zv(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function VO(){return Math.random().toString(36).substr(2,8)}function KN(t,s){return{usr:t.state,key:t.key,idx:s}}function Z0(t,s,n,r){return n===void 0&&(n=null),Gd({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof s=="string"?Fc(s):s,{state:n,key:s&&s.key||r||VO()})}function n2(t){let{pathname:s="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(s+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(s+=r.charAt(0)==="#"?r:"#"+r),s}function Fc(t){let s={};if(t){let n=t.indexOf("#");n>=0&&(s.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(s.search=t.substr(r),t=t.substr(0,r)),t&&(s.pathname=t)}return s}function HO(t,s,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:l=!1}=r,c=a.history,d=Dl.Pop,h=null,x=f();x==null&&(x=0,c.replaceState(Gd({},c.state,{idx:x}),""));function f(){return(c.state||{idx:null}).idx}function m(){d=Dl.Pop;let y=f(),N=y==null?null:y-x;x=y,h&&h({action:d,location:g.location,delta:N})}function p(y,N){d=Dl.Push;let S=Z0(g.location,y,N);x=f()+1;let C=KN(S,x),w=g.createHref(S);try{c.pushState(C,"",w)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;a.location.assign(w)}l&&h&&h({action:d,location:g.location,delta:1})}function u(y,N){d=Dl.Replace;let S=Z0(g.location,y,N);x=f();let C=KN(S,x),w=g.createHref(S);c.replaceState(C,"",w),l&&h&&h({action:d,location:g.location,delta:0})}function j(y){let N=a.location.origin!=="null"?a.location.origin:a.location.href,S=typeof y=="string"?y:n2(y);return S=S.replace(/ $/,"%20"),Yn(N,"No window.location.(origin|href) available to create URL for href: "+S),new URL(S,N)}let g={get action(){return d},get location(){return t(a,c)},listen(y){if(h)throw new Error("A history only accepts one active listener");return a.addEventListener(GN,m),h=y,()=>{a.removeEventListener(GN,m),h=null}},createHref(y){return s(a,y)},createURL:j,encodeLocation(y){let N=j(y);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:p,replace:u,go(y){return c.go(y)}};return g}var YN;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(YN||(YN={}));function WO(t,s,n){return n===void 0&&(n="/"),GO(t,s,n)}function GO(t,s,n,r){let a=typeof s=="string"?Fc(s):s,l=i2(a.pathname||"/",n);if(l==null)return null;let c=r2(t);KO(c);let d=null;for(let h=0;d==null&&h{let h={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:c,route:l};h.relativePath.startsWith("/")&&(Yn(h.relativePath.startsWith(r),'Absolute route path "'+h.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),h.relativePath=h.relativePath.slice(r.length));let x=Io([r,h.relativePath]),f=n.concat(h);l.children&&l.children.length>0&&(Yn(l.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+x+'".')),r2(l.children,s,f,x)),!(l.path==null&&!l.index)&&s.push({path:x,score:t4(x,l.index),routesMeta:f})};return t.forEach((l,c)=>{var d;if(l.path===""||!((d=l.path)!=null&&d.includes("?")))a(l,c);else for(let h of a2(l.path))a(l,c,h)}),s}function a2(t){let s=t.split("/");if(s.length===0)return[];let[n,...r]=s,a=n.endsWith("?"),l=n.replace(/\?$/,"");if(r.length===0)return a?[l,""]:[l];let c=a2(r.join("/")),d=[];return d.push(...c.map(h=>h===""?l:[l,h].join("/"))),a&&d.push(...c),d.map(h=>t.startsWith("/")&&h===""?"/":h)}function KO(t){t.sort((s,n)=>s.score!==n.score?n.score-s.score:s4(s.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const YO=/^:[\w-]+$/,ZO=3,QO=2,XO=1,JO=10,e4=-2,ZN=t=>t==="*";function t4(t,s){let n=t.split("/"),r=n.length;return n.some(ZN)&&(r+=e4),s&&(r+=QO),n.filter(a=>!ZN(a)).reduce((a,l)=>a+(YO.test(l)?ZO:l===""?XO:JO),r)}function s4(t,s){return t.length===s.length&&t.slice(0,-1).every((r,a)=>r===s[a])?t[t.length-1]-s[s.length-1]:0}function n4(t,s,n){let{routesMeta:r}=t,a={},l="/",c=[];for(let d=0;d{let{paramName:p,isOptional:u}=f;if(p==="*"){let g=d[m]||"";c=l.slice(0,l.length-g.length).replace(/(.)\/+$/,"$1")}const j=d[m];return u&&!j?x[p]=void 0:x[p]=(j||"").replace(/%2F/g,"/"),x},{}),pathname:l,pathnameBase:c,pattern:t}}function a4(t,s,n){s===void 0&&(s=!1),n===void 0&&(n=!0),zv(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,h)=>(r.push({paramName:d,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,s?void 0:"i"),r]}function i4(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return zv(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+s+").")),t}}function i2(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let n=s.endsWith("/")?s.length-1:s.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const l4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,o4=t=>l4.test(t);function c4(t,s){s===void 0&&(s="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?Fc(t):t,l;if(n)if(o4(n))l=n;else{if(n.includes("//")){let c=n;n=n.replace(/\/\/+/g,"/"),zv(!1,"Pathnames cannot have embedded double slashes - normalizing "+(c+" -> "+n))}n.startsWith("/")?l=QN(n.substring(1),"/"):l=QN(n,s)}else l=s;return{pathname:l,search:h4(r),hash:m4(a)}}function QN(t,s){let n=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Sx(t,s,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+s+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function d4(t){return t.filter((s,n)=>n===0||s.route.path&&s.route.path.length>0)}function l2(t,s){let n=d4(t);return s?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function o2(t,s,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=Fc(t):(a=Gd({},t),Yn(!a.pathname||!a.pathname.includes("?"),Sx("?","pathname","search",a)),Yn(!a.pathname||!a.pathname.includes("#"),Sx("#","pathname","hash",a)),Yn(!a.search||!a.search.includes("#"),Sx("#","search","hash",a)));let l=t===""||a.pathname==="",c=l?"/":a.pathname,d;if(c==null)d=n;else{let m=s.length-1;if(!r&&c.startsWith("..")){let p=c.split("/");for(;p[0]==="..";)p.shift(),m-=1;a.pathname=p.join("/")}d=m>=0?s[m]:"/"}let h=c4(a,d),x=c&&c!=="/"&&c.endsWith("/"),f=(l||c===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(x||f)&&(h.pathname+="/"),h}const Io=t=>t.join("/").replace(/\/\/+/g,"/"),u4=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),h4=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,m4=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function f4(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const c2=["post","put","patch","delete"];new Set(c2);const p4=["get",...c2];new Set(p4);/** + */function Kd(){return Kd=Object.assign?Object.assign.bind():function(t){for(var s=1;s"u")throw new Error(s)}function Hv(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function Y4(){return Math.random().toString(36).substr(2,8)}function QN(t,s){return{usr:t.state,key:t.key,idx:s}}function J0(t,s,n,r){return n===void 0&&(n=null),Kd({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof s=="string"?Fc(s):s,{state:n,key:s&&s.key||r||Y4()})}function l2(t){let{pathname:s="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(s+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(s+=r.charAt(0)==="#"?r:"#"+r),s}function Fc(t){let s={};if(t){let n=t.indexOf("#");n>=0&&(s.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(s.search=t.substr(r),t=t.substr(0,r)),t&&(s.pathname=t)}return s}function Z4(t,s,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:l=!1}=r,c=a.history,d=Dl.Pop,m=null,x=f();x==null&&(x=0,c.replaceState(Kd({},c.state,{idx:x}),""));function f(){return(c.state||{idx:null}).idx}function h(){d=Dl.Pop;let y=f(),N=y==null?null:y-x;x=y,m&&m({action:d,location:p.location,delta:N})}function g(y,N){d=Dl.Push;let S=J0(p.location,y,N);x=f()+1;let A=QN(S,x),w=p.createHref(S);try{c.pushState(A,"",w)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;a.location.assign(w)}l&&m&&m({action:d,location:p.location,delta:1})}function u(y,N){d=Dl.Replace;let S=J0(p.location,y,N);x=f();let A=QN(S,x),w=p.createHref(S);c.replaceState(A,"",w),l&&m&&m({action:d,location:p.location,delta:0})}function j(y){let N=a.location.origin!=="null"?a.location.origin:a.location.href,S=typeof y=="string"?y:l2(y);return S=S.replace(/ $/,"%20"),Yn(N,"No window.location.(origin|href) available to create URL for href: "+S),new URL(S,N)}let p={get action(){return d},get location(){return t(a,c)},listen(y){if(m)throw new Error("A history only accepts one active listener");return a.addEventListener(ZN,h),m=y,()=>{a.removeEventListener(ZN,h),m=null}},createHref(y){return s(a,y)},createURL:j,encodeLocation(y){let N=j(y);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:g,replace:u,go(y){return c.go(y)}};return p}var XN;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(XN||(XN={}));function Q4(t,s,n){return n===void 0&&(n="/"),X4(t,s,n)}function X4(t,s,n,r){let a=typeof s=="string"?Fc(s):s,l=d2(a.pathname||"/",n);if(l==null)return null;let c=o2(t);J4(c);let d=null;for(let m=0;d==null&&m{let m={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:c,route:l};m.relativePath.startsWith("/")&&(Yn(m.relativePath.startsWith(r),'Absolute route path "'+m.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),m.relativePath=m.relativePath.slice(r.length));let x=Lo([r,m.relativePath]),f=n.concat(m);l.children&&l.children.length>0&&(Yn(l.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+x+'".')),o2(l.children,s,f,x)),!(l.path==null&&!l.index)&&s.push({path:x,score:iO(x,l.index),routesMeta:f})};return t.forEach((l,c)=>{var d;if(l.path===""||!((d=l.path)!=null&&d.includes("?")))a(l,c);else for(let m of c2(l.path))a(l,c,m)}),s}function c2(t){let s=t.split("/");if(s.length===0)return[];let[n,...r]=s,a=n.endsWith("?"),l=n.replace(/\?$/,"");if(r.length===0)return a?[l,""]:[l];let c=c2(r.join("/")),d=[];return d.push(...c.map(m=>m===""?l:[l,m].join("/"))),a&&d.push(...c),d.map(m=>t.startsWith("/")&&m===""?"/":m)}function J4(t){t.sort((s,n)=>s.score!==n.score?n.score-s.score:lO(s.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const eO=/^:[\w-]+$/,tO=3,sO=2,nO=1,rO=10,aO=-2,JN=t=>t==="*";function iO(t,s){let n=t.split("/"),r=n.length;return n.some(JN)&&(r+=aO),s&&(r+=sO),n.filter(a=>!JN(a)).reduce((a,l)=>a+(eO.test(l)?tO:l===""?nO:rO),r)}function lO(t,s){return t.length===s.length&&t.slice(0,-1).every((r,a)=>r===s[a])?t[t.length-1]-s[s.length-1]:0}function oO(t,s,n){let{routesMeta:r}=t,a={},l="/",c=[];for(let d=0;d{let{paramName:g,isOptional:u}=f;if(g==="*"){let p=d[h]||"";c=l.slice(0,l.length-p.length).replace(/(.)\/+$/,"$1")}const j=d[h];return u&&!j?x[g]=void 0:x[g]=(j||"").replace(/%2F/g,"/"),x},{}),pathname:l,pathnameBase:c,pattern:t}}function dO(t,s,n){s===void 0&&(s=!1),n===void 0&&(n=!0),Hv(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,m)=>(r.push({paramName:d,isOptional:m!=null}),m?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,s?void 0:"i"),r]}function uO(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Hv(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+s+").")),t}}function d2(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let n=s.endsWith("/")?s.length-1:s.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const hO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mO=t=>hO.test(t);function fO(t,s){s===void 0&&(s="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?Fc(t):t,l;if(n)if(mO(n))l=n;else{if(n.includes("//")){let c=n;n=n.replace(/\/\/+/g,"/"),Hv(!1,"Pathnames cannot have embedded double slashes - normalizing "+(c+" -> "+n))}n.startsWith("/")?l=ew(n.substring(1),"/"):l=ew(n,s)}else l=s;return{pathname:l,search:gO(r),hash:vO(a)}}function ew(t,s){let n=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Ax(t,s,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+s+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function pO(t){return t.filter((s,n)=>n===0||s.route.path&&s.route.path.length>0)}function u2(t,s){let n=pO(t);return s?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function h2(t,s,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=Fc(t):(a=Kd({},t),Yn(!a.pathname||!a.pathname.includes("?"),Ax("?","pathname","search",a)),Yn(!a.pathname||!a.pathname.includes("#"),Ax("#","pathname","hash",a)),Yn(!a.search||!a.search.includes("#"),Ax("#","search","hash",a)));let l=t===""||a.pathname==="",c=l?"/":a.pathname,d;if(c==null)d=n;else{let h=s.length-1;if(!r&&c.startsWith("..")){let g=c.split("/");for(;g[0]==="..";)g.shift(),h-=1;a.pathname=g.join("/")}d=h>=0?s[h]:"/"}let m=fO(a,d),x=c&&c!=="/"&&c.endsWith("/"),f=(l||c===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(x||f)&&(m.pathname+="/"),m}const Lo=t=>t.join("/").replace(/\/\/+/g,"/"),xO=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),gO=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,vO=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function bO(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const m2=["post","put","patch","delete"];new Set(m2);const yO=["get",...m2];new Set(yO);/** * React Router v6.30.3 * * Copyright (c) Remix Software Inc. @@ -73,7 +73,7 @@ Error generating stack: `+H.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Kd(){return Kd=Object.assign?Object.assign.bind():function(t){for(var s=1;s{d.current=!0}),v.useCallback(function(x,f){if(f===void 0&&(f={}),!d.current)return;if(typeof x=="number"){r.go(x);return}let m=o2(x,JSON.parse(c),l,f.relative==="path");t==null&&s!=="/"&&(m.pathname=m.pathname==="/"?s:Io([s,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[s,r,c,l,t])}const v4=v.createContext(null);function b4(t){let s=v.useContext(Ji).outlet;return s&&v.createElement(v4.Provider,{value:t},s)}function Bc(){let{matches:t}=v.useContext(Ji),s=t[t.length-1];return s?s.params:{}}function y4(t,s){return j4(t,s)}function j4(t,s,n,r){uu()||Yn(!1);let{navigator:a}=v.useContext(du),{matches:l}=v.useContext(Ji),c=l[l.length-1],d=c?c.params:{};c&&c.pathname;let h=c?c.pathnameBase:"/";c&&c.route;let x=Ul(),f;if(s){var m;let y=typeof s=="string"?Fc(s):s;h==="/"||(m=y.pathname)!=null&&m.startsWith(h)||Yn(!1),f=y}else f=x;let p=f.pathname||"/",u=p;if(h!=="/"){let y=h.replace(/^\//,"").split("/");u="/"+p.replace(/^\//,"").split("/").slice(y.length).join("/")}let j=WO(t,{pathname:u}),g=A4(j&&j.map(y=>Object.assign({},y,{params:Object.assign({},d,y.params),pathname:Io([h,a.encodeLocation?a.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?h:Io([h,a.encodeLocation?a.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),l,n,r);return s&&g?v.createElement(Gm.Provider,{value:{location:Kd({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:Dl.Pop}},g):g}function N4(){let t=D4(),s=f4(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},s),n?v.createElement("pre",{style:a},n):null,null)}const w4=v.createElement(N4,null);class S4 extends v.Component{constructor(s){super(s),this.state={location:s.location,revalidation:s.revalidation,error:s.error}}static getDerivedStateFromError(s){return{error:s}}static getDerivedStateFromProps(s,n){return n.location!==s.location||n.revalidation!=="idle"&&s.revalidation==="idle"?{error:s.error,location:s.location,revalidation:s.revalidation}:{error:s.error!==void 0?s.error:n.error,location:n.location,revalidation:s.revalidation||n.revalidation}}componentDidCatch(s,n){console.error("React Router caught the following error during render",s,n)}render(){return this.state.error!==void 0?v.createElement(Ji.Provider,{value:this.props.routeContext},v.createElement(d2.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function C4(t){let{routeContext:s,match:n,children:r}=t,a=v.useContext(Uv);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(Ji.Provider,{value:s},r)}function A4(t,s,n,r){var a;if(s===void 0&&(s=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var l;if(!n)return null;if(n.errors)t=n.matches;else if((l=r)!=null&&l.v7_partialHydration&&s.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let c=t,d=(a=n)==null?void 0:a.errors;if(d!=null){let f=c.findIndex(m=>m.route.id&&(d==null?void 0:d[m.route.id])!==void 0);f>=0||Yn(!1),c=c.slice(0,Math.min(c.length,f+1))}let h=!1,x=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?c=c.slice(0,x+1):c=[c[0]];break}}}return c.reduceRight((f,m,p)=>{let u,j=!1,g=null,y=null;n&&(u=d&&m.route.id?d[m.route.id]:void 0,g=m.route.errorElement||w4,h&&(x<0&&p===0?(P4("route-fallback"),j=!0,y=null):x===p&&(j=!0,y=m.route.hydrateFallbackElement||null)));let N=s.concat(c.slice(0,p+1)),S=()=>{let C;return u?C=g:j?C=y:m.route.Component?C=v.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,v.createElement(C4,{match:m,routeContext:{outlet:f,matches:N,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||p===0)?v.createElement(S4,{location:n.location,revalidation:n.revalidation,component:g,error:u,children:S(),routeContext:{outlet:null,matches:N,isDataRoute:!0}}):S()},null)}var h2=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(h2||{}),m2=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(m2||{});function k4(t){let s=v.useContext(Uv);return s||Yn(!1),s}function R4(t){let s=v.useContext(x4);return s||Yn(!1),s}function E4(t){let s=v.useContext(Ji);return s||Yn(!1),s}function f2(t){let s=E4(),n=s.matches[s.matches.length-1];return n.route.id||Yn(!1),n.route.id}function D4(){var t;let s=v.useContext(d2),n=R4(),r=f2();return s!==void 0?s:(t=n.errors)==null?void 0:t[r]}function T4(){let{router:t}=k4(h2.UseNavigateStable),s=f2(m2.UseNavigateStable),n=v.useRef(!1);return u2(()=>{n.current=!0}),v.useCallback(function(a,l){l===void 0&&(l={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,Kd({fromRouteId:s},l)))},[t,s])}const XN={};function P4(t,s,n){XN[t]||(XN[t]=!0)}function _4(t,s){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Mn(t){let{to:s,replace:n,state:r,relative:a}=t;uu()||Yn(!1);let{future:l,static:c}=v.useContext(du),{matches:d}=v.useContext(Ji),{pathname:h}=Ul(),x=qn(),f=o2(s,l2(d,l.v7_relativeSplatPath),h,a==="path"),m=JSON.stringify(f);return v.useEffect(()=>x(JSON.parse(m),{replace:n,state:r,relative:a}),[x,m,a,n,r]),null}function O4(t){return b4(t.context)}function Ns(t){Yn(!1)}function I4(t){let{basename:s="/",children:n=null,location:r,navigationType:a=Dl.Pop,navigator:l,static:c=!1,future:d}=t;uu()&&Yn(!1);let h=s.replace(/^\/*/,"/"),x=v.useMemo(()=>({basename:h,navigator:l,static:c,future:Kd({v7_relativeSplatPath:!1},d)}),[h,d,l,c]);typeof r=="string"&&(r=Fc(r));let{pathname:f="/",search:m="",hash:p="",state:u=null,key:j="default"}=r,g=v.useMemo(()=>{let y=i2(f,h);return y==null?null:{location:{pathname:y,search:m,hash:p,state:u,key:j},navigationType:a}},[h,f,m,p,u,j,a]);return g==null?null:v.createElement(du.Provider,{value:x},v.createElement(Gm.Provider,{children:n,value:g}))}function Q0(t){let{children:s,location:n}=t;return y4(X0(s),n)}new Promise(()=>{});function X0(t,s){s===void 0&&(s=[]);let n=[];return v.Children.forEach(t,(r,a)=>{if(!v.isValidElement(r))return;let l=[...s,a];if(r.type===v.Fragment){n.push.apply(n,X0(r.props.children,l));return}r.type!==Ns&&Yn(!1),!r.props.index||!r.props.children||Yn(!1);let c={id:r.props.id||l.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(c.children=X0(r.props.children,l)),n.push(c)}),n}/** + */function Gd(){return Gd=Object.assign?Object.assign.bind():function(t){for(var s=1;s{d.current=!0}),v.useCallback(function(x,f){if(f===void 0&&(f={}),!d.current)return;if(typeof x=="number"){r.go(x);return}let h=h2(x,JSON.parse(c),l,f.relative==="path");t==null&&s!=="/"&&(h.pathname=h.pathname==="/"?s:Lo([s,h.pathname])),(f.replace?r.replace:r.push)(h,f.state,f)},[s,r,c,l,t])}const wO=v.createContext(null);function SO(t){let s=v.useContext(Ji).outlet;return s&&v.createElement(wO.Provider,{value:t},s)}function Bc(){let{matches:t}=v.useContext(Ji),s=t[t.length-1];return s?s.params:{}}function CO(t,s){return AO(t,s)}function AO(t,s,n,r){uu()||Yn(!1);let{navigator:a}=v.useContext(du),{matches:l}=v.useContext(Ji),c=l[l.length-1],d=c?c.params:{};c&&c.pathname;let m=c?c.pathnameBase:"/";c&&c.route;let x=Ul(),f;if(s){var h;let y=typeof s=="string"?Fc(s):s;m==="/"||(h=y.pathname)!=null&&h.startsWith(m)||Yn(!1),f=y}else f=x;let g=f.pathname||"/",u=g;if(m!=="/"){let y=m.replace(/^\//,"").split("/");u="/"+g.replace(/^\//,"").split("/").slice(y.length).join("/")}let j=Q4(t,{pathname:u}),p=TO(j&&j.map(y=>Object.assign({},y,{params:Object.assign({},d,y.params),pathname:Lo([m,a.encodeLocation?a.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?m:Lo([m,a.encodeLocation?a.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),l,n,r);return s&&p?v.createElement(Ym.Provider,{value:{location:Gd({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:Dl.Pop}},p):p}function kO(){let t=LO(),s=bO(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},s),n?v.createElement("pre",{style:a},n):null,null)}const RO=v.createElement(kO,null);class EO extends v.Component{constructor(s){super(s),this.state={location:s.location,revalidation:s.revalidation,error:s.error}}static getDerivedStateFromError(s){return{error:s}}static getDerivedStateFromProps(s,n){return n.location!==s.location||n.revalidation!=="idle"&&s.revalidation==="idle"?{error:s.error,location:s.location,revalidation:s.revalidation}:{error:s.error!==void 0?s.error:n.error,location:n.location,revalidation:s.revalidation||n.revalidation}}componentDidCatch(s,n){console.error("React Router caught the following error during render",s,n)}render(){return this.state.error!==void 0?v.createElement(Ji.Provider,{value:this.props.routeContext},v.createElement(f2.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function DO(t){let{routeContext:s,match:n,children:r}=t,a=v.useContext(Wv);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(Ji.Provider,{value:s},r)}function TO(t,s,n,r){var a;if(s===void 0&&(s=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var l;if(!n)return null;if(n.errors)t=n.matches;else if((l=r)!=null&&l.v7_partialHydration&&s.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let c=t,d=(a=n)==null?void 0:a.errors;if(d!=null){let f=c.findIndex(h=>h.route.id&&(d==null?void 0:d[h.route.id])!==void 0);f>=0||Yn(!1),c=c.slice(0,Math.min(c.length,f+1))}let m=!1,x=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?c=c.slice(0,x+1):c=[c[0]];break}}}return c.reduceRight((f,h,g)=>{let u,j=!1,p=null,y=null;n&&(u=d&&h.route.id?d[h.route.id]:void 0,p=h.route.errorElement||RO,m&&(x<0&&g===0?(MO("route-fallback"),j=!0,y=null):x===g&&(j=!0,y=h.route.hydrateFallbackElement||null)));let N=s.concat(c.slice(0,g+1)),S=()=>{let A;return u?A=p:j?A=y:h.route.Component?A=v.createElement(h.route.Component,null):h.route.element?A=h.route.element:A=f,v.createElement(DO,{match:h,routeContext:{outlet:f,matches:N,isDataRoute:n!=null},children:A})};return n&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?v.createElement(EO,{location:n.location,revalidation:n.revalidation,component:p,error:u,children:S(),routeContext:{outlet:null,matches:N,isDataRoute:!0}}):S()},null)}var x2=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(x2||{}),g2=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(g2||{});function _O(t){let s=v.useContext(Wv);return s||Yn(!1),s}function PO(t){let s=v.useContext(jO);return s||Yn(!1),s}function OO(t){let s=v.useContext(Ji);return s||Yn(!1),s}function v2(t){let s=OO(),n=s.matches[s.matches.length-1];return n.route.id||Yn(!1),n.route.id}function LO(){var t;let s=v.useContext(f2),n=PO(),r=v2();return s!==void 0?s:(t=n.errors)==null?void 0:t[r]}function IO(){let{router:t}=_O(x2.UseNavigateStable),s=v2(g2.UseNavigateStable),n=v.useRef(!1);return p2(()=>{n.current=!0}),v.useCallback(function(a,l){l===void 0&&(l={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,Gd({fromRouteId:s},l)))},[t,s])}const tw={};function MO(t,s,n){tw[t]||(tw[t]=!0)}function FO(t,s){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Mn(t){let{to:s,replace:n,state:r,relative:a}=t;uu()||Yn(!1);let{future:l,static:c}=v.useContext(du),{matches:d}=v.useContext(Ji),{pathname:m}=Ul(),x=qn(),f=h2(s,u2(d,l.v7_relativeSplatPath),m,a==="path"),h=JSON.stringify(f);return v.useEffect(()=>x(JSON.parse(h),{replace:n,state:r,relative:a}),[x,h,a,n,r]),null}function BO(t){return SO(t.context)}function Ns(t){Yn(!1)}function $O(t){let{basename:s="/",children:n=null,location:r,navigationType:a=Dl.Pop,navigator:l,static:c=!1,future:d}=t;uu()&&Yn(!1);let m=s.replace(/^\/*/,"/"),x=v.useMemo(()=>({basename:m,navigator:l,static:c,future:Gd({v7_relativeSplatPath:!1},d)}),[m,d,l,c]);typeof r=="string"&&(r=Fc(r));let{pathname:f="/",search:h="",hash:g="",state:u=null,key:j="default"}=r,p=v.useMemo(()=>{let y=d2(f,m);return y==null?null:{location:{pathname:y,search:h,hash:g,state:u,key:j},navigationType:a}},[m,f,h,g,u,j,a]);return p==null?null:v.createElement(du.Provider,{value:x},v.createElement(Ym.Provider,{children:n,value:p}))}function ev(t){let{children:s,location:n}=t;return CO(tv(s),n)}new Promise(()=>{});function tv(t,s){s===void 0&&(s=[]);let n=[];return v.Children.forEach(t,(r,a)=>{if(!v.isValidElement(r))return;let l=[...s,a];if(r.type===v.Fragment){n.push.apply(n,tv(r.props.children,l));return}r.type!==Ns&&Yn(!1),!r.props.index||!r.props.children||Yn(!1);let c={id:r.props.id||l.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(c.children=tv(r.props.children,l)),n.push(c)}),n}/** * React Router DOM v6.30.3 * * Copyright (c) Remix Software Inc. @@ -82,27 +82,27 @@ Error generating stack: `+H.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */const L4="6";try{window.__reactRouterVersion=L4}catch{}const M4="startTransition",JN=Om[M4];function F4(t){let{basename:s,children:n,future:r,window:a}=t,l=v.useRef();l.current==null&&(l.current=UO({window:a,v5Compat:!0}));let c=l.current,[d,h]=v.useState({action:c.action,location:c.location}),{v7_startTransition:x}=r||{},f=v.useCallback(m=>{x&&JN?JN(()=>h(m)):h(m)},[h,x]);return v.useLayoutEffect(()=>c.listen(f),[c,f]),v.useEffect(()=>_4(r),[r]),v.createElement(I4,{basename:s,children:n,location:d.location,navigationType:d.action,navigator:c,future:r})}var ew;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(ew||(ew={}));var tw;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(tw||(tw={}));const sw=({children:t,allowedRoles:s,excludeRoles:n,redirectTo:r})=>{const{user:a,isAuthenticated:l,loading:c}=Nn(m=>m.auth),d=Ul(),h=String((a==null?void 0:a.role)||(a==null?void 0:a.roleCode)||"").trim().toLowerCase(),x=(s||[]).map(m=>String(m).trim().toLowerCase()),f=(n||[]).map(m=>String(m).trim().toLowerCase());return c?e.jsx("div",{className:"flex h-screen items-center justify-center",children:"Loading..."}):l?n&&a&&f.includes(h)?h==="prospective dealer"?e.jsx(Mn,{to:"/prospective-dashboard",replace:!0}):e.jsx(Mn,{to:r||"/dashboard",replace:!0}):s&&a&&!x.includes(h)?e.jsx(Mn,{to:r||"/dashboard",replace:!0}):e.jsx(e.Fragment,{children:t}):e.jsx(Mn,{to:"/admin-login",state:{from:d},replace:!0})};function nw(t,s){if(typeof t=="function")return t(s);t!=null&&(t.current=s)}function Br(...t){return s=>{let n=!1;const r=t.map(a=>{const l=nw(a,s);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let a=0;a{let{children:l,...c}=r;p2(l)&&typeof gm=="function"&&(l=gm(l._payload));const d=v.Children.toArray(l),h=d.find(U4);if(h){const x=h.props.children,f=d.map(m=>m===h?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:m);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}var x2=hu("Slot");function q4(t){const s=v.forwardRef((n,r)=>{let{children:a,...l}=n;if(p2(a)&&typeof gm=="function"&&(a=gm(a._payload)),v.isValidElement(a)){const c=H4(a),d=V4(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var z4=Symbol("radix.slottable");function U4(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===z4}function V4(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const h=l(...d);return a(...d),h}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function H4(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function g2(t){var s,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(s=0;stypeof t=="boolean"?`${t}`:t===0?"0":t,aw=v2,Vv=(t,s)=>n=>{var r;if((s==null?void 0:s.variants)==null)return aw(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:l}=s,c=Object.keys(a).map(x=>{const f=n==null?void 0:n[x],m=l==null?void 0:l[x];if(f===null)return null;const p=rw(f)||rw(m);return a[x][p]}),d=n&&Object.entries(n).reduce((x,f)=>{let[m,p]=f;return p===void 0||(x[m]=p),x},{}),h=s==null||(r=s.compoundVariants)===null||r===void 0?void 0:r.reduce((x,f)=>{let{class:m,className:p,...u}=f;return Object.entries(u).every(j=>{let[g,y]=j;return Array.isArray(y)?y.includes({...l,...d}[g]):{...l,...d}[g]===y})?[...x,m,p]:x},[]);return aw(t,c,h,n==null?void 0:n.class,n==null?void 0:n.className)},Hv="-",W4=t=>{const s=K4(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:c=>{const d=c.split(Hv);return d[0]===""&&d.length!==1&&d.shift(),b2(d,s)||G4(c)},getConflictingClassGroupIds:(c,d)=>{const h=n[c]||[];return d&&r[c]?[...h,...r[c]]:h}}},b2=(t,s)=>{var c;if(t.length===0)return s.classGroupId;const n=t[0],r=s.nextPart.get(n),a=r?b2(t.slice(1),r):void 0;if(a)return a;if(s.validators.length===0)return;const l=t.join(Hv);return(c=s.validators.find(({validator:d})=>d(l)))==null?void 0:c.classGroupId},iw=/^\[(.+)\]$/,G4=t=>{if(iw.test(t)){const s=iw.exec(t)[1],n=s==null?void 0:s.substring(0,s.indexOf(":"));if(n)return"arbitrary.."+n}},K4=t=>{const{theme:s,prefix:n}=t,r={nextPart:new Map,validators:[]};return Z4(Object.entries(t.classGroups),n).forEach(([l,c])=>{J0(c,r,l,s)}),r},J0=(t,s,n,r)=>{t.forEach(a=>{if(typeof a=="string"){const l=a===""?s:lw(s,a);l.classGroupId=n;return}if(typeof a=="function"){if(Y4(a)){J0(a(r),s,n,r);return}s.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([l,c])=>{J0(c,lw(s,l),n,r)})})},lw=(t,s)=>{let n=t;return s.split(Hv).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Y4=t=>t.isThemeGetter,Z4=(t,s)=>s?t.map(([n,r])=>{const a=r.map(l=>typeof l=="string"?s+l:typeof l=="object"?Object.fromEntries(Object.entries(l).map(([c,d])=>[s+c,d])):l);return[n,a]}):t,Q4=t=>{if(t<1)return{get:()=>{},set:()=>{}};let s=0,n=new Map,r=new Map;const a=(l,c)=>{n.set(l,c),s++,s>t&&(s=0,r=n,n=new Map)};return{get(l){let c=n.get(l);if(c!==void 0)return c;if((c=r.get(l))!==void 0)return a(l,c),c},set(l,c){n.has(l)?n.set(l,c):a(l,c)}}},y2="!",X4=t=>{const{separator:s,experimentalParseClassName:n}=t,r=s.length===1,a=s[0],l=s.length,c=d=>{const h=[];let x=0,f=0,m;for(let y=0;yf?m-f:void 0;return{modifiers:h,hasImportantModifier:u,baseClassName:j,maybePostfixModifierPosition:g}};return n?d=>n({className:d,parseClassName:c}):c},J4=t=>{if(t.length<=1)return t;const s=[];let n=[];return t.forEach(r=>{r[0]==="["?(s.push(...n.sort(),r),n=[]):n.push(r)}),s.push(...n.sort()),s},e5=t=>({cache:Q4(t.cacheSize),parseClassName:X4(t),...W4(t)}),t5=/\s+/,s5=(t,s)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=s,l=[],c=t.trim().split(t5);let d="";for(let h=c.length-1;h>=0;h-=1){const x=c[h],{modifiers:f,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:u}=n(x);let j=!!u,g=r(j?p.substring(0,u):p);if(!g){if(!j){d=x+(d.length>0?" "+d:d);continue}if(g=r(p),!g){d=x+(d.length>0?" "+d:d);continue}j=!1}const y=J4(f).join(":"),N=m?y+y2:y,S=N+g;if(l.includes(S))continue;l.push(S);const C=a(g,j);for(let w=0;w0?" "+d:d)}return d};function n5(){let t=0,s,n,r="";for(;t{if(typeof t=="string")return t;let s,n="";for(let r=0;rm(f),t());return n=e5(x),r=n.cache.get,a=n.cache.set,l=d,d(h)}function d(h){const x=r(h);if(x)return x;const f=s5(h,n);return a(h,f),f}return function(){return l(n5.apply(null,arguments))}}const jn=t=>{const s=n=>n[t]||[];return s.isThemeGetter=!0,s},N2=/^\[(?:([a-z-]+):)?(.+)\]$/i,a5=/^\d+\/\d+$/,i5=new Set(["px","full","screen"]),l5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,o5=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,c5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,d5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,u5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qi=t=>wc(t)||i5.has(t)||a5.test(t),Al=t=>$c(t,"length",b5),wc=t=>!!t&&!Number.isNaN(Number(t)),Cx=t=>$c(t,"number",wc),yd=t=>!!t&&Number.isInteger(Number(t)),h5=t=>t.endsWith("%")&&wc(t.slice(0,-1)),$s=t=>N2.test(t),kl=t=>l5.test(t),m5=new Set(["length","size","percentage"]),f5=t=>$c(t,m5,w2),p5=t=>$c(t,"position",w2),x5=new Set(["image","url"]),g5=t=>$c(t,x5,j5),v5=t=>$c(t,"",y5),jd=()=>!0,$c=(t,s,n)=>{const r=N2.exec(t);return r?r[1]?typeof s=="string"?r[1]===s:s.has(r[1]):n(r[2]):!1},b5=t=>o5.test(t)&&!c5.test(t),w2=()=>!1,y5=t=>d5.test(t),j5=t=>u5.test(t),N5=()=>{const t=jn("colors"),s=jn("spacing"),n=jn("blur"),r=jn("brightness"),a=jn("borderColor"),l=jn("borderRadius"),c=jn("borderSpacing"),d=jn("borderWidth"),h=jn("contrast"),x=jn("grayscale"),f=jn("hueRotate"),m=jn("invert"),p=jn("gap"),u=jn("gradientColorStops"),j=jn("gradientColorStopPositions"),g=jn("inset"),y=jn("margin"),N=jn("opacity"),S=jn("padding"),C=jn("saturate"),w=jn("scale"),R=jn("sepia"),P=jn("skew"),A=jn("space"),I=jn("translate"),$=()=>["auto","contain","none"],T=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto",$s,s],_=()=>[$s,s],M=()=>["",qi,Al],q=()=>["auto",wc,$s],G=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Z=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",$s],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>[wc,$s];return{cacheSize:500,separator:":",theme:{colors:[jd],spacing:[qi,Al],blur:["none","",kl,$s],brightness:D(),borderColor:[t],borderRadius:["none","","full",kl,$s],borderSpacing:_(),borderWidth:M(),contrast:D(),grayscale:F(),hueRotate:D(),invert:F(),gap:_(),gradientColorStops:[t],gradientColorStopPositions:[h5,Al],inset:E(),margin:E(),opacity:D(),padding:_(),saturate:D(),scale:D(),sepia:F(),skew:D(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",$s]}],container:["container"],columns:[{columns:[kl]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...G(),$s]}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",yd,$s]}],basis:[{basis:E()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",$s]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",yd,$s]}],"grid-cols":[{"grid-cols":[jd]}],"col-start-end":[{col:["auto",{span:["full",yd,$s]},$s]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[jd]}],"row-start-end":[{row:["auto",{span:[yd,$s]},$s]}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",$s]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",$s]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[S]}],px:[{px:[S]}],py:[{py:[S]}],ps:[{ps:[S]}],pe:[{pe:[S]}],pt:[{pt:[S]}],pr:[{pr:[S]}],pb:[{pb:[S]}],pl:[{pl:[S]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",$s,s]}],"min-w":[{"min-w":[$s,s,"min","max","fit"]}],"max-w":[{"max-w":[$s,s,"none","full","min","max","fit","prose",{screen:[kl]},kl]}],h:[{h:[$s,s,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[$s,s,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[$s,s,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[$s,s,"auto","min","max","fit"]}],"font-size":[{text:["base",kl,Al]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Cx]}],"font-family":[{font:[jd]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",$s]}],"line-clamp":[{"line-clamp":["none",wc,Cx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",qi,$s]}],"list-image":[{"list-image":["none",$s]}],"list-style-type":[{list:["none","disc","decimal",$s]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[N]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[N]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",qi,Al]}],"underline-offset":[{"underline-offset":["auto",qi,$s]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$s]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",$s]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[N]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...G(),p5]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",f5]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},g5]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[j]}],"gradient-via-pos":[{via:[j]}],"gradient-to-pos":[{to:[j]}],"gradient-from":[{from:[u]}],"gradient-via":[{via:[u]}],"gradient-to":[{to:[u]}],rounded:[{rounded:[l]}],"rounded-s":[{"rounded-s":[l]}],"rounded-e":[{"rounded-e":[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-ss":[{"rounded-ss":[l]}],"rounded-se":[{"rounded-se":[l]}],"rounded-ee":[{"rounded-ee":[l]}],"rounded-es":[{"rounded-es":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"border-w":[{border:[d]}],"border-w-x":[{"border-x":[d]}],"border-w-y":[{"border-y":[d]}],"border-w-s":[{"border-s":[d]}],"border-w-e":[{"border-e":[d]}],"border-w-t":[{"border-t":[d]}],"border-w-r":[{"border-r":[d]}],"border-w-b":[{"border-b":[d]}],"border-w-l":[{"border-l":[d]}],"border-opacity":[{"border-opacity":[N]}],"border-style":[{border:[...Z(),"hidden"]}],"divide-x":[{"divide-x":[d]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[d]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[N]}],"divide-style":[{divide:Z()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...Z()]}],"outline-offset":[{"outline-offset":[qi,$s]}],"outline-w":[{outline:[qi,Al]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[N]}],"ring-offset-w":[{"ring-offset":[qi,Al]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",kl,v5]}],"shadow-color":[{shadow:[jd]}],opacity:[{opacity:[N]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",kl,$s]}],grayscale:[{grayscale:[x]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[m]}],saturate:[{saturate:[C]}],sepia:[{sepia:[R]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[x]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[N]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[R]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",$s]}],duration:[{duration:D()}],ease:[{ease:["linear","in","out","in-out",$s]}],delay:[{delay:D()}],animate:[{animate:["none","spin","ping","pulse","bounce",$s]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[yd,$s]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",$s]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",$s]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",$s]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[qi,Al,Cx]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},w5=r5(N5);function Pt(...t){return w5(v2(t))}function Ht(t,s="full"){const n=new Date(t),r={day:"2-digit",month:"short",year:"numeric"};return(s==="full"||s==="time")&&(r.hour="2-digit",r.minute="2-digit",r.hour12=!0),s==="time"?n.toLocaleTimeString("en-IN",{hour:"2-digit",minute:"2-digit",hour12:!0}):s==="full"?n.toLocaleString("en-IN",r):n.toLocaleDateString("en-IN",r)}const Km=Vv("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),se=v.forwardRef(({className:t,variant:s,size:n,asChild:r=!1,...a},l)=>{const c=r?x2:"button";return e.jsx(c,{"data-slot":"button",className:Pt(Km({variant:s,size:n,className:t})),ref:l,...a})});se.displayName="Button";const ot=v.forwardRef(({className:t,type:s,...n},r)=>e.jsx("input",{type:s,ref:r,"data-slot":"input",className:Pt("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base bg-input-background transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...n}));ot.displayName="Input";function Fs({className:t,...s}){return e.jsx("textarea",{"data-slot":"textarea",className:Pt("resize-none border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-input-background px-3 py-2 text-base transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...s})}function S5(t,s){const n=v.createContext(s),r=l=>{const{children:c,...d}=l,h=v.useMemo(()=>d,Object.values(d));return e.jsx(n.Provider,{value:h,children:c})};r.displayName=t+"Provider";function a(l){const c=v.useContext(n);if(c)return c;if(s!==void 0)return s;throw new Error(`\`${l}\` must be used within \`${t}\``)}return[r,a]}function ea(t,s=[]){let n=[];function r(l,c){const d=v.createContext(c),h=n.length;n=[...n,c];const x=m=>{var N;const{scope:p,children:u,...j}=m,g=((N=p==null?void 0:p[t])==null?void 0:N[h])||d,y=v.useMemo(()=>j,Object.values(j));return e.jsx(g.Provider,{value:y,children:u})};x.displayName=l+"Provider";function f(m,p){var g;const u=((g=p==null?void 0:p[t])==null?void 0:g[h])||d,j=v.useContext(u);if(j)return j;if(c!==void 0)return c;throw new Error(`\`${m}\` must be used within \`${l}\``)}return[x,f]}const a=()=>{const l=n.map(c=>v.createContext(c));return function(d){const h=(d==null?void 0:d[t])||l;return v.useMemo(()=>({[`__scope${t}`]:{...d,[t]:h}}),[d,h])}};return a.scopeName=t,[r,C5(a,...s)]}function C5(...t){const s=t[0];if(t.length===1)return s;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const c=r.reduce((d,{useScope:h,scopeName:x})=>{const m=h(l)[`__scope${x}`];return{...d,...m}},{});return v.useMemo(()=>({[`__scope${s.scopeName}`]:c}),[c])}};return n.scopeName=s.scopeName,n}function Vt(t,s,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return s==null?void 0:s(a)}}var Zn=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},A5=Om[" useInsertionEffect ".trim().toString()]||Zn;function bi({prop:t,defaultProp:s,onChange:n=()=>{},caller:r}){const[a,l,c]=k5({defaultProp:s,onChange:n}),d=t!==void 0,h=d?t:a;{const f=v.useRef(t!==void 0);v.useEffect(()=>{const m=f.current;m!==d&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=d},[d,r])}const x=v.useCallback(f=>{var m;if(d){const p=R5(f)?f(t):f;p!==t&&((m=c.current)==null||m.call(c,p))}else l(f)},[d,t,l,c]);return[h,x]}function k5({defaultProp:t,onChange:s}){const[n,r]=v.useState(t),a=v.useRef(n),l=v.useRef(s);return A5(()=>{l.current=s},[s]),v.useEffect(()=>{var c;a.current!==n&&((c=l.current)==null||c.call(l,n),a.current=n)},[n,a]),[n,r,l]}function R5(t){return typeof t=="function"}function Wv(t){const s=v.useRef({value:t,previous:t});return v.useMemo(()=>(s.current.value!==t&&(s.current.previous=s.current.value,s.current.value=t),s.current.previous),[t])}function Gv(t){const[s,n]=v.useState(void 0);return Zn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const l=a[0];let c,d;if("borderBoxSize"in l){const h=l.borderBoxSize,x=Array.isArray(h)?h[0]:h;c=x.inlineSize,d=x.blockSize}else c=t.offsetWidth,d=t.offsetHeight;n({width:c,height:d})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),s}function E5(t,s){return v.useReducer((n,r)=>s[n][r]??n,t)}var mr=t=>{const{present:s,children:n}=t,r=D5(s),a=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),l=Ms(r.ref,T5(a));return typeof n=="function"||r.isPresent?v.cloneElement(a,{ref:l}):null};mr.displayName="Presence";function D5(t){const[s,n]=v.useState(),r=v.useRef(null),a=v.useRef(t),l=v.useRef("none"),c=t?"mounted":"unmounted",[d,h]=E5(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const x=Ah(r.current);l.current=d==="mounted"?x:"none"},[d]),Zn(()=>{const x=r.current,f=a.current;if(f!==t){const p=l.current,u=Ah(x);t?h("MOUNT"):u==="none"||(x==null?void 0:x.display)==="none"?h("UNMOUNT"):h(f&&p!==u?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,h]),Zn(()=>{if(s){let x;const f=s.ownerDocument.defaultView??window,m=u=>{const g=Ah(r.current).includes(CSS.escape(u.animationName));if(u.target===s&&g&&(h("ANIMATION_END"),!a.current)){const y=s.style.animationFillMode;s.style.animationFillMode="forwards",x=f.setTimeout(()=>{s.style.animationFillMode==="forwards"&&(s.style.animationFillMode=y)})}},p=u=>{u.target===s&&(l.current=Ah(r.current))};return s.addEventListener("animationstart",p),s.addEventListener("animationcancel",m),s.addEventListener("animationend",m),()=>{f.clearTimeout(x),s.removeEventListener("animationstart",p),s.removeEventListener("animationcancel",m),s.removeEventListener("animationend",m)}}else h("ANIMATION_END")},[s,h]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:v.useCallback(x=>{r.current=x?getComputedStyle(x):null,n(x)},[])}}function Ah(t){return(t==null?void 0:t.animationName)||"none"}function T5(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function P5(t){const s=_5(t),n=v.forwardRef((r,a)=>{const{children:l,...c}=r,d=v.Children.toArray(l),h=d.find(I5);if(h){const x=h.props.children,f=d.map(m=>m===h?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:m);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}function _5(t){const s=v.forwardRef((n,r)=>{const{children:a,...l}=n;if(v.isValidElement(a)){const c=M5(a),d=L5(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var O5=Symbol("radix.slottable");function I5(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===O5}function L5(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const h=l(...d);return a(...d),h}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function M5(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var F5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ps=F5.reduce((t,s)=>{const n=P5(`Primitive.${s}`),r=v.forwardRef((a,l)=>{const{asChild:c,...d}=a,h=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${s}`,{...t,[s]:r}},{});function S2(t,s){t&&cu.flushSync(()=>t.dispatchEvent(s))}var Ym="Checkbox",[B5]=ea(Ym),[$5,Kv]=B5(Ym);function q5(t){const{__scopeCheckbox:s,checked:n,children:r,defaultChecked:a,disabled:l,form:c,name:d,onCheckedChange:h,required:x,value:f="on",internal_do_not_use_render:m}=t,[p,u]=bi({prop:n,defaultProp:a??!1,onChange:h,caller:Ym}),[j,g]=v.useState(null),[y,N]=v.useState(null),S=v.useRef(!1),C=j?!!c||!!j.closest("form"):!0,w={checked:p,disabled:l,setChecked:u,control:j,setControl:g,name:d,form:c,value:f,hasConsumerStoppedPropagationRef:S,required:x,defaultChecked:_l(a)?!1:a,isFormControl:C,bubbleInput:y,setBubbleInput:N};return e.jsx($5,{scope:s,...w,children:z5(m)?m(w):r})}var C2="CheckboxTrigger",A2=v.forwardRef(({__scopeCheckbox:t,onKeyDown:s,onClick:n,...r},a)=>{const{control:l,value:c,disabled:d,checked:h,required:x,setControl:f,setChecked:m,hasConsumerStoppedPropagationRef:p,isFormControl:u,bubbleInput:j}=Kv(C2,t),g=Ms(a,f),y=v.useRef(h);return v.useEffect(()=>{const N=l==null?void 0:l.form;if(N){const S=()=>m(y.current);return N.addEventListener("reset",S),()=>N.removeEventListener("reset",S)}},[l,m]),e.jsx(ps.button,{type:"button",role:"checkbox","aria-checked":_l(h)?"mixed":h,"aria-required":x,"data-state":P2(h),"data-disabled":d?"":void 0,disabled:d,value:c,...r,ref:g,onKeyDown:Vt(s,N=>{N.key==="Enter"&&N.preventDefault()}),onClick:Vt(n,N=>{m(S=>_l(S)?!0:!S),j&&u&&(p.current=N.isPropagationStopped(),p.current||N.stopPropagation())})})});A2.displayName=C2;var k2=v.forwardRef((t,s)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:l,required:c,disabled:d,value:h,onCheckedChange:x,form:f,...m}=t;return e.jsx(q5,{__scopeCheckbox:n,checked:a,defaultChecked:l,disabled:d,required:c,onCheckedChange:x,name:r,form:f,value:h,internal_do_not_use_render:({isFormControl:p})=>e.jsxs(e.Fragment,{children:[e.jsx(A2,{...m,ref:s,__scopeCheckbox:n}),p&&e.jsx(T2,{__scopeCheckbox:n})]})})});k2.displayName=Ym;var R2="CheckboxIndicator",E2=v.forwardRef((t,s)=>{const{__scopeCheckbox:n,forceMount:r,...a}=t,l=Kv(R2,n);return e.jsx(mr,{present:r||_l(l.checked)||l.checked===!0,children:e.jsx(ps.span,{"data-state":P2(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:s,style:{pointerEvents:"none",...t.style}})})});E2.displayName=R2;var D2="CheckboxBubbleInput",T2=v.forwardRef(({__scopeCheckbox:t,...s},n)=>{const{control:r,hasConsumerStoppedPropagationRef:a,checked:l,defaultChecked:c,required:d,disabled:h,name:x,value:f,form:m,bubbleInput:p,setBubbleInput:u}=Kv(D2,t),j=Ms(n,u),g=Wv(l),y=Gv(r);v.useEffect(()=>{const S=p;if(!S)return;const C=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(C,"checked").set,P=!a.current;if(g!==l&&R){const A=new Event("click",{bubbles:P});S.indeterminate=_l(l),R.call(S,_l(l)?!1:l),S.dispatchEvent(A)}},[p,g,l,a]);const N=v.useRef(_l(l)?!1:l);return e.jsx(ps.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??N.current,required:d,disabled:h,name:x,value:f,form:m,...s,tabIndex:-1,ref:j,style:{...s.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});T2.displayName=D2;function z5(t){return typeof t=="function"}function _l(t){return t==="indeterminate"}function P2(t){return _l(t)?"indeterminate":t?"checked":"unchecked"}/** + */const qO="6";try{window.__reactRouterVersion=qO}catch{}const zO="startTransition",sw=Im[zO];function UO(t){let{basename:s,children:n,future:r,window:a}=t,l=v.useRef();l.current==null&&(l.current=G4({window:a,v5Compat:!0}));let c=l.current,[d,m]=v.useState({action:c.action,location:c.location}),{v7_startTransition:x}=r||{},f=v.useCallback(h=>{x&&sw?sw(()=>m(h)):m(h)},[m,x]);return v.useLayoutEffect(()=>c.listen(f),[c,f]),v.useEffect(()=>FO(r),[r]),v.createElement($O,{basename:s,children:n,location:d.location,navigationType:d.action,navigator:c,future:r})}var nw;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(nw||(nw={}));var rw;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(rw||(rw={}));const aw=({children:t,allowedRoles:s,excludeRoles:n,redirectTo:r})=>{const{user:a,isAuthenticated:l,loading:c}=Nn(h=>h.auth),d=Ul(),m=String((a==null?void 0:a.role)||(a==null?void 0:a.roleCode)||"").trim().toLowerCase(),x=(s||[]).map(h=>String(h).trim().toLowerCase()),f=(n||[]).map(h=>String(h).trim().toLowerCase());return c?e.jsx("div",{className:"flex h-screen items-center justify-center",children:"Loading..."}):l?n&&a&&f.includes(m)?m==="prospective dealer"?e.jsx(Mn,{to:"/prospective-dashboard",replace:!0}):e.jsx(Mn,{to:r||"/dashboard",replace:!0}):s&&a&&!x.includes(m)?e.jsx(Mn,{to:r||"/dashboard",replace:!0}):e.jsx(e.Fragment,{children:t}):e.jsx(Mn,{to:"/admin-login",state:{from:d},replace:!0})};function iw(t,s){if(typeof t=="function")return t(s);t!=null&&(t.current=s)}function Br(...t){return s=>{let n=!1;const r=t.map(a=>{const l=iw(a,s);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let a=0;a{let{children:l,...c}=r;b2(l)&&typeof vm=="function"&&(l=vm(l._payload));const d=v.Children.toArray(l),m=d.find(GO);if(m){const x=m.props.children,f=d.map(h=>h===m?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:h);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}var y2=hu("Slot");function WO(t){const s=v.forwardRef((n,r)=>{let{children:a,...l}=n;if(b2(a)&&typeof vm=="function"&&(a=vm(a._payload)),v.isValidElement(a)){const c=ZO(a),d=YO(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var KO=Symbol("radix.slottable");function GO(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===KO}function YO(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const m=l(...d);return a(...d),m}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function ZO(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function j2(t){var s,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(s=0;stypeof t=="boolean"?`${t}`:t===0?"0":t,ow=N2,Kv=(t,s)=>n=>{var r;if((s==null?void 0:s.variants)==null)return ow(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:l}=s,c=Object.keys(a).map(x=>{const f=n==null?void 0:n[x],h=l==null?void 0:l[x];if(f===null)return null;const g=lw(f)||lw(h);return a[x][g]}),d=n&&Object.entries(n).reduce((x,f)=>{let[h,g]=f;return g===void 0||(x[h]=g),x},{}),m=s==null||(r=s.compoundVariants)===null||r===void 0?void 0:r.reduce((x,f)=>{let{class:h,className:g,...u}=f;return Object.entries(u).every(j=>{let[p,y]=j;return Array.isArray(y)?y.includes({...l,...d}[p]):{...l,...d}[p]===y})?[...x,h,g]:x},[]);return ow(t,c,m,n==null?void 0:n.class,n==null?void 0:n.className)},Gv="-",QO=t=>{const s=JO(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:c=>{const d=c.split(Gv);return d[0]===""&&d.length!==1&&d.shift(),w2(d,s)||XO(c)},getConflictingClassGroupIds:(c,d)=>{const m=n[c]||[];return d&&r[c]?[...m,...r[c]]:m}}},w2=(t,s)=>{var c;if(t.length===0)return s.classGroupId;const n=t[0],r=s.nextPart.get(n),a=r?w2(t.slice(1),r):void 0;if(a)return a;if(s.validators.length===0)return;const l=t.join(Gv);return(c=s.validators.find(({validator:d})=>d(l)))==null?void 0:c.classGroupId},cw=/^\[(.+)\]$/,XO=t=>{if(cw.test(t)){const s=cw.exec(t)[1],n=s==null?void 0:s.substring(0,s.indexOf(":"));if(n)return"arbitrary.."+n}},JO=t=>{const{theme:s,prefix:n}=t,r={nextPart:new Map,validators:[]};return t5(Object.entries(t.classGroups),n).forEach(([l,c])=>{sv(c,r,l,s)}),r},sv=(t,s,n,r)=>{t.forEach(a=>{if(typeof a=="string"){const l=a===""?s:dw(s,a);l.classGroupId=n;return}if(typeof a=="function"){if(e5(a)){sv(a(r),s,n,r);return}s.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([l,c])=>{sv(c,dw(s,l),n,r)})})},dw=(t,s)=>{let n=t;return s.split(Gv).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},e5=t=>t.isThemeGetter,t5=(t,s)=>s?t.map(([n,r])=>{const a=r.map(l=>typeof l=="string"?s+l:typeof l=="object"?Object.fromEntries(Object.entries(l).map(([c,d])=>[s+c,d])):l);return[n,a]}):t,s5=t=>{if(t<1)return{get:()=>{},set:()=>{}};let s=0,n=new Map,r=new Map;const a=(l,c)=>{n.set(l,c),s++,s>t&&(s=0,r=n,n=new Map)};return{get(l){let c=n.get(l);if(c!==void 0)return c;if((c=r.get(l))!==void 0)return a(l,c),c},set(l,c){n.has(l)?n.set(l,c):a(l,c)}}},S2="!",n5=t=>{const{separator:s,experimentalParseClassName:n}=t,r=s.length===1,a=s[0],l=s.length,c=d=>{const m=[];let x=0,f=0,h;for(let y=0;yf?h-f:void 0;return{modifiers:m,hasImportantModifier:u,baseClassName:j,maybePostfixModifierPosition:p}};return n?d=>n({className:d,parseClassName:c}):c},r5=t=>{if(t.length<=1)return t;const s=[];let n=[];return t.forEach(r=>{r[0]==="["?(s.push(...n.sort(),r),n=[]):n.push(r)}),s.push(...n.sort()),s},a5=t=>({cache:s5(t.cacheSize),parseClassName:n5(t),...QO(t)}),i5=/\s+/,l5=(t,s)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=s,l=[],c=t.trim().split(i5);let d="";for(let m=c.length-1;m>=0;m-=1){const x=c[m],{modifiers:f,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:u}=n(x);let j=!!u,p=r(j?g.substring(0,u):g);if(!p){if(!j){d=x+(d.length>0?" "+d:d);continue}if(p=r(g),!p){d=x+(d.length>0?" "+d:d);continue}j=!1}const y=r5(f).join(":"),N=h?y+S2:y,S=N+p;if(l.includes(S))continue;l.push(S);const A=a(p,j);for(let w=0;w0?" "+d:d)}return d};function o5(){let t=0,s,n,r="";for(;t{if(typeof t=="string")return t;let s,n="";for(let r=0;rh(f),t());return n=a5(x),r=n.cache.get,a=n.cache.set,l=d,d(m)}function d(m){const x=r(m);if(x)return x;const f=l5(m,n);return a(m,f),f}return function(){return l(o5.apply(null,arguments))}}const jn=t=>{const s=n=>n[t]||[];return s.isThemeGetter=!0,s},A2=/^\[(?:([a-z-]+):)?(.+)\]$/i,d5=/^\d+\/\d+$/,u5=new Set(["px","full","screen"]),h5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,m5=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,f5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,p5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,x5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qi=t=>wc(t)||u5.has(t)||d5.test(t),Al=t=>$c(t,"length",S5),wc=t=>!!t&&!Number.isNaN(Number(t)),kx=t=>$c(t,"number",wc),yd=t=>!!t&&Number.isInteger(Number(t)),g5=t=>t.endsWith("%")&&wc(t.slice(0,-1)),$s=t=>A2.test(t),kl=t=>h5.test(t),v5=new Set(["length","size","percentage"]),b5=t=>$c(t,v5,k2),y5=t=>$c(t,"position",k2),j5=new Set(["image","url"]),N5=t=>$c(t,j5,A5),w5=t=>$c(t,"",C5),jd=()=>!0,$c=(t,s,n)=>{const r=A2.exec(t);return r?r[1]?typeof s=="string"?r[1]===s:s.has(r[1]):n(r[2]):!1},S5=t=>m5.test(t)&&!f5.test(t),k2=()=>!1,C5=t=>p5.test(t),A5=t=>x5.test(t),k5=()=>{const t=jn("colors"),s=jn("spacing"),n=jn("blur"),r=jn("brightness"),a=jn("borderColor"),l=jn("borderRadius"),c=jn("borderSpacing"),d=jn("borderWidth"),m=jn("contrast"),x=jn("grayscale"),f=jn("hueRotate"),h=jn("invert"),g=jn("gap"),u=jn("gradientColorStops"),j=jn("gradientColorStopPositions"),p=jn("inset"),y=jn("margin"),N=jn("opacity"),S=jn("padding"),A=jn("saturate"),w=jn("scale"),E=jn("sepia"),T=jn("skew"),C=jn("space"),L=jn("translate"),$=()=>["auto","contain","none"],_=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto",$s,s],P=()=>[$s,s],M=()=>["",qi,Al],q=()=>["auto",wc,$s],K=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Z=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],U=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",$s],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>[wc,$s];return{cacheSize:500,separator:":",theme:{colors:[jd],spacing:[qi,Al],blur:["none","",kl,$s],brightness:D(),borderColor:[t],borderRadius:["none","","full",kl,$s],borderSpacing:P(),borderWidth:M(),contrast:D(),grayscale:F(),hueRotate:D(),invert:F(),gap:P(),gradientColorStops:[t],gradientColorStopPositions:[g5,Al],inset:R(),margin:R(),opacity:D(),padding:P(),saturate:D(),scale:D(),sepia:F(),skew:D(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",$s]}],container:["container"],columns:[{columns:[kl]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...K(),$s]}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",yd,$s]}],basis:[{basis:R()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",$s]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",yd,$s]}],"grid-cols":[{"grid-cols":[jd]}],"col-start-end":[{col:["auto",{span:["full",yd,$s]},$s]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[jd]}],"row-start-end":[{row:["auto",{span:[yd,$s]},$s]}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",$s]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",$s]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...U()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...U(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...U(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[S]}],px:[{px:[S]}],py:[{py:[S]}],ps:[{ps:[S]}],pe:[{pe:[S]}],pt:[{pt:[S]}],pr:[{pr:[S]}],pb:[{pb:[S]}],pl:[{pl:[S]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",$s,s]}],"min-w":[{"min-w":[$s,s,"min","max","fit"]}],"max-w":[{"max-w":[$s,s,"none","full","min","max","fit","prose",{screen:[kl]},kl]}],h:[{h:[$s,s,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[$s,s,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[$s,s,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[$s,s,"auto","min","max","fit"]}],"font-size":[{text:["base",kl,Al]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",kx]}],"font-family":[{font:[jd]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",$s]}],"line-clamp":[{"line-clamp":["none",wc,kx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",qi,$s]}],"list-image":[{"list-image":["none",$s]}],"list-style-type":[{list:["none","disc","decimal",$s]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[N]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[N]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",qi,Al]}],"underline-offset":[{"underline-offset":["auto",qi,$s]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$s]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",$s]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[N]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...K(),y5]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",b5]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},N5]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[j]}],"gradient-via-pos":[{via:[j]}],"gradient-to-pos":[{to:[j]}],"gradient-from":[{from:[u]}],"gradient-via":[{via:[u]}],"gradient-to":[{to:[u]}],rounded:[{rounded:[l]}],"rounded-s":[{"rounded-s":[l]}],"rounded-e":[{"rounded-e":[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-ss":[{"rounded-ss":[l]}],"rounded-se":[{"rounded-se":[l]}],"rounded-ee":[{"rounded-ee":[l]}],"rounded-es":[{"rounded-es":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"border-w":[{border:[d]}],"border-w-x":[{"border-x":[d]}],"border-w-y":[{"border-y":[d]}],"border-w-s":[{"border-s":[d]}],"border-w-e":[{"border-e":[d]}],"border-w-t":[{"border-t":[d]}],"border-w-r":[{"border-r":[d]}],"border-w-b":[{"border-b":[d]}],"border-w-l":[{"border-l":[d]}],"border-opacity":[{"border-opacity":[N]}],"border-style":[{border:[...Z(),"hidden"]}],"divide-x":[{"divide-x":[d]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[d]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[N]}],"divide-style":[{divide:Z()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...Z()]}],"outline-offset":[{"outline-offset":[qi,$s]}],"outline-w":[{outline:[qi,Al]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[N]}],"ring-offset-w":[{"ring-offset":[qi,Al]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",kl,w5]}],"shadow-color":[{shadow:[jd]}],opacity:[{opacity:[N]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",kl,$s]}],grayscale:[{grayscale:[x]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[h]}],saturate:[{saturate:[A]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[x]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[N]}],"backdrop-saturate":[{"backdrop-saturate":[A]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",$s]}],duration:[{duration:D()}],ease:[{ease:["linear","in","out","in-out",$s]}],delay:[{delay:D()}],animate:[{animate:["none","spin","ping","pulse","bounce",$s]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[yd,$s]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",$s]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",$s]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",$s]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[qi,Al,kx]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},R5=c5(k5);function _t(...t){return R5(N2(t))}function Ht(t,s="full"){const n=new Date(t),r={day:"2-digit",month:"short",year:"numeric"};return(s==="full"||s==="time")&&(r.hour="2-digit",r.minute="2-digit",r.hour12=!0),s==="time"?n.toLocaleTimeString("en-IN",{hour:"2-digit",minute:"2-digit",hour12:!0}):s==="full"?n.toLocaleString("en-IN",r):n.toLocaleDateString("en-IN",r)}const Zm=Kv("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9 rounded-md"}},defaultVariants:{variant:"default",size:"default"}}),se=v.forwardRef(({className:t,variant:s,size:n,asChild:r=!1,...a},l)=>{const c=r?y2:"button";return e.jsx(c,{"data-slot":"button",className:_t(Zm({variant:s,size:n,className:t})),ref:l,...a})});se.displayName="Button";const ot=v.forwardRef(({className:t,type:s,...n},r)=>e.jsx("input",{type:s,ref:r,"data-slot":"input",className:_t("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base bg-input-background transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...n}));ot.displayName="Input";function Fs({className:t,...s}){return e.jsx("textarea",{"data-slot":"textarea",className:_t("resize-none border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-input-background px-3 py-2 text-base transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...s})}function E5(t,s){const n=v.createContext(s),r=l=>{const{children:c,...d}=l,m=v.useMemo(()=>d,Object.values(d));return e.jsx(n.Provider,{value:m,children:c})};r.displayName=t+"Provider";function a(l){const c=v.useContext(n);if(c)return c;if(s!==void 0)return s;throw new Error(`\`${l}\` must be used within \`${t}\``)}return[r,a]}function ea(t,s=[]){let n=[];function r(l,c){const d=v.createContext(c),m=n.length;n=[...n,c];const x=h=>{var N;const{scope:g,children:u,...j}=h,p=((N=g==null?void 0:g[t])==null?void 0:N[m])||d,y=v.useMemo(()=>j,Object.values(j));return e.jsx(p.Provider,{value:y,children:u})};x.displayName=l+"Provider";function f(h,g){var p;const u=((p=g==null?void 0:g[t])==null?void 0:p[m])||d,j=v.useContext(u);if(j)return j;if(c!==void 0)return c;throw new Error(`\`${h}\` must be used within \`${l}\``)}return[x,f]}const a=()=>{const l=n.map(c=>v.createContext(c));return function(d){const m=(d==null?void 0:d[t])||l;return v.useMemo(()=>({[`__scope${t}`]:{...d,[t]:m}}),[d,m])}};return a.scopeName=t,[r,D5(a,...s)]}function D5(...t){const s=t[0];if(t.length===1)return s;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const c=r.reduce((d,{useScope:m,scopeName:x})=>{const h=m(l)[`__scope${x}`];return{...d,...h}},{});return v.useMemo(()=>({[`__scope${s.scopeName}`]:c}),[c])}};return n.scopeName=s.scopeName,n}function Vt(t,s,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return s==null?void 0:s(a)}}var Zn=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},T5=Im[" useInsertionEffect ".trim().toString()]||Zn;function bi({prop:t,defaultProp:s,onChange:n=()=>{},caller:r}){const[a,l,c]=_5({defaultProp:s,onChange:n}),d=t!==void 0,m=d?t:a;{const f=v.useRef(t!==void 0);v.useEffect(()=>{const h=f.current;h!==d&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=d},[d,r])}const x=v.useCallback(f=>{var h;if(d){const g=P5(f)?f(t):f;g!==t&&((h=c.current)==null||h.call(c,g))}else l(f)},[d,t,l,c]);return[m,x]}function _5({defaultProp:t,onChange:s}){const[n,r]=v.useState(t),a=v.useRef(n),l=v.useRef(s);return T5(()=>{l.current=s},[s]),v.useEffect(()=>{var c;a.current!==n&&((c=l.current)==null||c.call(l,n),a.current=n)},[n,a]),[n,r,l]}function P5(t){return typeof t=="function"}function Yv(t){const s=v.useRef({value:t,previous:t});return v.useMemo(()=>(s.current.value!==t&&(s.current.previous=s.current.value,s.current.value=t),s.current.previous),[t])}function Zv(t){const[s,n]=v.useState(void 0);return Zn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const l=a[0];let c,d;if("borderBoxSize"in l){const m=l.borderBoxSize,x=Array.isArray(m)?m[0]:m;c=x.inlineSize,d=x.blockSize}else c=t.offsetWidth,d=t.offsetHeight;n({width:c,height:d})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),s}function O5(t,s){return v.useReducer((n,r)=>s[n][r]??n,t)}var mr=t=>{const{present:s,children:n}=t,r=L5(s),a=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),l=Ms(r.ref,I5(a));return typeof n=="function"||r.isPresent?v.cloneElement(a,{ref:l}):null};mr.displayName="Presence";function L5(t){const[s,n]=v.useState(),r=v.useRef(null),a=v.useRef(t),l=v.useRef("none"),c=t?"mounted":"unmounted",[d,m]=O5(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const x=Ah(r.current);l.current=d==="mounted"?x:"none"},[d]),Zn(()=>{const x=r.current,f=a.current;if(f!==t){const g=l.current,u=Ah(x);t?m("MOUNT"):u==="none"||(x==null?void 0:x.display)==="none"?m("UNMOUNT"):m(f&&g!==u?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,m]),Zn(()=>{if(s){let x;const f=s.ownerDocument.defaultView??window,h=u=>{const p=Ah(r.current).includes(CSS.escape(u.animationName));if(u.target===s&&p&&(m("ANIMATION_END"),!a.current)){const y=s.style.animationFillMode;s.style.animationFillMode="forwards",x=f.setTimeout(()=>{s.style.animationFillMode==="forwards"&&(s.style.animationFillMode=y)})}},g=u=>{u.target===s&&(l.current=Ah(r.current))};return s.addEventListener("animationstart",g),s.addEventListener("animationcancel",h),s.addEventListener("animationend",h),()=>{f.clearTimeout(x),s.removeEventListener("animationstart",g),s.removeEventListener("animationcancel",h),s.removeEventListener("animationend",h)}}else m("ANIMATION_END")},[s,m]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:v.useCallback(x=>{r.current=x?getComputedStyle(x):null,n(x)},[])}}function Ah(t){return(t==null?void 0:t.animationName)||"none"}function I5(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function M5(t){const s=F5(t),n=v.forwardRef((r,a)=>{const{children:l,...c}=r,d=v.Children.toArray(l),m=d.find($5);if(m){const x=m.props.children,f=d.map(h=>h===m?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:h);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}function F5(t){const s=v.forwardRef((n,r)=>{const{children:a,...l}=n;if(v.isValidElement(a)){const c=z5(a),d=q5(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var B5=Symbol("radix.slottable");function $5(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===B5}function q5(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const m=l(...d);return a(...d),m}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function z5(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var U5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ps=U5.reduce((t,s)=>{const n=M5(`Primitive.${s}`),r=v.forwardRef((a,l)=>{const{asChild:c,...d}=a,m=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(m,{...d,ref:l})});return r.displayName=`Primitive.${s}`,{...t,[s]:r}},{});function R2(t,s){t&&cu.flushSync(()=>t.dispatchEvent(s))}var Qm="Checkbox",[V5]=ea(Qm),[H5,Qv]=V5(Qm);function W5(t){const{__scopeCheckbox:s,checked:n,children:r,defaultChecked:a,disabled:l,form:c,name:d,onCheckedChange:m,required:x,value:f="on",internal_do_not_use_render:h}=t,[g,u]=bi({prop:n,defaultProp:a??!1,onChange:m,caller:Qm}),[j,p]=v.useState(null),[y,N]=v.useState(null),S=v.useRef(!1),A=j?!!c||!!j.closest("form"):!0,w={checked:g,disabled:l,setChecked:u,control:j,setControl:p,name:d,form:c,value:f,hasConsumerStoppedPropagationRef:S,required:x,defaultChecked:Pl(a)?!1:a,isFormControl:A,bubbleInput:y,setBubbleInput:N};return e.jsx(H5,{scope:s,...w,children:K5(h)?h(w):r})}var E2="CheckboxTrigger",D2=v.forwardRef(({__scopeCheckbox:t,onKeyDown:s,onClick:n,...r},a)=>{const{control:l,value:c,disabled:d,checked:m,required:x,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:g,isFormControl:u,bubbleInput:j}=Qv(E2,t),p=Ms(a,f),y=v.useRef(m);return v.useEffect(()=>{const N=l==null?void 0:l.form;if(N){const S=()=>h(y.current);return N.addEventListener("reset",S),()=>N.removeEventListener("reset",S)}},[l,h]),e.jsx(ps.button,{type:"button",role:"checkbox","aria-checked":Pl(m)?"mixed":m,"aria-required":x,"data-state":I2(m),"data-disabled":d?"":void 0,disabled:d,value:c,...r,ref:p,onKeyDown:Vt(s,N=>{N.key==="Enter"&&N.preventDefault()}),onClick:Vt(n,N=>{h(S=>Pl(S)?!0:!S),j&&u&&(g.current=N.isPropagationStopped(),g.current||N.stopPropagation())})})});D2.displayName=E2;var T2=v.forwardRef((t,s)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:l,required:c,disabled:d,value:m,onCheckedChange:x,form:f,...h}=t;return e.jsx(W5,{__scopeCheckbox:n,checked:a,defaultChecked:l,disabled:d,required:c,onCheckedChange:x,name:r,form:f,value:m,internal_do_not_use_render:({isFormControl:g})=>e.jsxs(e.Fragment,{children:[e.jsx(D2,{...h,ref:s,__scopeCheckbox:n}),g&&e.jsx(L2,{__scopeCheckbox:n})]})})});T2.displayName=Qm;var _2="CheckboxIndicator",P2=v.forwardRef((t,s)=>{const{__scopeCheckbox:n,forceMount:r,...a}=t,l=Qv(_2,n);return e.jsx(mr,{present:r||Pl(l.checked)||l.checked===!0,children:e.jsx(ps.span,{"data-state":I2(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:s,style:{pointerEvents:"none",...t.style}})})});P2.displayName=_2;var O2="CheckboxBubbleInput",L2=v.forwardRef(({__scopeCheckbox:t,...s},n)=>{const{control:r,hasConsumerStoppedPropagationRef:a,checked:l,defaultChecked:c,required:d,disabled:m,name:x,value:f,form:h,bubbleInput:g,setBubbleInput:u}=Qv(O2,t),j=Ms(n,u),p=Yv(l),y=Zv(r);v.useEffect(()=>{const S=g;if(!S)return;const A=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(A,"checked").set,T=!a.current;if(p!==l&&E){const C=new Event("click",{bubbles:T});S.indeterminate=Pl(l),E.call(S,Pl(l)?!1:l),S.dispatchEvent(C)}},[g,p,l,a]);const N=v.useRef(Pl(l)?!1:l);return e.jsx(ps.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??N.current,required:d,disabled:m,name:x,value:f,form:h,...s,tabIndex:-1,ref:j,style:{...s.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});L2.displayName=O2;function K5(t){return typeof t=="function"}function Pl(t){return t==="indeterminate"}function I2(t){return Pl(t)?"indeterminate":t?"checked":"unchecked"}/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var U5={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var G5={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const V5=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),ft=(t,s)=>{const n=v.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:d="",children:h,...x},f)=>v.createElement("svg",{ref:f,...U5,width:a,height:a,stroke:r,strokeWidth:c?Number(l)*24/Number(a):l,className:["lucide",`lucide-${V5(t)}`,d].join(" "),...x},[...s.map(([m,p])=>v.createElement(m,p)),...Array.isArray(h)?h:[h]]));return n.displayName=`${t}`,n};/** + */const Y5=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),ft=(t,s)=>{const n=v.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:d="",children:m,...x},f)=>v.createElement("svg",{ref:f,...G5,width:a,height:a,stroke:r,strokeWidth:c?Number(l)*24/Number(a):l,className:["lucide",`lucide-${Y5(t)}`,d].join(" "),...x},[...s.map(([h,g])=>v.createElement(h,g)),...Array.isArray(m)?m:[m]]));return n.displayName=`${t}`,n};/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const H5=ft("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);/** + */const Z5=ft("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ks=ft("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + */const Gs=ft("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -122,22 +122,22 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const W5=ft("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** + */const Q5=ft("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _2=ft("Award",[["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}],["path",{d:"M15.477 12.89 17 22l-5-3-5 3 1.523-9.11",key:"em7aur"}]]);/** + */const M2=ft("Award",[["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}],["path",{d:"M15.477 12.89 17 22l-5-3-5 3 1.523-9.11",key:"em7aur"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Yv=ft("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/** + */const Xv=ft("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const G5=ft("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/** + */const X5=ft("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -147,7 +147,7 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ow=ft("Bike",[["circle",{cx:"18.5",cy:"17.5",r:"3.5",key:"15x4ox"}],["circle",{cx:"5.5",cy:"17.5",r:"3.5",key:"1noe27"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["path",{d:"M12 17.5V14l-3-3 4-3 2 3h2",key:"1npguv"}]]);/** + */const uw=ft("Bike",[["circle",{cx:"18.5",cy:"17.5",r:"3.5",key:"15x4ox"}],["circle",{cx:"5.5",cy:"17.5",r:"3.5",key:"1noe27"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["path",{d:"M12 17.5V14l-3-3 4-3 2 3h2",key:"1npguv"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -162,7 +162,7 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const O2=ft("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** + */const F2=ft("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -182,7 +182,7 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const K5=ft("CheckSquare",[["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}],["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11",key:"1jnkn4"}]]);/** + */const J5=ft("CheckSquare",[["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}],["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11",key:"1jnkn4"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -212,12 +212,12 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Y5=ft("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** + */const eL=ft("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Z5=ft("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/** + */const tL=ft("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -232,7 +232,7 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cw=ft("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + */const hw=ft("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -242,7 +242,7 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ev=ft("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** + */const nv=ft("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -252,7 +252,7 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Q5=ft("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** + */const sL=ft("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -262,12 +262,12 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _d=ft("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);/** + */const Pd=ft("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const X5=ft("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** + */const nL=ft("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -277,32 +277,32 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const J5=ft("FileX",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);/** + */const rL=ft("FileX",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vm=ft("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** + */const bm=ft("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const I2=ft("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + */const B2=ft("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const eI=ft("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** + */const aL=ft("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tI=ft("Gavel",[["path",{d:"m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8",key:"15492f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m9 7 8 8",key:"5jnvq1"}],["path",{d:"m21 11-8-8",key:"z4y7zo"}]]);/** + */const iL=ft("Gavel",[["path",{d:"m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8",key:"15492f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m9 7 8 8",key:"5jnvq1"}],["path",{d:"m21 11-8-8",key:"z4y7zo"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tv=ft("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** + */const rv=ft("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -312,27 +312,27 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sI=ft("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/** + */const lL=ft("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const L2=ft("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** + */const $2=ft("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const M2=ft("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const q2=ft("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dw=ft("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + */const mw=ft("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nI=ft("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** + */const oL=ft("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -347,12 +347,12 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const F2=ft("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/** + */const z2=ft("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rI=ft("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + */const cL=ft("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -362,12 +362,12 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aI=ft("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** + */const dL=ft("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const B2=ft("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/** + */const U2=ft("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -377,17 +377,17 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sv=ft("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** + */const av=ft("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const iI=ft("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** + */const uL=ft("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $2=ft("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + */const V2=ft("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -407,12 +407,12 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lI=ft("MoreHorizontal",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** + */const hL=ft("MoreHorizontal",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const q2=ft("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/** + */const H2=ft("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -422,7 +422,7 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uw=ft("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/** + */const fw=ft("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -432,17 +432,17 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nv=ft("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + */const iv=ft("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Zv=ft("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** + */const Jv=ft("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ax=ft("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/** + */const Rx=ft("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -452,12 +452,12 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rv=ft("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/** + */const lv=ft("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ki=ft("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** + */const Gi=ft("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -467,12 +467,12 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const oI=ft("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** + */const mL=ft("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Qv=ft("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + */const eb=ft("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -492,7 +492,7 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Zm=ft("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** + */const Xm=ft("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -502,7 +502,7 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Xv=ft("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** + */const tb=ft("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -517,42 +517,42 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cI=ft("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** + */const fL=ft("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dI=ft("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** + */const pL=ft("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uI=ft("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** + */const xL=ft("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hI=ft("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** + */const gL=ft("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mI=ft("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/** + */const vL=ft("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fI=ft("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2v0a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12v0a2 2 0 0 1-2-2V7",key:"jon5kx"}]]);/** + */const bL=ft("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2v0a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12v0a2 2 0 0 1-2-2V7",key:"jon5kx"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Gn=ft("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + */const Kn=ft("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Po=ft("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/** + */const _o=ft("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -562,12 +562,12 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pI=ft("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** + */const yL=ft("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xI=ft("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5v0a5.5 5.5 0 0 1-5.5 5.5H11",key:"llx8ln"}]]);/** + */const jL=ft("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5v0a5.5 5.5 0 0 1-5.5 5.5H11",key:"llx8ln"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -577,27 +577,27 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gI=ft("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** + */const NL=ft("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vI=ft("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** + */const wL=ft("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kx=ft("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** + */const Ex=ft("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Jv=ft("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** + */const sb=ft("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Rx=ft("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/** + */const Dx=ft("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -612,7 +612,7 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bm=ft("Wallet",[["path",{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",key:"195gfw"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",key:"195n9w"}],["path",{d:"M18 12a2 2 0 0 0 0 4h4v-4Z",key:"vllfpd"}]]);/** + */const ym=ft("Wallet",[["path",{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",key:"195gfw"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",key:"195n9w"}],["path",{d:"M18 12a2 2 0 0 0 0 4h4v-4Z",key:"vllfpd"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. @@ -627,10 +627,10 @@ Error generating stack: `+H.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hw=ft("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]);function Rn({className:t,...s}){return e.jsx(k2,{"data-slot":"checkbox",className:Pt("peer border bg-input-background dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(E2,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:e.jsx(Bn,{className:"size-3.5"})})})}var bI=t=>{switch(t){case"success":return NI;case"info":return SI;case"warning":return wI;case"error":return CI;default:return null}},yI=Array(12).fill(0),jI=({visible:t,className:s})=>gt.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":t},gt.createElement("div",{className:"sonner-spinner"},yI.map((n,r)=>gt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),NI=gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},gt.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),wI=gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},gt.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),SI=gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},gt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),CI=gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},gt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),AI=gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},gt.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),gt.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),kI=()=>{let[t,s]=gt.useState(document.hidden);return gt.useEffect(()=>{let n=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},av=1,RI=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let s=this.subscribers.indexOf(t);this.subscribers.splice(s,1)}),this.publish=t=>{this.subscribers.forEach(s=>s(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var s;let{message:n,...r}=t,a=typeof(t==null?void 0:t.id)=="number"||((s=t.id)==null?void 0:s.length)>0?t.id:av++,l=this.toasts.find(d=>d.id===a),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),l?this.toasts=this.toasts.map(d=>d.id===a?(this.publish({...d,...t,id:a,title:n}),{...d,...t,id:a,dismissible:c,title:n}):d):this.addToast({title:n,...r,dismissible:c,id:a}),a},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(s=>{this.subscribers.forEach(n=>n({id:s.id,dismiss:!0}))}),this.subscribers.forEach(s=>s({id:t,dismiss:!0})),t),this.message=(t,s)=>this.create({...s,message:t}),this.error=(t,s)=>this.create({...s,message:t,type:"error"}),this.success=(t,s)=>this.create({...s,type:"success",message:t}),this.info=(t,s)=>this.create({...s,type:"info",message:t}),this.warning=(t,s)=>this.create({...s,type:"warning",message:t}),this.loading=(t,s)=>this.create({...s,type:"loading",message:t}),this.promise=(t,s)=>{if(!s)return;let n;s.loading!==void 0&&(n=this.create({...s,promise:t,type:"loading",message:s.loading,description:typeof s.description!="function"?s.description:void 0}));let r=t instanceof Promise?t:t(),a=n!==void 0,l,c=r.then(async h=>{if(l=["resolve",h],gt.isValidElement(h))a=!1,this.create({id:n,type:"default",message:h});else if(DI(h)&&!h.ok){a=!1;let x=typeof s.error=="function"?await s.error(`HTTP error! status: ${h.status}`):s.error,f=typeof s.description=="function"?await s.description(`HTTP error! status: ${h.status}`):s.description;this.create({id:n,type:"error",message:x,description:f})}else if(s.success!==void 0){a=!1;let x=typeof s.success=="function"?await s.success(h):s.success,f=typeof s.description=="function"?await s.description(h):s.description;this.create({id:n,type:"success",message:x,description:f})}}).catch(async h=>{if(l=["reject",h],s.error!==void 0){a=!1;let x=typeof s.error=="function"?await s.error(h):s.error,f=typeof s.description=="function"?await s.description(h):s.description;this.create({id:n,type:"error",message:x,description:f})}}).finally(()=>{var h;a&&(this.dismiss(n),n=void 0),(h=s.finally)==null||h.call(s)}),d=()=>new Promise((h,x)=>c.then(()=>l[0]==="reject"?x(l[1]):h(l[1])).catch(x));return typeof n!="string"&&typeof n!="number"?{unwrap:d}:Object.assign(n,{unwrap:d})},this.custom=(t,s)=>{let n=(s==null?void 0:s.id)||av++;return this.create({jsx:t(n),id:n,...s}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Qr=new RI,EI=(t,s)=>{let n=(s==null?void 0:s.id)||av++;return Qr.addToast({title:t,...s,id:n}),n},DI=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",TI=EI,PI=()=>Qr.toasts,_I=()=>Qr.getActiveToasts(),ee=Object.assign(TI,{success:Qr.success,info:Qr.info,warning:Qr.warning,error:Qr.error,custom:Qr.custom,message:Qr.message,promise:Qr.promise,dismiss:Qr.dismiss,loading:Qr.loading},{getHistory:PI,getToasts:_I});function OI(t,{insertAt:s}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",s==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}OI(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} -`);function Rh(t){return t.label!==void 0}var II=3,LI="32px",MI="16px",mw=4e3,FI=356,BI=14,$I=20,qI=200;function Va(...t){return t.filter(Boolean).join(" ")}function zI(t){let[s,n]=t.split("-"),r=[];return s&&r.push(s),n&&r.push(n),r}var UI=t=>{var s,n,r,a,l,c,d,h,x,f,m;let{invert:p,toast:u,unstyled:j,interacting:g,setHeights:y,visibleToasts:N,heights:S,index:C,toasts:w,expanded:R,removeToast:P,defaultRichColors:A,closeButton:I,style:$,cancelButtonStyle:T,actionButtonStyle:E,className:_="",descriptionClassName:M="",duration:q,position:G,gap:Z,loadingIcon:W,expandByDefault:z,classNames:F,icons:B,closeButtonAriaLabel:D="Close toast",pauseWhenPageIsHidden:O}=t,[V,K]=gt.useState(null),[Y,U]=gt.useState(null),[X,ne]=gt.useState(!1),[oe,re]=gt.useState(!1),[ge,ve]=gt.useState(!1),[Se,We]=gt.useState(!1),[Ce,fe]=gt.useState(!1),[Ye,be]=gt.useState(0),[_e,ke]=gt.useState(0),qe=gt.useRef(u.duration||q||mw),Ve=gt.useRef(null),dt=gt.useRef(null),xt=C===0,ye=C+1<=N,le=u.type,Qe=u.dismissible!==!1,rt=u.className||"",Kt=u.descriptionClassName||"",Rt=gt.useMemo(()=>S.findIndex(Ee=>Ee.toastId===u.id)||0,[S,u.id]),Re=gt.useMemo(()=>{var Ee;return(Ee=u.closeButton)!=null?Ee:I},[u.closeButton,I]),Qt=gt.useMemo(()=>u.duration||q||mw,[u.duration,q]),qt=gt.useRef(0),ws=gt.useRef(0),_s=gt.useRef(0),ns=gt.useRef(null),[Cs,Bs]=G.split("-"),Ft=gt.useMemo(()=>S.reduce((Ee,it,st)=>st>=Rt?Ee:Ee+it.height,0),[S,Rt]),ie=kI(),Fe=u.invert||p,Q=le==="loading";ws.current=gt.useMemo(()=>Rt*Z+Ft,[Rt,Ft]),gt.useEffect(()=>{qe.current=Qt},[Qt]),gt.useEffect(()=>{ne(!0)},[]),gt.useEffect(()=>{let Ee=dt.current;if(Ee){let it=Ee.getBoundingClientRect().height;return ke(it),y(st=>[{toastId:u.id,height:it,position:u.position},...st]),()=>y(st=>st.filter(bt=>bt.toastId!==u.id))}},[y,u.id]),gt.useLayoutEffect(()=>{if(!X)return;let Ee=dt.current,it=Ee.style.height;Ee.style.height="auto";let st=Ee.getBoundingClientRect().height;Ee.style.height=it,ke(st),y(bt=>bt.find(Ue=>Ue.toastId===u.id)?bt.map(Ue=>Ue.toastId===u.id?{...Ue,height:st}:Ue):[{toastId:u.id,height:st,position:u.position},...bt])},[X,u.title,u.description,y,u.id]);let pe=gt.useCallback(()=>{re(!0),be(ws.current),y(Ee=>Ee.filter(it=>it.toastId!==u.id)),setTimeout(()=>{P(u)},qI)},[u,P,y,ws]);gt.useEffect(()=>{if(u.promise&&le==="loading"||u.duration===1/0||u.type==="loading")return;let Ee;return R||g||O&&ie?(()=>{if(_s.current{var it;(it=u.onAutoClose)==null||it.call(u,u),pe()},qe.current)),()=>clearTimeout(Ee)},[R,g,u,le,O,ie,pe]),gt.useEffect(()=>{u.delete&&pe()},[pe,u.delete]);function Ne(){var Ee,it,st;return B!=null&&B.loading?gt.createElement("div",{className:Va(F==null?void 0:F.loader,(Ee=u==null?void 0:u.classNames)==null?void 0:Ee.loader,"sonner-loader"),"data-visible":le==="loading"},B.loading):W?gt.createElement("div",{className:Va(F==null?void 0:F.loader,(it=u==null?void 0:u.classNames)==null?void 0:it.loader,"sonner-loader"),"data-visible":le==="loading"},W):gt.createElement(jI,{className:Va(F==null?void 0:F.loader,(st=u==null?void 0:u.classNames)==null?void 0:st.loader),visible:le==="loading"})}return gt.createElement("li",{tabIndex:0,ref:dt,className:Va(_,rt,F==null?void 0:F.toast,(s=u==null?void 0:u.classNames)==null?void 0:s.toast,F==null?void 0:F.default,F==null?void 0:F[le],(n=u==null?void 0:u.classNames)==null?void 0:n[le]),"data-sonner-toast":"","data-rich-colors":(r=u.richColors)!=null?r:A,"data-styled":!(u.jsx||u.unstyled||j),"data-mounted":X,"data-promise":!!u.promise,"data-swiped":Ce,"data-removed":oe,"data-visible":ye,"data-y-position":Cs,"data-x-position":Bs,"data-index":C,"data-front":xt,"data-swiping":ge,"data-dismissible":Qe,"data-type":le,"data-invert":Fe,"data-swipe-out":Se,"data-swipe-direction":Y,"data-expanded":!!(R||z&&X),style:{"--index":C,"--toasts-before":C,"--z-index":w.length-C,"--offset":`${oe?Ye:ws.current}px`,"--initial-height":z?"auto":`${_e}px`,...$,...u.style},onDragEnd:()=>{ve(!1),K(null),ns.current=null},onPointerDown:Ee=>{Q||!Qe||(Ve.current=new Date,be(ws.current),Ee.target.setPointerCapture(Ee.pointerId),Ee.target.tagName!=="BUTTON"&&(ve(!0),ns.current={x:Ee.clientX,y:Ee.clientY}))},onPointerUp:()=>{var Ee,it,st,bt;if(Se||!Qe)return;ns.current=null;let Ue=Number(((Ee=dt.current)==null?void 0:Ee.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Lt=Number(((it=dt.current)==null?void 0:it.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ut=new Date().getTime()-((st=Ve.current)==null?void 0:st.getTime()),yt=V==="x"?Ue:Lt,kt=Math.abs(yt)/ut;if(Math.abs(yt)>=$I||kt>.11){be(ws.current),(bt=u.onDismiss)==null||bt.call(u,u),U(V==="x"?Ue>0?"right":"left":Lt>0?"down":"up"),pe(),We(!0),fe(!1);return}ve(!1),K(null)},onPointerMove:Ee=>{var it,st,bt,Ue;if(!ns.current||!Qe||((it=window.getSelection())==null?void 0:it.toString().length)>0)return;let Lt=Ee.clientY-ns.current.y,ut=Ee.clientX-ns.current.x,yt=(st=t.swipeDirections)!=null?st:zI(G);!V&&(Math.abs(ut)>1||Math.abs(Lt)>1)&&K(Math.abs(ut)>Math.abs(Lt)?"x":"y");let kt={x:0,y:0};V==="y"?(yt.includes("top")||yt.includes("bottom"))&&(yt.includes("top")&&Lt<0||yt.includes("bottom")&&Lt>0)&&(kt.y=Lt):V==="x"&&(yt.includes("left")||yt.includes("right"))&&(yt.includes("left")&&ut<0||yt.includes("right")&&ut>0)&&(kt.x=ut),(Math.abs(kt.x)>0||Math.abs(kt.y)>0)&&fe(!0),(bt=dt.current)==null||bt.style.setProperty("--swipe-amount-x",`${kt.x}px`),(Ue=dt.current)==null||Ue.style.setProperty("--swipe-amount-y",`${kt.y}px`)}},Re&&!u.jsx?gt.createElement("button",{"aria-label":D,"data-disabled":Q,"data-close-button":!0,onClick:Q||!Qe?()=>{}:()=>{var Ee;pe(),(Ee=u.onDismiss)==null||Ee.call(u,u)},className:Va(F==null?void 0:F.closeButton,(a=u==null?void 0:u.classNames)==null?void 0:a.closeButton)},(l=B==null?void 0:B.close)!=null?l:AI):null,u.jsx||v.isValidElement(u.title)?u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title:gt.createElement(gt.Fragment,null,le||u.icon||u.promise?gt.createElement("div",{"data-icon":"",className:Va(F==null?void 0:F.icon,(c=u==null?void 0:u.classNames)==null?void 0:c.icon)},u.promise||u.type==="loading"&&!u.icon?u.icon||Ne():null,u.type!=="loading"?u.icon||(B==null?void 0:B[le])||bI(le):null):null,gt.createElement("div",{"data-content":"",className:Va(F==null?void 0:F.content,(d=u==null?void 0:u.classNames)==null?void 0:d.content)},gt.createElement("div",{"data-title":"",className:Va(F==null?void 0:F.title,(h=u==null?void 0:u.classNames)==null?void 0:h.title)},typeof u.title=="function"?u.title():u.title),u.description?gt.createElement("div",{"data-description":"",className:Va(M,Kt,F==null?void 0:F.description,(x=u==null?void 0:u.classNames)==null?void 0:x.description)},typeof u.description=="function"?u.description():u.description):null),v.isValidElement(u.cancel)?u.cancel:u.cancel&&Rh(u.cancel)?gt.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||T,onClick:Ee=>{var it,st;Rh(u.cancel)&&Qe&&((st=(it=u.cancel).onClick)==null||st.call(it,Ee),pe())},className:Va(F==null?void 0:F.cancelButton,(f=u==null?void 0:u.classNames)==null?void 0:f.cancelButton)},u.cancel.label):null,v.isValidElement(u.action)?u.action:u.action&&Rh(u.action)?gt.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||E,onClick:Ee=>{var it,st;Rh(u.action)&&((st=(it=u.action).onClick)==null||st.call(it,Ee),!Ee.defaultPrevented&&pe())},className:Va(F==null?void 0:F.actionButton,(m=u==null?void 0:u.classNames)==null?void 0:m.actionButton)},u.action.label):null))};function fw(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function VI(t,s){let n={};return[t,s].forEach((r,a)=>{let l=a===1,c=l?"--mobile-offset":"--offset",d=l?MI:LI;function h(x){["top","right","bottom","left"].forEach(f=>{n[`${c}-${f}`]=typeof x=="number"?`${x}px`:x})}typeof r=="number"||typeof r=="string"?h(r):typeof r=="object"?["top","right","bottom","left"].forEach(x=>{r[x]===void 0?n[`${c}-${x}`]=d:n[`${c}-${x}`]=typeof r[x]=="number"?`${r[x]}px`:r[x]}):h(d)}),n}var HI=v.forwardRef(function(t,s){let{invert:n,position:r="bottom-right",hotkey:a=["altKey","KeyT"],expand:l,closeButton:c,className:d,offset:h,mobileOffset:x,theme:f="light",richColors:m,duration:p,style:u,visibleToasts:j=II,toastOptions:g,dir:y=fw(),gap:N=BI,loadingIcon:S,icons:C,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:R}=t,[P,A]=gt.useState([]),I=gt.useMemo(()=>Array.from(new Set([r].concat(P.filter(O=>O.position).map(O=>O.position)))),[P,r]),[$,T]=gt.useState([]),[E,_]=gt.useState(!1),[M,q]=gt.useState(!1),[G,Z]=gt.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=gt.useRef(null),z=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),F=gt.useRef(null),B=gt.useRef(!1),D=gt.useCallback(O=>{A(V=>{var K;return(K=V.find(Y=>Y.id===O.id))!=null&&K.delete||Qr.dismiss(O.id),V.filter(({id:Y})=>Y!==O.id)})},[]);return gt.useEffect(()=>Qr.subscribe(O=>{if(O.dismiss){A(V=>V.map(K=>K.id===O.id?{...K,delete:!0}:K));return}setTimeout(()=>{qv.flushSync(()=>{A(V=>{let K=V.findIndex(Y=>Y.id===O.id);return K!==-1?[...V.slice(0,K),{...V[K],...O},...V.slice(K+1)]:[O,...V]})})})}),[]),gt.useEffect(()=>{if(f!=="system"){Z(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Z("dark"):Z("light")),typeof window>"u")return;let O=window.matchMedia("(prefers-color-scheme: dark)");try{O.addEventListener("change",({matches:V})=>{Z(V?"dark":"light")})}catch{O.addListener(({matches:K})=>{try{Z(K?"dark":"light")}catch(Y){console.error(Y)}})}},[f]),gt.useEffect(()=>{P.length<=1&&_(!1)},[P]),gt.useEffect(()=>{let O=V=>{var K,Y;a.every(U=>V[U]||V.code===U)&&(_(!0),(K=W.current)==null||K.focus()),V.code==="Escape"&&(document.activeElement===W.current||(Y=W.current)!=null&&Y.contains(document.activeElement))&&_(!1)};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[a]),gt.useEffect(()=>{if(W.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,B.current=!1)}},[W.current]),gt.createElement("section",{ref:s,"aria-label":`${w} ${z}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},I.map((O,V)=>{var K;let[Y,U]=O.split("-");return P.length?gt.createElement("ol",{key:O,dir:y==="auto"?fw():y,tabIndex:-1,ref:W,className:d,"data-sonner-toaster":!0,"data-theme":G,"data-y-position":Y,"data-lifted":E&&P.length>1&&!l,"data-x-position":U,style:{"--front-toast-height":`${((K=$[0])==null?void 0:K.height)||0}px`,"--width":`${FI}px`,"--gap":`${N}px`,...u,...VI(h,x)},onBlur:X=>{B.current&&!X.currentTarget.contains(X.relatedTarget)&&(B.current=!1,F.current&&(F.current.focus({preventScroll:!0}),F.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||B.current||(B.current=!0,F.current=X.relatedTarget)},onMouseEnter:()=>_(!0),onMouseMove:()=>_(!0),onMouseLeave:()=>{M||_(!1)},onDragEnd:()=>_(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||q(!0)},onPointerUp:()=>q(!1)},P.filter(X=>!X.position&&V===0||X.position===O).map((X,ne)=>{var oe,re;return gt.createElement(UI,{key:X.id,icons:C,index:ne,toast:X,defaultRichColors:m,duration:(oe=g==null?void 0:g.duration)!=null?oe:p,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:n,visibleToasts:j,closeButton:(re=g==null?void 0:g.closeButton)!=null?re:c,interacting:M,position:O,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:D,toasts:P.filter(ge=>ge.position==X.position),heights:$.filter(ge=>ge.position==X.position),setHeights:T,expandByDefault:l,gap:N,loadingIcon:S,expanded:E,pauseWhenPageIsHidden:R,swipeDirections:t.swipeDirections})})):null}))});const ds={submitApplication:async t=>{var n;const s=await Te.submitApplication(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to submit application");return s.data},getApplications:async t=>{var n;const s=await Te.getApplications(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch applications");return s.data},shortlistApplications:async(t,s,n)=>{var a;const r=await Te.shortlistApplications({applicationIds:t,assignedTo:s,remarks:n});if(!r.ok)throw new Error(((a=r.data)==null?void 0:a.message)||"Failed to shortlist applications");return r.data},getApplicationById:async t=>{var n,r;const s=await Te.getApplicationById(t);if(!s.ok)throw console.error("API Error Response:",s.status,s.data),new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch application details");return((r=s.data)==null?void 0:r.data)||s.data},getUsers:async t=>{var n,r;const s=await Te.getUsers(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch users");return((r=s.data)==null?void 0:r.data)||s.data},addParticipant:async t=>{var n;const s=await Te.addParticipant(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to add participant");return s.data},scheduleInterview:async t=>{var n;const s=await Te.scheduleInterview(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to schedule interview");return s.data},updateInterview:async(t,s)=>{var r;const n=await Te.updateInterview(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to update interview");return n.data},getInterviews:async t=>{var r,a;const s=await Te.getInterviews(t);if(!s.ok)throw new Error(((r=s.data)==null?void 0:r.message)||"Failed to fetch interviews");const n=((a=s.data)==null?void 0:a.data)||s.data;return Array.isArray(n)?n:[]},getDocuments:async t=>{var n,r;const s=await Te.getDocuments(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch documents");return((r=s.data)==null?void 0:r.data)||s.data},uploadDocument:async(t,s)=>{var r;const n=await Te.uploadDocument(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to upload document");return n.data},submitKTMatrix:async t=>{var n;const s=await Te.submitKTMatrix(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to submit KT Matrix");return s.data},submitLevel2Feedback:async t=>{var n;const s=await Te.submitLevel2Feedback(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to submit feedback");return s.data},updateRecommendation:async t=>{var n;const s=await Te.updateRecommendation(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to update recommendation");return s.data},submitStageDecision:async t=>{var n;const s=await Te.submitStageDecision(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to process stage decision");return s.data},updateInterviewDecision:async t=>{var n;const s=await Te.updateInterviewDecision(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to update interview decision");return s.data},assignArchitectureTeam:async(t,s)=>{var r;const n=await Te.assignArchitectureTeam(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to assign architecture team");return n.data},updateArchitectureStatus:async(t,s,n)=>{var a;const r=await Te.updateArchitectureStatus(t,s,n);if(!r.ok)throw new Error(((a=r.data)==null?void 0:a.message)||"Failed to update architecture status");return r.data},generateDealerCodes:async t=>{var n;const s=await Te.generateDealerCodes(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to generate dealer codes");return s.data},updateApplicationStatus:async(t,s)=>{var r;const n=await Te.updateApplicationStatus(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to update application status");return n.data},convertToOpportunity:async(t,s)=>{var r;const n=await Te.convertToOpportunity(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to convert application to opportunity");return n.data},bulkConvertToOpportunity:async t=>{var n;const s=await Te.bulkConvertToOpportunity(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to perform bulk conversion");return s.data},createDealer:async t=>{var n;const s=await Te.createDealer(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to create dealer profile");return s.data},retriggerEvaluators:async t=>{var n;const s=await Te.retriggerEvaluators(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to retrigger evaluators");return s.data},getSecurityDeposit:async t=>{var n,r;const s=await Te.getSecurityDeposit(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch security deposit");return((r=s.data)==null?void 0:r.data)||s.data},updateSecurityDeposit:async t=>{var n;const s=await Te.updateSecurityDeposit(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to update security deposit");return s.data},getSystemConfigs:async t=>{var n,r;const s=await Te.getSystemConfigs(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch system configurations");return((r=s.data)==null?void 0:r.data)||s.data},getDocumentConfigMetadata:async()=>{var s,n;const t=await Te.getDocumentConfigMetadata();if(!t.ok)throw new Error(((s=t.data)==null?void 0:s.message)||"Failed to fetch metadata");return((n=t.data)==null?void 0:n.data)||t.data},getDocumentConfigs:async t=>{var n;const s=await Te.getDocumentConfigs(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch document configurations");return s.data},createDocumentConfig:async t=>{var n,r;const s=await Te.createDocumentConfig(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to create document configuration");return((r=s.data)==null?void 0:r.data)||s.data},updateDocumentConfig:async(t,s)=>{var r,a;const n=await Te.updateDocumentConfig(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to update document configuration");return((a=n.data)==null?void 0:a.data)||n.data},deleteDocumentConfig:async t=>{var n;const s=await Te.deleteDocumentConfig(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to delete document configuration");return s.data},updateApplication:async(t,s)=>{var r;const n=await Te.updateApplication(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to update application");return n.data},submitFddReport:async t=>{var n;const s=await Te.submitFddReport(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to submit FDD report");return s.data},getFddAssignment:async t=>{var n;const s=await Te.getFddAssignment(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch FDD assignment");return s.data},assignFddAgency:async t=>{var n;const s=await Te.assignFddAgency(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to assign FDD agency");return s.data},exportResponses:async t=>{var n,r;const s=await Te.exportApplicationResponses({applicationIds:t.join(",")});if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to export responses");return((r=s.data)==null?void 0:r.data)||[]}},Ss={getRoles:async()=>(await Te.getRoles()).data,getPermissions:async()=>(await Te.getPermissions()).data,updateRole:async(t,s)=>(await Te.updateRole(t,s)).data,createRole:async t=>(await Te.createRole(t)).data,getZones:async()=>(await Te.getZones()).data,updateZone:async(t,s)=>(await Te.updateZone(t,s)).data,createZone:async t=>(await Te.createZone(t)).data,createRegion:async t=>(await Te.createRegion(t)).data,updateRegion:async(t,s)=>(await Te.updateRegion(t,s)).data,getRegions:async()=>(await Te.getRegions()).data,getStates:async t=>(await Te.getStates(t)).data,getDistricts:async t=>{const s=typeof t=="string"?{stateId:t,limit:"all"}:{limit:"all",...t};return(await Te.getDistricts(s)).data},getAreas:async t=>(await Te.getAreas(t)).data,updateArea:async(t,s)=>(await Te.updateArea(t,s)).data,createArea:async t=>(await Te.createArea(t)).data,deleteArea:async t=>(await Te.deleteArea(t)).data,getAreaManagers:async()=>(await Te.getAreaManagers()).data,getASMs:async()=>(await Te.getASMs()).data,getZonalManagers:async()=>(await Te.getZonalManagers()).data,saveZonalManager:async t=>Te.saveZonalManager(t).then(s=>s.data),getDDLeads:async()=>(await Te.getDDLeads()).data,saveDDLead:async t=>Te.saveDDLead(t).then(s=>s.data),getUsers:async()=>(await Te.getUsers()).data,updateUser:async(t,s)=>(await Te.updateUser(t,s)).data,getEmailTemplates:async()=>(await Te.getEmailTemplates()).data,getEmailTemplate:async t=>(await Te.getEmailTemplate(t)).data,createEmailTemplate:async t=>(await Te.createEmailTemplate(t)).data,updateEmailTemplate:async(t,s)=>(await Te.updateEmailTemplate(t,s)).data,deleteEmailTemplate:async t=>(await Te.deleteEmailTemplate(t)).data,previewEmailTemplate:async t=>(await Te.previewEmailTemplate(t)).data,getSlaConfigs:async()=>(await Te.getSlaConfigs()).data,saveSlaConfig:async t=>(await Te.saveSlaConfig(t)).data,initializeDefaultSlas:async()=>(await Te.initializeDefaultSlas()).data,saveZone:async t=>t.id?Ss.updateZone(t.id,t):Ss.createZone(t),saveRegion:async t=>t.id?Ss.updateRegion(t.id,t):Ss.createRegion(t),saveASM:async t=>Te.updateUser(t.userId,t).then(s=>s.data),getSystemConfigs:async t=>(await Te.getSystemConfigs(t)).data,saveSystemConfig:async t=>(await Te.saveSystemConfig(t)).data,getDealerAsmMappings:async()=>(await Te.getDealerAsmMappings()).data,saveDealerAsmMapping:async t=>(await Te.saveDealerAsmMapping(t)).data};function WI({onAdminLogin:t}){const[s,n]=v.useState({country:"India",stateId:"",districtId:"",name:"",interestedCity:"",email:"",pincode:"",mobile:"",ownRoyalEnfield:"",royalEnfieldModel:"",age:"",education:"",companyName:"",source:"",existingDealer:"",description:"",address:"",acceptTerms:!1}),[r,a]=v.useState(!1),[l,c]=v.useState([]),[d,h]=v.useState([]);v.useEffect(()=>{x()},[]);const x=async()=>{try{const g=await Ss.getStates(),y=Array.isArray(g)?g:(g==null?void 0:g.data)||(g==null?void 0:g.states)||[];c(y)}catch(g){console.error("Error fetching states:",g)}},f=async g=>{if(g){n(y=>({...y,stateId:g,districtId:""})),h([]);try{const y=await Ss.getDistricts(g),N=Array.isArray(y)?y:(y==null?void 0:y.data)||(y==null?void 0:y.districts)||[];h(N)}catch(y){console.error("Error fetching districts:",y)}}},m=()=>{if(!s.mobile||s.mobile.length<10){ee.error("Please enter a valid mobile number");return}ee.success("OTP sent to "+s.mobile),setTimeout(()=>{a(!0),ee.success("Mobile number verified")},1500)},p=async g=>{var y,N;if(g.preventDefault(),!s.country||!s.stateId||!s.districtId||!s.name||!s.interestedCity||!s.email||!s.pincode||!s.mobile||!s.ownRoyalEnfield||!s.age||!s.education||!s.companyName||!s.source||!s.existingDealer||!s.description||!s.address){ee.error("Please fill in all required fields");return}if(!r){ee.error("Please verify your mobile number");return}if(!s.acceptTerms){ee.error("Please accept the terms and conditions");return}try{const S=l.find(A=>A.id===s.stateId),C=d.find(A=>A.id===s.districtId),w=(S==null?void 0:S.name)||(S==null?void 0:S.stateName)||"",R=(C==null?void 0:C.name)||(C==null?void 0:C.districtName)||"",P={applicantName:s.name,email:s.email,phone:s.mobile,state:w,city:s.interestedCity,district:R,preferredLocation:`${s.interestedCity}, ${w}`,businessType:"Dealership",locationType:"district",locationId:s.districtId,address:s.address,pincode:s.pincode,age:s.age,education:s.education,companyName:s.companyName,source:s.source,existingDealer:s.existingDealer==="yes",ownRoyalEnfield:s.ownRoyalEnfield==="yes",royalEnfieldModel:s.royalEnfieldModel,description:s.description,experienceYears:0,investmentCapacity:"Unknown"};await ds.submitApplication(P),ee.success("Application submitted successfully"),n({country:"India",stateId:"",districtId:"",name:"",interestedCity:"",email:"",pincode:"",mobile:"",ownRoyalEnfield:"",royalEnfieldModel:"",age:"",education:"",companyName:"",source:"",existingDealer:"",description:"",address:"",acceptTerms:!1}),a(!1)}catch(S){ee.error(((N=(y=S.response)==null?void 0:y.data)==null?void 0:N.message)||"Failed to submit application.")}},u=["Classic 650","Scram 440","Goan Classic 350","Bear 650","Guerrilla 450","Shotgun 650","Himalayan 450","Bullet 350","Super Meteor 650","Hunter 350","Scram 411","Meteor 350","Interceptor INT 650","Continental GT 650","Classic 350","Other Royal Enfield motorcycle"],j=["Existing RE dealer","Customer","RE Employee","News Paper","Website","Friends","Others"];return e.jsxs("div",{className:"min-h-screen relative flex flex-col",children:[e.jsxs("div",{className:"fixed inset-0 z-0",children:[e.jsx("img",{src:"/assets/images/become_a_dealer.webp",alt:"Royal Enfield Background",className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-black/20"})]}),e.jsxs("nav",{className:"relative z-10 bg-black px-6 md:px-12 py-4 flex items-center justify-between border-b border-white/10",children:[e.jsx("img",{src:"/assets/images/Re_Logo.png",alt:"Royal Enfield",className:"h-10 md:h-12 w-auto"}),e.jsxs(se,{variant:"ghost",onClick:t,className:"text-[10px] uppercase tracking-widest font-bold text-slate-400 hover:text-white transition-colors",children:[e.jsx(iI,{className:"w-3.5 h-3.5 mr-2"}),"Login"]})]}),e.jsx("main",{className:"relative z-10 flex-grow flex flex-col items-center pt-24 pb-24 px-6",children:e.jsxs("div",{className:"w-full max-w-[1240px] bg-white shadow-2xl p-8 md:p-16",children:[e.jsxs("section",{className:"text-[#333333] mb-12",children:[e.jsx("h1",{className:"text-[28px] font-bold mb-8 uppercase tracking-wide text-black",children:"Become a Dealer"}),e.jsxs("div",{className:"space-y-6 text-[15px] leading-relaxed",children:[e.jsx("p",{children:"At Royal Enfield, we endeavour to partner our patrons and customers in their journeys of exploration. Our main objective is to provide an immersive brand and retail experience in addition to ensuring a superior product experience. Our dealers, distributors and network teams are our extended partners in this task."}),e.jsx("p",{children:"Royal Enfield employs a comprehensive and professional process for Dealership allotment. Dealer selection is done based on a variety of criteria including a personal meeting with the applicant. It is only post completion of the evaluation and selection process, that other formalities are considered."}),e.jsx("p",{children:"Royal Enfield does not accept or demand money / deposits from prospective partners prior to processing the application or candidature of the Dealership."}),e.jsxs("p",{children:["If you receive any communication offering allotment of Royal Enfield Dealership against payment / transfer of money and / or otherwise, we advise you to seek information / clarifications by writing to us at ",e.jsx("b",{children:e.jsx("a",{href:"mailto:support@royalenfield.com",className:"text-red-600",children:"support@royalenfield.com"})})," or by contacting us on our customer care toll-free number ",e.jsx("b",{children:e.jsx("a",{href:"tel:18002100008",className:"text-red-600",children:"1800 210 0008"})}),"."]}),e.jsx("p",{className:"font-bold py-1 mt-8 text-black text-[15px]",children:"*This is the ONLY official website and central number for dealership enquiries for Royal Enfield and we do not have any other partner website(s)."})]})]}),e.jsxs("form",{onSubmit:p,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"w-full h-[44px] px-4 border border-[#cccccc] appearance-none bg-white text-[14px] outline-none",value:s.country,onChange:g=>n({...s,country:g.target.value}),children:[e.jsx("option",{value:"India",children:"India"}),e.jsx("option",{value:"Other",children:"Others"})]}),e.jsx(la,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"w-full h-[44px] px-4 border border-[#cccccc] appearance-none bg-white text-[14px] outline-none",value:s.stateId,onChange:g=>f(g.target.value),children:[e.jsx("option",{value:"",children:"Select State*"}),l.map(g=>e.jsx("option",{value:g.id,children:g.name||g.stateName},g.id))]}),e.jsx(la,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"w-full h-[44px] px-4 border border-[#cccccc] appearance-none bg-white text-[14px] outline-none",value:s.districtId,onChange:g=>n({...s,districtId:g.target.value}),children:[e.jsx("option",{value:"",children:"Select District*"}),d.map(g=>e.jsx("option",{value:g.id,children:g.name||g.districtName},g.id))]}),e.jsx(la,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-10 gap-y-6",children:[e.jsx(ot,{placeholder:"Name*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.name,onChange:g=>n({...s,name:g.target.value})}),e.jsx(ot,{placeholder:"Interested city for Dealership*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.interestedCity,onChange:g=>n({...s,interestedCity:g.target.value})}),e.jsx(ot,{placeholder:"Email Id*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.email,onChange:g=>n({...s,email:g.target.value})}),e.jsx(ot,{placeholder:"Pincode*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.pincode,onChange:g=>n({...s,pincode:g.target.value})}),e.jsxs("div",{className:"relative",children:[e.jsx(ot,{placeholder:"Mobile No.*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.mobile,onChange:g=>n({...s,mobile:g.target.value})}),r?e.jsx("span",{className:"absolute right-4 top-1/2 -translate-y-1/2 text-[12px] font-bold text-green-600",children:"Verified"}):e.jsx("button",{type:"button",onClick:m,className:"absolute right-4 top-1/2 -translate-y-1/2 text-[12px] font-bold text-red-600 hover:text-black transition-colors",children:"Verify"})]}),e.jsxs("div",{className:"flex items-center gap-10 h-[44px]",children:[e.jsxs("span",{className:"text-[14px] font-medium text-[#333333]",children:["Own a Royal Enfield? ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("div",{className:"flex gap-8",children:["yes","no"].map(g=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s.ownRoyalEnfield===g?"border-red-600":"border-[#cccccc]"}`,children:s.ownRoyalEnfield===g&&e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-600"})}),e.jsx("input",{type:"radio",className:"hidden",checked:s.ownRoyalEnfield===g,onChange:()=>n({...s,ownRoyalEnfield:g})}),e.jsx("span",{className:"text-[14px] capitalize",children:g})]},g))})]}),e.jsx(ot,{placeholder:"Age*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.age,onChange:g=>n({...s,age:g.target.value})}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"w-full h-[44px] px-4 border border-[#cccccc] appearance-none bg-white text-[14px] outline-none disabled:bg-slate-50",value:s.royalEnfieldModel,disabled:s.ownRoyalEnfield!=="yes",onChange:g=>n({...s,royalEnfieldModel:g.target.value}),children:[e.jsx("option",{value:"",children:"Motorcycle Owned"}),u.map(g=>e.jsx("option",{value:g,children:g},g))]}),e.jsx(la,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"})]}),e.jsx(ot,{placeholder:"Education Qualification*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.education,onChange:g=>n({...s,education:g.target.value})}),e.jsx(ot,{placeholder:"Company Name*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.companyName,onChange:g=>n({...s,companyName:g.target.value})}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"w-full h-[44px] px-4 border border-[#cccccc] appearance-none bg-white text-[14px] outline-none",value:s.source,onChange:g=>n({...s,source:g.target.value}),children:[e.jsx("option",{value:"",children:"Select Source*"}),j.map(g=>e.jsx("option",{value:g,children:g},g))]}),e.jsx(la,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"})]}),e.jsxs("div",{className:"flex flex-col justify-center h-auto min-h-[44px] space-y-1",children:[e.jsxs("span",{className:"text-[13px] font-medium text-[#333333]",children:["Are you an existing Dealer / Vendor of Royal Enfield? ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("div",{className:"flex gap-8",children:["yes","no"].map(g=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s.existingDealer===g?"border-red-600":"border-[#cccccc]"}`,children:s.existingDealer===g&&e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-600"})}),e.jsx("input",{type:"radio",className:"hidden",checked:s.existingDealer===g,onChange:()=>n({...s,existingDealer:g})}),e.jsx("span",{className:"text-[14px] capitalize",children:g})]},g))})]})]}),e.jsxs("div",{className:"space-y-6 pt-4",children:[e.jsx(Fs,{placeholder:"Description*",className:"min-h-[120px] border-[#cccccc] rounded-none px-4 py-3 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999] resize-none",value:s.description,onChange:g=>n({...s,description:g.target.value})}),e.jsx(Fs,{placeholder:"Address*",className:"min-h-[120px] border-[#cccccc] rounded-none px-4 py-3 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999] resize-none",value:s.address,onChange:g=>n({...s,address:g.target.value})})]}),e.jsxs("div",{className:"pt-6 space-y-8",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("p",{className:"text-[14px] text-[#666666] leading-relaxed",children:["Disclaimer: By signing this form/checking this box, you acknowledge and agree that we may use the information you share with us, to communicate with you through e-mails, text messages, WhatsApp and calls, in order to provide our product or service related information and/or for promotional and marketing purposes. All information provided will be secured and processed as per our ",e.jsx("b",{children:"privacy policy"}),"."]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Rn,{id:"terms",className:"w-5 h-5 border-[#cccccc] rounded-none data-[state=checked]:bg-black data-[state=checked]:border-black",checked:s.acceptTerms,onCheckedChange:g=>n({...s,acceptTerms:g})}),e.jsxs("label",{htmlFor:"terms",className:"text-[14px] font-medium cursor-pointer",children:["I accept the ",e.jsx("b",{children:"terms and conditions"})," as well as ",e.jsx("b",{children:"privacy policy"}),"."]})]})]}),e.jsxs("button",{type:"submit",className:"h-12 px-10 bg-black text-white flex items-center gap-3 hover:bg-slate-900 transition-colors",children:[e.jsx("span",{className:"font-bold uppercase tracking-wider text-[14px]",children:"Submit"}),e.jsx(el,{className:"w-4 h-4"})]})]})]})]})}),e.jsx("footer",{className:"relative z-10 bg-black py-16",children:e.jsxs("div",{className:"max-w-[1240px] mx-auto px-6 grid grid-cols-1 md:grid-cols-3 items-center gap-8",children:[e.jsx("img",{src:"/assets/images/Re_Logo.png",alt:"Royal Enfield",className:"h-10 w-auto opacity-100"}),e.jsxs("div",{className:"flex justify-center gap-12 text-[10px] font-bold uppercase tracking-widest text-slate-500",children:[e.jsx("a",{href:"#",className:"hover:text-white transition-all",children:"Legal"}),e.jsx("a",{href:"#",className:"hover:text-white transition-all",children:"Privacy"}),e.jsx("a",{href:"#",className:"hover:text-white transition-all",children:"Terms"})]}),e.jsx("p",{className:"text-[10px] text-center md:text-right uppercase tracking-widest text-slate-500 font-bold",children:"© 2026 Royal Enfield. All Rights Reserved."})]})})]})}const GI=()=>{const{applicationId:t}=Bc(),s=qn(),{user:n}=Nn(A=>A.auth),[r,a]=v.useState(!0),[l,c]=v.useState([]),[d,h]=v.useState([]),[x,f]=v.useState(""),[m,p]=v.useState({}),[u,j]=v.useState(!1),[g,y]=v.useState(!1);v.useEffect(()=>{(async()=>{var I,$;if(t)try{const T=await Te.getPublicQuestionnaire(t);if(T.data.success){const E=T.data.data.questions||[];c(E);const _=Array.from(new Set(E.map(M=>M.sectionName)));h(_),_.length>0&&f(_[0])}}catch(T){console.error("Error fetching questionnaire:",T),(($=(I=T.response)==null?void 0:I.data)==null?void 0:$.code)==="ALREADY_SUBMITTED"?y(!0):ee.error("Failed to load questionnaire")}finally{a(!1)}})()},[t]);const N=(A,I)=>{p($=>({...$,[A]:I}))},S=()=>{const A=d.indexOf(x);A{const A=d.indexOf(x);A>0&&(f(d[A-1]),window.scrollTo({top:0,behavior:"smooth"}))},w=async()=>{const A=l.filter(I=>I.isMandatory&&!m[I.id]);if(A.length>0){ee.error(`Please answer all mandatory questions. Missing: ${A.length}`);return}try{j(!0);const I=Object.entries(m).map(([$,T])=>({questionId:$,value:T}));await Te.submitPublicResponse({applicationId:t,responses:I}),ee.success("Responses submitted successfully"),y(!0),setTimeout(()=>s("/prospective-dashboard"),3e3)}catch(I){console.error(I),ee.error("Failed to submit responses")}finally{j(!1)}};if(r)return e.jsx("div",{className:"flex items-center justify-center h-screen bg-slate-50",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-amber-600"})});if(g)return e.jsx("div",{className:"min-h-screen bg-slate-50 flex flex-col items-center justify-center p-6",children:e.jsxs("div",{className:"bg-white p-8 rounded-lg shadow-lg max-w-md w-full text-center border-t-4 border-amber-600",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 text-green-600 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(Ys,{className:"w-8 h-8"})}),e.jsx("h2",{className:"text-2xl font-bold mb-2 text-slate-900",children:"Assessment Submitted"}),e.jsx("p",{className:"text-slate-600 mb-6",children:"Thank you! Your assessment has been submitted successfully. Redirecting to dashboard..."}),e.jsx("button",{onClick:()=>s("/prospective-dashboard"),className:"w-full py-2 bg-amber-600 text-white rounded-lg hover:bg-amber-700 transition-colors",children:"Return to Dashboard"})]})});const R=l.filter(A=>A.sectionName===x),P=d.indexOf(x);return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden h-screen bg-slate-50",children:[e.jsx("header",{className:"bg-white border-b border-slate-200 px-6 py-4 flex-shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900 font-bold text-xl",children:"Dealer Questionnaire Form"}),e.jsx("p",{className:"text-slate-600 text-sm",children:"Manage and track dealership applications"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[n&&e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-100 rounded-lg",children:[e.jsx("div",{className:"w-8 h-8 bg-amber-600 rounded-full flex items-center justify-center",children:e.jsx(kr,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-slate-900 text-sm font-medium",children:n.name||"Applicant"}),e.jsx("p",{className:"text-slate-600 text-xs",children:n.role||"Prospective Dealer"})]})]}),e.jsx("button",{className:"p-2 text-slate-500 hover:bg-slate-100 rounded-lg",title:"Refresh",onClick:()=>window.location.reload(),children:e.jsx(Rr,{className:"w-4 h-4"})}),e.jsx("button",{className:"p-2 text-slate-500 hover:bg-slate-100 rounded-lg",title:"Help",children:e.jsx(M2,{className:"w-4 h-4"})})]})]})}),e.jsxs("main",{className:"flex-1 overflow-y-auto",children:[e.jsx("div",{className:"bg-white border-b border-slate-200 sticky top-0 z-20 shadow-sm",children:e.jsx("div",{className:"max-w-5xl mx-auto px-8 py-3",children:e.jsxs("button",{onClick:()=>s("/prospective-dashboard"),className:"inline-flex items-center gap-2 text-sm font-medium text-slate-600 hover:text-slate-900 transition-colors px-3 py-2 rounded-lg hover:bg-slate-100",children:[e.jsx($r,{className:"w-4 h-4"}),"Back to Applicant Portal"]})})}),e.jsxs("div",{className:"max-w-5xl mx-auto py-8 px-6",children:[e.jsxs("div",{className:"bg-re-black rounded-t-lg overflow-hidden shadow-xl",children:[e.jsx("div",{className:"relative px-8 py-12",children:e.jsxs("div",{className:"relative z-10 text-center",children:[e.jsx("div",{className:"flex items-center justify-center mb-7",children:e.jsx("img",{src:"/assets/images/Re_Logo.png",alt:"Royal Enfield",className:"h-12 w-auto"})}),e.jsx("div",{className:"h-1 w-24 bg-amber-600 mx-auto mb-4"}),e.jsx("h2",{className:"text-amber-400 text-xl mb-4 font-light",children:"Dealership Partner Application"}),e.jsx("p",{className:"text-slate-300 max-w-2xl mx-auto leading-relaxed text-sm",children:"Thank you for your interest in becoming a Royal Enfield business partner. Please complete this questionnaire to help us understand your profile and aspirations."}),e.jsxs("div",{className:"flex items-center justify-center gap-8 mt-8 border-t border-slate-700/50 pt-6 inline-flex mx-auto",children:[e.jsxs("div",{className:"text-center px-4",children:[e.jsx("div",{className:"text-amber-400 text-2xl font-bold",children:l.length}),e.jsx("div",{className:"text-slate-400 text-xs uppercase tracking-wider",children:"Questions"})]}),e.jsx("div",{className:"h-10 w-px bg-slate-700"}),e.jsxs("div",{className:"text-center px-4",children:[e.jsx("div",{className:"text-amber-400 text-2xl font-bold",children:d.length}),e.jsx("div",{className:"text-slate-400 text-xs uppercase tracking-wider",children:"Sections"})]})]})]})}),e.jsx("div",{className:"bg-slate-800/50 backdrop-blur-sm border-t border-slate-700",children:e.jsx("div",{className:"flex items-center gap-2 overflow-x-auto scrollbar-hide px-8 py-4 no-scrollbar",children:d.map(A=>e.jsxs("button",{onClick:()=>f(A),className:`flex items-center gap-2 px-4 py-2 rounded-lg whitespace-nowrap transition-all text-sm font-medium - ${x===A?"bg-amber-600 text-white shadow-lg":"bg-slate-700/50 text-slate-300 hover:bg-slate-700 hover:text-white"}`,children:[e.jsx(fs,{className:"w-4 h-4"}),e.jsx("span",{children:A}),x===A&&e.jsx("span",{className:"ml-2 bg-white/20 px-2 py-0.5 rounded text-xs",children:l.filter(I=>I.sectionName===A).length})]},A))})})]}),e.jsx("div",{className:"bg-white rounded-b-lg shadow-xl border border-slate-200 border-t-0 min-h-[400px]",children:e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"flex items-start gap-4 pb-6 border-b-2 border-amber-100 mb-8",children:[e.jsx("div",{className:"w-12 h-12 bg-amber-50 rounded-lg flex items-center justify-center flex-shrink-0 text-amber-600",children:e.jsx(da,{className:"w-6 h-6"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-slate-900 text-xl font-bold mb-1",children:x}),e.jsxs("p",{className:"text-slate-500 text-sm",children:["Section ",P+1," of ",d.length," • ",R.length," questions"]})]})]}),e.jsxs("div",{className:"space-y-10",children:[R.map((A,I)=>e.jsx("div",{className:"group animate-in fade-in duration-500",style:{animationDelay:`${I*100}ms`},children:e.jsxs("div",{className:"flex items-start gap-5",children:[e.jsx("div",{className:"w-8 h-8 bg-slate-100 rounded-full flex items-center justify-center flex-shrink-0 group-hover:bg-amber-100 transition-colors text-slate-600 group-hover:text-amber-700 font-semibold text-sm",children:I+1}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("label",{className:"text-sm font-medium text-slate-900 leading-relaxed block",children:[A.questionText,A.isMandatory&&e.jsx("span",{className:"text-red-500 ml-1",children:"*"})]})}),e.jsxs("div",{className:"max-w-xl",children:[(A.inputType==="text"||A.inputType==="email"||A.inputType==="number")&&e.jsx("input",{type:A.inputType,className:"w-full h-10 px-3 rounded-lg border border-slate-300 focus:border-amber-500 focus:ring-2 focus:ring-amber-200 outline-none transition-all placeholder:text-slate-400",placeholder:"Type your answer here...",value:m[A.id]||"",onChange:$=>N(A.id,$.target.value)}),A.inputType==="textarea"&&e.jsx("textarea",{className:"w-full h-32 p-3 rounded-lg border border-slate-300 focus:border-amber-500 focus:ring-2 focus:ring-amber-200 outline-none transition-all placeholder:text-slate-400",placeholder:"Type your answer here...",value:m[A.id]||"",onChange:$=>N(A.id,$.target.value)}),(A.inputType==="select"||A.inputType==="yesno"||A.inputType==="radio"||A.inputType==="mcq")&&e.jsx("div",{className:"space-y-2",children:(A.questionOptions||(A.inputType==="yesno"?[{optionText:"Yes"},{optionText:"No"}]:[])).map(($,T)=>{const E=$.optionText||$.text;return e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group/opt",children:[e.jsx("input",{type:"radio",name:`q-${A.id}`,className:"w-4 h-4 text-amber-600 focus:ring-amber-500 border-slate-300",checked:m[A.id]===E,onChange:()=>N(A.id,E)}),e.jsx("span",{className:"text-slate-700 group-hover/opt:text-slate-900 transition-colors",children:E})]},T)})})]})]})]})},A.id)),R.length===0&&e.jsx("div",{className:"text-center py-10 text-slate-500 italic",children:"No questions in this section."})]}),e.jsxs("div",{className:"flex items-center justify-between pt-10 mt-10 border-t border-slate-100",children:[e.jsx("button",{onClick:C,disabled:P===0,className:"px-6 py-2.5 rounded-lg text-sm font-medium border border-slate-300 text-slate-700 hover:bg-slate-50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Previous Section"}),P{const n=hu(`Primitive.${s}`),r=v.forwardRef((a,l)=>{const{asChild:c,...d}=a,h=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${s}`,{...t,[s]:r}},{}),ZI="Label",z2=v.forwardRef((t,s)=>e.jsx(YI.label,{...t,ref:s,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));z2.displayName=ZI;var QI=z2;function ce({className:t,...s}){return e.jsx(QI,{"data-slot":"label",className:Pt("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...s})}const XI=[{id:"15",name:"Super Admin",email:"admin@royalenfield.com",password:"Admin@123",role:"Super Admin"},{id:"13",name:"piyush",email:"piyush@royalenfield.com",password:"Admin@123",role:"DD-ZM"},{id:"14",name:"manish",email:"manish@royalenfield.com",password:"Admin@123",role:"RBM"},{id:"14",name:"manav",email:"manav@royalenfield.com",password:"Admin@123",role:"ZBH"},{id:"5",name:"Jaya",email:"jaya@royalenfield.com",password:"Admin@123",role:"DD Lead"},{id:"14",name:"ganesh",email:"ganesh@royalenfield.com",password:"Admin@123",role:"DD Head"},{id:"16",name:"Yashwin",email:"yashwin@royalenfield.com",password:"Admin@123",role:"NBH"},{id:"15",name:"FDD Team",email:"fdd@royalenfield.com",password:"Admin@123",role:"FDD"},{id:"13",name:"Finance Admin",email:"finance@royalenfield.com",password:"Admin@123",role:"Finance"},{id:"13",name:"abhishek",email:"abhishek@royalenfield.com",password:"Admin@123",role:"ASM"},{id:"18",name:"Lince",email:"lince@royalenfield.com",password:"Admin@123",role:"DD Admin"},{id:"18",name:"Legal Admin",email:"legal@royalenfield.com",password:"Admin@123",role:"Legal Admin"},{id:"18",name:"CEO",email:"ceo@royalenfield.com",password:"Admin@123",role:"CEO"},{id:"18",name:"CCO",email:"cco@royalenfield.com",password:"Admin@123",role:"CCO"}],hi={totalApplications:0,loaIssued:0,level1Pending:0,level2Pending:0,level3Pending:0,eorInProgress:0,disqualified:0,pendingReminders:0,shortlistedToday:0,pendingShortlisting:0},JI=[];function pw({onLogin:t}){const[s,n]=v.useState(""),[r,a]=v.useState(""),[l,c]=v.useState(!1),[d,h]=v.useState(""),[x,f]=v.useState(!1),[m,p]=v.useState(!1),[u,j]=v.useState(!1),[g,y]=v.useState(null),N=async(R,P)=>{try{if(navigator.clipboard&&navigator.clipboard.writeText){await navigator.clipboard.writeText(R),y(P),setTimeout(()=>y(null),2e3);return}}catch{}try{const A=document.createElement("textarea");A.value=R,A.style.position="fixed",A.style.left="-999999px",A.style.top="-999999px",document.body.appendChild(A),A.focus(),A.select();const I=document.execCommand("copy");document.body.removeChild(A),I&&(y(P),setTimeout(()=>y(null),2e3))}catch{}},S=async(R,P)=>{var A,I;n(R),a(P),h(""),p(!0);try{await t(R,P)}catch($){const T=((I=(A=$.response)==null?void 0:A.data)==null?void 0:I.message)||$.message||"Auto-login failed";h(T),ee.error(T)}finally{p(!1)}},C=async R=>{var P,A;if(R.preventDefault(),!m){if(h(""),!s||!r){h("Please enter both email and password");return}p(!0);try{await t(s,r)}catch(I){const $=((A=(P=I.response)==null?void 0:P.data)==null?void 0:A.message)||I.message||"Login failed";h($),ee.error($)}finally{p(!1)}}},w=R=>{R.preventDefault(),alert("Password reset link sent to "+s),f(!1)};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-black p-4 overflow-y-auto",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute -top-40 -right-40 w-80 h-80 bg-red-700/15 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-80 h-80 bg-red-700/15 rounded-full blur-3xl"})]}),e.jsxs("div",{className:"relative w-full max-w-6xl grid md:grid-cols-2 gap-8 my-8",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:"/assets/images/Re_Logo.png",alt:"Royal Enfield",className:"h-16 w-auto object-contain"})}),e.jsx("p",{className:"text-slate-400",children:"Dealership Onboarding System"})]}),e.jsx("div",{className:"bg-white rounded-lg shadow-2xl p-8",children:x?e.jsxs("form",{onSubmit:w,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"mb-2",children:"Reset Password"}),e.jsx("p",{className:"text-slate-600",children:"Enter your email to receive a password reset link"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"reset-email",children:"Email Address"}),e.jsx(ot,{id:"reset-email",type:"email",placeholder:"you@royalenfield.com",value:s,onChange:R=>n(R.target.value),required:!0,className:"w-full"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{type:"button",variant:"outline",onClick:()=>f(!1),className:"flex-1",children:"Back to Login"}),e.jsx(se,{type:"submit",className:"flex-1 bg-re-red hover:bg-re-red-hover text-white",children:"Send Reset Link"})]})]}):e.jsxs("form",{onSubmit:C,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"email",children:"Email Address"}),e.jsx(ot,{id:"email",type:"email",placeholder:"you@royalenfield.com",value:s,onChange:R=>n(R.target.value),className:"w-full",disabled:m})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"password",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(ot,{id:"password",type:u?"text":"password",placeholder:"Enter your password",value:r,onChange:R=>a(R.target.value),className:"no-native-password-reveal w-full pr-10",autoComplete:"current-password",disabled:m}),e.jsx("button",{type:"button",onClick:()=>j(!u),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 focus:outline-none",disabled:m,children:u?e.jsx(Q5,{className:"w-5 h-5"}):e.jsx(nn,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Rn,{id:"remember",checked:l,onCheckedChange:R=>c(R),disabled:m}),e.jsx(ce,{htmlFor:"remember",className:"cursor-pointer",children:"Remember Me"})]}),e.jsx("button",{type:"button",onClick:()=>f(!0),className:"text-re-red hover:text-re-red-hover disabled:opacity-50",disabled:m,children:"Forgot Password?"})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-200 rounded-md",children:[e.jsx(Ks,{className:"w-4 h-4 text-red-600"}),e.jsx("span",{className:"text-red-600 font-medium text-sm",children:d})]}),e.jsx(se,{type:"submit",className:"w-full bg-re-red hover:bg-re-red-hover h-11 text-white",disabled:m,children:m?e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),e.jsx("span",{children:"Logging in..."})]}):"Login"}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"relative my-4",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-slate-200"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-white px-2 text-slate-500",children:"Or"})})]}),e.jsx(se,{type:"button",variant:"outline",className:"w-full border-re-red text-re-red hover:bg-red-50 h-11",onClick:()=>window.location.href="/prospective-login",children:"Prospective User Login"})]})]})}),e.jsx("div",{className:"text-center mt-6 text-slate-400",children:e.jsx("p",{children:"© 2026 Royal Enfield. All rights reserved."})})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-2xl p-8 overflow-y-auto max-h-[800px]",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-2",children:"Test User Credentials"}),e.jsx("p",{className:"text-slate-600",children:"Click on any user to auto-login"})]}),e.jsx("div",{className:"space-y-3",children:XI.map((R,P)=>e.jsxs("div",{className:"border border-slate-200 rounded-lg p-4 hover:border-re-red hover:bg-red-50 transition-all cursor-pointer",onClick:()=>S(R.email,R.password),children:[e.jsx("div",{className:"flex items-start justify-between mb-2",children:e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"flex items-center gap-2 mb-1",children:e.jsx("span",{className:"px-2 py-1 bg-red-100 text-re-red rounded text-xs",children:R.role})}),e.jsx("p",{className:"text-slate-900",children:R.name})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-slate-500",children:"Email:"}),e.jsx("p",{className:"text-slate-900 font-mono break-all",children:R.email})]}),e.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),N(R.email,P*2)},className:"p-2 hover:bg-slate-100 rounded",children:g===P*2?e.jsx(Bn,{className:"w-4 h-4 text-green-600"}):e.jsx(cw,{className:"w-4 h-4 text-slate-400"})})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-slate-500",children:"Password:"}),e.jsx("p",{className:"text-slate-900 font-mono",children:R.password})]}),e.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),N(R.password,P*2+1)},className:"p-2 hover:bg-slate-100 rounded",children:g===P*2+1?e.jsx(Bn,{className:"w-4 h-4 text-green-600"}):e.jsx(cw,{className:"w-4 h-4 text-slate-400"})})]})]}),e.jsx("div",{className:"mt-3 pt-3 border-t border-slate-200",children:e.jsxs("p",{className:"text-re-red text-center",children:["Click to login as ",R.role]})})]},R.email))})]})]})]})}function eL(){const t=qn(),s=su(),[n,r]=v.useState("PHONE"),[a,l]=v.useState(""),[c,d]=v.useState(""),[h,x]=v.useState(!1),[f,m]=v.useState(""),p=async j=>{var g;if(j.preventDefault(),!a||a.length<10){m("Please enter a valid 10-digit phone number");return}x(!0),m("");try{const y=await Te.sendOtp(a);if(y.ok)r("OTP"),ee.success("OTP sent successfully!");else{console.error("Send OTP error response:",y);const N=((g=y.data)==null?void 0:g.message)||"Failed to send OTP";m(N),ee.error(N)}}catch(y){console.error("Send OTP network error:",y),m("Network error. Please try again."),ee.error("Network error. Please try again.")}finally{x(!1)}},u=async j=>{var g;if(j.preventDefault(),!c||c.length<6){m("Please enter a valid 6-digit OTP");return}x(!0),m("");try{const y=await Te.verifyOtp(a,c);if(y.ok&&y.data){const{token:N,user:S}=y.data.data||y.data;if(!N||!S)throw new Error("Invalid response format");s(JC({user:S,token:N})),localStorage.setItem("token",N),ee.success("Logged in successfully!"),t("/prospective-dashboard")}else{const N=((g=y.data)==null?void 0:g.message)||"Invalid OTP";m(N),ee.error(N)}}catch(y){console.error("Verify OTP error:",y),m("An unexpected error occurred"),ee.error("An unexpected error occurred")}finally{x(!1)}};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 p-4 overflow-y-auto",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute -top-40 -right-40 w-80 h-80 bg-amber-600/10 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-80 h-80 bg-amber-600/10 rounded-full blur-3xl"})]}),e.jsxs("div",{className:"relative w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 bg-amber-600 rounded-full mb-4",children:e.jsxs("svg",{viewBox:"0 0 24 24",className:"w-12 h-12 text-white",fill:"currentColor",children:[e.jsx("path",{d:"M12 2L4 6v6c0 5.5 3.8 10.7 8 12 4.2-1.3 8-6.5 8-12V6l-8-4zm0 2.2l6 3v4.8c0 4.5-3.1 8.7-6 10-2.9-1.3-6-5.5-6-10V7.2l6-3z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),e.jsx("h1",{className:"text-white mb-2",children:"Royal Enfield"}),e.jsx("p",{className:"text-slate-400",children:"Dealer Login"})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-2xl p-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs(se,{variant:"ghost",className:"px-0 flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-4 hover:bg-transparent",onClick:()=>n==="OTP"?r("PHONE"):t("/admin-login"),children:[e.jsx($r,{className:"w-4 h-4"}),n==="OTP"?"Change Phone Number":"Back to Login"]}),e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-amber-100 rounded-lg",children:e.jsx(uI,{className:"w-6 h-6 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-slate-900 text-lg font-semibold",children:"Dealer Login"}),e.jsx("p",{className:"text-slate-600 text-sm",children:"Login with your registered phone number"})]})]})]}),n==="PHONE"?e.jsxs("form",{onSubmit:p,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"phone",children:"Registered Phone Number"}),e.jsx(ot,{id:"phone",type:"tel",placeholder:"Enter 10-digit phone number",maxLength:10,value:a,onChange:j=>l(j.target.value.replace(/\D/g,"")),className:"w-full",disabled:h}),e.jsx("p",{className:"text-slate-500 text-xs",children:"Enter the phone number you used during application"})]}),f&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-200 rounded-md",children:[e.jsx(Ks,{className:"w-4 h-4 text-red-600"}),e.jsx("span",{className:"text-red-600 font-medium text-sm",children:f})]}),e.jsx(se,{type:"submit",className:"w-full bg-amber-600 hover:bg-amber-700 h-9",disabled:h||a.length<10,children:h?"Sending...":"Send OTP"}),e.jsx("div",{className:"text-center text-slate-500 text-xs",children:e.jsx("p",{children:"You will receive a 6-digit OTP on your registered mobile number"})})]}):e.jsxs("form",{onSubmit:u,className:"space-y-6",children:[e.jsx("div",{className:"p-4 bg-green-50 border border-green-200 rounded-lg",children:e.jsxs("p",{className:"text-green-800 text-center text-sm",children:["OTP sent to +91 ",a]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"otp",children:"Enter OTP"}),e.jsx(ot,{id:"otp",type:"text",placeholder:"Enter 6-digit OTP",maxLength:6,value:c,onChange:j=>d(j.target.value.replace(/\D/g,"")),className:"w-full text-center text-2xl tracking-widest",disabled:h}),e.jsx("p",{className:"text-slate-500 text-xs text-center",children:"Check your SMS for the OTP"})]}),f&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-200 rounded-md",children:[e.jsx(Ks,{className:"w-4 h-4 text-red-600"}),e.jsx("span",{className:"text-red-600 font-medium text-sm",children:f})]}),e.jsx(se,{type:"submit",className:"w-full bg-amber-600 hover:bg-amber-700 h-9",disabled:h||c.length<6,children:h?"Verifying...":"Verify OTP"}),e.jsxs("div",{className:"text-center text-sm",children:[e.jsx("button",{type:"button",className:"text-amber-600 hover:text-amber-700 font-medium",onClick:()=>r("PHONE"),children:"Change Phone Number"}),e.jsx("span",{className:"mx-2 text-slate-400",children:"|"}),e.jsx("button",{type:"button",className:"text-amber-600 hover:text-amber-700 font-medium",onClick:p,disabled:h,children:"Resend OTP"})]})]})]}),e.jsx("div",{className:"text-center mt-6 text-slate-400",children:e.jsx("p",{children:"© 2025 Royal Enfield. All rights reserved."})})]})]})}function tL({onLogout:t}){const s=qn(),r=Ul().pathname.substring(1)||"dashboard",{user:a}=Nn(G=>G.auth),[l,c]=v.useState(!1),[d,h]=v.useState(""),[x,f]=v.useState(!1),[m,p]=v.useState(!1),[u,j]=v.useState(null),g=v.useRef(null),y=(a==null?void 0:a.role)||(a==null?void 0:a.roleCode)||"",N=String(y).trim().toLowerCase(),S=G=>G.map(Z=>Z.toLowerCase()).includes(N),C=["DD Admin","ASM","RBM","DD Lead","ZBH","NBH","Legal","Legal Admin","Super Admin"],w=["ASM","RBM","ZBH","DD Lead","DD Head","NBH","Legal Admin","Legal","DD Admin","CCO","CEO","Super Admin"],R=["DD Admin","DD Lead","NBH","Finance","Finance Admin","Super Admin"],P=S(C),A=S(w),I=S(R),$=[P?{id:"resignation",label:"Resignation"}:null,A?{id:"termination",label:"Termination"}:null,I?{id:"fnf",label:"F&F"}:null].filter(Boolean),T=S(["Finance","Finance Admin"])?[{id:"dashboard",label:"Dashboard",icon:kh},{id:"finance-onboarding",label:"Onboarding",icon:fs},{id:"finance-fnf",label:"F&F",icon:kx}]:S(["Dealer"])?[{id:"dashboard",label:"Dashboard",icon:kh},{id:"dealer-resignation",label:"My Resignations",icon:kx},{id:"dealer-constitutional",label:"Constitutional Change",icon:Ki},{id:"dealer-relocation",label:"Relocation Requests",icon:Er}]:S(["FDD"])?[{id:"fdd-dashboard",label:"FDD Dashboard",icon:kh}]:[{id:"dashboard",label:"Dashboard",icon:kh},{id:"applications",label:"Dealership Requests",icon:fs},...$.length>0?[{id:"offboarding",label:"Offboarding",icon:kx,hasSubmenu:!0,submenuKey:"offboarding",submenu:$}]:[],{id:"constitutional-change",label:"Constitutional Change",icon:Ki},{id:"relocation-requests",label:"Relocation Requests",icon:Er}];S(["DD Lead","DD Admin","Super Admin"])&&T.splice(1,0,{id:"all-requests",label:"All Requests",icon:eI,hasSubmenu:!0,submenuKey:"allRequests",submenu:[{id:"opportunity-requests",label:"Opportunity Requests"},{id:"non-opportunities",label:"Non-opportunities"}]}),S(["Super Admin","DD Admin","DD Lead"])&&(T.push({id:"master",label:"Master",icon:Sc}),T.push({id:"sla-configurations",label:"SLA Matrix",icon:Ki})),S(["Super Admin"])&&(T.push({id:"users",label:"User Management",icon:da}),T.push({id:"questionnaires",label:"Questionnaire Templates",icon:Fo}),T.push({id:"interview-configs",label:"Interview Configs",icon:aI}));const E=G=>{G.preventDefault(),d.trim()&&s("/applications")},_=v.useCallback((G,Z)=>{g.current&&clearTimeout(g.current);const W=Z.getBoundingClientRect();j({submenuKey:G,top:W.top,left:W.right+8})},[]),M=v.useCallback((G=!1)=>{G?(g.current&&clearTimeout(g.current),j(null)):g.current=setTimeout(()=>j(null),150)},[]),q=v.useCallback(()=>{g.current&&clearTimeout(g.current)},[]);return v.useEffect(()=>{l||j(null)},[l]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`bg-black text-white h-screen flex flex-col transition-all duration-300 overflow-hidden relative flex-shrink-0 ${l?"w-20":"w-64"}`,children:[e.jsx("div",{className:"border-b border-white/10",children:l?e.jsxs("div",{className:"flex flex-col items-center py-3 gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-white flex items-center justify-center p-1 shadow-md",children:e.jsx("img",{src:"/assets/images/Re_Logo.png",alt:"RE",className:"w-full h-full object-contain"})}),e.jsx("button",{onClick:()=>c(!1),className:"p-1.5 hover:bg-white/10 rounded-lg transition-colors text-slate-400 hover:text-white",title:"Expand sidebar",children:e.jsx(el,{className:"w-4 h-4"})})]}):e.jsxs("div",{className:"flex items-center justify-between px-4 py-4",children:[e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("img",{src:"/assets/images/Re_Logo.png",alt:"Royal Enfield",className:"h-6 w-auto"}),e.jsx("span",{className:"text-[10px] uppercase tracking-[0.2em] font-bold text-slate-400 mt-1 whitespace-nowrap",children:"Dealer Onboarding"})]}),e.jsx("button",{onClick:()=>c(!0),className:"p-1.5 hover:bg-white/10 rounded-lg transition-colors text-slate-400 hover:text-white flex-shrink-0 ml-2",title:"Collapse sidebar",children:e.jsx(qc,{className:"w-4 h-4"})})]})}),!l&&e.jsx("div",{className:"p-4 border-b border-white/10",children:e.jsxs("form",{onSubmit:E,className:"relative",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ot,{type:"text",placeholder:"Search applications...",value:d,onChange:G=>h(G.target.value),className:"w-full pl-10 bg-white/5 border-white/10 text-white placeholder:text-slate-500"})]})}),e.jsx("nav",{className:"flex-1 p-3 space-y-1 overflow-y-auto custom-scrollbar",children:T.map(G=>{var O,V;const Z=G.icon,W=r===G.id,z=!!G.hasSubmenu,F=z&&((O=G.submenu)==null?void 0:O.some(K=>r===K.id)),B=G.submenuKey,D=B==="offboarding"?x:B==="allRequests"?m:!1;return e.jsxs("div",{children:[e.jsxs("button",{onMouseEnter:K=>{l&&z&&B&&_(B,K.currentTarget)},onMouseLeave:()=>{l&&z&&M()},onClick:()=>{z?l?(c(!1),B==="offboarding"?f(!0):B==="allRequests"&&p(!0)):B==="offboarding"?f(!x):B==="allRequests"&&p(!m):s(`/${G.id}`)},className:`w-full flex items-center gap-3 px-3 py-3 rounded-lg transition-colors ${l?"justify-center":""} ${W||F?"bg-re-red text-white shadow-lg shadow-re-red/20":"text-slate-400 hover:bg-white/5 hover:text-white"}`,title:l?G.label:void 0,children:[e.jsx(Z,{className:"w-5 h-5 flex-shrink-0"}),!l&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex-1 text-left text-sm",children:G.label}),z&&(D?e.jsx($d,{className:"w-4 h-4 flex-shrink-0"}):e.jsx(la,{className:"w-4 h-4 flex-shrink-0"}))]})]}),z&&D&&!l&&e.jsx("div",{className:"ml-3 mt-1 space-y-1 border-l border-white/10 pl-3",children:(V=G.submenu)==null?void 0:V.map(K=>{const Y=r===K.id;return e.jsxs("button",{onClick:()=>s(`/${K.id}`),className:`w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-colors text-sm ${Y?"bg-re-red/20 text-re-red font-semibold":"text-slate-500 hover:bg-white/5 hover:text-white"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current flex-shrink-0"}),e.jsx("span",{children:K.label})]},K.id)})})]},G.id)})}),e.jsxs("div",{className:"p-4 border-t border-white/10 space-y-2",children:[!l&&a&&e.jsx("div",{className:"px-4 py-2 bg-white/5 rounded-lg mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-re-red rounded-full flex items-center justify-center font-bold flex-shrink-0",children:e.jsx("span",{children:a.name.charAt(0)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-semibold",children:a.name}),e.jsx("p",{className:"text-slate-500 truncate text-[11px] uppercase tracking-wider",children:a.role})]})]})}),l&&a&&e.jsx("div",{className:"flex justify-center mb-2",children:e.jsx("div",{className:"w-9 h-9 bg-re-red rounded-full flex items-center justify-center font-bold text-sm",title:a.name,children:e.jsx("span",{children:a.name.charAt(0)})})}),e.jsxs(se,{onClick:t,variant:"ghost",className:`w-full ${l?"px-2 justify-center":"justify-start"} text-slate-400 hover:bg-white/5 hover:text-white`,title:l?"Logout":void 0,children:[e.jsx($2,{className:"w-5 h-5 flex-shrink-0"}),!l&&e.jsx("span",{className:"ml-3",children:"Logout"})]})]})]}),u&&l&&(()=>{const G=T.find(Z=>Z.submenuKey===u.submenuKey);return!G||!G.submenu?null:qv.createPortal(e.jsxs("div",{style:{top:u.top,left:u.left},className:"fixed z-[9999] min-w-[200px] bg-gray-900 border border-white/10 rounded-xl shadow-2xl py-2",onMouseEnter:q,onMouseLeave:()=>M(),children:[e.jsx("div",{className:"px-4 py-1.5 text-xs font-bold uppercase tracking-widest text-slate-400 border-b border-white/10 mb-1",children:G.label}),G.submenu.map(Z=>{const W=r===Z.id;return e.jsxs("button",{onClick:()=>{s(`/${Z.id}`),M(!0)},className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-sm transition-colors ${W?"bg-re-red/20 text-re-red font-semibold":"text-slate-300 hover:bg-white/10 hover:text-white"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current flex-shrink-0"}),e.jsx("span",{children:Z.label})]},Z.id)})]}),document.body)})()]})}function xw(t){const s=sL(t),n=v.forwardRef((r,a)=>{const{children:l,...c}=r,d=v.Children.toArray(l),h=d.find(rL);if(h){const x=h.props.children,f=d.map(m=>m===h?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:m);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}function sL(t){const s=v.forwardRef((n,r)=>{const{children:a,...l}=n;if(v.isValidElement(a)){const c=iL(a),d=aL(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var nL=Symbol("radix.slottable");function rL(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===nL}function aL(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const h=l(...d);return a(...d),h}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function iL(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function eb(t){const s=t+"CollectionProvider",[n,r]=ea(s),[a,l]=n(s,{collectionRef:{current:null},itemMap:new Map}),c=g=>{const{scope:y,children:N}=g,S=gt.useRef(null),C=gt.useRef(new Map).current;return e.jsx(a,{scope:y,itemMap:C,collectionRef:S,children:N})};c.displayName=s;const d=t+"CollectionSlot",h=xw(d),x=gt.forwardRef((g,y)=>{const{scope:N,children:S}=g,C=l(d,N),w=Ms(y,C.collectionRef);return e.jsx(h,{ref:w,children:S})});x.displayName=d;const f=t+"CollectionItemSlot",m="data-radix-collection-item",p=xw(f),u=gt.forwardRef((g,y)=>{const{scope:N,children:S,...C}=g,w=gt.useRef(null),R=Ms(y,w),P=l(f,N);return gt.useEffect(()=>(P.itemMap.set(w,{ref:w,...C}),()=>void P.itemMap.delete(w))),e.jsx(p,{[m]:"",ref:R,children:S})});u.displayName=f;function j(g){const y=l(t+"CollectionConsumer",g);return gt.useCallback(()=>{const S=y.collectionRef.current;if(!S)return[];const C=Array.from(S.querySelectorAll(`[${m}]`));return Array.from(y.itemMap.values()).sort((P,A)=>C.indexOf(P.ref.current)-C.indexOf(A.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:c,Slot:x,ItemSlot:u},j,r]}var lL=v.createContext(void 0);function pu(t){const s=v.useContext(lL);return t||s||"ltr"}function dr(t){const s=v.useRef(t);return v.useEffect(()=>{s.current=t}),v.useMemo(()=>(...n)=>{var r;return(r=s.current)==null?void 0:r.call(s,...n)},[])}function oL(t,s=globalThis==null?void 0:globalThis.document){const n=dr(t);v.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return s.addEventListener("keydown",r,{capture:!0}),()=>s.removeEventListener("keydown",r,{capture:!0})},[n,s])}var cL="DismissableLayer",iv="dismissableLayer.update",dL="dismissableLayer.pointerDownOutside",uL="dismissableLayer.focusOutside",gw,U2=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zc=v.forwardRef((t,s)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:d,...h}=t,x=v.useContext(U2),[f,m]=v.useState(null),p=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,u]=v.useState({}),j=Ms(s,A=>m(A)),g=Array.from(x.layers),[y]=[...x.layersWithOutsidePointerEventsDisabled].slice(-1),N=g.indexOf(y),S=f?g.indexOf(f):-1,C=x.layersWithOutsidePointerEventsDisabled.size>0,w=S>=N,R=fL(A=>{const I=A.target,$=[...x.branches].some(T=>T.contains(I));!w||$||(a==null||a(A),c==null||c(A),A.defaultPrevented||d==null||d())},p),P=pL(A=>{const I=A.target;[...x.branches].some(T=>T.contains(I))||(l==null||l(A),c==null||c(A),A.defaultPrevented||d==null||d())},p);return oL(A=>{S===x.layers.size-1&&(r==null||r(A),!A.defaultPrevented&&d&&(A.preventDefault(),d()))},p),v.useEffect(()=>{if(f)return n&&(x.layersWithOutsidePointerEventsDisabled.size===0&&(gw=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),x.layersWithOutsidePointerEventsDisabled.add(f)),x.layers.add(f),vw(),()=>{n&&x.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=gw)}},[f,p,n,x]),v.useEffect(()=>()=>{f&&(x.layers.delete(f),x.layersWithOutsidePointerEventsDisabled.delete(f),vw())},[f,x]),v.useEffect(()=>{const A=()=>u({});return document.addEventListener(iv,A),()=>document.removeEventListener(iv,A)},[]),e.jsx(ps.div,{...h,ref:j,style:{pointerEvents:C?w?"auto":"none":void 0,...t.style},onFocusCapture:Vt(t.onFocusCapture,P.onFocusCapture),onBlurCapture:Vt(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Vt(t.onPointerDownCapture,R.onPointerDownCapture)})});zc.displayName=cL;var hL="DismissableLayerBranch",mL=v.forwardRef((t,s)=>{const n=v.useContext(U2),r=v.useRef(null),a=Ms(s,r);return v.useEffect(()=>{const l=r.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),e.jsx(ps.div,{...t,ref:a})});mL.displayName=hL;function fL(t,s=globalThis==null?void 0:globalThis.document){const n=dr(t),r=v.useRef(!1),a=v.useRef(()=>{});return v.useEffect(()=>{const l=d=>{if(d.target&&!r.current){let h=function(){V2(dL,n,x,{discrete:!0})};const x={originalEvent:d};d.pointerType==="touch"?(s.removeEventListener("click",a.current),a.current=h,s.addEventListener("click",a.current,{once:!0})):h()}else s.removeEventListener("click",a.current);r.current=!1},c=window.setTimeout(()=>{s.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(c),s.removeEventListener("pointerdown",l),s.removeEventListener("click",a.current)}},[s,n]),{onPointerDownCapture:()=>r.current=!0}}function pL(t,s=globalThis==null?void 0:globalThis.document){const n=dr(t),r=v.useRef(!1);return v.useEffect(()=>{const a=l=>{l.target&&!r.current&&V2(uL,n,{originalEvent:l},{discrete:!1})};return s.addEventListener("focusin",a),()=>s.removeEventListener("focusin",a)},[s,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function vw(){const t=new CustomEvent(iv);document.dispatchEvent(t)}function V2(t,s,n,{discrete:r}){const a=n.originalEvent.target,l=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});s&&a.addEventListener(t,s,{once:!0}),r?S2(a,l):a.dispatchEvent(l)}var Ex=0;function Qm(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??bw()),document.body.insertAdjacentElement("beforeend",t[1]??bw()),Ex++,()=>{Ex===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(s=>s.remove()),Ex--}},[])}function bw(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Dx="focusScope.autoFocusOnMount",Tx="focusScope.autoFocusOnUnmount",yw={bubbles:!1,cancelable:!0},xL="FocusScope",xu=v.forwardRef((t,s)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:l,...c}=t,[d,h]=v.useState(null),x=dr(a),f=dr(l),m=v.useRef(null),p=Ms(s,g=>h(g)),u=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let g=function(C){if(u.paused||!d)return;const w=C.target;d.contains(w)?m.current=w:El(m.current,{select:!0})},y=function(C){if(u.paused||!d)return;const w=C.relatedTarget;w!==null&&(d.contains(w)||El(m.current,{select:!0}))},N=function(C){if(document.activeElement===document.body)for(const R of C)R.removedNodes.length>0&&El(d)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const S=new MutationObserver(N);return d&&S.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),S.disconnect()}}},[r,d,u.paused]),v.useEffect(()=>{if(d){Nw.add(u);const g=document.activeElement;if(!d.contains(g)){const N=new CustomEvent(Dx,yw);d.addEventListener(Dx,x),d.dispatchEvent(N),N.defaultPrevented||(gL(NL(H2(d)),{select:!0}),document.activeElement===g&&El(d))}return()=>{d.removeEventListener(Dx,x),setTimeout(()=>{const N=new CustomEvent(Tx,yw);d.addEventListener(Tx,f),d.dispatchEvent(N),N.defaultPrevented||El(g??document.body,{select:!0}),d.removeEventListener(Tx,f),Nw.remove(u)},0)}}},[d,x,f,u]);const j=v.useCallback(g=>{if(!n&&!r||u.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,N=document.activeElement;if(y&&N){const S=g.currentTarget,[C,w]=vL(S);C&&w?!g.shiftKey&&N===w?(g.preventDefault(),n&&El(C,{select:!0})):g.shiftKey&&N===C&&(g.preventDefault(),n&&El(w,{select:!0})):N===S&&g.preventDefault()}},[n,r,u.paused]);return e.jsx(ps.div,{tabIndex:-1,...c,ref:p,onKeyDown:j})});xu.displayName=xL;function gL(t,{select:s=!1}={}){const n=document.activeElement;for(const r of t)if(El(r,{select:s}),document.activeElement!==n)return}function vL(t){const s=H2(t),n=jw(s,t),r=jw(s.reverse(),t);return[n,r]}function H2(t){const s=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)s.push(n.currentNode);return s}function jw(t,s){for(const n of t)if(!bL(n,{upTo:s}))return n}function bL(t,{upTo:s}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(s!==void 0&&t===s)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function yL(t){return t instanceof HTMLInputElement&&"select"in t}function El(t,{select:s=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&yL(t)&&s&&t.select()}}var Nw=jL();function jL(){let t=[];return{add(s){const n=t[0];s!==n&&(n==null||n.pause()),t=ww(t,s),t.unshift(s)},remove(s){var n;t=ww(t,s),(n=t[0])==null||n.resume()}}}function ww(t,s){const n=[...t],r=n.indexOf(s);return r!==-1&&n.splice(r,1),n}function NL(t){return t.filter(s=>s.tagName!=="A")}var wL=Om[" useId ".trim().toString()]||(()=>{}),SL=0;function hr(t){const[s,n]=v.useState(wL());return Zn(()=>{n(r=>r??String(SL++))},[t]),t||(s?`radix-${s}`:"")}const CL=["top","right","bottom","left"],Bl=Math.min,ia=Math.max,ym=Math.round,Eh=Math.floor,gi=t=>({x:t,y:t}),AL={left:"right",right:"left",bottom:"top",top:"bottom"};function lv(t,s,n){return ia(t,Bl(s,n))}function Qi(t,s){return typeof t=="function"?t(s):t}function Xi(t){return t.split("-")[0]}function Uc(t){return t.split("-")[1]}function tb(t){return t==="x"?"y":"x"}function sb(t){return t==="y"?"height":"width"}function xi(t){const s=t[0];return s==="t"||s==="b"?"y":"x"}function nb(t){return tb(xi(t))}function kL(t,s,n){n===void 0&&(n=!1);const r=Uc(t),a=nb(t),l=sb(a);let c=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return s.reference[l]>s.floating[l]&&(c=jm(c)),[c,jm(c)]}function RL(t){const s=jm(t);return[ov(t),s,ov(s)]}function ov(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Sw=["left","right"],Cw=["right","left"],EL=["top","bottom"],DL=["bottom","top"];function TL(t,s,n){switch(t){case"top":case"bottom":return n?s?Cw:Sw:s?Sw:Cw;case"left":case"right":return s?EL:DL;default:return[]}}function PL(t,s,n,r){const a=Uc(t);let l=TL(Xi(t),n==="start",r);return a&&(l=l.map(c=>c+"-"+a),s&&(l=l.concat(l.map(ov)))),l}function jm(t){const s=Xi(t);return AL[s]+t.slice(s.length)}function _L(t){return{top:0,right:0,bottom:0,left:0,...t}}function W2(t){return typeof t!="number"?_L(t):{top:t,right:t,bottom:t,left:t}}function Nm(t){const{x:s,y:n,width:r,height:a}=t;return{width:r,height:a,top:n,left:s,right:s+r,bottom:n+a,x:s,y:n}}function Aw(t,s,n){let{reference:r,floating:a}=t;const l=xi(s),c=nb(s),d=sb(c),h=Xi(s),x=l==="y",f=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,p=r[d]/2-a[d]/2;let u;switch(h){case"top":u={x:f,y:r.y-a.height};break;case"bottom":u={x:f,y:r.y+r.height};break;case"right":u={x:r.x+r.width,y:m};break;case"left":u={x:r.x-a.width,y:m};break;default:u={x:r.x,y:r.y}}switch(Uc(s)){case"start":u[c]-=p*(n&&x?-1:1);break;case"end":u[c]+=p*(n&&x?-1:1);break}return u}async function OL(t,s){var n;s===void 0&&(s={});const{x:r,y:a,platform:l,rects:c,elements:d,strategy:h}=t,{boundary:x="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:p=!1,padding:u=0}=Qi(s,t),j=W2(u),y=d[p?m==="floating"?"reference":"floating":m],N=Nm(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(y)))==null||n?y:y.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:x,rootBoundary:f,strategy:h})),S=m==="floating"?{x:r,y:a,width:c.floating.width,height:c.floating.height}:c.reference,C=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),w=await(l.isElement==null?void 0:l.isElement(C))?await(l.getScale==null?void 0:l.getScale(C))||{x:1,y:1}:{x:1,y:1},R=Nm(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:S,offsetParent:C,strategy:h}):S);return{top:(N.top-R.top+j.top)/w.y,bottom:(R.bottom-N.bottom+j.bottom)/w.y,left:(N.left-R.left+j.left)/w.x,right:(R.right-N.right+j.right)/w.x}}const IL=50,LL=async(t,s,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:l=[],platform:c}=n,d=c.detectOverflow?c:{...c,detectOverflow:OL},h=await(c.isRTL==null?void 0:c.isRTL(s));let x=await c.getElementRects({reference:t,floating:s,strategy:a}),{x:f,y:m}=Aw(x,r,h),p=r,u=0;const j={};for(let g=0;g({name:"arrow",options:t,async fn(s){const{x:n,y:r,placement:a,rects:l,platform:c,elements:d,middlewareData:h}=s,{element:x,padding:f=0}=Qi(t,s)||{};if(x==null)return{};const m=W2(f),p={x:n,y:r},u=nb(a),j=sb(u),g=await c.getDimensions(x),y=u==="y",N=y?"top":"left",S=y?"bottom":"right",C=y?"clientHeight":"clientWidth",w=l.reference[j]+l.reference[u]-p[u]-l.floating[j],R=p[u]-l.reference[u],P=await(c.getOffsetParent==null?void 0:c.getOffsetParent(x));let A=P?P[C]:0;(!A||!await(c.isElement==null?void 0:c.isElement(P)))&&(A=d.floating[C]||l.floating[j]);const I=w/2-R/2,$=A/2-g[j]/2-1,T=Bl(m[N],$),E=Bl(m[S],$),_=T,M=A-g[j]-E,q=A/2-g[j]/2+I,G=lv(_,q,M),Z=!h.arrow&&Uc(a)!=null&&q!==G&&l.reference[j]/2-(q<_?T:E)-g[j]/2<0,W=Z?q<_?q-_:q-M:0;return{[u]:p[u]+W,data:{[u]:G,centerOffset:q-G-W,...Z&&{alignmentOffset:W}},reset:Z}}}),FL=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(s){var n,r;const{placement:a,middlewareData:l,rects:c,initialPlacement:d,platform:h,elements:x}=s,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:p,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:g=!0,...y}=Qi(t,s);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const N=Xi(a),S=xi(d),C=Xi(d)===d,w=await(h.isRTL==null?void 0:h.isRTL(x.floating)),R=p||(C||!g?[jm(d)]:RL(d)),P=j!=="none";!p&&P&&R.push(...PL(d,g,j,w));const A=[d,...R],I=await h.detectOverflow(s,y),$=[];let T=((r=l.flip)==null?void 0:r.overflows)||[];if(f&&$.push(I[N]),m){const q=kL(a,c,w);$.push(I[q[0]],I[q[1]])}if(T=[...T,{placement:a,overflows:$}],!$.every(q=>q<=0)){var E,_;const q=(((E=l.flip)==null?void 0:E.index)||0)+1,G=A[q];if(G&&(!(m==="alignment"?S!==xi(G):!1)||T.every(z=>xi(z.placement)===S?z.overflows[0]>0:!0)))return{data:{index:q,overflows:T},reset:{placement:G}};let Z=(_=T.filter(W=>W.overflows[0]<=0).sort((W,z)=>W.overflows[1]-z.overflows[1])[0])==null?void 0:_.placement;if(!Z)switch(u){case"bestFit":{var M;const W=(M=T.filter(z=>{if(P){const F=xi(z.placement);return F===S||F==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(F=>F>0).reduce((F,B)=>F+B,0)]).sort((z,F)=>z[1]-F[1])[0])==null?void 0:M[0];W&&(Z=W);break}case"initialPlacement":Z=d;break}if(a!==Z)return{reset:{placement:Z}}}return{}}}};function kw(t,s){return{top:t.top-s.height,right:t.right-s.width,bottom:t.bottom-s.height,left:t.left-s.width}}function Rw(t){return CL.some(s=>t[s]>=0)}const BL=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(s){const{rects:n,platform:r}=s,{strategy:a="referenceHidden",...l}=Qi(t,s);switch(a){case"referenceHidden":{const c=await r.detectOverflow(s,{...l,elementContext:"reference"}),d=kw(c,n.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:Rw(d)}}}case"escaped":{const c=await r.detectOverflow(s,{...l,altBoundary:!0}),d=kw(c,n.floating);return{data:{escapedOffsets:d,escaped:Rw(d)}}}default:return{}}}}},G2=new Set(["left","top"]);async function $L(t,s){const{placement:n,platform:r,elements:a}=t,l=await(r.isRTL==null?void 0:r.isRTL(a.floating)),c=Xi(n),d=Uc(n),h=xi(n)==="y",x=G2.has(c)?-1:1,f=l&&h?-1:1,m=Qi(s,t);let{mainAxis:p,crossAxis:u,alignmentAxis:j}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return d&&typeof j=="number"&&(u=d==="end"?j*-1:j),h?{x:u*f,y:p*x}:{x:p*x,y:u*f}}const qL=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(s){var n,r;const{x:a,y:l,placement:c,middlewareData:d}=s,h=await $L(s,t);return c===((n=d.offset)==null?void 0:n.placement)&&(r=d.arrow)!=null&&r.alignmentOffset?{}:{x:a+h.x,y:l+h.y,data:{...h,placement:c}}}}},zL=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(s){const{x:n,y:r,placement:a,platform:l}=s,{mainAxis:c=!0,crossAxis:d=!1,limiter:h={fn:N=>{let{x:S,y:C}=N;return{x:S,y:C}}},...x}=Qi(t,s),f={x:n,y:r},m=await l.detectOverflow(s,x),p=xi(Xi(a)),u=tb(p);let j=f[u],g=f[p];if(c){const N=u==="y"?"top":"left",S=u==="y"?"bottom":"right",C=j+m[N],w=j-m[S];j=lv(C,j,w)}if(d){const N=p==="y"?"top":"left",S=p==="y"?"bottom":"right",C=g+m[N],w=g-m[S];g=lv(C,g,w)}const y=h.fn({...s,[u]:j,[p]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[u]:c,[p]:d}}}}}},UL=function(t){return t===void 0&&(t={}),{options:t,fn(s){const{x:n,y:r,placement:a,rects:l,middlewareData:c}=s,{offset:d=0,mainAxis:h=!0,crossAxis:x=!0}=Qi(t,s),f={x:n,y:r},m=xi(a),p=tb(m);let u=f[p],j=f[m];const g=Qi(d,s),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(h){const C=p==="y"?"height":"width",w=l.reference[p]-l.floating[C]+y.mainAxis,R=l.reference[p]+l.reference[C]-y.mainAxis;uR&&(u=R)}if(x){var N,S;const C=p==="y"?"width":"height",w=G2.has(Xi(a)),R=l.reference[m]-l.floating[C]+(w&&((N=c.offset)==null?void 0:N[m])||0)+(w?0:y.crossAxis),P=l.reference[m]+l.reference[C]+(w?0:((S=c.offset)==null?void 0:S[m])||0)-(w?y.crossAxis:0);jP&&(j=P)}return{[p]:u,[m]:j}}}},VL=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(s){var n,r;const{placement:a,rects:l,platform:c,elements:d}=s,{apply:h=()=>{},...x}=Qi(t,s),f=await c.detectOverflow(s,x),m=Xi(a),p=Uc(a),u=xi(a)==="y",{width:j,height:g}=l.floating;let y,N;m==="top"||m==="bottom"?(y=m,N=p===(await(c.isRTL==null?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(N=m,y=p==="end"?"top":"bottom");const S=g-f.top-f.bottom,C=j-f.left-f.right,w=Bl(g-f[y],S),R=Bl(j-f[N],C),P=!s.middlewareData.shift;let A=w,I=R;if((n=s.middlewareData.shift)!=null&&n.enabled.x&&(I=C),(r=s.middlewareData.shift)!=null&&r.enabled.y&&(A=S),P&&!p){const T=ia(f.left,0),E=ia(f.right,0),_=ia(f.top,0),M=ia(f.bottom,0);u?I=j-2*(T!==0||E!==0?T+E:ia(f.left,f.right)):A=g-2*(_!==0||M!==0?_+M:ia(f.top,f.bottom))}await h({...s,availableWidth:I,availableHeight:A});const $=await c.getDimensions(d.floating);return j!==$.width||g!==$.height?{reset:{rects:!0}}:{}}}};function Xm(){return typeof window<"u"}function Vc(t){return K2(t)?(t.nodeName||"").toLowerCase():"#document"}function ua(t){var s;return(t==null||(s=t.ownerDocument)==null?void 0:s.defaultView)||window}function wi(t){var s;return(s=(K2(t)?t.ownerDocument:t.document)||window.document)==null?void 0:s.documentElement}function K2(t){return Xm()?t instanceof Node||t instanceof ua(t).Node:!1}function Ja(t){return Xm()?t instanceof Element||t instanceof ua(t).Element:!1}function tl(t){return Xm()?t instanceof HTMLElement||t instanceof ua(t).HTMLElement:!1}function Ew(t){return!Xm()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ua(t).ShadowRoot}function gu(t){const{overflow:s,overflowX:n,overflowY:r,display:a}=ei(t);return/auto|scroll|overlay|hidden|clip/.test(s+r+n)&&a!=="inline"&&a!=="contents"}function HL(t){return/^(table|td|th)$/.test(Vc(t))}function Jm(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const WL=/transform|translate|scale|rotate|perspective|filter/,GL=/paint|layout|strict|content/,wo=t=>!!t&&t!=="none";let Px;function rb(t){const s=Ja(t)?ei(t):t;return wo(s.transform)||wo(s.translate)||wo(s.scale)||wo(s.rotate)||wo(s.perspective)||!ab()&&(wo(s.backdropFilter)||wo(s.filter))||WL.test(s.willChange||"")||GL.test(s.contain||"")}function KL(t){let s=$l(t);for(;tl(s)&&!Pc(s);){if(rb(s))return s;if(Jm(s))return null;s=$l(s)}return null}function ab(){return Px==null&&(Px=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Px}function Pc(t){return/^(html|body|#document)$/.test(Vc(t))}function ei(t){return ua(t).getComputedStyle(t)}function ef(t){return Ja(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $l(t){if(Vc(t)==="html")return t;const s=t.assignedSlot||t.parentNode||Ew(t)&&t.host||wi(t);return Ew(s)?s.host:s}function Y2(t){const s=$l(t);return Pc(s)?t.ownerDocument?t.ownerDocument.body:t.body:tl(s)&&gu(s)?s:Y2(s)}function Qd(t,s,n){var r;s===void 0&&(s=[]),n===void 0&&(n=!0);const a=Y2(t),l=a===((r=t.ownerDocument)==null?void 0:r.body),c=ua(a);if(l){const d=cv(c);return s.concat(c,c.visualViewport||[],gu(a)?a:[],d&&n?Qd(d):[])}else return s.concat(a,Qd(a,[],n))}function cv(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Z2(t){const s=ei(t);let n=parseFloat(s.width)||0,r=parseFloat(s.height)||0;const a=tl(t),l=a?t.offsetWidth:n,c=a?t.offsetHeight:r,d=ym(n)!==l||ym(r)!==c;return d&&(n=l,r=c),{width:n,height:r,$:d}}function ib(t){return Ja(t)?t:t.contextElement}function Cc(t){const s=ib(t);if(!tl(s))return gi(1);const n=s.getBoundingClientRect(),{width:r,height:a,$:l}=Z2(s);let c=(l?ym(n.width):n.width)/r,d=(l?ym(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!d||!Number.isFinite(d))&&(d=1),{x:c,y:d}}const YL=gi(0);function Q2(t){const s=ua(t);return!ab()||!s.visualViewport?YL:{x:s.visualViewport.offsetLeft,y:s.visualViewport.offsetTop}}function ZL(t,s,n){return s===void 0&&(s=!1),!n||s&&n!==ua(t)?!1:s}function Bo(t,s,n,r){s===void 0&&(s=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),l=ib(t);let c=gi(1);s&&(r?Ja(r)&&(c=Cc(r)):c=Cc(t));const d=ZL(l,n,r)?Q2(l):gi(0);let h=(a.left+d.x)/c.x,x=(a.top+d.y)/c.y,f=a.width/c.x,m=a.height/c.y;if(l){const p=ua(l),u=r&&Ja(r)?ua(r):r;let j=p,g=cv(j);for(;g&&r&&u!==j;){const y=Cc(g),N=g.getBoundingClientRect(),S=ei(g),C=N.left+(g.clientLeft+parseFloat(S.paddingLeft))*y.x,w=N.top+(g.clientTop+parseFloat(S.paddingTop))*y.y;h*=y.x,x*=y.y,f*=y.x,m*=y.y,h+=C,x+=w,j=ua(g),g=cv(j)}}return Nm({width:f,height:m,x:h,y:x})}function tf(t,s){const n=ef(t).scrollLeft;return s?s.left+n:Bo(wi(t)).left+n}function X2(t,s){const n=t.getBoundingClientRect(),r=n.left+s.scrollLeft-tf(t,n),a=n.top+s.scrollTop;return{x:r,y:a}}function QL(t){let{elements:s,rect:n,offsetParent:r,strategy:a}=t;const l=a==="fixed",c=wi(r),d=s?Jm(s.floating):!1;if(r===c||d&&l)return n;let h={scrollLeft:0,scrollTop:0},x=gi(1);const f=gi(0),m=tl(r);if((m||!m&&!l)&&((Vc(r)!=="body"||gu(c))&&(h=ef(r)),m)){const u=Bo(r);x=Cc(r),f.x=u.x+r.clientLeft,f.y=u.y+r.clientTop}const p=c&&!m&&!l?X2(c,h):gi(0);return{width:n.width*x.x,height:n.height*x.y,x:n.x*x.x-h.scrollLeft*x.x+f.x+p.x,y:n.y*x.y-h.scrollTop*x.y+f.y+p.y}}function XL(t){return Array.from(t.getClientRects())}function JL(t){const s=wi(t),n=ef(t),r=t.ownerDocument.body,a=ia(s.scrollWidth,s.clientWidth,r.scrollWidth,r.clientWidth),l=ia(s.scrollHeight,s.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+tf(t);const d=-n.scrollTop;return ei(r).direction==="rtl"&&(c+=ia(s.clientWidth,r.clientWidth)-a),{width:a,height:l,x:c,y:d}}const Dw=25;function e6(t,s){const n=ua(t),r=wi(t),a=n.visualViewport;let l=r.clientWidth,c=r.clientHeight,d=0,h=0;if(a){l=a.width,c=a.height;const f=ab();(!f||f&&s==="fixed")&&(d=a.offsetLeft,h=a.offsetTop)}const x=tf(r);if(x<=0){const f=r.ownerDocument,m=f.body,p=getComputedStyle(m),u=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,j=Math.abs(r.clientWidth-m.clientWidth-u);j<=Dw&&(l-=j)}else x<=Dw&&(l+=x);return{width:l,height:c,x:d,y:h}}function t6(t,s){const n=Bo(t,!0,s==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,l=tl(t)?Cc(t):gi(1),c=t.clientWidth*l.x,d=t.clientHeight*l.y,h=a*l.x,x=r*l.y;return{width:c,height:d,x:h,y:x}}function Tw(t,s,n){let r;if(s==="viewport")r=e6(t,n);else if(s==="document")r=JL(wi(t));else if(Ja(s))r=t6(s,n);else{const a=Q2(t);r={x:s.x-a.x,y:s.y-a.y,width:s.width,height:s.height}}return Nm(r)}function J2(t,s){const n=$l(t);return n===s||!Ja(n)||Pc(n)?!1:ei(n).position==="fixed"||J2(n,s)}function s6(t,s){const n=s.get(t);if(n)return n;let r=Qd(t,[],!1).filter(d=>Ja(d)&&Vc(d)!=="body"),a=null;const l=ei(t).position==="fixed";let c=l?$l(t):t;for(;Ja(c)&&!Pc(c);){const d=ei(c),h=rb(c);!h&&d.position==="fixed"&&(a=null),(l?!h&&!a:!h&&d.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||gu(c)&&!h&&J2(t,c))?r=r.filter(f=>f!==c):a=d,c=$l(c)}return s.set(t,r),r}function n6(t){let{element:s,boundary:n,rootBoundary:r,strategy:a}=t;const c=[...n==="clippingAncestors"?Jm(s)?[]:s6(s,this._c):[].concat(n),r],d=Tw(s,c[0],a);let h=d.top,x=d.right,f=d.bottom,m=d.left;for(let p=1;p{c(!1,1e-7)},1e3)}A===1&&!tA(x,t.getBoundingClientRect())&&c(),w=!1}try{n=new IntersectionObserver(R,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(R,C)}n.observe(t)}return c(!0),l}function d6(t,s,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,x=ib(t),f=a||l?[...x?Qd(x):[],...s?Qd(s):[]]:[];f.forEach(N=>{a&&N.addEventListener("scroll",n,{passive:!0}),l&&N.addEventListener("resize",n)});const m=x&&d?c6(x,n):null;let p=-1,u=null;c&&(u=new ResizeObserver(N=>{let[S]=N;S&&S.target===x&&u&&s&&(u.unobserve(s),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var C;(C=u)==null||C.observe(s)})),n()}),x&&!h&&u.observe(x),s&&u.observe(s));let j,g=h?Bo(t):null;h&&y();function y(){const N=Bo(t);g&&!tA(g,N)&&n(),g=N,j=requestAnimationFrame(y)}return n(),()=>{var N;f.forEach(S=>{a&&S.removeEventListener("scroll",n),l&&S.removeEventListener("resize",n)}),m==null||m(),(N=u)==null||N.disconnect(),u=null,h&&cancelAnimationFrame(j)}}const u6=qL,h6=zL,m6=FL,f6=VL,p6=BL,_w=ML,x6=UL,g6=(t,s,n)=>{const r=new Map,a={platform:o6,...n},l={...a.platform,_c:r};return LL(t,s,{...a,platform:l})};var v6=typeof document<"u",b6=function(){},Xh=v6?v.useLayoutEffect:b6;function wm(t,s){if(t===s)return!0;if(typeof t!=typeof s)return!1;if(typeof t=="function"&&t.toString()===s.toString())return!0;let n,r,a;if(t&&s&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==s.length)return!1;for(r=n;r--!==0;)if(!wm(t[r],s[r]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(s).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(s,a[r]))return!1;for(r=n;r--!==0;){const l=a[r];if(!(l==="_owner"&&t.$$typeof)&&!wm(t[l],s[l]))return!1}return!0}return t!==t&&s!==s}function sA(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Ow(t,s){const n=sA(t);return Math.round(s*n)/n}function Ox(t){const s=v.useRef(t);return Xh(()=>{s.current=t}),s}function y6(t){t===void 0&&(t={});const{placement:s="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:l,floating:c}={},transform:d=!0,whileElementsMounted:h,open:x}=t,[f,m]=v.useState({x:0,y:0,strategy:n,placement:s,middlewareData:{},isPositioned:!1}),[p,u]=v.useState(r);wm(p,r)||u(r);const[j,g]=v.useState(null),[y,N]=v.useState(null),S=v.useCallback(z=>{z!==P.current&&(P.current=z,g(z))},[]),C=v.useCallback(z=>{z!==A.current&&(A.current=z,N(z))},[]),w=l||j,R=c||y,P=v.useRef(null),A=v.useRef(null),I=v.useRef(f),$=h!=null,T=Ox(h),E=Ox(a),_=Ox(x),M=v.useCallback(()=>{if(!P.current||!A.current)return;const z={placement:s,strategy:n,middleware:p};E.current&&(z.platform=E.current),g6(P.current,A.current,z).then(F=>{const B={...F,isPositioned:_.current!==!1};q.current&&!wm(I.current,B)&&(I.current=B,cu.flushSync(()=>{m(B)}))})},[p,s,n,E,_]);Xh(()=>{x===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,m(z=>({...z,isPositioned:!1})))},[x]);const q=v.useRef(!1);Xh(()=>(q.current=!0,()=>{q.current=!1}),[]),Xh(()=>{if(w&&(P.current=w),R&&(A.current=R),w&&R){if(T.current)return T.current(w,R,M);M()}},[w,R,M,T,$]);const G=v.useMemo(()=>({reference:P,floating:A,setReference:S,setFloating:C}),[S,C]),Z=v.useMemo(()=>({reference:w,floating:R}),[w,R]),W=v.useMemo(()=>{const z={position:n,left:0,top:0};if(!Z.floating)return z;const F=Ow(Z.floating,f.x),B=Ow(Z.floating,f.y);return d?{...z,transform:"translate("+F+"px, "+B+"px)",...sA(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:B}},[n,d,Z.floating,f.x,f.y]);return v.useMemo(()=>({...f,update:M,refs:G,elements:Z,floatingStyles:W}),[f,M,G,Z,W])}const j6=t=>{function s(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:a}=typeof t=="function"?t(n):t;return r&&s(r)?r.current!=null?_w({element:r.current,padding:a}).fn(n):{}:r?_w({element:r,padding:a}).fn(n):{}}}},N6=(t,s)=>{const n=u6(t);return{name:n.name,fn:n.fn,options:[t,s]}},w6=(t,s)=>{const n=h6(t);return{name:n.name,fn:n.fn,options:[t,s]}},S6=(t,s)=>({fn:x6(t).fn,options:[t,s]}),C6=(t,s)=>{const n=m6(t);return{name:n.name,fn:n.fn,options:[t,s]}},A6=(t,s)=>{const n=f6(t);return{name:n.name,fn:n.fn,options:[t,s]}},k6=(t,s)=>{const n=p6(t);return{name:n.name,fn:n.fn,options:[t,s]}},R6=(t,s)=>{const n=j6(t);return{name:n.name,fn:n.fn,options:[t,s]}};var E6="Arrow",nA=v.forwardRef((t,s)=>{const{children:n,width:r=10,height:a=5,...l}=t;return e.jsx(ps.svg,{...l,ref:s,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});nA.displayName=E6;var D6=nA,lb="Popper",[rA,Vl]=ea(lb),[T6,aA]=rA(lb),iA=t=>{const{__scopePopper:s,children:n}=t,[r,a]=v.useState(null);return e.jsx(T6,{scope:s,anchor:r,onAnchorChange:a,children:n})};iA.displayName=lb;var lA="PopperAnchor",oA=v.forwardRef((t,s)=>{const{__scopePopper:n,virtualRef:r,...a}=t,l=aA(lA,n),c=v.useRef(null),d=Ms(s,c),h=v.useRef(null);return v.useEffect(()=>{const x=h.current;h.current=(r==null?void 0:r.current)||c.current,x!==h.current&&l.onAnchorChange(h.current)}),r?null:e.jsx(ps.div,{...a,ref:d})});oA.displayName=lA;var ob="PopperContent",[P6,_6]=rA(ob),cA=v.forwardRef((t,s)=>{var X,ne,oe,re,ge,ve;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:l="center",alignOffset:c=0,arrowPadding:d=0,avoidCollisions:h=!0,collisionBoundary:x=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:p=!1,updatePositionStrategy:u="optimized",onPlaced:j,...g}=t,y=aA(ob,n),[N,S]=v.useState(null),C=Ms(s,Se=>S(Se)),[w,R]=v.useState(null),P=Gv(w),A=(P==null?void 0:P.width)??0,I=(P==null?void 0:P.height)??0,$=r+(l!=="center"?"-"+l:""),T=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},E=Array.isArray(x)?x:[x],_=E.length>0,M={padding:T,boundary:E.filter(I6),altBoundary:_},{refs:q,floatingStyles:G,placement:Z,isPositioned:W,middlewareData:z}=y6({strategy:"fixed",placement:$,whileElementsMounted:(...Se)=>d6(...Se,{animationFrame:u==="always"}),elements:{reference:y.anchor},middleware:[N6({mainAxis:a+I,alignmentAxis:c}),h&&w6({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?S6():void 0,...M}),h&&C6({...M}),A6({...M,apply:({elements:Se,rects:We,availableWidth:Ce,availableHeight:fe})=>{const{width:Ye,height:be}=We.reference,_e=Se.floating.style;_e.setProperty("--radix-popper-available-width",`${Ce}px`),_e.setProperty("--radix-popper-available-height",`${fe}px`),_e.setProperty("--radix-popper-anchor-width",`${Ye}px`),_e.setProperty("--radix-popper-anchor-height",`${be}px`)}}),w&&R6({element:w,padding:d}),L6({arrowWidth:A,arrowHeight:I}),p&&k6({strategy:"referenceHidden",...M})]}),[F,B]=hA(Z),D=dr(j);Zn(()=>{W&&(D==null||D())},[W,D]);const O=(X=z.arrow)==null?void 0:X.x,V=(ne=z.arrow)==null?void 0:ne.y,K=((oe=z.arrow)==null?void 0:oe.centerOffset)!==0,[Y,U]=v.useState();return Zn(()=>{N&&U(window.getComputedStyle(N).zIndex)},[N]),e.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:W?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[(re=z.transformOrigin)==null?void 0:re.x,(ge=z.transformOrigin)==null?void 0:ge.y].join(" "),...((ve=z.hide)==null?void 0:ve.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(P6,{scope:n,placedSide:F,onArrowChange:R,arrowX:O,arrowY:V,shouldHideArrow:K,children:e.jsx(ps.div,{"data-side":F,"data-align":B,...g,ref:C,style:{...g.style,animation:W?void 0:"none"}})})})});cA.displayName=ob;var dA="PopperArrow",O6={top:"bottom",right:"left",bottom:"top",left:"right"},uA=v.forwardRef(function(s,n){const{__scopePopper:r,...a}=s,l=_6(dA,r),c=O6[l.placedSide];return e.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:e.jsx(D6,{...a,ref:n,style:{...a.style,display:"block"}})})});uA.displayName=dA;function I6(t){return t!==null}var L6=t=>({name:"transformOrigin",options:t,fn(s){var y,N,S;const{placement:n,rects:r,middlewareData:a}=s,c=((y=a.arrow)==null?void 0:y.centerOffset)!==0,d=c?0:t.arrowWidth,h=c?0:t.arrowHeight,[x,f]=hA(n),m={start:"0%",center:"50%",end:"100%"}[f],p=(((N=a.arrow)==null?void 0:N.x)??0)+d/2,u=(((S=a.arrow)==null?void 0:S.y)??0)+h/2;let j="",g="";return x==="bottom"?(j=c?m:`${p}px`,g=`${-h}px`):x==="top"?(j=c?m:`${p}px`,g=`${r.floating.height+h}px`):x==="right"?(j=`${-h}px`,g=c?m:`${u}px`):x==="left"&&(j=`${r.floating.width+h}px`,g=c?m:`${u}px`),{data:{x:j,y:g}}}});function hA(t){const[s,n="center"]=t.split("-");return[s,n]}var sf=iA,vu=oA,nf=cA,rf=uA,M6="Portal",Hc=v.forwardRef((t,s)=>{var d;const{container:n,...r}=t,[a,l]=v.useState(!1);Zn(()=>l(!0),[]);const c=n||a&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return c?qv.createPortal(e.jsx(ps.div,{...r,ref:s}),c):null});Hc.displayName=M6;var Ix="rovingFocusGroup.onEntryFocus",F6={bubbles:!1,cancelable:!0},bu="RovingFocusGroup",[dv,mA,B6]=eb(bu),[$6,af]=ea(bu,[B6]),[q6,z6]=$6(bu),fA=v.forwardRef((t,s)=>e.jsx(dv.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(dv.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(U6,{...t,ref:s})})}));fA.displayName=bu;var U6=v.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:l,currentTabStopId:c,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:x,preventScrollOnEntryFocus:f=!1,...m}=t,p=v.useRef(null),u=Ms(s,p),j=pu(l),[g,y]=bi({prop:c,defaultProp:d??null,onChange:h,caller:bu}),[N,S]=v.useState(!1),C=dr(x),w=mA(n),R=v.useRef(!1),[P,A]=v.useState(0);return v.useEffect(()=>{const I=p.current;if(I)return I.addEventListener(Ix,C),()=>I.removeEventListener(Ix,C)},[C]),e.jsx(q6,{scope:n,orientation:r,dir:j,loop:a,currentTabStopId:g,onItemFocus:v.useCallback(I=>y(I),[y]),onItemShiftTab:v.useCallback(()=>S(!0),[]),onFocusableItemAdd:v.useCallback(()=>A(I=>I+1),[]),onFocusableItemRemove:v.useCallback(()=>A(I=>I-1),[]),children:e.jsx(ps.div,{tabIndex:N||P===0?-1:0,"data-orientation":r,...m,ref:u,style:{outline:"none",...t.style},onMouseDown:Vt(t.onMouseDown,()=>{R.current=!0}),onFocus:Vt(t.onFocus,I=>{const $=!R.current;if(I.target===I.currentTarget&&$&&!N){const T=new CustomEvent(Ix,F6);if(I.currentTarget.dispatchEvent(T),!T.defaultPrevented){const E=w().filter(Z=>Z.focusable),_=E.find(Z=>Z.active),M=E.find(Z=>Z.id===g),G=[_,M,...E].filter(Boolean).map(Z=>Z.ref.current);gA(G,f)}}R.current=!1}),onBlur:Vt(t.onBlur,()=>S(!1))})})}),pA="RovingFocusGroupItem",xA=v.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:l,children:c,...d}=t,h=hr(),x=l||h,f=z6(pA,n),m=f.currentTabStopId===x,p=mA(n),{onFocusableItemAdd:u,onFocusableItemRemove:j,currentTabStopId:g}=f;return v.useEffect(()=>{if(r)return u(),()=>j()},[r,u,j]),e.jsx(dv.ItemSlot,{scope:n,id:x,focusable:r,active:a,children:e.jsx(ps.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...d,ref:s,onMouseDown:Vt(t.onMouseDown,y=>{r?f.onItemFocus(x):y.preventDefault()}),onFocus:Vt(t.onFocus,()=>f.onItemFocus(x)),onKeyDown:Vt(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const N=W6(y,f.orientation,f.dir);if(N!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let C=p().filter(w=>w.focusable).map(w=>w.ref.current);if(N==="last")C.reverse();else if(N==="prev"||N==="next"){N==="prev"&&C.reverse();const w=C.indexOf(y.currentTarget);C=f.loop?G6(C,w+1):C.slice(w+1)}setTimeout(()=>gA(C))}}),children:typeof c=="function"?c({isCurrentTabStop:m,hasTabStop:g!=null}):c})})});xA.displayName=pA;var V6={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function H6(t,s){return s!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function W6(t,s,n){const r=H6(t.key,n);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return V6[r]}function gA(t,s=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:s}),document.activeElement!==n))return}function G6(t,s){return t.map((n,r)=>t[(s+r)%t.length])}var vA=fA,bA=xA;function K6(t){const s=Y6(t),n=v.forwardRef((r,a)=>{const{children:l,...c}=r,d=v.Children.toArray(l),h=d.find(Q6);if(h){const x=h.props.children,f=d.map(m=>m===h?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:m);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}function Y6(t){const s=v.forwardRef((n,r)=>{const{children:a,...l}=n;if(v.isValidElement(a)){const c=J6(a),d=X6(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var Z6=Symbol("radix.slottable");function Q6(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Z6}function X6(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const h=l(...d);return a(...d),h}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function J6(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var e3=function(t){if(typeof document>"u")return null;var s=Array.isArray(t)?t[0]:t;return s.ownerDocument.body},pc=new WeakMap,Dh=new WeakMap,Th={},Lx=0,yA=function(t){return t&&(t.host||yA(t.parentNode))},t3=function(t,s){return s.map(function(n){if(t.contains(n))return n;var r=yA(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},s3=function(t,s,n,r){var a=t3(s,Array.isArray(t)?t:[t]);Th[n]||(Th[n]=new WeakMap);var l=Th[n],c=[],d=new Set,h=new Set(a),x=function(m){!m||d.has(m)||(d.add(m),x(m.parentNode))};a.forEach(x);var f=function(m){!m||h.has(m)||Array.prototype.forEach.call(m.children,function(p){if(d.has(p))f(p);else try{var u=p.getAttribute(r),j=u!==null&&u!=="false",g=(pc.get(p)||0)+1,y=(l.get(p)||0)+1;pc.set(p,g),l.set(p,y),c.push(p),g===1&&j&&Dh.set(p,!0),y===1&&p.setAttribute(n,"true"),j||p.setAttribute(r,"true")}catch(N){console.error("aria-hidden: cannot operate on ",p,N)}})};return f(s),d.clear(),Lx++,function(){c.forEach(function(m){var p=pc.get(m)-1,u=l.get(m)-1;pc.set(m,p),l.set(m,u),p||(Dh.has(m)||m.removeAttribute(r),Dh.delete(m)),u||m.removeAttribute(n)}),Lx--,Lx||(pc=new WeakMap,pc=new WeakMap,Dh=new WeakMap,Th={})}},lf=function(t,s,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=e3(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),s3(r,a,n,"aria-hidden")):function(){return null}},pi=function(){return pi=Object.assign||function(s){for(var n,r=1,a=arguments.length;r"u")return b3;var s=y3(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:s[0],top:s[1],right:s[2],gap:Math.max(0,r-n+s[2]-s[0])}},N3=SA(),Ac="data-scroll-locked",w3=function(t,s,n,r){var a=t.left,l=t.top,c=t.right,d=t.gap;return n===void 0&&(n="margin"),` - .`.concat(r3,` { + */const pw=ft("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]);function Rn({className:t,...s}){return e.jsx(T2,{"data-slot":"checkbox",className:_t("peer border bg-input-background dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(P2,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:e.jsx(Bn,{className:"size-3.5"})})})}var SL=t=>{switch(t){case"success":return kL;case"info":return EL;case"warning":return RL;case"error":return DL;default:return null}},CL=Array(12).fill(0),AL=({visible:t,className:s})=>gt.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":t},gt.createElement("div",{className:"sonner-spinner"},CL.map((n,r)=>gt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),kL=gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},gt.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),RL=gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},gt.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),EL=gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},gt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),DL=gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},gt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),TL=gt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},gt.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),gt.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),_L=()=>{let[t,s]=gt.useState(document.hidden);return gt.useEffect(()=>{let n=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},ov=1,PL=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let s=this.subscribers.indexOf(t);this.subscribers.splice(s,1)}),this.publish=t=>{this.subscribers.forEach(s=>s(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var s;let{message:n,...r}=t,a=typeof(t==null?void 0:t.id)=="number"||((s=t.id)==null?void 0:s.length)>0?t.id:ov++,l=this.toasts.find(d=>d.id===a),c=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),l?this.toasts=this.toasts.map(d=>d.id===a?(this.publish({...d,...t,id:a,title:n}),{...d,...t,id:a,dismissible:c,title:n}):d):this.addToast({title:n,...r,dismissible:c,id:a}),a},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(s=>{this.subscribers.forEach(n=>n({id:s.id,dismiss:!0}))}),this.subscribers.forEach(s=>s({id:t,dismiss:!0})),t),this.message=(t,s)=>this.create({...s,message:t}),this.error=(t,s)=>this.create({...s,message:t,type:"error"}),this.success=(t,s)=>this.create({...s,type:"success",message:t}),this.info=(t,s)=>this.create({...s,type:"info",message:t}),this.warning=(t,s)=>this.create({...s,type:"warning",message:t}),this.loading=(t,s)=>this.create({...s,type:"loading",message:t}),this.promise=(t,s)=>{if(!s)return;let n;s.loading!==void 0&&(n=this.create({...s,promise:t,type:"loading",message:s.loading,description:typeof s.description!="function"?s.description:void 0}));let r=t instanceof Promise?t:t(),a=n!==void 0,l,c=r.then(async m=>{if(l=["resolve",m],gt.isValidElement(m))a=!1,this.create({id:n,type:"default",message:m});else if(LL(m)&&!m.ok){a=!1;let x=typeof s.error=="function"?await s.error(`HTTP error! status: ${m.status}`):s.error,f=typeof s.description=="function"?await s.description(`HTTP error! status: ${m.status}`):s.description;this.create({id:n,type:"error",message:x,description:f})}else if(s.success!==void 0){a=!1;let x=typeof s.success=="function"?await s.success(m):s.success,f=typeof s.description=="function"?await s.description(m):s.description;this.create({id:n,type:"success",message:x,description:f})}}).catch(async m=>{if(l=["reject",m],s.error!==void 0){a=!1;let x=typeof s.error=="function"?await s.error(m):s.error,f=typeof s.description=="function"?await s.description(m):s.description;this.create({id:n,type:"error",message:x,description:f})}}).finally(()=>{var m;a&&(this.dismiss(n),n=void 0),(m=s.finally)==null||m.call(s)}),d=()=>new Promise((m,x)=>c.then(()=>l[0]==="reject"?x(l[1]):m(l[1])).catch(x));return typeof n!="string"&&typeof n!="number"?{unwrap:d}:Object.assign(n,{unwrap:d})},this.custom=(t,s)=>{let n=(s==null?void 0:s.id)||ov++;return this.create({jsx:t(n),id:n,...s}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Qr=new PL,OL=(t,s)=>{let n=(s==null?void 0:s.id)||ov++;return Qr.addToast({title:t,...s,id:n}),n},LL=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",IL=OL,ML=()=>Qr.toasts,FL=()=>Qr.getActiveToasts(),ee=Object.assign(IL,{success:Qr.success,info:Qr.info,warning:Qr.warning,error:Qr.error,custom:Qr.custom,message:Qr.message,promise:Qr.promise,dismiss:Qr.dismiss,loading:Qr.loading},{getHistory:ML,getToasts:FL});function BL(t,{insertAt:s}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",s==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}BL(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} +`);function Rh(t){return t.label!==void 0}var $L=3,qL="32px",zL="16px",xw=4e3,UL=356,VL=14,HL=20,WL=200;function Va(...t){return t.filter(Boolean).join(" ")}function KL(t){let[s,n]=t.split("-"),r=[];return s&&r.push(s),n&&r.push(n),r}var GL=t=>{var s,n,r,a,l,c,d,m,x,f,h;let{invert:g,toast:u,unstyled:j,interacting:p,setHeights:y,visibleToasts:N,heights:S,index:A,toasts:w,expanded:E,removeToast:T,defaultRichColors:C,closeButton:L,style:$,cancelButtonStyle:_,actionButtonStyle:R,className:P="",descriptionClassName:M="",duration:q,position:K,gap:Z,loadingIcon:W,expandByDefault:U,classNames:F,icons:B,closeButtonAriaLabel:D="Close toast",pauseWhenPageIsHidden:O}=t,[z,G]=gt.useState(null),[Y,V]=gt.useState(null),[X,ne]=gt.useState(!1),[oe,re]=gt.useState(!1),[ge,ve]=gt.useState(!1),[Se,We]=gt.useState(!1),[Ce,fe]=gt.useState(!1),[Ye,be]=gt.useState(0),[Pe,ke]=gt.useState(0),qe=gt.useRef(u.duration||q||xw),Ve=gt.useRef(null),dt=gt.useRef(null),xt=A===0,ye=A+1<=N,le=u.type,Qe=u.dismissible!==!1,rt=u.className||"",Gt=u.descriptionClassName||"",Rt=gt.useMemo(()=>S.findIndex(Ee=>Ee.toastId===u.id)||0,[S,u.id]),Re=gt.useMemo(()=>{var Ee;return(Ee=u.closeButton)!=null?Ee:L},[u.closeButton,L]),Qt=gt.useMemo(()=>u.duration||q||xw,[u.duration,q]),qt=gt.useRef(0),ws=gt.useRef(0),Ps=gt.useRef(0),ns=gt.useRef(null),[Cs,Bs]=K.split("-"),Ft=gt.useMemo(()=>S.reduce((Ee,it,st)=>st>=Rt?Ee:Ee+it.height,0),[S,Rt]),ie=_L(),Fe=u.invert||g,Q=le==="loading";ws.current=gt.useMemo(()=>Rt*Z+Ft,[Rt,Ft]),gt.useEffect(()=>{qe.current=Qt},[Qt]),gt.useEffect(()=>{ne(!0)},[]),gt.useEffect(()=>{let Ee=dt.current;if(Ee){let it=Ee.getBoundingClientRect().height;return ke(it),y(st=>[{toastId:u.id,height:it,position:u.position},...st]),()=>y(st=>st.filter(bt=>bt.toastId!==u.id))}},[y,u.id]),gt.useLayoutEffect(()=>{if(!X)return;let Ee=dt.current,it=Ee.style.height;Ee.style.height="auto";let st=Ee.getBoundingClientRect().height;Ee.style.height=it,ke(st),y(bt=>bt.find(Ue=>Ue.toastId===u.id)?bt.map(Ue=>Ue.toastId===u.id?{...Ue,height:st}:Ue):[{toastId:u.id,height:st,position:u.position},...bt])},[X,u.title,u.description,y,u.id]);let pe=gt.useCallback(()=>{re(!0),be(ws.current),y(Ee=>Ee.filter(it=>it.toastId!==u.id)),setTimeout(()=>{T(u)},WL)},[u,T,y,ws]);gt.useEffect(()=>{if(u.promise&&le==="loading"||u.duration===1/0||u.type==="loading")return;let Ee;return E||p||O&&ie?(()=>{if(Ps.current{var it;(it=u.onAutoClose)==null||it.call(u,u),pe()},qe.current)),()=>clearTimeout(Ee)},[E,p,u,le,O,ie,pe]),gt.useEffect(()=>{u.delete&&pe()},[pe,u.delete]);function Ne(){var Ee,it,st;return B!=null&&B.loading?gt.createElement("div",{className:Va(F==null?void 0:F.loader,(Ee=u==null?void 0:u.classNames)==null?void 0:Ee.loader,"sonner-loader"),"data-visible":le==="loading"},B.loading):W?gt.createElement("div",{className:Va(F==null?void 0:F.loader,(it=u==null?void 0:u.classNames)==null?void 0:it.loader,"sonner-loader"),"data-visible":le==="loading"},W):gt.createElement(AL,{className:Va(F==null?void 0:F.loader,(st=u==null?void 0:u.classNames)==null?void 0:st.loader),visible:le==="loading"})}return gt.createElement("li",{tabIndex:0,ref:dt,className:Va(P,rt,F==null?void 0:F.toast,(s=u==null?void 0:u.classNames)==null?void 0:s.toast,F==null?void 0:F.default,F==null?void 0:F[le],(n=u==null?void 0:u.classNames)==null?void 0:n[le]),"data-sonner-toast":"","data-rich-colors":(r=u.richColors)!=null?r:C,"data-styled":!(u.jsx||u.unstyled||j),"data-mounted":X,"data-promise":!!u.promise,"data-swiped":Ce,"data-removed":oe,"data-visible":ye,"data-y-position":Cs,"data-x-position":Bs,"data-index":A,"data-front":xt,"data-swiping":ge,"data-dismissible":Qe,"data-type":le,"data-invert":Fe,"data-swipe-out":Se,"data-swipe-direction":Y,"data-expanded":!!(E||U&&X),style:{"--index":A,"--toasts-before":A,"--z-index":w.length-A,"--offset":`${oe?Ye:ws.current}px`,"--initial-height":U?"auto":`${Pe}px`,...$,...u.style},onDragEnd:()=>{ve(!1),G(null),ns.current=null},onPointerDown:Ee=>{Q||!Qe||(Ve.current=new Date,be(ws.current),Ee.target.setPointerCapture(Ee.pointerId),Ee.target.tagName!=="BUTTON"&&(ve(!0),ns.current={x:Ee.clientX,y:Ee.clientY}))},onPointerUp:()=>{var Ee,it,st,bt;if(Se||!Qe)return;ns.current=null;let Ue=Number(((Ee=dt.current)==null?void 0:Ee.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),It=Number(((it=dt.current)==null?void 0:it.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ut=new Date().getTime()-((st=Ve.current)==null?void 0:st.getTime()),yt=z==="x"?Ue:It,kt=Math.abs(yt)/ut;if(Math.abs(yt)>=HL||kt>.11){be(ws.current),(bt=u.onDismiss)==null||bt.call(u,u),V(z==="x"?Ue>0?"right":"left":It>0?"down":"up"),pe(),We(!0),fe(!1);return}ve(!1),G(null)},onPointerMove:Ee=>{var it,st,bt,Ue;if(!ns.current||!Qe||((it=window.getSelection())==null?void 0:it.toString().length)>0)return;let It=Ee.clientY-ns.current.y,ut=Ee.clientX-ns.current.x,yt=(st=t.swipeDirections)!=null?st:KL(K);!z&&(Math.abs(ut)>1||Math.abs(It)>1)&&G(Math.abs(ut)>Math.abs(It)?"x":"y");let kt={x:0,y:0};z==="y"?(yt.includes("top")||yt.includes("bottom"))&&(yt.includes("top")&&It<0||yt.includes("bottom")&&It>0)&&(kt.y=It):z==="x"&&(yt.includes("left")||yt.includes("right"))&&(yt.includes("left")&&ut<0||yt.includes("right")&&ut>0)&&(kt.x=ut),(Math.abs(kt.x)>0||Math.abs(kt.y)>0)&&fe(!0),(bt=dt.current)==null||bt.style.setProperty("--swipe-amount-x",`${kt.x}px`),(Ue=dt.current)==null||Ue.style.setProperty("--swipe-amount-y",`${kt.y}px`)}},Re&&!u.jsx?gt.createElement("button",{"aria-label":D,"data-disabled":Q,"data-close-button":!0,onClick:Q||!Qe?()=>{}:()=>{var Ee;pe(),(Ee=u.onDismiss)==null||Ee.call(u,u)},className:Va(F==null?void 0:F.closeButton,(a=u==null?void 0:u.classNames)==null?void 0:a.closeButton)},(l=B==null?void 0:B.close)!=null?l:TL):null,u.jsx||v.isValidElement(u.title)?u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title:gt.createElement(gt.Fragment,null,le||u.icon||u.promise?gt.createElement("div",{"data-icon":"",className:Va(F==null?void 0:F.icon,(c=u==null?void 0:u.classNames)==null?void 0:c.icon)},u.promise||u.type==="loading"&&!u.icon?u.icon||Ne():null,u.type!=="loading"?u.icon||(B==null?void 0:B[le])||SL(le):null):null,gt.createElement("div",{"data-content":"",className:Va(F==null?void 0:F.content,(d=u==null?void 0:u.classNames)==null?void 0:d.content)},gt.createElement("div",{"data-title":"",className:Va(F==null?void 0:F.title,(m=u==null?void 0:u.classNames)==null?void 0:m.title)},typeof u.title=="function"?u.title():u.title),u.description?gt.createElement("div",{"data-description":"",className:Va(M,Gt,F==null?void 0:F.description,(x=u==null?void 0:u.classNames)==null?void 0:x.description)},typeof u.description=="function"?u.description():u.description):null),v.isValidElement(u.cancel)?u.cancel:u.cancel&&Rh(u.cancel)?gt.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||_,onClick:Ee=>{var it,st;Rh(u.cancel)&&Qe&&((st=(it=u.cancel).onClick)==null||st.call(it,Ee),pe())},className:Va(F==null?void 0:F.cancelButton,(f=u==null?void 0:u.classNames)==null?void 0:f.cancelButton)},u.cancel.label):null,v.isValidElement(u.action)?u.action:u.action&&Rh(u.action)?gt.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||R,onClick:Ee=>{var it,st;Rh(u.action)&&((st=(it=u.action).onClick)==null||st.call(it,Ee),!Ee.defaultPrevented&&pe())},className:Va(F==null?void 0:F.actionButton,(h=u==null?void 0:u.classNames)==null?void 0:h.actionButton)},u.action.label):null))};function gw(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function YL(t,s){let n={};return[t,s].forEach((r,a)=>{let l=a===1,c=l?"--mobile-offset":"--offset",d=l?zL:qL;function m(x){["top","right","bottom","left"].forEach(f=>{n[`${c}-${f}`]=typeof x=="number"?`${x}px`:x})}typeof r=="number"||typeof r=="string"?m(r):typeof r=="object"?["top","right","bottom","left"].forEach(x=>{r[x]===void 0?n[`${c}-${x}`]=d:n[`${c}-${x}`]=typeof r[x]=="number"?`${r[x]}px`:r[x]}):m(d)}),n}var ZL=v.forwardRef(function(t,s){let{invert:n,position:r="bottom-right",hotkey:a=["altKey","KeyT"],expand:l,closeButton:c,className:d,offset:m,mobileOffset:x,theme:f="light",richColors:h,duration:g,style:u,visibleToasts:j=$L,toastOptions:p,dir:y=gw(),gap:N=VL,loadingIcon:S,icons:A,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:E}=t,[T,C]=gt.useState([]),L=gt.useMemo(()=>Array.from(new Set([r].concat(T.filter(O=>O.position).map(O=>O.position)))),[T,r]),[$,_]=gt.useState([]),[R,P]=gt.useState(!1),[M,q]=gt.useState(!1),[K,Z]=gt.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=gt.useRef(null),U=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),F=gt.useRef(null),B=gt.useRef(!1),D=gt.useCallback(O=>{C(z=>{var G;return(G=z.find(Y=>Y.id===O.id))!=null&&G.delete||Qr.dismiss(O.id),z.filter(({id:Y})=>Y!==O.id)})},[]);return gt.useEffect(()=>Qr.subscribe(O=>{if(O.dismiss){C(z=>z.map(G=>G.id===O.id?{...G,delete:!0}:G));return}setTimeout(()=>{Vv.flushSync(()=>{C(z=>{let G=z.findIndex(Y=>Y.id===O.id);return G!==-1?[...z.slice(0,G),{...z[G],...O},...z.slice(G+1)]:[O,...z]})})})}),[]),gt.useEffect(()=>{if(f!=="system"){Z(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Z("dark"):Z("light")),typeof window>"u")return;let O=window.matchMedia("(prefers-color-scheme: dark)");try{O.addEventListener("change",({matches:z})=>{Z(z?"dark":"light")})}catch{O.addListener(({matches:G})=>{try{Z(G?"dark":"light")}catch(Y){console.error(Y)}})}},[f]),gt.useEffect(()=>{T.length<=1&&P(!1)},[T]),gt.useEffect(()=>{let O=z=>{var G,Y;a.every(V=>z[V]||z.code===V)&&(P(!0),(G=W.current)==null||G.focus()),z.code==="Escape"&&(document.activeElement===W.current||(Y=W.current)!=null&&Y.contains(document.activeElement))&&P(!1)};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[a]),gt.useEffect(()=>{if(W.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,B.current=!1)}},[W.current]),gt.createElement("section",{ref:s,"aria-label":`${w} ${U}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},L.map((O,z)=>{var G;let[Y,V]=O.split("-");return T.length?gt.createElement("ol",{key:O,dir:y==="auto"?gw():y,tabIndex:-1,ref:W,className:d,"data-sonner-toaster":!0,"data-theme":K,"data-y-position":Y,"data-lifted":R&&T.length>1&&!l,"data-x-position":V,style:{"--front-toast-height":`${((G=$[0])==null?void 0:G.height)||0}px`,"--width":`${UL}px`,"--gap":`${N}px`,...u,...YL(m,x)},onBlur:X=>{B.current&&!X.currentTarget.contains(X.relatedTarget)&&(B.current=!1,F.current&&(F.current.focus({preventScroll:!0}),F.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||B.current||(B.current=!0,F.current=X.relatedTarget)},onMouseEnter:()=>P(!0),onMouseMove:()=>P(!0),onMouseLeave:()=>{M||P(!1)},onDragEnd:()=>P(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||q(!0)},onPointerUp:()=>q(!1)},T.filter(X=>!X.position&&z===0||X.position===O).map((X,ne)=>{var oe,re;return gt.createElement(GL,{key:X.id,icons:A,index:ne,toast:X,defaultRichColors:h,duration:(oe=p==null?void 0:p.duration)!=null?oe:g,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:n,visibleToasts:j,closeButton:(re=p==null?void 0:p.closeButton)!=null?re:c,interacting:M,position:O,style:p==null?void 0:p.style,unstyled:p==null?void 0:p.unstyled,classNames:p==null?void 0:p.classNames,cancelButtonStyle:p==null?void 0:p.cancelButtonStyle,actionButtonStyle:p==null?void 0:p.actionButtonStyle,removeToast:D,toasts:T.filter(ge=>ge.position==X.position),heights:$.filter(ge=>ge.position==X.position),setHeights:_,expandByDefault:l,gap:N,loadingIcon:S,expanded:R,pauseWhenPageIsHidden:E,swipeDirections:t.swipeDirections})})):null}))});const ds={submitApplication:async t=>{var n;const s=await Te.submitApplication(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to submit application");return s.data},getApplications:async t=>{var n;const s=await Te.getApplications(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch applications");return s.data},shortlistApplications:async(t,s,n)=>{var a;const r=await Te.shortlistApplications({applicationIds:t,assignedTo:s,remarks:n});if(!r.ok)throw new Error(((a=r.data)==null?void 0:a.message)||"Failed to shortlist applications");return r.data},getApplicationById:async t=>{var n,r;const s=await Te.getApplicationById(t);if(!s.ok)throw console.error("API Error Response:",s.status,s.data),new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch application details");return((r=s.data)==null?void 0:r.data)||s.data},getUsers:async t=>{var n,r;const s=await Te.getUsers(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch users");return((r=s.data)==null?void 0:r.data)||s.data},addParticipant:async t=>{var n;const s=await Te.addParticipant(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to add participant");return s.data},scheduleInterview:async t=>{var n;const s=await Te.scheduleInterview(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to schedule interview");return s.data},updateInterview:async(t,s)=>{var r;const n=await Te.updateInterview(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to update interview");return n.data},getInterviews:async t=>{var r,a;const s=await Te.getInterviews(t);if(!s.ok)throw new Error(((r=s.data)==null?void 0:r.message)||"Failed to fetch interviews");const n=((a=s.data)==null?void 0:a.data)||s.data;return Array.isArray(n)?n:[]},getDocuments:async t=>{var n,r;const s=await Te.getDocuments(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch documents");return((r=s.data)==null?void 0:r.data)||s.data},uploadDocument:async(t,s)=>{var r;const n=await Te.uploadDocument(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to upload document");return n.data},submitKTMatrix:async t=>{var n;const s=await Te.submitKTMatrix(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to submit KT Matrix");return s.data},submitLevel2Feedback:async t=>{var n;const s=await Te.submitLevel2Feedback(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to submit feedback");return s.data},updateRecommendation:async t=>{var n;const s=await Te.updateRecommendation(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to update recommendation");return s.data},submitStageDecision:async t=>{var n;const s=await Te.submitStageDecision(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to process stage decision");return s.data},updateInterviewDecision:async t=>{var n;const s=await Te.updateInterviewDecision(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to update interview decision");return s.data},assignArchitectureTeam:async(t,s)=>{var r;const n=await Te.assignArchitectureTeam(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to assign architecture team");return n.data},updateArchitectureStatus:async(t,s,n)=>{var a;const r=await Te.updateArchitectureStatus(t,s,n);if(!r.ok)throw new Error(((a=r.data)==null?void 0:a.message)||"Failed to update architecture status");return r.data},generateDealerCodes:async t=>{var n;const s=await Te.generateDealerCodes(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to generate dealer codes");return s.data},updateApplicationStatus:async(t,s)=>{var r;const n=await Te.updateApplicationStatus(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to update application status");return n.data},convertToOpportunity:async(t,s)=>{var r;const n=await Te.convertToOpportunity(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to convert application to opportunity");return n.data},bulkConvertToOpportunity:async t=>{var n;const s=await Te.bulkConvertToOpportunity(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to perform bulk conversion");return s.data},createDealer:async t=>{var n;const s=await Te.createDealer(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to create dealer profile");return s.data},retriggerEvaluators:async t=>{var n;const s=await Te.retriggerEvaluators(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to retrigger evaluators");return s.data},getSecurityDeposit:async t=>{var n,r;const s=await Te.getSecurityDeposit(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch security deposit");return((r=s.data)==null?void 0:r.data)||s.data},updateSecurityDeposit:async t=>{var n;const s=await Te.updateSecurityDeposit(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to update security deposit");return s.data},getSystemConfigs:async t=>{var n,r;const s=await Te.getSystemConfigs(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch system configurations");return((r=s.data)==null?void 0:r.data)||s.data},getDocumentConfigMetadata:async()=>{var s,n;const t=await Te.getDocumentConfigMetadata();if(!t.ok)throw new Error(((s=t.data)==null?void 0:s.message)||"Failed to fetch metadata");return((n=t.data)==null?void 0:n.data)||t.data},getDocumentConfigs:async t=>{var n;const s=await Te.getDocumentConfigs(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch document configurations");return s.data},createDocumentConfig:async t=>{var n,r;const s=await Te.createDocumentConfig(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to create document configuration");return((r=s.data)==null?void 0:r.data)||s.data},updateDocumentConfig:async(t,s)=>{var r,a;const n=await Te.updateDocumentConfig(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to update document configuration");return((a=n.data)==null?void 0:a.data)||n.data},deleteDocumentConfig:async t=>{var n;const s=await Te.deleteDocumentConfig(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to delete document configuration");return s.data},updateApplication:async(t,s)=>{var r;const n=await Te.updateApplication(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to update application");return n.data},submitFddReport:async t=>{var n;const s=await Te.submitFddReport(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to submit FDD report");return s.data},getFddAssignment:async t=>{var n;const s=await Te.getFddAssignment(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch FDD assignment");return s.data},assignFddAgency:async t=>{var n;const s=await Te.assignFddAgency(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to assign FDD agency");return s.data},exportResponses:async t=>{var n,r;const s=await Te.exportApplicationResponses({applicationIds:t.join(",")});if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to export responses");return((r=s.data)==null?void 0:r.data)||[]}},Ss={getRoles:async()=>(await Te.getRoles()).data,getPermissions:async()=>(await Te.getPermissions()).data,updateRole:async(t,s)=>(await Te.updateRole(t,s)).data,createRole:async t=>(await Te.createRole(t)).data,getZones:async()=>(await Te.getZones()).data,updateZone:async(t,s)=>(await Te.updateZone(t,s)).data,createZone:async t=>(await Te.createZone(t)).data,createRegion:async t=>(await Te.createRegion(t)).data,updateRegion:async(t,s)=>(await Te.updateRegion(t,s)).data,getRegions:async()=>(await Te.getRegions()).data,getStates:async t=>(await Te.getStates(t)).data,getDistricts:async t=>{const s=typeof t=="string"?{stateId:t,limit:"all"}:{limit:"all",...t};return(await Te.getDistricts(s)).data},getAreas:async t=>(await Te.getAreas(t)).data,updateArea:async(t,s)=>(await Te.updateArea(t,s)).data,createArea:async t=>(await Te.createArea(t)).data,deleteArea:async t=>(await Te.deleteArea(t)).data,getAreaManagers:async()=>(await Te.getAreaManagers()).data,getASMs:async()=>(await Te.getASMs()).data,getZonalManagers:async()=>(await Te.getZonalManagers()).data,saveZonalManager:async t=>Te.saveZonalManager(t).then(s=>s.data),getDDLeads:async()=>(await Te.getDDLeads()).data,saveDDLead:async t=>Te.saveDDLead(t).then(s=>s.data),getUsers:async()=>(await Te.getUsers()).data,updateUser:async(t,s)=>(await Te.updateUser(t,s)).data,getEmailTemplates:async()=>(await Te.getEmailTemplates()).data,getEmailTemplate:async t=>(await Te.getEmailTemplate(t)).data,createEmailTemplate:async t=>(await Te.createEmailTemplate(t)).data,updateEmailTemplate:async(t,s)=>(await Te.updateEmailTemplate(t,s)).data,deleteEmailTemplate:async t=>(await Te.deleteEmailTemplate(t)).data,previewEmailTemplate:async t=>(await Te.previewEmailTemplate(t)).data,getSlaConfigs:async()=>(await Te.getSlaConfigs()).data,saveSlaConfig:async t=>(await Te.saveSlaConfig(t)).data,initializeDefaultSlas:async()=>(await Te.initializeDefaultSlas()).data,saveZone:async t=>t.id?Ss.updateZone(t.id,t):Ss.createZone(t),saveRegion:async t=>t.id?Ss.updateRegion(t.id,t):Ss.createRegion(t),saveASM:async t=>Te.updateUser(t.userId,t).then(s=>s.data),getSystemConfigs:async t=>(await Te.getSystemConfigs(t)).data,saveSystemConfig:async t=>(await Te.saveSystemConfig(t)).data,getDealerAsmMappings:async()=>(await Te.getDealerAsmMappings()).data,saveDealerAsmMapping:async t=>(await Te.saveDealerAsmMapping(t)).data};function QL({onAdminLogin:t}){const[s,n]=v.useState({country:"India",stateId:"",districtId:"",name:"",interestedCity:"",email:"",pincode:"",mobile:"",ownRoyalEnfield:"",royalEnfieldModel:"",age:"",education:"",companyName:"",source:"",existingDealer:"",description:"",address:"",acceptTerms:!1}),[r,a]=v.useState(!1),[l,c]=v.useState([]),[d,m]=v.useState([]);v.useEffect(()=>{x()},[]);const x=async()=>{try{const p=await Ss.getStates(),y=Array.isArray(p)?p:(p==null?void 0:p.data)||(p==null?void 0:p.states)||[];c(y)}catch(p){console.error("Error fetching states:",p)}},f=async p=>{if(p){n(y=>({...y,stateId:p,districtId:""})),m([]);try{const y=await Ss.getDistricts(p),N=Array.isArray(y)?y:(y==null?void 0:y.data)||(y==null?void 0:y.districts)||[];m(N)}catch(y){console.error("Error fetching districts:",y)}}},h=()=>{if(!s.mobile||s.mobile.length<10){ee.error("Please enter a valid mobile number");return}ee.success("OTP sent to "+s.mobile),setTimeout(()=>{a(!0),ee.success("Mobile number verified")},1500)},g=async p=>{var y,N;if(p.preventDefault(),!s.country||!s.stateId||!s.districtId||!s.name||!s.interestedCity||!s.email||!s.pincode||!s.mobile||!s.ownRoyalEnfield||!s.age||!s.education||!s.companyName||!s.source||!s.existingDealer||!s.description||!s.address){ee.error("Please fill in all required fields");return}if(!r){ee.error("Please verify your mobile number");return}if(!s.acceptTerms){ee.error("Please accept the terms and conditions");return}try{const S=l.find(C=>C.id===s.stateId),A=d.find(C=>C.id===s.districtId),w=(S==null?void 0:S.name)||(S==null?void 0:S.stateName)||"",E=(A==null?void 0:A.name)||(A==null?void 0:A.districtName)||"",T={applicantName:s.name,email:s.email,phone:s.mobile,state:w,city:s.interestedCity,district:E,preferredLocation:`${s.interestedCity}, ${w}`,businessType:"Dealership",locationType:"district",locationId:s.districtId,address:s.address,pincode:s.pincode,age:s.age,education:s.education,companyName:s.companyName,source:s.source,existingDealer:s.existingDealer==="yes",ownRoyalEnfield:s.ownRoyalEnfield==="yes",royalEnfieldModel:s.royalEnfieldModel,description:s.description,experienceYears:0,investmentCapacity:"Unknown"};await ds.submitApplication(T),ee.success("Application submitted successfully"),n({country:"India",stateId:"",districtId:"",name:"",interestedCity:"",email:"",pincode:"",mobile:"",ownRoyalEnfield:"",royalEnfieldModel:"",age:"",education:"",companyName:"",source:"",existingDealer:"",description:"",address:"",acceptTerms:!1}),a(!1)}catch(S){ee.error(((N=(y=S.response)==null?void 0:y.data)==null?void 0:N.message)||"Failed to submit application.")}},u=["Classic 650","Scram 440","Goan Classic 350","Bear 650","Guerrilla 450","Shotgun 650","Himalayan 450","Bullet 350","Super Meteor 650","Hunter 350","Scram 411","Meteor 350","Interceptor INT 650","Continental GT 650","Classic 350","Other Royal Enfield motorcycle"],j=["Existing RE dealer","Customer","RE Employee","News Paper","Website","Friends","Others"];return e.jsxs("div",{className:"min-h-screen relative flex flex-col",children:[e.jsxs("div",{className:"fixed inset-0 z-0",children:[e.jsx("img",{src:"/assets/images/become_a_dealer.webp",alt:"Royal Enfield Background",className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-black/20"})]}),e.jsxs("nav",{className:"relative z-10 bg-black px-6 md:px-12 py-4 flex items-center justify-between border-b border-white/10",children:[e.jsx("img",{src:"/assets/images/Re_Logo.png",alt:"Royal Enfield",className:"h-10 md:h-12 w-auto"}),e.jsxs(se,{variant:"ghost",onClick:t,className:"text-[10px] uppercase tracking-widest font-bold text-slate-400 hover:text-white transition-colors",children:[e.jsx(uL,{className:"w-3.5 h-3.5 mr-2"}),"Login"]})]}),e.jsx("main",{className:"relative z-10 flex-grow flex flex-col items-center pt-24 pb-24 px-6",children:e.jsxs("div",{className:"w-full max-w-[1240px] bg-white shadow-2xl p-8 md:p-16",children:[e.jsxs("section",{className:"text-[#333333] mb-12",children:[e.jsx("h1",{className:"text-[28px] font-bold mb-8 uppercase tracking-wide text-black",children:"Become a Dealer"}),e.jsxs("div",{className:"space-y-6 text-[15px] leading-relaxed",children:[e.jsx("p",{children:"At Royal Enfield, we endeavour to partner our patrons and customers in their journeys of exploration. Our main objective is to provide an immersive brand and retail experience in addition to ensuring a superior product experience. Our dealers, distributors and network teams are our extended partners in this task."}),e.jsx("p",{children:"Royal Enfield employs a comprehensive and professional process for Dealership allotment. Dealer selection is done based on a variety of criteria including a personal meeting with the applicant. It is only post completion of the evaluation and selection process, that other formalities are considered."}),e.jsx("p",{children:"Royal Enfield does not accept or demand money / deposits from prospective partners prior to processing the application or candidature of the Dealership."}),e.jsxs("p",{children:["If you receive any communication offering allotment of Royal Enfield Dealership against payment / transfer of money and / or otherwise, we advise you to seek information / clarifications by writing to us at ",e.jsx("b",{children:e.jsx("a",{href:"mailto:support@royalenfield.com",className:"text-red-600",children:"support@royalenfield.com"})})," or by contacting us on our customer care toll-free number ",e.jsx("b",{children:e.jsx("a",{href:"tel:18002100008",className:"text-red-600",children:"1800 210 0008"})}),"."]}),e.jsx("p",{className:"font-bold py-1 mt-8 text-black text-[15px]",children:"*This is the ONLY official website and central number for dealership enquiries for Royal Enfield and we do not have any other partner website(s)."})]})]}),e.jsxs("form",{onSubmit:g,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"w-full h-[44px] px-4 border border-[#cccccc] appearance-none bg-white text-[14px] outline-none",value:s.country,onChange:p=>n({...s,country:p.target.value}),children:[e.jsx("option",{value:"India",children:"India"}),e.jsx("option",{value:"Other",children:"Others"})]}),e.jsx(la,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"w-full h-[44px] px-4 border border-[#cccccc] appearance-none bg-white text-[14px] outline-none",value:s.stateId,onChange:p=>f(p.target.value),children:[e.jsx("option",{value:"",children:"Select State*"}),l.map(p=>e.jsx("option",{value:p.id,children:p.name||p.stateName},p.id))]}),e.jsx(la,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"w-full h-[44px] px-4 border border-[#cccccc] appearance-none bg-white text-[14px] outline-none",value:s.districtId,onChange:p=>n({...s,districtId:p.target.value}),children:[e.jsx("option",{value:"",children:"Select District*"}),d.map(p=>e.jsx("option",{value:p.id,children:p.name||p.districtName},p.id))]}),e.jsx(la,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-10 gap-y-6",children:[e.jsx(ot,{placeholder:"Name*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.name,onChange:p=>n({...s,name:p.target.value})}),e.jsx(ot,{placeholder:"Interested city for Dealership*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.interestedCity,onChange:p=>n({...s,interestedCity:p.target.value})}),e.jsx(ot,{placeholder:"Email Id*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.email,onChange:p=>n({...s,email:p.target.value})}),e.jsx(ot,{placeholder:"Pincode*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.pincode,onChange:p=>n({...s,pincode:p.target.value})}),e.jsxs("div",{className:"relative",children:[e.jsx(ot,{placeholder:"Mobile No.*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.mobile,onChange:p=>n({...s,mobile:p.target.value})}),r?e.jsx("span",{className:"absolute right-4 top-1/2 -translate-y-1/2 text-[12px] font-bold text-green-600",children:"Verified"}):e.jsx("button",{type:"button",onClick:h,className:"absolute right-4 top-1/2 -translate-y-1/2 text-[12px] font-bold text-red-600 hover:text-black transition-colors",children:"Verify"})]}),e.jsxs("div",{className:"flex items-center gap-10 h-[44px]",children:[e.jsxs("span",{className:"text-[14px] font-medium text-[#333333]",children:["Own a Royal Enfield? ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("div",{className:"flex gap-8",children:["yes","no"].map(p=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s.ownRoyalEnfield===p?"border-red-600":"border-[#cccccc]"}`,children:s.ownRoyalEnfield===p&&e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-600"})}),e.jsx("input",{type:"radio",className:"hidden",checked:s.ownRoyalEnfield===p,onChange:()=>n({...s,ownRoyalEnfield:p})}),e.jsx("span",{className:"text-[14px] capitalize",children:p})]},p))})]}),e.jsx(ot,{placeholder:"Age*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.age,onChange:p=>n({...s,age:p.target.value})}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"w-full h-[44px] px-4 border border-[#cccccc] appearance-none bg-white text-[14px] outline-none disabled:bg-slate-50",value:s.royalEnfieldModel,disabled:s.ownRoyalEnfield!=="yes",onChange:p=>n({...s,royalEnfieldModel:p.target.value}),children:[e.jsx("option",{value:"",children:"Motorcycle Owned"}),u.map(p=>e.jsx("option",{value:p,children:p},p))]}),e.jsx(la,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"})]}),e.jsx(ot,{placeholder:"Education Qualification*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.education,onChange:p=>n({...s,education:p.target.value})}),e.jsx(ot,{placeholder:"Company Name*",className:"h-[44px] border-[#cccccc] rounded-none px-4 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999]",value:s.companyName,onChange:p=>n({...s,companyName:p.target.value})}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"w-full h-[44px] px-4 border border-[#cccccc] appearance-none bg-white text-[14px] outline-none",value:s.source,onChange:p=>n({...s,source:p.target.value}),children:[e.jsx("option",{value:"",children:"Select Source*"}),j.map(p=>e.jsx("option",{value:p,children:p},p))]}),e.jsx(la,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500 pointer-events-none"})]}),e.jsxs("div",{className:"flex flex-col justify-center h-auto min-h-[44px] space-y-1",children:[e.jsxs("span",{className:"text-[13px] font-medium text-[#333333]",children:["Are you an existing Dealer / Vendor of Royal Enfield? ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("div",{className:"flex gap-8",children:["yes","no"].map(p=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("div",{className:`w-5 h-5 rounded-full border flex items-center justify-center ${s.existingDealer===p?"border-red-600":"border-[#cccccc]"}`,children:s.existingDealer===p&&e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-600"})}),e.jsx("input",{type:"radio",className:"hidden",checked:s.existingDealer===p,onChange:()=>n({...s,existingDealer:p})}),e.jsx("span",{className:"text-[14px] capitalize",children:p})]},p))})]})]}),e.jsxs("div",{className:"space-y-6 pt-4",children:[e.jsx(Fs,{placeholder:"Description*",className:"min-h-[120px] border-[#cccccc] rounded-none px-4 py-3 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999] resize-none",value:s.description,onChange:p=>n({...s,description:p.target.value})}),e.jsx(Fs,{placeholder:"Address*",className:"min-h-[120px] border-[#cccccc] rounded-none px-4 py-3 text-[14px] focus-visible:ring-1 focus-visible:ring-black placeholder:text-[#999999] resize-none",value:s.address,onChange:p=>n({...s,address:p.target.value})})]}),e.jsxs("div",{className:"pt-6 space-y-8",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("p",{className:"text-[14px] text-[#666666] leading-relaxed",children:["Disclaimer: By signing this form/checking this box, you acknowledge and agree that we may use the information you share with us, to communicate with you through e-mails, text messages, WhatsApp and calls, in order to provide our product or service related information and/or for promotional and marketing purposes. All information provided will be secured and processed as per our ",e.jsx("b",{children:"privacy policy"}),"."]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Rn,{id:"terms",className:"w-5 h-5 border-[#cccccc] rounded-none data-[state=checked]:bg-black data-[state=checked]:border-black",checked:s.acceptTerms,onCheckedChange:p=>n({...s,acceptTerms:p})}),e.jsxs("label",{htmlFor:"terms",className:"text-[14px] font-medium cursor-pointer",children:["I accept the ",e.jsx("b",{children:"terms and conditions"})," as well as ",e.jsx("b",{children:"privacy policy"}),"."]})]})]}),e.jsxs("button",{type:"submit",className:"h-12 px-10 bg-black text-white flex items-center gap-3 hover:bg-slate-900 transition-colors",children:[e.jsx("span",{className:"font-bold uppercase tracking-wider text-[14px]",children:"Submit"}),e.jsx(el,{className:"w-4 h-4"})]})]})]})]})}),e.jsx("footer",{className:"relative z-10 bg-black py-16",children:e.jsxs("div",{className:"max-w-[1240px] mx-auto px-6 grid grid-cols-1 md:grid-cols-3 items-center gap-8",children:[e.jsx("img",{src:"/assets/images/Re_Logo.png",alt:"Royal Enfield",className:"h-10 w-auto opacity-100"}),e.jsxs("div",{className:"flex justify-center gap-12 text-[10px] font-bold uppercase tracking-widest text-slate-500",children:[e.jsx("a",{href:"#",className:"hover:text-white transition-all",children:"Legal"}),e.jsx("a",{href:"#",className:"hover:text-white transition-all",children:"Privacy"}),e.jsx("a",{href:"#",className:"hover:text-white transition-all",children:"Terms"})]}),e.jsx("p",{className:"text-[10px] text-center md:text-right uppercase tracking-widest text-slate-500 font-bold",children:"© 2026 Royal Enfield. All Rights Reserved."})]})})]})}const XL=()=>{const{applicationId:t}=Bc(),s=qn(),{user:n}=Nn(C=>C.auth),[r,a]=v.useState(!0),[l,c]=v.useState([]),[d,m]=v.useState([]),[x,f]=v.useState(""),[h,g]=v.useState({}),[u,j]=v.useState(!1),[p,y]=v.useState(!1);v.useEffect(()=>{(async()=>{var L,$;if(t)try{const _=await Te.getPublicQuestionnaire(t);if(_.data.success){const R=_.data.data.questions||[];c(R);const P=Array.from(new Set(R.map(M=>M.sectionName)));m(P),P.length>0&&f(P[0])}}catch(_){console.error("Error fetching questionnaire:",_),(($=(L=_.response)==null?void 0:L.data)==null?void 0:$.code)==="ALREADY_SUBMITTED"?y(!0):ee.error("Failed to load questionnaire")}finally{a(!1)}})()},[t]);const N=(C,L)=>{g($=>({...$,[C]:L}))},S=()=>{const C=d.indexOf(x);C{const C=d.indexOf(x);C>0&&(f(d[C-1]),window.scrollTo({top:0,behavior:"smooth"}))},w=async()=>{const C=l.filter(L=>L.isMandatory&&!h[L.id]);if(C.length>0){ee.error(`Please answer all mandatory questions. Missing: ${C.length}`);return}try{j(!0);const L=Object.entries(h).map(([$,_])=>({questionId:$,value:_}));await Te.submitPublicResponse({applicationId:t,responses:L}),ee.success("Responses submitted successfully"),y(!0),setTimeout(()=>s("/prospective-dashboard"),3e3)}catch(L){console.error(L),ee.error("Failed to submit responses")}finally{j(!1)}};if(r)return e.jsx("div",{className:"flex items-center justify-center h-screen bg-slate-50",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-amber-600"})});if(p)return e.jsx("div",{className:"min-h-screen bg-slate-50 flex flex-col items-center justify-center p-6",children:e.jsxs("div",{className:"bg-white p-8 rounded-lg shadow-lg max-w-md w-full text-center border-t-4 border-amber-600",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 text-green-600 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(Ys,{className:"w-8 h-8"})}),e.jsx("h2",{className:"text-2xl font-bold mb-2 text-slate-900",children:"Assessment Submitted"}),e.jsx("p",{className:"text-slate-600 mb-6",children:"Thank you! Your assessment has been submitted successfully. Redirecting to dashboard..."}),e.jsx("button",{onClick:()=>s("/prospective-dashboard"),className:"w-full py-2 bg-amber-600 text-white rounded-lg hover:bg-amber-700 transition-colors",children:"Return to Dashboard"})]})});const E=l.filter(C=>C.sectionName===x),T=d.indexOf(x);return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden h-screen bg-slate-50",children:[e.jsx("header",{className:"bg-white border-b border-slate-200 px-6 py-4 flex-shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900 font-bold text-xl",children:"Dealer Questionnaire Form"}),e.jsx("p",{className:"text-slate-600 text-sm",children:"Manage and track dealership applications"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[n&&e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-100 rounded-lg",children:[e.jsx("div",{className:"w-8 h-8 bg-amber-600 rounded-full flex items-center justify-center",children:e.jsx(kr,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-slate-900 text-sm font-medium",children:n.name||"Applicant"}),e.jsx("p",{className:"text-slate-600 text-xs",children:n.role||"Prospective Dealer"})]})]}),e.jsx("button",{className:"p-2 text-slate-500 hover:bg-slate-100 rounded-lg",title:"Refresh",onClick:()=>window.location.reload(),children:e.jsx(Rr,{className:"w-4 h-4"})}),e.jsx("button",{className:"p-2 text-slate-500 hover:bg-slate-100 rounded-lg",title:"Help",children:e.jsx(q2,{className:"w-4 h-4"})})]})]})}),e.jsxs("main",{className:"flex-1 overflow-y-auto",children:[e.jsx("div",{className:"bg-white border-b border-slate-200 sticky top-0 z-20 shadow-sm",children:e.jsx("div",{className:"max-w-5xl mx-auto px-8 py-3",children:e.jsxs("button",{onClick:()=>s("/prospective-dashboard"),className:"inline-flex items-center gap-2 text-sm font-medium text-slate-600 hover:text-slate-900 transition-colors px-3 py-2 rounded-lg hover:bg-slate-100",children:[e.jsx($r,{className:"w-4 h-4"}),"Back to Applicant Portal"]})})}),e.jsxs("div",{className:"max-w-5xl mx-auto py-8 px-6",children:[e.jsxs("div",{className:"bg-re-black rounded-t-lg overflow-hidden shadow-xl",children:[e.jsx("div",{className:"relative px-8 py-12",children:e.jsxs("div",{className:"relative z-10 text-center",children:[e.jsx("div",{className:"flex items-center justify-center mb-7",children:e.jsx("img",{src:"/assets/images/Re_Logo.png",alt:"Royal Enfield",className:"h-12 w-auto"})}),e.jsx("div",{className:"h-1 w-24 bg-amber-600 mx-auto mb-4"}),e.jsx("h2",{className:"text-amber-400 text-xl mb-4 font-light",children:"Dealership Partner Application"}),e.jsx("p",{className:"text-slate-300 max-w-2xl mx-auto leading-relaxed text-sm",children:"Thank you for your interest in becoming a Royal Enfield business partner. Please complete this questionnaire to help us understand your profile and aspirations."}),e.jsxs("div",{className:"flex items-center justify-center gap-8 mt-8 border-t border-slate-700/50 pt-6 inline-flex mx-auto",children:[e.jsxs("div",{className:"text-center px-4",children:[e.jsx("div",{className:"text-amber-400 text-2xl font-bold",children:l.length}),e.jsx("div",{className:"text-slate-400 text-xs uppercase tracking-wider",children:"Questions"})]}),e.jsx("div",{className:"h-10 w-px bg-slate-700"}),e.jsxs("div",{className:"text-center px-4",children:[e.jsx("div",{className:"text-amber-400 text-2xl font-bold",children:d.length}),e.jsx("div",{className:"text-slate-400 text-xs uppercase tracking-wider",children:"Sections"})]})]})]})}),e.jsx("div",{className:"bg-slate-800/50 backdrop-blur-sm border-t border-slate-700",children:e.jsx("div",{className:"flex items-center gap-2 overflow-x-auto scrollbar-hide px-8 py-4 no-scrollbar",children:d.map(C=>e.jsxs("button",{onClick:()=>f(C),className:`flex items-center gap-2 px-4 py-2 rounded-lg whitespace-nowrap transition-all text-sm font-medium + ${x===C?"bg-amber-600 text-white shadow-lg":"bg-slate-700/50 text-slate-300 hover:bg-slate-700 hover:text-white"}`,children:[e.jsx(fs,{className:"w-4 h-4"}),e.jsx("span",{children:C}),x===C&&e.jsx("span",{className:"ml-2 bg-white/20 px-2 py-0.5 rounded text-xs",children:l.filter(L=>L.sectionName===C).length})]},C))})})]}),e.jsx("div",{className:"bg-white rounded-b-lg shadow-xl border border-slate-200 border-t-0 min-h-[400px]",children:e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"flex items-start gap-4 pb-6 border-b-2 border-amber-100 mb-8",children:[e.jsx("div",{className:"w-12 h-12 bg-amber-50 rounded-lg flex items-center justify-center flex-shrink-0 text-amber-600",children:e.jsx(da,{className:"w-6 h-6"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-slate-900 text-xl font-bold mb-1",children:x}),e.jsxs("p",{className:"text-slate-500 text-sm",children:["Section ",T+1," of ",d.length," • ",E.length," questions"]})]})]}),e.jsxs("div",{className:"space-y-10",children:[E.map((C,L)=>e.jsx("div",{className:"group animate-in fade-in duration-500",style:{animationDelay:`${L*100}ms`},children:e.jsxs("div",{className:"flex items-start gap-5",children:[e.jsx("div",{className:"w-8 h-8 bg-slate-100 rounded-full flex items-center justify-center flex-shrink-0 group-hover:bg-amber-100 transition-colors text-slate-600 group-hover:text-amber-700 font-semibold text-sm",children:L+1}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("label",{className:"text-sm font-medium text-slate-900 leading-relaxed block",children:[C.questionText,C.isMandatory&&e.jsx("span",{className:"text-red-500 ml-1",children:"*"})]})}),e.jsxs("div",{className:"max-w-xl",children:[(C.inputType==="text"||C.inputType==="email"||C.inputType==="number")&&e.jsx("input",{type:C.inputType,className:"w-full h-10 px-3 rounded-lg border border-slate-300 focus:border-amber-500 focus:ring-2 focus:ring-amber-200 outline-none transition-all placeholder:text-slate-400",placeholder:"Type your answer here...",value:h[C.id]||"",onChange:$=>N(C.id,$.target.value)}),C.inputType==="textarea"&&e.jsx("textarea",{className:"w-full h-32 p-3 rounded-lg border border-slate-300 focus:border-amber-500 focus:ring-2 focus:ring-amber-200 outline-none transition-all placeholder:text-slate-400",placeholder:"Type your answer here...",value:h[C.id]||"",onChange:$=>N(C.id,$.target.value)}),(C.inputType==="select"||C.inputType==="yesno"||C.inputType==="radio"||C.inputType==="mcq")&&e.jsx("div",{className:"space-y-2",children:(C.questionOptions||(C.inputType==="yesno"?[{optionText:"Yes"},{optionText:"No"}]:[])).map(($,_)=>{const R=$.optionText||$.text;return e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group/opt",children:[e.jsx("input",{type:"radio",name:`q-${C.id}`,className:"w-4 h-4 text-amber-600 focus:ring-amber-500 border-slate-300",checked:h[C.id]===R,onChange:()=>N(C.id,R)}),e.jsx("span",{className:"text-slate-700 group-hover/opt:text-slate-900 transition-colors",children:R})]},_)})})]})]})]})},C.id)),E.length===0&&e.jsx("div",{className:"text-center py-10 text-slate-500 italic",children:"No questions in this section."})]}),e.jsxs("div",{className:"flex items-center justify-between pt-10 mt-10 border-t border-slate-100",children:[e.jsx("button",{onClick:A,disabled:T===0,className:"px-6 py-2.5 rounded-lg text-sm font-medium border border-slate-300 text-slate-700 hover:bg-slate-50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Previous Section"}),T{const n=hu(`Primitive.${s}`),r=v.forwardRef((a,l)=>{const{asChild:c,...d}=a,m=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(m,{...d,ref:l})});return r.displayName=`Primitive.${s}`,{...t,[s]:r}},{}),tI="Label",W2=v.forwardRef((t,s)=>e.jsx(eI.label,{...t,ref:s,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));W2.displayName=tI;var sI=W2;function ce({className:t,...s}){return e.jsx(sI,{"data-slot":"label",className:_t("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...s})}const nI=[{id:"15",name:"Super Admin",email:"admin@royalenfield.com",password:"Admin@123",role:"Super Admin"},{id:"13",name:"piyush",email:"piyush@royalenfield.com",password:"Admin@123",role:"DD-ZM"},{id:"14",name:"manish",email:"manish@royalenfield.com",password:"Admin@123",role:"RBM"},{id:"14",name:"manav",email:"manav@royalenfield.com",password:"Admin@123",role:"ZBH"},{id:"5",name:"Jaya",email:"jaya@royalenfield.com",password:"Admin@123",role:"DD Lead"},{id:"14",name:"ganesh",email:"ganesh@royalenfield.com",password:"Admin@123",role:"DD Head"},{id:"16",name:"Yashwin",email:"yashwin@royalenfield.com",password:"Admin@123",role:"NBH"},{id:"15",name:"FDD Team",email:"fdd@royalenfield.com",password:"Admin@123",role:"FDD"},{id:"13",name:"Finance Admin",email:"finance@royalenfield.com",password:"Admin@123",role:"Finance"},{id:"13",name:"abhishek",email:"abhishek@royalenfield.com",password:"Admin@123",role:"ASM"},{id:"18",name:"Lince",email:"lince@royalenfield.com",password:"Admin@123",role:"DD Admin"},{id:"18",name:"Legal Admin",email:"legal@royalenfield.com",password:"Admin@123",role:"Legal Admin"},{id:"18",name:"CEO",email:"ceo@royalenfield.com",password:"Admin@123",role:"CEO"},{id:"18",name:"CCO",email:"cco@royalenfield.com",password:"Admin@123",role:"CCO"}],hi={totalApplications:0,loaIssued:0,level1Pending:0,level2Pending:0,level3Pending:0,eorInProgress:0,disqualified:0,pendingReminders:0,shortlistedToday:0,pendingShortlisting:0},rI=[];function vw({onLogin:t}){const[s,n]=v.useState(""),[r,a]=v.useState(""),[l,c]=v.useState(!1),[d,m]=v.useState(""),[x,f]=v.useState(!1),[h,g]=v.useState(!1),[u,j]=v.useState(!1),[p,y]=v.useState(null),N=async(E,T)=>{try{if(navigator.clipboard&&navigator.clipboard.writeText){await navigator.clipboard.writeText(E),y(T),setTimeout(()=>y(null),2e3);return}}catch{}try{const C=document.createElement("textarea");C.value=E,C.style.position="fixed",C.style.left="-999999px",C.style.top="-999999px",document.body.appendChild(C),C.focus(),C.select();const L=document.execCommand("copy");document.body.removeChild(C),L&&(y(T),setTimeout(()=>y(null),2e3))}catch{}},S=async(E,T)=>{var C,L;n(E),a(T),m(""),g(!0);try{await t(E,T)}catch($){const _=((L=(C=$.response)==null?void 0:C.data)==null?void 0:L.message)||$.message||"Auto-login failed";m(_),ee.error(_)}finally{g(!1)}},A=async E=>{var T,C;if(E.preventDefault(),!h){if(m(""),!s||!r){m("Please enter both email and password");return}g(!0);try{await t(s,r)}catch(L){const $=((C=(T=L.response)==null?void 0:T.data)==null?void 0:C.message)||L.message||"Login failed";m($),ee.error($)}finally{g(!1)}}},w=E=>{E.preventDefault(),alert("Password reset link sent to "+s),f(!1)};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-black p-4 overflow-y-auto",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute -top-40 -right-40 w-80 h-80 bg-red-700/15 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-80 h-80 bg-red-700/15 rounded-full blur-3xl"})]}),e.jsxs("div",{className:"relative w-full max-w-6xl grid md:grid-cols-2 gap-8 my-8",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:"/assets/images/Re_Logo.png",alt:"Royal Enfield",className:"h-16 w-auto object-contain"})}),e.jsx("p",{className:"text-slate-400",children:"Dealership Onboarding System"})]}),e.jsx("div",{className:"bg-white rounded-lg shadow-2xl p-8",children:x?e.jsxs("form",{onSubmit:w,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"mb-2",children:"Reset Password"}),e.jsx("p",{className:"text-slate-600",children:"Enter your email to receive a password reset link"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"reset-email",children:"Email Address"}),e.jsx(ot,{id:"reset-email",type:"email",placeholder:"you@royalenfield.com",value:s,onChange:E=>n(E.target.value),required:!0,className:"w-full"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{type:"button",variant:"outline",onClick:()=>f(!1),className:"flex-1",children:"Back to Login"}),e.jsx(se,{type:"submit",className:"flex-1 bg-re-red hover:bg-re-red-hover text-white",children:"Send Reset Link"})]})]}):e.jsxs("form",{onSubmit:A,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"email",children:"Email Address"}),e.jsx(ot,{id:"email",type:"email",placeholder:"you@royalenfield.com",value:s,onChange:E=>n(E.target.value),className:"w-full",disabled:h})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"password",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(ot,{id:"password",type:u?"text":"password",placeholder:"Enter your password",value:r,onChange:E=>a(E.target.value),className:"no-native-password-reveal w-full pr-10",autoComplete:"current-password",disabled:h}),e.jsx("button",{type:"button",onClick:()=>j(!u),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 focus:outline-none",disabled:h,children:u?e.jsx(sL,{className:"w-5 h-5"}):e.jsx(nn,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Rn,{id:"remember",checked:l,onCheckedChange:E=>c(E),disabled:h}),e.jsx(ce,{htmlFor:"remember",className:"cursor-pointer",children:"Remember Me"})]}),e.jsx("button",{type:"button",onClick:()=>f(!0),className:"text-re-red hover:text-re-red-hover disabled:opacity-50",disabled:h,children:"Forgot Password?"})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-200 rounded-md",children:[e.jsx(Gs,{className:"w-4 h-4 text-red-600"}),e.jsx("span",{className:"text-red-600 font-medium text-sm",children:d})]}),e.jsx(se,{type:"submit",className:"w-full bg-re-red hover:bg-re-red-hover h-11 text-white",disabled:h,children:h?e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),e.jsx("span",{children:"Logging in..."})]}):"Login"}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"relative my-4",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-slate-200"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-white px-2 text-slate-500",children:"Or"})})]}),e.jsx(se,{type:"button",variant:"outline",className:"w-full border-re-red text-re-red hover:bg-red-50 h-11",onClick:()=>window.location.href="/prospective-login",children:"Prospective User Login"})]})]})}),e.jsx("div",{className:"text-center mt-6 text-slate-400",children:e.jsx("p",{children:"© 2026 Royal Enfield. All rights reserved."})})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-2xl p-8 overflow-y-auto max-h-[800px]",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-2",children:"Test User Credentials"}),e.jsx("p",{className:"text-slate-600",children:"Click on any user to auto-login"})]}),e.jsx("div",{className:"space-y-3",children:nI.map((E,T)=>e.jsxs("div",{className:"border border-slate-200 rounded-lg p-4 hover:border-re-red hover:bg-red-50 transition-all cursor-pointer",onClick:()=>S(E.email,E.password),children:[e.jsx("div",{className:"flex items-start justify-between mb-2",children:e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"flex items-center gap-2 mb-1",children:e.jsx("span",{className:"px-2 py-1 bg-red-100 text-re-red rounded text-xs",children:E.role})}),e.jsx("p",{className:"text-slate-900",children:E.name})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-slate-500",children:"Email:"}),e.jsx("p",{className:"text-slate-900 font-mono break-all",children:E.email})]}),e.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),N(E.email,T*2)},className:"p-2 hover:bg-slate-100 rounded",children:p===T*2?e.jsx(Bn,{className:"w-4 h-4 text-green-600"}):e.jsx(hw,{className:"w-4 h-4 text-slate-400"})})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-slate-500",children:"Password:"}),e.jsx("p",{className:"text-slate-900 font-mono",children:E.password})]}),e.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),N(E.password,T*2+1)},className:"p-2 hover:bg-slate-100 rounded",children:p===T*2+1?e.jsx(Bn,{className:"w-4 h-4 text-green-600"}):e.jsx(hw,{className:"w-4 h-4 text-slate-400"})})]})]}),e.jsx("div",{className:"mt-3 pt-3 border-t border-slate-200",children:e.jsxs("p",{className:"text-re-red text-center",children:["Click to login as ",E.role]})})]},E.email))})]})]})]})}function aI(){const t=qn(),s=su(),[n,r]=v.useState("PHONE"),[a,l]=v.useState(""),[c,d]=v.useState(""),[m,x]=v.useState(!1),[f,h]=v.useState(""),g=async j=>{var p;if(j.preventDefault(),!a||a.length<10){h("Please enter a valid 10-digit phone number");return}x(!0),h("");try{const y=await Te.sendOtp(a);if(y.ok)r("OTP"),ee.success("OTP sent successfully!");else{console.error("Send OTP error response:",y);const N=((p=y.data)==null?void 0:p.message)||"Failed to send OTP";h(N),ee.error(N)}}catch(y){console.error("Send OTP network error:",y),h("Network error. Please try again."),ee.error("Network error. Please try again.")}finally{x(!1)}},u=async j=>{var p;if(j.preventDefault(),!c||c.length<6){h("Please enter a valid 6-digit OTP");return}x(!0),h("");try{const y=await Te.verifyOtp(a,c);if(y.ok&&y.data){const{token:N,user:S}=y.data.data||y.data;if(!N||!S)throw new Error("Invalid response format");s(n2({user:S,token:N})),localStorage.setItem("token",N),ee.success("Logged in successfully!"),t("/prospective-dashboard")}else{const N=((p=y.data)==null?void 0:p.message)||"Invalid OTP";h(N),ee.error(N)}}catch(y){console.error("Verify OTP error:",y),h("An unexpected error occurred"),ee.error("An unexpected error occurred")}finally{x(!1)}};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 p-4 overflow-y-auto",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute -top-40 -right-40 w-80 h-80 bg-amber-600/10 rounded-full blur-3xl"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-80 h-80 bg-amber-600/10 rounded-full blur-3xl"})]}),e.jsxs("div",{className:"relative w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 bg-amber-600 rounded-full mb-4",children:e.jsxs("svg",{viewBox:"0 0 24 24",className:"w-12 h-12 text-white",fill:"currentColor",children:[e.jsx("path",{d:"M12 2L4 6v6c0 5.5 3.8 10.7 8 12 4.2-1.3 8-6.5 8-12V6l-8-4zm0 2.2l6 3v4.8c0 4.5-3.1 8.7-6 10-2.9-1.3-6-5.5-6-10V7.2l6-3z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),e.jsx("h1",{className:"text-white mb-2",children:"Royal Enfield"}),e.jsx("p",{className:"text-slate-400",children:"Dealer Login"})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-2xl p-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs(se,{variant:"ghost",className:"px-0 flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-4 hover:bg-transparent",onClick:()=>n==="OTP"?r("PHONE"):t("/admin-login"),children:[e.jsx($r,{className:"w-4 h-4"}),n==="OTP"?"Change Phone Number":"Back to Login"]}),e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 bg-amber-100 rounded-lg",children:e.jsx(xL,{className:"w-6 h-6 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-slate-900 text-lg font-semibold",children:"Dealer Login"}),e.jsx("p",{className:"text-slate-600 text-sm",children:"Login with your registered phone number"})]})]})]}),n==="PHONE"?e.jsxs("form",{onSubmit:g,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"phone",children:"Registered Phone Number"}),e.jsx(ot,{id:"phone",type:"tel",placeholder:"Enter 10-digit phone number",maxLength:10,value:a,onChange:j=>l(j.target.value.replace(/\D/g,"")),className:"w-full",disabled:m}),e.jsx("p",{className:"text-slate-500 text-xs",children:"Enter the phone number you used during application"})]}),f&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-200 rounded-md",children:[e.jsx(Gs,{className:"w-4 h-4 text-red-600"}),e.jsx("span",{className:"text-red-600 font-medium text-sm",children:f})]}),e.jsx(se,{type:"submit",className:"w-full bg-amber-600 hover:bg-amber-700 h-9",disabled:m||a.length<10,children:m?"Sending...":"Send OTP"}),e.jsx("div",{className:"text-center text-slate-500 text-xs",children:e.jsx("p",{children:"You will receive a 6-digit OTP on your registered mobile number"})})]}):e.jsxs("form",{onSubmit:u,className:"space-y-6",children:[e.jsx("div",{className:"p-4 bg-green-50 border border-green-200 rounded-lg",children:e.jsxs("p",{className:"text-green-800 text-center text-sm",children:["OTP sent to +91 ",a]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"otp",children:"Enter OTP"}),e.jsx(ot,{id:"otp",type:"text",placeholder:"Enter 6-digit OTP",maxLength:6,value:c,onChange:j=>d(j.target.value.replace(/\D/g,"")),className:"w-full text-center text-2xl tracking-widest",disabled:m}),e.jsx("p",{className:"text-slate-500 text-xs text-center",children:"Check your SMS for the OTP"})]}),f&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-200 rounded-md",children:[e.jsx(Gs,{className:"w-4 h-4 text-red-600"}),e.jsx("span",{className:"text-red-600 font-medium text-sm",children:f})]}),e.jsx(se,{type:"submit",className:"w-full bg-amber-600 hover:bg-amber-700 h-9",disabled:m||c.length<6,children:m?"Verifying...":"Verify OTP"}),e.jsxs("div",{className:"text-center text-sm",children:[e.jsx("button",{type:"button",className:"text-amber-600 hover:text-amber-700 font-medium",onClick:()=>r("PHONE"),children:"Change Phone Number"}),e.jsx("span",{className:"mx-2 text-slate-400",children:"|"}),e.jsx("button",{type:"button",className:"text-amber-600 hover:text-amber-700 font-medium",onClick:g,disabled:m,children:"Resend OTP"})]})]})]}),e.jsx("div",{className:"text-center mt-6 text-slate-400",children:e.jsx("p",{children:"© 2025 Royal Enfield. All rights reserved."})})]})]})}function iI({onLogout:t}){const s=qn(),r=Ul().pathname.substring(1)||"dashboard",{user:a}=Nn(K=>K.auth),[l,c]=v.useState(!1),[d,m]=v.useState(""),[x,f]=v.useState(!1),[h,g]=v.useState(!1),[u,j]=v.useState(null),p=v.useRef(null),y=(a==null?void 0:a.role)||(a==null?void 0:a.roleCode)||"",N=String(y).trim().toLowerCase(),S=K=>K.map(Z=>Z.toLowerCase()).includes(N),A=["DD Admin","ASM","RBM","DD Lead","ZBH","NBH","Legal","Legal Admin","Super Admin"],w=["ASM","RBM","ZBH","DD Lead","DD Head","NBH","Legal Admin","Legal","DD Admin","CCO","CEO","Super Admin"],E=["DD Admin","DD Lead","NBH","Finance","Finance Admin","Super Admin"],T=S(A),C=S(w),L=S(E),$=[T?{id:"resignation",label:"Resignation"}:null,C?{id:"termination",label:"Termination"}:null,L?{id:"fnf",label:"F&F"}:null].filter(Boolean),_=S(["Finance","Finance Admin"])?[{id:"dashboard",label:"Dashboard",icon:kh},{id:"finance-onboarding",label:"Onboarding",icon:fs},{id:"finance-fnf",label:"F&F",icon:Ex}]:S(["Dealer"])?[{id:"dashboard",label:"Dashboard",icon:kh},{id:"dealer-resignation",label:"My Resignations",icon:Ex},{id:"dealer-constitutional",label:"Constitutional Change",icon:Gi},{id:"dealer-relocation",label:"Relocation Requests",icon:Er}]:S(["FDD"])?[{id:"fdd-dashboard",label:"FDD Dashboard",icon:kh}]:[{id:"dashboard",label:"Dashboard",icon:kh},{id:"applications",label:"Dealership Requests",icon:fs},...$.length>0?[{id:"offboarding",label:"Offboarding",icon:Ex,hasSubmenu:!0,submenuKey:"offboarding",submenu:$}]:[],{id:"constitutional-change",label:"Constitutional Change",icon:Gi},{id:"relocation-requests",label:"Relocation Requests",icon:Er}];S(["DD Lead","DD Admin","Super Admin"])&&_.splice(1,0,{id:"all-requests",label:"All Requests",icon:aL,hasSubmenu:!0,submenuKey:"allRequests",submenu:[{id:"opportunity-requests",label:"Opportunity Requests"},{id:"non-opportunities",label:"Non-opportunities"}]}),S(["Super Admin","DD Admin","DD Lead"])&&(_.push({id:"master",label:"Master",icon:Sc}),_.push({id:"sla-configurations",label:"SLA Matrix",icon:Gi})),S(["Super Admin"])&&(_.push({id:"users",label:"User Management",icon:da}),_.push({id:"questionnaires",label:"Questionnaire Templates",icon:Fo}),_.push({id:"interview-configs",label:"Interview Configs",icon:dL}));const R=K=>{K.preventDefault(),d.trim()&&s("/applications")},P=v.useCallback((K,Z)=>{p.current&&clearTimeout(p.current);const W=Z.getBoundingClientRect();j({submenuKey:K,top:W.top,left:W.right+8})},[]),M=v.useCallback((K=!1)=>{K?(p.current&&clearTimeout(p.current),j(null)):p.current=setTimeout(()=>j(null),150)},[]),q=v.useCallback(()=>{p.current&&clearTimeout(p.current)},[]);return v.useEffect(()=>{l||j(null)},[l]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`bg-black text-white h-screen flex flex-col transition-all duration-300 overflow-hidden relative flex-shrink-0 ${l?"w-20":"w-64"}`,children:[e.jsx("div",{className:"border-b border-white/10",children:l?e.jsxs("div",{className:"flex flex-col items-center py-3 gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-white flex items-center justify-center p-1 shadow-md",children:e.jsx("img",{src:"/assets/images/Re_Logo.png",alt:"RE",className:"w-full h-full object-contain"})}),e.jsx("button",{onClick:()=>c(!1),className:"p-1.5 hover:bg-white/10 rounded-lg transition-colors text-slate-400 hover:text-white",title:"Expand sidebar",children:e.jsx(el,{className:"w-4 h-4"})})]}):e.jsxs("div",{className:"flex items-center justify-between px-4 py-4",children:[e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("img",{src:"/assets/images/Re_Logo.png",alt:"Royal Enfield",className:"h-6 w-auto"}),e.jsx("span",{className:"text-[10px] uppercase tracking-[0.2em] font-bold text-slate-400 mt-1 whitespace-nowrap",children:"Dealer Onboarding"})]}),e.jsx("button",{onClick:()=>c(!0),className:"p-1.5 hover:bg-white/10 rounded-lg transition-colors text-slate-400 hover:text-white flex-shrink-0 ml-2",title:"Collapse sidebar",children:e.jsx(qc,{className:"w-4 h-4"})})]})}),!l&&e.jsx("div",{className:"p-4 border-b border-white/10",children:e.jsxs("form",{onSubmit:R,className:"relative",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ot,{type:"text",placeholder:"Search applications...",value:d,onChange:K=>m(K.target.value),className:"w-full pl-10 bg-white/5 border-white/10 text-white placeholder:text-slate-500"})]})}),e.jsx("nav",{className:"flex-1 p-3 space-y-1 overflow-y-auto custom-scrollbar",children:_.map(K=>{var O,z;const Z=K.icon,W=r===K.id,U=!!K.hasSubmenu,F=U&&((O=K.submenu)==null?void 0:O.some(G=>r===G.id)),B=K.submenuKey,D=B==="offboarding"?x:B==="allRequests"?h:!1;return e.jsxs("div",{children:[e.jsxs("button",{onMouseEnter:G=>{l&&U&&B&&P(B,G.currentTarget)},onMouseLeave:()=>{l&&U&&M()},onClick:()=>{U?l?(c(!1),B==="offboarding"?f(!0):B==="allRequests"&&g(!0)):B==="offboarding"?f(!x):B==="allRequests"&&g(!h):s(`/${K.id}`)},className:`w-full flex items-center gap-3 px-3 py-3 rounded-lg transition-colors ${l?"justify-center":""} ${W||F?"bg-re-red text-white shadow-lg shadow-re-red/20":"text-slate-400 hover:bg-white/5 hover:text-white"}`,title:l?K.label:void 0,children:[e.jsx(Z,{className:"w-5 h-5 flex-shrink-0"}),!l&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex-1 text-left text-sm",children:K.label}),U&&(D?e.jsx($d,{className:"w-4 h-4 flex-shrink-0"}):e.jsx(la,{className:"w-4 h-4 flex-shrink-0"}))]})]}),U&&D&&!l&&e.jsx("div",{className:"ml-3 mt-1 space-y-1 border-l border-white/10 pl-3",children:(z=K.submenu)==null?void 0:z.map(G=>{const Y=r===G.id;return e.jsxs("button",{onClick:()=>s(`/${G.id}`),className:`w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-colors text-sm ${Y?"bg-re-red/20 text-re-red font-semibold":"text-slate-500 hover:bg-white/5 hover:text-white"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current flex-shrink-0"}),e.jsx("span",{children:G.label})]},G.id)})})]},K.id)})}),e.jsxs("div",{className:"p-4 border-t border-white/10 space-y-2",children:[!l&&a&&e.jsx("div",{className:"px-4 py-2 bg-white/5 rounded-lg mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-re-red rounded-full flex items-center justify-center font-bold flex-shrink-0",children:e.jsx("span",{children:a.name.charAt(0)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-semibold",children:a.name}),e.jsx("p",{className:"text-slate-500 truncate text-[11px] uppercase tracking-wider",children:a.role})]})]})}),l&&a&&e.jsx("div",{className:"flex justify-center mb-2",children:e.jsx("div",{className:"w-9 h-9 bg-re-red rounded-full flex items-center justify-center font-bold text-sm",title:a.name,children:e.jsx("span",{children:a.name.charAt(0)})})}),e.jsxs(se,{onClick:t,variant:"ghost",className:`w-full ${l?"px-2 justify-center":"justify-start"} text-slate-400 hover:bg-white/5 hover:text-white`,title:l?"Logout":void 0,children:[e.jsx(V2,{className:"w-5 h-5 flex-shrink-0"}),!l&&e.jsx("span",{className:"ml-3",children:"Logout"})]})]})]}),u&&l&&(()=>{const K=_.find(Z=>Z.submenuKey===u.submenuKey);return!K||!K.submenu?null:Vv.createPortal(e.jsxs("div",{style:{top:u.top,left:u.left},className:"fixed z-[9999] min-w-[200px] bg-gray-900 border border-white/10 rounded-xl shadow-2xl py-2",onMouseEnter:q,onMouseLeave:()=>M(),children:[e.jsx("div",{className:"px-4 py-1.5 text-xs font-bold uppercase tracking-widest text-slate-400 border-b border-white/10 mb-1",children:K.label}),K.submenu.map(Z=>{const W=r===Z.id;return e.jsxs("button",{onClick:()=>{s(`/${Z.id}`),M(!0)},className:`w-full flex items-center gap-2.5 px-4 py-2.5 text-sm transition-colors ${W?"bg-re-red/20 text-re-red font-semibold":"text-slate-300 hover:bg-white/10 hover:text-white"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current flex-shrink-0"}),e.jsx("span",{children:Z.label})]},Z.id)})]}),document.body)})()]})}function bw(t){const s=lI(t),n=v.forwardRef((r,a)=>{const{children:l,...c}=r,d=v.Children.toArray(l),m=d.find(cI);if(m){const x=m.props.children,f=d.map(h=>h===m?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:h);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}function lI(t){const s=v.forwardRef((n,r)=>{const{children:a,...l}=n;if(v.isValidElement(a)){const c=uI(a),d=dI(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var oI=Symbol("radix.slottable");function cI(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===oI}function dI(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const m=l(...d);return a(...d),m}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function uI(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function nb(t){const s=t+"CollectionProvider",[n,r]=ea(s),[a,l]=n(s,{collectionRef:{current:null},itemMap:new Map}),c=p=>{const{scope:y,children:N}=p,S=gt.useRef(null),A=gt.useRef(new Map).current;return e.jsx(a,{scope:y,itemMap:A,collectionRef:S,children:N})};c.displayName=s;const d=t+"CollectionSlot",m=bw(d),x=gt.forwardRef((p,y)=>{const{scope:N,children:S}=p,A=l(d,N),w=Ms(y,A.collectionRef);return e.jsx(m,{ref:w,children:S})});x.displayName=d;const f=t+"CollectionItemSlot",h="data-radix-collection-item",g=bw(f),u=gt.forwardRef((p,y)=>{const{scope:N,children:S,...A}=p,w=gt.useRef(null),E=Ms(y,w),T=l(f,N);return gt.useEffect(()=>(T.itemMap.set(w,{ref:w,...A}),()=>void T.itemMap.delete(w))),e.jsx(g,{[h]:"",ref:E,children:S})});u.displayName=f;function j(p){const y=l(t+"CollectionConsumer",p);return gt.useCallback(()=>{const S=y.collectionRef.current;if(!S)return[];const A=Array.from(S.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((T,C)=>A.indexOf(T.ref.current)-A.indexOf(C.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:c,Slot:x,ItemSlot:u},j,r]}var hI=v.createContext(void 0);function pu(t){const s=v.useContext(hI);return t||s||"ltr"}function dr(t){const s=v.useRef(t);return v.useEffect(()=>{s.current=t}),v.useMemo(()=>(...n)=>{var r;return(r=s.current)==null?void 0:r.call(s,...n)},[])}function mI(t,s=globalThis==null?void 0:globalThis.document){const n=dr(t);v.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return s.addEventListener("keydown",r,{capture:!0}),()=>s.removeEventListener("keydown",r,{capture:!0})},[n,s])}var fI="DismissableLayer",cv="dismissableLayer.update",pI="dismissableLayer.pointerDownOutside",xI="dismissableLayer.focusOutside",yw,K2=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zc=v.forwardRef((t,s)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:d,...m}=t,x=v.useContext(K2),[f,h]=v.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,u]=v.useState({}),j=Ms(s,C=>h(C)),p=Array.from(x.layers),[y]=[...x.layersWithOutsidePointerEventsDisabled].slice(-1),N=p.indexOf(y),S=f?p.indexOf(f):-1,A=x.layersWithOutsidePointerEventsDisabled.size>0,w=S>=N,E=bI(C=>{const L=C.target,$=[...x.branches].some(_=>_.contains(L));!w||$||(a==null||a(C),c==null||c(C),C.defaultPrevented||d==null||d())},g),T=yI(C=>{const L=C.target;[...x.branches].some(_=>_.contains(L))||(l==null||l(C),c==null||c(C),C.defaultPrevented||d==null||d())},g);return mI(C=>{S===x.layers.size-1&&(r==null||r(C),!C.defaultPrevented&&d&&(C.preventDefault(),d()))},g),v.useEffect(()=>{if(f)return n&&(x.layersWithOutsidePointerEventsDisabled.size===0&&(yw=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),x.layersWithOutsidePointerEventsDisabled.add(f)),x.layers.add(f),jw(),()=>{n&&x.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=yw)}},[f,g,n,x]),v.useEffect(()=>()=>{f&&(x.layers.delete(f),x.layersWithOutsidePointerEventsDisabled.delete(f),jw())},[f,x]),v.useEffect(()=>{const C=()=>u({});return document.addEventListener(cv,C),()=>document.removeEventListener(cv,C)},[]),e.jsx(ps.div,{...m,ref:j,style:{pointerEvents:A?w?"auto":"none":void 0,...t.style},onFocusCapture:Vt(t.onFocusCapture,T.onFocusCapture),onBlurCapture:Vt(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Vt(t.onPointerDownCapture,E.onPointerDownCapture)})});zc.displayName=fI;var gI="DismissableLayerBranch",vI=v.forwardRef((t,s)=>{const n=v.useContext(K2),r=v.useRef(null),a=Ms(s,r);return v.useEffect(()=>{const l=r.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),e.jsx(ps.div,{...t,ref:a})});vI.displayName=gI;function bI(t,s=globalThis==null?void 0:globalThis.document){const n=dr(t),r=v.useRef(!1),a=v.useRef(()=>{});return v.useEffect(()=>{const l=d=>{if(d.target&&!r.current){let m=function(){G2(pI,n,x,{discrete:!0})};const x={originalEvent:d};d.pointerType==="touch"?(s.removeEventListener("click",a.current),a.current=m,s.addEventListener("click",a.current,{once:!0})):m()}else s.removeEventListener("click",a.current);r.current=!1},c=window.setTimeout(()=>{s.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(c),s.removeEventListener("pointerdown",l),s.removeEventListener("click",a.current)}},[s,n]),{onPointerDownCapture:()=>r.current=!0}}function yI(t,s=globalThis==null?void 0:globalThis.document){const n=dr(t),r=v.useRef(!1);return v.useEffect(()=>{const a=l=>{l.target&&!r.current&&G2(xI,n,{originalEvent:l},{discrete:!1})};return s.addEventListener("focusin",a),()=>s.removeEventListener("focusin",a)},[s,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function jw(){const t=new CustomEvent(cv);document.dispatchEvent(t)}function G2(t,s,n,{discrete:r}){const a=n.originalEvent.target,l=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});s&&a.addEventListener(t,s,{once:!0}),r?R2(a,l):a.dispatchEvent(l)}var Tx=0;function Jm(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Nw()),document.body.insertAdjacentElement("beforeend",t[1]??Nw()),Tx++,()=>{Tx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(s=>s.remove()),Tx--}},[])}function Nw(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var _x="focusScope.autoFocusOnMount",Px="focusScope.autoFocusOnUnmount",ww={bubbles:!1,cancelable:!0},jI="FocusScope",xu=v.forwardRef((t,s)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:l,...c}=t,[d,m]=v.useState(null),x=dr(a),f=dr(l),h=v.useRef(null),g=Ms(s,p=>m(p)),u=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let p=function(A){if(u.paused||!d)return;const w=A.target;d.contains(w)?h.current=w:El(h.current,{select:!0})},y=function(A){if(u.paused||!d)return;const w=A.relatedTarget;w!==null&&(d.contains(w)||El(h.current,{select:!0}))},N=function(A){if(document.activeElement===document.body)for(const E of A)E.removedNodes.length>0&&El(d)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const S=new MutationObserver(N);return d&&S.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),S.disconnect()}}},[r,d,u.paused]),v.useEffect(()=>{if(d){Cw.add(u);const p=document.activeElement;if(!d.contains(p)){const N=new CustomEvent(_x,ww);d.addEventListener(_x,x),d.dispatchEvent(N),N.defaultPrevented||(NI(kI(Y2(d)),{select:!0}),document.activeElement===p&&El(d))}return()=>{d.removeEventListener(_x,x),setTimeout(()=>{const N=new CustomEvent(Px,ww);d.addEventListener(Px,f),d.dispatchEvent(N),N.defaultPrevented||El(p??document.body,{select:!0}),d.removeEventListener(Px,f),Cw.remove(u)},0)}}},[d,x,f,u]);const j=v.useCallback(p=>{if(!n&&!r||u.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,N=document.activeElement;if(y&&N){const S=p.currentTarget,[A,w]=wI(S);A&&w?!p.shiftKey&&N===w?(p.preventDefault(),n&&El(A,{select:!0})):p.shiftKey&&N===A&&(p.preventDefault(),n&&El(w,{select:!0})):N===S&&p.preventDefault()}},[n,r,u.paused]);return e.jsx(ps.div,{tabIndex:-1,...c,ref:g,onKeyDown:j})});xu.displayName=jI;function NI(t,{select:s=!1}={}){const n=document.activeElement;for(const r of t)if(El(r,{select:s}),document.activeElement!==n)return}function wI(t){const s=Y2(t),n=Sw(s,t),r=Sw(s.reverse(),t);return[n,r]}function Y2(t){const s=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)s.push(n.currentNode);return s}function Sw(t,s){for(const n of t)if(!SI(n,{upTo:s}))return n}function SI(t,{upTo:s}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(s!==void 0&&t===s)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function CI(t){return t instanceof HTMLInputElement&&"select"in t}function El(t,{select:s=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&CI(t)&&s&&t.select()}}var Cw=AI();function AI(){let t=[];return{add(s){const n=t[0];s!==n&&(n==null||n.pause()),t=Aw(t,s),t.unshift(s)},remove(s){var n;t=Aw(t,s),(n=t[0])==null||n.resume()}}}function Aw(t,s){const n=[...t],r=n.indexOf(s);return r!==-1&&n.splice(r,1),n}function kI(t){return t.filter(s=>s.tagName!=="A")}var RI=Im[" useId ".trim().toString()]||(()=>{}),EI=0;function hr(t){const[s,n]=v.useState(RI());return Zn(()=>{n(r=>r??String(EI++))},[t]),t||(s?`radix-${s}`:"")}const DI=["top","right","bottom","left"],Bl=Math.min,ia=Math.max,jm=Math.round,Eh=Math.floor,gi=t=>({x:t,y:t}),TI={left:"right",right:"left",bottom:"top",top:"bottom"};function dv(t,s,n){return ia(t,Bl(s,n))}function Qi(t,s){return typeof t=="function"?t(s):t}function Xi(t){return t.split("-")[0]}function Uc(t){return t.split("-")[1]}function rb(t){return t==="x"?"y":"x"}function ab(t){return t==="y"?"height":"width"}function xi(t){const s=t[0];return s==="t"||s==="b"?"y":"x"}function ib(t){return rb(xi(t))}function _I(t,s,n){n===void 0&&(n=!1);const r=Uc(t),a=ib(t),l=ab(a);let c=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return s.reference[l]>s.floating[l]&&(c=Nm(c)),[c,Nm(c)]}function PI(t){const s=Nm(t);return[uv(t),s,uv(s)]}function uv(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const kw=["left","right"],Rw=["right","left"],OI=["top","bottom"],LI=["bottom","top"];function II(t,s,n){switch(t){case"top":case"bottom":return n?s?Rw:kw:s?kw:Rw;case"left":case"right":return s?OI:LI;default:return[]}}function MI(t,s,n,r){const a=Uc(t);let l=II(Xi(t),n==="start",r);return a&&(l=l.map(c=>c+"-"+a),s&&(l=l.concat(l.map(uv)))),l}function Nm(t){const s=Xi(t);return TI[s]+t.slice(s.length)}function FI(t){return{top:0,right:0,bottom:0,left:0,...t}}function Z2(t){return typeof t!="number"?FI(t):{top:t,right:t,bottom:t,left:t}}function wm(t){const{x:s,y:n,width:r,height:a}=t;return{width:r,height:a,top:n,left:s,right:s+r,bottom:n+a,x:s,y:n}}function Ew(t,s,n){let{reference:r,floating:a}=t;const l=xi(s),c=ib(s),d=ab(c),m=Xi(s),x=l==="y",f=r.x+r.width/2-a.width/2,h=r.y+r.height/2-a.height/2,g=r[d]/2-a[d]/2;let u;switch(m){case"top":u={x:f,y:r.y-a.height};break;case"bottom":u={x:f,y:r.y+r.height};break;case"right":u={x:r.x+r.width,y:h};break;case"left":u={x:r.x-a.width,y:h};break;default:u={x:r.x,y:r.y}}switch(Uc(s)){case"start":u[c]-=g*(n&&x?-1:1);break;case"end":u[c]+=g*(n&&x?-1:1);break}return u}async function BI(t,s){var n;s===void 0&&(s={});const{x:r,y:a,platform:l,rects:c,elements:d,strategy:m}=t,{boundary:x="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:u=0}=Qi(s,t),j=Z2(u),y=d[g?h==="floating"?"reference":"floating":h],N=wm(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(y)))==null||n?y:y.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:x,rootBoundary:f,strategy:m})),S=h==="floating"?{x:r,y:a,width:c.floating.width,height:c.floating.height}:c.reference,A=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),w=await(l.isElement==null?void 0:l.isElement(A))?await(l.getScale==null?void 0:l.getScale(A))||{x:1,y:1}:{x:1,y:1},E=wm(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:S,offsetParent:A,strategy:m}):S);return{top:(N.top-E.top+j.top)/w.y,bottom:(E.bottom-N.bottom+j.bottom)/w.y,left:(N.left-E.left+j.left)/w.x,right:(E.right-N.right+j.right)/w.x}}const $I=50,qI=async(t,s,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:l=[],platform:c}=n,d=c.detectOverflow?c:{...c,detectOverflow:BI},m=await(c.isRTL==null?void 0:c.isRTL(s));let x=await c.getElementRects({reference:t,floating:s,strategy:a}),{x:f,y:h}=Ew(x,r,m),g=r,u=0;const j={};for(let p=0;p({name:"arrow",options:t,async fn(s){const{x:n,y:r,placement:a,rects:l,platform:c,elements:d,middlewareData:m}=s,{element:x,padding:f=0}=Qi(t,s)||{};if(x==null)return{};const h=Z2(f),g={x:n,y:r},u=ib(a),j=ab(u),p=await c.getDimensions(x),y=u==="y",N=y?"top":"left",S=y?"bottom":"right",A=y?"clientHeight":"clientWidth",w=l.reference[j]+l.reference[u]-g[u]-l.floating[j],E=g[u]-l.reference[u],T=await(c.getOffsetParent==null?void 0:c.getOffsetParent(x));let C=T?T[A]:0;(!C||!await(c.isElement==null?void 0:c.isElement(T)))&&(C=d.floating[A]||l.floating[j]);const L=w/2-E/2,$=C/2-p[j]/2-1,_=Bl(h[N],$),R=Bl(h[S],$),P=_,M=C-p[j]-R,q=C/2-p[j]/2+L,K=dv(P,q,M),Z=!m.arrow&&Uc(a)!=null&&q!==K&&l.reference[j]/2-(qq<=0)){var R,P;const q=(((R=l.flip)==null?void 0:R.index)||0)+1,K=C[q];if(K&&(!(h==="alignment"?S!==xi(K):!1)||_.every(U=>xi(U.placement)===S?U.overflows[0]>0:!0)))return{data:{index:q,overflows:_},reset:{placement:K}};let Z=(P=_.filter(W=>W.overflows[0]<=0).sort((W,U)=>W.overflows[1]-U.overflows[1])[0])==null?void 0:P.placement;if(!Z)switch(u){case"bestFit":{var M;const W=(M=_.filter(U=>{if(T){const F=xi(U.placement);return F===S||F==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(F=>F>0).reduce((F,B)=>F+B,0)]).sort((U,F)=>U[1]-F[1])[0])==null?void 0:M[0];W&&(Z=W);break}case"initialPlacement":Z=d;break}if(a!==Z)return{reset:{placement:Z}}}return{}}}};function Dw(t,s){return{top:t.top-s.height,right:t.right-s.width,bottom:t.bottom-s.height,left:t.left-s.width}}function Tw(t){return DI.some(s=>t[s]>=0)}const VI=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(s){const{rects:n,platform:r}=s,{strategy:a="referenceHidden",...l}=Qi(t,s);switch(a){case"referenceHidden":{const c=await r.detectOverflow(s,{...l,elementContext:"reference"}),d=Dw(c,n.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:Tw(d)}}}case"escaped":{const c=await r.detectOverflow(s,{...l,altBoundary:!0}),d=Dw(c,n.floating);return{data:{escapedOffsets:d,escaped:Tw(d)}}}default:return{}}}}},Q2=new Set(["left","top"]);async function HI(t,s){const{placement:n,platform:r,elements:a}=t,l=await(r.isRTL==null?void 0:r.isRTL(a.floating)),c=Xi(n),d=Uc(n),m=xi(n)==="y",x=Q2.has(c)?-1:1,f=l&&m?-1:1,h=Qi(s,t);let{mainAxis:g,crossAxis:u,alignmentAxis:j}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return d&&typeof j=="number"&&(u=d==="end"?j*-1:j),m?{x:u*f,y:g*x}:{x:g*x,y:u*f}}const WI=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(s){var n,r;const{x:a,y:l,placement:c,middlewareData:d}=s,m=await HI(s,t);return c===((n=d.offset)==null?void 0:n.placement)&&(r=d.arrow)!=null&&r.alignmentOffset?{}:{x:a+m.x,y:l+m.y,data:{...m,placement:c}}}}},KI=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(s){const{x:n,y:r,placement:a,platform:l}=s,{mainAxis:c=!0,crossAxis:d=!1,limiter:m={fn:N=>{let{x:S,y:A}=N;return{x:S,y:A}}},...x}=Qi(t,s),f={x:n,y:r},h=await l.detectOverflow(s,x),g=xi(Xi(a)),u=rb(g);let j=f[u],p=f[g];if(c){const N=u==="y"?"top":"left",S=u==="y"?"bottom":"right",A=j+h[N],w=j-h[S];j=dv(A,j,w)}if(d){const N=g==="y"?"top":"left",S=g==="y"?"bottom":"right",A=p+h[N],w=p-h[S];p=dv(A,p,w)}const y=m.fn({...s,[u]:j,[g]:p});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[u]:c,[g]:d}}}}}},GI=function(t){return t===void 0&&(t={}),{options:t,fn(s){const{x:n,y:r,placement:a,rects:l,middlewareData:c}=s,{offset:d=0,mainAxis:m=!0,crossAxis:x=!0}=Qi(t,s),f={x:n,y:r},h=xi(a),g=rb(h);let u=f[g],j=f[h];const p=Qi(d,s),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(m){const A=g==="y"?"height":"width",w=l.reference[g]-l.floating[A]+y.mainAxis,E=l.reference[g]+l.reference[A]-y.mainAxis;uE&&(u=E)}if(x){var N,S;const A=g==="y"?"width":"height",w=Q2.has(Xi(a)),E=l.reference[h]-l.floating[A]+(w&&((N=c.offset)==null?void 0:N[h])||0)+(w?0:y.crossAxis),T=l.reference[h]+l.reference[A]+(w?0:((S=c.offset)==null?void 0:S[h])||0)-(w?y.crossAxis:0);jT&&(j=T)}return{[g]:u,[h]:j}}}},YI=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(s){var n,r;const{placement:a,rects:l,platform:c,elements:d}=s,{apply:m=()=>{},...x}=Qi(t,s),f=await c.detectOverflow(s,x),h=Xi(a),g=Uc(a),u=xi(a)==="y",{width:j,height:p}=l.floating;let y,N;h==="top"||h==="bottom"?(y=h,N=g===(await(c.isRTL==null?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(N=h,y=g==="end"?"top":"bottom");const S=p-f.top-f.bottom,A=j-f.left-f.right,w=Bl(p-f[y],S),E=Bl(j-f[N],A),T=!s.middlewareData.shift;let C=w,L=E;if((n=s.middlewareData.shift)!=null&&n.enabled.x&&(L=A),(r=s.middlewareData.shift)!=null&&r.enabled.y&&(C=S),T&&!g){const _=ia(f.left,0),R=ia(f.right,0),P=ia(f.top,0),M=ia(f.bottom,0);u?L=j-2*(_!==0||R!==0?_+R:ia(f.left,f.right)):C=p-2*(P!==0||M!==0?P+M:ia(f.top,f.bottom))}await m({...s,availableWidth:L,availableHeight:C});const $=await c.getDimensions(d.floating);return j!==$.width||p!==$.height?{reset:{rects:!0}}:{}}}};function ef(){return typeof window<"u"}function Vc(t){return X2(t)?(t.nodeName||"").toLowerCase():"#document"}function ua(t){var s;return(t==null||(s=t.ownerDocument)==null?void 0:s.defaultView)||window}function wi(t){var s;return(s=(X2(t)?t.ownerDocument:t.document)||window.document)==null?void 0:s.documentElement}function X2(t){return ef()?t instanceof Node||t instanceof ua(t).Node:!1}function Ja(t){return ef()?t instanceof Element||t instanceof ua(t).Element:!1}function tl(t){return ef()?t instanceof HTMLElement||t instanceof ua(t).HTMLElement:!1}function _w(t){return!ef()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ua(t).ShadowRoot}function gu(t){const{overflow:s,overflowX:n,overflowY:r,display:a}=ei(t);return/auto|scroll|overlay|hidden|clip/.test(s+r+n)&&a!=="inline"&&a!=="contents"}function ZI(t){return/^(table|td|th)$/.test(Vc(t))}function tf(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const QI=/transform|translate|scale|rotate|perspective|filter/,XI=/paint|layout|strict|content/,wo=t=>!!t&&t!=="none";let Ox;function lb(t){const s=Ja(t)?ei(t):t;return wo(s.transform)||wo(s.translate)||wo(s.scale)||wo(s.rotate)||wo(s.perspective)||!ob()&&(wo(s.backdropFilter)||wo(s.filter))||QI.test(s.willChange||"")||XI.test(s.contain||"")}function JI(t){let s=$l(t);for(;tl(s)&&!_c(s);){if(lb(s))return s;if(tf(s))return null;s=$l(s)}return null}function ob(){return Ox==null&&(Ox=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ox}function _c(t){return/^(html|body|#document)$/.test(Vc(t))}function ei(t){return ua(t).getComputedStyle(t)}function sf(t){return Ja(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $l(t){if(Vc(t)==="html")return t;const s=t.assignedSlot||t.parentNode||_w(t)&&t.host||wi(t);return _w(s)?s.host:s}function J2(t){const s=$l(t);return _c(s)?t.ownerDocument?t.ownerDocument.body:t.body:tl(s)&&gu(s)?s:J2(s)}function Qd(t,s,n){var r;s===void 0&&(s=[]),n===void 0&&(n=!0);const a=J2(t),l=a===((r=t.ownerDocument)==null?void 0:r.body),c=ua(a);if(l){const d=hv(c);return s.concat(c,c.visualViewport||[],gu(a)?a:[],d&&n?Qd(d):[])}else return s.concat(a,Qd(a,[],n))}function hv(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function eA(t){const s=ei(t);let n=parseFloat(s.width)||0,r=parseFloat(s.height)||0;const a=tl(t),l=a?t.offsetWidth:n,c=a?t.offsetHeight:r,d=jm(n)!==l||jm(r)!==c;return d&&(n=l,r=c),{width:n,height:r,$:d}}function cb(t){return Ja(t)?t:t.contextElement}function Cc(t){const s=cb(t);if(!tl(s))return gi(1);const n=s.getBoundingClientRect(),{width:r,height:a,$:l}=eA(s);let c=(l?jm(n.width):n.width)/r,d=(l?jm(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!d||!Number.isFinite(d))&&(d=1),{x:c,y:d}}const e6=gi(0);function tA(t){const s=ua(t);return!ob()||!s.visualViewport?e6:{x:s.visualViewport.offsetLeft,y:s.visualViewport.offsetTop}}function t6(t,s,n){return s===void 0&&(s=!1),!n||s&&n!==ua(t)?!1:s}function Bo(t,s,n,r){s===void 0&&(s=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),l=cb(t);let c=gi(1);s&&(r?Ja(r)&&(c=Cc(r)):c=Cc(t));const d=t6(l,n,r)?tA(l):gi(0);let m=(a.left+d.x)/c.x,x=(a.top+d.y)/c.y,f=a.width/c.x,h=a.height/c.y;if(l){const g=ua(l),u=r&&Ja(r)?ua(r):r;let j=g,p=hv(j);for(;p&&r&&u!==j;){const y=Cc(p),N=p.getBoundingClientRect(),S=ei(p),A=N.left+(p.clientLeft+parseFloat(S.paddingLeft))*y.x,w=N.top+(p.clientTop+parseFloat(S.paddingTop))*y.y;m*=y.x,x*=y.y,f*=y.x,h*=y.y,m+=A,x+=w,j=ua(p),p=hv(j)}}return wm({width:f,height:h,x:m,y:x})}function nf(t,s){const n=sf(t).scrollLeft;return s?s.left+n:Bo(wi(t)).left+n}function sA(t,s){const n=t.getBoundingClientRect(),r=n.left+s.scrollLeft-nf(t,n),a=n.top+s.scrollTop;return{x:r,y:a}}function s6(t){let{elements:s,rect:n,offsetParent:r,strategy:a}=t;const l=a==="fixed",c=wi(r),d=s?tf(s.floating):!1;if(r===c||d&&l)return n;let m={scrollLeft:0,scrollTop:0},x=gi(1);const f=gi(0),h=tl(r);if((h||!h&&!l)&&((Vc(r)!=="body"||gu(c))&&(m=sf(r)),h)){const u=Bo(r);x=Cc(r),f.x=u.x+r.clientLeft,f.y=u.y+r.clientTop}const g=c&&!h&&!l?sA(c,m):gi(0);return{width:n.width*x.x,height:n.height*x.y,x:n.x*x.x-m.scrollLeft*x.x+f.x+g.x,y:n.y*x.y-m.scrollTop*x.y+f.y+g.y}}function n6(t){return Array.from(t.getClientRects())}function r6(t){const s=wi(t),n=sf(t),r=t.ownerDocument.body,a=ia(s.scrollWidth,s.clientWidth,r.scrollWidth,r.clientWidth),l=ia(s.scrollHeight,s.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+nf(t);const d=-n.scrollTop;return ei(r).direction==="rtl"&&(c+=ia(s.clientWidth,r.clientWidth)-a),{width:a,height:l,x:c,y:d}}const Pw=25;function a6(t,s){const n=ua(t),r=wi(t),a=n.visualViewport;let l=r.clientWidth,c=r.clientHeight,d=0,m=0;if(a){l=a.width,c=a.height;const f=ob();(!f||f&&s==="fixed")&&(d=a.offsetLeft,m=a.offsetTop)}const x=nf(r);if(x<=0){const f=r.ownerDocument,h=f.body,g=getComputedStyle(h),u=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,j=Math.abs(r.clientWidth-h.clientWidth-u);j<=Pw&&(l-=j)}else x<=Pw&&(l+=x);return{width:l,height:c,x:d,y:m}}function i6(t,s){const n=Bo(t,!0,s==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,l=tl(t)?Cc(t):gi(1),c=t.clientWidth*l.x,d=t.clientHeight*l.y,m=a*l.x,x=r*l.y;return{width:c,height:d,x:m,y:x}}function Ow(t,s,n){let r;if(s==="viewport")r=a6(t,n);else if(s==="document")r=r6(wi(t));else if(Ja(s))r=i6(s,n);else{const a=tA(t);r={x:s.x-a.x,y:s.y-a.y,width:s.width,height:s.height}}return wm(r)}function nA(t,s){const n=$l(t);return n===s||!Ja(n)||_c(n)?!1:ei(n).position==="fixed"||nA(n,s)}function l6(t,s){const n=s.get(t);if(n)return n;let r=Qd(t,[],!1).filter(d=>Ja(d)&&Vc(d)!=="body"),a=null;const l=ei(t).position==="fixed";let c=l?$l(t):t;for(;Ja(c)&&!_c(c);){const d=ei(c),m=lb(c);!m&&d.position==="fixed"&&(a=null),(l?!m&&!a:!m&&d.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||gu(c)&&!m&&nA(t,c))?r=r.filter(f=>f!==c):a=d,c=$l(c)}return s.set(t,r),r}function o6(t){let{element:s,boundary:n,rootBoundary:r,strategy:a}=t;const c=[...n==="clippingAncestors"?tf(s)?[]:l6(s,this._c):[].concat(n),r],d=Ow(s,c[0],a);let m=d.top,x=d.right,f=d.bottom,h=d.left;for(let g=1;g{c(!1,1e-7)},1e3)}C===1&&!aA(x,t.getBoundingClientRect())&&c(),w=!1}try{n=new IntersectionObserver(E,{...A,root:a.ownerDocument})}catch{n=new IntersectionObserver(E,A)}n.observe(t)}return c(!0),l}function p6(t,s,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=r,x=cb(t),f=a||l?[...x?Qd(x):[],...s?Qd(s):[]]:[];f.forEach(N=>{a&&N.addEventListener("scroll",n,{passive:!0}),l&&N.addEventListener("resize",n)});const h=x&&d?f6(x,n):null;let g=-1,u=null;c&&(u=new ResizeObserver(N=>{let[S]=N;S&&S.target===x&&u&&s&&(u.unobserve(s),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var A;(A=u)==null||A.observe(s)})),n()}),x&&!m&&u.observe(x),s&&u.observe(s));let j,p=m?Bo(t):null;m&&y();function y(){const N=Bo(t);p&&!aA(p,N)&&n(),p=N,j=requestAnimationFrame(y)}return n(),()=>{var N;f.forEach(S=>{a&&S.removeEventListener("scroll",n),l&&S.removeEventListener("resize",n)}),h==null||h(),(N=u)==null||N.disconnect(),u=null,m&&cancelAnimationFrame(j)}}const x6=WI,g6=KI,v6=UI,b6=YI,y6=VI,Iw=zI,j6=GI,N6=(t,s,n)=>{const r=new Map,a={platform:m6,...n},l={...a.platform,_c:r};return qI(t,s,{...a,platform:l})};var w6=typeof document<"u",S6=function(){},Jh=w6?v.useLayoutEffect:S6;function Sm(t,s){if(t===s)return!0;if(typeof t!=typeof s)return!1;if(typeof t=="function"&&t.toString()===s.toString())return!0;let n,r,a;if(t&&s&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==s.length)return!1;for(r=n;r--!==0;)if(!Sm(t[r],s[r]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(s).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(s,a[r]))return!1;for(r=n;r--!==0;){const l=a[r];if(!(l==="_owner"&&t.$$typeof)&&!Sm(t[l],s[l]))return!1}return!0}return t!==t&&s!==s}function iA(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Mw(t,s){const n=iA(t);return Math.round(s*n)/n}function Ix(t){const s=v.useRef(t);return Jh(()=>{s.current=t}),s}function C6(t){t===void 0&&(t={});const{placement:s="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:l,floating:c}={},transform:d=!0,whileElementsMounted:m,open:x}=t,[f,h]=v.useState({x:0,y:0,strategy:n,placement:s,middlewareData:{},isPositioned:!1}),[g,u]=v.useState(r);Sm(g,r)||u(r);const[j,p]=v.useState(null),[y,N]=v.useState(null),S=v.useCallback(U=>{U!==T.current&&(T.current=U,p(U))},[]),A=v.useCallback(U=>{U!==C.current&&(C.current=U,N(U))},[]),w=l||j,E=c||y,T=v.useRef(null),C=v.useRef(null),L=v.useRef(f),$=m!=null,_=Ix(m),R=Ix(a),P=Ix(x),M=v.useCallback(()=>{if(!T.current||!C.current)return;const U={placement:s,strategy:n,middleware:g};R.current&&(U.platform=R.current),N6(T.current,C.current,U).then(F=>{const B={...F,isPositioned:P.current!==!1};q.current&&!Sm(L.current,B)&&(L.current=B,cu.flushSync(()=>{h(B)}))})},[g,s,n,R,P]);Jh(()=>{x===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,h(U=>({...U,isPositioned:!1})))},[x]);const q=v.useRef(!1);Jh(()=>(q.current=!0,()=>{q.current=!1}),[]),Jh(()=>{if(w&&(T.current=w),E&&(C.current=E),w&&E){if(_.current)return _.current(w,E,M);M()}},[w,E,M,_,$]);const K=v.useMemo(()=>({reference:T,floating:C,setReference:S,setFloating:A}),[S,A]),Z=v.useMemo(()=>({reference:w,floating:E}),[w,E]),W=v.useMemo(()=>{const U={position:n,left:0,top:0};if(!Z.floating)return U;const F=Mw(Z.floating,f.x),B=Mw(Z.floating,f.y);return d?{...U,transform:"translate("+F+"px, "+B+"px)",...iA(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:B}},[n,d,Z.floating,f.x,f.y]);return v.useMemo(()=>({...f,update:M,refs:K,elements:Z,floatingStyles:W}),[f,M,K,Z,W])}const A6=t=>{function s(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:a}=typeof t=="function"?t(n):t;return r&&s(r)?r.current!=null?Iw({element:r.current,padding:a}).fn(n):{}:r?Iw({element:r,padding:a}).fn(n):{}}}},k6=(t,s)=>{const n=x6(t);return{name:n.name,fn:n.fn,options:[t,s]}},R6=(t,s)=>{const n=g6(t);return{name:n.name,fn:n.fn,options:[t,s]}},E6=(t,s)=>({fn:j6(t).fn,options:[t,s]}),D6=(t,s)=>{const n=v6(t);return{name:n.name,fn:n.fn,options:[t,s]}},T6=(t,s)=>{const n=b6(t);return{name:n.name,fn:n.fn,options:[t,s]}},_6=(t,s)=>{const n=y6(t);return{name:n.name,fn:n.fn,options:[t,s]}},P6=(t,s)=>{const n=A6(t);return{name:n.name,fn:n.fn,options:[t,s]}};var O6="Arrow",lA=v.forwardRef((t,s)=>{const{children:n,width:r=10,height:a=5,...l}=t;return e.jsx(ps.svg,{...l,ref:s,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});lA.displayName=O6;var L6=lA,db="Popper",[oA,Vl]=ea(db),[I6,cA]=oA(db),dA=t=>{const{__scopePopper:s,children:n}=t,[r,a]=v.useState(null);return e.jsx(I6,{scope:s,anchor:r,onAnchorChange:a,children:n})};dA.displayName=db;var uA="PopperAnchor",hA=v.forwardRef((t,s)=>{const{__scopePopper:n,virtualRef:r,...a}=t,l=cA(uA,n),c=v.useRef(null),d=Ms(s,c),m=v.useRef(null);return v.useEffect(()=>{const x=m.current;m.current=(r==null?void 0:r.current)||c.current,x!==m.current&&l.onAnchorChange(m.current)}),r?null:e.jsx(ps.div,{...a,ref:d})});hA.displayName=uA;var ub="PopperContent",[M6,F6]=oA(ub),mA=v.forwardRef((t,s)=>{var X,ne,oe,re,ge,ve;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:l="center",alignOffset:c=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:x=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:u="optimized",onPlaced:j,...p}=t,y=cA(ub,n),[N,S]=v.useState(null),A=Ms(s,Se=>S(Se)),[w,E]=v.useState(null),T=Zv(w),C=(T==null?void 0:T.width)??0,L=(T==null?void 0:T.height)??0,$=r+(l!=="center"?"-"+l:""),_=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},R=Array.isArray(x)?x:[x],P=R.length>0,M={padding:_,boundary:R.filter($6),altBoundary:P},{refs:q,floatingStyles:K,placement:Z,isPositioned:W,middlewareData:U}=C6({strategy:"fixed",placement:$,whileElementsMounted:(...Se)=>p6(...Se,{animationFrame:u==="always"}),elements:{reference:y.anchor},middleware:[k6({mainAxis:a+L,alignmentAxis:c}),m&&R6({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?E6():void 0,...M}),m&&D6({...M}),T6({...M,apply:({elements:Se,rects:We,availableWidth:Ce,availableHeight:fe})=>{const{width:Ye,height:be}=We.reference,Pe=Se.floating.style;Pe.setProperty("--radix-popper-available-width",`${Ce}px`),Pe.setProperty("--radix-popper-available-height",`${fe}px`),Pe.setProperty("--radix-popper-anchor-width",`${Ye}px`),Pe.setProperty("--radix-popper-anchor-height",`${be}px`)}}),w&&P6({element:w,padding:d}),q6({arrowWidth:C,arrowHeight:L}),g&&_6({strategy:"referenceHidden",...M})]}),[F,B]=xA(Z),D=dr(j);Zn(()=>{W&&(D==null||D())},[W,D]);const O=(X=U.arrow)==null?void 0:X.x,z=(ne=U.arrow)==null?void 0:ne.y,G=((oe=U.arrow)==null?void 0:oe.centerOffset)!==0,[Y,V]=v.useState();return Zn(()=>{N&&V(window.getComputedStyle(N).zIndex)},[N]),e.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:W?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[(re=U.transformOrigin)==null?void 0:re.x,(ge=U.transformOrigin)==null?void 0:ge.y].join(" "),...((ve=U.hide)==null?void 0:ve.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(M6,{scope:n,placedSide:F,onArrowChange:E,arrowX:O,arrowY:z,shouldHideArrow:G,children:e.jsx(ps.div,{"data-side":F,"data-align":B,...p,ref:A,style:{...p.style,animation:W?void 0:"none"}})})})});mA.displayName=ub;var fA="PopperArrow",B6={top:"bottom",right:"left",bottom:"top",left:"right"},pA=v.forwardRef(function(s,n){const{__scopePopper:r,...a}=s,l=F6(fA,r),c=B6[l.placedSide];return e.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:e.jsx(L6,{...a,ref:n,style:{...a.style,display:"block"}})})});pA.displayName=fA;function $6(t){return t!==null}var q6=t=>({name:"transformOrigin",options:t,fn(s){var y,N,S;const{placement:n,rects:r,middlewareData:a}=s,c=((y=a.arrow)==null?void 0:y.centerOffset)!==0,d=c?0:t.arrowWidth,m=c?0:t.arrowHeight,[x,f]=xA(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((N=a.arrow)==null?void 0:N.x)??0)+d/2,u=(((S=a.arrow)==null?void 0:S.y)??0)+m/2;let j="",p="";return x==="bottom"?(j=c?h:`${g}px`,p=`${-m}px`):x==="top"?(j=c?h:`${g}px`,p=`${r.floating.height+m}px`):x==="right"?(j=`${-m}px`,p=c?h:`${u}px`):x==="left"&&(j=`${r.floating.width+m}px`,p=c?h:`${u}px`),{data:{x:j,y:p}}}});function xA(t){const[s,n="center"]=t.split("-");return[s,n]}var rf=dA,vu=hA,af=mA,lf=pA,z6="Portal",Hc=v.forwardRef((t,s)=>{var d;const{container:n,...r}=t,[a,l]=v.useState(!1);Zn(()=>l(!0),[]);const c=n||a&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return c?Vv.createPortal(e.jsx(ps.div,{...r,ref:s}),c):null});Hc.displayName=z6;var Mx="rovingFocusGroup.onEntryFocus",U6={bubbles:!1,cancelable:!0},bu="RovingFocusGroup",[mv,gA,V6]=nb(bu),[H6,of]=ea(bu,[V6]),[W6,K6]=H6(bu),vA=v.forwardRef((t,s)=>e.jsx(mv.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(mv.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(G6,{...t,ref:s})})}));vA.displayName=bu;var G6=v.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:l,currentTabStopId:c,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:x,preventScrollOnEntryFocus:f=!1,...h}=t,g=v.useRef(null),u=Ms(s,g),j=pu(l),[p,y]=bi({prop:c,defaultProp:d??null,onChange:m,caller:bu}),[N,S]=v.useState(!1),A=dr(x),w=gA(n),E=v.useRef(!1),[T,C]=v.useState(0);return v.useEffect(()=>{const L=g.current;if(L)return L.addEventListener(Mx,A),()=>L.removeEventListener(Mx,A)},[A]),e.jsx(W6,{scope:n,orientation:r,dir:j,loop:a,currentTabStopId:p,onItemFocus:v.useCallback(L=>y(L),[y]),onItemShiftTab:v.useCallback(()=>S(!0),[]),onFocusableItemAdd:v.useCallback(()=>C(L=>L+1),[]),onFocusableItemRemove:v.useCallback(()=>C(L=>L-1),[]),children:e.jsx(ps.div,{tabIndex:N||T===0?-1:0,"data-orientation":r,...h,ref:u,style:{outline:"none",...t.style},onMouseDown:Vt(t.onMouseDown,()=>{E.current=!0}),onFocus:Vt(t.onFocus,L=>{const $=!E.current;if(L.target===L.currentTarget&&$&&!N){const _=new CustomEvent(Mx,U6);if(L.currentTarget.dispatchEvent(_),!_.defaultPrevented){const R=w().filter(Z=>Z.focusable),P=R.find(Z=>Z.active),M=R.find(Z=>Z.id===p),K=[P,M,...R].filter(Boolean).map(Z=>Z.ref.current);jA(K,f)}}E.current=!1}),onBlur:Vt(t.onBlur,()=>S(!1))})})}),bA="RovingFocusGroupItem",yA=v.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:l,children:c,...d}=t,m=hr(),x=l||m,f=K6(bA,n),h=f.currentTabStopId===x,g=gA(n),{onFocusableItemAdd:u,onFocusableItemRemove:j,currentTabStopId:p}=f;return v.useEffect(()=>{if(r)return u(),()=>j()},[r,u,j]),e.jsx(mv.ItemSlot,{scope:n,id:x,focusable:r,active:a,children:e.jsx(ps.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...d,ref:s,onMouseDown:Vt(t.onMouseDown,y=>{r?f.onItemFocus(x):y.preventDefault()}),onFocus:Vt(t.onFocus,()=>f.onItemFocus(x)),onKeyDown:Vt(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const N=Q6(y,f.orientation,f.dir);if(N!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let A=g().filter(w=>w.focusable).map(w=>w.ref.current);if(N==="last")A.reverse();else if(N==="prev"||N==="next"){N==="prev"&&A.reverse();const w=A.indexOf(y.currentTarget);A=f.loop?X6(A,w+1):A.slice(w+1)}setTimeout(()=>jA(A))}}),children:typeof c=="function"?c({isCurrentTabStop:h,hasTabStop:p!=null}):c})})});yA.displayName=bA;var Y6={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Z6(t,s){return s!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Q6(t,s,n){const r=Z6(t.key,n);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Y6[r]}function jA(t,s=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:s}),document.activeElement!==n))return}function X6(t,s){return t.map((n,r)=>t[(s+r)%t.length])}var NA=vA,wA=yA;function J6(t){const s=e3(t),n=v.forwardRef((r,a)=>{const{children:l,...c}=r,d=v.Children.toArray(l),m=d.find(s3);if(m){const x=m.props.children,f=d.map(h=>h===m?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:h);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}function e3(t){const s=v.forwardRef((n,r)=>{const{children:a,...l}=n;if(v.isValidElement(a)){const c=r3(a),d=n3(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var t3=Symbol("radix.slottable");function s3(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===t3}function n3(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const m=l(...d);return a(...d),m}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function r3(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var a3=function(t){if(typeof document>"u")return null;var s=Array.isArray(t)?t[0]:t;return s.ownerDocument.body},pc=new WeakMap,Dh=new WeakMap,Th={},Fx=0,SA=function(t){return t&&(t.host||SA(t.parentNode))},i3=function(t,s){return s.map(function(n){if(t.contains(n))return n;var r=SA(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},l3=function(t,s,n,r){var a=i3(s,Array.isArray(t)?t:[t]);Th[n]||(Th[n]=new WeakMap);var l=Th[n],c=[],d=new Set,m=new Set(a),x=function(h){!h||d.has(h)||(d.add(h),x(h.parentNode))};a.forEach(x);var f=function(h){!h||m.has(h)||Array.prototype.forEach.call(h.children,function(g){if(d.has(g))f(g);else try{var u=g.getAttribute(r),j=u!==null&&u!=="false",p=(pc.get(g)||0)+1,y=(l.get(g)||0)+1;pc.set(g,p),l.set(g,y),c.push(g),p===1&&j&&Dh.set(g,!0),y===1&&g.setAttribute(n,"true"),j||g.setAttribute(r,"true")}catch(N){console.error("aria-hidden: cannot operate on ",g,N)}})};return f(s),d.clear(),Fx++,function(){c.forEach(function(h){var g=pc.get(h)-1,u=l.get(h)-1;pc.set(h,g),l.set(h,u),g||(Dh.has(h)||h.removeAttribute(r),Dh.delete(h)),u||h.removeAttribute(n)}),Fx--,Fx||(pc=new WeakMap,pc=new WeakMap,Dh=new WeakMap,Th={})}},cf=function(t,s,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=a3(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),l3(r,a,n,"aria-hidden")):function(){return null}},pi=function(){return pi=Object.assign||function(s){for(var n,r=1,a=arguments.length;r"u")return S3;var s=C3(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:s[0],top:s[1],right:s[2],gap:Math.max(0,r-n+s[2]-s[0])}},k3=RA(),Ac="data-scroll-locked",R3=function(t,s,n,r){var a=t.left,l=t.top,c=t.right,d=t.gap;return n===void 0&&(n="margin"),` + .`.concat(c3,` { overflow: hidden `).concat(r,`; padding-right: `).concat(d,"px ").concat(r,`; } @@ -647,33 +647,33 @@ Error generating stack: `+H.message+` `),n==="padding"&&"padding-right: ".concat(d,"px ").concat(r,";")].filter(Boolean).join(""),` } - .`).concat(Jh,` { + .`).concat(em,` { right: `).concat(d,"px ").concat(r,`; } - .`).concat(em,` { + .`).concat(tm,` { margin-right: `).concat(d,"px ").concat(r,`; } - .`).concat(Jh," .").concat(Jh,` { + .`).concat(em," .").concat(em,` { right: 0 `).concat(r,`; } - .`).concat(em," .").concat(em,` { + .`).concat(tm," .").concat(tm,` { margin-right: 0 `).concat(r,`; } body[`).concat(Ac,`] { - `).concat(a3,": ").concat(d,`px; + `).concat(d3,": ").concat(d,`px; } -`)},Lw=function(){var t=parseInt(document.body.getAttribute(Ac)||"0",10);return isFinite(t)?t:0},S3=function(){v.useEffect(function(){return document.body.setAttribute(Ac,(Lw()+1).toString()),function(){var t=Lw()-1;t<=0?document.body.removeAttribute(Ac):document.body.setAttribute(Ac,t.toString())}},[])},C3=function(t){var s=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;S3();var l=v.useMemo(function(){return j3(a)},[a]);return v.createElement(N3,{styles:w3(l,!s,a,n?"":"!important")})},uv=!1;if(typeof window<"u")try{var Ph=Object.defineProperty({},"passive",{get:function(){return uv=!0,!0}});window.addEventListener("test",Ph,Ph),window.removeEventListener("test",Ph,Ph)}catch{uv=!1}var xc=uv?{passive:!1}:!1,A3=function(t){return t.tagName==="TEXTAREA"},CA=function(t,s){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[s]!=="hidden"&&!(n.overflowY===n.overflowX&&!A3(t)&&n[s]==="visible")},k3=function(t){return CA(t,"overflowY")},R3=function(t){return CA(t,"overflowX")},Mw=function(t,s){var n=s.ownerDocument,r=s;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=AA(t,r);if(a){var l=kA(t,r),c=l[1],d=l[2];if(c>d)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},E3=function(t){var s=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[s,n,r]},D3=function(t){var s=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[s,n,r]},AA=function(t,s){return t==="v"?k3(s):R3(s)},kA=function(t,s){return t==="v"?E3(s):D3(s)},T3=function(t,s){return t==="h"&&s==="rtl"?-1:1},P3=function(t,s,n,r,a){var l=T3(t,window.getComputedStyle(s).direction),c=l*r,d=n.target,h=s.contains(d),x=!1,f=c>0,m=0,p=0;do{if(!d)break;var u=kA(t,d),j=u[0],g=u[1],y=u[2],N=g-y-l*j;(j||N)&&AA(t,d)&&(m+=N,p+=j);var S=d.parentNode;d=S&&S.nodeType===Node.DOCUMENT_FRAGMENT_NODE?S.host:S}while(!h&&d!==document.body||h&&(s.contains(d)||s===d));return(f&&Math.abs(m)<1||!f&&Math.abs(p)<1)&&(x=!0),x},_h=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Fw=function(t){return[t.deltaX,t.deltaY]},Bw=function(t){return t&&"current"in t?t.current:t},_3=function(t,s){return t[0]===s[0]&&t[1]===s[1]},O3=function(t){return` +`)},Bw=function(){var t=parseInt(document.body.getAttribute(Ac)||"0",10);return isFinite(t)?t:0},E3=function(){v.useEffect(function(){return document.body.setAttribute(Ac,(Bw()+1).toString()),function(){var t=Bw()-1;t<=0?document.body.removeAttribute(Ac):document.body.setAttribute(Ac,t.toString())}},[])},D3=function(t){var s=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;E3();var l=v.useMemo(function(){return A3(a)},[a]);return v.createElement(k3,{styles:R3(l,!s,a,n?"":"!important")})},fv=!1;if(typeof window<"u")try{var _h=Object.defineProperty({},"passive",{get:function(){return fv=!0,!0}});window.addEventListener("test",_h,_h),window.removeEventListener("test",_h,_h)}catch{fv=!1}var xc=fv?{passive:!1}:!1,T3=function(t){return t.tagName==="TEXTAREA"},EA=function(t,s){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[s]!=="hidden"&&!(n.overflowY===n.overflowX&&!T3(t)&&n[s]==="visible")},_3=function(t){return EA(t,"overflowY")},P3=function(t){return EA(t,"overflowX")},$w=function(t,s){var n=s.ownerDocument,r=s;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=DA(t,r);if(a){var l=TA(t,r),c=l[1],d=l[2];if(c>d)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},O3=function(t){var s=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[s,n,r]},L3=function(t){var s=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[s,n,r]},DA=function(t,s){return t==="v"?_3(s):P3(s)},TA=function(t,s){return t==="v"?O3(s):L3(s)},I3=function(t,s){return t==="h"&&s==="rtl"?-1:1},M3=function(t,s,n,r,a){var l=I3(t,window.getComputedStyle(s).direction),c=l*r,d=n.target,m=s.contains(d),x=!1,f=c>0,h=0,g=0;do{if(!d)break;var u=TA(t,d),j=u[0],p=u[1],y=u[2],N=p-y-l*j;(j||N)&&DA(t,d)&&(h+=N,g+=j);var S=d.parentNode;d=S&&S.nodeType===Node.DOCUMENT_FRAGMENT_NODE?S.host:S}while(!m&&d!==document.body||m&&(s.contains(d)||s===d));return(f&&Math.abs(h)<1||!f&&Math.abs(g)<1)&&(x=!0),x},Ph=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},qw=function(t){return[t.deltaX,t.deltaY]},zw=function(t){return t&&"current"in t?t.current:t},F3=function(t,s){return t[0]===s[0]&&t[1]===s[1]},B3=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},I3=0,gc=[];function L3(t){var s=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),a=v.useState(I3++)[0],l=v.useState(SA)[0],c=v.useRef(t);v.useEffect(function(){c.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var g=n3([t.lockRef.current],(t.shards||[]).map(Bw),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var d=v.useCallback(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!c.current.allowPinchZoom;var N=_h(g),S=n.current,C="deltaX"in g?g.deltaX:S[0]-N[0],w="deltaY"in g?g.deltaY:S[1]-N[1],R,P=g.target,A=Math.abs(C)>Math.abs(w)?"h":"v";if("touches"in g&&A==="h"&&P.type==="range")return!1;var I=window.getSelection(),$=I&&I.anchorNode,T=$?$===P||$.contains(P):!1;if(T)return!1;var E=Mw(A,P);if(!E)return!0;if(E?R=A:(R=A==="v"?"h":"v",E=Mw(A,P)),!E)return!1;if(!r.current&&"changedTouches"in g&&(C||w)&&(r.current=R),!R)return!0;var _=r.current||R;return P3(_,y,g,_==="h"?C:w)},[]),h=v.useCallback(function(g){var y=g;if(!(!gc.length||gc[gc.length-1]!==l)){var N="deltaY"in y?Fw(y):_h(y),S=s.current.filter(function(R){return R.name===y.type&&(R.target===y.target||y.target===R.shadowParent)&&_3(R.delta,N)})[0];if(S&&S.should){y.cancelable&&y.preventDefault();return}if(!S){var C=(c.current.shards||[]).map(Bw).filter(Boolean).filter(function(R){return R.contains(y.target)}),w=C.length>0?d(y,C[0]):!c.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),x=v.useCallback(function(g,y,N,S){var C={name:g,delta:y,target:N,should:S,shadowParent:M3(N)};s.current.push(C),setTimeout(function(){s.current=s.current.filter(function(w){return w!==C})},1)},[]),f=v.useCallback(function(g){n.current=_h(g),r.current=void 0},[]),m=v.useCallback(function(g){x(g.type,Fw(g),g.target,d(g,t.lockRef.current))},[]),p=v.useCallback(function(g){x(g.type,_h(g),g.target,d(g,t.lockRef.current))},[]);v.useEffect(function(){return gc.push(l),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:p}),document.addEventListener("wheel",h,xc),document.addEventListener("touchmove",h,xc),document.addEventListener("touchstart",f,xc),function(){gc=gc.filter(function(g){return g!==l}),document.removeEventListener("wheel",h,xc),document.removeEventListener("touchmove",h,xc),document.removeEventListener("touchstart",f,xc)}},[]);var u=t.removeScrollBar,j=t.inert;return v.createElement(v.Fragment,null,j?v.createElement(l,{styles:O3(a)}):null,u?v.createElement(C3,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function M3(t){for(var s=null;t!==null;)t instanceof ShadowRoot&&(s=t.host,t=t.host),t=t.parentNode;return s}const F3=h3(wA,L3);var yu=v.forwardRef(function(t,s){return v.createElement(of,pi({},t,{ref:s,sideCar:F3}))});yu.classNames=of.classNames;var hv=["Enter"," "],B3=["ArrowDown","PageUp","Home"],RA=["ArrowUp","PageDown","End"],$3=[...B3,...RA],q3={ltr:[...hv,"ArrowRight"],rtl:[...hv,"ArrowLeft"]},z3={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ju="Menu",[Xd,U3,V3]=eb(ju),[Ho,EA]=ea(ju,[V3,Vl,af]),cf=Vl(),DA=af(),[H3,Wo]=Ho(ju),[W3,Nu]=Ho(ju),TA=t=>{const{__scopeMenu:s,open:n=!1,children:r,dir:a,onOpenChange:l,modal:c=!0}=t,d=cf(s),[h,x]=v.useState(null),f=v.useRef(!1),m=dr(l),p=pu(a);return v.useEffect(()=>{const u=()=>{f.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>f.current=!1;return document.addEventListener("keydown",u,{capture:!0}),()=>{document.removeEventListener("keydown",u,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),e.jsx(sf,{...d,children:e.jsx(H3,{scope:s,open:n,onOpenChange:m,content:h,onContentChange:x,children:e.jsx(W3,{scope:s,onClose:v.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:p,modal:c,children:r})})})};TA.displayName=ju;var G3="MenuAnchor",cb=v.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t,a=cf(n);return e.jsx(vu,{...a,...r,ref:s})});cb.displayName=G3;var db="MenuPortal",[K3,PA]=Ho(db,{forceMount:void 0}),_A=t=>{const{__scopeMenu:s,forceMount:n,children:r,container:a}=t,l=Wo(db,s);return e.jsx(K3,{scope:s,forceMount:n,children:e.jsx(mr,{present:n||l.open,children:e.jsx(Hc,{asChild:!0,container:a,children:r})})})};_A.displayName=db;var ka="MenuContent",[Y3,ub]=Ho(ka),OA=v.forwardRef((t,s)=>{const n=PA(ka,t.__scopeMenu),{forceMount:r=n.forceMount,...a}=t,l=Wo(ka,t.__scopeMenu),c=Nu(ka,t.__scopeMenu);return e.jsx(Xd.Provider,{scope:t.__scopeMenu,children:e.jsx(mr,{present:r||l.open,children:e.jsx(Xd.Slot,{scope:t.__scopeMenu,children:c.modal?e.jsx(Z3,{...a,ref:s}):e.jsx(Q3,{...a,ref:s})})})})}),Z3=v.forwardRef((t,s)=>{const n=Wo(ka,t.__scopeMenu),r=v.useRef(null),a=Ms(s,r);return v.useEffect(()=>{const l=r.current;if(l)return lf(l)},[]),e.jsx(hb,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Vt(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Q3=v.forwardRef((t,s)=>{const n=Wo(ka,t.__scopeMenu);return e.jsx(hb,{...t,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),X3=K6("MenuContent.ScrollLock"),hb=v.forwardRef((t,s)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEntryFocus:h,onEscapeKeyDown:x,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:p,onDismiss:u,disableOutsideScroll:j,...g}=t,y=Wo(ka,n),N=Nu(ka,n),S=cf(n),C=DA(n),w=U3(n),[R,P]=v.useState(null),A=v.useRef(null),I=Ms(s,A,y.onContentChange),$=v.useRef(0),T=v.useRef(""),E=v.useRef(0),_=v.useRef(null),M=v.useRef("right"),q=v.useRef(0),G=j?yu:v.Fragment,Z=j?{as:X3,allowPinchZoom:!0}:void 0,W=F=>{var X,ne;const B=T.current+F,D=w().filter(oe=>!oe.disabled),O=document.activeElement,V=(X=D.find(oe=>oe.ref.current===O))==null?void 0:X.textValue,K=D.map(oe=>oe.textValue),Y=dM(K,B,V),U=(ne=D.find(oe=>oe.textValue===Y))==null?void 0:ne.ref.current;(function oe(re){T.current=re,window.clearTimeout($.current),re!==""&&($.current=window.setTimeout(()=>oe(""),1e3))})(B),U&&setTimeout(()=>U.focus())};v.useEffect(()=>()=>window.clearTimeout($.current),[]),Qm();const z=v.useCallback(F=>{var D,O;return M.current===((D=_.current)==null?void 0:D.side)&&hM(F,(O=_.current)==null?void 0:O.area)},[]);return e.jsx(Y3,{scope:n,searchRef:T,onItemEnter:v.useCallback(F=>{z(F)&&F.preventDefault()},[z]),onItemLeave:v.useCallback(F=>{var B;z(F)||((B=A.current)==null||B.focus(),P(null))},[z]),onTriggerLeave:v.useCallback(F=>{z(F)&&F.preventDefault()},[z]),pointerGraceTimerRef:E,onPointerGraceIntentChange:v.useCallback(F=>{_.current=F},[]),children:e.jsx(G,{...Z,children:e.jsx(xu,{asChild:!0,trapped:a,onMountAutoFocus:Vt(l,F=>{var B;F.preventDefault(),(B=A.current)==null||B.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:e.jsx(zc,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:x,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:p,onDismiss:u,children:e.jsx(vA,{asChild:!0,...C,dir:N.dir,orientation:"vertical",loop:r,currentTabStopId:R,onCurrentTabStopIdChange:P,onEntryFocus:Vt(h,F=>{N.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:e.jsx(nf,{role:"menu","aria-orientation":"vertical","data-state":ZA(y.open),"data-radix-menu-content":"",dir:N.dir,...S,...g,ref:I,style:{outline:"none",...g.style},onKeyDown:Vt(g.onKeyDown,F=>{const D=F.target.closest("[data-radix-menu-content]")===F.currentTarget,O=F.ctrlKey||F.altKey||F.metaKey,V=F.key.length===1;D&&(F.key==="Tab"&&F.preventDefault(),!O&&V&&W(F.key));const K=A.current;if(F.target!==K||!$3.includes(F.key))return;F.preventDefault();const U=w().filter(X=>!X.disabled).map(X=>X.ref.current);RA.includes(F.key)&&U.reverse(),oM(U)}),onBlur:Vt(t.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout($.current),T.current="")}),onPointerMove:Vt(t.onPointerMove,Jd(F=>{const B=F.target,D=q.current!==F.clientX;if(F.currentTarget.contains(B)&&D){const O=F.clientX>q.current?"right":"left";M.current=O,q.current=F.clientX}}))})})})})})})});OA.displayName=ka;var J3="MenuGroup",mb=v.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t;return e.jsx(ps.div,{role:"group",...r,ref:s})});mb.displayName=J3;var eM="MenuLabel",IA=v.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t;return e.jsx(ps.div,{...r,ref:s})});IA.displayName=eM;var Sm="MenuItem",$w="menu.itemSelect",df=v.forwardRef((t,s)=>{const{disabled:n=!1,onSelect:r,...a}=t,l=v.useRef(null),c=Nu(Sm,t.__scopeMenu),d=ub(Sm,t.__scopeMenu),h=Ms(s,l),x=v.useRef(!1),f=()=>{const m=l.current;if(!n&&m){const p=new CustomEvent($w,{bubbles:!0,cancelable:!0});m.addEventListener($w,u=>r==null?void 0:r(u),{once:!0}),S2(m,p),p.defaultPrevented?x.current=!1:c.onClose()}};return e.jsx(LA,{...a,ref:h,disabled:n,onClick:Vt(t.onClick,f),onPointerDown:m=>{var p;(p=t.onPointerDown)==null||p.call(t,m),x.current=!0},onPointerUp:Vt(t.onPointerUp,m=>{var p;x.current||(p=m.currentTarget)==null||p.click()}),onKeyDown:Vt(t.onKeyDown,m=>{const p=d.searchRef.current!=="";n||p&&m.key===" "||hv.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});df.displayName=Sm;var LA=v.forwardRef((t,s)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...l}=t,c=ub(Sm,n),d=DA(n),h=v.useRef(null),x=Ms(s,h),[f,m]=v.useState(!1),[p,u]=v.useState("");return v.useEffect(()=>{const j=h.current;j&&u((j.textContent??"").trim())},[l.children]),e.jsx(Xd.ItemSlot,{scope:n,disabled:r,textValue:a??p,children:e.jsx(bA,{asChild:!0,...d,focusable:!r,children:e.jsx(ps.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...l,ref:x,onPointerMove:Vt(t.onPointerMove,Jd(j=>{r?c.onItemLeave(j):(c.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Vt(t.onPointerLeave,Jd(j=>c.onItemLeave(j))),onFocus:Vt(t.onFocus,()=>m(!0)),onBlur:Vt(t.onBlur,()=>m(!1))})})})}),tM="MenuCheckboxItem",MA=v.forwardRef((t,s)=>{const{checked:n=!1,onCheckedChange:r,...a}=t;return e.jsx(zA,{scope:t.__scopeMenu,checked:n,children:e.jsx(df,{role:"menuitemcheckbox","aria-checked":Cm(n)?"mixed":n,...a,ref:s,"data-state":pb(n),onSelect:Vt(a.onSelect,()=>r==null?void 0:r(Cm(n)?!0:!n),{checkForDefaultPrevented:!1})})})});MA.displayName=tM;var FA="MenuRadioGroup",[sM,nM]=Ho(FA,{value:void 0,onValueChange:()=>{}}),BA=v.forwardRef((t,s)=>{const{value:n,onValueChange:r,...a}=t,l=dr(r);return e.jsx(sM,{scope:t.__scopeMenu,value:n,onValueChange:l,children:e.jsx(mb,{...a,ref:s})})});BA.displayName=FA;var $A="MenuRadioItem",qA=v.forwardRef((t,s)=>{const{value:n,...r}=t,a=nM($A,t.__scopeMenu),l=n===a.value;return e.jsx(zA,{scope:t.__scopeMenu,checked:l,children:e.jsx(df,{role:"menuitemradio","aria-checked":l,...r,ref:s,"data-state":pb(l),onSelect:Vt(r.onSelect,()=>{var c;return(c=a.onValueChange)==null?void 0:c.call(a,n)},{checkForDefaultPrevented:!1})})})});qA.displayName=$A;var fb="MenuItemIndicator",[zA,rM]=Ho(fb,{checked:!1}),UA=v.forwardRef((t,s)=>{const{__scopeMenu:n,forceMount:r,...a}=t,l=rM(fb,n);return e.jsx(mr,{present:r||Cm(l.checked)||l.checked===!0,children:e.jsx(ps.span,{...a,ref:s,"data-state":pb(l.checked)})})});UA.displayName=fb;var aM="MenuSeparator",VA=v.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t;return e.jsx(ps.div,{role:"separator","aria-orientation":"horizontal",...r,ref:s})});VA.displayName=aM;var iM="MenuArrow",HA=v.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t,a=cf(n);return e.jsx(rf,{...a,...r,ref:s})});HA.displayName=iM;var lM="MenuSub",[FH,WA]=Ho(lM),Od="MenuSubTrigger",GA=v.forwardRef((t,s)=>{const n=Wo(Od,t.__scopeMenu),r=Nu(Od,t.__scopeMenu),a=WA(Od,t.__scopeMenu),l=ub(Od,t.__scopeMenu),c=v.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:h}=l,x={__scopeMenu:t.__scopeMenu},f=v.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return v.useEffect(()=>f,[f]),v.useEffect(()=>{const m=d.current;return()=>{window.clearTimeout(m),h(null)}},[d,h]),e.jsx(cb,{asChild:!0,...x,children:e.jsx(LA,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":ZA(n.open),...t,ref:Br(s,a.onTriggerChange),onClick:m=>{var p;(p=t.onClick)==null||p.call(t,m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Vt(t.onPointerMove,Jd(m=>{l.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!n.open&&!c.current&&(l.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Vt(t.onPointerLeave,Jd(m=>{var u,j;f();const p=(u=n.content)==null?void 0:u.getBoundingClientRect();if(p){const g=(j=n.content)==null?void 0:j.dataset.side,y=g==="right",N=y?-5:5,S=p[y?"left":"right"],C=p[y?"right":"left"];l.onPointerGraceIntentChange({area:[{x:m.clientX+N,y:m.clientY},{x:S,y:p.top},{x:C,y:p.top},{x:C,y:p.bottom},{x:S,y:p.bottom}],side:g}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(m),m.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Vt(t.onKeyDown,m=>{var u;const p=l.searchRef.current!=="";t.disabled||p&&m.key===" "||q3[r.dir].includes(m.key)&&(n.onOpenChange(!0),(u=n.content)==null||u.focus(),m.preventDefault())})})})});GA.displayName=Od;var KA="MenuSubContent",YA=v.forwardRef((t,s)=>{const n=PA(ka,t.__scopeMenu),{forceMount:r=n.forceMount,...a}=t,l=Wo(ka,t.__scopeMenu),c=Nu(ka,t.__scopeMenu),d=WA(KA,t.__scopeMenu),h=v.useRef(null),x=Ms(s,h);return e.jsx(Xd.Provider,{scope:t.__scopeMenu,children:e.jsx(mr,{present:r||l.open,children:e.jsx(Xd.Slot,{scope:t.__scopeMenu,children:e.jsx(hb,{id:d.contentId,"aria-labelledby":d.triggerId,...a,ref:x,align:"start",side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var m;c.isUsingKeyboardRef.current&&((m=h.current)==null||m.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Vt(t.onFocusOutside,f=>{f.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:Vt(t.onEscapeKeyDown,f=>{c.onClose(),f.preventDefault()}),onKeyDown:Vt(t.onKeyDown,f=>{var u;const m=f.currentTarget.contains(f.target),p=z3[c.dir].includes(f.key);m&&p&&(l.onOpenChange(!1),(u=d.trigger)==null||u.focus(),f.preventDefault())})})})})})});YA.displayName=KA;function ZA(t){return t?"open":"closed"}function Cm(t){return t==="indeterminate"}function pb(t){return Cm(t)?"indeterminate":t?"checked":"unchecked"}function oM(t){const s=document.activeElement;for(const n of t)if(n===s||(n.focus(),document.activeElement!==s))return}function cM(t,s){return t.map((n,r)=>t[(s+r)%t.length])}function dM(t,s,n){const a=s.length>1&&Array.from(s).every(x=>x===s[0])?s[0]:s,l=n?t.indexOf(n):-1;let c=cM(t,Math.max(l,0));a.length===1&&(c=c.filter(x=>x!==n));const h=c.find(x=>x.toLowerCase().startsWith(a.toLowerCase()));return h!==n?h:void 0}function uM(t,s){const{x:n,y:r}=t;let a=!1;for(let l=0,c=s.length-1;lr!=p>r&&n<(m-x)*(r-f)/(p-f)+x&&(a=!a)}return a}function hM(t,s){if(!s)return!1;const n={x:t.clientX,y:t.clientY};return uM(n,s)}function Jd(t){return s=>s.pointerType==="mouse"?t(s):void 0}var mM=TA,fM=cb,pM=_A,xM=OA,gM=mb,vM=IA,bM=df,yM=MA,jM=BA,NM=qA,wM=UA,SM=VA,CM=HA,AM=GA,kM=YA,uf="DropdownMenu",[RM]=ea(uf,[EA]),Ur=EA(),[EM,QA]=RM(uf),XA=t=>{const{__scopeDropdownMenu:s,children:n,dir:r,open:a,defaultOpen:l,onOpenChange:c,modal:d=!0}=t,h=Ur(s),x=v.useRef(null),[f,m]=bi({prop:a,defaultProp:l??!1,onChange:c,caller:uf});return e.jsx(EM,{scope:s,triggerId:hr(),triggerRef:x,contentId:hr(),open:f,onOpenChange:m,onOpenToggle:v.useCallback(()=>m(p=>!p),[m]),modal:d,children:e.jsx(mM,{...h,open:f,onOpenChange:m,dir:r,modal:d,children:n})})};XA.displayName=uf;var JA="DropdownMenuTrigger",ek=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=t,l=QA(JA,n),c=Ur(n);return e.jsx(fM,{asChild:!0,...c,children:e.jsx(ps.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:Br(s,l.triggerRef),onPointerDown:Vt(t.onPointerDown,d=>{!r&&d.button===0&&d.ctrlKey===!1&&(l.onOpenToggle(),l.open||d.preventDefault())}),onKeyDown:Vt(t.onKeyDown,d=>{r||(["Enter"," "].includes(d.key)&&l.onOpenToggle(),d.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});ek.displayName=JA;var DM="DropdownMenuPortal",tk=t=>{const{__scopeDropdownMenu:s,...n}=t,r=Ur(s);return e.jsx(pM,{...r,...n})};tk.displayName=DM;var sk="DropdownMenuContent",nk=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=QA(sk,n),l=Ur(n),c=v.useRef(!1);return e.jsx(xM,{id:a.contentId,"aria-labelledby":a.triggerId,...l,...r,ref:s,onCloseAutoFocus:Vt(t.onCloseAutoFocus,d=>{var h;c.current||(h=a.triggerRef.current)==null||h.focus(),c.current=!1,d.preventDefault()}),onInteractOutside:Vt(t.onInteractOutside,d=>{const h=d.detail.originalEvent,x=h.button===0&&h.ctrlKey===!0,f=h.button===2||x;(!a.modal||f)&&(c.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});nk.displayName=sk;var TM="DropdownMenuGroup",PM=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(gM,{...a,...r,ref:s})});PM.displayName=TM;var _M="DropdownMenuLabel",rk=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(vM,{...a,...r,ref:s})});rk.displayName=_M;var OM="DropdownMenuItem",ak=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(bM,{...a,...r,ref:s})});ak.displayName=OM;var IM="DropdownMenuCheckboxItem",ik=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(yM,{...a,...r,ref:s})});ik.displayName=IM;var LM="DropdownMenuRadioGroup",MM=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(jM,{...a,...r,ref:s})});MM.displayName=LM;var FM="DropdownMenuRadioItem",BM=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(NM,{...a,...r,ref:s})});BM.displayName=FM;var $M="DropdownMenuItemIndicator",lk=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(wM,{...a,...r,ref:s})});lk.displayName=$M;var qM="DropdownMenuSeparator",ok=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(SM,{...a,...r,ref:s})});ok.displayName=qM;var zM="DropdownMenuArrow",UM=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(CM,{...a,...r,ref:s})});UM.displayName=zM;var VM="DropdownMenuSubTrigger",HM=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(AM,{...a,...r,ref:s})});HM.displayName=VM;var WM="DropdownMenuSubContent",GM=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(kM,{...a,...r,ref:s,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});GM.displayName=WM;var KM=XA,YM=ek,ZM=tk,QM=nk,XM=rk,JM=ak,eF=ik,tF=lk,sF=ok;function xb({...t}){return e.jsx(KM,{"data-slot":"dropdown-menu",...t})}function gb({...t}){return e.jsx(YM,{"data-slot":"dropdown-menu-trigger",...t})}function vb({className:t,sideOffset:s=4,...n}){return e.jsx(ZM,{children:e.jsx(QM,{"data-slot":"dropdown-menu-content",sideOffset:s,className:Pt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...n})})}function ck({className:t,inset:s,variant:n="default",...r}){return e.jsx(JM,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":n,className:Pt("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r})}function nF({className:t,children:s,checked:n,...r}){return e.jsxs(eF,{"data-slot":"dropdown-menu-checkbox-item",className:Pt("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),checked:n,...r,children:[e.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:e.jsx(tF,{children:e.jsx(Bn,{className:"size-4"})})}),s]})}function rF({className:t,inset:s,...n}){return e.jsx(XM,{"data-slot":"dropdown-menu-label","data-inset":s,className:Pt("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...n})}function aF({className:t,...s}){return e.jsx(sF,{"data-slot":"dropdown-menu-separator",className:Pt("bg-border -mx-1 my-1 h-px",t),...s})}const iF=Vv("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Ae({className:t,variant:s,asChild:n=!1,...r}){const a=n?x2:"span";return e.jsx(a,{"data-slot":"badge",className:Pt(iF({variant:s}),t),...r})}const Oh="/communication",_o={getNotifications:async(t,s)=>{let n=`${Oh}/notifications`;return t&&s&&(n+=`?page=${t}&limit=${s}`),(await ze.get(n)).data},markAsRead:async t=>(await ze.patch(`${Oh}/notifications/${t}/read`)).data,markAllAsRead:async()=>(await ze.patch(`${Oh}/notifications/read-all`)).data,updatePushSubscription:async t=>(await ze.post(`${Oh}/notifications/subscribe`,{subscription:t})).data},yi=Object.create(null);yi.open="0";yi.close="1";yi.ping="2";yi.pong="3";yi.message="4";yi.upgrade="5";yi.noop="6";const tm=Object.create(null);Object.keys(yi).forEach(t=>{tm[yi[t]]=t});const mv={type:"error",data:"parser error"},dk=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",uk=typeof ArrayBuffer=="function",hk=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,bb=({type:t,data:s},n,r)=>dk&&s instanceof Blob?n?r(s):qw(s,r):uk&&(s instanceof ArrayBuffer||hk(s))?n?r(s):qw(new Blob([s]),r):r(yi[t]+(s||"")),qw=(t,s)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];s("b"+(r||""))},n.readAsDataURL(t)};function zw(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let $x;function lF(t,s){if(dk&&t.data instanceof Blob)return t.data.arrayBuffer().then(zw).then(s);if(uk&&(t.data instanceof ArrayBuffer||hk(t.data)))return s(zw(t.data));bb(t,!1,n=>{$x||($x=new TextEncoder),s($x.encode(n))})}const Uw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Id=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t{let s=t.length*.75,n=t.length,r,a=0,l,c,d,h;t[t.length-1]==="="&&(s--,t[t.length-2]==="="&&s--);const x=new ArrayBuffer(s),f=new Uint8Array(x);for(r=0;r>4,f[a++]=(c&15)<<4|d>>2,f[a++]=(d&3)<<6|h&63;return x},cF=typeof ArrayBuffer=="function",yb=(t,s)=>{if(typeof t!="string")return{type:"message",data:mk(t,s)};const n=t.charAt(0);return n==="b"?{type:"message",data:dF(t.substring(1),s)}:tm[n]?t.length>1?{type:tm[n],data:t.substring(1)}:{type:tm[n]}:mv},dF=(t,s)=>{if(cF){const n=oF(t);return mk(n,s)}else return{base64:!0,data:t}},mk=(t,s)=>{switch(s){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},fk="",uF=(t,s)=>{const n=t.length,r=new Array(n);let a=0;t.forEach((l,c)=>{bb(l,!1,d=>{r[c]=d,++a===n&&s(r.join(fk))})})},hF=(t,s)=>{const n=t.split(fk),r=[];for(let a=0;a{const r=n.length;let a;if(r<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,r);else if(r<65536){a=new Uint8Array(3);const l=new DataView(a.buffer);l.setUint8(0,126),l.setUint16(1,r)}else{a=new Uint8Array(9);const l=new DataView(a.buffer);l.setUint8(0,127),l.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(a[0]|=128),s.enqueue(a),s.enqueue(n)})}})}let qx;function Ih(t){return t.reduce((s,n)=>s+n.length,0)}function Lh(t,s){if(t[0].length===s)return t.shift();const n=new Uint8Array(s);let r=0;for(let a=0;aMath.pow(2,21)-1){d.enqueue(mv);break}a=f*Math.pow(2,32)+x.getUint32(4),r=3}else{if(Ih(n)t){d.enqueue(mv);break}}}})}const pk=4;function Kn(t){if(t)return pF(t)}function pF(t){for(var s in Kn.prototype)t[s]=Kn.prototype[s];return t}Kn.prototype.on=Kn.prototype.addEventListener=function(t,s){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(s),this};Kn.prototype.once=function(t,s){function n(){this.off(t,n),s.apply(this,arguments)}return n.fn=s,this.on(t,n),this};Kn.prototype.off=Kn.prototype.removeListener=Kn.prototype.removeAllListeners=Kn.prototype.removeEventListener=function(t,s){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,a=0;aPromise.resolve().then(s):(s,n)=>n(s,0),Aa=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),xF="arraybuffer";function xk(t,...s){return s.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const gF=Aa.setTimeout,vF=Aa.clearTimeout;function mf(t,s){s.useNativeTimers?(t.setTimeoutFn=gF.bind(Aa),t.clearTimeoutFn=vF.bind(Aa)):(t.setTimeoutFn=Aa.setTimeout.bind(Aa),t.clearTimeoutFn=Aa.clearTimeout.bind(Aa))}const bF=1.33;function yF(t){return typeof t=="string"?jF(t):Math.ceil((t.byteLength||t.size)*bF)}function jF(t){let s=0,n=0;for(let r=0,a=t.length;r=57344?n+=3:(r++,n+=4);return n}function gk(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function NF(t){let s="";for(let n in t)t.hasOwnProperty(n)&&(s.length&&(s+="&"),s+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return s}function wF(t){let s={},n=t.split("&");for(let r=0,a=n.length;r{this.readyState="paused",s()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(s){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};hF(s,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const s=()=>{this.write([{type:"close"}])};this.readyState==="open"?s():this.once("open",s)}write(s){this.writable=!1,uF(s,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const s=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=gk()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(s,n)}}let vk=!1;try{vk=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const AF=vk;function kF(){}class RF extends CF{constructor(s){if(super(s),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&s.hostname!==location.hostname||r!==s.port}}doWrite(s,n){const r=this.request({method:"POST",data:s});r.on("success",n),r.on("error",(a,l)=>{this.onError("xhr post error",a,l)})}doPoll(){const s=this.request();s.on("data",this.onData.bind(this)),s.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=s}}class vi extends Kn{constructor(s,n,r){super(),this.createRequest=s,mf(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var s;const n=xk(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&r.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(s=this._opts.cookieJar)===null||s===void 0||s.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var a;r.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=vi.requestsCount++,vi.requests[this._index]=this)}_onError(s){this.emitReserved("error",s,this._xhr),this._cleanup(!0)}_cleanup(s){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=kF,s)try{this._xhr.abort()}catch{}typeof document<"u"&&delete vi.requests[this._index],this._xhr=null}}_onLoad(){const s=this._xhr.responseText;s!==null&&(this.emitReserved("data",s),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}vi.requestsCount=0;vi.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Vw);else if(typeof addEventListener=="function"){const t="onpagehide"in Aa?"pagehide":"unload";addEventListener(t,Vw,!1)}}function Vw(){for(let t in vi.requests)vi.requests.hasOwnProperty(t)&&vi.requests[t].abort()}const EF=(function(){const t=bk({xdomain:!1});return t&&t.responseType!==null})();class DF extends RF{constructor(s){super(s);const n=s&&s.forceBase64;this.supportsBinary=EF&&!n}request(s={}){return Object.assign(s,{xd:this.xd},this.opts),new vi(bk,this.uri(),s)}}function bk(t){const s=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!s||AF))return new XMLHttpRequest}catch{}if(!s)try{return new Aa[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const yk=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class TF extends jb{get name(){return"websocket"}doOpen(){const s=this.uri(),n=this.opts.protocols,r=yk?{}:xk(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(s,n,r)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=s=>this.onClose({description:"websocket connection closed",context:s}),this.ws.onmessage=s=>this.onData(s.data),this.ws.onerror=s=>this.onError("websocket error",s)}write(s){this.writable=!1;for(let n=0;n{try{this.doWrite(r,l)}catch{}a&&hf(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const s=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=gk()),this.supportsBinary||(n.b64=1),this.createUri(s,n)}}const zx=Aa.WebSocket||Aa.MozWebSocket;class PF extends TF{createSocket(s,n,r){return yk?new zx(s,n,r):n?new zx(s,n):new zx(s)}doWrite(s,n){this.ws.send(n)}}class _F extends jb{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(s){return this.emitReserved("error",s)}this._transport.closed.then(()=>{this.onClose()}).catch(s=>{this.onError("webtransport error",s)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(s=>{const n=fF(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=s.readable.pipeThrough(n).getReader(),a=mF();a.readable.pipeTo(s.writable),this._writer=a.writable.getWriter();const l=()=>{r.read().then(({done:d,value:h})=>{d||(this.onPacket(h),l())}).catch(d=>{})};l();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this._writer.write(c).then(()=>this.onOpen())})})}write(s){this.writable=!1;for(let n=0;n{a&&hf(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var s;(s=this._transport)===null||s===void 0||s.close()}}const OF={websocket:PF,webtransport:_F,polling:DF},IF=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,LF=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function fv(t){if(t.length>8e3)throw"URI too long";const s=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let a=IF.exec(t||""),l={},c=14;for(;c--;)l[LF[c]]=a[c]||"";return n!=-1&&r!=-1&&(l.source=s,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),l.pathNames=MF(l,l.path),l.queryKey=FF(l,l.query),l}function MF(t,s){const n=/\/{2,9}/g,r=s.replace(n,"/").split("/");return(s.slice(0,1)=="/"||s.length===0)&&r.splice(0,1),s.slice(-1)=="/"&&r.splice(r.length-1,1),r}function FF(t,s){const n={};return s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,a,l){a&&(n[a]=l)}),n}const pv=typeof addEventListener=="function"&&typeof removeEventListener=="function",sm=[];pv&&addEventListener("offline",()=>{sm.forEach(t=>t())},!1);class Ol extends Kn{constructor(s,n){if(super(),this.binaryType=xF,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,s&&typeof s=="object"&&(n=s,s=null),s){const r=fv(s);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=fv(n.host).host);mf(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const a=r.prototype.name;this.transports.push(a),this._transportsByName[a]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=wF(this.opts.query)),pv&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},sm.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(s){const n=Object.assign({},this.opts.query);n.EIO=pk,n.transport=s,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[s]);return new this._transportsByName[s](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const s=this.opts.rememberUpgrade&&Ol.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(s);n.open(),this.setTransport(n)}setTransport(s){this.transport&&this.transport.removeAllListeners(),this.transport=s,s.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Ol.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",s),this.emitReserved("heartbeat"),s.type){case"open":this.onHandshake(JSON.parse(s.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=s.data,this._onError(n);break;case"message":this.emitReserved("data",s.data),this.emitReserved("message",s.data);break}}onHandshake(s){this.emitReserved("handshake",s),this.id=s.sid,this.transport.query.sid=s.sid,this._pingInterval=s.pingInterval,this._pingTimeout=s.pingTimeout,this._maxPayload=s.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const s=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+s,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},s),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const s=this._getWritablePackets();this.transport.send(s),this._prevBufferLen=s.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const s=Date.now()>this._pingTimeoutTime;return s&&(this._pingTimeoutTime=0,hf(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),s}write(s,n,r){return this._sendPacket("message",s,n,r),this}send(s,n,r){return this._sendPacket("message",s,n,r),this}_sendPacket(s,n,r,a){if(typeof n=="function"&&(a=n,n=void 0),typeof r=="function"&&(a=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const l={type:s,data:n,options:r};this.emitReserved("packetCreate",l),this.writeBuffer.push(l),a&&this.once("flush",a),this.flush()}close(){const s=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),s()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():s()}):this.upgrading?r():s()),this}_onError(s){if(Ol.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",s),this._onClose("transport error",s)}_onClose(s,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),pv&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=sm.indexOf(this._offlineEventListener);r!==-1&&sm.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",s,n),this.writeBuffer=[],this._prevBufferLen=0}}}Ol.protocol=pk;class BF extends Ol{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let s=0;s{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!r)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Ol.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(f(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const p=new Error("probe error");p.transport=n.name,this.emitReserved("upgradeError",p)}}))};function l(){r||(r=!0,f(),n.close(),n=null)}const c=m=>{const p=new Error("probe error: "+m);p.transport=n.name,l(),this.emitReserved("upgradeError",p)};function d(){c("transport closed")}function h(){c("socket closed")}function x(m){n&&m.name!==n.name&&l()}const f=()=>{n.removeListener("open",a),n.removeListener("error",c),n.removeListener("close",d),this.off("close",h),this.off("upgrading",x)};n.once("open",a),n.once("error",c),n.once("close",d),this.once("close",h),this.once("upgrading",x),this._upgrades.indexOf("webtransport")!==-1&&s!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(s){this._upgrades=this._filterUpgrades(s.upgrades),super.onHandshake(s)}_filterUpgrades(s){const n=[];for(let r=0;rOF[a]).filter(a=>!!a)),super(s,r)}};function qF(t,s="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=fv(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const l=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+l+":"+r.port+s,r.href=r.protocol+"://"+l+(n&&n.port===r.port?"":":"+r.port),r}const zF=typeof ArrayBuffer=="function",UF=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,jk=Object.prototype.toString,VF=typeof Blob=="function"||typeof Blob<"u"&&jk.call(Blob)==="[object BlobConstructor]",HF=typeof File=="function"||typeof File<"u"&&jk.call(File)==="[object FileConstructor]";function Nb(t){return zF&&(t instanceof ArrayBuffer||UF(t))||VF&&t instanceof Blob||HF&&t instanceof File}function nm(t,s){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n=0&&t.numthis.opts.maxAttachments)throw new Error("too many attachments");r.attachments=d}if(s.charAt(n+1)==="/"){const l=n+1;for(;++n&&!(s.charAt(n)===","||n===s.length););r.nsp=s.substring(l,n)}else r.nsp="/";const a=s.charAt(n+1);if(a!==""&&Number(a)==a){const l=n+1;for(;++n;){const c=s.charAt(n);if(c==null||Number(c)!=c){--n;break}if(n===s.length)break}r.id=Number(s.substring(l,n+1))}if(s.charAt(++n)){const l=this.tryParse(s.substr(n));if(wb.isPayloadValid(r.type,l))r.data=l;else throw new Error("invalid payload")}return r}tryParse(s){try{return JSON.parse(s,this.opts.reviver)}catch{return!1}}static isPayloadValid(s,n){switch(s){case Zs.CONNECT:return Hw(n);case Zs.DISCONNECT:return n===void 0;case Zs.CONNECT_ERROR:return typeof n=="string"||Hw(n);case Zs.EVENT:case Zs.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&KF.indexOf(n[0])===-1);case Zs.ACK:case Zs.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ZF{constructor(s){this.packet=s,this.buffers=[],this.reconPack=s}takeBinaryData(s){if(this.buffers.push(s),this.buffers.length===this.reconPack.attachments){const n=GF(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const QF=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function Hw(t){return Object.prototype.toString.call(t)==="[object Object]"}const XF=Object.freeze(Object.defineProperty({__proto__:null,Decoder:wb,Encoder:YF,get PacketType(){return Zs}},Symbol.toStringTag,{value:"Module"}));function Ga(t,s,n){return t.on(s,n),function(){t.off(s,n)}}const JF=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Nk extends Kn{constructor(s,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=s,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const s=this.io;this.subs=[Ga(s,"open",this.onopen.bind(this)),Ga(s,"packet",this.onpacket.bind(this)),Ga(s,"error",this.onerror.bind(this)),Ga(s,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...s){return s.unshift("message"),this.emit.apply(this,s),this}emit(s,...n){var r,a,l;if(JF.hasOwnProperty(s))throw new Error('"'+s.toString()+'" is a reserved event name');if(n.unshift(s),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const c={type:Zs.EVENT,data:n};if(c.options={},c.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const f=this.ids++,m=n.pop();this._registerAckCallback(f,m),c.id=f}const d=(a=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||a===void 0?void 0:a.writable,h=this.connected&&!(!((l=this.io.engine)===null||l===void 0)&&l._hasPingExpired());return this.flags.volatile&&!d||(h?(this.notifyOutgoingListeners(c),this.packet(c)):this.sendBuffer.push(c)),this.flags={},this}_registerAckCallback(s,n){var r;const a=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(a===void 0){this.acks[s]=n;return}const l=this.io.setTimeoutFn(()=>{delete this.acks[s];for(let d=0;d{this.io.clearTimeoutFn(l),n.apply(this,d)};c.withError=!0,this.acks[s]=c}emitWithAck(s,...n){return new Promise((r,a)=>{const l=(c,d)=>c?a(c):r(d);l.withError=!0,n.push(l),this.emit(s,...n)})}_addToQueue(s){let n;typeof s[s.length-1]=="function"&&(n=s.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:s,flags:Object.assign({fromQueue:!0},this.flags)};s.push((a,...l)=>(this._queue[0],a!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...l)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(s=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!s||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(s){s.nsp=this.nsp,this.io._packet(s)}onopen(){typeof this.auth=="function"?this.auth(s=>{this._sendConnectPacket(s)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(s){this.packet({type:Zs.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},s):s})}onerror(s){this.connected||this.emitReserved("connect_error",s)}onclose(s,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",s,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(s=>{if(!this.sendBuffer.some(r=>String(r.id)===s)){const r=this.acks[s];delete this.acks[s],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(s){if(s.nsp===this.nsp)switch(s.type){case Zs.CONNECT:s.data&&s.data.sid?this.onconnect(s.data.sid,s.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Zs.EVENT:case Zs.BINARY_EVENT:this.onevent(s);break;case Zs.ACK:case Zs.BINARY_ACK:this.onack(s);break;case Zs.DISCONNECT:this.ondisconnect();break;case Zs.CONNECT_ERROR:this.destroy();const r=new Error(s.data.message);r.data=s.data.data,this.emitReserved("connect_error",r);break}}onevent(s){const n=s.data||[];s.id!=null&&n.push(this.ack(s.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(s){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,s)}super.emit.apply(this,s),this._pid&&s.length&&typeof s[s.length-1]=="string"&&(this._lastOffset=s[s.length-1])}ack(s){const n=this;let r=!1;return function(...a){r||(r=!0,n.packet({type:Zs.ACK,id:s,data:a}))}}onack(s){const n=this.acks[s.id];typeof n=="function"&&(delete this.acks[s.id],n.withError&&s.data.unshift(null),n.apply(this,s.data))}onconnect(s,n){this.id=s,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(s=>this.emitEvent(s)),this.receiveBuffer=[],this.sendBuffer.forEach(s=>{this.notifyOutgoingListeners(s),this.packet(s)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(s=>s()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Zs.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(s){return this.flags.compress=s,this}get volatile(){return this.flags.volatile=!0,this}timeout(s){return this.flags.timeout=s,this}onAny(s){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(s),this}prependAny(s){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(s),this}offAny(s){if(!this._anyListeners)return this;if(s){const n=this._anyListeners;for(let r=0;r0&&t.jitter<=1?t.jitter:0,this.attempts=0}Wc.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var s=Math.random(),n=Math.floor(s*this.jitter*t);t=(Math.floor(s*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0};Wc.prototype.reset=function(){this.attempts=0};Wc.prototype.setMin=function(t){this.ms=t};Wc.prototype.setMax=function(t){this.max=t};Wc.prototype.setJitter=function(t){this.jitter=t};class vv extends Kn{constructor(s,n){var r;super(),this.nsps={},this.subs=[],s&&typeof s=="object"&&(n=s,s=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,mf(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Wc({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=s;const a=n.parser||XF;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(s){return arguments.length?(this._reconnection=!!s,s||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(s){return s===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=s,this)}reconnectionDelay(s){var n;return s===void 0?this._reconnectionDelay:(this._reconnectionDelay=s,(n=this.backoff)===null||n===void 0||n.setMin(s),this)}randomizationFactor(s){var n;return s===void 0?this._randomizationFactor:(this._randomizationFactor=s,(n=this.backoff)===null||n===void 0||n.setJitter(s),this)}reconnectionDelayMax(s){var n;return s===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=s,(n=this.backoff)===null||n===void 0||n.setMax(s),this)}timeout(s){return arguments.length?(this._timeout=s,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(s){if(~this._readyState.indexOf("open"))return this;this.engine=new $F(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const a=Ga(n,"open",function(){r.onopen(),s&&s()}),l=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),s?s(d):this.maybeReconnectOnOpen()},c=Ga(n,"error",l);if(this._timeout!==!1){const d=this._timeout,h=this.setTimeoutFn(()=>{a(),l(new Error("timeout")),n.close()},d);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(a),this.subs.push(c),this}connect(s){return this.open(s)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const s=this.engine;this.subs.push(Ga(s,"ping",this.onping.bind(this)),Ga(s,"data",this.ondata.bind(this)),Ga(s,"error",this.onerror.bind(this)),Ga(s,"close",this.onclose.bind(this)),Ga(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(s){try{this.decoder.add(s)}catch(n){this.onclose("parse error",n)}}ondecoded(s){hf(()=>{this.emitReserved("packet",s)},this.setTimeoutFn)}onerror(s){this.emitReserved("error",s)}socket(s,n){let r=this.nsps[s];return r?this._autoConnect&&!r.active&&r.connect():(r=new Nk(this,s,n),this.nsps[s]=r),r}_destroy(s){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(s){const n=this.encoder.encode(s);for(let r=0;rs()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(s,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",s,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const s=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{s.skipReconnect||(this.emitReserved("reconnect_attempt",s.backoff.attempts),!s.skipReconnect&&s.open(a=>{a?(s._reconnecting=!1,s.reconnect(),this.emitReserved("reconnect_error",a)):s.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const s=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",s)}}const Nd={};function rm(t,s){typeof t=="object"&&(s=t,t=void 0),s=s||{};const n=qF(t,s.path||"/socket.io"),r=n.source,a=n.id,l=n.path,c=Nd[a]&&l in Nd[a].nsps,d=s.forceNew||s["force new connection"]||s.multiplex===!1||c;let h;return d?h=new vv(r,s):(Nd[a]||(Nd[a]=new vv(r,s)),h=Nd[a]),n.query&&!s.query&&(s.query=n.queryKey),h.socket(n.path,s)}Object.assign(rm,{Manager:vv,Socket:Nk,io:rm,connect:rm});const wk=v.createContext({socket:null,isConnected:!1}),Sk=()=>v.useContext(wk),e8=({children:t})=>{const[s,n]=v.useState(null),[r,a]=v.useState(!1),{user:l}=Nn(c=>c.auth);return v.useEffect(()=>{let c="https://dealeronboarding-uat.royalenfield.com/api";c.endsWith("/api")&&(c=c.replace(/\/api$/,""));const d=rm(c,{withCredentials:!0});return d.on("connect",()=>{console.log("Socket connected:",d.id),a(!0)}),d.on("disconnect",()=>{console.log("Socket disconnected"),a(!1)}),n(d),()=>{d.close()}},[]),v.useEffect(()=>{if(s&&r&&(l!=null&&l.id))return s.emit("join_room",`user_${l.id}`),console.log(`Joined private notification room: user_${l.id}`),()=>{s.emit("leave_room",`user_${l.id}`)}},[s,r,l==null?void 0:l.id]),e.jsx(wk.Provider,{value:{socket:s,isConnected:r},children:t})};function fn(t){const s=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&s==="[object Date]"?new t.constructor(+t):typeof t=="number"||s==="[object Number]"||typeof t=="string"||s==="[object String]"?new Date(t):new Date(NaN)}function ql(t,s){return t instanceof Date?new t.constructor(s):new Date(s)}const Ck=6048e5,t8=864e5,Mh=43200,Ww=1440;let s8={};function wu(){return s8}function eu(t,s){var d,h,x,f;const n=wu(),r=(s==null?void 0:s.weekStartsOn)??((h=(d=s==null?void 0:s.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((f=(x=n.locale)==null?void 0:x.options)==null?void 0:f.weekStartsOn)??0,a=fn(t),l=a.getDay(),c=(l=a.getTime()?n+1:s.getTime()>=c.getTime()?n:n-1}function Gw(t){const s=fn(t);return s.setHours(0,0,0,0),s}function km(t){const s=fn(t),n=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()));return n.setUTCFullYear(s.getFullYear()),+t-+n}function n8(t,s){const n=Gw(t),r=Gw(s),a=+n-km(n),l=+r-km(r);return Math.round((a-l)/t8)}function r8(t){const s=Ak(t),n=ql(t,0);return n.setFullYear(s,0,4),n.setHours(0,0,0,0),Am(n)}function am(t,s){const n=fn(t),r=fn(s),a=n.getTime()-r.getTime();return a<0?-1:a>0?1:a}function a8(t){return ql(t,Date.now())}function i8(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function l8(t){if(!i8(t)&&typeof t!="number")return!1;const s=fn(t);return!isNaN(Number(s))}function o8(t,s){const n=fn(t),r=fn(s),a=n.getFullYear()-r.getFullYear(),l=n.getMonth()-r.getMonth();return a*12+l}function c8(t){return s=>{const r=(t?Math[t]:Math.trunc)(s);return r===0?0:r}}function d8(t,s){return+fn(t)-+fn(s)}function u8(t){const s=fn(t);return s.setHours(23,59,59,999),s}function h8(t){const s=fn(t),n=s.getMonth();return s.setFullYear(s.getFullYear(),n+1,0),s.setHours(23,59,59,999),s}function m8(t){const s=fn(t);return+u8(s)==+h8(s)}function f8(t,s){const n=fn(t),r=fn(s),a=am(n,r),l=Math.abs(o8(n,r));let c;if(l<1)c=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*l);let d=am(n,r)===-a;m8(fn(t))&&l===1&&am(t,r)===1&&(d=!1),c=a*(l-Number(d))}return c===0?0:c}function p8(t,s,n){const r=d8(t,s)/1e3;return c8(n==null?void 0:n.roundingMethod)(r)}function x8(t){const s=fn(t),n=ql(t,0);return n.setFullYear(s.getFullYear(),0,1),n.setHours(0,0,0,0),n}const g8={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},v8=(t,s,n)=>{let r;const a=g8[t];return typeof a=="string"?r=a:s===1?r=a.one:r=a.other.replace("{{count}}",s.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Ux(t){return(s={})=>{const n=s.width?String(s.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const b8={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},y8={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},j8={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},N8={date:Ux({formats:b8,defaultWidth:"full"}),time:Ux({formats:y8,defaultWidth:"full"}),dateTime:Ux({formats:j8,defaultWidth:"full"})},w8={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},S8=(t,s,n,r)=>w8[t];function wd(t){return(s,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&t.formattingValues){const c=t.defaultFormattingWidth||t.defaultWidth,d=n!=null&&n.width?String(n.width):c;a=t.formattingValues[d]||t.formattingValues[c]}else{const c=t.defaultWidth,d=n!=null&&n.width?String(n.width):t.defaultWidth;a=t.values[d]||t.values[c]}const l=t.argumentCallback?t.argumentCallback(s):s;return a[l]}}const C8={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},A8={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},k8={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},R8={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},E8={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},D8={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},T8=(t,s)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},P8={ordinalNumber:T8,era:wd({values:C8,defaultWidth:"wide"}),quarter:wd({values:A8,defaultWidth:"wide",argumentCallback:t=>t-1}),month:wd({values:k8,defaultWidth:"wide"}),day:wd({values:R8,defaultWidth:"wide"}),dayPeriod:wd({values:E8,defaultWidth:"wide",formattingValues:D8,defaultFormattingWidth:"wide"})};function Sd(t){return(s,n={})=>{const r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],l=s.match(a);if(!l)return null;const c=l[0],d=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],h=Array.isArray(d)?O8(d,m=>m.test(c)):_8(d,m=>m.test(c));let x;x=t.valueCallback?t.valueCallback(h):h,x=n.valueCallback?n.valueCallback(x):x;const f=s.slice(c.length);return{value:x,rest:f}}}function _8(t,s){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&s(t[n]))return n}function O8(t,s){for(let n=0;n{const r=s.match(t.matchPattern);if(!r)return null;const a=r[0],l=s.match(t.parsePattern);if(!l)return null;let c=t.valueCallback?t.valueCallback(l[0]):l[0];c=n.valueCallback?n.valueCallback(c):c;const d=s.slice(a.length);return{value:c,rest:d}}}const L8=/^(\d+)(th|st|nd|rd)?/i,M8=/\d+/i,F8={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},B8={any:[/^b/i,/^(a|c)/i]},$8={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},q8={any:[/1/i,/2/i,/3/i,/4/i]},z8={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},U8={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},V8={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},H8={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},W8={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},G8={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},K8={ordinalNumber:I8({matchPattern:L8,parsePattern:M8,valueCallback:t=>parseInt(t,10)}),era:Sd({matchPatterns:F8,defaultMatchWidth:"wide",parsePatterns:B8,defaultParseWidth:"any"}),quarter:Sd({matchPatterns:$8,defaultMatchWidth:"wide",parsePatterns:q8,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Sd({matchPatterns:z8,defaultMatchWidth:"wide",parsePatterns:U8,defaultParseWidth:"any"}),day:Sd({matchPatterns:V8,defaultMatchWidth:"wide",parsePatterns:H8,defaultParseWidth:"any"}),dayPeriod:Sd({matchPatterns:W8,defaultMatchWidth:"any",parsePatterns:G8,defaultParseWidth:"any"})},kk={code:"en-US",formatDistance:v8,formatLong:N8,formatRelative:S8,localize:P8,match:K8,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Y8(t){const s=fn(t);return n8(s,x8(s))+1}function Z8(t){const s=fn(t),n=+Am(s)-+r8(s);return Math.round(n/Ck)+1}function Rk(t,s){var f,m,p,u;const n=fn(t),r=n.getFullYear(),a=wu(),l=(s==null?void 0:s.firstWeekContainsDate)??((m=(f=s==null?void 0:s.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??a.firstWeekContainsDate??((u=(p=a.locale)==null?void 0:p.options)==null?void 0:u.firstWeekContainsDate)??1,c=ql(t,0);c.setFullYear(r+1,0,l),c.setHours(0,0,0,0);const d=eu(c,s),h=ql(t,0);h.setFullYear(r,0,l),h.setHours(0,0,0,0);const x=eu(h,s);return n.getTime()>=d.getTime()?r+1:n.getTime()>=x.getTime()?r:r-1}function Q8(t,s){var d,h,x,f;const n=wu(),r=(s==null?void 0:s.firstWeekContainsDate)??((h=(d=s==null?void 0:s.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??n.firstWeekContainsDate??((f=(x=n.locale)==null?void 0:x.options)==null?void 0:f.firstWeekContainsDate)??1,a=Rk(t,s),l=ql(t,0);return l.setFullYear(a,0,r),l.setHours(0,0,0,0),eu(l,s)}function X8(t,s){const n=fn(t),r=+eu(n,s)-+Q8(n,s);return Math.round(r/Ck)+1}function un(t,s){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(s,"0");return n+r}const Rl={y(t,s){const n=t.getFullYear(),r=n>0?n:1-n;return un(s==="yy"?r%100:r,s.length)},M(t,s){const n=t.getMonth();return s==="M"?String(n+1):un(n+1,2)},d(t,s){return un(t.getDate(),s.length)},a(t,s){const n=t.getHours()/12>=1?"pm":"am";switch(s){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,s){return un(t.getHours()%12||12,s.length)},H(t,s){return un(t.getHours(),s.length)},m(t,s){return un(t.getMinutes(),s.length)},s(t,s){return un(t.getSeconds(),s.length)},S(t,s){const n=s.length,r=t.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return un(a,s.length)}},vc={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Kw={G:function(t,s,n){const r=t.getFullYear()>0?1:0;switch(s){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,s,n){if(s==="yo"){const r=t.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return Rl.y(t,s)},Y:function(t,s,n,r){const a=Rk(t,r),l=a>0?a:1-a;if(s==="YY"){const c=l%100;return un(c,2)}return s==="Yo"?n.ordinalNumber(l,{unit:"year"}):un(l,s.length)},R:function(t,s){const n=Ak(t);return un(n,s.length)},u:function(t,s){const n=t.getFullYear();return un(n,s.length)},Q:function(t,s,n){const r=Math.ceil((t.getMonth()+1)/3);switch(s){case"Q":return String(r);case"QQ":return un(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,s,n){const r=Math.ceil((t.getMonth()+1)/3);switch(s){case"q":return String(r);case"qq":return un(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,s,n){const r=t.getMonth();switch(s){case"M":case"MM":return Rl.M(t,s);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,s,n){const r=t.getMonth();switch(s){case"L":return String(r+1);case"LL":return un(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,s,n,r){const a=X8(t,r);return s==="wo"?n.ordinalNumber(a,{unit:"week"}):un(a,s.length)},I:function(t,s,n){const r=Z8(t);return s==="Io"?n.ordinalNumber(r,{unit:"week"}):un(r,s.length)},d:function(t,s,n){return s==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Rl.d(t,s)},D:function(t,s,n){const r=Y8(t);return s==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):un(r,s.length)},E:function(t,s,n){const r=t.getDay();switch(s){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,s,n,r){const a=t.getDay(),l=(a-r.weekStartsOn+8)%7||7;switch(s){case"e":return String(l);case"ee":return un(l,2);case"eo":return n.ordinalNumber(l,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,s,n,r){const a=t.getDay(),l=(a-r.weekStartsOn+8)%7||7;switch(s){case"c":return String(l);case"cc":return un(l,s.length);case"co":return n.ordinalNumber(l,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,s,n){const r=t.getDay(),a=r===0?7:r;switch(s){case"i":return String(a);case"ii":return un(a,s.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,s,n){const a=t.getHours()/12>=1?"pm":"am";switch(s){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,s,n){const r=t.getHours();let a;switch(r===12?a=vc.noon:r===0?a=vc.midnight:a=r/12>=1?"pm":"am",s){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,s,n){const r=t.getHours();let a;switch(r>=17?a=vc.evening:r>=12?a=vc.afternoon:r>=4?a=vc.morning:a=vc.night,s){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,s,n){if(s==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Rl.h(t,s)},H:function(t,s,n){return s==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Rl.H(t,s)},K:function(t,s,n){const r=t.getHours()%12;return s==="Ko"?n.ordinalNumber(r,{unit:"hour"}):un(r,s.length)},k:function(t,s,n){let r=t.getHours();return r===0&&(r=24),s==="ko"?n.ordinalNumber(r,{unit:"hour"}):un(r,s.length)},m:function(t,s,n){return s==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Rl.m(t,s)},s:function(t,s,n){return s==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Rl.s(t,s)},S:function(t,s){return Rl.S(t,s)},X:function(t,s,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(s){case"X":return Zw(r);case"XXXX":case"XX":return ko(r);case"XXXXX":case"XXX":default:return ko(r,":")}},x:function(t,s,n){const r=t.getTimezoneOffset();switch(s){case"x":return Zw(r);case"xxxx":case"xx":return ko(r);case"xxxxx":case"xxx":default:return ko(r,":")}},O:function(t,s,n){const r=t.getTimezoneOffset();switch(s){case"O":case"OO":case"OOO":return"GMT"+Yw(r,":");case"OOOO":default:return"GMT"+ko(r,":")}},z:function(t,s,n){const r=t.getTimezoneOffset();switch(s){case"z":case"zz":case"zzz":return"GMT"+Yw(r,":");case"zzzz":default:return"GMT"+ko(r,":")}},t:function(t,s,n){const r=Math.trunc(t.getTime()/1e3);return un(r,s.length)},T:function(t,s,n){const r=t.getTime();return un(r,s.length)}};function Yw(t,s=""){const n=t>0?"-":"+",r=Math.abs(t),a=Math.trunc(r/60),l=r%60;return l===0?n+String(a):n+String(a)+s+un(l,2)}function Zw(t,s){return t%60===0?(t>0?"-":"+")+un(Math.abs(t)/60,2):ko(t,s)}function ko(t,s=""){const n=t>0?"-":"+",r=Math.abs(t),a=un(Math.trunc(r/60),2),l=un(r%60,2);return n+a+s+l}const Qw=(t,s)=>{switch(t){case"P":return s.date({width:"short"});case"PP":return s.date({width:"medium"});case"PPP":return s.date({width:"long"});case"PPPP":default:return s.date({width:"full"})}},Ek=(t,s)=>{switch(t){case"p":return s.time({width:"short"});case"pp":return s.time({width:"medium"});case"ppp":return s.time({width:"long"});case"pppp":default:return s.time({width:"full"})}},J8=(t,s)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return Qw(t,s);let l;switch(r){case"P":l=s.dateTime({width:"short"});break;case"PP":l=s.dateTime({width:"medium"});break;case"PPP":l=s.dateTime({width:"long"});break;case"PPPP":default:l=s.dateTime({width:"full"});break}return l.replace("{{date}}",Qw(r,s)).replace("{{time}}",Ek(a,s))},e9={p:Ek,P:J8},t9=/^D+$/,s9=/^Y+$/,n9=["D","DD","YY","YYYY"];function r9(t){return t9.test(t)}function a9(t){return s9.test(t)}function i9(t,s,n){const r=l9(t,s,n);if(console.warn(r),n9.includes(t))throw new RangeError(r)}function l9(t,s,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${s}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const o9=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,c9=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,d9=/^'([^]*?)'?$/,u9=/''/g,h9=/[a-zA-Z]/;function m9(t,s,n){var f,m,p,u;const r=wu(),a=r.locale??kk,l=r.firstWeekContainsDate??((m=(f=r.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,c=r.weekStartsOn??((u=(p=r.locale)==null?void 0:p.options)==null?void 0:u.weekStartsOn)??0,d=fn(t);if(!l8(d))throw new RangeError("Invalid time value");let h=s.match(c9).map(j=>{const g=j[0];if(g==="p"||g==="P"){const y=e9[g];return y(j,a.formatLong)}return j}).join("").match(o9).map(j=>{if(j==="''")return{isToken:!1,value:"'"};const g=j[0];if(g==="'")return{isToken:!1,value:f9(j)};if(Kw[g])return{isToken:!0,value:j};if(g.match(h9))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:j}});a.localize.preprocessor&&(h=a.localize.preprocessor(d,h));const x={firstWeekContainsDate:l,weekStartsOn:c,locale:a};return h.map(j=>{if(!j.isToken)return j.value;const g=j.value;(a9(g)||r9(g))&&i9(g,s,String(t));const y=Kw[g[0]];return y(d,g,a.localize,x)}).join("")}function f9(t){const s=t.match(d9);return s?s[1].replace(u9,"'"):t}function p9(t,s,n){const r=wu(),a=(n==null?void 0:n.locale)??r.locale??kk,l=2520,c=am(t,s);if(isNaN(c))throw new RangeError("Invalid time value");const d=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:c});let h,x;c>0?(h=fn(s),x=fn(t)):(h=fn(t),x=fn(s));const f=p8(x,h),m=(km(x)-km(h))/1e3,p=Math.round((f-m)/60);let u;if(p<2)return n!=null&&n.includeSeconds?f<5?a.formatDistance("lessThanXSeconds",5,d):f<10?a.formatDistance("lessThanXSeconds",10,d):f<20?a.formatDistance("lessThanXSeconds",20,d):f<40?a.formatDistance("halfAMinute",0,d):f<60?a.formatDistance("lessThanXMinutes",1,d):a.formatDistance("xMinutes",1,d):p===0?a.formatDistance("lessThanXMinutes",1,d):a.formatDistance("xMinutes",p,d);if(p<45)return a.formatDistance("xMinutes",p,d);if(p<90)return a.formatDistance("aboutXHours",1,d);if(pf.auth),{socket:r}=Sk(),[a,l]=v.useState([]),[c,d]=v.useState(0);v.useEffect(()=>{(async()=>{try{const m=await _o.getNotifications(1,15);m.success&&(l(m.data),m.pagination&&m.pagination.unreadCount!==void 0?d(m.pagination.unreadCount):d(m.data.filter(p=>!p.isRead).length))}catch(m){console.error("Fetch notifications error:",m)}})()},[]),v.useEffect(()=>{if(r)return r.on("notification",f=>{l(m=>[f,...m].slice(0,15)),d(m=>m+1),ee(f.title,{description:f.message,action:f.link?{label:"View",onClick:()=>window.location.href=f.link}:void 0})}),()=>{r.off("notification")}},[r]);const h=async f=>{try{f.isRead||(await _o.markAsRead(f.id)).success&&(l(p=>p.map(u=>u.id===f.id?{...u,isRead:!0}:u)),d(p=>Math.max(0,p-1))),f.link&&(window.location.href=f.link)}catch(m){console.error("Notification click error:",m)}},x=async()=>{try{(await _o.markAllAsRead()).success&&(l(m=>m.map(p=>({...p,isRead:!0}))),d(0))}catch(f){console.error("Mark all as read error:",f)}};return e.jsx("header",{className:"bg-white border-b border-slate-200 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900",children:t}),e.jsx("p",{className:"text-slate-600",children:"Manage and track dealership applications"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[n&&e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-100 rounded-lg",children:[e.jsx("div",{className:"w-8 h-8 bg-re-red rounded-full flex items-center justify-center",children:e.jsx(kr,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-slate-900",children:n.name}),e.jsx("p",{className:"text-slate-600",children:n.role})]})]}),s&&e.jsx(se,{variant:"outline",size:"icon",onClick:s,title:"Refresh",children:e.jsx(Rr,{className:"w-4 h-4"})}),e.jsx(se,{variant:"outline",size:"icon",title:"Help",children:e.jsx(M2,{className:"w-4 h-4"})}),e.jsxs(xb,{children:[e.jsx(gb,{asChild:!0,children:e.jsxs(se,{variant:"outline",size:"icon",className:"relative",children:[e.jsx(Yd,{className:"w-4 h-4"}),c>0&&e.jsx(Ae,{variant:"destructive",className:"absolute -top-1 -right-1 w-5 h-5 p-0 flex items-center justify-center text-xs",children:c})]})}),e.jsxs(vb,{align:"end",className:"w-80",children:[e.jsxs("div",{className:"p-3 border-b flex items-center justify-between",children:[e.jsx("p",{className:"font-semibold text-slate-900",children:"Notifications"}),c>0&&e.jsx("button",{onClick:x,className:"text-xs text-blue-600 hover:underline",children:"Mark all read"})]}),e.jsx("div",{className:"max-h-96 overflow-y-auto custom-scrollbar",children:a.length===0?e.jsx("div",{className:"p-8 text-center text-slate-500",children:"No notifications yet"}):a.map(f=>e.jsxs(ck,{className:`p-3 cursor-pointer flex items-start gap-3 ${f.isRead?"":"bg-blue-50/50"}`,onClick:()=>h(f),children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-slate-900 text-sm font-medium",children:f.title}),e.jsx("p",{className:"text-slate-600 text-xs mt-1 leading-relaxed",children:f.message}),e.jsx("p",{className:"text-slate-400 text-[10px] mt-2",children:Dk(new Date(f.createdAt),{addSuffix:!0})})]}),!f.isRead&&e.jsx("div",{className:"w-2 h-2 bg-blue-600 rounded-full mt-1.5 flex-shrink-0"})]},f.id))}),e.jsx("div",{className:"p-3 border-t text-center",children:e.jsx("button",{onClick:()=>window.location.href="/notifications",className:"text-xs font-medium text-blue-600 hover:text-blue-800 transition-colors",children:"View All Notifications"})})]})]})]})]})})}function Le({className:t,...s}){return e.jsx("div",{"data-slot":"card",className:Pt("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border",t),...s})}function tt({className:t,...s}){return e.jsx("div",{"data-slot":"card-header",className:Pt("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 pt-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...s})}function nt({className:t,...s}){return e.jsx("h4",{"data-slot":"card-title",className:Pt("leading-none",t),...s})}function Zt({className:t,...s}){return e.jsx("p",{"data-slot":"card-description",className:Pt("text-muted-foreground",t),...s})}function Me({className:t,...s}){return e.jsx("div",{"data-slot":"card-content",className:Pt("px-6 [&:last-child]:pb-6",t),...s})}function bv(t,[s,n]){return Math.min(n,Math.max(s,t))}function g9(t,s){return v.useReducer((n,r)=>s[n][r]??n,t)}var Sb="ScrollArea",[Tk]=ea(Sb),[v9,Ea]=Tk(Sb),Pk=v.forwardRef((t,s)=>{const{__scopeScrollArea:n,type:r="hover",dir:a,scrollHideDelay:l=600,...c}=t,[d,h]=v.useState(null),[x,f]=v.useState(null),[m,p]=v.useState(null),[u,j]=v.useState(null),[g,y]=v.useState(null),[N,S]=v.useState(0),[C,w]=v.useState(0),[R,P]=v.useState(!1),[A,I]=v.useState(!1),$=Ms(s,E=>h(E)),T=pu(a);return e.jsx(v9,{scope:n,type:r,dir:T,scrollHideDelay:l,scrollArea:d,viewport:x,onViewportChange:f,content:m,onContentChange:p,scrollbarX:u,onScrollbarXChange:j,scrollbarXEnabled:R,onScrollbarXEnabledChange:P,scrollbarY:g,onScrollbarYChange:y,scrollbarYEnabled:A,onScrollbarYEnabledChange:I,onCornerWidthChange:S,onCornerHeightChange:w,children:e.jsx(ps.div,{dir:T,...c,ref:$,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":C+"px",...t.style}})})});Pk.displayName=Sb;var _k="ScrollAreaViewport",Ok=v.forwardRef((t,s)=>{const{__scopeScrollArea:n,children:r,nonce:a,...l}=t,c=Ea(_k,n),d=v.useRef(null),h=Ms(s,d,c.onViewportChange);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),e.jsx(ps.div,{"data-radix-scroll-area-viewport":"",...l,ref:h,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...t.style},children:e.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Ok.displayName=_k;var Si="ScrollAreaScrollbar",Ik=v.forwardRef((t,s)=>{const{forceMount:n,...r}=t,a=Ea(Si,t.__scopeScrollArea),{onScrollbarXEnabledChange:l,onScrollbarYEnabledChange:c}=a,d=t.orientation==="horizontal";return v.useEffect(()=>(d?l(!0):c(!0),()=>{d?l(!1):c(!1)}),[d,l,c]),a.type==="hover"?e.jsx(b9,{...r,ref:s,forceMount:n}):a.type==="scroll"?e.jsx(y9,{...r,ref:s,forceMount:n}):a.type==="auto"?e.jsx(Lk,{...r,ref:s,forceMount:n}):a.type==="always"?e.jsx(Cb,{...r,ref:s}):null});Ik.displayName=Si;var b9=v.forwardRef((t,s)=>{const{forceMount:n,...r}=t,a=Ea(Si,t.__scopeScrollArea),[l,c]=v.useState(!1);return v.useEffect(()=>{const d=a.scrollArea;let h=0;if(d){const x=()=>{window.clearTimeout(h),c(!0)},f=()=>{h=window.setTimeout(()=>c(!1),a.scrollHideDelay)};return d.addEventListener("pointerenter",x),d.addEventListener("pointerleave",f),()=>{window.clearTimeout(h),d.removeEventListener("pointerenter",x),d.removeEventListener("pointerleave",f)}}},[a.scrollArea,a.scrollHideDelay]),e.jsx(mr,{present:n||l,children:e.jsx(Lk,{"data-state":l?"visible":"hidden",...r,ref:s})})}),y9=v.forwardRef((t,s)=>{const{forceMount:n,...r}=t,a=Ea(Si,t.__scopeScrollArea),l=t.orientation==="horizontal",c=pf(()=>h("SCROLL_END"),100),[d,h]=g9("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(d==="idle"){const x=window.setTimeout(()=>h("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(x)}},[d,a.scrollHideDelay,h]),v.useEffect(()=>{const x=a.viewport,f=l?"scrollLeft":"scrollTop";if(x){let m=x[f];const p=()=>{const u=x[f];m!==u&&(h("SCROLL"),c()),m=u};return x.addEventListener("scroll",p),()=>x.removeEventListener("scroll",p)}},[a.viewport,l,h,c]),e.jsx(mr,{present:n||d!=="hidden",children:e.jsx(Cb,{"data-state":d==="hidden"?"hidden":"visible",...r,ref:s,onPointerEnter:Vt(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:Vt(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),Lk=v.forwardRef((t,s)=>{const n=Ea(Si,t.__scopeScrollArea),{forceMount:r,...a}=t,[l,c]=v.useState(!1),d=t.orientation==="horizontal",h=pf(()=>{if(n.viewport){const x=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,a=Ea(Si,t.__scopeScrollArea),l=v.useRef(null),c=v.useRef(0),[d,h]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),x=qk(d.viewport,d.content),f={...r,sizes:d,onSizesChange:h,hasThumb:x>0&&x<1,onThumbChange:p=>l.current=p,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:p=>c.current=p};function m(p,u){return A9(p,c.current,d,u)}return n==="horizontal"?e.jsx(j9,{...f,ref:s,onThumbPositionChange:()=>{if(a.viewport&&l.current){const p=a.viewport.scrollLeft,u=Xw(p,d,a.dir);l.current.style.transform=`translate3d(${u}px, 0, 0)`}},onWheelScroll:p=>{a.viewport&&(a.viewport.scrollLeft=p)},onDragScroll:p=>{a.viewport&&(a.viewport.scrollLeft=m(p,a.dir))}}):n==="vertical"?e.jsx(N9,{...f,ref:s,onThumbPositionChange:()=>{if(a.viewport&&l.current){const p=a.viewport.scrollTop,u=Xw(p,d);l.current.style.transform=`translate3d(0, ${u}px, 0)`}},onWheelScroll:p=>{a.viewport&&(a.viewport.scrollTop=p)},onDragScroll:p=>{a.viewport&&(a.viewport.scrollTop=m(p))}}):null}),j9=v.forwardRef((t,s)=>{const{sizes:n,onSizesChange:r,...a}=t,l=Ea(Si,t.__scopeScrollArea),[c,d]=v.useState(),h=v.useRef(null),x=Ms(s,h,l.onScrollbarXChange);return v.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),e.jsx(Fk,{"data-orientation":"horizontal",...a,ref:x,sizes:n,style:{bottom:0,left:l.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:l.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ff(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.x),onDragScroll:f=>t.onDragScroll(f.x),onWheelScroll:(f,m)=>{if(l.viewport){const p=l.viewport.scrollLeft+f.deltaX;t.onWheelScroll(p),Uk(p,m)&&f.preventDefault()}},onResize:()=>{h.current&&l.viewport&&c&&r({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:Em(c.paddingLeft),paddingEnd:Em(c.paddingRight)}})}})}),N9=v.forwardRef((t,s)=>{const{sizes:n,onSizesChange:r,...a}=t,l=Ea(Si,t.__scopeScrollArea),[c,d]=v.useState(),h=v.useRef(null),x=Ms(s,h,l.onScrollbarYChange);return v.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),e.jsx(Fk,{"data-orientation":"vertical",...a,ref:x,sizes:n,style:{top:0,right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ff(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.y),onDragScroll:f=>t.onDragScroll(f.y),onWheelScroll:(f,m)=>{if(l.viewport){const p=l.viewport.scrollTop+f.deltaY;t.onWheelScroll(p),Uk(p,m)&&f.preventDefault()}},onResize:()=>{h.current&&l.viewport&&c&&r({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:Em(c.paddingTop),paddingEnd:Em(c.paddingBottom)}})}})}),[w9,Mk]=Tk(Si),Fk=v.forwardRef((t,s)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:a,onThumbChange:l,onThumbPointerUp:c,onThumbPointerDown:d,onThumbPositionChange:h,onDragScroll:x,onWheelScroll:f,onResize:m,...p}=t,u=Ea(Si,n),[j,g]=v.useState(null),y=Ms(s,$=>g($)),N=v.useRef(null),S=v.useRef(""),C=u.viewport,w=r.content-r.viewport,R=dr(f),P=dr(h),A=pf(m,10);function I($){if(N.current){const T=$.clientX-N.current.left,E=$.clientY-N.current.top;x({x:T,y:E})}}return v.useEffect(()=>{const $=T=>{const E=T.target;(j==null?void 0:j.contains(E))&&R(T,w)};return document.addEventListener("wheel",$,{passive:!1}),()=>document.removeEventListener("wheel",$,{passive:!1})},[C,j,w,R]),v.useEffect(P,[r,P]),_c(j,A),_c(u.content,A),e.jsx(w9,{scope:n,scrollbar:j,hasThumb:a,onThumbChange:dr(l),onThumbPointerUp:dr(c),onThumbPositionChange:P,onThumbPointerDown:dr(d),children:e.jsx(ps.div,{...p,ref:y,style:{position:"absolute",...p.style},onPointerDown:Vt(t.onPointerDown,$=>{$.button===0&&($.target.setPointerCapture($.pointerId),N.current=j.getBoundingClientRect(),S.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",u.viewport&&(u.viewport.style.scrollBehavior="auto"),I($))}),onPointerMove:Vt(t.onPointerMove,I),onPointerUp:Vt(t.onPointerUp,$=>{const T=$.target;T.hasPointerCapture($.pointerId)&&T.releasePointerCapture($.pointerId),document.body.style.webkitUserSelect=S.current,u.viewport&&(u.viewport.style.scrollBehavior=""),N.current=null})})})}),Rm="ScrollAreaThumb",Bk=v.forwardRef((t,s)=>{const{forceMount:n,...r}=t,a=Mk(Rm,t.__scopeScrollArea);return e.jsx(mr,{present:n||a.hasThumb,children:e.jsx(S9,{ref:s,...r})})}),S9=v.forwardRef((t,s)=>{const{__scopeScrollArea:n,style:r,...a}=t,l=Ea(Rm,n),c=Mk(Rm,n),{onThumbPositionChange:d}=c,h=Ms(s,m=>c.onThumbChange(m)),x=v.useRef(void 0),f=pf(()=>{x.current&&(x.current(),x.current=void 0)},100);return v.useEffect(()=>{const m=l.viewport;if(m){const p=()=>{if(f(),!x.current){const u=k9(m,d);x.current=u,d()}};return d(),m.addEventListener("scroll",p),()=>m.removeEventListener("scroll",p)}},[l.viewport,f,d]),e.jsx(ps.div,{"data-state":c.hasThumb?"visible":"hidden",...a,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Vt(t.onPointerDownCapture,m=>{const u=m.target.getBoundingClientRect(),j=m.clientX-u.left,g=m.clientY-u.top;c.onThumbPointerDown({x:j,y:g})}),onPointerUp:Vt(t.onPointerUp,c.onThumbPointerUp)})});Bk.displayName=Rm;var Ab="ScrollAreaCorner",$k=v.forwardRef((t,s)=>{const n=Ea(Ab,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?e.jsx(C9,{...t,ref:s}):null});$k.displayName=Ab;var C9=v.forwardRef((t,s)=>{const{__scopeScrollArea:n,...r}=t,a=Ea(Ab,n),[l,c]=v.useState(0),[d,h]=v.useState(0),x=!!(l&&d);return _c(a.scrollbarX,()=>{var m;const f=((m=a.scrollbarX)==null?void 0:m.offsetHeight)||0;a.onCornerHeightChange(f),h(f)}),_c(a.scrollbarY,()=>{var m;const f=((m=a.scrollbarY)==null?void 0:m.offsetWidth)||0;a.onCornerWidthChange(f),c(f)}),x?e.jsx(ps.div,{...r,ref:s,style:{width:l,height:d,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Em(t){return t?parseInt(t,10):0}function qk(t,s){const n=t/s;return isNaN(n)?0:n}function ff(t){const s=qk(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*s;return Math.max(r,18)}function A9(t,s,n,r="ltr"){const a=ff(n),l=a/2,c=s||l,d=a-c,h=n.scrollbar.paddingStart+c,x=n.scrollbar.size-n.scrollbar.paddingEnd-d,f=n.content-n.viewport,m=r==="ltr"?[0,f]:[f*-1,0];return zk([h,x],m)(t)}function Xw(t,s,n="ltr"){const r=ff(s),a=s.scrollbar.paddingStart+s.scrollbar.paddingEnd,l=s.scrollbar.size-a,c=s.content-s.viewport,d=l-r,h=n==="ltr"?[0,c]:[c*-1,0],x=bv(t,h);return zk([0,c],[0,d])(x)}function zk(t,s){return n=>{if(t[0]===t[1]||s[0]===s[1])return s[0];const r=(s[1]-s[0])/(t[1]-t[0]);return s[0]+r*(n-t[0])}}function Uk(t,s){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function a(){const l={left:t.scrollLeft,top:t.scrollTop},c=n.left!==l.left,d=n.top!==l.top;(c||d)&&s(),n=l,r=window.requestAnimationFrame(a)})(),()=>window.cancelAnimationFrame(r)};function pf(t,s){const n=dr(t),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,s)},[n,s])}function _c(t,s){const n=dr(s);Zn(()=>{let r=0;if(t){const a=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return a.observe(t),()=>{window.cancelAnimationFrame(r),a.unobserve(t)}}},[t,n])}var R9=Pk,E9=Ok,D9=$k;function kb({className:t,children:s,...n}){return e.jsxs(R9,{"data-slot":"scroll-area",className:Pt("relative",t),...n,children:[e.jsx(E9,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:s}),e.jsx(T9,{}),e.jsx(D9,{})]})}function T9({className:t,orientation:s="vertical",...n}){return e.jsx(Ik,{"data-slot":"scroll-area-scrollbar",orientation:s,className:Pt("flex touch-none p-px transition-colors select-none",s==="vertical"&&"h-full w-2.5 border-l border-l-transparent",s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",t),...n,children:e.jsx(Bk,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function P9({onNavigate:t}){const s=[{title:"Total Applications",value:hi.totalApplications,icon:fs,color:"bg-blue-500",trend:{value:12,isPositive:!0},filter:"all"},{title:"LOA Issued",value:hi.loaIssued,icon:Ys,color:"bg-green-500",trend:{value:8,isPositive:!0},filter:"Approved"},{title:"Level 1 Pending",value:hi.level1Pending,icon:Js,color:"bg-amber-500",trend:{value:3,isPositive:!1},filter:"Level 1 Pending"},{title:"Level 2 Pending",value:hi.level2Pending,icon:gI,color:"bg-purple-500",trend:{value:5,isPositive:!0},filter:"Level 2 Pending"},{title:"Level 3 Pending",value:hi.level3Pending,icon:Z5,color:"bg-indigo-500",trend:{value:2,isPositive:!1},filter:"Level 3 Pending"},{title:"EOR In Progress",value:hi.eorInProgress,icon:Ks,color:"bg-cyan-500",trend:{value:1,isPositive:!0},filter:"EOR In Progress"},{title:"Disqualified",value:hi.disqualified,icon:Za,color:"bg-red-500",trend:{value:4,isPositive:!1},filter:"Disqualified"},{title:"Pending Reminders",value:hi.pendingReminders,icon:qr,color:"bg-orange-500",trend:{value:7,isPositive:!1},filter:"Questionnaire Pending"},{title:"Shortlisted Today",value:hi.shortlistedToday,icon:Ys,color:"bg-teal-500",trend:{value:5,isPositive:!0},filter:"Shortlisted"},{title:"Pending Shortlisting",value:hi.pendingShortlisting,icon:nI,color:"bg-yellow-500",trend:{value:2,isPositive:!1},filter:"all",action:"opportunity-requests"}],n=[{status:"Pending",count:45,color:"#f59e0b"},{status:"In Progress",count:68,color:"#3b82f6"},{status:"Approved",count:25,color:"#10b981"},{status:"Rejected",count:12,color:"#ef4444"}],r=[{location:"Mumbai",count:23},{location:"Delhi",count:18},{location:"Bangalore",count:21},{location:"Chennai",count:15},{location:"Kolkata",count:12},{location:"Others",count:61}],a=Math.max(...r.map(l=>l.count));return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:s.map(l=>{const c=l.icon,d=l.trend.isPositive?Wi:Po;return e.jsxs(Le,{className:"cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>t(l.action||"applications",l.filter),children:[e.jsxs(tt,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsx(nt,{className:"text-slate-600",children:l.title}),e.jsx("div",{className:`${l.color} p-2 rounded-lg`,children:e.jsx(c,{className:"w-5 h-5 text-white"})})]}),e.jsx(Me,{children:e.jsx("div",{className:"flex items-end justify-between",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-slate-900",children:l.value}),e.jsxs("div",{className:`flex items-center gap-1 mt-1 ${l.trend.isPositive?"text-green-600":"text-red-600"}`,children:[e.jsx(d,{className:"w-3 h-3"}),e.jsxs("span",{children:[l.trend.value,"% from last month"]})]})]})})})]},l.title)})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Application Status Distribution"})}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:n.map(l=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:l.color}}),e.jsx("span",{className:"text-slate-700",children:l.status})]}),e.jsx("span",{className:"text-slate-900",children:l.count})]}),e.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:e.jsx("div",{className:"h-2 rounded-full transition-all",style:{width:`${l.count/150*100}%`,backgroundColor:l.color}})})]},l.status))})})]}),e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Applications by Location"})}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-3",children:r.map(l=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-24 text-slate-700",children:l.location}),e.jsx("div",{className:"flex-1 bg-slate-200 rounded-full h-8 relative overflow-hidden",children:e.jsx("div",{className:"bg-amber-600 h-full rounded-full transition-all flex items-center justify-end px-3",style:{width:`${l.count/a*100}%`},children:e.jsx("span",{className:"text-white",children:l.count})})})]},l.location))})})]})]}),e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Recent Activity"})}),e.jsx(Me,{children:e.jsx(kb,{className:"h-80",children:e.jsx("div",{className:"space-y-4",children:JI.map(l=>e.jsxs("div",{className:"flex items-start gap-4 p-3 hover:bg-slate-50 rounded-lg cursor-pointer transition-colors",onClick:()=>t("applications"),children:[e.jsxs("div",{className:"w-10 h-10 bg-amber-100 rounded-full flex items-center justify-center flex-shrink-0",children:[l.action==="Approved"&&e.jsx(Ys,{className:"w-5 h-5 text-green-600"}),l.action==="Interview Scheduled"&&e.jsx(Js,{className:"w-5 h-5 text-blue-600"}),l.action==="Document Uploaded"&&e.jsx(fs,{className:"w-5 h-5 text-purple-600"}),l.action==="Reminder Sent"&&e.jsx(qr,{className:"w-5 h-5 text-orange-600"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(Ae,{variant:"outline",children:l.applicationId}),e.jsx("span",{className:"text-slate-700",children:l.action})]}),e.jsxs("p",{className:"text-slate-500 mt-1",children:["by ",l.user]})]}),e.jsx("div",{className:"text-slate-500 flex-shrink-0",children:l.timestamp})]},l.id))})})})]})]})}var xf="Tabs",[_9]=ea(xf,[af]),Vk=af(),[O9,Rb]=_9(xf),Hk=v.forwardRef((t,s)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:l,orientation:c="horizontal",dir:d,activationMode:h="automatic",...x}=t,f=pu(d),[m,p]=bi({prop:r,onChange:a,defaultProp:l??"",caller:xf});return e.jsx(O9,{scope:n,baseId:hr(),value:m,onValueChange:p,orientation:c,dir:f,activationMode:h,children:e.jsx(ps.div,{dir:f,"data-orientation":c,...x,ref:s})})});Hk.displayName=xf;var Wk="TabsList",Gk=v.forwardRef((t,s)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,l=Rb(Wk,n),c=Vk(n);return e.jsx(vA,{asChild:!0,...c,orientation:l.orientation,dir:l.dir,loop:r,children:e.jsx(ps.div,{role:"tablist","aria-orientation":l.orientation,...a,ref:s})})});Gk.displayName=Wk;var Kk="TabsTrigger",Yk=v.forwardRef((t,s)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...l}=t,c=Rb(Kk,n),d=Vk(n),h=Xk(c.baseId,r),x=Jk(c.baseId,r),f=r===c.value;return e.jsx(bA,{asChild:!0,...d,focusable:!a,active:f,children:e.jsx(ps.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":x,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:h,...l,ref:s,onMouseDown:Vt(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?c.onValueChange(r):m.preventDefault()}),onKeyDown:Vt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&c.onValueChange(r)}),onFocus:Vt(t.onFocus,()=>{const m=c.activationMode!=="manual";!f&&!a&&m&&c.onValueChange(r)})})})});Yk.displayName=Kk;var Zk="TabsContent",Qk=v.forwardRef((t,s)=>{const{__scopeTabs:n,value:r,forceMount:a,children:l,...c}=t,d=Rb(Zk,n),h=Xk(d.baseId,r),x=Jk(d.baseId,r),f=r===d.value,m=v.useRef(f);return v.useEffect(()=>{const p=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(p)},[]),e.jsx(mr,{present:a||f,children:({present:p})=>e.jsx(ps.div,{"data-state":f?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":h,hidden:!p,id:x,tabIndex:0,...c,ref:s,style:{...t.style,animationDuration:m.current?"0s":void 0},children:p&&l})})});Qk.displayName=Zk;function Xk(t,s){return`${t}-trigger-${s}`}function Jk(t,s){return`${t}-content-${s}`}var I9=Hk,L9=Gk,M9=Yk,F9=Qk;function Pn({className:t,...s}){return e.jsx(I9,{"data-slot":"tabs",className:Pt("flex flex-col gap-2",t),...s})}function _n({className:t,...s}){return e.jsx(L9,{"data-slot":"tabs-list",className:Pt("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-xl p-[3px] flex",t),...s})}function Wt({className:t,...s}){return e.jsx(M9,{"data-slot":"tabs-trigger",className:Pt("data-[state=active]:bg-card dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-xl border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s})}function Gt({className:t,...s}){return e.jsx(F9,{"data-slot":"tabs-content",className:Pt("flex-1 outline-none",t),...s})}function B9(t){const s=$9(t),n=v.forwardRef((r,a)=>{const{children:l,...c}=r,d=v.Children.toArray(l),h=d.find(z9);if(h){const x=h.props.children,f=d.map(m=>m===h?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:m);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}function $9(t){const s=v.forwardRef((n,r)=>{const{children:a,...l}=n;if(v.isValidElement(a)){const c=V9(a),d=U9(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var q9=Symbol("radix.slottable");function z9(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===q9}function U9(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const h=l(...d);return a(...d),h}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function V9(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var gf="Dialog",[eR,tR]=ea(gf),[H9,si]=eR(gf),sR=t=>{const{__scopeDialog:s,children:n,open:r,defaultOpen:a,onOpenChange:l,modal:c=!0}=t,d=v.useRef(null),h=v.useRef(null),[x,f]=bi({prop:r,defaultProp:a??!1,onChange:l,caller:gf});return e.jsx(H9,{scope:s,triggerRef:d,contentRef:h,contentId:hr(),titleId:hr(),descriptionId:hr(),open:x,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:c,children:n})};sR.displayName=gf;var nR="DialogTrigger",rR=v.forwardRef((t,s)=>{const{__scopeDialog:n,...r}=t,a=si(nR,n),l=Ms(s,a.triggerRef);return e.jsx(ps.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Tb(a.open),...r,ref:l,onClick:Vt(t.onClick,a.onOpenToggle)})});rR.displayName=nR;var Eb="DialogPortal",[W9,aR]=eR(Eb,{forceMount:void 0}),iR=t=>{const{__scopeDialog:s,forceMount:n,children:r,container:a}=t,l=si(Eb,s);return e.jsx(W9,{scope:s,forceMount:n,children:v.Children.map(r,c=>e.jsx(mr,{present:n||l.open,children:e.jsx(Hc,{asChild:!0,container:a,children:c})}))})};iR.displayName=Eb;var Dm="DialogOverlay",lR=v.forwardRef((t,s)=>{const n=aR(Dm,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,l=si(Dm,t.__scopeDialog);return l.modal?e.jsx(mr,{present:r||l.open,children:e.jsx(K9,{...a,ref:s})}):null});lR.displayName=Dm;var G9=B9("DialogOverlay.RemoveScroll"),K9=v.forwardRef((t,s)=>{const{__scopeDialog:n,...r}=t,a=si(Dm,n);return e.jsx(yu,{as:G9,allowPinchZoom:!0,shards:[a.contentRef],children:e.jsx(ps.div,{"data-state":Tb(a.open),...r,ref:s,style:{pointerEvents:"auto",...r.style}})})}),$o="DialogContent",oR=v.forwardRef((t,s)=>{const n=aR($o,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,l=si($o,t.__scopeDialog);return e.jsx(mr,{present:r||l.open,children:l.modal?e.jsx(Y9,{...a,ref:s}):e.jsx(Z9,{...a,ref:s})})});oR.displayName=$o;var Y9=v.forwardRef((t,s)=>{const n=si($o,t.__scopeDialog),r=v.useRef(null),a=Ms(s,n.contentRef,r);return v.useEffect(()=>{const l=r.current;if(l)return lf(l)},[]),e.jsx(cR,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Vt(t.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Vt(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0;(c.button===2||d)&&l.preventDefault()}),onFocusOutside:Vt(t.onFocusOutside,l=>l.preventDefault())})}),Z9=v.forwardRef((t,s)=>{const n=si($o,t.__scopeDialog),r=v.useRef(!1),a=v.useRef(!1);return e.jsx(cR,{...t,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,d;(c=t.onCloseAutoFocus)==null||c.call(t,l),l.defaultPrevented||(r.current||(d=n.triggerRef.current)==null||d.focus(),l.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:l=>{var h,x;(h=t.onInteractOutside)==null||h.call(t,l),l.defaultPrevented||(r.current=!0,l.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=l.target;((x=n.triggerRef.current)==null?void 0:x.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&a.current&&l.preventDefault()}})}),cR=v.forwardRef((t,s)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:l,...c}=t,d=si($o,n),h=v.useRef(null),x=Ms(s,h);return Qm(),e.jsxs(e.Fragment,{children:[e.jsx(xu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:l,children:e.jsx(zc,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Tb(d.open),...c,ref:x,onDismiss:()=>d.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(X9,{titleId:d.titleId}),e.jsx(eB,{contentRef:h,descriptionId:d.descriptionId})]})]})}),Db="DialogTitle",dR=v.forwardRef((t,s)=>{const{__scopeDialog:n,...r}=t,a=si(Db,n);return e.jsx(ps.h2,{id:a.titleId,...r,ref:s})});dR.displayName=Db;var uR="DialogDescription",hR=v.forwardRef((t,s)=>{const{__scopeDialog:n,...r}=t,a=si(uR,n);return e.jsx(ps.p,{id:a.descriptionId,...r,ref:s})});hR.displayName=uR;var mR="DialogClose",fR=v.forwardRef((t,s)=>{const{__scopeDialog:n,...r}=t,a=si(mR,n);return e.jsx(ps.button,{type:"button",...r,ref:s,onClick:Vt(t.onClick,()=>a.onOpenChange(!1))})});fR.displayName=mR;function Tb(t){return t?"open":"closed"}var pR="DialogTitleWarning",[Q9,xR]=S5(pR,{contentName:$o,titleName:Db,docsSlug:"dialog"}),X9=({titleId:t})=>{const s=xR(pR),n=`\`${s.contentName}\` requires a \`${s.titleName}\` for the component to be accessible for screen reader users. +`)},$3=0,gc=[];function q3(t){var s=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),a=v.useState($3++)[0],l=v.useState(RA)[0],c=v.useRef(t);v.useEffect(function(){c.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var p=o3([t.lockRef.current],(t.shards||[]).map(zw),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var d=v.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!c.current.allowPinchZoom;var N=Ph(p),S=n.current,A="deltaX"in p?p.deltaX:S[0]-N[0],w="deltaY"in p?p.deltaY:S[1]-N[1],E,T=p.target,C=Math.abs(A)>Math.abs(w)?"h":"v";if("touches"in p&&C==="h"&&T.type==="range")return!1;var L=window.getSelection(),$=L&&L.anchorNode,_=$?$===T||$.contains(T):!1;if(_)return!1;var R=$w(C,T);if(!R)return!0;if(R?E=C:(E=C==="v"?"h":"v",R=$w(C,T)),!R)return!1;if(!r.current&&"changedTouches"in p&&(A||w)&&(r.current=E),!E)return!0;var P=r.current||E;return M3(P,y,p,P==="h"?A:w)},[]),m=v.useCallback(function(p){var y=p;if(!(!gc.length||gc[gc.length-1]!==l)){var N="deltaY"in y?qw(y):Ph(y),S=s.current.filter(function(E){return E.name===y.type&&(E.target===y.target||y.target===E.shadowParent)&&F3(E.delta,N)})[0];if(S&&S.should){y.cancelable&&y.preventDefault();return}if(!S){var A=(c.current.shards||[]).map(zw).filter(Boolean).filter(function(E){return E.contains(y.target)}),w=A.length>0?d(y,A[0]):!c.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),x=v.useCallback(function(p,y,N,S){var A={name:p,delta:y,target:N,should:S,shadowParent:z3(N)};s.current.push(A),setTimeout(function(){s.current=s.current.filter(function(w){return w!==A})},1)},[]),f=v.useCallback(function(p){n.current=Ph(p),r.current=void 0},[]),h=v.useCallback(function(p){x(p.type,qw(p),p.target,d(p,t.lockRef.current))},[]),g=v.useCallback(function(p){x(p.type,Ph(p),p.target,d(p,t.lockRef.current))},[]);v.useEffect(function(){return gc.push(l),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",m,xc),document.addEventListener("touchmove",m,xc),document.addEventListener("touchstart",f,xc),function(){gc=gc.filter(function(p){return p!==l}),document.removeEventListener("wheel",m,xc),document.removeEventListener("touchmove",m,xc),document.removeEventListener("touchstart",f,xc)}},[]);var u=t.removeScrollBar,j=t.inert;return v.createElement(v.Fragment,null,j?v.createElement(l,{styles:B3(a)}):null,u?v.createElement(D3,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function z3(t){for(var s=null;t!==null;)t instanceof ShadowRoot&&(s=t.host,t=t.host),t=t.parentNode;return s}const U3=g3(kA,q3);var yu=v.forwardRef(function(t,s){return v.createElement(df,pi({},t,{ref:s,sideCar:U3}))});yu.classNames=df.classNames;var pv=["Enter"," "],V3=["ArrowDown","PageUp","Home"],_A=["ArrowUp","PageDown","End"],H3=[...V3,..._A],W3={ltr:[...pv,"ArrowRight"],rtl:[...pv,"ArrowLeft"]},K3={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ju="Menu",[Xd,G3,Y3]=nb(ju),[Ho,PA]=ea(ju,[Y3,Vl,of]),uf=Vl(),OA=of(),[Z3,Wo]=Ho(ju),[Q3,Nu]=Ho(ju),LA=t=>{const{__scopeMenu:s,open:n=!1,children:r,dir:a,onOpenChange:l,modal:c=!0}=t,d=uf(s),[m,x]=v.useState(null),f=v.useRef(!1),h=dr(l),g=pu(a);return v.useEffect(()=>{const u=()=>{f.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>f.current=!1;return document.addEventListener("keydown",u,{capture:!0}),()=>{document.removeEventListener("keydown",u,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),e.jsx(rf,{...d,children:e.jsx(Z3,{scope:s,open:n,onOpenChange:h,content:m,onContentChange:x,children:e.jsx(Q3,{scope:s,onClose:v.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:c,children:r})})})};LA.displayName=ju;var X3="MenuAnchor",hb=v.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t,a=uf(n);return e.jsx(vu,{...a,...r,ref:s})});hb.displayName=X3;var mb="MenuPortal",[J3,IA]=Ho(mb,{forceMount:void 0}),MA=t=>{const{__scopeMenu:s,forceMount:n,children:r,container:a}=t,l=Wo(mb,s);return e.jsx(J3,{scope:s,forceMount:n,children:e.jsx(mr,{present:n||l.open,children:e.jsx(Hc,{asChild:!0,container:a,children:r})})})};MA.displayName=mb;var ka="MenuContent",[eM,fb]=Ho(ka),FA=v.forwardRef((t,s)=>{const n=IA(ka,t.__scopeMenu),{forceMount:r=n.forceMount,...a}=t,l=Wo(ka,t.__scopeMenu),c=Nu(ka,t.__scopeMenu);return e.jsx(Xd.Provider,{scope:t.__scopeMenu,children:e.jsx(mr,{present:r||l.open,children:e.jsx(Xd.Slot,{scope:t.__scopeMenu,children:c.modal?e.jsx(tM,{...a,ref:s}):e.jsx(sM,{...a,ref:s})})})})}),tM=v.forwardRef((t,s)=>{const n=Wo(ka,t.__scopeMenu),r=v.useRef(null),a=Ms(s,r);return v.useEffect(()=>{const l=r.current;if(l)return cf(l)},[]),e.jsx(pb,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Vt(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),sM=v.forwardRef((t,s)=>{const n=Wo(ka,t.__scopeMenu);return e.jsx(pb,{...t,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),nM=J6("MenuContent.ScrollLock"),pb=v.forwardRef((t,s)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:x,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:u,disableOutsideScroll:j,...p}=t,y=Wo(ka,n),N=Nu(ka,n),S=uf(n),A=OA(n),w=G3(n),[E,T]=v.useState(null),C=v.useRef(null),L=Ms(s,C,y.onContentChange),$=v.useRef(0),_=v.useRef(""),R=v.useRef(0),P=v.useRef(null),M=v.useRef("right"),q=v.useRef(0),K=j?yu:v.Fragment,Z=j?{as:nM,allowPinchZoom:!0}:void 0,W=F=>{var X,ne;const B=_.current+F,D=w().filter(oe=>!oe.disabled),O=document.activeElement,z=(X=D.find(oe=>oe.ref.current===O))==null?void 0:X.textValue,G=D.map(oe=>oe.textValue),Y=pM(G,B,z),V=(ne=D.find(oe=>oe.textValue===Y))==null?void 0:ne.ref.current;(function oe(re){_.current=re,window.clearTimeout($.current),re!==""&&($.current=window.setTimeout(()=>oe(""),1e3))})(B),V&&setTimeout(()=>V.focus())};v.useEffect(()=>()=>window.clearTimeout($.current),[]),Jm();const U=v.useCallback(F=>{var D,O;return M.current===((D=P.current)==null?void 0:D.side)&&gM(F,(O=P.current)==null?void 0:O.area)},[]);return e.jsx(eM,{scope:n,searchRef:_,onItemEnter:v.useCallback(F=>{U(F)&&F.preventDefault()},[U]),onItemLeave:v.useCallback(F=>{var B;U(F)||((B=C.current)==null||B.focus(),T(null))},[U]),onTriggerLeave:v.useCallback(F=>{U(F)&&F.preventDefault()},[U]),pointerGraceTimerRef:R,onPointerGraceIntentChange:v.useCallback(F=>{P.current=F},[]),children:e.jsx(K,{...Z,children:e.jsx(xu,{asChild:!0,trapped:a,onMountAutoFocus:Vt(l,F=>{var B;F.preventDefault(),(B=C.current)==null||B.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:e.jsx(zc,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:x,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:u,children:e.jsx(NA,{asChild:!0,...A,dir:N.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:T,onEntryFocus:Vt(m,F=>{N.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:e.jsx(af,{role:"menu","aria-orientation":"vertical","data-state":ek(y.open),"data-radix-menu-content":"",dir:N.dir,...S,...p,ref:L,style:{outline:"none",...p.style},onKeyDown:Vt(p.onKeyDown,F=>{const D=F.target.closest("[data-radix-menu-content]")===F.currentTarget,O=F.ctrlKey||F.altKey||F.metaKey,z=F.key.length===1;D&&(F.key==="Tab"&&F.preventDefault(),!O&&z&&W(F.key));const G=C.current;if(F.target!==G||!H3.includes(F.key))return;F.preventDefault();const V=w().filter(X=>!X.disabled).map(X=>X.ref.current);_A.includes(F.key)&&V.reverse(),mM(V)}),onBlur:Vt(t.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout($.current),_.current="")}),onPointerMove:Vt(t.onPointerMove,Jd(F=>{const B=F.target,D=q.current!==F.clientX;if(F.currentTarget.contains(B)&&D){const O=F.clientX>q.current?"right":"left";M.current=O,q.current=F.clientX}}))})})})})})})});FA.displayName=ka;var rM="MenuGroup",xb=v.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t;return e.jsx(ps.div,{role:"group",...r,ref:s})});xb.displayName=rM;var aM="MenuLabel",BA=v.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t;return e.jsx(ps.div,{...r,ref:s})});BA.displayName=aM;var Cm="MenuItem",Uw="menu.itemSelect",hf=v.forwardRef((t,s)=>{const{disabled:n=!1,onSelect:r,...a}=t,l=v.useRef(null),c=Nu(Cm,t.__scopeMenu),d=fb(Cm,t.__scopeMenu),m=Ms(s,l),x=v.useRef(!1),f=()=>{const h=l.current;if(!n&&h){const g=new CustomEvent(Uw,{bubbles:!0,cancelable:!0});h.addEventListener(Uw,u=>r==null?void 0:r(u),{once:!0}),R2(h,g),g.defaultPrevented?x.current=!1:c.onClose()}};return e.jsx($A,{...a,ref:m,disabled:n,onClick:Vt(t.onClick,f),onPointerDown:h=>{var g;(g=t.onPointerDown)==null||g.call(t,h),x.current=!0},onPointerUp:Vt(t.onPointerUp,h=>{var g;x.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:Vt(t.onKeyDown,h=>{const g=d.searchRef.current!=="";n||g&&h.key===" "||pv.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});hf.displayName=Cm;var $A=v.forwardRef((t,s)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...l}=t,c=fb(Cm,n),d=OA(n),m=v.useRef(null),x=Ms(s,m),[f,h]=v.useState(!1),[g,u]=v.useState("");return v.useEffect(()=>{const j=m.current;j&&u((j.textContent??"").trim())},[l.children]),e.jsx(Xd.ItemSlot,{scope:n,disabled:r,textValue:a??g,children:e.jsx(wA,{asChild:!0,...d,focusable:!r,children:e.jsx(ps.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...l,ref:x,onPointerMove:Vt(t.onPointerMove,Jd(j=>{r?c.onItemLeave(j):(c.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Vt(t.onPointerLeave,Jd(j=>c.onItemLeave(j))),onFocus:Vt(t.onFocus,()=>h(!0)),onBlur:Vt(t.onBlur,()=>h(!1))})})})}),iM="MenuCheckboxItem",qA=v.forwardRef((t,s)=>{const{checked:n=!1,onCheckedChange:r,...a}=t;return e.jsx(WA,{scope:t.__scopeMenu,checked:n,children:e.jsx(hf,{role:"menuitemcheckbox","aria-checked":Am(n)?"mixed":n,...a,ref:s,"data-state":vb(n),onSelect:Vt(a.onSelect,()=>r==null?void 0:r(Am(n)?!0:!n),{checkForDefaultPrevented:!1})})})});qA.displayName=iM;var zA="MenuRadioGroup",[lM,oM]=Ho(zA,{value:void 0,onValueChange:()=>{}}),UA=v.forwardRef((t,s)=>{const{value:n,onValueChange:r,...a}=t,l=dr(r);return e.jsx(lM,{scope:t.__scopeMenu,value:n,onValueChange:l,children:e.jsx(xb,{...a,ref:s})})});UA.displayName=zA;var VA="MenuRadioItem",HA=v.forwardRef((t,s)=>{const{value:n,...r}=t,a=oM(VA,t.__scopeMenu),l=n===a.value;return e.jsx(WA,{scope:t.__scopeMenu,checked:l,children:e.jsx(hf,{role:"menuitemradio","aria-checked":l,...r,ref:s,"data-state":vb(l),onSelect:Vt(r.onSelect,()=>{var c;return(c=a.onValueChange)==null?void 0:c.call(a,n)},{checkForDefaultPrevented:!1})})})});HA.displayName=VA;var gb="MenuItemIndicator",[WA,cM]=Ho(gb,{checked:!1}),KA=v.forwardRef((t,s)=>{const{__scopeMenu:n,forceMount:r,...a}=t,l=cM(gb,n);return e.jsx(mr,{present:r||Am(l.checked)||l.checked===!0,children:e.jsx(ps.span,{...a,ref:s,"data-state":vb(l.checked)})})});KA.displayName=gb;var dM="MenuSeparator",GA=v.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t;return e.jsx(ps.div,{role:"separator","aria-orientation":"horizontal",...r,ref:s})});GA.displayName=dM;var uM="MenuArrow",YA=v.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t,a=uf(n);return e.jsx(lf,{...a,...r,ref:s})});YA.displayName=uM;var hM="MenuSub",[WH,ZA]=Ho(hM),Od="MenuSubTrigger",QA=v.forwardRef((t,s)=>{const n=Wo(Od,t.__scopeMenu),r=Nu(Od,t.__scopeMenu),a=ZA(Od,t.__scopeMenu),l=fb(Od,t.__scopeMenu),c=v.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=l,x={__scopeMenu:t.__scopeMenu},f=v.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return v.useEffect(()=>f,[f]),v.useEffect(()=>{const h=d.current;return()=>{window.clearTimeout(h),m(null)}},[d,m]),e.jsx(hb,{asChild:!0,...x,children:e.jsx($A,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":ek(n.open),...t,ref:Br(s,a.onTriggerChange),onClick:h=>{var g;(g=t.onClick)==null||g.call(t,h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Vt(t.onPointerMove,Jd(h=>{l.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!n.open&&!c.current&&(l.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Vt(t.onPointerLeave,Jd(h=>{var u,j;f();const g=(u=n.content)==null?void 0:u.getBoundingClientRect();if(g){const p=(j=n.content)==null?void 0:j.dataset.side,y=p==="right",N=y?-5:5,S=g[y?"left":"right"],A=g[y?"right":"left"];l.onPointerGraceIntentChange({area:[{x:h.clientX+N,y:h.clientY},{x:S,y:g.top},{x:A,y:g.top},{x:A,y:g.bottom},{x:S,y:g.bottom}],side:p}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(h),h.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Vt(t.onKeyDown,h=>{var u;const g=l.searchRef.current!=="";t.disabled||g&&h.key===" "||W3[r.dir].includes(h.key)&&(n.onOpenChange(!0),(u=n.content)==null||u.focus(),h.preventDefault())})})})});QA.displayName=Od;var XA="MenuSubContent",JA=v.forwardRef((t,s)=>{const n=IA(ka,t.__scopeMenu),{forceMount:r=n.forceMount,...a}=t,l=Wo(ka,t.__scopeMenu),c=Nu(ka,t.__scopeMenu),d=ZA(XA,t.__scopeMenu),m=v.useRef(null),x=Ms(s,m);return e.jsx(Xd.Provider,{scope:t.__scopeMenu,children:e.jsx(mr,{present:r||l.open,children:e.jsx(Xd.Slot,{scope:t.__scopeMenu,children:e.jsx(pb,{id:d.contentId,"aria-labelledby":d.triggerId,...a,ref:x,align:"start",side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;c.isUsingKeyboardRef.current&&((h=m.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Vt(t.onFocusOutside,f=>{f.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:Vt(t.onEscapeKeyDown,f=>{c.onClose(),f.preventDefault()}),onKeyDown:Vt(t.onKeyDown,f=>{var u;const h=f.currentTarget.contains(f.target),g=K3[c.dir].includes(f.key);h&&g&&(l.onOpenChange(!1),(u=d.trigger)==null||u.focus(),f.preventDefault())})})})})})});JA.displayName=XA;function ek(t){return t?"open":"closed"}function Am(t){return t==="indeterminate"}function vb(t){return Am(t)?"indeterminate":t?"checked":"unchecked"}function mM(t){const s=document.activeElement;for(const n of t)if(n===s||(n.focus(),document.activeElement!==s))return}function fM(t,s){return t.map((n,r)=>t[(s+r)%t.length])}function pM(t,s,n){const a=s.length>1&&Array.from(s).every(x=>x===s[0])?s[0]:s,l=n?t.indexOf(n):-1;let c=fM(t,Math.max(l,0));a.length===1&&(c=c.filter(x=>x!==n));const m=c.find(x=>x.toLowerCase().startsWith(a.toLowerCase()));return m!==n?m:void 0}function xM(t,s){const{x:n,y:r}=t;let a=!1;for(let l=0,c=s.length-1;lr!=g>r&&n<(h-x)*(r-f)/(g-f)+x&&(a=!a)}return a}function gM(t,s){if(!s)return!1;const n={x:t.clientX,y:t.clientY};return xM(n,s)}function Jd(t){return s=>s.pointerType==="mouse"?t(s):void 0}var vM=LA,bM=hb,yM=MA,jM=FA,NM=xb,wM=BA,SM=hf,CM=qA,AM=UA,kM=HA,RM=KA,EM=GA,DM=YA,TM=QA,_M=JA,mf="DropdownMenu",[PM]=ea(mf,[PA]),Ur=PA(),[OM,tk]=PM(mf),sk=t=>{const{__scopeDropdownMenu:s,children:n,dir:r,open:a,defaultOpen:l,onOpenChange:c,modal:d=!0}=t,m=Ur(s),x=v.useRef(null),[f,h]=bi({prop:a,defaultProp:l??!1,onChange:c,caller:mf});return e.jsx(OM,{scope:s,triggerId:hr(),triggerRef:x,contentId:hr(),open:f,onOpenChange:h,onOpenToggle:v.useCallback(()=>h(g=>!g),[h]),modal:d,children:e.jsx(vM,{...m,open:f,onOpenChange:h,dir:r,modal:d,children:n})})};sk.displayName=mf;var nk="DropdownMenuTrigger",rk=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=t,l=tk(nk,n),c=Ur(n);return e.jsx(bM,{asChild:!0,...c,children:e.jsx(ps.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:Br(s,l.triggerRef),onPointerDown:Vt(t.onPointerDown,d=>{!r&&d.button===0&&d.ctrlKey===!1&&(l.onOpenToggle(),l.open||d.preventDefault())}),onKeyDown:Vt(t.onKeyDown,d=>{r||(["Enter"," "].includes(d.key)&&l.onOpenToggle(),d.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});rk.displayName=nk;var LM="DropdownMenuPortal",ak=t=>{const{__scopeDropdownMenu:s,...n}=t,r=Ur(s);return e.jsx(yM,{...r,...n})};ak.displayName=LM;var ik="DropdownMenuContent",lk=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=tk(ik,n),l=Ur(n),c=v.useRef(!1);return e.jsx(jM,{id:a.contentId,"aria-labelledby":a.triggerId,...l,...r,ref:s,onCloseAutoFocus:Vt(t.onCloseAutoFocus,d=>{var m;c.current||(m=a.triggerRef.current)==null||m.focus(),c.current=!1,d.preventDefault()}),onInteractOutside:Vt(t.onInteractOutside,d=>{const m=d.detail.originalEvent,x=m.button===0&&m.ctrlKey===!0,f=m.button===2||x;(!a.modal||f)&&(c.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});lk.displayName=ik;var IM="DropdownMenuGroup",MM=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(NM,{...a,...r,ref:s})});MM.displayName=IM;var FM="DropdownMenuLabel",ok=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(wM,{...a,...r,ref:s})});ok.displayName=FM;var BM="DropdownMenuItem",ck=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(SM,{...a,...r,ref:s})});ck.displayName=BM;var $M="DropdownMenuCheckboxItem",dk=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(CM,{...a,...r,ref:s})});dk.displayName=$M;var qM="DropdownMenuRadioGroup",zM=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(AM,{...a,...r,ref:s})});zM.displayName=qM;var UM="DropdownMenuRadioItem",VM=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(kM,{...a,...r,ref:s})});VM.displayName=UM;var HM="DropdownMenuItemIndicator",uk=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(RM,{...a,...r,ref:s})});uk.displayName=HM;var WM="DropdownMenuSeparator",hk=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(EM,{...a,...r,ref:s})});hk.displayName=WM;var KM="DropdownMenuArrow",GM=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(DM,{...a,...r,ref:s})});GM.displayName=KM;var YM="DropdownMenuSubTrigger",ZM=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(TM,{...a,...r,ref:s})});ZM.displayName=YM;var QM="DropdownMenuSubContent",XM=v.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Ur(n);return e.jsx(_M,{...a,...r,ref:s,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});XM.displayName=QM;var JM=sk,eF=rk,tF=ak,sF=lk,nF=ok,rF=ck,aF=dk,iF=uk,lF=hk;function bb({...t}){return e.jsx(JM,{"data-slot":"dropdown-menu",...t})}function yb({...t}){return e.jsx(eF,{"data-slot":"dropdown-menu-trigger",...t})}function jb({className:t,sideOffset:s=4,...n}){return e.jsx(tF,{children:e.jsx(sF,{"data-slot":"dropdown-menu-content",sideOffset:s,className:_t("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...n})})}function mk({className:t,inset:s,variant:n="default",...r}){return e.jsx(rF,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":n,className:_t("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r})}function oF({className:t,children:s,checked:n,...r}){return e.jsxs(aF,{"data-slot":"dropdown-menu-checkbox-item",className:_t("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),checked:n,...r,children:[e.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:e.jsx(iF,{children:e.jsx(Bn,{className:"size-4"})})}),s]})}function cF({className:t,inset:s,...n}){return e.jsx(nF,{"data-slot":"dropdown-menu-label","data-inset":s,className:_t("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...n})}function dF({className:t,...s}){return e.jsx(lF,{"data-slot":"dropdown-menu-separator",className:_t("bg-border -mx-1 my-1 h-px",t),...s})}const uF=Kv("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Ae({className:t,variant:s,asChild:n=!1,...r}){const a=n?y2:"span";return e.jsx(a,{"data-slot":"badge",className:_t(uF({variant:s}),t),...r})}const Oh="/communication",Po={getNotifications:async(t,s)=>{let n=`${Oh}/notifications`;return t&&s&&(n+=`?page=${t}&limit=${s}`),(await ze.get(n)).data},markAsRead:async t=>(await ze.patch(`${Oh}/notifications/${t}/read`)).data,markAllAsRead:async()=>(await ze.patch(`${Oh}/notifications/read-all`)).data,updatePushSubscription:async t=>(await ze.post(`${Oh}/notifications/subscribe`,{subscription:t})).data},yi=Object.create(null);yi.open="0";yi.close="1";yi.ping="2";yi.pong="3";yi.message="4";yi.upgrade="5";yi.noop="6";const sm=Object.create(null);Object.keys(yi).forEach(t=>{sm[yi[t]]=t});const xv={type:"error",data:"parser error"},fk=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",pk=typeof ArrayBuffer=="function",xk=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Nb=({type:t,data:s},n,r)=>fk&&s instanceof Blob?n?r(s):Vw(s,r):pk&&(s instanceof ArrayBuffer||xk(s))?n?r(s):Vw(new Blob([s]),r):r(yi[t]+(s||"")),Vw=(t,s)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];s("b"+(r||""))},n.readAsDataURL(t)};function Hw(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let zx;function hF(t,s){if(fk&&t.data instanceof Blob)return t.data.arrayBuffer().then(Hw).then(s);if(pk&&(t.data instanceof ArrayBuffer||xk(t.data)))return s(Hw(t.data));Nb(t,!1,n=>{zx||(zx=new TextEncoder),s(zx.encode(n))})}const Ww="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ld=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t{let s=t.length*.75,n=t.length,r,a=0,l,c,d,m;t[t.length-1]==="="&&(s--,t[t.length-2]==="="&&s--);const x=new ArrayBuffer(s),f=new Uint8Array(x);for(r=0;r>4,f[a++]=(c&15)<<4|d>>2,f[a++]=(d&3)<<6|m&63;return x},fF=typeof ArrayBuffer=="function",wb=(t,s)=>{if(typeof t!="string")return{type:"message",data:gk(t,s)};const n=t.charAt(0);return n==="b"?{type:"message",data:pF(t.substring(1),s)}:sm[n]?t.length>1?{type:sm[n],data:t.substring(1)}:{type:sm[n]}:xv},pF=(t,s)=>{if(fF){const n=mF(t);return gk(n,s)}else return{base64:!0,data:t}},gk=(t,s)=>{switch(s){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},vk="",xF=(t,s)=>{const n=t.length,r=new Array(n);let a=0;t.forEach((l,c)=>{Nb(l,!1,d=>{r[c]=d,++a===n&&s(r.join(vk))})})},gF=(t,s)=>{const n=t.split(vk),r=[];for(let a=0;a{const r=n.length;let a;if(r<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,r);else if(r<65536){a=new Uint8Array(3);const l=new DataView(a.buffer);l.setUint8(0,126),l.setUint16(1,r)}else{a=new Uint8Array(9);const l=new DataView(a.buffer);l.setUint8(0,127),l.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(a[0]|=128),s.enqueue(a),s.enqueue(n)})}})}let Ux;function Lh(t){return t.reduce((s,n)=>s+n.length,0)}function Ih(t,s){if(t[0].length===s)return t.shift();const n=new Uint8Array(s);let r=0;for(let a=0;aMath.pow(2,21)-1){d.enqueue(xv);break}a=f*Math.pow(2,32)+x.getUint32(4),r=3}else{if(Lh(n)t){d.enqueue(xv);break}}}})}const bk=4;function Gn(t){if(t)return yF(t)}function yF(t){for(var s in Gn.prototype)t[s]=Gn.prototype[s];return t}Gn.prototype.on=Gn.prototype.addEventListener=function(t,s){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(s),this};Gn.prototype.once=function(t,s){function n(){this.off(t,n),s.apply(this,arguments)}return n.fn=s,this.on(t,n),this};Gn.prototype.off=Gn.prototype.removeListener=Gn.prototype.removeAllListeners=Gn.prototype.removeEventListener=function(t,s){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,a=0;aPromise.resolve().then(s):(s,n)=>n(s,0),Aa=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),jF="arraybuffer";function yk(t,...s){return s.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const NF=Aa.setTimeout,wF=Aa.clearTimeout;function pf(t,s){s.useNativeTimers?(t.setTimeoutFn=NF.bind(Aa),t.clearTimeoutFn=wF.bind(Aa)):(t.setTimeoutFn=Aa.setTimeout.bind(Aa),t.clearTimeoutFn=Aa.clearTimeout.bind(Aa))}const SF=1.33;function CF(t){return typeof t=="string"?AF(t):Math.ceil((t.byteLength||t.size)*SF)}function AF(t){let s=0,n=0;for(let r=0,a=t.length;r=57344?n+=3:(r++,n+=4);return n}function jk(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function kF(t){let s="";for(let n in t)t.hasOwnProperty(n)&&(s.length&&(s+="&"),s+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return s}function RF(t){let s={},n=t.split("&");for(let r=0,a=n.length;r{this.readyState="paused",s()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(s){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};gF(s,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const s=()=>{this.write([{type:"close"}])};this.readyState==="open"?s():this.once("open",s)}write(s){this.writable=!1,xF(s,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const s=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=jk()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(s,n)}}let Nk=!1;try{Nk=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const TF=Nk;function _F(){}class PF extends DF{constructor(s){if(super(s),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&s.hostname!==location.hostname||r!==s.port}}doWrite(s,n){const r=this.request({method:"POST",data:s});r.on("success",n),r.on("error",(a,l)=>{this.onError("xhr post error",a,l)})}doPoll(){const s=this.request();s.on("data",this.onData.bind(this)),s.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=s}}class vi extends Gn{constructor(s,n,r){super(),this.createRequest=s,pf(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var s;const n=yk(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&r.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(s=this._opts.cookieJar)===null||s===void 0||s.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var a;r.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=vi.requestsCount++,vi.requests[this._index]=this)}_onError(s){this.emitReserved("error",s,this._xhr),this._cleanup(!0)}_cleanup(s){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=_F,s)try{this._xhr.abort()}catch{}typeof document<"u"&&delete vi.requests[this._index],this._xhr=null}}_onLoad(){const s=this._xhr.responseText;s!==null&&(this.emitReserved("data",s),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}vi.requestsCount=0;vi.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Kw);else if(typeof addEventListener=="function"){const t="onpagehide"in Aa?"pagehide":"unload";addEventListener(t,Kw,!1)}}function Kw(){for(let t in vi.requests)vi.requests.hasOwnProperty(t)&&vi.requests[t].abort()}const OF=(function(){const t=wk({xdomain:!1});return t&&t.responseType!==null})();class LF extends PF{constructor(s){super(s);const n=s&&s.forceBase64;this.supportsBinary=OF&&!n}request(s={}){return Object.assign(s,{xd:this.xd},this.opts),new vi(wk,this.uri(),s)}}function wk(t){const s=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!s||TF))return new XMLHttpRequest}catch{}if(!s)try{return new Aa[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Sk=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class IF extends Sb{get name(){return"websocket"}doOpen(){const s=this.uri(),n=this.opts.protocols,r=Sk?{}:yk(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(s,n,r)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=s=>this.onClose({description:"websocket connection closed",context:s}),this.ws.onmessage=s=>this.onData(s.data),this.ws.onerror=s=>this.onError("websocket error",s)}write(s){this.writable=!1;for(let n=0;n{try{this.doWrite(r,l)}catch{}a&&ff(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const s=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=jk()),this.supportsBinary||(n.b64=1),this.createUri(s,n)}}const Vx=Aa.WebSocket||Aa.MozWebSocket;class MF extends IF{createSocket(s,n,r){return Sk?new Vx(s,n,r):n?new Vx(s,n):new Vx(s)}doWrite(s,n){this.ws.send(n)}}class FF extends Sb{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(s){return this.emitReserved("error",s)}this._transport.closed.then(()=>{this.onClose()}).catch(s=>{this.onError("webtransport error",s)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(s=>{const n=bF(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=s.readable.pipeThrough(n).getReader(),a=vF();a.readable.pipeTo(s.writable),this._writer=a.writable.getWriter();const l=()=>{r.read().then(({done:d,value:m})=>{d||(this.onPacket(m),l())}).catch(d=>{})};l();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this._writer.write(c).then(()=>this.onOpen())})})}write(s){this.writable=!1;for(let n=0;n{a&&ff(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var s;(s=this._transport)===null||s===void 0||s.close()}}const BF={websocket:MF,webtransport:FF,polling:LF},$F=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,qF=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function gv(t){if(t.length>8e3)throw"URI too long";const s=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let a=$F.exec(t||""),l={},c=14;for(;c--;)l[qF[c]]=a[c]||"";return n!=-1&&r!=-1&&(l.source=s,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),l.pathNames=zF(l,l.path),l.queryKey=UF(l,l.query),l}function zF(t,s){const n=/\/{2,9}/g,r=s.replace(n,"/").split("/");return(s.slice(0,1)=="/"||s.length===0)&&r.splice(0,1),s.slice(-1)=="/"&&r.splice(r.length-1,1),r}function UF(t,s){const n={};return s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,a,l){a&&(n[a]=l)}),n}const vv=typeof addEventListener=="function"&&typeof removeEventListener=="function",nm=[];vv&&addEventListener("offline",()=>{nm.forEach(t=>t())},!1);class Ol extends Gn{constructor(s,n){if(super(),this.binaryType=jF,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,s&&typeof s=="object"&&(n=s,s=null),s){const r=gv(s);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=gv(n.host).host);pf(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const a=r.prototype.name;this.transports.push(a),this._transportsByName[a]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=RF(this.opts.query)),vv&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},nm.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(s){const n=Object.assign({},this.opts.query);n.EIO=bk,n.transport=s,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[s]);return new this._transportsByName[s](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const s=this.opts.rememberUpgrade&&Ol.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(s);n.open(),this.setTransport(n)}setTransport(s){this.transport&&this.transport.removeAllListeners(),this.transport=s,s.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Ol.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",s),this.emitReserved("heartbeat"),s.type){case"open":this.onHandshake(JSON.parse(s.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=s.data,this._onError(n);break;case"message":this.emitReserved("data",s.data),this.emitReserved("message",s.data);break}}onHandshake(s){this.emitReserved("handshake",s),this.id=s.sid,this.transport.query.sid=s.sid,this._pingInterval=s.pingInterval,this._pingTimeout=s.pingTimeout,this._maxPayload=s.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const s=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+s,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},s),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const s=this._getWritablePackets();this.transport.send(s),this._prevBufferLen=s.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const s=Date.now()>this._pingTimeoutTime;return s&&(this._pingTimeoutTime=0,ff(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),s}write(s,n,r){return this._sendPacket("message",s,n,r),this}send(s,n,r){return this._sendPacket("message",s,n,r),this}_sendPacket(s,n,r,a){if(typeof n=="function"&&(a=n,n=void 0),typeof r=="function"&&(a=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const l={type:s,data:n,options:r};this.emitReserved("packetCreate",l),this.writeBuffer.push(l),a&&this.once("flush",a),this.flush()}close(){const s=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),s()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():s()}):this.upgrading?r():s()),this}_onError(s){if(Ol.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",s),this._onClose("transport error",s)}_onClose(s,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),vv&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=nm.indexOf(this._offlineEventListener);r!==-1&&nm.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",s,n),this.writeBuffer=[],this._prevBufferLen=0}}}Ol.protocol=bk;class VF extends Ol{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let s=0;s{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Ol.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(f(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const g=new Error("probe error");g.transport=n.name,this.emitReserved("upgradeError",g)}}))};function l(){r||(r=!0,f(),n.close(),n=null)}const c=h=>{const g=new Error("probe error: "+h);g.transport=n.name,l(),this.emitReserved("upgradeError",g)};function d(){c("transport closed")}function m(){c("socket closed")}function x(h){n&&h.name!==n.name&&l()}const f=()=>{n.removeListener("open",a),n.removeListener("error",c),n.removeListener("close",d),this.off("close",m),this.off("upgrading",x)};n.once("open",a),n.once("error",c),n.once("close",d),this.once("close",m),this.once("upgrading",x),this._upgrades.indexOf("webtransport")!==-1&&s!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(s){this._upgrades=this._filterUpgrades(s.upgrades),super.onHandshake(s)}_filterUpgrades(s){const n=[];for(let r=0;rBF[a]).filter(a=>!!a)),super(s,r)}};function WF(t,s="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=gv(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const l=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+l+":"+r.port+s,r.href=r.protocol+"://"+l+(n&&n.port===r.port?"":":"+r.port),r}const KF=typeof ArrayBuffer=="function",GF=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Ck=Object.prototype.toString,YF=typeof Blob=="function"||typeof Blob<"u"&&Ck.call(Blob)==="[object BlobConstructor]",ZF=typeof File=="function"||typeof File<"u"&&Ck.call(File)==="[object FileConstructor]";function Cb(t){return KF&&(t instanceof ArrayBuffer||GF(t))||YF&&t instanceof Blob||ZF&&t instanceof File}function rm(t,s){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n=0&&t.numthis.opts.maxAttachments)throw new Error("too many attachments");r.attachments=d}if(s.charAt(n+1)==="/"){const l=n+1;for(;++n&&!(s.charAt(n)===","||n===s.length););r.nsp=s.substring(l,n)}else r.nsp="/";const a=s.charAt(n+1);if(a!==""&&Number(a)==a){const l=n+1;for(;++n;){const c=s.charAt(n);if(c==null||Number(c)!=c){--n;break}if(n===s.length)break}r.id=Number(s.substring(l,n+1))}if(s.charAt(++n)){const l=this.tryParse(s.substr(n));if(Ab.isPayloadValid(r.type,l))r.data=l;else throw new Error("invalid payload")}return r}tryParse(s){try{return JSON.parse(s,this.opts.reviver)}catch{return!1}}static isPayloadValid(s,n){switch(s){case Zs.CONNECT:return Gw(n);case Zs.DISCONNECT:return n===void 0;case Zs.CONNECT_ERROR:return typeof n=="string"||Gw(n);case Zs.EVENT:case Zs.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&JF.indexOf(n[0])===-1);case Zs.ACK:case Zs.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class t8{constructor(s){this.packet=s,this.buffers=[],this.reconPack=s}takeBinaryData(s){if(this.buffers.push(s),this.buffers.length===this.reconPack.attachments){const n=XF(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const s8=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function Gw(t){return Object.prototype.toString.call(t)==="[object Object]"}const n8=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ab,Encoder:e8,get PacketType(){return Zs}},Symbol.toStringTag,{value:"Module"}));function Ka(t,s,n){return t.on(s,n),function(){t.off(s,n)}}const r8=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ak extends Gn{constructor(s,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=s,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const s=this.io;this.subs=[Ka(s,"open",this.onopen.bind(this)),Ka(s,"packet",this.onpacket.bind(this)),Ka(s,"error",this.onerror.bind(this)),Ka(s,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...s){return s.unshift("message"),this.emit.apply(this,s),this}emit(s,...n){var r,a,l;if(r8.hasOwnProperty(s))throw new Error('"'+s.toString()+'" is a reserved event name');if(n.unshift(s),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const c={type:Zs.EVENT,data:n};if(c.options={},c.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const f=this.ids++,h=n.pop();this._registerAckCallback(f,h),c.id=f}const d=(a=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||a===void 0?void 0:a.writable,m=this.connected&&!(!((l=this.io.engine)===null||l===void 0)&&l._hasPingExpired());return this.flags.volatile&&!d||(m?(this.notifyOutgoingListeners(c),this.packet(c)):this.sendBuffer.push(c)),this.flags={},this}_registerAckCallback(s,n){var r;const a=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(a===void 0){this.acks[s]=n;return}const l=this.io.setTimeoutFn(()=>{delete this.acks[s];for(let d=0;d{this.io.clearTimeoutFn(l),n.apply(this,d)};c.withError=!0,this.acks[s]=c}emitWithAck(s,...n){return new Promise((r,a)=>{const l=(c,d)=>c?a(c):r(d);l.withError=!0,n.push(l),this.emit(s,...n)})}_addToQueue(s){let n;typeof s[s.length-1]=="function"&&(n=s.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:s,flags:Object.assign({fromQueue:!0},this.flags)};s.push((a,...l)=>(this._queue[0],a!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...l)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(s=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!s||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(s){s.nsp=this.nsp,this.io._packet(s)}onopen(){typeof this.auth=="function"?this.auth(s=>{this._sendConnectPacket(s)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(s){this.packet({type:Zs.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},s):s})}onerror(s){this.connected||this.emitReserved("connect_error",s)}onclose(s,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",s,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(s=>{if(!this.sendBuffer.some(r=>String(r.id)===s)){const r=this.acks[s];delete this.acks[s],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(s){if(s.nsp===this.nsp)switch(s.type){case Zs.CONNECT:s.data&&s.data.sid?this.onconnect(s.data.sid,s.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Zs.EVENT:case Zs.BINARY_EVENT:this.onevent(s);break;case Zs.ACK:case Zs.BINARY_ACK:this.onack(s);break;case Zs.DISCONNECT:this.ondisconnect();break;case Zs.CONNECT_ERROR:this.destroy();const r=new Error(s.data.message);r.data=s.data.data,this.emitReserved("connect_error",r);break}}onevent(s){const n=s.data||[];s.id!=null&&n.push(this.ack(s.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(s){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,s)}super.emit.apply(this,s),this._pid&&s.length&&typeof s[s.length-1]=="string"&&(this._lastOffset=s[s.length-1])}ack(s){const n=this;let r=!1;return function(...a){r||(r=!0,n.packet({type:Zs.ACK,id:s,data:a}))}}onack(s){const n=this.acks[s.id];typeof n=="function"&&(delete this.acks[s.id],n.withError&&s.data.unshift(null),n.apply(this,s.data))}onconnect(s,n){this.id=s,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(s=>this.emitEvent(s)),this.receiveBuffer=[],this.sendBuffer.forEach(s=>{this.notifyOutgoingListeners(s),this.packet(s)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(s=>s()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Zs.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(s){return this.flags.compress=s,this}get volatile(){return this.flags.volatile=!0,this}timeout(s){return this.flags.timeout=s,this}onAny(s){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(s),this}prependAny(s){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(s),this}offAny(s){if(!this._anyListeners)return this;if(s){const n=this._anyListeners;for(let r=0;r0&&t.jitter<=1?t.jitter:0,this.attempts=0}Wc.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var s=Math.random(),n=Math.floor(s*this.jitter*t);t=(Math.floor(s*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0};Wc.prototype.reset=function(){this.attempts=0};Wc.prototype.setMin=function(t){this.ms=t};Wc.prototype.setMax=function(t){this.max=t};Wc.prototype.setJitter=function(t){this.jitter=t};class jv extends Gn{constructor(s,n){var r;super(),this.nsps={},this.subs=[],s&&typeof s=="object"&&(n=s,s=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,pf(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Wc({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=s;const a=n.parser||n8;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(s){return arguments.length?(this._reconnection=!!s,s||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(s){return s===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=s,this)}reconnectionDelay(s){var n;return s===void 0?this._reconnectionDelay:(this._reconnectionDelay=s,(n=this.backoff)===null||n===void 0||n.setMin(s),this)}randomizationFactor(s){var n;return s===void 0?this._randomizationFactor:(this._randomizationFactor=s,(n=this.backoff)===null||n===void 0||n.setJitter(s),this)}reconnectionDelayMax(s){var n;return s===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=s,(n=this.backoff)===null||n===void 0||n.setMax(s),this)}timeout(s){return arguments.length?(this._timeout=s,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(s){if(~this._readyState.indexOf("open"))return this;this.engine=new HF(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const a=Ka(n,"open",function(){r.onopen(),s&&s()}),l=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),s?s(d):this.maybeReconnectOnOpen()},c=Ka(n,"error",l);if(this._timeout!==!1){const d=this._timeout,m=this.setTimeoutFn(()=>{a(),l(new Error("timeout")),n.close()},d);this.opts.autoUnref&&m.unref(),this.subs.push(()=>{this.clearTimeoutFn(m)})}return this.subs.push(a),this.subs.push(c),this}connect(s){return this.open(s)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const s=this.engine;this.subs.push(Ka(s,"ping",this.onping.bind(this)),Ka(s,"data",this.ondata.bind(this)),Ka(s,"error",this.onerror.bind(this)),Ka(s,"close",this.onclose.bind(this)),Ka(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(s){try{this.decoder.add(s)}catch(n){this.onclose("parse error",n)}}ondecoded(s){ff(()=>{this.emitReserved("packet",s)},this.setTimeoutFn)}onerror(s){this.emitReserved("error",s)}socket(s,n){let r=this.nsps[s];return r?this._autoConnect&&!r.active&&r.connect():(r=new Ak(this,s,n),this.nsps[s]=r),r}_destroy(s){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(s){const n=this.encoder.encode(s);for(let r=0;rs()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(s,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",s,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const s=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{s.skipReconnect||(this.emitReserved("reconnect_attempt",s.backoff.attempts),!s.skipReconnect&&s.open(a=>{a?(s._reconnecting=!1,s.reconnect(),this.emitReserved("reconnect_error",a)):s.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const s=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",s)}}const Nd={};function am(t,s){typeof t=="object"&&(s=t,t=void 0),s=s||{};const n=WF(t,s.path||"/socket.io"),r=n.source,a=n.id,l=n.path,c=Nd[a]&&l in Nd[a].nsps,d=s.forceNew||s["force new connection"]||s.multiplex===!1||c;let m;return d?m=new jv(r,s):(Nd[a]||(Nd[a]=new jv(r,s)),m=Nd[a]),n.query&&!s.query&&(s.query=n.queryKey),m.socket(n.path,s)}Object.assign(am,{Manager:jv,Socket:Ak,io:am,connect:am});const kk=v.createContext({socket:null,isConnected:!1}),Rk=()=>v.useContext(kk),a8=({children:t})=>{const[s,n]=v.useState(null),[r,a]=v.useState(!1),{user:l}=Nn(c=>c.auth);return v.useEffect(()=>{let c="https://dealeronboarding-uat.royalenfield.com/api";c.endsWith("/api")&&(c=c.replace(/\/api$/,""));const d=am(c,{withCredentials:!0});return d.on("connect",()=>{console.log("Socket connected:",d.id),a(!0)}),d.on("disconnect",()=>{console.log("Socket disconnected"),a(!1)}),n(d),()=>{d.close()}},[]),v.useEffect(()=>{if(s&&r&&(l!=null&&l.id))return s.emit("join_room",`user_${l.id}`),console.log(`Joined private notification room: user_${l.id}`),()=>{s.emit("leave_room",`user_${l.id}`)}},[s,r,l==null?void 0:l.id]),e.jsx(kk.Provider,{value:{socket:s,isConnected:r},children:t})};function fn(t){const s=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&s==="[object Date]"?new t.constructor(+t):typeof t=="number"||s==="[object Number]"||typeof t=="string"||s==="[object String]"?new Date(t):new Date(NaN)}function ql(t,s){return t instanceof Date?new t.constructor(s):new Date(s)}const Ek=6048e5,i8=864e5,Mh=43200,Yw=1440;let l8={};function wu(){return l8}function eu(t,s){var d,m,x,f;const n=wu(),r=(s==null?void 0:s.weekStartsOn)??((m=(d=s==null?void 0:s.locale)==null?void 0:d.options)==null?void 0:m.weekStartsOn)??n.weekStartsOn??((f=(x=n.locale)==null?void 0:x.options)==null?void 0:f.weekStartsOn)??0,a=fn(t),l=a.getDay(),c=(l=a.getTime()?n+1:s.getTime()>=c.getTime()?n:n-1}function Zw(t){const s=fn(t);return s.setHours(0,0,0,0),s}function Rm(t){const s=fn(t),n=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()));return n.setUTCFullYear(s.getFullYear()),+t-+n}function o8(t,s){const n=Zw(t),r=Zw(s),a=+n-Rm(n),l=+r-Rm(r);return Math.round((a-l)/i8)}function c8(t){const s=Dk(t),n=ql(t,0);return n.setFullYear(s,0,4),n.setHours(0,0,0,0),km(n)}function im(t,s){const n=fn(t),r=fn(s),a=n.getTime()-r.getTime();return a<0?-1:a>0?1:a}function d8(t){return ql(t,Date.now())}function u8(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function h8(t){if(!u8(t)&&typeof t!="number")return!1;const s=fn(t);return!isNaN(Number(s))}function m8(t,s){const n=fn(t),r=fn(s),a=n.getFullYear()-r.getFullYear(),l=n.getMonth()-r.getMonth();return a*12+l}function f8(t){return s=>{const r=(t?Math[t]:Math.trunc)(s);return r===0?0:r}}function p8(t,s){return+fn(t)-+fn(s)}function x8(t){const s=fn(t);return s.setHours(23,59,59,999),s}function g8(t){const s=fn(t),n=s.getMonth();return s.setFullYear(s.getFullYear(),n+1,0),s.setHours(23,59,59,999),s}function v8(t){const s=fn(t);return+x8(s)==+g8(s)}function b8(t,s){const n=fn(t),r=fn(s),a=im(n,r),l=Math.abs(m8(n,r));let c;if(l<1)c=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*l);let d=im(n,r)===-a;v8(fn(t))&&l===1&&im(t,r)===1&&(d=!1),c=a*(l-Number(d))}return c===0?0:c}function y8(t,s,n){const r=p8(t,s)/1e3;return f8(n==null?void 0:n.roundingMethod)(r)}function j8(t){const s=fn(t),n=ql(t,0);return n.setFullYear(s.getFullYear(),0,1),n.setHours(0,0,0,0),n}const N8={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},w8=(t,s,n)=>{let r;const a=N8[t];return typeof a=="string"?r=a:s===1?r=a.one:r=a.other.replace("{{count}}",s.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Hx(t){return(s={})=>{const n=s.width?String(s.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const S8={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},C8={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},A8={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},k8={date:Hx({formats:S8,defaultWidth:"full"}),time:Hx({formats:C8,defaultWidth:"full"}),dateTime:Hx({formats:A8,defaultWidth:"full"})},R8={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},E8=(t,s,n,r)=>R8[t];function wd(t){return(s,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&t.formattingValues){const c=t.defaultFormattingWidth||t.defaultWidth,d=n!=null&&n.width?String(n.width):c;a=t.formattingValues[d]||t.formattingValues[c]}else{const c=t.defaultWidth,d=n!=null&&n.width?String(n.width):t.defaultWidth;a=t.values[d]||t.values[c]}const l=t.argumentCallback?t.argumentCallback(s):s;return a[l]}}const D8={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},T8={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},_8={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},P8={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},O8={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},L8={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},I8=(t,s)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},M8={ordinalNumber:I8,era:wd({values:D8,defaultWidth:"wide"}),quarter:wd({values:T8,defaultWidth:"wide",argumentCallback:t=>t-1}),month:wd({values:_8,defaultWidth:"wide"}),day:wd({values:P8,defaultWidth:"wide"}),dayPeriod:wd({values:O8,defaultWidth:"wide",formattingValues:L8,defaultFormattingWidth:"wide"})};function Sd(t){return(s,n={})=>{const r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],l=s.match(a);if(!l)return null;const c=l[0],d=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],m=Array.isArray(d)?B8(d,h=>h.test(c)):F8(d,h=>h.test(c));let x;x=t.valueCallback?t.valueCallback(m):m,x=n.valueCallback?n.valueCallback(x):x;const f=s.slice(c.length);return{value:x,rest:f}}}function F8(t,s){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&s(t[n]))return n}function B8(t,s){for(let n=0;n{const r=s.match(t.matchPattern);if(!r)return null;const a=r[0],l=s.match(t.parsePattern);if(!l)return null;let c=t.valueCallback?t.valueCallback(l[0]):l[0];c=n.valueCallback?n.valueCallback(c):c;const d=s.slice(a.length);return{value:c,rest:d}}}const q8=/^(\d+)(th|st|nd|rd)?/i,z8=/\d+/i,U8={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},V8={any:[/^b/i,/^(a|c)/i]},H8={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},W8={any:[/1/i,/2/i,/3/i,/4/i]},K8={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},G8={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Y8={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Z8={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Q8={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},X8={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},J8={ordinalNumber:$8({matchPattern:q8,parsePattern:z8,valueCallback:t=>parseInt(t,10)}),era:Sd({matchPatterns:U8,defaultMatchWidth:"wide",parsePatterns:V8,defaultParseWidth:"any"}),quarter:Sd({matchPatterns:H8,defaultMatchWidth:"wide",parsePatterns:W8,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Sd({matchPatterns:K8,defaultMatchWidth:"wide",parsePatterns:G8,defaultParseWidth:"any"}),day:Sd({matchPatterns:Y8,defaultMatchWidth:"wide",parsePatterns:Z8,defaultParseWidth:"any"}),dayPeriod:Sd({matchPatterns:Q8,defaultMatchWidth:"any",parsePatterns:X8,defaultParseWidth:"any"})},Tk={code:"en-US",formatDistance:w8,formatLong:k8,formatRelative:E8,localize:M8,match:J8,options:{weekStartsOn:0,firstWeekContainsDate:1}};function e9(t){const s=fn(t);return o8(s,j8(s))+1}function t9(t){const s=fn(t),n=+km(s)-+c8(s);return Math.round(n/Ek)+1}function _k(t,s){var f,h,g,u;const n=fn(t),r=n.getFullYear(),a=wu(),l=(s==null?void 0:s.firstWeekContainsDate)??((h=(f=s==null?void 0:s.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??a.firstWeekContainsDate??((u=(g=a.locale)==null?void 0:g.options)==null?void 0:u.firstWeekContainsDate)??1,c=ql(t,0);c.setFullYear(r+1,0,l),c.setHours(0,0,0,0);const d=eu(c,s),m=ql(t,0);m.setFullYear(r,0,l),m.setHours(0,0,0,0);const x=eu(m,s);return n.getTime()>=d.getTime()?r+1:n.getTime()>=x.getTime()?r:r-1}function s9(t,s){var d,m,x,f;const n=wu(),r=(s==null?void 0:s.firstWeekContainsDate)??((m=(d=s==null?void 0:s.locale)==null?void 0:d.options)==null?void 0:m.firstWeekContainsDate)??n.firstWeekContainsDate??((f=(x=n.locale)==null?void 0:x.options)==null?void 0:f.firstWeekContainsDate)??1,a=_k(t,s),l=ql(t,0);return l.setFullYear(a,0,r),l.setHours(0,0,0,0),eu(l,s)}function n9(t,s){const n=fn(t),r=+eu(n,s)-+s9(n,s);return Math.round(r/Ek)+1}function un(t,s){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(s,"0");return n+r}const Rl={y(t,s){const n=t.getFullYear(),r=n>0?n:1-n;return un(s==="yy"?r%100:r,s.length)},M(t,s){const n=t.getMonth();return s==="M"?String(n+1):un(n+1,2)},d(t,s){return un(t.getDate(),s.length)},a(t,s){const n=t.getHours()/12>=1?"pm":"am";switch(s){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,s){return un(t.getHours()%12||12,s.length)},H(t,s){return un(t.getHours(),s.length)},m(t,s){return un(t.getMinutes(),s.length)},s(t,s){return un(t.getSeconds(),s.length)},S(t,s){const n=s.length,r=t.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return un(a,s.length)}},vc={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Qw={G:function(t,s,n){const r=t.getFullYear()>0?1:0;switch(s){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,s,n){if(s==="yo"){const r=t.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return Rl.y(t,s)},Y:function(t,s,n,r){const a=_k(t,r),l=a>0?a:1-a;if(s==="YY"){const c=l%100;return un(c,2)}return s==="Yo"?n.ordinalNumber(l,{unit:"year"}):un(l,s.length)},R:function(t,s){const n=Dk(t);return un(n,s.length)},u:function(t,s){const n=t.getFullYear();return un(n,s.length)},Q:function(t,s,n){const r=Math.ceil((t.getMonth()+1)/3);switch(s){case"Q":return String(r);case"QQ":return un(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,s,n){const r=Math.ceil((t.getMonth()+1)/3);switch(s){case"q":return String(r);case"qq":return un(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,s,n){const r=t.getMonth();switch(s){case"M":case"MM":return Rl.M(t,s);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,s,n){const r=t.getMonth();switch(s){case"L":return String(r+1);case"LL":return un(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,s,n,r){const a=n9(t,r);return s==="wo"?n.ordinalNumber(a,{unit:"week"}):un(a,s.length)},I:function(t,s,n){const r=t9(t);return s==="Io"?n.ordinalNumber(r,{unit:"week"}):un(r,s.length)},d:function(t,s,n){return s==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Rl.d(t,s)},D:function(t,s,n){const r=e9(t);return s==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):un(r,s.length)},E:function(t,s,n){const r=t.getDay();switch(s){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,s,n,r){const a=t.getDay(),l=(a-r.weekStartsOn+8)%7||7;switch(s){case"e":return String(l);case"ee":return un(l,2);case"eo":return n.ordinalNumber(l,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,s,n,r){const a=t.getDay(),l=(a-r.weekStartsOn+8)%7||7;switch(s){case"c":return String(l);case"cc":return un(l,s.length);case"co":return n.ordinalNumber(l,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,s,n){const r=t.getDay(),a=r===0?7:r;switch(s){case"i":return String(a);case"ii":return un(a,s.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,s,n){const a=t.getHours()/12>=1?"pm":"am";switch(s){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,s,n){const r=t.getHours();let a;switch(r===12?a=vc.noon:r===0?a=vc.midnight:a=r/12>=1?"pm":"am",s){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,s,n){const r=t.getHours();let a;switch(r>=17?a=vc.evening:r>=12?a=vc.afternoon:r>=4?a=vc.morning:a=vc.night,s){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,s,n){if(s==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Rl.h(t,s)},H:function(t,s,n){return s==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Rl.H(t,s)},K:function(t,s,n){const r=t.getHours()%12;return s==="Ko"?n.ordinalNumber(r,{unit:"hour"}):un(r,s.length)},k:function(t,s,n){let r=t.getHours();return r===0&&(r=24),s==="ko"?n.ordinalNumber(r,{unit:"hour"}):un(r,s.length)},m:function(t,s,n){return s==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Rl.m(t,s)},s:function(t,s,n){return s==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Rl.s(t,s)},S:function(t,s){return Rl.S(t,s)},X:function(t,s,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(s){case"X":return Jw(r);case"XXXX":case"XX":return ko(r);case"XXXXX":case"XXX":default:return ko(r,":")}},x:function(t,s,n){const r=t.getTimezoneOffset();switch(s){case"x":return Jw(r);case"xxxx":case"xx":return ko(r);case"xxxxx":case"xxx":default:return ko(r,":")}},O:function(t,s,n){const r=t.getTimezoneOffset();switch(s){case"O":case"OO":case"OOO":return"GMT"+Xw(r,":");case"OOOO":default:return"GMT"+ko(r,":")}},z:function(t,s,n){const r=t.getTimezoneOffset();switch(s){case"z":case"zz":case"zzz":return"GMT"+Xw(r,":");case"zzzz":default:return"GMT"+ko(r,":")}},t:function(t,s,n){const r=Math.trunc(t.getTime()/1e3);return un(r,s.length)},T:function(t,s,n){const r=t.getTime();return un(r,s.length)}};function Xw(t,s=""){const n=t>0?"-":"+",r=Math.abs(t),a=Math.trunc(r/60),l=r%60;return l===0?n+String(a):n+String(a)+s+un(l,2)}function Jw(t,s){return t%60===0?(t>0?"-":"+")+un(Math.abs(t)/60,2):ko(t,s)}function ko(t,s=""){const n=t>0?"-":"+",r=Math.abs(t),a=un(Math.trunc(r/60),2),l=un(r%60,2);return n+a+s+l}const e1=(t,s)=>{switch(t){case"P":return s.date({width:"short"});case"PP":return s.date({width:"medium"});case"PPP":return s.date({width:"long"});case"PPPP":default:return s.date({width:"full"})}},Pk=(t,s)=>{switch(t){case"p":return s.time({width:"short"});case"pp":return s.time({width:"medium"});case"ppp":return s.time({width:"long"});case"pppp":default:return s.time({width:"full"})}},r9=(t,s)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return e1(t,s);let l;switch(r){case"P":l=s.dateTime({width:"short"});break;case"PP":l=s.dateTime({width:"medium"});break;case"PPP":l=s.dateTime({width:"long"});break;case"PPPP":default:l=s.dateTime({width:"full"});break}return l.replace("{{date}}",e1(r,s)).replace("{{time}}",Pk(a,s))},a9={p:Pk,P:r9},i9=/^D+$/,l9=/^Y+$/,o9=["D","DD","YY","YYYY"];function c9(t){return i9.test(t)}function d9(t){return l9.test(t)}function u9(t,s,n){const r=h9(t,s,n);if(console.warn(r),o9.includes(t))throw new RangeError(r)}function h9(t,s,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${s}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const m9=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,f9=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,p9=/^'([^]*?)'?$/,x9=/''/g,g9=/[a-zA-Z]/;function v9(t,s,n){var f,h,g,u;const r=wu(),a=r.locale??Tk,l=r.firstWeekContainsDate??((h=(f=r.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??1,c=r.weekStartsOn??((u=(g=r.locale)==null?void 0:g.options)==null?void 0:u.weekStartsOn)??0,d=fn(t);if(!h8(d))throw new RangeError("Invalid time value");let m=s.match(f9).map(j=>{const p=j[0];if(p==="p"||p==="P"){const y=a9[p];return y(j,a.formatLong)}return j}).join("").match(m9).map(j=>{if(j==="''")return{isToken:!1,value:"'"};const p=j[0];if(p==="'")return{isToken:!1,value:b9(j)};if(Qw[p])return{isToken:!0,value:j};if(p.match(g9))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:j}});a.localize.preprocessor&&(m=a.localize.preprocessor(d,m));const x={firstWeekContainsDate:l,weekStartsOn:c,locale:a};return m.map(j=>{if(!j.isToken)return j.value;const p=j.value;(d9(p)||c9(p))&&u9(p,s,String(t));const y=Qw[p[0]];return y(d,p,a.localize,x)}).join("")}function b9(t){const s=t.match(p9);return s?s[1].replace(x9,"'"):t}function y9(t,s,n){const r=wu(),a=(n==null?void 0:n.locale)??r.locale??Tk,l=2520,c=im(t,s);if(isNaN(c))throw new RangeError("Invalid time value");const d=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:c});let m,x;c>0?(m=fn(s),x=fn(t)):(m=fn(t),x=fn(s));const f=y8(x,m),h=(Rm(x)-Rm(m))/1e3,g=Math.round((f-h)/60);let u;if(g<2)return n!=null&&n.includeSeconds?f<5?a.formatDistance("lessThanXSeconds",5,d):f<10?a.formatDistance("lessThanXSeconds",10,d):f<20?a.formatDistance("lessThanXSeconds",20,d):f<40?a.formatDistance("halfAMinute",0,d):f<60?a.formatDistance("lessThanXMinutes",1,d):a.formatDistance("xMinutes",1,d):g===0?a.formatDistance("lessThanXMinutes",1,d):a.formatDistance("xMinutes",g,d);if(g<45)return a.formatDistance("xMinutes",g,d);if(g<90)return a.formatDistance("aboutXHours",1,d);if(gf.auth),{socket:r}=Rk(),[a,l]=v.useState([]),[c,d]=v.useState(0);v.useEffect(()=>{(async()=>{try{const h=await Po.getNotifications(1,15);h.success&&(l(h.data),h.pagination&&h.pagination.unreadCount!==void 0?d(h.pagination.unreadCount):d(h.data.filter(g=>!g.isRead).length))}catch(h){console.error("Fetch notifications error:",h)}})()},[]),v.useEffect(()=>{if(r)return r.on("notification",f=>{l(h=>[f,...h].slice(0,15)),d(h=>h+1),ee(f.title,{description:f.message,action:f.link?{label:"View",onClick:()=>window.location.href=f.link}:void 0})}),()=>{r.off("notification")}},[r]);const m=async f=>{try{f.isRead||(await Po.markAsRead(f.id)).success&&(l(g=>g.map(u=>u.id===f.id?{...u,isRead:!0}:u)),d(g=>Math.max(0,g-1))),f.link&&(window.location.href=f.link)}catch(h){console.error("Notification click error:",h)}},x=async()=>{try{(await Po.markAllAsRead()).success&&(l(h=>h.map(g=>({...g,isRead:!0}))),d(0))}catch(f){console.error("Mark all as read error:",f)}};return e.jsx("header",{className:"bg-white border-b border-slate-200 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900",children:t}),e.jsx("p",{className:"text-slate-600",children:"Manage and track dealership applications"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[n&&e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-100 rounded-lg",children:[e.jsx("div",{className:"w-8 h-8 bg-re-red rounded-full flex items-center justify-center",children:e.jsx(kr,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-slate-900",children:n.name}),e.jsx("p",{className:"text-slate-600",children:n.role})]})]}),s&&e.jsx(se,{variant:"outline",size:"icon",onClick:s,title:"Refresh",children:e.jsx(Rr,{className:"w-4 h-4"})}),e.jsx(se,{variant:"outline",size:"icon",title:"Help",children:e.jsx(q2,{className:"w-4 h-4"})}),e.jsxs(bb,{children:[e.jsx(yb,{asChild:!0,children:e.jsxs(se,{variant:"outline",size:"icon",className:"relative",children:[e.jsx(Yd,{className:"w-4 h-4"}),c>0&&e.jsx(Ae,{variant:"destructive",className:"absolute -top-1 -right-1 w-5 h-5 p-0 flex items-center justify-center text-xs",children:c})]})}),e.jsxs(jb,{align:"end",className:"w-80",children:[e.jsxs("div",{className:"p-3 border-b flex items-center justify-between",children:[e.jsx("p",{className:"font-semibold text-slate-900",children:"Notifications"}),c>0&&e.jsx("button",{onClick:x,className:"text-xs text-blue-600 hover:underline",children:"Mark all read"})]}),e.jsx("div",{className:"max-h-96 overflow-y-auto custom-scrollbar",children:a.length===0?e.jsx("div",{className:"p-8 text-center text-slate-500",children:"No notifications yet"}):a.map(f=>e.jsxs(mk,{className:`p-3 cursor-pointer flex items-start gap-3 ${f.isRead?"":"bg-blue-50/50"}`,onClick:()=>m(f),children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-slate-900 text-sm font-medium",children:f.title}),e.jsx("p",{className:"text-slate-600 text-xs mt-1 leading-relaxed",children:f.message}),e.jsx("p",{className:"text-slate-400 text-[10px] mt-2",children:Ok(new Date(f.createdAt),{addSuffix:!0})})]}),!f.isRead&&e.jsx("div",{className:"w-2 h-2 bg-blue-600 rounded-full mt-1.5 flex-shrink-0"})]},f.id))}),e.jsx("div",{className:"p-3 border-t text-center",children:e.jsx("button",{onClick:()=>window.location.href="/notifications",className:"text-xs font-medium text-blue-600 hover:text-blue-800 transition-colors",children:"View All Notifications"})})]})]})]})]})})}function Ie({className:t,...s}){return e.jsx("div",{"data-slot":"card",className:_t("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border",t),...s})}function tt({className:t,...s}){return e.jsx("div",{"data-slot":"card-header",className:_t("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 pt-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...s})}function nt({className:t,...s}){return e.jsx("h4",{"data-slot":"card-title",className:_t("leading-none",t),...s})}function Zt({className:t,...s}){return e.jsx("p",{"data-slot":"card-description",className:_t("text-muted-foreground",t),...s})}function Me({className:t,...s}){return e.jsx("div",{"data-slot":"card-content",className:_t("px-6 [&:last-child]:pb-6",t),...s})}function Nv(t,[s,n]){return Math.min(n,Math.max(s,t))}function N9(t,s){return v.useReducer((n,r)=>s[n][r]??n,t)}var kb="ScrollArea",[Lk]=ea(kb),[w9,Ea]=Lk(kb),Ik=v.forwardRef((t,s)=>{const{__scopeScrollArea:n,type:r="hover",dir:a,scrollHideDelay:l=600,...c}=t,[d,m]=v.useState(null),[x,f]=v.useState(null),[h,g]=v.useState(null),[u,j]=v.useState(null),[p,y]=v.useState(null),[N,S]=v.useState(0),[A,w]=v.useState(0),[E,T]=v.useState(!1),[C,L]=v.useState(!1),$=Ms(s,R=>m(R)),_=pu(a);return e.jsx(w9,{scope:n,type:r,dir:_,scrollHideDelay:l,scrollArea:d,viewport:x,onViewportChange:f,content:h,onContentChange:g,scrollbarX:u,onScrollbarXChange:j,scrollbarXEnabled:E,onScrollbarXEnabledChange:T,scrollbarY:p,onScrollbarYChange:y,scrollbarYEnabled:C,onScrollbarYEnabledChange:L,onCornerWidthChange:S,onCornerHeightChange:w,children:e.jsx(ps.div,{dir:_,...c,ref:$,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});Ik.displayName=kb;var Mk="ScrollAreaViewport",Fk=v.forwardRef((t,s)=>{const{__scopeScrollArea:n,children:r,nonce:a,...l}=t,c=Ea(Mk,n),d=v.useRef(null),m=Ms(s,d,c.onViewportChange);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),e.jsx(ps.div,{"data-radix-scroll-area-viewport":"",...l,ref:m,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...t.style},children:e.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Fk.displayName=Mk;var Si="ScrollAreaScrollbar",Bk=v.forwardRef((t,s)=>{const{forceMount:n,...r}=t,a=Ea(Si,t.__scopeScrollArea),{onScrollbarXEnabledChange:l,onScrollbarYEnabledChange:c}=a,d=t.orientation==="horizontal";return v.useEffect(()=>(d?l(!0):c(!0),()=>{d?l(!1):c(!1)}),[d,l,c]),a.type==="hover"?e.jsx(S9,{...r,ref:s,forceMount:n}):a.type==="scroll"?e.jsx(C9,{...r,ref:s,forceMount:n}):a.type==="auto"?e.jsx($k,{...r,ref:s,forceMount:n}):a.type==="always"?e.jsx(Rb,{...r,ref:s}):null});Bk.displayName=Si;var S9=v.forwardRef((t,s)=>{const{forceMount:n,...r}=t,a=Ea(Si,t.__scopeScrollArea),[l,c]=v.useState(!1);return v.useEffect(()=>{const d=a.scrollArea;let m=0;if(d){const x=()=>{window.clearTimeout(m),c(!0)},f=()=>{m=window.setTimeout(()=>c(!1),a.scrollHideDelay)};return d.addEventListener("pointerenter",x),d.addEventListener("pointerleave",f),()=>{window.clearTimeout(m),d.removeEventListener("pointerenter",x),d.removeEventListener("pointerleave",f)}}},[a.scrollArea,a.scrollHideDelay]),e.jsx(mr,{present:n||l,children:e.jsx($k,{"data-state":l?"visible":"hidden",...r,ref:s})})}),C9=v.forwardRef((t,s)=>{const{forceMount:n,...r}=t,a=Ea(Si,t.__scopeScrollArea),l=t.orientation==="horizontal",c=gf(()=>m("SCROLL_END"),100),[d,m]=N9("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(d==="idle"){const x=window.setTimeout(()=>m("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(x)}},[d,a.scrollHideDelay,m]),v.useEffect(()=>{const x=a.viewport,f=l?"scrollLeft":"scrollTop";if(x){let h=x[f];const g=()=>{const u=x[f];h!==u&&(m("SCROLL"),c()),h=u};return x.addEventListener("scroll",g),()=>x.removeEventListener("scroll",g)}},[a.viewport,l,m,c]),e.jsx(mr,{present:n||d!=="hidden",children:e.jsx(Rb,{"data-state":d==="hidden"?"hidden":"visible",...r,ref:s,onPointerEnter:Vt(t.onPointerEnter,()=>m("POINTER_ENTER")),onPointerLeave:Vt(t.onPointerLeave,()=>m("POINTER_LEAVE"))})})}),$k=v.forwardRef((t,s)=>{const n=Ea(Si,t.__scopeScrollArea),{forceMount:r,...a}=t,[l,c]=v.useState(!1),d=t.orientation==="horizontal",m=gf(()=>{if(n.viewport){const x=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,a=Ea(Si,t.__scopeScrollArea),l=v.useRef(null),c=v.useRef(0),[d,m]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),x=Hk(d.viewport,d.content),f={...r,sizes:d,onSizesChange:m,hasThumb:x>0&&x<1,onThumbChange:g=>l.current=g,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:g=>c.current=g};function h(g,u){return T9(g,c.current,d,u)}return n==="horizontal"?e.jsx(A9,{...f,ref:s,onThumbPositionChange:()=>{if(a.viewport&&l.current){const g=a.viewport.scrollLeft,u=t1(g,d,a.dir);l.current.style.transform=`translate3d(${u}px, 0, 0)`}},onWheelScroll:g=>{a.viewport&&(a.viewport.scrollLeft=g)},onDragScroll:g=>{a.viewport&&(a.viewport.scrollLeft=h(g,a.dir))}}):n==="vertical"?e.jsx(k9,{...f,ref:s,onThumbPositionChange:()=>{if(a.viewport&&l.current){const g=a.viewport.scrollTop,u=t1(g,d);l.current.style.transform=`translate3d(0, ${u}px, 0)`}},onWheelScroll:g=>{a.viewport&&(a.viewport.scrollTop=g)},onDragScroll:g=>{a.viewport&&(a.viewport.scrollTop=h(g))}}):null}),A9=v.forwardRef((t,s)=>{const{sizes:n,onSizesChange:r,...a}=t,l=Ea(Si,t.__scopeScrollArea),[c,d]=v.useState(),m=v.useRef(null),x=Ms(s,m,l.onScrollbarXChange);return v.useEffect(()=>{m.current&&d(getComputedStyle(m.current))},[m]),e.jsx(zk,{"data-orientation":"horizontal",...a,ref:x,sizes:n,style:{bottom:0,left:l.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:l.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":xf(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.x),onDragScroll:f=>t.onDragScroll(f.x),onWheelScroll:(f,h)=>{if(l.viewport){const g=l.viewport.scrollLeft+f.deltaX;t.onWheelScroll(g),Kk(g,h)&&f.preventDefault()}},onResize:()=>{m.current&&l.viewport&&c&&r({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:m.current.clientWidth,paddingStart:Dm(c.paddingLeft),paddingEnd:Dm(c.paddingRight)}})}})}),k9=v.forwardRef((t,s)=>{const{sizes:n,onSizesChange:r,...a}=t,l=Ea(Si,t.__scopeScrollArea),[c,d]=v.useState(),m=v.useRef(null),x=Ms(s,m,l.onScrollbarYChange);return v.useEffect(()=>{m.current&&d(getComputedStyle(m.current))},[m]),e.jsx(zk,{"data-orientation":"vertical",...a,ref:x,sizes:n,style:{top:0,right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":xf(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.y),onDragScroll:f=>t.onDragScroll(f.y),onWheelScroll:(f,h)=>{if(l.viewport){const g=l.viewport.scrollTop+f.deltaY;t.onWheelScroll(g),Kk(g,h)&&f.preventDefault()}},onResize:()=>{m.current&&l.viewport&&c&&r({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:m.current.clientHeight,paddingStart:Dm(c.paddingTop),paddingEnd:Dm(c.paddingBottom)}})}})}),[R9,qk]=Lk(Si),zk=v.forwardRef((t,s)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:a,onThumbChange:l,onThumbPointerUp:c,onThumbPointerDown:d,onThumbPositionChange:m,onDragScroll:x,onWheelScroll:f,onResize:h,...g}=t,u=Ea(Si,n),[j,p]=v.useState(null),y=Ms(s,$=>p($)),N=v.useRef(null),S=v.useRef(""),A=u.viewport,w=r.content-r.viewport,E=dr(f),T=dr(m),C=gf(h,10);function L($){if(N.current){const _=$.clientX-N.current.left,R=$.clientY-N.current.top;x({x:_,y:R})}}return v.useEffect(()=>{const $=_=>{const R=_.target;(j==null?void 0:j.contains(R))&&E(_,w)};return document.addEventListener("wheel",$,{passive:!1}),()=>document.removeEventListener("wheel",$,{passive:!1})},[A,j,w,E]),v.useEffect(T,[r,T]),Pc(j,C),Pc(u.content,C),e.jsx(R9,{scope:n,scrollbar:j,hasThumb:a,onThumbChange:dr(l),onThumbPointerUp:dr(c),onThumbPositionChange:T,onThumbPointerDown:dr(d),children:e.jsx(ps.div,{...g,ref:y,style:{position:"absolute",...g.style},onPointerDown:Vt(t.onPointerDown,$=>{$.button===0&&($.target.setPointerCapture($.pointerId),N.current=j.getBoundingClientRect(),S.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",u.viewport&&(u.viewport.style.scrollBehavior="auto"),L($))}),onPointerMove:Vt(t.onPointerMove,L),onPointerUp:Vt(t.onPointerUp,$=>{const _=$.target;_.hasPointerCapture($.pointerId)&&_.releasePointerCapture($.pointerId),document.body.style.webkitUserSelect=S.current,u.viewport&&(u.viewport.style.scrollBehavior=""),N.current=null})})})}),Em="ScrollAreaThumb",Uk=v.forwardRef((t,s)=>{const{forceMount:n,...r}=t,a=qk(Em,t.__scopeScrollArea);return e.jsx(mr,{present:n||a.hasThumb,children:e.jsx(E9,{ref:s,...r})})}),E9=v.forwardRef((t,s)=>{const{__scopeScrollArea:n,style:r,...a}=t,l=Ea(Em,n),c=qk(Em,n),{onThumbPositionChange:d}=c,m=Ms(s,h=>c.onThumbChange(h)),x=v.useRef(void 0),f=gf(()=>{x.current&&(x.current(),x.current=void 0)},100);return v.useEffect(()=>{const h=l.viewport;if(h){const g=()=>{if(f(),!x.current){const u=_9(h,d);x.current=u,d()}};return d(),h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[l.viewport,f,d]),e.jsx(ps.div,{"data-state":c.hasThumb?"visible":"hidden",...a,ref:m,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Vt(t.onPointerDownCapture,h=>{const u=h.target.getBoundingClientRect(),j=h.clientX-u.left,p=h.clientY-u.top;c.onThumbPointerDown({x:j,y:p})}),onPointerUp:Vt(t.onPointerUp,c.onThumbPointerUp)})});Uk.displayName=Em;var Eb="ScrollAreaCorner",Vk=v.forwardRef((t,s)=>{const n=Ea(Eb,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?e.jsx(D9,{...t,ref:s}):null});Vk.displayName=Eb;var D9=v.forwardRef((t,s)=>{const{__scopeScrollArea:n,...r}=t,a=Ea(Eb,n),[l,c]=v.useState(0),[d,m]=v.useState(0),x=!!(l&&d);return Pc(a.scrollbarX,()=>{var h;const f=((h=a.scrollbarX)==null?void 0:h.offsetHeight)||0;a.onCornerHeightChange(f),m(f)}),Pc(a.scrollbarY,()=>{var h;const f=((h=a.scrollbarY)==null?void 0:h.offsetWidth)||0;a.onCornerWidthChange(f),c(f)}),x?e.jsx(ps.div,{...r,ref:s,style:{width:l,height:d,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Dm(t){return t?parseInt(t,10):0}function Hk(t,s){const n=t/s;return isNaN(n)?0:n}function xf(t){const s=Hk(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*s;return Math.max(r,18)}function T9(t,s,n,r="ltr"){const a=xf(n),l=a/2,c=s||l,d=a-c,m=n.scrollbar.paddingStart+c,x=n.scrollbar.size-n.scrollbar.paddingEnd-d,f=n.content-n.viewport,h=r==="ltr"?[0,f]:[f*-1,0];return Wk([m,x],h)(t)}function t1(t,s,n="ltr"){const r=xf(s),a=s.scrollbar.paddingStart+s.scrollbar.paddingEnd,l=s.scrollbar.size-a,c=s.content-s.viewport,d=l-r,m=n==="ltr"?[0,c]:[c*-1,0],x=Nv(t,m);return Wk([0,c],[0,d])(x)}function Wk(t,s){return n=>{if(t[0]===t[1]||s[0]===s[1])return s[0];const r=(s[1]-s[0])/(t[1]-t[0]);return s[0]+r*(n-t[0])}}function Kk(t,s){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function a(){const l={left:t.scrollLeft,top:t.scrollTop},c=n.left!==l.left,d=n.top!==l.top;(c||d)&&s(),n=l,r=window.requestAnimationFrame(a)})(),()=>window.cancelAnimationFrame(r)};function gf(t,s){const n=dr(t),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,s)},[n,s])}function Pc(t,s){const n=dr(s);Zn(()=>{let r=0;if(t){const a=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return a.observe(t),()=>{window.cancelAnimationFrame(r),a.unobserve(t)}}},[t,n])}var P9=Ik,O9=Fk,L9=Vk;function Db({className:t,children:s,...n}){return e.jsxs(P9,{"data-slot":"scroll-area",className:_t("relative",t),...n,children:[e.jsx(O9,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:s}),e.jsx(I9,{}),e.jsx(L9,{})]})}function I9({className:t,orientation:s="vertical",...n}){return e.jsx(Bk,{"data-slot":"scroll-area-scrollbar",orientation:s,className:_t("flex touch-none p-px transition-colors select-none",s==="vertical"&&"h-full w-2.5 border-l border-l-transparent",s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",t),...n,children:e.jsx(Uk,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function M9({onNavigate:t}){const s=[{title:"Total Applications",value:hi.totalApplications,icon:fs,color:"bg-blue-500",trend:{value:12,isPositive:!0},filter:"all"},{title:"LOA Issued",value:hi.loaIssued,icon:Ys,color:"bg-green-500",trend:{value:8,isPositive:!0},filter:"Approved"},{title:"Level 1 Pending",value:hi.level1Pending,icon:Js,color:"bg-amber-500",trend:{value:3,isPositive:!1},filter:"Level 1 Pending"},{title:"Level 2 Pending",value:hi.level2Pending,icon:NL,color:"bg-purple-500",trend:{value:5,isPositive:!0},filter:"Level 2 Pending"},{title:"Level 3 Pending",value:hi.level3Pending,icon:tL,color:"bg-indigo-500",trend:{value:2,isPositive:!1},filter:"Level 3 Pending"},{title:"EOR In Progress",value:hi.eorInProgress,icon:Gs,color:"bg-cyan-500",trend:{value:1,isPositive:!0},filter:"EOR In Progress"},{title:"Disqualified",value:hi.disqualified,icon:Za,color:"bg-red-500",trend:{value:4,isPositive:!1},filter:"Disqualified"},{title:"Pending Reminders",value:hi.pendingReminders,icon:qr,color:"bg-orange-500",trend:{value:7,isPositive:!1},filter:"Questionnaire Pending"},{title:"Shortlisted Today",value:hi.shortlistedToday,icon:Ys,color:"bg-teal-500",trend:{value:5,isPositive:!0},filter:"Shortlisted"},{title:"Pending Shortlisting",value:hi.pendingShortlisting,icon:oL,color:"bg-yellow-500",trend:{value:2,isPositive:!1},filter:"all",action:"opportunity-requests"}],n=[{status:"Pending",count:45,color:"#f59e0b"},{status:"In Progress",count:68,color:"#3b82f6"},{status:"Approved",count:25,color:"#10b981"},{status:"Rejected",count:12,color:"#ef4444"}],r=[{location:"Mumbai",count:23},{location:"Delhi",count:18},{location:"Bangalore",count:21},{location:"Chennai",count:15},{location:"Kolkata",count:12},{location:"Others",count:61}],a=Math.max(...r.map(l=>l.count));return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:s.map(l=>{const c=l.icon,d=l.trend.isPositive?Wi:_o;return e.jsxs(Ie,{className:"cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>t(l.action||"applications",l.filter),children:[e.jsxs(tt,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsx(nt,{className:"text-slate-600",children:l.title}),e.jsx("div",{className:`${l.color} p-2 rounded-lg`,children:e.jsx(c,{className:"w-5 h-5 text-white"})})]}),e.jsx(Me,{children:e.jsx("div",{className:"flex items-end justify-between",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-slate-900",children:l.value}),e.jsxs("div",{className:`flex items-center gap-1 mt-1 ${l.trend.isPositive?"text-green-600":"text-red-600"}`,children:[e.jsx(d,{className:"w-3 h-3"}),e.jsxs("span",{children:[l.trend.value,"% from last month"]})]})]})})})]},l.title)})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Application Status Distribution"})}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:n.map(l=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:l.color}}),e.jsx("span",{className:"text-slate-700",children:l.status})]}),e.jsx("span",{className:"text-slate-900",children:l.count})]}),e.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:e.jsx("div",{className:"h-2 rounded-full transition-all",style:{width:`${l.count/150*100}%`,backgroundColor:l.color}})})]},l.status))})})]}),e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Applications by Location"})}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-3",children:r.map(l=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-24 text-slate-700",children:l.location}),e.jsx("div",{className:"flex-1 bg-slate-200 rounded-full h-8 relative overflow-hidden",children:e.jsx("div",{className:"bg-amber-600 h-full rounded-full transition-all flex items-center justify-end px-3",style:{width:`${l.count/a*100}%`},children:e.jsx("span",{className:"text-white",children:l.count})})})]},l.location))})})]})]}),e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Recent Activity"})}),e.jsx(Me,{children:e.jsx(Db,{className:"h-80",children:e.jsx("div",{className:"space-y-4",children:rI.map(l=>e.jsxs("div",{className:"flex items-start gap-4 p-3 hover:bg-slate-50 rounded-lg cursor-pointer transition-colors",onClick:()=>t("applications"),children:[e.jsxs("div",{className:"w-10 h-10 bg-amber-100 rounded-full flex items-center justify-center flex-shrink-0",children:[l.action==="Approved"&&e.jsx(Ys,{className:"w-5 h-5 text-green-600"}),l.action==="Interview Scheduled"&&e.jsx(Js,{className:"w-5 h-5 text-blue-600"}),l.action==="Document Uploaded"&&e.jsx(fs,{className:"w-5 h-5 text-purple-600"}),l.action==="Reminder Sent"&&e.jsx(qr,{className:"w-5 h-5 text-orange-600"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(Ae,{variant:"outline",children:l.applicationId}),e.jsx("span",{className:"text-slate-700",children:l.action})]}),e.jsxs("p",{className:"text-slate-500 mt-1",children:["by ",l.user]})]}),e.jsx("div",{className:"text-slate-500 flex-shrink-0",children:l.timestamp})]},l.id))})})})]})]})}var vf="Tabs",[F9]=ea(vf,[of]),Gk=of(),[B9,Tb]=F9(vf),Yk=v.forwardRef((t,s)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:l,orientation:c="horizontal",dir:d,activationMode:m="automatic",...x}=t,f=pu(d),[h,g]=bi({prop:r,onChange:a,defaultProp:l??"",caller:vf});return e.jsx(B9,{scope:n,baseId:hr(),value:h,onValueChange:g,orientation:c,dir:f,activationMode:m,children:e.jsx(ps.div,{dir:f,"data-orientation":c,...x,ref:s})})});Yk.displayName=vf;var Zk="TabsList",Qk=v.forwardRef((t,s)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,l=Tb(Zk,n),c=Gk(n);return e.jsx(NA,{asChild:!0,...c,orientation:l.orientation,dir:l.dir,loop:r,children:e.jsx(ps.div,{role:"tablist","aria-orientation":l.orientation,...a,ref:s})})});Qk.displayName=Zk;var Xk="TabsTrigger",Jk=v.forwardRef((t,s)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...l}=t,c=Tb(Xk,n),d=Gk(n),m=sR(c.baseId,r),x=nR(c.baseId,r),f=r===c.value;return e.jsx(wA,{asChild:!0,...d,focusable:!a,active:f,children:e.jsx(ps.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":x,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:m,...l,ref:s,onMouseDown:Vt(t.onMouseDown,h=>{!a&&h.button===0&&h.ctrlKey===!1?c.onValueChange(r):h.preventDefault()}),onKeyDown:Vt(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&c.onValueChange(r)}),onFocus:Vt(t.onFocus,()=>{const h=c.activationMode!=="manual";!f&&!a&&h&&c.onValueChange(r)})})})});Jk.displayName=Xk;var eR="TabsContent",tR=v.forwardRef((t,s)=>{const{__scopeTabs:n,value:r,forceMount:a,children:l,...c}=t,d=Tb(eR,n),m=sR(d.baseId,r),x=nR(d.baseId,r),f=r===d.value,h=v.useRef(f);return v.useEffect(()=>{const g=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(g)},[]),e.jsx(mr,{present:a||f,children:({present:g})=>e.jsx(ps.div,{"data-state":f?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!g,id:x,tabIndex:0,...c,ref:s,style:{...t.style,animationDuration:h.current?"0s":void 0},children:g&&l})})});tR.displayName=eR;function sR(t,s){return`${t}-trigger-${s}`}function nR(t,s){return`${t}-content-${s}`}var $9=Yk,q9=Qk,z9=Jk,U9=tR;function _n({className:t,...s}){return e.jsx($9,{"data-slot":"tabs",className:_t("flex flex-col gap-2",t),...s})}function Pn({className:t,...s}){return e.jsx(q9,{"data-slot":"tabs-list",className:_t("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-xl p-[3px] flex",t),...s})}function Wt({className:t,...s}){return e.jsx(z9,{"data-slot":"tabs-trigger",className:_t("data-[state=active]:bg-card dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-xl border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s})}function Kt({className:t,...s}){return e.jsx(U9,{"data-slot":"tabs-content",className:_t("flex-1 outline-none",t),...s})}function V9(t){const s=H9(t),n=v.forwardRef((r,a)=>{const{children:l,...c}=r,d=v.Children.toArray(l),m=d.find(K9);if(m){const x=m.props.children,f=d.map(h=>h===m?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:h);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}function H9(t){const s=v.forwardRef((n,r)=>{const{children:a,...l}=n;if(v.isValidElement(a)){const c=Y9(a),d=G9(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var W9=Symbol("radix.slottable");function K9(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===W9}function G9(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const m=l(...d);return a(...d),m}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function Y9(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var bf="Dialog",[rR,aR]=ea(bf),[Z9,si]=rR(bf),iR=t=>{const{__scopeDialog:s,children:n,open:r,defaultOpen:a,onOpenChange:l,modal:c=!0}=t,d=v.useRef(null),m=v.useRef(null),[x,f]=bi({prop:r,defaultProp:a??!1,onChange:l,caller:bf});return e.jsx(Z9,{scope:s,triggerRef:d,contentRef:m,contentId:hr(),titleId:hr(),descriptionId:hr(),open:x,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(h=>!h),[f]),modal:c,children:n})};iR.displayName=bf;var lR="DialogTrigger",oR=v.forwardRef((t,s)=>{const{__scopeDialog:n,...r}=t,a=si(lR,n),l=Ms(s,a.triggerRef);return e.jsx(ps.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Ob(a.open),...r,ref:l,onClick:Vt(t.onClick,a.onOpenToggle)})});oR.displayName=lR;var _b="DialogPortal",[Q9,cR]=rR(_b,{forceMount:void 0}),dR=t=>{const{__scopeDialog:s,forceMount:n,children:r,container:a}=t,l=si(_b,s);return e.jsx(Q9,{scope:s,forceMount:n,children:v.Children.map(r,c=>e.jsx(mr,{present:n||l.open,children:e.jsx(Hc,{asChild:!0,container:a,children:c})}))})};dR.displayName=_b;var Tm="DialogOverlay",uR=v.forwardRef((t,s)=>{const n=cR(Tm,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,l=si(Tm,t.__scopeDialog);return l.modal?e.jsx(mr,{present:r||l.open,children:e.jsx(J9,{...a,ref:s})}):null});uR.displayName=Tm;var X9=V9("DialogOverlay.RemoveScroll"),J9=v.forwardRef((t,s)=>{const{__scopeDialog:n,...r}=t,a=si(Tm,n);return e.jsx(yu,{as:X9,allowPinchZoom:!0,shards:[a.contentRef],children:e.jsx(ps.div,{"data-state":Ob(a.open),...r,ref:s,style:{pointerEvents:"auto",...r.style}})})}),$o="DialogContent",hR=v.forwardRef((t,s)=>{const n=cR($o,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,l=si($o,t.__scopeDialog);return e.jsx(mr,{present:r||l.open,children:l.modal?e.jsx(eB,{...a,ref:s}):e.jsx(tB,{...a,ref:s})})});hR.displayName=$o;var eB=v.forwardRef((t,s)=>{const n=si($o,t.__scopeDialog),r=v.useRef(null),a=Ms(s,n.contentRef,r);return v.useEffect(()=>{const l=r.current;if(l)return cf(l)},[]),e.jsx(mR,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Vt(t.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Vt(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0;(c.button===2||d)&&l.preventDefault()}),onFocusOutside:Vt(t.onFocusOutside,l=>l.preventDefault())})}),tB=v.forwardRef((t,s)=>{const n=si($o,t.__scopeDialog),r=v.useRef(!1),a=v.useRef(!1);return e.jsx(mR,{...t,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,d;(c=t.onCloseAutoFocus)==null||c.call(t,l),l.defaultPrevented||(r.current||(d=n.triggerRef.current)==null||d.focus(),l.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:l=>{var m,x;(m=t.onInteractOutside)==null||m.call(t,l),l.defaultPrevented||(r.current=!0,l.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=l.target;((x=n.triggerRef.current)==null?void 0:x.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&a.current&&l.preventDefault()}})}),mR=v.forwardRef((t,s)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:l,...c}=t,d=si($o,n),m=v.useRef(null),x=Ms(s,m);return Jm(),e.jsxs(e.Fragment,{children:[e.jsx(xu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:l,children:e.jsx(zc,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Ob(d.open),...c,ref:x,onDismiss:()=>d.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(nB,{titleId:d.titleId}),e.jsx(aB,{contentRef:m,descriptionId:d.descriptionId})]})]})}),Pb="DialogTitle",fR=v.forwardRef((t,s)=>{const{__scopeDialog:n,...r}=t,a=si(Pb,n);return e.jsx(ps.h2,{id:a.titleId,...r,ref:s})});fR.displayName=Pb;var pR="DialogDescription",xR=v.forwardRef((t,s)=>{const{__scopeDialog:n,...r}=t,a=si(pR,n);return e.jsx(ps.p,{id:a.descriptionId,...r,ref:s})});xR.displayName=pR;var gR="DialogClose",vR=v.forwardRef((t,s)=>{const{__scopeDialog:n,...r}=t,a=si(gR,n);return e.jsx(ps.button,{type:"button",...r,ref:s,onClick:Vt(t.onClick,()=>a.onOpenChange(!1))})});vR.displayName=gR;function Ob(t){return t?"open":"closed"}var bR="DialogTitleWarning",[sB,yR]=E5(bR,{contentName:$o,titleName:Pb,docsSlug:"dialog"}),nB=({titleId:t})=>{const s=yR(bR),n=`\`${s.contentName}\` requires a \`${s.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${s.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${s.docsSlug}`;return v.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},J9="DialogDescriptionWarning",eB=({contentRef:t,descriptionId:s})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${xR(J9).contentName}}.`;return v.useEffect(()=>{var l;const a=(l=t.current)==null?void 0:l.getAttribute("aria-describedby");s&&a&&(document.getElementById(s)||console.warn(r))},[r,t,s]),null},Pb=sR,gR=rR,_b=iR,vf=lR,bf=oR,vR=dR,bR=hR,Ob=fR;function os({...t}){return e.jsx(Pb,{"data-slot":"dialog",...t})}function Hl({...t}){return e.jsx(gR,{"data-slot":"dialog-trigger",...t})}function tB({...t}){return e.jsx(_b,{"data-slot":"dialog-portal",...t})}const yR=v.forwardRef(({className:t,...s},n)=>e.jsx(vf,{ref:n,"data-slot":"dialog-overlay",className:Pt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...s}));yR.displayName=vf.displayName;const ls=v.forwardRef(({className:t,children:s,...n},r)=>e.jsxs(tB,{"data-slot":"dialog-portal",children:[e.jsx(yR,{}),e.jsxs(bf,{ref:r,"data-slot":"dialog-content",className:Pt("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...n,children:[s,e.jsxs(Ob,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e.jsx(Tc,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ls.displayName=bf.displayName;function ms({className:t,...s}){return e.jsx("div",{"data-slot":"dialog-header",className:Pt("flex flex-col gap-2 text-center sm:text-left",t),...s})}function rn({className:t,...s}){return e.jsx("div",{"data-slot":"dialog-footer",className:Pt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function us({className:t,...s}){return e.jsx(vR,{"data-slot":"dialog-title",className:Pt("text-lg leading-none font-semibold",t),...s})}function vs({className:t,...s}){return e.jsx(bR,{"data-slot":"dialog-description",className:Pt("text-muted-foreground text-sm",t),...s})}function sB(t){const s=nB(t),n=v.forwardRef((r,a)=>{const{children:l,...c}=r,d=v.Children.toArray(l),h=d.find(aB);if(h){const x=h.props.children,f=d.map(m=>m===h?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:m);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}function nB(t){const s=v.forwardRef((n,r)=>{const{children:a,...l}=n;if(v.isValidElement(a)){const c=lB(a),d=iB(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var rB=Symbol("radix.slottable");function aB(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===rB}function iB(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const h=l(...d);return a(...d),h}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function lB(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var jR=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),oB="VisuallyHidden",NR=v.forwardRef((t,s)=>e.jsx(ps.span,{...t,ref:s,style:{...jR,...t.style}}));NR.displayName=oB;var cB=NR,dB=[" ","Enter","ArrowUp","ArrowDown"],uB=[" ","Enter"],qo="Select",[yf,jf,hB]=eb(qo),[Gc]=ea(qo,[hB,Vl]),Nf=Vl(),[mB,Wl]=Gc(qo),[fB,pB]=Gc(qo),wR=t=>{const{__scopeSelect:s,children:n,open:r,defaultOpen:a,onOpenChange:l,value:c,defaultValue:d,onValueChange:h,dir:x,name:f,autoComplete:m,disabled:p,required:u,form:j}=t,g=Nf(s),[y,N]=v.useState(null),[S,C]=v.useState(null),[w,R]=v.useState(!1),P=pu(x),[A,I]=bi({prop:r,defaultProp:a??!1,onChange:l,caller:qo}),[$,T]=bi({prop:c,defaultProp:d,onChange:h,caller:qo}),E=v.useRef(null),_=y?j||!!y.closest("form"):!0,[M,q]=v.useState(new Set),G=Array.from(M).map(Z=>Z.props.value).join(";");return e.jsx(sf,{...g,children:e.jsxs(mB,{required:u,scope:s,trigger:y,onTriggerChange:N,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:R,contentId:hr(),value:$,onValueChange:T,open:A,onOpenChange:I,dir:P,triggerPointerDownPosRef:E,disabled:p,children:[e.jsx(yf.Provider,{scope:s,children:e.jsx(fB,{scope:t.__scopeSelect,onNativeOptionAdd:v.useCallback(Z=>{q(W=>new Set(W).add(Z))},[]),onNativeOptionRemove:v.useCallback(Z=>{q(W=>{const z=new Set(W);return z.delete(Z),z})},[]),children:n})}),_?e.jsxs(GR,{"aria-hidden":!0,required:u,tabIndex:-1,name:f,autoComplete:m,value:$,onChange:Z=>T(Z.target.value),disabled:p,form:j,children:[$===void 0?e.jsx("option",{value:""}):null,Array.from(M)]},G):null]})})};wR.displayName=qo;var SR="SelectTrigger",CR=v.forwardRef((t,s)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,l=Nf(n),c=Wl(SR,n),d=c.disabled||r,h=Ms(s,c.onTriggerChange),x=jf(n),f=v.useRef("touch"),[m,p,u]=YR(g=>{const y=x().filter(C=>!C.disabled),N=y.find(C=>C.value===c.value),S=ZR(y,g,N);S!==void 0&&c.onValueChange(S.value)}),j=g=>{d||(c.onOpenChange(!0),u()),g&&(c.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return e.jsx(vu,{asChild:!0,...l,children:e.jsx(ps.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":KR(c.value)?"":void 0,...a,ref:h,onClick:Vt(a.onClick,g=>{g.currentTarget.focus(),f.current!=="mouse"&&j(g)}),onPointerDown:Vt(a.onPointerDown,g=>{f.current=g.pointerType;const y=g.target;y.hasPointerCapture(g.pointerId)&&y.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(j(g),g.preventDefault())}),onKeyDown:Vt(a.onKeyDown,g=>{const y=m.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&p(g.key),!(y&&g.key===" ")&&dB.includes(g.key)&&(j(),g.preventDefault())})})})});CR.displayName=SR;var AR="SelectValue",kR=v.forwardRef((t,s)=>{const{__scopeSelect:n,className:r,style:a,children:l,placeholder:c="",...d}=t,h=Wl(AR,n),{onValueNodeHasChildrenChange:x}=h,f=l!==void 0,m=Ms(s,h.onValueNodeChange);return Zn(()=>{x(f)},[x,f]),e.jsx(ps.span,{...d,ref:m,style:{pointerEvents:"none"},children:KR(h.value)?e.jsx(e.Fragment,{children:c}):l})});kR.displayName=AR;var xB="SelectIcon",RR=v.forwardRef((t,s)=>{const{__scopeSelect:n,children:r,...a}=t;return e.jsx(ps.span,{"aria-hidden":!0,...a,ref:s,children:r||"▼"})});RR.displayName=xB;var gB="SelectPortal",ER=t=>e.jsx(Hc,{asChild:!0,...t});ER.displayName=gB;var zo="SelectContent",DR=v.forwardRef((t,s)=>{const n=Wl(zo,t.__scopeSelect),[r,a]=v.useState();if(Zn(()=>{a(new DocumentFragment)},[]),!n.open){const l=r;return l?cu.createPortal(e.jsx(TR,{scope:t.__scopeSelect,children:e.jsx(yf.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),l):null}return e.jsx(PR,{...t,ref:s})});DR.displayName=zo;var Wa=10,[TR,Gl]=Gc(zo),vB="SelectContentImpl",bB=sB("SelectContent.RemoveScroll"),PR=v.forwardRef((t,s)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:l,onPointerDownOutside:c,side:d,sideOffset:h,align:x,alignOffset:f,arrowPadding:m,collisionBoundary:p,collisionPadding:u,sticky:j,hideWhenDetached:g,avoidCollisions:y,...N}=t,S=Wl(zo,n),[C,w]=v.useState(null),[R,P]=v.useState(null),A=Ms(s,X=>w(X)),[I,$]=v.useState(null),[T,E]=v.useState(null),_=jf(n),[M,q]=v.useState(!1),G=v.useRef(!1);v.useEffect(()=>{if(C)return lf(C)},[C]),Qm();const Z=v.useCallback(X=>{const[ne,...oe]=_().map(ve=>ve.ref.current),[re]=oe.slice(-1),ge=document.activeElement;for(const ve of X)if(ve===ge||(ve==null||ve.scrollIntoView({block:"nearest"}),ve===ne&&R&&(R.scrollTop=0),ve===re&&R&&(R.scrollTop=R.scrollHeight),ve==null||ve.focus(),document.activeElement!==ge))return},[_,R]),W=v.useCallback(()=>Z([I,C]),[Z,I,C]);v.useEffect(()=>{M&&W()},[M,W]);const{onOpenChange:z,triggerPointerDownPosRef:F}=S;v.useEffect(()=>{if(C){let X={x:0,y:0};const ne=re=>{var ge,ve;X={x:Math.abs(Math.round(re.pageX)-(((ge=F.current)==null?void 0:ge.x)??0)),y:Math.abs(Math.round(re.pageY)-(((ve=F.current)==null?void 0:ve.y)??0))}},oe=re=>{X.x<=10&&X.y<=10?re.preventDefault():C.contains(re.target)||z(!1),document.removeEventListener("pointermove",ne),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",ne),document.addEventListener("pointerup",oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",oe,{capture:!0})}}},[C,z,F]),v.useEffect(()=>{const X=()=>z(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[z]);const[B,D]=YR(X=>{const ne=_().filter(ge=>!ge.disabled),oe=ne.find(ge=>ge.ref.current===document.activeElement),re=ZR(ne,X,oe);re&&setTimeout(()=>re.ref.current.focus())}),O=v.useCallback((X,ne,oe)=>{const re=!G.current&&!oe;(S.value!==void 0&&S.value===ne||re)&&($(X),re&&(G.current=!0))},[S.value]),V=v.useCallback(()=>C==null?void 0:C.focus(),[C]),K=v.useCallback((X,ne,oe)=>{const re=!G.current&&!oe;(S.value!==void 0&&S.value===ne||re)&&E(X)},[S.value]),Y=r==="popper"?yv:_R,U=Y===yv?{side:d,sideOffset:h,align:x,alignOffset:f,arrowPadding:m,collisionBoundary:p,collisionPadding:u,sticky:j,hideWhenDetached:g,avoidCollisions:y}:{};return e.jsx(TR,{scope:n,content:C,viewport:R,onViewportChange:P,itemRefCallback:O,selectedItem:I,onItemLeave:V,itemTextRefCallback:K,focusSelectedItem:W,selectedItemText:T,position:r,isPositioned:M,searchRef:B,children:e.jsx(yu,{as:bB,allowPinchZoom:!0,children:e.jsx(xu,{asChild:!0,trapped:S.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:Vt(a,X=>{var ne;(ne=S.trigger)==null||ne.focus({preventScroll:!0}),X.preventDefault()}),children:e.jsx(zc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:e.jsx(Y,{role:"listbox",id:S.contentId,"data-state":S.open?"open":"closed",dir:S.dir,onContextMenu:X=>X.preventDefault(),...N,...U,onPlaced:()=>q(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...N.style},onKeyDown:Vt(N.onKeyDown,X=>{const ne=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!ne&&X.key.length===1&&D(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let re=_().filter(ge=>!ge.disabled).map(ge=>ge.ref.current);if(["ArrowUp","End"].includes(X.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const ge=X.target,ve=re.indexOf(ge);re=re.slice(ve+1)}setTimeout(()=>Z(re)),X.preventDefault()}})})})})})})});PR.displayName=vB;var yB="SelectItemAlignedPosition",_R=v.forwardRef((t,s)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,l=Wl(zo,n),c=Gl(zo,n),[d,h]=v.useState(null),[x,f]=v.useState(null),m=Ms(s,A=>f(A)),p=jf(n),u=v.useRef(!1),j=v.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:N,focusSelectedItem:S}=c,C=v.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&x&&g&&y&&N){const A=l.trigger.getBoundingClientRect(),I=x.getBoundingClientRect(),$=l.valueNode.getBoundingClientRect(),T=N.getBoundingClientRect();if(l.dir!=="rtl"){const ge=T.left-I.left,ve=$.left-ge,Se=A.left-ve,We=A.width+Se,Ce=Math.max(We,I.width),fe=window.innerWidth-Wa,Ye=bv(ve,[Wa,Math.max(Wa,fe-Ce)]);d.style.minWidth=We+"px",d.style.left=Ye+"px"}else{const ge=I.right-T.right,ve=window.innerWidth-$.right-ge,Se=window.innerWidth-A.right-ve,We=A.width+Se,Ce=Math.max(We,I.width),fe=window.innerWidth-Wa,Ye=bv(ve,[Wa,Math.max(Wa,fe-Ce)]);d.style.minWidth=We+"px",d.style.right=Ye+"px"}const E=p(),_=window.innerHeight-Wa*2,M=g.scrollHeight,q=window.getComputedStyle(x),G=parseInt(q.borderTopWidth,10),Z=parseInt(q.paddingTop,10),W=parseInt(q.borderBottomWidth,10),z=parseInt(q.paddingBottom,10),F=G+Z+M+z+W,B=Math.min(y.offsetHeight*5,F),D=window.getComputedStyle(g),O=parseInt(D.paddingTop,10),V=parseInt(D.paddingBottom,10),K=A.top+A.height/2-Wa,Y=_-K,U=y.offsetHeight/2,X=y.offsetTop+U,ne=G+Z+X,oe=F-ne;if(ne<=K){const ge=E.length>0&&y===E[E.length-1].ref.current;d.style.bottom="0px";const ve=x.clientHeight-g.offsetTop-g.offsetHeight,Se=Math.max(Y,U+(ge?V:0)+ve+W),We=ne+Se;d.style.height=We+"px"}else{const ge=E.length>0&&y===E[0].ref.current;d.style.top="0px";const Se=Math.max(K,G+g.offsetTop+(ge?O:0)+U)+oe;d.style.height=Se+"px",g.scrollTop=ne-K+g.offsetTop}d.style.margin=`${Wa}px 0`,d.style.minHeight=B+"px",d.style.maxHeight=_+"px",r==null||r(),requestAnimationFrame(()=>u.current=!0)}},[p,l.trigger,l.valueNode,d,x,g,y,N,l.dir,r]);Zn(()=>C(),[C]);const[w,R]=v.useState();Zn(()=>{x&&R(window.getComputedStyle(x).zIndex)},[x]);const P=v.useCallback(A=>{A&&j.current===!0&&(C(),S==null||S(),j.current=!1)},[C,S]);return e.jsx(NB,{scope:n,contentWrapper:d,shouldExpandOnScrollRef:u,onScrollButtonChange:P,children:e.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:e.jsx(ps.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});_R.displayName=yB;var jB="SelectPopperPosition",yv=v.forwardRef((t,s)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=Wa,...l}=t,c=Nf(n);return e.jsx(nf,{...c,...l,ref:s,align:r,collisionPadding:a,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});yv.displayName=jB;var[NB,Ib]=Gc(zo,{}),jv="SelectViewport",OR=v.forwardRef((t,s)=>{const{__scopeSelect:n,nonce:r,...a}=t,l=Gl(jv,n),c=Ib(jv,n),d=Ms(s,l.onViewportChange),h=v.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),e.jsx(yf.Slot,{scope:n,children:e.jsx(ps.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Vt(a.onScroll,x=>{const f=x.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:p}=c;if(p!=null&&p.current&&m){const u=Math.abs(h.current-f.scrollTop);if(u>0){const j=window.innerHeight-Wa*2,g=parseFloat(m.style.minHeight),y=parseFloat(m.style.height),N=Math.max(g,y);if(N0?w:0,m.style.justifyContent="flex-end")}}}h.current=f.scrollTop})})})]})});OR.displayName=jv;var IR="SelectGroup",[wB,SB]=Gc(IR),LR=v.forwardRef((t,s)=>{const{__scopeSelect:n,...r}=t,a=hr();return e.jsx(wB,{scope:n,id:a,children:e.jsx(ps.div,{role:"group","aria-labelledby":a,...r,ref:s})})});LR.displayName=IR;var MR="SelectLabel",FR=v.forwardRef((t,s)=>{const{__scopeSelect:n,...r}=t,a=SB(MR,n);return e.jsx(ps.div,{id:a.id,...r,ref:s})});FR.displayName=MR;var Tm="SelectItem",[CB,BR]=Gc(Tm),$R=v.forwardRef((t,s)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:l,...c}=t,d=Wl(Tm,n),h=Gl(Tm,n),x=d.value===r,[f,m]=v.useState(l??""),[p,u]=v.useState(!1),j=Ms(s,S=>{var C;return(C=h.itemRefCallback)==null?void 0:C.call(h,S,r,a)}),g=hr(),y=v.useRef("touch"),N=()=>{a||(d.onValueChange(r),d.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(CB,{scope:n,value:r,disabled:a,textId:g,isSelected:x,onItemTextChange:v.useCallback(S=>{m(C=>C||((S==null?void 0:S.textContent)??"").trim())},[]),children:e.jsx(yf.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:e.jsx(ps.div,{role:"option","aria-labelledby":g,"data-highlighted":p?"":void 0,"aria-selected":x&&p,"data-state":x?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...c,ref:j,onFocus:Vt(c.onFocus,()=>u(!0)),onBlur:Vt(c.onBlur,()=>u(!1)),onClick:Vt(c.onClick,()=>{y.current!=="mouse"&&N()}),onPointerUp:Vt(c.onPointerUp,()=>{y.current==="mouse"&&N()}),onPointerDown:Vt(c.onPointerDown,S=>{y.current=S.pointerType}),onPointerMove:Vt(c.onPointerMove,S=>{var C;y.current=S.pointerType,a?(C=h.onItemLeave)==null||C.call(h):y.current==="mouse"&&S.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Vt(c.onPointerLeave,S=>{var C;S.currentTarget===document.activeElement&&((C=h.onItemLeave)==null||C.call(h))}),onKeyDown:Vt(c.onKeyDown,S=>{var w;((w=h.searchRef)==null?void 0:w.current)!==""&&S.key===" "||(uB.includes(S.key)&&N(),S.key===" "&&S.preventDefault())})})})})});$R.displayName=Tm;var Ld="SelectItemText",qR=v.forwardRef((t,s)=>{const{__scopeSelect:n,className:r,style:a,...l}=t,c=Wl(Ld,n),d=Gl(Ld,n),h=BR(Ld,n),x=pB(Ld,n),[f,m]=v.useState(null),p=Ms(s,N=>m(N),h.onItemTextChange,N=>{var S;return(S=d.itemTextRefCallback)==null?void 0:S.call(d,N,h.value,h.disabled)}),u=f==null?void 0:f.textContent,j=v.useMemo(()=>e.jsx("option",{value:h.value,disabled:h.disabled,children:u},h.value),[h.disabled,h.value,u]),{onNativeOptionAdd:g,onNativeOptionRemove:y}=x;return Zn(()=>(g(j),()=>y(j)),[g,y,j]),e.jsxs(e.Fragment,{children:[e.jsx(ps.span,{id:h.textId,...l,ref:p}),h.isSelected&&c.valueNode&&!c.valueNodeHasChildren?cu.createPortal(l.children,c.valueNode):null]})});qR.displayName=Ld;var zR="SelectItemIndicator",UR=v.forwardRef((t,s)=>{const{__scopeSelect:n,...r}=t;return BR(zR,n).isSelected?e.jsx(ps.span,{"aria-hidden":!0,...r,ref:s}):null});UR.displayName=zR;var Nv="SelectScrollUpButton",VR=v.forwardRef((t,s)=>{const n=Gl(Nv,t.__scopeSelect),r=Ib(Nv,t.__scopeSelect),[a,l]=v.useState(!1),c=Ms(s,r.onScrollButtonChange);return Zn(()=>{if(n.viewport&&n.isPositioned){let d=function(){const x=h.scrollTop>0;l(x)};const h=n.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),a?e.jsx(WR,{...t,ref:c,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=n;d&&h&&(d.scrollTop=d.scrollTop-h.offsetHeight)}}):null});VR.displayName=Nv;var wv="SelectScrollDownButton",HR=v.forwardRef((t,s)=>{const n=Gl(wv,t.__scopeSelect),r=Ib(wv,t.__scopeSelect),[a,l]=v.useState(!1),c=Ms(s,r.onScrollButtonChange);return Zn(()=>{if(n.viewport&&n.isPositioned){let d=function(){const x=h.scrollHeight-h.clientHeight,f=Math.ceil(h.scrollTop)h.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),a?e.jsx(WR,{...t,ref:c,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=n;d&&h&&(d.scrollTop=d.scrollTop+h.offsetHeight)}}):null});HR.displayName=wv;var WR=v.forwardRef((t,s)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,l=Gl("SelectScrollButton",n),c=v.useRef(null),d=jf(n),h=v.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return v.useEffect(()=>()=>h(),[h]),Zn(()=>{var f;const x=d().find(m=>m.ref.current===document.activeElement);(f=x==null?void 0:x.ref.current)==null||f.scrollIntoView({block:"nearest"})},[d]),e.jsx(ps.div,{"aria-hidden":!0,...a,ref:s,style:{flexShrink:0,...a.style},onPointerDown:Vt(a.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(r,50))}),onPointerMove:Vt(a.onPointerMove,()=>{var x;(x=l.onItemLeave)==null||x.call(l),c.current===null&&(c.current=window.setInterval(r,50))}),onPointerLeave:Vt(a.onPointerLeave,()=>{h()})})}),AB="SelectSeparator",kB=v.forwardRef((t,s)=>{const{__scopeSelect:n,...r}=t;return e.jsx(ps.div,{"aria-hidden":!0,...r,ref:s})});kB.displayName=AB;var Sv="SelectArrow",RB=v.forwardRef((t,s)=>{const{__scopeSelect:n,...r}=t,a=Nf(n),l=Wl(Sv,n),c=Gl(Sv,n);return l.open&&c.position==="popper"?e.jsx(rf,{...a,...r,ref:s}):null});RB.displayName=Sv;var EB="SelectBubbleInput",GR=v.forwardRef(({__scopeSelect:t,value:s,...n},r)=>{const a=v.useRef(null),l=Ms(r,a),c=Wv(s);return v.useEffect(()=>{const d=a.current;if(!d)return;const h=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(h,"value").set;if(c!==s&&f){const m=new Event("change",{bubbles:!0});f.call(d,s),d.dispatchEvent(m)}},[c,s]),e.jsx(ps.select,{...n,style:{...jR,...n.style},ref:l,defaultValue:s})});GR.displayName=EB;function KR(t){return t===""||t===void 0}function YR(t){const s=dr(t),n=v.useRef(""),r=v.useRef(0),a=v.useCallback(c=>{const d=n.current+c;s(d),(function h(x){n.current=x,window.clearTimeout(r.current),x!==""&&(r.current=window.setTimeout(()=>h(""),1e3))})(d)},[s]),l=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,l]}function ZR(t,s,n){const a=s.length>1&&Array.from(s).every(x=>x===s[0])?s[0]:s,l=n?t.indexOf(n):-1;let c=DB(t,Math.max(l,0));a.length===1&&(c=c.filter(x=>x!==n));const h=c.find(x=>x.textValue.toLowerCase().startsWith(a.toLowerCase()));return h!==n?h:void 0}function DB(t,s){return t.map((n,r)=>t[(s+r)%t.length])}var TB=wR,PB=CR,_B=kR,OB=RR,IB=ER,LB=DR,MB=OR,FB=LR,BB=FR,$B=$R,qB=qR,zB=UR,UB=VR,VB=HR;function wt({...t}){return e.jsx(TB,{"data-slot":"select",...t})}function Jw({...t}){return e.jsx(FB,{"data-slot":"select-group",...t})}function St({...t}){return e.jsx(_B,{"data-slot":"select-value",...t})}function Ct({className:t,size:s="default",children:n,...r}){return e.jsxs(PB,{"data-slot":"select-trigger","data-size":s,className:Pt("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-input-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r,children:[n,e.jsx(OB,{asChild:!0,children:e.jsx(la,{className:"size-4 opacity-50"})})]})}function At({className:t,children:s,position:n="popper",...r}){return e.jsx(IB,{children:e.jsxs(LB,{"data-slot":"select-content",className:Pt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[e.jsx(WB,{}),e.jsx(MB,{className:Pt("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:s}),e.jsx(GB,{})]})})}function HB({className:t,...s}){return e.jsx(BB,{"data-slot":"select-label",className:Pt("text-muted-foreground px-2 py-1.5 text-xs",t),...s})}function Pe({className:t,children:s,...n}){return e.jsxs($B,{"data-slot":"select-item",className:Pt("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(zB,{children:e.jsx(Bn,{className:"size-4"})})}),e.jsx(qB,{children:s})]})}function WB({className:t,...s}){return e.jsx(UB,{"data-slot":"select-scroll-up-button",className:Pt("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx($d,{className:"size-4"})})}function GB({className:t,...s}){return e.jsx(VB,{"data-slot":"select-scroll-down-button",className:Pt("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(la,{className:"size-4"})})}function ks({className:t,...s}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:Pt("w-full caption-bottom text-sm",t),...s})})}function Rs({className:t,...s}){return e.jsx("thead",{"data-slot":"table-header",className:Pt("[&_tr]:border-b",t),...s})}function Es({className:t,...s}){return e.jsx("tbody",{"data-slot":"table-body",className:Pt("[&_tr:last-child]:border-0",t),...s})}function ct({className:t,...s}){return e.jsx("tr",{"data-slot":"table-row",className:Pt("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...s})}function me({className:t,...s}){return e.jsx("th",{"data-slot":"table-head",className:Pt("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function de({className:t,...s}){return e.jsx("td",{"data-slot":"table-cell",className:Pt("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}const QR={getOnboardingPayments:async()=>{var s,n;const t=await Te.getOnboardingPayments();if(!t.ok)throw new Error(((s=t.data)==null?void 0:s.message)||"Failed to fetch onboarding payments");return((n=t.data)==null?void 0:n.payments)||[]},getFnFSettlements:async()=>{var s,n;const t=await Te.getFnFSettlements();if(!t.ok)throw new Error(((s=t.data)==null?void 0:s.message)||"Failed to fetch F&F settlements");return((n=t.data)==null?void 0:n.settlements)||[]},getFnFSettlementById:async t=>{var n,r;const s=await Te.getFnFSettlementById(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch F&F details");return(r=s.data)==null?void 0:r.fnf},updatePayment:async(t,s)=>{var r;const n=await Te.updatePayment(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to update payment");return n.data},calculateFnF:async t=>{var n;const s=await Te.calculateFnF(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to calculate F&F");return s.data},addLineItem:async(t,s)=>{var r;const n=await Te.addLineItem(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to add line item");return n.data},updateFnF:async(t,s)=>{var r;const n=await Te.updateFnF(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to update F&F settlement");return n.data}};function KB({onNavigate:t,onViewPaymentDetails:s,onViewAuditDetails:n,onViewFnFDetails:r}){var D,O,V,K;const[a,l]=v.useState([]),[c,d]=v.useState([]),[h,x]=v.useState([]),[f,m]=v.useState(!0);v.useEffect(()=>{p()},[]);const p=async()=>{try{m(!0);const[Y,U]=await Promise.all([QR.getFnFSettlements(),ds.getApplications()]),X=U.data||[],ne=[];X.forEach(re=>{const ge=re.overallStatus||re.status,ve=["Payment Pending","Security Details","LOI In Progress","LOI Issued","LOA Pending","Dealer Code Generation","LOA_APPROVAL"].includes(ge),Se=re.securityDeposits||[];Se.length>0?Se.forEach(We=>{ne.push({...We,application:re,paymentStatus:We.status,paymentType:We.depositType,amount:We.amount,id:We.id,applicationId:re.applicationId||re.id,createdAt:We.createdAt,verificationDate:We.verifiedAt})}):ve&&(["Payment Pending","Security Details","LOI In Progress"].includes(ge)?ne.push({id:`virtual-${re.id}-sd`,applicationId:re.applicationId||re.id,application:re,paymentStatus:"Pending",paymentType:"SECURITY_DEPOSIT",amount:5e5,createdAt:re.updatedAt,isVirtual:!0}):["LOA Pending","Dealer Code Generation","LOA_APPROVAL"].includes(ge)&&ne.push({id:`virtual-${re.id}-ff`,applicationId:re.applicationId||re.id,application:re,paymentStatus:"Pending",paymentType:"FIRST_FILL",amount:15e5,createdAt:re.updatedAt,isVirtual:!0}))}),l(ne),d(Y);const oe=X.filter(re=>re.status==="FDD_VERIFICATION"||re.overallStatus==="FDD Verification"||re.currentStage==="FDD");x(oe)}catch(Y){console.error("Fetch error:",Y),ee.error("Failed to load dashboard data")}finally{m(!1)}},[u,j]=v.useState(!1),[g,y]=v.useState(!1),[N,S]=v.useState(null),[C,w]=v.useState([]),[R,P]=v.useState({department:"",description:"",type:"receivable",amount:""}),[A,I]=v.useState(""),$=()=>{const Y=C.filter(ne=>ne.type==="receivable").reduce((ne,oe)=>ne+oe.amount,0),U=C.filter(ne=>ne.type==="payable").reduce((ne,oe)=>ne+oe.amount,0),X=U-Y;return{totalReceivable:Y,totalPayable:U,netAmount:X}},T=async()=>{if(C.length===0){ee.error("Please add at least one line item");return}if(!A){ee.error("Please add final remarks");return}try{m(!0),ee.success("Finance summary submitted successfully"),j(!1),S(null),w([]),I(""),p()}catch{ee.error("Failed to submit summary")}finally{m(!1)}},E=Y=>{const U=String(Y||"").trim().toLowerCase();return U==="paid"||U==="verified"},_=a.filter(Y=>!E(Y.paymentStatus)),M=a.filter(Y=>E(Y.paymentStatus)),q=c.filter(Y=>Y.status==="Initiated"||Y.status==="Calculated"),G=c.filter(Y=>Y.status==="Completed"||Y.status==="Cleared"),Z=()=>{if(!R.department||!R.description||!R.amount){ee.error("Please fill in all line item fields");return}const Y={id:Date.now().toString(),department:R.department,description:R.description,type:R.type,amount:parseFloat(R.amount)};w([...C,Y]),P({department:"",description:"",type:"receivable",amount:""}),ee.success("Line item added")},W=Y=>{w(C.filter(U=>U.id!==Y)),ee.info("Line item removed")},{totalReceivable:z,totalPayable:F,netAmount:B}=$();return f?e.jsxs("div",{className:"flex items-center justify-center p-20 text-amber-600",children:[e.jsx(Js,{className:"w-8 h-8 animate-spin mr-3"}),e.jsx("span",{children:"Loading Finance Data..."})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl mb-2",children:"Finance Dashboard"}),e.jsx("p",{className:"text-slate-600",children:"Verify payments and create financial settlement summaries"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-3",children:[e.jsxs(Le,{className:"cursor-pointer hover:shadow-lg transition-shadow border-amber-200 bg-amber-50/20",onClick:()=>{h.length>0&&n?n(h[0].applicationId||h[0].id):t==null||t("finance-onboarding")},children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{className:"text-amber-600 font-bold",children:"Pending Audits"}),e.jsx(nt,{className:"text-3xl text-amber-600",children:h.length})]}),e.jsxs(Me,{children:[e.jsx("p",{className:"text-slate-600 text-xs font-medium",children:"FDD Sign-offs"}),e.jsx(se,{variant:"link",className:"p-0 h-auto text-amber-600 mt-2 text-xs",children:"Review Now →"})]})]}),e.jsxs(Le,{className:"cursor-pointer hover:shadow-lg transition-shadow border-yellow-200",onClick:()=>t==null?void 0:t("finance-onboarding"),children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Pending Verification"}),e.jsx(nt,{className:"text-3xl text-yellow-600",children:_.length})]}),e.jsxs(Me,{children:[e.jsx("p",{className:"text-slate-600",children:"Onboarding Payments"}),e.jsx(se,{variant:"link",className:"p-0 h-auto text-amber-600 mt-2",children:"View All →"})]})]}),e.jsxs(Le,{className:"cursor-pointer hover:shadow-lg transition-shadow border-green-200",onClick:()=>t==null?void 0:t("finance-onboarding"),children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Verified"}),e.jsx(nt,{className:"text-3xl text-green-600",children:M.length})]}),e.jsxs(Me,{children:[e.jsx("p",{className:"text-slate-600",children:"Total Validated"}),e.jsx(se,{variant:"link",className:"p-0 h-auto text-amber-600 mt-2",children:"View All →"})]})]}),e.jsxs(Le,{className:"cursor-pointer hover:shadow-lg transition-shadow border-orange-200",onClick:()=>t==null?void 0:t("finance-fnf"),children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Pending F&F Summary"}),e.jsx(nt,{className:"text-3xl text-orange-600",children:q.length})]}),e.jsxs(Me,{children:[e.jsx("p",{className:"text-slate-600",children:"Offboarding Cases"}),e.jsx(se,{variant:"link",className:"p-0 h-auto text-amber-600 mt-2",children:"View All →"})]})]}),e.jsxs(Le,{className:"cursor-pointer hover:shadow-lg transition-shadow border-green-200",onClick:()=>t==null?void 0:t("finance-fnf"),children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"F&F Completed"}),e.jsx(nt,{className:"text-3xl text-green-600",children:G.length})]}),e.jsxs(Me,{children:[e.jsx("p",{className:"text-slate-600",children:"Settlements Done"}),e.jsx(se,{variant:"link",className:"p-0 h-auto text-amber-600 mt-2",children:"View All →"})]})]})]}),e.jsxs(Pn,{defaultValue:"onboarding",className:"w-full",children:[e.jsxs(_n,{className:"grid w-full grid-cols-2",children:[e.jsxs(Wt,{value:"onboarding",children:[e.jsx(oa,{className:"w-4 h-4 mr-2"}),"Onboarding"]}),e.jsxs(Wt,{value:"fnf",children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"F&F Settlement"]})]}),e.jsx(Gt,{value:"onboarding",className:"space-y-4",children:e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Payment Verification"}),e.jsx(Zt,{children:"Verify dealer advance payments for onboarding applications"})]}),e.jsx(Me,{children:e.jsxs(Pn,{defaultValue:"pending",className:"w-full",children:[e.jsxs(_n,{children:[e.jsxs(Wt,{value:"pending",children:["Pending (",_.length,")"]}),e.jsxs(Wt,{value:"verified",children:["Verified (",M.length,")"]})]}),e.jsx(Gt,{value:"pending",className:"mt-6",children:e.jsxs("div",{className:"space-y-4",children:[_.map(Y=>{var U,X;return e.jsx(Le,{className:"border-yellow-200 bg-yellow-50/30",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("h3",{className:"text-lg font-bold",children:((U=Y.application)==null?void 0:U.applicationId)||"N/A"}),e.jsx(Ae,{className:"bg-yellow-100 text-yellow-700 border-yellow-300",children:Y.paymentStatus})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Applicant Name"}),e.jsx("p",{className:"font-medium",children:(X=Y.application)==null?void 0:X.applicantName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Type"}),e.jsx("p",{children:Y.paymentType==="SECURITY_DEPOSIT"?"Security Deposit":Y.paymentType==="FIRST_FILL"?"First Fill":Y.paymentType})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Amount"}),e.jsxs("p",{className:"text-amber-700 font-bold",children:["₹",parseFloat(Y.amount).toLocaleString("en-IN")]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Created On"}),e.jsx("p",{children:Ht(Y.createdAt)})]})]})]}),e.jsxs("div",{className:"ml-4 flex flex-col gap-2",children:[e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>{s&&s(Y.applicationId||Y.id)},children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"View Details"]}),e.jsxs(se,{size:"sm",className:"bg-green-600 hover:bg-green-700 font-bold",onClick:()=>{s&&s(Y.applicationId||Y.id)},children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"}),"Verify Payment"]})]})]})})},Y.id)}),_.length===0&&e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(Ys,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No pending payment verifications"})]})]})}),e.jsx(Gt,{value:"verified",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:M.map(Y=>{var U,X;return e.jsx(Le,{className:"border-green-200 bg-green-50/30",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("h3",{className:"text-lg font-bold",children:((U=Y.application)==null?void 0:U.applicationId)||"N/A"}),e.jsx(Ae,{className:"bg-green-100 text-green-700 border-green-300",children:Y.paymentStatus})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Applicant Name"}),e.jsx("p",{className:"font-medium",children:(X=Y.application)==null?void 0:X.applicantName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Type"}),e.jsx("p",{children:Y.paymentType==="SECURITY_DEPOSIT"?"Security Deposit":Y.paymentType==="FIRST_FILL"?"First Fill":Y.paymentType})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Amount"}),e.jsxs("p",{className:"text-green-700 font-bold",children:["₹",parseFloat(Y.amount).toLocaleString("en-IN")]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Verified On"}),e.jsx("p",{children:Y.verificationDate?Ht(Y.verificationDate):"N/A"})]})]})]}),e.jsx("div",{className:"ml-4",children:e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>{s&&s(Y.applicationId||Y.id)},children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"View Details"]})})]})})},Y.id)})})})]})})]})}),e.jsx(Gt,{value:"fnf",className:"space-y-4",children:e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"F&F Financial Summary"}),e.jsx(Zt,{children:"Create financial settlement summaries for resignation and termination cases"})]}),e.jsx(Me,{children:e.jsxs(Pn,{defaultValue:"pending",className:"w-full",children:[e.jsxs(_n,{children:[e.jsxs(Wt,{value:"pending",children:["Pending Summary (",q.length,")"]}),e.jsxs(Wt,{value:"completed",children:["Completed (",G.length,")"]})]}),e.jsx(Gt,{value:"pending",className:"mt-6",children:e.jsxs("div",{className:"space-y-4",children:[q.map(Y=>{var U,X,ne,oe,re,ge,ve;return e.jsx(Le,{className:"border-orange-200 bg-orange-50/30",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("h3",{className:"text-lg font-bold",children:((U=Y.resignation)==null?void 0:U.resignationId)||Y.id}),e.jsx(Ae,{variant:"outline",children:Y.resignation?"Resignation":Y.terminationRequest?"Termination":"General"}),e.jsx(Ae,{className:"bg-orange-100 text-orange-700 border-orange-300",children:Y.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm mb-3",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm mb-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 font-medium text-[10px] uppercase tracking-wider mb-1",children:"Dealer Name"}),e.jsx("p",{className:"font-semibold text-slate-900",children:((ne=(X=Y.outlet)==null?void 0:X.dealer)==null?void 0:ne.fullName)||((oe=Y.outlet)==null?void 0:oe.name)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 font-medium text-[10px] uppercase tracking-wider mb-1",children:"Dealer Code"}),e.jsx("p",{className:"font-mono text-xs font-bold text-blue-600",children:((re=Y.outlet)==null?void 0:re.code)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 font-medium text-[10px] uppercase tracking-wider mb-1",children:"Location"}),e.jsxs("p",{className:"text-slate-900",children:[((ge=Y.outlet)==null?void 0:ge.city)||"N/A",", ",((ve=Y.outlet)==null?void 0:ve.state)||""]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm bg-white/50 p-2 rounded-lg border border-slate-100",children:[e.jsx(Ys,{className:"w-4 h-4 text-emerald-500"}),e.jsxs("span",{className:"text-slate-600 font-medium",children:[e.jsx("span",{className:"text-emerald-600 font-bold",children:(Y.clearances||[]).filter(Se=>Se.status==="NOC Submitted"||Se.status==="Dues Pending").length}),"/16 Departments Cleared"]})]})]})]}),e.jsxs("div",{className:"ml-4 flex flex-col gap-2",children:[e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>{S(Y),y(!0)},children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"View Details"]}),e.jsxs(se,{size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:()=>{S(Y),w([]),I(""),j(!0)},children:[e.jsx(O2,{className:"w-4 h-4 mr-2"}),"Create Summary"]})]})]})})},Y.id)}),q.length===0&&e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(fs,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No F&F cases pending financial summary"})]})]})}),e.jsx(Gt,{value:"completed",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:G.map(Y=>e.jsx(Le,{className:"border-green-200 bg-green-50/30",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("h3",{className:"text-lg font-bold",children:Y.id}),e.jsx(Ae,{variant:"outline",children:Y.type}),e.jsx(Ae,{className:"bg-green-100 text-green-700 border-green-300",children:Y.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{className:"font-medium",children:Y.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Code"}),e.jsx("p",{children:Y.dealerCode})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Net Settlement"}),e.jsxs("p",{className:Y.netAmount&&Y.netAmount>=0?"text-green-700":"text-red-700",children:["₹",Y.netAmount?Math.abs(Y.netAmount).toLocaleString("en-IN"):"0"]}),e.jsx("p",{className:"text-xs text-slate-500",children:Y.netAmount&&Y.netAmount>=0?"Payable to Dealer":"Receivable from Dealer"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Completed On"}),e.jsx("p",{children:Y.completedOn})]})]})]}),e.jsx("div",{className:"ml-4",children:e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>{r&&r(Y.id)},children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"View Details"]})})]})})},Y.id))})})]})})]})})]}),e.jsx(os,{open:u,onOpenChange:j,children:e.jsxs(ls,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Create Financial Settlement Summary"}),e.jsxs(vs,{children:[((D=N==null?void 0:N.resignation)==null?void 0:D.resignationId)||(N==null?void 0:N.id)," - ",N==null?void 0:N.dealerName," (",N==null?void 0:N.dealerCode,")"]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border rounded-lg p-4 bg-slate-50",children:[e.jsx("h3",{className:"text-sm font-bold mb-4",children:"Add Financial Line Item"}),e.jsxs("div",{className:"grid grid-cols-12 gap-3",children:[e.jsxs("div",{className:"col-span-3",children:[e.jsx(ce,{className:"text-xs",children:"Department"}),e.jsx(ot,{placeholder:"e.g., Warranty",value:R.department,onChange:Y=>P({...R,department:Y.target.value})})]}),e.jsxs("div",{className:"col-span-4",children:[e.jsx(ce,{className:"text-xs",children:"Description"}),e.jsx(ot,{placeholder:"e.g., Pending warranty claims",value:R.description,onChange:Y=>P({...R,description:Y.target.value})})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(ce,{className:"text-xs",children:"Type"}),e.jsxs(wt,{value:R.type,onValueChange:Y=>P({...R,type:Y}),children:[e.jsx(Ct,{children:e.jsx(St,{})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"receivable",children:"Receivable"}),e.jsx(Pe,{value:"payable",children:"Payable"})]})]})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(ce,{className:"text-xs",children:"Amount (₹)"}),e.jsx(ot,{type:"number",placeholder:"0",value:R.amount,onChange:Y=>P({...R,amount:Y.target.value})})]}),e.jsx("div",{className:"col-span-1 flex items-end",children:e.jsx(se,{size:"sm",onClick:Z,className:"w-full bg-amber-600 hover:bg-amber-700",children:e.jsx(cn,{className:"w-4 h-4"})})})]})]}),C.length>0&&e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Description"}),e.jsx(me,{className:"text-center",children:"Type"}),e.jsx(me,{className:"text-right",children:"Amount"}),e.jsx(me,{className:"w-16"})]})}),e.jsx(Es,{children:C.map(Y=>e.jsxs(ct,{children:[e.jsx(de,{children:Y.department}),e.jsx(de,{children:Y.description}),e.jsx(de,{className:"text-center",children:e.jsx(Ae,{className:Y.type==="receivable"?"bg-red-100 text-red-700 border-red-200":"bg-green-100 text-green-700 border-green-200",children:Y.type==="receivable"?"Receivable":"Payable"})}),e.jsxs(de,{className:`text-right font-medium ${Y.type==="receivable"?"text-red-700":"text-green-700"}`,children:["₹",Y.amount.toLocaleString("en-IN")]}),e.jsx(de,{children:e.jsx(se,{size:"sm",variant:"ghost",onClick:()=>W(Y.id),children:e.jsx(Gn,{className:"w-4 h-4 text-red-600"})})})]},Y.id))})]})}),C.length>0&&e.jsxs("div",{className:"border rounded-lg p-4 bg-slate-900 text-white",children:[e.jsx("h3",{className:"text-sm font-bold mb-4",children:"Financial Settlement Summary"}),e.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-400 uppercase tracking-wider mb-1",children:"Total Payable"}),e.jsxs("p",{className:"text-3xl font-bold text-green-400",children:["₹",F.toLocaleString("en-IN")]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-400 uppercase tracking-wider mb-1",children:"Total receivable"}),e.jsxs("p",{className:"text-3xl font-bold text-red-400",children:["₹",z.toLocaleString("en-IN")]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-400 uppercase tracking-wider mb-1",children:"Net Settlement"}),e.jsxs("p",{className:`text-3xl font-bold ${B>=0?"text-green-400":"text-red-400"}`,children:["₹",Math.abs(B).toLocaleString("en-IN")]}),e.jsx("p",{className:"text-xs text-slate-400 mt-1 italic",children:B>=0?"Payable to Dealer":"Receivable from Dealer"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"font-bold",children:["Summary Remarks ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(Fs,{placeholder:"Add your final reconciliation remarks here...",rows:4,value:A,onChange:Y=>I(Y.target.value)})]})]}),e.jsxs(rn,{className:"border-t pt-4",children:[e.jsx(se,{variant:"outline",onClick:()=>j(!1),children:"Discard"}),e.jsxs(se,{className:"bg-green-600 hover:bg-green-700",onClick:T,disabled:C.length===0,children:[e.jsx(Yi,{className:"w-4 h-4 mr-2"}),"Finalize & Submit Summary"]})]})]})}),e.jsx(os,{open:g,onOpenChange:y,children:e.jsxs(ls,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Full Settlement Details"}),e.jsxs(vs,{children:[((O=N==null?void 0:N.resignation)==null?void 0:O.resignationId)||(N==null?void 0:N.id)," - ",N==null?void 0:N.dealerName]})]}),N&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(Le,{className:"bg-slate-50 border-none",children:e.jsxs(Me,{className:"pt-6 grid grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-500 uppercase tracking-wider mb-1",children:"Dealer Code"}),e.jsx("p",{className:"text-lg font-bold",children:((V=N.outlet)==null?void 0:V.code)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-500 uppercase tracking-wider mb-1",children:"Location"}),e.jsx("p",{className:"text-lg font-bold",children:((K=N.outlet)==null?void 0:K.city)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-500 uppercase tracking-wider mb-1",children:"Current Status"}),e.jsx(Ae,{variant:"outline",className:"bg-amber-100 text-amber-700 border-amber-200",children:N.status})]})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(Le,{className:"border-blue-100",children:[e.jsx(tt,{className:"bg-blue-50/50 pb-2",children:e.jsxs(nt,{className:"text-sm font-bold flex items-center gap-2",children:[e.jsx(Wi,{className:"w-4 h-4 text-blue-600"}),"Receivables Check"]})}),e.jsxs(Me,{className:"pt-4 space-y-3",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-500",children:"Security Deposit Credits"}),e.jsxs("span",{className:"font-bold text-slate-900",children:["₹",parseFloat(N.totalPayables||0).toLocaleString("en-IN")]})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-500",children:"Other Payable Credits"}),e.jsx("span",{className:"font-bold text-slate-900",children:"₹0"})]}),e.jsxs("div",{className:"border-t pt-2 flex justify-between font-bold text-blue-700",children:[e.jsx("span",{children:"Total Payables"}),e.jsxs("span",{children:["₹",parseFloat(N.totalPayables||0).toLocaleString("en-IN")]})]})]})]}),e.jsxs(Le,{className:"border-red-100 shadow-sm",children:[e.jsx(tt,{className:"bg-red-50/30 pb-2 border-b border-red-50",children:e.jsxs(nt,{className:"text-sm font-bold flex items-center gap-2 text-red-700",children:[e.jsx(Po,{className:"w-4 h-4"}),"Receivables Check"]})}),e.jsxs(Me,{className:"pt-4 space-y-3",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-500",children:"Departmental Dues (Recoverable)"}),e.jsxs("span",{className:"font-bold text-red-600",children:["₹",parseFloat(N.totalReceivables||0).toLocaleString("en-IN")]})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-500",children:"Outstanding Invoices"}),e.jsx("span",{className:"font-bold text-slate-900",children:"₹0"})]}),e.jsxs("div",{className:"border-t pt-2 flex justify-between font-bold text-red-700",children:[e.jsx("span",{children:"Total Recoveries"}),e.jsxs("span",{children:["₹",parseFloat(N.totalReceivables||0).toLocaleString("en-IN")]})]})]})]})]}),e.jsxs("div",{className:"p-5 bg-slate-900 text-white rounded-xl flex items-center justify-between shadow-lg",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`p-3 rounded-lg ${parseFloat(N.netAmount||0)>=0?"bg-emerald-500/20":"bg-rose-500/20"}`,children:e.jsx(oa,{className:`w-6 h-6 ${parseFloat(N.netAmount||0)>=0?"text-emerald-400":"text-rose-400"}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-400 uppercase font-bold tracking-widest mb-1",children:"Final Net Financial Position"}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("p",{className:`text-3xl font-bold tracking-tight ${parseFloat(N.netAmount||0)>=0?"text-emerald-400":"text-rose-400"}`,children:["₹",Math.abs(parseFloat(N.netAmount||0)).toLocaleString("en-IN")]}),e.jsxs("span",{className:"text-xs font-medium text-slate-400",children:["(",parseFloat(N.netAmount||0)>=0?"Payable to Dealer":"Recoverable from Dealer",")"]})]})]})]}),e.jsx(se,{className:"bg-blue-600 hover:bg-blue-500 px-6 font-bold shadow-md transition-all active:scale-95",children:"Generate PDF Summary"})]})]}),e.jsx(rn,{children:e.jsx(se,{onClick:()=>y(!1),children:"Close Overview"})})]})})]})}const Il={getDashboardData:async()=>{var t;try{const s=await Te.getDealerDashboard();return((t=s.data)==null?void 0:t.data)||s.data}catch(s){throw console.error("Get dealer dashboard error:",s),s}},getConstitutionalChanges:async()=>{try{return(await Te.getConstitutionalChanges()).data}catch(t){throw console.error("Get constitutional changes error:",t),t}},submitConstitutionalChange:async t=>{try{return(await Te.createConstitutionalChange(t)).data}catch(s){throw console.error("Submit constitutional change error:",s),s}},getRelocationRequests:async()=>{try{return(await Te.getRelocationRequests()).data}catch(t){throw console.error("Get relocation requests error:",t),t}},submitRelocationRequest:async t=>{try{return(await Te.createRelocationRequest(t)).data}catch(s){throw console.error("Submit relocation request error:",s),s}}};function YB({currentUser:t,onNavigate:s}){var u,j;const[n,r]=v.useState(!0),[a,l]=v.useState(null);if(v.useEffect(()=>{(async()=>{try{const y=await Il.getDashboardData();l(y)}catch(y){console.error("Failed to fetch dashboard:",y)}finally{r(!1)}})()},[]),n)return e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px]",children:[e.jsx(ss,{className:"w-10 h-10 text-amber-600 animate-spin mb-4"}),e.jsx("p",{className:"text-slate-600",children:"Loading your dashboard..."})]});const c=a||{},d=c.profile||{},h=c.stats||{constitutional:0,relocation:0,total:0},x=c.recentRequests||[],f=((u=c.outlets)==null?void 0:u[0])||{},m=[{title:"Constitutional Changes",value:h.constitutional,icon:Ki,color:"bg-blue-500",change:"Active Requests",onClick:()=>s("dealer-constitutional")},{title:"Relocation Requests",value:h.relocation,icon:Er,color:"bg-amber-500",change:"Active Requests",onClick:()=>s("dealer-relocation")},{title:"My Outlets",value:((j=c.outlets)==null?void 0:j.length)||0,icon:cI,color:"bg-purple-500",change:"Registered",onClick:()=>{}},{title:"Total Requests",value:h.total,icon:Wi,color:"bg-green-500",change:"All time",onClick:()=>{}}],p=[{title:"Constitutional Change",description:"Request change in business structure",icon:Ki,color:"bg-blue-50 hover:bg-blue-100 border-blue-200",textColor:"text-blue-700",onClick:()=>s("dealer-constitutional")},{title:"Request Relocation",description:"Move dealership to new location",icon:Er,color:"bg-amber-50 hover:bg-amber-100 border-amber-200",textColor:"text-amber-700",onClick:()=>s("dealer-relocation")}];return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-gradient-to-r from-amber-500 to-amber-600 rounded-lg p-6 text-white",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-white mb-2",children:["Welcome back, ",d.name||(t==null?void 0:t.name),"!"]}),e.jsxs("p",{className:"text-amber-100",children:["Dealer Code: ",d.dealerCode," • ",d.businessName]}),e.jsxs("p",{className:"text-amber-100 text-sm mt-1",children:[f.name," • ",f.location]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-white",children:"Active Dealership"}),e.jsxs(Ae,{className:"bg-green-500 text-white border-0 mt-2",children:[e.jsx(Ys,{className:"w-3 h-3 mr-1"}),"Operational"]})]})]})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:m.map((g,y)=>{const N=g.icon;return e.jsxs(Le,{className:"cursor-pointer hover:shadow-lg transition-shadow",onClick:g.onClick,children:[e.jsxs(tt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(nt,{className:"text-sm",children:g.title}),e.jsx("div",{className:`${g.color} p-2 rounded-lg`,children:e.jsx(N,{className:"h-4 w-4 text-white"})})]}),e.jsxs(Me,{children:[e.jsx("div",{className:"text-slate-900 text-2xl",children:g.value}),e.jsx("p",{className:"text-xs text-slate-600 mt-1",children:g.change})]})]},y)})}),e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Quick Actions"}),e.jsx(Zt,{children:"Submit new requests and manage your dealership"})]}),e.jsx(Me,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:p.map((g,y)=>{const N=g.icon;return e.jsx("button",{onClick:g.onClick,className:`${g.color} border-2 rounded-lg p-4 text-left transition-all`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`${g.textColor} p-2 bg-white rounded-lg`,children:e.jsx(N,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:`${g.textColor} mb-1`,children:g.title}),e.jsx("p",{className:"text-slate-600 text-sm",children:g.description})]})]})},y)})})})]}),e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"My Recent Requests"}),e.jsx(Zt,{children:"Track the status of your submitted requests"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-3",children:x.map(g=>e.jsxs("div",{className:"flex items-center justify-between p-4 border border-slate-200 rounded-lg hover:bg-slate-50 transition-colors",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-slate-900",children:g.id}),e.jsx(Ae,{variant:"outline",className:"text-xs",children:g.type})]}),e.jsx("p",{className:"text-slate-600 text-sm",children:g.title}),e.jsxs("p",{className:"text-slate-500 text-xs mt-1",children:["Submitted on ",g.date]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ae,{className:`border ${g.color}`,children:g.status}),e.jsx(se,{variant:"ghost",size:"sm",children:"View"})]})]},g.id))})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(Js,{className:"w-5 h-5 text-amber-600"}),"Important Reminders"]})}),e.jsx(Me,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ks,{className:"w-4 h-4 text-amber-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 text-sm",children:"GST Filing Due"}),e.jsx("p",{className:"text-slate-600 text-xs",children:"Due by Jan 15, 2026"})]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ks,{className:"w-4 h-4 text-amber-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 text-sm",children:"Inventory Audit Scheduled"}),e.jsx("p",{className:"text-slate-600 text-xs",children:"Jan 20, 2026"})]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ys,{className:"w-4 h-4 text-green-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 text-sm",children:"Compliance Report Submitted"}),e.jsx("p",{className:"text-slate-600 text-xs",children:"Jan 2, 2026"})]})]})]})})]}),e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(da,{className:"w-5 h-5 text-blue-600"}),"Support & Help"]})}),e.jsx(Me,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 text-sm mb-1",children:"Regional Manager"}),e.jsx("p",{className:"text-slate-600 text-xs",children:"Rajesh Kumar - +91 98765 43210"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 text-sm mb-1",children:"Zonal Business Head"}),e.jsx("p",{className:"text-slate-600 text-xs",children:"Priya Sharma - +91 98765 43211"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 text-sm mb-1",children:"Support Email"}),e.jsx("p",{className:"text-slate-600 text-xs",children:"dealer.support@royalenfield.com"})]}),e.jsx(se,{variant:"outline",className:"w-full mt-2",children:"Contact Support"})]})})]})]})]})}function ZB({id:t,onBack:s}){var M,q;const n=["PAN Card","GST Certificate","Aadhaar Card","Security Deposit Receipt","First Fill Receipt","Partnership Deed","LLP Agreement","Certificate of Incorporation","MOA","AOA","Firm Registration","Rental Agreement","Property Documents","Nodal Agreement","Cancelled Check","LOI Acknowledgement","Architecture Blueprint","Site Plan","Other"],[r,a]=v.useState(null),[l,c]=v.useState(!0),[d,h]=v.useState([]),[x,f]=v.useState(""),[m,p]=v.useState(null),[u,j]=v.useState(!1),[g,y]=v.useState(!1),N={panNumber:"",gstNumber:"",registeredAddress:"",bankName:"",accountNumber:"",ifscCode:"",branchName:"",accountHolderName:""},[S,C]=v.useState(N),[w,R]=v.useState(N),P=JSON.stringify(S)!==JSON.stringify(w),A=new Set(d.map(G=>String(G.documentType||"").trim().toLowerCase())),I=x?A.has(x.toLowerCase()):!1;v.useEffect(()=>{$()},[t]);const $=async()=>{var G,Z;c(!0);try{const[W,z]=await Promise.all([Te.getApplicationById(t),Te.getDocuments(t)]);if((G=W.data)!=null&&G.success){const F=W.data.data,B={panNumber:F.panNumber||"",gstNumber:F.gstNumber||"",registeredAddress:F.registeredAddress||F.address||"",bankName:F.bankName||"",accountNumber:F.accountNumber||"",ifscCode:F.ifscCode||"",branchName:F.branchName||"",accountHolderName:F.accountHolderName||F.applicantName||""};a(F),C(B),R(B)}((Z=z.data)!=null&&Z.success||z.ok)&&h(z.data.data||[])}catch(W){console.error("Failed to fetch details:",W),ee.error("Failed to load application details")}finally{c(!1)}},T=async()=>{var G;y(!0);try{console.log("Saving business details for:",t,S);const Z=await Te.updateApplication(t,S);if(Z.ok)ee.success("Business details saved successfully"),await $();else{const W=((G=Z.data)==null?void 0:G.message)||"Failed to update business details";ee.error(W),console.error("Update failed:",Z)}}catch(Z){console.error("Save details fatal error:",Z),ee.error(Z.message||"A network error occurred while saving")}finally{y(!1)}},E=G=>{G.target.files&&G.target.files[0]&&p(G.target.files[0])},_=async()=>{var Z,W,z;if(!m||!x){ee.error("Please select a document type and file");return}const G=new FormData;G.append("file",m),G.append("documentType",x),j(!0);try{const F=await Te.uploadDocument(t,G);if((Z=F.data)!=null&&Z.success||F.ok){ee.success("Document uploaded successfully"),p(null),f("");const B=document.getElementById("file-upload");B&&(B.value="");const D=await Te.getDocuments(t);((W=D.data)!=null&&W.success||D.ok)&&h(D.data.data||[])}else ee.error(((z=F.data)==null?void 0:z.message)||"Upload failed")}catch(F){console.error("Upload error:",F),ee.error("Upload failed")}finally{j(!1)}};return l?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(Rr,{className:"w-8 h-8 animate-spin text-amber-600"})}):r?e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("button",{onClick:s,className:"mr-3 p-1.5 rounded-full hover:bg-slate-200 text-slate-600 transition-colors","data-testid":"onboarding-prospective-details-back-btn",children:e.jsx(qc,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900 text-2xl font-bold mb-1",children:"Application Details"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-slate-600 font-medium","data-testid":"onboarding-prospective-details-app-id",children:r.applicationId||"Loading..."}),r.districtId?e.jsx("span",{className:"text-[10px] bg-green-100 text-green-700 font-bold px-1.5 py-0.5 rounded uppercase tracking-wider","data-testid":"onboarding-prospective-details-type-badge",children:"Opportunity"}):e.jsx("span",{className:"text-[10px] bg-blue-100 text-blue-700 font-bold px-1.5 py-0.5 rounded uppercase tracking-wider","data-testid":"onboarding-prospective-details-type-badge",children:"Future Reference"})]})]})]})}),e.jsxs("div",{className:"animate-in fade-in duration-500 space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-slate-200 shadow-sm p-6","data-testid":"onboarding-prospective-details-summary-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4 border-b pb-2",children:[e.jsxs("h4",{className:"text-lg font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(Xa,{className:"w-5 h-5 text-amber-600"})," Application Summary"]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-widest",children:"Current Stage"}),e.jsx("span",{className:"bg-amber-100 text-amber-700 px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wide","data-testid":"onboarding-prospective-details-current-stage",children:r.currentStage||r.overallStatus})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3","data-testid":"onboarding-prospective-details-applicant-info",children:[e.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:e.jsx(kr,{className:"w-4 h-4 text-blue-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Applicant"}),e.jsx("p",{className:"text-sm font-semibold text-slate-900","data-testid":"onboarding-prospective-details-name",children:r.applicantName}),e.jsxs("p",{className:"text-xs text-slate-600",children:[r.email," | ",r.phone]})]})]}),e.jsxs("div",{className:"flex items-start gap-3","data-testid":"onboarding-prospective-details-location-info",children:[e.jsx("div",{className:"p-2 bg-amber-50 rounded-lg",children:e.jsx(Er,{className:"w-4 h-4 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Proposed Location"}),e.jsxs("p",{className:"text-sm font-semibold text-slate-900",children:[r.city,", ",r.state]}),e.jsx("p",{className:"text-xs text-slate-600",children:r.preferredLocation||"Standard Area"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3","data-testid":"onboarding-prospective-details-concept-info",children:[e.jsx("div",{className:"p-2 bg-green-50 rounded-lg",children:e.jsx(Dc,{className:"w-4 h-4 text-green-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Business Concept"}),e.jsxs("p",{className:"text-sm font-semibold text-slate-900",children:[r.businessType," - ",r.constitutionType]}),e.jsxs("p",{className:"text-xs text-slate-600",children:["Investment: ",r.investmentCapacity]})]})]}),e.jsxs("div",{className:"flex items-start gap-3","data-testid":"onboarding-prospective-details-date-info",children:[e.jsx("div",{className:"p-2 bg-slate-50 rounded-lg",children:e.jsx(Js,{className:"w-4 h-4 text-slate-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Applied On"}),e.jsx("p",{className:"text-sm font-semibold text-slate-900",children:r.createdAt?new Date(r.createdAt).toLocaleDateString("en-IN",{day:"numeric",month:"long",year:"numeric"}):"-"})]})]})]}),e.jsxs("div",{className:"bg-slate-50 rounded-xl p-4 flex flex-col justify-center border border-slate-100","data-testid":"onboarding-prospective-details-progress-card",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("p",{className:"text-xs font-bold text-slate-700 uppercase tracking-tight",children:"Onboarding Progress"}),e.jsxs("p",{className:"text-xs font-black text-amber-600",children:[r.progressPercentage||0,"%"]})]}),e.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2 shadow-inner",children:e.jsx("div",{className:"bg-amber-500 h-2 rounded-full transition-all duration-1000 ease-out shadow-sm",style:{width:`${r.progressPercentage||0}%`}})}),((q=(M=r.statusHistory)==null?void 0:M[0])==null?void 0:q.changeReason)&&e.jsxs("p",{className:"mt-3 text-[11px] text-slate-600 italic leading-relaxed border-l-2 border-amber-300 pl-2",children:['"',r.statusHistory[0].changeReason,'"']})]})]})]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:e.jsxs("div",{className:"lg:col-span-3 space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-slate-200 shadow-sm overflow-hidden","data-testid":"onboarding-prospective-details-statutory-card",children:[e.jsxs("div",{className:"p-4 bg-slate-900 text-white flex justify-between items-center",children:[e.jsxs("h4",{className:"flex items-center gap-2 text-sm font-bold uppercase tracking-widest",children:[e.jsx(mu,{className:"w-4 h-4 text-amber-400"})," Statutory & Bank Details"]}),e.jsxs("button",{onClick:T,disabled:g,className:`text-xs text-white px-3 py-1 rounded font-bold transition-all flex items-center gap-1 disabled:opacity-50 ${P?"bg-emerald-600 hover:bg-emerald-700 ring-2 ring-emerald-300 animate-pulse":"bg-amber-600 hover:bg-amber-700"}`,"data-testid":"onboarding-prospective-details-save-statutory-btn",children:[g?e.jsx(Rr,{className:"w-3 h-3 animate-spin"}):e.jsx(Fn,{className:"w-3 h-3"}),"Save Business Info"]})]}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Registered Business Name"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all",value:S.accountHolderName,onChange:G=>C({...S,accountHolderName:G.target.value}),placeholder:"As per legal documents","data-testid":"onboarding-prospective-details-input-biz-name"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Permanent Account Number (PAN)"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all uppercase",value:S.panNumber,onChange:G=>C({...S,panNumber:G.target.value.toUpperCase()}),placeholder:"ABCDE1234F",maxLength:10,"data-testid":"onboarding-prospective-details-input-pan"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"GST Identification Number (GSTIN)"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all uppercase",value:S.gstNumber,onChange:G=>C({...S,gstNumber:G.target.value.toUpperCase()}),placeholder:"27ABCDE1234F1Z5",maxLength:15,"data-testid":"onboarding-prospective-details-input-gst"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Registered Office Address"}),e.jsx("textarea",{rows:1,className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all",value:S.registeredAddress,onChange:G=>C({...S,registeredAddress:G.target.value}),placeholder:"Full legal address","data-testid":"onboarding-prospective-details-input-address"})]}),e.jsx("div",{className:"md:col-span-2 border-t pt-2 mt-2",children:e.jsxs("h5",{className:"text-xs font-black text-slate-900 uppercase flex items-center gap-2 mb-3",children:[e.jsx(F2,{className:"w-3.5 h-3.5 text-blue-600"})," Primary Bank Information"]})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Bank Name"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all",value:S.bankName,onChange:G=>C({...S,bankName:G.target.value}),placeholder:"e.g. HDFC Bank","data-testid":"onboarding-prospective-details-input-bank"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Account Number"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all",value:S.accountNumber,onChange:G=>C({...S,accountNumber:G.target.value}),placeholder:"Bank account number","data-testid":"onboarding-prospective-details-input-acc-num"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"IFSC Code"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all uppercase",value:S.ifscCode,onChange:G=>C({...S,ifscCode:G.target.value.toUpperCase()}),placeholder:"HDFC0001234",maxLength:11,"data-testid":"onboarding-prospective-details-input-ifsc"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Branch Name"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all",value:S.branchName,onChange:G=>C({...S,branchName:G.target.value}),placeholder:"e.g. South Mumbai","data-testid":"onboarding-prospective-details-input-branch"})]})]})})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-slate-200 shadow-sm overflow-hidden","data-testid":"onboarding-prospective-details-upload-card",children:[e.jsx("div",{className:"p-4 border-b border-slate-200 bg-slate-50 flex justify-between items-center",children:e.jsxs("h4",{className:"flex items-center gap-2 text-sm font-bold uppercase tracking-widest text-slate-900",children:[e.jsx(Dr,{className:"w-4 h-4 text-blue-600"})," Required Documents"]})}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 bg-slate-50 rounded-lg border border-slate-100",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Document Category"}),x&&e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-bold ${I?"bg-blue-100 text-blue-700":"bg-amber-100 text-amber-700"}`,children:I?"Already uploaded":"Pending upload"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Fn,{className:`pointer-events-none absolute left-3 top-1/2 z-10 h-4 w-4 -translate-y-1/2 ${I?"text-green-600":"text-slate-300"}`}),e.jsxs(wt,{value:x,onValueChange:f,disabled:u,children:[e.jsx(Ct,{className:"h-12 rounded-xl border-slate-200 bg-gradient-to-r from-white to-slate-50 pl-10 pr-3 text-sm font-medium text-slate-700 shadow-sm focus:border-amber-300 focus:ring-2 focus:ring-amber-500","data-testid":"onboarding-prospective-details-doc-type-select",children:e.jsx(St,{placeholder:"Choose document type"})}),e.jsx(At,{className:"rounded-xl border-slate-200 shadow-lg","data-testid":"onboarding-prospective-details-doc-type-content",children:n.map(G=>{const Z=A.has(G.toLowerCase());return e.jsx(Pe,{value:G,className:"rounded-lg px-3 py-2 text-sm text-slate-700 focus:bg-amber-50 focus:text-slate-900","data-testid":`onboarding-prospective-details-doc-type-item-${G.replace(/\s+/g,"-").toLowerCase()}`,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Fn,{className:`h-4 w-4 ${Z?"text-green-600":"text-slate-300"}`}),G]})},G)})})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Select File"}),e.jsx("input",{type:"file",id:"file-upload",className:"w-full text-xs text-slate-600 file:mr-4 file:py-1 file:px-4 file:rounded-full file:border-0 file:text-xs file:font-semibold file:bg-amber-50 file:text-amber-700 hover:file:bg-amber-100",onChange:E,disabled:u,"data-testid":"onboarding-prospective-details-file-input"})]}),e.jsx("div",{className:"md:col-span-2 flex justify-end",children:e.jsxs("button",{onClick:_,disabled:!m||!x||u,className:"bg-blue-600 text-white px-5 py-2 rounded-md hover:bg-blue-700 disabled:opacity-50 text-xs font-bold transition-all shadow-sm flex items-center gap-2","data-testid":"onboarding-prospective-details-upload-btn",children:[u?e.jsx(Rr,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Dr,{className:"w-3.5 h-3.5"}),"Upload Document"]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-slate-900 border-b pb-1",children:[e.jsx(vm,{className:"w-4 h-4 text-blue-600"}),e.jsxs("h3",{className:"text-xs font-black uppercase tracking-tighter",children:["Uploaded Library (",d.length,")"]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3","data-testid":"onboarding-prospective-details-doc-library",children:d.length>0?d.map((G,Z)=>e.jsxs("div",{className:"flex justify-between items-center p-3 border border-slate-100 rounded-xl bg-slate-50 group hover:border-amber-200 transition-all","data-testid":`onboarding-prospective-details-doc-item-${Z}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-white flex items-center justify-center border border-slate-200 group-hover:bg-blue-50",children:e.jsx(vm,{className:"w-4 h-4 text-slate-400 group-hover:text-blue-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-bold text-slate-900","data-testid":`onboarding-prospective-details-doc-type-${Z}`,children:G.documentType}),e.jsx("p",{className:"text-[10px] text-slate-400 truncate w-32",children:G.fileName})]})]}),e.jsx("span",{className:`text-[9px] px-2 py-0.5 rounded-full font-black uppercase tracking-tighter ${G.status==="Approved"?"bg-green-100 text-green-700":"bg-amber-100 text-amber-700"}`,"data-testid":`onboarding-prospective-details-doc-status-${Z}`,children:G.status||"Pending"})]},G.id)):e.jsxs("div",{className:"col-span-2 py-8 text-center bg-slate-50 rounded-xl border border-dashed border-slate-200","data-testid":"onboarding-prospective-details-doc-empty",children:[e.jsx(Xa,{className:"w-6 h-6 text-slate-300 mx-auto mb-2"}),e.jsx("p",{className:"text-xs text-slate-500 font-medium",children:"No documents in your library yet"})]})})]})]})]})]})})]})]}):e.jsxs("div",{className:"bg-white rounded-xl border border-slate-200 p-8 text-center",children:[e.jsx("p",{className:"text-slate-600 mb-4",children:"Application details not found."}),e.jsx("button",{onClick:s,className:"bg-amber-600 text-white px-4 py-2 rounded-md hover:bg-amber-700",children:"Go Back"})]})}function QB(){var h;const t=su(),s=qn(),{user:n}=Nn(x=>x.auth),[r,a]=v.useState(!1),[l,c]=v.useState("applicant"),d=()=>{t(e2()),ee.info("Logged out successfully"),s("/")};return e.jsxs("div",{className:"flex h-screen bg-slate-50",children:[e.jsxs("div",{className:`bg-slate-900 text-white h-screen flex flex-col transition-all duration-300 ${r?"w-20":"w-64"}`,children:[e.jsx("div",{className:"p-4 border-b border-slate-800",children:e.jsxs("div",{className:"flex items-center justify-between",children:[!r&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-10 h-10 bg-amber-600 rounded-lg flex items-center justify-center",children:e.jsx(fs,{className:"w-6 h-6 text-white"})}),e.jsx("span",{className:"text-amber-600 font-bold",children:"Applicant Portal"})]}),e.jsx("button",{onClick:()=>a(!r),className:"p-1 hover:bg-slate-800 rounded transition-colors",children:r?e.jsx(el,{className:"w-5 h-5"}):e.jsx(qc,{className:"w-5 h-5"})})]})}),e.jsx("nav",{className:"flex-1 p-4 space-y-2",children:e.jsx("div",{children:e.jsxs("button",{onClick:()=>{c("applicant"),s("/prospective-dashboard")},className:`w-full flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${l==="applicant"?"bg-amber-600 text-white":"text-slate-300 hover:bg-slate-800 hover:text-white"}`,children:[e.jsx(fs,{className:"w-5 h-5 flex-shrink-0"}),!r&&e.jsx("span",{className:"flex-1 text-left",children:"My Applications"})]})})}),e.jsxs("div",{className:"p-4 border-t border-slate-800 space-y-2",children:[!r&&e.jsx("div",{className:"px-4 py-2 bg-slate-800 rounded-lg mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-amber-600 rounded-full flex items-center justify-center text-white",children:e.jsx("span",{className:"font-bold",children:((h=n==null?void 0:n.name)==null?void 0:h.charAt(0))||"A"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:(n==null?void 0:n.name)||"Applicant"}),e.jsx("p",{className:"text-slate-400 truncate text-xs",children:(n==null?void 0:n.role)||"Prospective"})]})]})}),e.jsxs("button",{onClick:d,className:`w-full flex items-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all h-9 px-4 py-2 text-slate-300 hover:bg-slate-800 hover:text-white ${r?"justify-center":"justify-start"}`,children:[e.jsx($2,{className:"w-5 h-5 flex-shrink-0"}),!r&&e.jsx("span",{className:"ml-3",children:"Logout"})]})]})]}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx("header",{className:"bg-white border-b border-slate-200 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900 text-xl font-semibold",children:"Applicant Management"}),e.jsx("p",{className:"text-slate-600 text-sm",children:"Manage and track dealership applications"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-100 rounded-lg",children:[e.jsx("div",{className:"w-8 h-8 bg-amber-600 rounded-full flex items-center justify-center",children:e.jsx(kr,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-slate-900 text-sm font-medium",children:(n==null?void 0:n.name)||"Applicant"}),e.jsx("p",{className:"text-slate-600 text-xs",children:(n==null?void 0:n.role)||"User"})]})]}),e.jsx("button",{className:"p-2 rounded-md hover:bg-slate-100",title:"Refresh",onClick:()=>window.location.reload(),children:e.jsx(Rr,{className:"w-4 h-4 text-slate-600"})})]})]})}),e.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:e.jsxs(Q0,{children:[e.jsx(Ns,{path:"/",element:e.jsx(XB,{})}),e.jsx(Ns,{path:"/application/:id",element:e.jsx(JB,{})})]})})]})]})}function XB(){const t=qn(),{user:s}=Nn(l=>l.auth),[n,r]=v.useState([]);v.useEffect(()=>{s!=null&&s.id&&a()},[s==null?void 0:s.id]);const a=async()=>{var l;try{const c=await Te.getApplications();(l=c.data)!=null&&l.success&&r(c.data.data)}catch(c){console.error("Failed to fetch applications",c)}};return e.jsx("div",{className:"max-w-7xl mx-auto",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-8",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900 text-3xl font-bold mb-2",children:"My Applications"}),e.jsx("p",{className:"text-slate-500 font-medium",children:"Track and manage your dealership applications"})]})}),n.length===0?e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 border-dashed p-12 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-slate-50 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(fs,{className:"w-8 h-8 text-slate-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-1",children:"No applications found"}),e.jsx("p",{className:"text-slate-500 max-w-sm mx-auto mb-6",children:"You haven't submitted any dealership applications yet."})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:n.map(l=>e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-6 shadow-sm hover:shadow-md hover:border-amber-500 cursor-pointer transition-all group",onClick:()=>t(`/prospective-dashboard/application/${l.id}`),children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsx("div",{className:"w-12 h-12 bg-amber-50 rounded-xl flex items-center justify-center group-hover:bg-amber-600 transition-colors",children:e.jsx(fs,{className:"w-6 h-6 text-amber-600 group-hover:text-white"})}),e.jsx(Ae,{className:`px-4 py-1.5 rounded-xl text-[10px] uppercase font-bold ${l.overallStatus==="Completed"?"bg-green-100 text-green-700":l.overallStatus==="Rejected"?"bg-red-100 text-red-700":"bg-amber-100 text-amber-700"}`,children:l.overallStatus||"Active"})]}),e.jsx("h3",{className:"text-xl font-bold text-slate-900 mb-1 truncate",children:l.applicationId}),e.jsxs("p",{className:"text-slate-500 text-sm mb-4 font-medium",children:[l.city,", ",l.state]}),e.jsxs("div",{className:"space-y-4 pt-6 border-t border-slate-100",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-slate-500 font-medium",children:"Current Stage"}),e.jsx("span",{className:"text-xs font-bold text-slate-900 bg-slate-100 px-3 py-1 rounded-lg",children:l.currentStage||"Initial"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-slate-500 font-medium",children:"Applied"}),e.jsx("span",{className:"text-xs font-bold text-slate-600",children:Ht(l.createdAt)})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-wider",children:"Progress"}),e.jsxs("span",{className:"text-xs font-bold text-amber-600",children:[l.progressPercentage||0,"%"]})]}),e.jsx("div",{className:"w-full bg-slate-100 rounded-full h-2",children:e.jsx("div",{className:"bg-amber-500 h-2 rounded-full transition-all duration-1000",style:{width:`${l.progressPercentage||0}%`}})})]})]})]},l.id))})]})})}function JB(){const{id:t}=Bc(),s=qn();return t?e.jsx("div",{className:"max-w-7xl mx-auto",children:e.jsx(ZB,{id:t,onBack:()=>s("/prospective-dashboard")})}):null}function e7(){const t=qn(),[s,n]=v.useState([]),[r,a]=v.useState(!0),[l,c]=v.useState("");v.useEffect(()=>{d()},[]);const d=async()=>{var x;a(!0);try{const f=await Te.getApplications();(x=f.data)!=null&&x.success&&n(f.data.data)}catch(f){console.error("Failed to fetch FDD applications:",f),ee.error("Failed to load assigned applications")}finally{a(!1)}},h=s.filter(x=>{var f;return x.applicationId.toLowerCase().includes(l.toLowerCase())||x.applicantName.toLowerCase().includes(l.toLowerCase())||((f=x.city)==null?void 0:f.toLowerCase().includes(l.toLowerCase()))});return e.jsxs("div",{className:"space-y-6 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-slate-900 tracking-tight",children:"FDD Dashboard"}),e.jsx("p",{className:"text-slate-500",children:"Manage financial due diligence for assigned dealer applications"})]}),e.jsxs("button",{onClick:d,className:"flex items-center gap-2 px-4 py-2 bg-white border border-slate-200 rounded-lg hover:bg-slate-50 transition-colors text-sm font-medium",children:[e.jsx(Rr,{className:`w-4 h-4 ${r?"animate-spin":""}`}),"Refresh"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsx(Le,{className:"bg-white border-slate-200 shadow-sm",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider",children:"Total Assigned"}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900",children:s.length})]}),e.jsx("div",{className:"p-2 bg-slate-100 rounded-lg text-slate-600",children:e.jsx(fs,{className:"w-5 h-5"})})]})})}),e.jsx(Le,{className:"bg-white border-slate-200 shadow-sm",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider",children:"Pending Reports"}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900",children:s.filter(x=>x.currentStage==="FDD"||x.overallStatus==="Active").length})]}),e.jsx("div",{className:"p-2 bg-slate-100 rounded-lg text-slate-600",children:e.jsx(Js,{className:"w-5 h-5"})})]})})}),e.jsx(Le,{className:"bg-white border-slate-200 shadow-sm",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider",children:"Completed Reports"}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900",children:"0"})]}),e.jsx("div",{className:"p-2 bg-slate-100 rounded-lg text-slate-600",children:e.jsx(Fn,{className:"w-5 h-5"})})]})})})]}),e.jsxs(Le,{className:"shadow-sm border-slate-200 overflow-hidden",children:[e.jsxs(tt,{className:"bg-white border-b border-slate-100 px-6 py-4 flex flex-row items-center justify-between",children:[e.jsxs(nt,{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(fs,{className:"w-5 h-5 text-blue-600"}),"My Assigned Cases"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx("input",{type:"text",placeholder:"Search by ID or Name...",className:"pl-9 pr-4 py-2 bg-slate-50 border-slate-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 transition-all outline-none",value:l,onChange:x=>c(x.target.value)})]}),e.jsx("button",{className:"p-2 border border-slate-200 rounded-lg hover:bg-slate-50 transition-colors",children:e.jsx(I2,{className:"w-4 h-4 text-slate-600"})})]})]}),e.jsx(Me,{className:"p-0",children:r?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 px-6",children:[e.jsx(Rr,{className:"w-10 h-10 animate-spin text-blue-600 mb-4"}),e.jsx("p",{className:"text-slate-500 font-medium",children:"Synchronizing application data..."})]}):h.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 px-6 text-center",children:[e.jsx("div",{className:"w-20 h-20 bg-slate-50 rounded-full flex items-center justify-center mb-6",children:e.jsx(Ks,{className:"w-10 h-10 text-slate-200"})}),e.jsx("h3",{className:"text-xl font-bold text-slate-900 mb-2",children:"No Applications Found"}),e.jsx("p",{className:"text-slate-500 max-w-md mx-auto",children:"You don't have any applications assigned for Financial Due Diligence at this time."})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{className:"bg-slate-50 border-b border-slate-200",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider",children:"Application Details"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider",children:"Location"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider",children:"Current Stage"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider text-right",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-100",children:h.map(x=>e.jsxs("tr",{className:"hover:bg-slate-50 transition-colors cursor-pointer group",onClick:()=>t(`/fdd-details/${x.id}`),children:[e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center font-bold",children:x.applicantName.charAt(0)}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-slate-900 group-hover:text-blue-600 transition-colors",children:x.applicationId}),e.jsx("p",{className:"text-xs text-slate-500",children:x.applicantName})]})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-slate-700",children:[x.city,", ",x.state]}),e.jsx("p",{className:"text-xs text-slate-400 capitalize",children:x.locationType||"New Market"})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx(Ae,{className:`px-3 py-1 rounded-full text-[10px] uppercase font-bold tracking-wider ${x.overallStatus==="Completed"?"bg-green-100 text-green-700":"bg-amber-100 text-amber-700"}`,children:x.overallStatus==="Active"?"FDD Pending":x.overallStatus})}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsx("button",{className:"p-2 text-slate-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-all",children:e.jsx(To,{className:"w-5 h-5"})})})]},x.id))})]})})})]})]})}const t7="modulepreload",s7=function(t){return"/"+t},e1={},Tl=function(s,n,r){let a=Promise.resolve();if(n&&n.length>0){let c=function(x){return Promise.all(x.map(f=>Promise.resolve(f).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=c(n.map(x=>{if(x=s7(x),x in e1)return;e1[x]=!0;const f=x.endsWith(".css"),m=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${x}"]${m}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":t7,f||(p.as="script"),p.crossOrigin="",p.href=x,h&&p.setAttribute("nonce",h),document.head.appendChild(p),f)return new Promise((u,j)=>{p.addEventListener("load",u),p.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${x}`)))})}))}function l(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return a.then(c=>{for(const d of c||[])d.status==="rejected"&&l(d.reason);return s().catch(l)})};function n7(t,s=[]){let n=[];function r(l,c){const d=v.createContext(c);d.displayName=l+"Context";const h=n.length;n=[...n,c];const x=m=>{var N;const{scope:p,children:u,...j}=m,g=((N=p==null?void 0:p[t])==null?void 0:N[h])||d,y=v.useMemo(()=>j,Object.values(j));return e.jsx(g.Provider,{value:y,children:u})};x.displayName=l+"Provider";function f(m,p){var g;const u=((g=p==null?void 0:p[t])==null?void 0:g[h])||d,j=v.useContext(u);if(j)return j;if(c!==void 0)return c;throw new Error(`\`${m}\` must be used within \`${l}\``)}return[x,f]}const a=()=>{const l=n.map(c=>v.createContext(c));return function(d){const h=(d==null?void 0:d[t])||l;return v.useMemo(()=>({[`__scope${t}`]:{...d,[t]:h}}),[d,h])}};return a.scopeName=t,[r,r7(a,...s)]}function r7(...t){const s=t[0];if(t.length===1)return s;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const c=r.reduce((d,{useScope:h,scopeName:x})=>{const m=h(l)[`__scope${x}`];return{...d,...m}},{});return v.useMemo(()=>({[`__scope${s.scopeName}`]:c}),[c])}};return n.scopeName=s.scopeName,n}var a7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Lb=a7.reduce((t,s)=>{const n=hu(`Primitive.${s}`),r=v.forwardRef((a,l)=>{const{asChild:c,...d}=a,h=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${s}`,{...t,[s]:r}},{}),Vx={exports:{}},Hx={};/** +For more information, see https://radix-ui.com/primitives/docs/components/${s.docsSlug}`;return v.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},rB="DialogDescriptionWarning",aB=({contentRef:t,descriptionId:s})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yR(rB).contentName}}.`;return v.useEffect(()=>{var l;const a=(l=t.current)==null?void 0:l.getAttribute("aria-describedby");s&&a&&(document.getElementById(s)||console.warn(r))},[r,t,s]),null},Lb=iR,jR=oR,Ib=dR,yf=uR,jf=hR,NR=fR,wR=xR,Mb=vR;function os({...t}){return e.jsx(Lb,{"data-slot":"dialog",...t})}function Hl({...t}){return e.jsx(jR,{"data-slot":"dialog-trigger",...t})}function iB({...t}){return e.jsx(Ib,{"data-slot":"dialog-portal",...t})}const SR=v.forwardRef(({className:t,...s},n)=>e.jsx(yf,{ref:n,"data-slot":"dialog-overlay",className:_t("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...s}));SR.displayName=yf.displayName;const ls=v.forwardRef(({className:t,children:s,...n},r)=>e.jsxs(iB,{"data-slot":"dialog-portal",children:[e.jsx(SR,{}),e.jsxs(jf,{ref:r,"data-slot":"dialog-content",className:_t("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...n,children:[s,e.jsxs(Mb,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e.jsx(Tc,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ls.displayName=jf.displayName;function ms({className:t,...s}){return e.jsx("div",{"data-slot":"dialog-header",className:_t("flex flex-col gap-2 text-center sm:text-left",t),...s})}function rn({className:t,...s}){return e.jsx("div",{"data-slot":"dialog-footer",className:_t("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function us({className:t,...s}){return e.jsx(NR,{"data-slot":"dialog-title",className:_t("text-lg leading-none font-semibold",t),...s})}function vs({className:t,...s}){return e.jsx(wR,{"data-slot":"dialog-description",className:_t("text-muted-foreground text-sm",t),...s})}function lB(t){const s=oB(t),n=v.forwardRef((r,a)=>{const{children:l,...c}=r,d=v.Children.toArray(l),m=d.find(dB);if(m){const x=m.props.children,f=d.map(h=>h===m?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:h);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}function oB(t){const s=v.forwardRef((n,r)=>{const{children:a,...l}=n;if(v.isValidElement(a)){const c=hB(a),d=uB(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var cB=Symbol("radix.slottable");function dB(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===cB}function uB(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const m=l(...d);return a(...d),m}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function hB(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var CR=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),mB="VisuallyHidden",AR=v.forwardRef((t,s)=>e.jsx(ps.span,{...t,ref:s,style:{...CR,...t.style}}));AR.displayName=mB;var fB=AR,pB=[" ","Enter","ArrowUp","ArrowDown"],xB=[" ","Enter"],qo="Select",[Nf,wf,gB]=nb(qo),[Kc]=ea(qo,[gB,Vl]),Sf=Vl(),[vB,Wl]=Kc(qo),[bB,yB]=Kc(qo),kR=t=>{const{__scopeSelect:s,children:n,open:r,defaultOpen:a,onOpenChange:l,value:c,defaultValue:d,onValueChange:m,dir:x,name:f,autoComplete:h,disabled:g,required:u,form:j}=t,p=Sf(s),[y,N]=v.useState(null),[S,A]=v.useState(null),[w,E]=v.useState(!1),T=pu(x),[C,L]=bi({prop:r,defaultProp:a??!1,onChange:l,caller:qo}),[$,_]=bi({prop:c,defaultProp:d,onChange:m,caller:qo}),R=v.useRef(null),P=y?j||!!y.closest("form"):!0,[M,q]=v.useState(new Set),K=Array.from(M).map(Z=>Z.props.value).join(";");return e.jsx(rf,{...p,children:e.jsxs(vB,{required:u,scope:s,trigger:y,onTriggerChange:N,valueNode:S,onValueNodeChange:A,valueNodeHasChildren:w,onValueNodeHasChildrenChange:E,contentId:hr(),value:$,onValueChange:_,open:C,onOpenChange:L,dir:T,triggerPointerDownPosRef:R,disabled:g,children:[e.jsx(Nf.Provider,{scope:s,children:e.jsx(bB,{scope:t.__scopeSelect,onNativeOptionAdd:v.useCallback(Z=>{q(W=>new Set(W).add(Z))},[]),onNativeOptionRemove:v.useCallback(Z=>{q(W=>{const U=new Set(W);return U.delete(Z),U})},[]),children:n})}),P?e.jsxs(QR,{"aria-hidden":!0,required:u,tabIndex:-1,name:f,autoComplete:h,value:$,onChange:Z=>_(Z.target.value),disabled:g,form:j,children:[$===void 0?e.jsx("option",{value:""}):null,Array.from(M)]},K):null]})})};kR.displayName=qo;var RR="SelectTrigger",ER=v.forwardRef((t,s)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,l=Sf(n),c=Wl(RR,n),d=c.disabled||r,m=Ms(s,c.onTriggerChange),x=wf(n),f=v.useRef("touch"),[h,g,u]=JR(p=>{const y=x().filter(A=>!A.disabled),N=y.find(A=>A.value===c.value),S=eE(y,p,N);S!==void 0&&c.onValueChange(S.value)}),j=p=>{d||(c.onOpenChange(!0),u()),p&&(c.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return e.jsx(vu,{asChild:!0,...l,children:e.jsx(ps.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":XR(c.value)?"":void 0,...a,ref:m,onClick:Vt(a.onClick,p=>{p.currentTarget.focus(),f.current!=="mouse"&&j(p)}),onPointerDown:Vt(a.onPointerDown,p=>{f.current=p.pointerType;const y=p.target;y.hasPointerCapture(p.pointerId)&&y.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(j(p),p.preventDefault())}),onKeyDown:Vt(a.onKeyDown,p=>{const y=h.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&g(p.key),!(y&&p.key===" ")&&pB.includes(p.key)&&(j(),p.preventDefault())})})})});ER.displayName=RR;var DR="SelectValue",TR=v.forwardRef((t,s)=>{const{__scopeSelect:n,className:r,style:a,children:l,placeholder:c="",...d}=t,m=Wl(DR,n),{onValueNodeHasChildrenChange:x}=m,f=l!==void 0,h=Ms(s,m.onValueNodeChange);return Zn(()=>{x(f)},[x,f]),e.jsx(ps.span,{...d,ref:h,style:{pointerEvents:"none"},children:XR(m.value)?e.jsx(e.Fragment,{children:c}):l})});TR.displayName=DR;var jB="SelectIcon",_R=v.forwardRef((t,s)=>{const{__scopeSelect:n,children:r,...a}=t;return e.jsx(ps.span,{"aria-hidden":!0,...a,ref:s,children:r||"▼"})});_R.displayName=jB;var NB="SelectPortal",PR=t=>e.jsx(Hc,{asChild:!0,...t});PR.displayName=NB;var zo="SelectContent",OR=v.forwardRef((t,s)=>{const n=Wl(zo,t.__scopeSelect),[r,a]=v.useState();if(Zn(()=>{a(new DocumentFragment)},[]),!n.open){const l=r;return l?cu.createPortal(e.jsx(LR,{scope:t.__scopeSelect,children:e.jsx(Nf.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),l):null}return e.jsx(IR,{...t,ref:s})});OR.displayName=zo;var Wa=10,[LR,Kl]=Kc(zo),wB="SelectContentImpl",SB=lB("SelectContent.RemoveScroll"),IR=v.forwardRef((t,s)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:l,onPointerDownOutside:c,side:d,sideOffset:m,align:x,alignOffset:f,arrowPadding:h,collisionBoundary:g,collisionPadding:u,sticky:j,hideWhenDetached:p,avoidCollisions:y,...N}=t,S=Wl(zo,n),[A,w]=v.useState(null),[E,T]=v.useState(null),C=Ms(s,X=>w(X)),[L,$]=v.useState(null),[_,R]=v.useState(null),P=wf(n),[M,q]=v.useState(!1),K=v.useRef(!1);v.useEffect(()=>{if(A)return cf(A)},[A]),Jm();const Z=v.useCallback(X=>{const[ne,...oe]=P().map(ve=>ve.ref.current),[re]=oe.slice(-1),ge=document.activeElement;for(const ve of X)if(ve===ge||(ve==null||ve.scrollIntoView({block:"nearest"}),ve===ne&&E&&(E.scrollTop=0),ve===re&&E&&(E.scrollTop=E.scrollHeight),ve==null||ve.focus(),document.activeElement!==ge))return},[P,E]),W=v.useCallback(()=>Z([L,A]),[Z,L,A]);v.useEffect(()=>{M&&W()},[M,W]);const{onOpenChange:U,triggerPointerDownPosRef:F}=S;v.useEffect(()=>{if(A){let X={x:0,y:0};const ne=re=>{var ge,ve;X={x:Math.abs(Math.round(re.pageX)-(((ge=F.current)==null?void 0:ge.x)??0)),y:Math.abs(Math.round(re.pageY)-(((ve=F.current)==null?void 0:ve.y)??0))}},oe=re=>{X.x<=10&&X.y<=10?re.preventDefault():A.contains(re.target)||U(!1),document.removeEventListener("pointermove",ne),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",ne),document.addEventListener("pointerup",oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",oe,{capture:!0})}}},[A,U,F]),v.useEffect(()=>{const X=()=>U(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[U]);const[B,D]=JR(X=>{const ne=P().filter(ge=>!ge.disabled),oe=ne.find(ge=>ge.ref.current===document.activeElement),re=eE(ne,X,oe);re&&setTimeout(()=>re.ref.current.focus())}),O=v.useCallback((X,ne,oe)=>{const re=!K.current&&!oe;(S.value!==void 0&&S.value===ne||re)&&($(X),re&&(K.current=!0))},[S.value]),z=v.useCallback(()=>A==null?void 0:A.focus(),[A]),G=v.useCallback((X,ne,oe)=>{const re=!K.current&&!oe;(S.value!==void 0&&S.value===ne||re)&&R(X)},[S.value]),Y=r==="popper"?wv:MR,V=Y===wv?{side:d,sideOffset:m,align:x,alignOffset:f,arrowPadding:h,collisionBoundary:g,collisionPadding:u,sticky:j,hideWhenDetached:p,avoidCollisions:y}:{};return e.jsx(LR,{scope:n,content:A,viewport:E,onViewportChange:T,itemRefCallback:O,selectedItem:L,onItemLeave:z,itemTextRefCallback:G,focusSelectedItem:W,selectedItemText:_,position:r,isPositioned:M,searchRef:B,children:e.jsx(yu,{as:SB,allowPinchZoom:!0,children:e.jsx(xu,{asChild:!0,trapped:S.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:Vt(a,X=>{var ne;(ne=S.trigger)==null||ne.focus({preventScroll:!0}),X.preventDefault()}),children:e.jsx(zc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:e.jsx(Y,{role:"listbox",id:S.contentId,"data-state":S.open?"open":"closed",dir:S.dir,onContextMenu:X=>X.preventDefault(),...N,...V,onPlaced:()=>q(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...N.style},onKeyDown:Vt(N.onKeyDown,X=>{const ne=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!ne&&X.key.length===1&&D(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let re=P().filter(ge=>!ge.disabled).map(ge=>ge.ref.current);if(["ArrowUp","End"].includes(X.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const ge=X.target,ve=re.indexOf(ge);re=re.slice(ve+1)}setTimeout(()=>Z(re)),X.preventDefault()}})})})})})})});IR.displayName=wB;var CB="SelectItemAlignedPosition",MR=v.forwardRef((t,s)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,l=Wl(zo,n),c=Kl(zo,n),[d,m]=v.useState(null),[x,f]=v.useState(null),h=Ms(s,C=>f(C)),g=wf(n),u=v.useRef(!1),j=v.useRef(!0),{viewport:p,selectedItem:y,selectedItemText:N,focusSelectedItem:S}=c,A=v.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&x&&p&&y&&N){const C=l.trigger.getBoundingClientRect(),L=x.getBoundingClientRect(),$=l.valueNode.getBoundingClientRect(),_=N.getBoundingClientRect();if(l.dir!=="rtl"){const ge=_.left-L.left,ve=$.left-ge,Se=C.left-ve,We=C.width+Se,Ce=Math.max(We,L.width),fe=window.innerWidth-Wa,Ye=Nv(ve,[Wa,Math.max(Wa,fe-Ce)]);d.style.minWidth=We+"px",d.style.left=Ye+"px"}else{const ge=L.right-_.right,ve=window.innerWidth-$.right-ge,Se=window.innerWidth-C.right-ve,We=C.width+Se,Ce=Math.max(We,L.width),fe=window.innerWidth-Wa,Ye=Nv(ve,[Wa,Math.max(Wa,fe-Ce)]);d.style.minWidth=We+"px",d.style.right=Ye+"px"}const R=g(),P=window.innerHeight-Wa*2,M=p.scrollHeight,q=window.getComputedStyle(x),K=parseInt(q.borderTopWidth,10),Z=parseInt(q.paddingTop,10),W=parseInt(q.borderBottomWidth,10),U=parseInt(q.paddingBottom,10),F=K+Z+M+U+W,B=Math.min(y.offsetHeight*5,F),D=window.getComputedStyle(p),O=parseInt(D.paddingTop,10),z=parseInt(D.paddingBottom,10),G=C.top+C.height/2-Wa,Y=P-G,V=y.offsetHeight/2,X=y.offsetTop+V,ne=K+Z+X,oe=F-ne;if(ne<=G){const ge=R.length>0&&y===R[R.length-1].ref.current;d.style.bottom="0px";const ve=x.clientHeight-p.offsetTop-p.offsetHeight,Se=Math.max(Y,V+(ge?z:0)+ve+W),We=ne+Se;d.style.height=We+"px"}else{const ge=R.length>0&&y===R[0].ref.current;d.style.top="0px";const Se=Math.max(G,K+p.offsetTop+(ge?O:0)+V)+oe;d.style.height=Se+"px",p.scrollTop=ne-G+p.offsetTop}d.style.margin=`${Wa}px 0`,d.style.minHeight=B+"px",d.style.maxHeight=P+"px",r==null||r(),requestAnimationFrame(()=>u.current=!0)}},[g,l.trigger,l.valueNode,d,x,p,y,N,l.dir,r]);Zn(()=>A(),[A]);const[w,E]=v.useState();Zn(()=>{x&&E(window.getComputedStyle(x).zIndex)},[x]);const T=v.useCallback(C=>{C&&j.current===!0&&(A(),S==null||S(),j.current=!1)},[A,S]);return e.jsx(kB,{scope:n,contentWrapper:d,shouldExpandOnScrollRef:u,onScrollButtonChange:T,children:e.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:e.jsx(ps.div,{...a,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});MR.displayName=CB;var AB="SelectPopperPosition",wv=v.forwardRef((t,s)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=Wa,...l}=t,c=Sf(n);return e.jsx(af,{...c,...l,ref:s,align:r,collisionPadding:a,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});wv.displayName=AB;var[kB,Fb]=Kc(zo,{}),Sv="SelectViewport",FR=v.forwardRef((t,s)=>{const{__scopeSelect:n,nonce:r,...a}=t,l=Kl(Sv,n),c=Fb(Sv,n),d=Ms(s,l.onViewportChange),m=v.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),e.jsx(Nf.Slot,{scope:n,children:e.jsx(ps.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Vt(a.onScroll,x=>{const f=x.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:g}=c;if(g!=null&&g.current&&h){const u=Math.abs(m.current-f.scrollTop);if(u>0){const j=window.innerHeight-Wa*2,p=parseFloat(h.style.minHeight),y=parseFloat(h.style.height),N=Math.max(p,y);if(N0?w:0,h.style.justifyContent="flex-end")}}}m.current=f.scrollTop})})})]})});FR.displayName=Sv;var BR="SelectGroup",[RB,EB]=Kc(BR),$R=v.forwardRef((t,s)=>{const{__scopeSelect:n,...r}=t,a=hr();return e.jsx(RB,{scope:n,id:a,children:e.jsx(ps.div,{role:"group","aria-labelledby":a,...r,ref:s})})});$R.displayName=BR;var qR="SelectLabel",zR=v.forwardRef((t,s)=>{const{__scopeSelect:n,...r}=t,a=EB(qR,n);return e.jsx(ps.div,{id:a.id,...r,ref:s})});zR.displayName=qR;var _m="SelectItem",[DB,UR]=Kc(_m),VR=v.forwardRef((t,s)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:l,...c}=t,d=Wl(_m,n),m=Kl(_m,n),x=d.value===r,[f,h]=v.useState(l??""),[g,u]=v.useState(!1),j=Ms(s,S=>{var A;return(A=m.itemRefCallback)==null?void 0:A.call(m,S,r,a)}),p=hr(),y=v.useRef("touch"),N=()=>{a||(d.onValueChange(r),d.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(DB,{scope:n,value:r,disabled:a,textId:p,isSelected:x,onItemTextChange:v.useCallback(S=>{h(A=>A||((S==null?void 0:S.textContent)??"").trim())},[]),children:e.jsx(Nf.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:e.jsx(ps.div,{role:"option","aria-labelledby":p,"data-highlighted":g?"":void 0,"aria-selected":x&&g,"data-state":x?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...c,ref:j,onFocus:Vt(c.onFocus,()=>u(!0)),onBlur:Vt(c.onBlur,()=>u(!1)),onClick:Vt(c.onClick,()=>{y.current!=="mouse"&&N()}),onPointerUp:Vt(c.onPointerUp,()=>{y.current==="mouse"&&N()}),onPointerDown:Vt(c.onPointerDown,S=>{y.current=S.pointerType}),onPointerMove:Vt(c.onPointerMove,S=>{var A;y.current=S.pointerType,a?(A=m.onItemLeave)==null||A.call(m):y.current==="mouse"&&S.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Vt(c.onPointerLeave,S=>{var A;S.currentTarget===document.activeElement&&((A=m.onItemLeave)==null||A.call(m))}),onKeyDown:Vt(c.onKeyDown,S=>{var w;((w=m.searchRef)==null?void 0:w.current)!==""&&S.key===" "||(xB.includes(S.key)&&N(),S.key===" "&&S.preventDefault())})})})})});VR.displayName=_m;var Id="SelectItemText",HR=v.forwardRef((t,s)=>{const{__scopeSelect:n,className:r,style:a,...l}=t,c=Wl(Id,n),d=Kl(Id,n),m=UR(Id,n),x=yB(Id,n),[f,h]=v.useState(null),g=Ms(s,N=>h(N),m.onItemTextChange,N=>{var S;return(S=d.itemTextRefCallback)==null?void 0:S.call(d,N,m.value,m.disabled)}),u=f==null?void 0:f.textContent,j=v.useMemo(()=>e.jsx("option",{value:m.value,disabled:m.disabled,children:u},m.value),[m.disabled,m.value,u]),{onNativeOptionAdd:p,onNativeOptionRemove:y}=x;return Zn(()=>(p(j),()=>y(j)),[p,y,j]),e.jsxs(e.Fragment,{children:[e.jsx(ps.span,{id:m.textId,...l,ref:g}),m.isSelected&&c.valueNode&&!c.valueNodeHasChildren?cu.createPortal(l.children,c.valueNode):null]})});HR.displayName=Id;var WR="SelectItemIndicator",KR=v.forwardRef((t,s)=>{const{__scopeSelect:n,...r}=t;return UR(WR,n).isSelected?e.jsx(ps.span,{"aria-hidden":!0,...r,ref:s}):null});KR.displayName=WR;var Cv="SelectScrollUpButton",GR=v.forwardRef((t,s)=>{const n=Kl(Cv,t.__scopeSelect),r=Fb(Cv,t.__scopeSelect),[a,l]=v.useState(!1),c=Ms(s,r.onScrollButtonChange);return Zn(()=>{if(n.viewport&&n.isPositioned){let d=function(){const x=m.scrollTop>0;l(x)};const m=n.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),a?e.jsx(ZR,{...t,ref:c,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=n;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});GR.displayName=Cv;var Av="SelectScrollDownButton",YR=v.forwardRef((t,s)=>{const n=Kl(Av,t.__scopeSelect),r=Fb(Av,t.__scopeSelect),[a,l]=v.useState(!1),c=Ms(s,r.onScrollButtonChange);return Zn(()=>{if(n.viewport&&n.isPositioned){let d=function(){const x=m.scrollHeight-m.clientHeight,f=Math.ceil(m.scrollTop)m.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),a?e.jsx(ZR,{...t,ref:c,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=n;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});YR.displayName=Av;var ZR=v.forwardRef((t,s)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,l=Kl("SelectScrollButton",n),c=v.useRef(null),d=wf(n),m=v.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return v.useEffect(()=>()=>m(),[m]),Zn(()=>{var f;const x=d().find(h=>h.ref.current===document.activeElement);(f=x==null?void 0:x.ref.current)==null||f.scrollIntoView({block:"nearest"})},[d]),e.jsx(ps.div,{"aria-hidden":!0,...a,ref:s,style:{flexShrink:0,...a.style},onPointerDown:Vt(a.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(r,50))}),onPointerMove:Vt(a.onPointerMove,()=>{var x;(x=l.onItemLeave)==null||x.call(l),c.current===null&&(c.current=window.setInterval(r,50))}),onPointerLeave:Vt(a.onPointerLeave,()=>{m()})})}),TB="SelectSeparator",_B=v.forwardRef((t,s)=>{const{__scopeSelect:n,...r}=t;return e.jsx(ps.div,{"aria-hidden":!0,...r,ref:s})});_B.displayName=TB;var kv="SelectArrow",PB=v.forwardRef((t,s)=>{const{__scopeSelect:n,...r}=t,a=Sf(n),l=Wl(kv,n),c=Kl(kv,n);return l.open&&c.position==="popper"?e.jsx(lf,{...a,...r,ref:s}):null});PB.displayName=kv;var OB="SelectBubbleInput",QR=v.forwardRef(({__scopeSelect:t,value:s,...n},r)=>{const a=v.useRef(null),l=Ms(r,a),c=Yv(s);return v.useEffect(()=>{const d=a.current;if(!d)return;const m=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(m,"value").set;if(c!==s&&f){const h=new Event("change",{bubbles:!0});f.call(d,s),d.dispatchEvent(h)}},[c,s]),e.jsx(ps.select,{...n,style:{...CR,...n.style},ref:l,defaultValue:s})});QR.displayName=OB;function XR(t){return t===""||t===void 0}function JR(t){const s=dr(t),n=v.useRef(""),r=v.useRef(0),a=v.useCallback(c=>{const d=n.current+c;s(d),(function m(x){n.current=x,window.clearTimeout(r.current),x!==""&&(r.current=window.setTimeout(()=>m(""),1e3))})(d)},[s]),l=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,l]}function eE(t,s,n){const a=s.length>1&&Array.from(s).every(x=>x===s[0])?s[0]:s,l=n?t.indexOf(n):-1;let c=LB(t,Math.max(l,0));a.length===1&&(c=c.filter(x=>x!==n));const m=c.find(x=>x.textValue.toLowerCase().startsWith(a.toLowerCase()));return m!==n?m:void 0}function LB(t,s){return t.map((n,r)=>t[(s+r)%t.length])}var IB=kR,MB=ER,FB=TR,BB=_R,$B=PR,qB=OR,zB=FR,UB=$R,VB=zR,HB=VR,WB=HR,KB=KR,GB=GR,YB=YR;function wt({...t}){return e.jsx(IB,{"data-slot":"select",...t})}function s1({...t}){return e.jsx(UB,{"data-slot":"select-group",...t})}function St({...t}){return e.jsx(FB,{"data-slot":"select-value",...t})}function Ct({className:t,size:s="default",children:n,...r}){return e.jsxs(MB,{"data-slot":"select-trigger","data-size":s,className:_t("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-input-background px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r,children:[n,e.jsx(BB,{asChild:!0,children:e.jsx(la,{className:"size-4 opacity-50"})})]})}function At({className:t,children:s,position:n="popper",...r}){return e.jsx($B,{children:e.jsxs(qB,{"data-slot":"select-content",className:_t("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[e.jsx(QB,{}),e.jsx(zB,{className:_t("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:s}),e.jsx(XB,{})]})})}function ZB({className:t,...s}){return e.jsx(VB,{"data-slot":"select-label",className:_t("text-muted-foreground px-2 py-1.5 text-xs",t),...s})}function _e({className:t,children:s,...n}){return e.jsxs(HB,{"data-slot":"select-item",className:_t("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(KB,{children:e.jsx(Bn,{className:"size-4"})})}),e.jsx(WB,{children:s})]})}function QB({className:t,...s}){return e.jsx(GB,{"data-slot":"select-scroll-up-button",className:_t("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx($d,{className:"size-4"})})}function XB({className:t,...s}){return e.jsx(YB,{"data-slot":"select-scroll-down-button",className:_t("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(la,{className:"size-4"})})}function ks({className:t,...s}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:_t("w-full caption-bottom text-sm",t),...s})})}function Rs({className:t,...s}){return e.jsx("thead",{"data-slot":"table-header",className:_t("[&_tr]:border-b",t),...s})}function Es({className:t,...s}){return e.jsx("tbody",{"data-slot":"table-body",className:_t("[&_tr:last-child]:border-0",t),...s})}function ct({className:t,...s}){return e.jsx("tr",{"data-slot":"table-row",className:_t("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...s})}function me({className:t,...s}){return e.jsx("th",{"data-slot":"table-head",className:_t("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function de({className:t,...s}){return e.jsx("td",{"data-slot":"table-cell",className:_t("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}const tE={getOnboardingPayments:async()=>{var s,n;const t=await Te.getOnboardingPayments();if(!t.ok)throw new Error(((s=t.data)==null?void 0:s.message)||"Failed to fetch onboarding payments");return((n=t.data)==null?void 0:n.payments)||[]},getFnFSettlements:async()=>{var s,n;const t=await Te.getFnFSettlements();if(!t.ok)throw new Error(((s=t.data)==null?void 0:s.message)||"Failed to fetch F&F settlements");return((n=t.data)==null?void 0:n.settlements)||[]},getFnFSettlementById:async t=>{var n,r;const s=await Te.getFnFSettlementById(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to fetch F&F details");return(r=s.data)==null?void 0:r.fnf},updatePayment:async(t,s)=>{var r;const n=await Te.updatePayment(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to update payment");return n.data},calculateFnF:async t=>{var n;const s=await Te.calculateFnF(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to calculate F&F");return s.data},addLineItem:async(t,s)=>{var r;const n=await Te.addLineItem(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to add line item");return n.data},updateFnF:async(t,s)=>{var r;const n=await Te.updateFnF(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to update F&F settlement");return n.data}};function JB({onNavigate:t,onViewPaymentDetails:s,onViewAuditDetails:n,onViewFnFDetails:r}){var D,O,z,G;const[a,l]=v.useState([]),[c,d]=v.useState([]),[m,x]=v.useState([]),[f,h]=v.useState(!0);v.useEffect(()=>{g()},[]);const g=async()=>{try{h(!0);const[Y,V]=await Promise.all([tE.getFnFSettlements(),ds.getApplications()]),X=V.data||[],ne=[];X.forEach(re=>{const ge=re.overallStatus||re.status,ve=["Payment Pending","Security Details","LOI In Progress","LOI Issued","LOA Pending","Dealer Code Generation","LOA_APPROVAL"].includes(ge),Se=re.securityDeposits||[];Se.length>0?Se.forEach(We=>{ne.push({...We,application:re,paymentStatus:We.status,paymentType:We.depositType,amount:We.amount,id:We.id,applicationId:re.applicationId||re.id,createdAt:We.createdAt,verificationDate:We.verifiedAt})}):ve&&(["Payment Pending","Security Details","LOI In Progress"].includes(ge)?ne.push({id:`virtual-${re.id}-sd`,applicationId:re.applicationId||re.id,application:re,paymentStatus:"Pending",paymentType:"SECURITY_DEPOSIT",amount:5e5,createdAt:re.updatedAt,isVirtual:!0}):["LOA Pending","Dealer Code Generation","LOA_APPROVAL"].includes(ge)&&ne.push({id:`virtual-${re.id}-ff`,applicationId:re.applicationId||re.id,application:re,paymentStatus:"Pending",paymentType:"FIRST_FILL",amount:15e5,createdAt:re.updatedAt,isVirtual:!0}))}),l(ne),d(Y);const oe=X.filter(re=>re.status==="FDD_VERIFICATION"||re.overallStatus==="FDD Verification"||re.currentStage==="FDD");x(oe)}catch(Y){console.error("Fetch error:",Y),ee.error("Failed to load dashboard data")}finally{h(!1)}},[u,j]=v.useState(!1),[p,y]=v.useState(!1),[N,S]=v.useState(null),[A,w]=v.useState([]),[E,T]=v.useState({department:"",description:"",type:"receivable",amount:""}),[C,L]=v.useState(""),$=()=>{const Y=A.filter(ne=>ne.type==="receivable").reduce((ne,oe)=>ne+oe.amount,0),V=A.filter(ne=>ne.type==="payable").reduce((ne,oe)=>ne+oe.amount,0),X=V-Y;return{totalReceivable:Y,totalPayable:V,netAmount:X}},_=async()=>{if(A.length===0){ee.error("Please add at least one line item");return}if(!C){ee.error("Please add final remarks");return}try{h(!0),ee.success("Finance summary submitted successfully"),j(!1),S(null),w([]),L(""),g()}catch{ee.error("Failed to submit summary")}finally{h(!1)}},R=Y=>{const V=String(Y||"").trim().toLowerCase();return V==="paid"||V==="verified"},P=a.filter(Y=>!R(Y.paymentStatus)),M=a.filter(Y=>R(Y.paymentStatus)),q=c.filter(Y=>Y.status==="Initiated"||Y.status==="Calculated"),K=c.filter(Y=>Y.status==="Completed"||Y.status==="Cleared"),Z=()=>{if(!E.department||!E.description||!E.amount){ee.error("Please fill in all line item fields");return}const Y={id:Date.now().toString(),department:E.department,description:E.description,type:E.type,amount:parseFloat(E.amount)};w([...A,Y]),T({department:"",description:"",type:"receivable",amount:""}),ee.success("Line item added")},W=Y=>{w(A.filter(V=>V.id!==Y)),ee.info("Line item removed")},{totalReceivable:U,totalPayable:F,netAmount:B}=$();return f?e.jsxs("div",{className:"flex items-center justify-center p-20 text-amber-600",children:[e.jsx(Js,{className:"w-8 h-8 animate-spin mr-3"}),e.jsx("span",{children:"Loading Finance Data..."})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl mb-2",children:"Finance Dashboard"}),e.jsx("p",{className:"text-slate-600",children:"Verify payments and create financial settlement summaries"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-3",children:[e.jsxs(Ie,{className:"cursor-pointer hover:shadow-lg transition-shadow border-amber-200 bg-amber-50/20",onClick:()=>{m.length>0&&n?n(m[0].applicationId||m[0].id):t==null||t("finance-onboarding")},children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{className:"text-amber-600 font-bold",children:"Pending Audits"}),e.jsx(nt,{className:"text-3xl text-amber-600",children:m.length})]}),e.jsxs(Me,{children:[e.jsx("p",{className:"text-slate-600 text-xs font-medium",children:"FDD Sign-offs"}),e.jsx(se,{variant:"link",className:"p-0 h-auto text-amber-600 mt-2 text-xs",children:"Review Now →"})]})]}),e.jsxs(Ie,{className:"cursor-pointer hover:shadow-lg transition-shadow border-yellow-200",onClick:()=>t==null?void 0:t("finance-onboarding"),children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Pending Verification"}),e.jsx(nt,{className:"text-3xl text-yellow-600",children:P.length})]}),e.jsxs(Me,{children:[e.jsx("p",{className:"text-slate-600",children:"Onboarding Payments"}),e.jsx(se,{variant:"link",className:"p-0 h-auto text-amber-600 mt-2",children:"View All →"})]})]}),e.jsxs(Ie,{className:"cursor-pointer hover:shadow-lg transition-shadow border-green-200",onClick:()=>t==null?void 0:t("finance-onboarding"),children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Verified"}),e.jsx(nt,{className:"text-3xl text-green-600",children:M.length})]}),e.jsxs(Me,{children:[e.jsx("p",{className:"text-slate-600",children:"Total Validated"}),e.jsx(se,{variant:"link",className:"p-0 h-auto text-amber-600 mt-2",children:"View All →"})]})]}),e.jsxs(Ie,{className:"cursor-pointer hover:shadow-lg transition-shadow border-orange-200",onClick:()=>t==null?void 0:t("finance-fnf"),children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Pending F&F Summary"}),e.jsx(nt,{className:"text-3xl text-orange-600",children:q.length})]}),e.jsxs(Me,{children:[e.jsx("p",{className:"text-slate-600",children:"Offboarding Cases"}),e.jsx(se,{variant:"link",className:"p-0 h-auto text-amber-600 mt-2",children:"View All →"})]})]}),e.jsxs(Ie,{className:"cursor-pointer hover:shadow-lg transition-shadow border-green-200",onClick:()=>t==null?void 0:t("finance-fnf"),children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"F&F Completed"}),e.jsx(nt,{className:"text-3xl text-green-600",children:K.length})]}),e.jsxs(Me,{children:[e.jsx("p",{className:"text-slate-600",children:"Settlements Done"}),e.jsx(se,{variant:"link",className:"p-0 h-auto text-amber-600 mt-2",children:"View All →"})]})]})]}),e.jsxs(_n,{defaultValue:"onboarding",className:"w-full",children:[e.jsxs(Pn,{className:"grid w-full grid-cols-2",children:[e.jsxs(Wt,{value:"onboarding",children:[e.jsx(oa,{className:"w-4 h-4 mr-2"}),"Onboarding"]}),e.jsxs(Wt,{value:"fnf",children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"F&F Settlement"]})]}),e.jsx(Kt,{value:"onboarding",className:"space-y-4",children:e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Payment Verification"}),e.jsx(Zt,{children:"Verify dealer advance payments for onboarding applications"})]}),e.jsx(Me,{children:e.jsxs(_n,{defaultValue:"pending",className:"w-full",children:[e.jsxs(Pn,{children:[e.jsxs(Wt,{value:"pending",children:["Pending (",P.length,")"]}),e.jsxs(Wt,{value:"verified",children:["Verified (",M.length,")"]})]}),e.jsx(Kt,{value:"pending",className:"mt-6",children:e.jsxs("div",{className:"space-y-4",children:[P.map(Y=>{var V,X;return e.jsx(Ie,{className:"border-yellow-200 bg-yellow-50/30",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("h3",{className:"text-lg font-bold",children:((V=Y.application)==null?void 0:V.applicationId)||"N/A"}),e.jsx(Ae,{className:"bg-yellow-100 text-yellow-700 border-yellow-300",children:Y.paymentStatus})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Applicant Name"}),e.jsx("p",{className:"font-medium",children:(X=Y.application)==null?void 0:X.applicantName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Type"}),e.jsx("p",{children:Y.paymentType==="SECURITY_DEPOSIT"?"Security Deposit":Y.paymentType==="FIRST_FILL"?"First Fill":Y.paymentType})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Amount"}),e.jsxs("p",{className:"text-amber-700 font-bold",children:["₹",parseFloat(Y.amount).toLocaleString("en-IN")]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Created On"}),e.jsx("p",{children:Ht(Y.createdAt)})]})]})]}),e.jsxs("div",{className:"ml-4 flex flex-col gap-2",children:[e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>{s&&s(Y.applicationId||Y.id)},children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"View Details"]}),e.jsxs(se,{size:"sm",className:"bg-green-600 hover:bg-green-700 font-bold",onClick:()=>{s&&s(Y.applicationId||Y.id)},children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"}),"Verify Payment"]})]})]})})},Y.id)}),P.length===0&&e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(Ys,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No pending payment verifications"})]})]})}),e.jsx(Kt,{value:"verified",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:M.map(Y=>{var V,X;return e.jsx(Ie,{className:"border-green-200 bg-green-50/30",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("h3",{className:"text-lg font-bold",children:((V=Y.application)==null?void 0:V.applicationId)||"N/A"}),e.jsx(Ae,{className:"bg-green-100 text-green-700 border-green-300",children:Y.paymentStatus})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Applicant Name"}),e.jsx("p",{className:"font-medium",children:(X=Y.application)==null?void 0:X.applicantName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Type"}),e.jsx("p",{children:Y.paymentType==="SECURITY_DEPOSIT"?"Security Deposit":Y.paymentType==="FIRST_FILL"?"First Fill":Y.paymentType})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Amount"}),e.jsxs("p",{className:"text-green-700 font-bold",children:["₹",parseFloat(Y.amount).toLocaleString("en-IN")]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Verified On"}),e.jsx("p",{children:Y.verificationDate?Ht(Y.verificationDate):"N/A"})]})]})]}),e.jsx("div",{className:"ml-4",children:e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>{s&&s(Y.applicationId||Y.id)},children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"View Details"]})})]})})},Y.id)})})})]})})]})}),e.jsx(Kt,{value:"fnf",className:"space-y-4",children:e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"F&F Financial Summary"}),e.jsx(Zt,{children:"Create financial settlement summaries for resignation and termination cases"})]}),e.jsx(Me,{children:e.jsxs(_n,{defaultValue:"pending",className:"w-full",children:[e.jsxs(Pn,{children:[e.jsxs(Wt,{value:"pending",children:["Pending Summary (",q.length,")"]}),e.jsxs(Wt,{value:"completed",children:["Completed (",K.length,")"]})]}),e.jsx(Kt,{value:"pending",className:"mt-6",children:e.jsxs("div",{className:"space-y-4",children:[q.map(Y=>{var V,X,ne,oe,re,ge,ve;return e.jsx(Ie,{className:"border-orange-200 bg-orange-50/30",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("h3",{className:"text-lg font-bold",children:((V=Y.resignation)==null?void 0:V.resignationId)||Y.id}),e.jsx(Ae,{variant:"outline",children:Y.resignation?"Resignation":Y.terminationRequest?"Termination":"General"}),e.jsx(Ae,{className:"bg-orange-100 text-orange-700 border-orange-300",children:Y.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm mb-3",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm mb-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 font-medium text-[10px] uppercase tracking-wider mb-1",children:"Dealer Name"}),e.jsx("p",{className:"font-semibold text-slate-900",children:((ne=(X=Y.outlet)==null?void 0:X.dealer)==null?void 0:ne.fullName)||((oe=Y.outlet)==null?void 0:oe.name)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 font-medium text-[10px] uppercase tracking-wider mb-1",children:"Dealer Code"}),e.jsx("p",{className:"font-mono text-xs font-bold text-blue-600",children:((re=Y.outlet)==null?void 0:re.code)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 font-medium text-[10px] uppercase tracking-wider mb-1",children:"Location"}),e.jsxs("p",{className:"text-slate-900",children:[((ge=Y.outlet)==null?void 0:ge.city)||"N/A",", ",((ve=Y.outlet)==null?void 0:ve.state)||""]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm bg-white/50 p-2 rounded-lg border border-slate-100",children:[e.jsx(Ys,{className:"w-4 h-4 text-emerald-500"}),e.jsxs("span",{className:"text-slate-600 font-medium",children:[e.jsx("span",{className:"text-emerald-600 font-bold",children:(Y.clearances||[]).filter(Se=>Se.status==="NOC Submitted"||Se.status==="Dues Pending").length}),"/16 Departments Cleared"]})]})]})]}),e.jsxs("div",{className:"ml-4 flex flex-col gap-2",children:[e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>{S(Y),y(!0)},children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"View Details"]}),e.jsxs(se,{size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:()=>{S(Y),w([]),L(""),j(!0)},children:[e.jsx(F2,{className:"w-4 h-4 mr-2"}),"Create Summary"]})]})]})})},Y.id)}),q.length===0&&e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(fs,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No F&F cases pending financial summary"})]})]})}),e.jsx(Kt,{value:"completed",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:K.map(Y=>e.jsx(Ie,{className:"border-green-200 bg-green-50/30",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("h3",{className:"text-lg font-bold",children:Y.id}),e.jsx(Ae,{variant:"outline",children:Y.type}),e.jsx(Ae,{className:"bg-green-100 text-green-700 border-green-300",children:Y.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{className:"font-medium",children:Y.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Code"}),e.jsx("p",{children:Y.dealerCode})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Net Settlement"}),e.jsxs("p",{className:Y.netAmount&&Y.netAmount>=0?"text-green-700":"text-red-700",children:["₹",Y.netAmount?Math.abs(Y.netAmount).toLocaleString("en-IN"):"0"]}),e.jsx("p",{className:"text-xs text-slate-500",children:Y.netAmount&&Y.netAmount>=0?"Payable to Dealer":"Receivable from Dealer"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Completed On"}),e.jsx("p",{children:Y.completedOn})]})]})]}),e.jsx("div",{className:"ml-4",children:e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>{r&&r(Y.id)},children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"View Details"]})})]})})},Y.id))})})]})})]})})]}),e.jsx(os,{open:u,onOpenChange:j,children:e.jsxs(ls,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Create Financial Settlement Summary"}),e.jsxs(vs,{children:[((D=N==null?void 0:N.resignation)==null?void 0:D.resignationId)||(N==null?void 0:N.id)," - ",N==null?void 0:N.dealerName," (",N==null?void 0:N.dealerCode,")"]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border rounded-lg p-4 bg-slate-50",children:[e.jsx("h3",{className:"text-sm font-bold mb-4",children:"Add Financial Line Item"}),e.jsxs("div",{className:"grid grid-cols-12 gap-3",children:[e.jsxs("div",{className:"col-span-3",children:[e.jsx(ce,{className:"text-xs",children:"Department"}),e.jsx(ot,{placeholder:"e.g., Warranty",value:E.department,onChange:Y=>T({...E,department:Y.target.value})})]}),e.jsxs("div",{className:"col-span-4",children:[e.jsx(ce,{className:"text-xs",children:"Description"}),e.jsx(ot,{placeholder:"e.g., Pending warranty claims",value:E.description,onChange:Y=>T({...E,description:Y.target.value})})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(ce,{className:"text-xs",children:"Type"}),e.jsxs(wt,{value:E.type,onValueChange:Y=>T({...E,type:Y}),children:[e.jsx(Ct,{children:e.jsx(St,{})}),e.jsxs(At,{children:[e.jsx(_e,{value:"receivable",children:"Receivable"}),e.jsx(_e,{value:"payable",children:"Payable"})]})]})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(ce,{className:"text-xs",children:"Amount (₹)"}),e.jsx(ot,{type:"number",placeholder:"0",value:E.amount,onChange:Y=>T({...E,amount:Y.target.value})})]}),e.jsx("div",{className:"col-span-1 flex items-end",children:e.jsx(se,{size:"sm",onClick:Z,className:"w-full bg-amber-600 hover:bg-amber-700",children:e.jsx(cn,{className:"w-4 h-4"})})})]})]}),A.length>0&&e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Description"}),e.jsx(me,{className:"text-center",children:"Type"}),e.jsx(me,{className:"text-right",children:"Amount"}),e.jsx(me,{className:"w-16"})]})}),e.jsx(Es,{children:A.map(Y=>e.jsxs(ct,{children:[e.jsx(de,{children:Y.department}),e.jsx(de,{children:Y.description}),e.jsx(de,{className:"text-center",children:e.jsx(Ae,{className:Y.type==="receivable"?"bg-red-100 text-red-700 border-red-200":"bg-green-100 text-green-700 border-green-200",children:Y.type==="receivable"?"Receivable":"Payable"})}),e.jsxs(de,{className:`text-right font-medium ${Y.type==="receivable"?"text-red-700":"text-green-700"}`,children:["₹",Y.amount.toLocaleString("en-IN")]}),e.jsx(de,{children:e.jsx(se,{size:"sm",variant:"ghost",onClick:()=>W(Y.id),children:e.jsx(Kn,{className:"w-4 h-4 text-red-600"})})})]},Y.id))})]})}),A.length>0&&e.jsxs("div",{className:"border rounded-lg p-4 bg-slate-900 text-white",children:[e.jsx("h3",{className:"text-sm font-bold mb-4",children:"Financial Settlement Summary"}),e.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-400 uppercase tracking-wider mb-1",children:"Total Payable"}),e.jsxs("p",{className:"text-3xl font-bold text-green-400",children:["₹",F.toLocaleString("en-IN")]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-400 uppercase tracking-wider mb-1",children:"Total receivable"}),e.jsxs("p",{className:"text-3xl font-bold text-red-400",children:["₹",U.toLocaleString("en-IN")]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-400 uppercase tracking-wider mb-1",children:"Net Settlement"}),e.jsxs("p",{className:`text-3xl font-bold ${B>=0?"text-green-400":"text-red-400"}`,children:["₹",Math.abs(B).toLocaleString("en-IN")]}),e.jsx("p",{className:"text-xs text-slate-400 mt-1 italic",children:B>=0?"Payable to Dealer":"Receivable from Dealer"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"font-bold",children:["Summary Remarks ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(Fs,{placeholder:"Add your final reconciliation remarks here...",rows:4,value:C,onChange:Y=>L(Y.target.value)})]})]}),e.jsxs(rn,{className:"border-t pt-4",children:[e.jsx(se,{variant:"outline",onClick:()=>j(!1),children:"Discard"}),e.jsxs(se,{className:"bg-green-600 hover:bg-green-700",onClick:_,disabled:A.length===0,children:[e.jsx(Yi,{className:"w-4 h-4 mr-2"}),"Finalize & Submit Summary"]})]})]})}),e.jsx(os,{open:p,onOpenChange:y,children:e.jsxs(ls,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Full Settlement Details"}),e.jsxs(vs,{children:[((O=N==null?void 0:N.resignation)==null?void 0:O.resignationId)||(N==null?void 0:N.id)," - ",N==null?void 0:N.dealerName]})]}),N&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(Ie,{className:"bg-slate-50 border-none",children:e.jsxs(Me,{className:"pt-6 grid grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-500 uppercase tracking-wider mb-1",children:"Dealer Code"}),e.jsx("p",{className:"text-lg font-bold",children:((z=N.outlet)==null?void 0:z.code)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-500 uppercase tracking-wider mb-1",children:"Location"}),e.jsx("p",{className:"text-lg font-bold",children:((G=N.outlet)==null?void 0:G.city)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-500 uppercase tracking-wider mb-1",children:"Current Status"}),e.jsx(Ae,{variant:"outline",className:"bg-amber-100 text-amber-700 border-amber-200",children:N.status})]})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(Ie,{className:"border-blue-100",children:[e.jsx(tt,{className:"bg-blue-50/50 pb-2",children:e.jsxs(nt,{className:"text-sm font-bold flex items-center gap-2",children:[e.jsx(Wi,{className:"w-4 h-4 text-blue-600"}),"Receivables Check"]})}),e.jsxs(Me,{className:"pt-4 space-y-3",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-500",children:"Security Deposit Credits"}),e.jsxs("span",{className:"font-bold text-slate-900",children:["₹",parseFloat(N.totalPayables||0).toLocaleString("en-IN")]})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-500",children:"Other Payable Credits"}),e.jsx("span",{className:"font-bold text-slate-900",children:"₹0"})]}),e.jsxs("div",{className:"border-t pt-2 flex justify-between font-bold text-blue-700",children:[e.jsx("span",{children:"Total Payables"}),e.jsxs("span",{children:["₹",parseFloat(N.totalPayables||0).toLocaleString("en-IN")]})]})]})]}),e.jsxs(Ie,{className:"border-red-100 shadow-sm",children:[e.jsx(tt,{className:"bg-red-50/30 pb-2 border-b border-red-50",children:e.jsxs(nt,{className:"text-sm font-bold flex items-center gap-2 text-red-700",children:[e.jsx(_o,{className:"w-4 h-4"}),"Receivables Check"]})}),e.jsxs(Me,{className:"pt-4 space-y-3",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-500",children:"Departmental Dues (Recoverable)"}),e.jsxs("span",{className:"font-bold text-red-600",children:["₹",parseFloat(N.totalReceivables||0).toLocaleString("en-IN")]})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-slate-500",children:"Outstanding Invoices"}),e.jsx("span",{className:"font-bold text-slate-900",children:"₹0"})]}),e.jsxs("div",{className:"border-t pt-2 flex justify-between font-bold text-red-700",children:[e.jsx("span",{children:"Total Recoveries"}),e.jsxs("span",{children:["₹",parseFloat(N.totalReceivables||0).toLocaleString("en-IN")]})]})]})]})]}),e.jsxs("div",{className:"p-5 bg-slate-900 text-white rounded-xl flex items-center justify-between shadow-lg",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`p-3 rounded-lg ${parseFloat(N.netAmount||0)>=0?"bg-emerald-500/20":"bg-rose-500/20"}`,children:e.jsx(oa,{className:`w-6 h-6 ${parseFloat(N.netAmount||0)>=0?"text-emerald-400":"text-rose-400"}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-400 uppercase font-bold tracking-widest mb-1",children:"Final Net Financial Position"}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("p",{className:`text-3xl font-bold tracking-tight ${parseFloat(N.netAmount||0)>=0?"text-emerald-400":"text-rose-400"}`,children:["₹",Math.abs(parseFloat(N.netAmount||0)).toLocaleString("en-IN")]}),e.jsxs("span",{className:"text-xs font-medium text-slate-400",children:["(",parseFloat(N.netAmount||0)>=0?"Payable to Dealer":"Recoverable from Dealer",")"]})]})]})]}),e.jsx(se,{className:"bg-blue-600 hover:bg-blue-500 px-6 font-bold shadow-md transition-all active:scale-95",children:"Generate PDF Summary"})]})]}),e.jsx(rn,{children:e.jsx(se,{onClick:()=>y(!1),children:"Close Overview"})})]})})]})}const Ll={getDashboardData:async()=>{var t;try{const s=await Te.getDealerDashboard();return((t=s.data)==null?void 0:t.data)||s.data}catch(s){throw console.error("Get dealer dashboard error:",s),s}},getConstitutionalChanges:async()=>{try{return(await Te.getConstitutionalChanges()).data}catch(t){throw console.error("Get constitutional changes error:",t),t}},submitConstitutionalChange:async t=>{try{return(await Te.createConstitutionalChange(t)).data}catch(s){throw console.error("Submit constitutional change error:",s),s}},getRelocationRequests:async()=>{try{return(await Te.getRelocationRequests()).data}catch(t){throw console.error("Get relocation requests error:",t),t}},submitRelocationRequest:async t=>{try{return(await Te.createRelocationRequest(t)).data}catch(s){throw console.error("Submit relocation request error:",s),s}}};function e7({currentUser:t,onNavigate:s}){var u,j;const[n,r]=v.useState(!0),[a,l]=v.useState(null);if(v.useEffect(()=>{(async()=>{try{const y=await Ll.getDashboardData();l(y)}catch(y){console.error("Failed to fetch dashboard:",y)}finally{r(!1)}})()},[]),n)return e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px]",children:[e.jsx(ss,{className:"w-10 h-10 text-amber-600 animate-spin mb-4"}),e.jsx("p",{className:"text-slate-600",children:"Loading your dashboard..."})]});const c=a||{},d=c.profile||{},m=c.stats||{constitutional:0,relocation:0,total:0},x=c.recentRequests||[],f=((u=c.outlets)==null?void 0:u[0])||{},h=[{title:"Constitutional Changes",value:m.constitutional,icon:Gi,color:"bg-blue-500",change:"Active Requests",onClick:()=>s("dealer-constitutional")},{title:"Relocation Requests",value:m.relocation,icon:Er,color:"bg-amber-500",change:"Active Requests",onClick:()=>s("dealer-relocation")},{title:"My Outlets",value:((j=c.outlets)==null?void 0:j.length)||0,icon:fL,color:"bg-purple-500",change:"Registered",onClick:()=>{}},{title:"Total Requests",value:m.total,icon:Wi,color:"bg-green-500",change:"All time",onClick:()=>{}}],g=[{title:"Constitutional Change",description:"Request change in business structure",icon:Gi,color:"bg-blue-50 hover:bg-blue-100 border-blue-200",textColor:"text-blue-700",onClick:()=>s("dealer-constitutional")},{title:"Request Relocation",description:"Move dealership to new location",icon:Er,color:"bg-amber-50 hover:bg-amber-100 border-amber-200",textColor:"text-amber-700",onClick:()=>s("dealer-relocation")}];return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-gradient-to-r from-amber-500 to-amber-600 rounded-lg p-6 text-white",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-white mb-2",children:["Welcome back, ",d.name||(t==null?void 0:t.name),"!"]}),e.jsxs("p",{className:"text-amber-100",children:["Dealer Code: ",d.dealerCode," • ",d.businessName]}),e.jsxs("p",{className:"text-amber-100 text-sm mt-1",children:[f.name," • ",f.location]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-white",children:"Active Dealership"}),e.jsxs(Ae,{className:"bg-green-500 text-white border-0 mt-2",children:[e.jsx(Ys,{className:"w-3 h-3 mr-1"}),"Operational"]})]})]})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:h.map((p,y)=>{const N=p.icon;return e.jsxs(Ie,{className:"cursor-pointer hover:shadow-lg transition-shadow",onClick:p.onClick,children:[e.jsxs(tt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(nt,{className:"text-sm",children:p.title}),e.jsx("div",{className:`${p.color} p-2 rounded-lg`,children:e.jsx(N,{className:"h-4 w-4 text-white"})})]}),e.jsxs(Me,{children:[e.jsx("div",{className:"text-slate-900 text-2xl",children:p.value}),e.jsx("p",{className:"text-xs text-slate-600 mt-1",children:p.change})]})]},y)})}),e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Quick Actions"}),e.jsx(Zt,{children:"Submit new requests and manage your dealership"})]}),e.jsx(Me,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:g.map((p,y)=>{const N=p.icon;return e.jsx("button",{onClick:p.onClick,className:`${p.color} border-2 rounded-lg p-4 text-left transition-all`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`${p.textColor} p-2 bg-white rounded-lg`,children:e.jsx(N,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:`${p.textColor} mb-1`,children:p.title}),e.jsx("p",{className:"text-slate-600 text-sm",children:p.description})]})]})},y)})})})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"My Recent Requests"}),e.jsx(Zt,{children:"Track the status of your submitted requests"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-3",children:x.map(p=>e.jsxs("div",{className:"flex items-center justify-between p-4 border border-slate-200 rounded-lg hover:bg-slate-50 transition-colors",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-slate-900",children:p.id}),e.jsx(Ae,{variant:"outline",className:"text-xs",children:p.type})]}),e.jsx("p",{className:"text-slate-600 text-sm",children:p.title}),e.jsxs("p",{className:"text-slate-500 text-xs mt-1",children:["Submitted on ",p.date]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ae,{className:`border ${p.color}`,children:p.status}),e.jsx(se,{variant:"ghost",size:"sm",children:"View"})]})]},p.id))})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(Js,{className:"w-5 h-5 text-amber-600"}),"Important Reminders"]})}),e.jsx(Me,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Gs,{className:"w-4 h-4 text-amber-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 text-sm",children:"GST Filing Due"}),e.jsx("p",{className:"text-slate-600 text-xs",children:"Due by Jan 15, 2026"})]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Gs,{className:"w-4 h-4 text-amber-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 text-sm",children:"Inventory Audit Scheduled"}),e.jsx("p",{className:"text-slate-600 text-xs",children:"Jan 20, 2026"})]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ys,{className:"w-4 h-4 text-green-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 text-sm",children:"Compliance Report Submitted"}),e.jsx("p",{className:"text-slate-600 text-xs",children:"Jan 2, 2026"})]})]})]})})]}),e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(da,{className:"w-5 h-5 text-blue-600"}),"Support & Help"]})}),e.jsx(Me,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 text-sm mb-1",children:"Regional Manager"}),e.jsx("p",{className:"text-slate-600 text-xs",children:"Rajesh Kumar - +91 98765 43210"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 text-sm mb-1",children:"Zonal Business Head"}),e.jsx("p",{className:"text-slate-600 text-xs",children:"Priya Sharma - +91 98765 43211"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 text-sm mb-1",children:"Support Email"}),e.jsx("p",{className:"text-slate-600 text-xs",children:"dealer.support@royalenfield.com"})]}),e.jsx(se,{variant:"outline",className:"w-full mt-2",children:"Contact Support"})]})})]})]})]})}function t7({id:t,onBack:s}){var M,q;const n=["PAN Card","GST Certificate","Aadhaar Card","Security Deposit Receipt","First Fill Receipt","Partnership Deed","LLP Agreement","Certificate of Incorporation","MOA","AOA","Firm Registration","Rental Agreement","Property Documents","Nodal Agreement","Cancelled Check","LOI Acknowledgement","Architecture Blueprint","Site Plan","Other"],[r,a]=v.useState(null),[l,c]=v.useState(!0),[d,m]=v.useState([]),[x,f]=v.useState(""),[h,g]=v.useState(null),[u,j]=v.useState(!1),[p,y]=v.useState(!1),N={panNumber:"",gstNumber:"",registeredAddress:"",bankName:"",accountNumber:"",ifscCode:"",branchName:"",accountHolderName:""},[S,A]=v.useState(N),[w,E]=v.useState(N),T=JSON.stringify(S)!==JSON.stringify(w),C=new Set(d.map(K=>String(K.documentType||"").trim().toLowerCase())),L=x?C.has(x.toLowerCase()):!1;v.useEffect(()=>{$()},[t]);const $=async()=>{var K,Z;c(!0);try{const[W,U]=await Promise.all([Te.getApplicationById(t),Te.getDocuments(t)]);if((K=W.data)!=null&&K.success){const F=W.data.data,B={panNumber:F.panNumber||"",gstNumber:F.gstNumber||"",registeredAddress:F.registeredAddress||F.address||"",bankName:F.bankName||"",accountNumber:F.accountNumber||"",ifscCode:F.ifscCode||"",branchName:F.branchName||"",accountHolderName:F.accountHolderName||F.applicantName||""};a(F),A(B),E(B)}((Z=U.data)!=null&&Z.success||U.ok)&&m(U.data.data||[])}catch(W){console.error("Failed to fetch details:",W),ee.error("Failed to load application details")}finally{c(!1)}},_=async()=>{var K;y(!0);try{console.log("Saving business details for:",t,S);const Z=await Te.updateApplication(t,S);if(Z.ok)ee.success("Business details saved successfully"),await $();else{const W=((K=Z.data)==null?void 0:K.message)||"Failed to update business details";ee.error(W),console.error("Update failed:",Z)}}catch(Z){console.error("Save details fatal error:",Z),ee.error(Z.message||"A network error occurred while saving")}finally{y(!1)}},R=K=>{K.target.files&&K.target.files[0]&&g(K.target.files[0])},P=async()=>{var Z,W,U;if(!h||!x){ee.error("Please select a document type and file");return}const K=new FormData;K.append("file",h),K.append("documentType",x),j(!0);try{const F=await Te.uploadDocument(t,K);if((Z=F.data)!=null&&Z.success||F.ok){ee.success("Document uploaded successfully"),g(null),f("");const B=document.getElementById("file-upload");B&&(B.value="");const D=await Te.getDocuments(t);((W=D.data)!=null&&W.success||D.ok)&&m(D.data.data||[])}else ee.error(((U=F.data)==null?void 0:U.message)||"Upload failed")}catch(F){console.error("Upload error:",F),ee.error("Upload failed")}finally{j(!1)}};return l?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(Rr,{className:"w-8 h-8 animate-spin text-amber-600"})}):r?e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("button",{onClick:s,className:"mr-3 p-1.5 rounded-full hover:bg-slate-200 text-slate-600 transition-colors","data-testid":"onboarding-prospective-details-back-btn",children:e.jsx(qc,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900 text-2xl font-bold mb-1",children:"Application Details"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-slate-600 font-medium","data-testid":"onboarding-prospective-details-app-id",children:r.applicationId||"Loading..."}),r.districtId?e.jsx("span",{className:"text-[10px] bg-green-100 text-green-700 font-bold px-1.5 py-0.5 rounded uppercase tracking-wider","data-testid":"onboarding-prospective-details-type-badge",children:"Opportunity"}):e.jsx("span",{className:"text-[10px] bg-blue-100 text-blue-700 font-bold px-1.5 py-0.5 rounded uppercase tracking-wider","data-testid":"onboarding-prospective-details-type-badge",children:"Future Reference"})]})]})]})}),e.jsxs("div",{className:"animate-in fade-in duration-500 space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-slate-200 shadow-sm p-6","data-testid":"onboarding-prospective-details-summary-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4 border-b pb-2",children:[e.jsxs("h4",{className:"text-lg font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(Xa,{className:"w-5 h-5 text-amber-600"})," Application Summary"]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-widest",children:"Current Stage"}),e.jsx("span",{className:"bg-amber-100 text-amber-700 px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wide","data-testid":"onboarding-prospective-details-current-stage",children:r.currentStage||r.overallStatus})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3","data-testid":"onboarding-prospective-details-applicant-info",children:[e.jsx("div",{className:"p-2 bg-blue-50 rounded-lg",children:e.jsx(kr,{className:"w-4 h-4 text-blue-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Applicant"}),e.jsx("p",{className:"text-sm font-semibold text-slate-900","data-testid":"onboarding-prospective-details-name",children:r.applicantName}),e.jsxs("p",{className:"text-xs text-slate-600",children:[r.email," | ",r.phone]})]})]}),e.jsxs("div",{className:"flex items-start gap-3","data-testid":"onboarding-prospective-details-location-info",children:[e.jsx("div",{className:"p-2 bg-amber-50 rounded-lg",children:e.jsx(Er,{className:"w-4 h-4 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Proposed Location"}),e.jsxs("p",{className:"text-sm font-semibold text-slate-900",children:[r.city,", ",r.state]}),e.jsx("p",{className:"text-xs text-slate-600",children:r.preferredLocation||"Standard Area"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3","data-testid":"onboarding-prospective-details-concept-info",children:[e.jsx("div",{className:"p-2 bg-green-50 rounded-lg",children:e.jsx(Dc,{className:"w-4 h-4 text-green-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Business Concept"}),e.jsxs("p",{className:"text-sm font-semibold text-slate-900",children:[r.businessType," - ",r.constitutionType]}),e.jsxs("p",{className:"text-xs text-slate-600",children:["Investment: ",r.investmentCapacity]})]})]}),e.jsxs("div",{className:"flex items-start gap-3","data-testid":"onboarding-prospective-details-date-info",children:[e.jsx("div",{className:"p-2 bg-slate-50 rounded-lg",children:e.jsx(Js,{className:"w-4 h-4 text-slate-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Applied On"}),e.jsx("p",{className:"text-sm font-semibold text-slate-900",children:r.createdAt?new Date(r.createdAt).toLocaleDateString("en-IN",{day:"numeric",month:"long",year:"numeric"}):"-"})]})]})]}),e.jsxs("div",{className:"bg-slate-50 rounded-xl p-4 flex flex-col justify-center border border-slate-100","data-testid":"onboarding-prospective-details-progress-card",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("p",{className:"text-xs font-bold text-slate-700 uppercase tracking-tight",children:"Onboarding Progress"}),e.jsxs("p",{className:"text-xs font-black text-amber-600",children:[r.progressPercentage||0,"%"]})]}),e.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2 shadow-inner",children:e.jsx("div",{className:"bg-amber-500 h-2 rounded-full transition-all duration-1000 ease-out shadow-sm",style:{width:`${r.progressPercentage||0}%`}})}),((q=(M=r.statusHistory)==null?void 0:M[0])==null?void 0:q.changeReason)&&e.jsxs("p",{className:"mt-3 text-[11px] text-slate-600 italic leading-relaxed border-l-2 border-amber-300 pl-2",children:['"',r.statusHistory[0].changeReason,'"']})]})]})]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:e.jsxs("div",{className:"lg:col-span-3 space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-slate-200 shadow-sm overflow-hidden","data-testid":"onboarding-prospective-details-statutory-card",children:[e.jsxs("div",{className:"p-4 bg-slate-900 text-white flex justify-between items-center",children:[e.jsxs("h4",{className:"flex items-center gap-2 text-sm font-bold uppercase tracking-widest",children:[e.jsx(mu,{className:"w-4 h-4 text-amber-400"})," Statutory & Bank Details"]}),e.jsxs("button",{onClick:_,disabled:p,className:`text-xs text-white px-3 py-1 rounded font-bold transition-all flex items-center gap-1 disabled:opacity-50 ${T?"bg-emerald-600 hover:bg-emerald-700 ring-2 ring-emerald-300 animate-pulse":"bg-amber-600 hover:bg-amber-700"}`,"data-testid":"onboarding-prospective-details-save-statutory-btn",children:[p?e.jsx(Rr,{className:"w-3 h-3 animate-spin"}):e.jsx(Fn,{className:"w-3 h-3"}),"Save Business Info"]})]}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Registered Business Name"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all",value:S.accountHolderName,onChange:K=>A({...S,accountHolderName:K.target.value}),placeholder:"As per legal documents","data-testid":"onboarding-prospective-details-input-biz-name"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Permanent Account Number (PAN)"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all uppercase",value:S.panNumber,onChange:K=>A({...S,panNumber:K.target.value.toUpperCase()}),placeholder:"ABCDE1234F",maxLength:10,"data-testid":"onboarding-prospective-details-input-pan"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"GST Identification Number (GSTIN)"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all uppercase",value:S.gstNumber,onChange:K=>A({...S,gstNumber:K.target.value.toUpperCase()}),placeholder:"27ABCDE1234F1Z5",maxLength:15,"data-testid":"onboarding-prospective-details-input-gst"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Registered Office Address"}),e.jsx("textarea",{rows:1,className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all",value:S.registeredAddress,onChange:K=>A({...S,registeredAddress:K.target.value}),placeholder:"Full legal address","data-testid":"onboarding-prospective-details-input-address"})]}),e.jsx("div",{className:"md:col-span-2 border-t pt-2 mt-2",children:e.jsxs("h5",{className:"text-xs font-black text-slate-900 uppercase flex items-center gap-2 mb-3",children:[e.jsx(z2,{className:"w-3.5 h-3.5 text-blue-600"})," Primary Bank Information"]})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Bank Name"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all",value:S.bankName,onChange:K=>A({...S,bankName:K.target.value}),placeholder:"e.g. HDFC Bank","data-testid":"onboarding-prospective-details-input-bank"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Account Number"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all",value:S.accountNumber,onChange:K=>A({...S,accountNumber:K.target.value}),placeholder:"Bank account number","data-testid":"onboarding-prospective-details-input-acc-num"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"IFSC Code"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all uppercase",value:S.ifscCode,onChange:K=>A({...S,ifscCode:K.target.value.toUpperCase()}),placeholder:"HDFC0001234",maxLength:11,"data-testid":"onboarding-prospective-details-input-ifsc"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Branch Name"}),e.jsx("input",{type:"text",className:"w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-amber-500 outline-none transition-all",value:S.branchName,onChange:K=>A({...S,branchName:K.target.value}),placeholder:"e.g. South Mumbai","data-testid":"onboarding-prospective-details-input-branch"})]})]})})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-slate-200 shadow-sm overflow-hidden","data-testid":"onboarding-prospective-details-upload-card",children:[e.jsx("div",{className:"p-4 border-b border-slate-200 bg-slate-50 flex justify-between items-center",children:e.jsxs("h4",{className:"flex items-center gap-2 text-sm font-bold uppercase tracking-widest text-slate-900",children:[e.jsx(Dr,{className:"w-4 h-4 text-blue-600"})," Required Documents"]})}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 bg-slate-50 rounded-lg border border-slate-100",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Document Category"}),x&&e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-bold ${L?"bg-blue-100 text-blue-700":"bg-amber-100 text-amber-700"}`,children:L?"Already uploaded":"Pending upload"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Fn,{className:`pointer-events-none absolute left-3 top-1/2 z-10 h-4 w-4 -translate-y-1/2 ${L?"text-green-600":"text-slate-300"}`}),e.jsxs(wt,{value:x,onValueChange:f,disabled:u,children:[e.jsx(Ct,{className:"h-12 rounded-xl border-slate-200 bg-gradient-to-r from-white to-slate-50 pl-10 pr-3 text-sm font-medium text-slate-700 shadow-sm focus:border-amber-300 focus:ring-2 focus:ring-amber-500","data-testid":"onboarding-prospective-details-doc-type-select",children:e.jsx(St,{placeholder:"Choose document type"})}),e.jsx(At,{className:"rounded-xl border-slate-200 shadow-lg","data-testid":"onboarding-prospective-details-doc-type-content",children:n.map(K=>{const Z=C.has(K.toLowerCase());return e.jsx(_e,{value:K,className:"rounded-lg px-3 py-2 text-sm text-slate-700 focus:bg-amber-50 focus:text-slate-900","data-testid":`onboarding-prospective-details-doc-type-item-${K.replace(/\s+/g,"-").toLowerCase()}`,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Fn,{className:`h-4 w-4 ${Z?"text-green-600":"text-slate-300"}`}),K]})},K)})})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-[10px] font-bold text-slate-500 uppercase",children:"Select File"}),e.jsx("input",{type:"file",id:"file-upload",className:"w-full text-xs text-slate-600 file:mr-4 file:py-1 file:px-4 file:rounded-full file:border-0 file:text-xs file:font-semibold file:bg-amber-50 file:text-amber-700 hover:file:bg-amber-100",onChange:R,disabled:u,"data-testid":"onboarding-prospective-details-file-input"})]}),e.jsx("div",{className:"md:col-span-2 flex justify-end",children:e.jsxs("button",{onClick:P,disabled:!h||!x||u,className:"bg-blue-600 text-white px-5 py-2 rounded-md hover:bg-blue-700 disabled:opacity-50 text-xs font-bold transition-all shadow-sm flex items-center gap-2","data-testid":"onboarding-prospective-details-upload-btn",children:[u?e.jsx(Rr,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Dr,{className:"w-3.5 h-3.5"}),"Upload Document"]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-slate-900 border-b pb-1",children:[e.jsx(bm,{className:"w-4 h-4 text-blue-600"}),e.jsxs("h3",{className:"text-xs font-black uppercase tracking-tighter",children:["Uploaded Library (",d.length,")"]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3","data-testid":"onboarding-prospective-details-doc-library",children:d.length>0?d.map((K,Z)=>e.jsxs("div",{className:"flex justify-between items-center p-3 border border-slate-100 rounded-xl bg-slate-50 group hover:border-amber-200 transition-all","data-testid":`onboarding-prospective-details-doc-item-${Z}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-white flex items-center justify-center border border-slate-200 group-hover:bg-blue-50",children:e.jsx(bm,{className:"w-4 h-4 text-slate-400 group-hover:text-blue-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-bold text-slate-900","data-testid":`onboarding-prospective-details-doc-type-${Z}`,children:K.documentType}),e.jsx("p",{className:"text-[10px] text-slate-400 truncate w-32",children:K.fileName})]})]}),e.jsx("span",{className:`text-[9px] px-2 py-0.5 rounded-full font-black uppercase tracking-tighter ${K.status==="Approved"?"bg-green-100 text-green-700":"bg-amber-100 text-amber-700"}`,"data-testid":`onboarding-prospective-details-doc-status-${Z}`,children:K.status||"Pending"})]},K.id)):e.jsxs("div",{className:"col-span-2 py-8 text-center bg-slate-50 rounded-xl border border-dashed border-slate-200","data-testid":"onboarding-prospective-details-doc-empty",children:[e.jsx(Xa,{className:"w-6 h-6 text-slate-300 mx-auto mb-2"}),e.jsx("p",{className:"text-xs text-slate-500 font-medium",children:"No documents in your library yet"})]})})]})]})]})]})})]})]}):e.jsxs("div",{className:"bg-white rounded-xl border border-slate-200 p-8 text-center",children:[e.jsx("p",{className:"text-slate-600 mb-4",children:"Application details not found."}),e.jsx("button",{onClick:s,className:"bg-amber-600 text-white px-4 py-2 rounded-md hover:bg-amber-700",children:"Go Back"})]})}function s7(){var m;const t=su(),s=qn(),{user:n}=Nn(x=>x.auth),[r,a]=v.useState(!1),[l,c]=v.useState("applicant"),d=()=>{t(r2()),ee.info("Logged out successfully"),s("/")};return e.jsxs("div",{className:"flex h-screen bg-slate-50",children:[e.jsxs("div",{className:`bg-slate-900 text-white h-screen flex flex-col transition-all duration-300 ${r?"w-20":"w-64"}`,children:[e.jsx("div",{className:"p-4 border-b border-slate-800",children:e.jsxs("div",{className:"flex items-center justify-between",children:[!r&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-10 h-10 bg-amber-600 rounded-lg flex items-center justify-center",children:e.jsx(fs,{className:"w-6 h-6 text-white"})}),e.jsx("span",{className:"text-amber-600 font-bold",children:"Applicant Portal"})]}),e.jsx("button",{onClick:()=>a(!r),className:"p-1 hover:bg-slate-800 rounded transition-colors",children:r?e.jsx(el,{className:"w-5 h-5"}):e.jsx(qc,{className:"w-5 h-5"})})]})}),e.jsx("nav",{className:"flex-1 p-4 space-y-2",children:e.jsx("div",{children:e.jsxs("button",{onClick:()=>{c("applicant"),s("/prospective-dashboard")},className:`w-full flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${l==="applicant"?"bg-amber-600 text-white":"text-slate-300 hover:bg-slate-800 hover:text-white"}`,children:[e.jsx(fs,{className:"w-5 h-5 flex-shrink-0"}),!r&&e.jsx("span",{className:"flex-1 text-left",children:"My Applications"})]})})}),e.jsxs("div",{className:"p-4 border-t border-slate-800 space-y-2",children:[!r&&e.jsx("div",{className:"px-4 py-2 bg-slate-800 rounded-lg mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-amber-600 rounded-full flex items-center justify-center text-white",children:e.jsx("span",{className:"font-bold",children:((m=n==null?void 0:n.name)==null?void 0:m.charAt(0))||"A"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:(n==null?void 0:n.name)||"Applicant"}),e.jsx("p",{className:"text-slate-400 truncate text-xs",children:(n==null?void 0:n.role)||"Prospective"})]})]})}),e.jsxs("button",{onClick:d,className:`w-full flex items-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all h-9 px-4 py-2 text-slate-300 hover:bg-slate-800 hover:text-white ${r?"justify-center":"justify-start"}`,children:[e.jsx(V2,{className:"w-5 h-5 flex-shrink-0"}),!r&&e.jsx("span",{className:"ml-3",children:"Logout"})]})]})]}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx("header",{className:"bg-white border-b border-slate-200 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900 text-xl font-semibold",children:"Applicant Management"}),e.jsx("p",{className:"text-slate-600 text-sm",children:"Manage and track dealership applications"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 bg-slate-100 rounded-lg",children:[e.jsx("div",{className:"w-8 h-8 bg-amber-600 rounded-full flex items-center justify-center",children:e.jsx(kr,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"text-slate-900 text-sm font-medium",children:(n==null?void 0:n.name)||"Applicant"}),e.jsx("p",{className:"text-slate-600 text-xs",children:(n==null?void 0:n.role)||"User"})]})]}),e.jsx("button",{className:"p-2 rounded-md hover:bg-slate-100",title:"Refresh",onClick:()=>window.location.reload(),children:e.jsx(Rr,{className:"w-4 h-4 text-slate-600"})})]})]})}),e.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:e.jsxs(ev,{children:[e.jsx(Ns,{path:"/",element:e.jsx(n7,{})}),e.jsx(Ns,{path:"/application/:id",element:e.jsx(r7,{})})]})})]})]})}function n7(){const t=qn(),{user:s}=Nn(l=>l.auth),[n,r]=v.useState([]);v.useEffect(()=>{s!=null&&s.id&&a()},[s==null?void 0:s.id]);const a=async()=>{var l;try{const c=await Te.getApplications();(l=c.data)!=null&&l.success&&r(c.data.data)}catch(c){console.error("Failed to fetch applications",c)}};return e.jsx("div",{className:"max-w-7xl mx-auto",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-8",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900 text-3xl font-bold mb-2",children:"My Applications"}),e.jsx("p",{className:"text-slate-500 font-medium",children:"Track and manage your dealership applications"})]})}),n.length===0?e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 border-dashed p-12 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-slate-50 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(fs,{className:"w-8 h-8 text-slate-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-1",children:"No applications found"}),e.jsx("p",{className:"text-slate-500 max-w-sm mx-auto mb-6",children:"You haven't submitted any dealership applications yet."})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:n.map(l=>e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-6 shadow-sm hover:shadow-md hover:border-amber-500 cursor-pointer transition-all group",onClick:()=>t(`/prospective-dashboard/application/${l.id}`),children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsx("div",{className:"w-12 h-12 bg-amber-50 rounded-xl flex items-center justify-center group-hover:bg-amber-600 transition-colors",children:e.jsx(fs,{className:"w-6 h-6 text-amber-600 group-hover:text-white"})}),e.jsx(Ae,{className:`px-4 py-1.5 rounded-xl text-[10px] uppercase font-bold ${l.overallStatus==="Completed"?"bg-green-100 text-green-700":l.overallStatus==="Rejected"?"bg-red-100 text-red-700":"bg-amber-100 text-amber-700"}`,children:l.overallStatus||"Active"})]}),e.jsx("h3",{className:"text-xl font-bold text-slate-900 mb-1 truncate",children:l.applicationId}),e.jsxs("p",{className:"text-slate-500 text-sm mb-4 font-medium",children:[l.city,", ",l.state]}),e.jsxs("div",{className:"space-y-4 pt-6 border-t border-slate-100",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-slate-500 font-medium",children:"Current Stage"}),e.jsx("span",{className:"text-xs font-bold text-slate-900 bg-slate-100 px-3 py-1 rounded-lg",children:l.currentStage||"Initial"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-slate-500 font-medium",children:"Applied"}),e.jsx("span",{className:"text-xs font-bold text-slate-600",children:Ht(l.createdAt)})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-wider",children:"Progress"}),e.jsxs("span",{className:"text-xs font-bold text-amber-600",children:[l.progressPercentage||0,"%"]})]}),e.jsx("div",{className:"w-full bg-slate-100 rounded-full h-2",children:e.jsx("div",{className:"bg-amber-500 h-2 rounded-full transition-all duration-1000",style:{width:`${l.progressPercentage||0}%`}})})]})]})]},l.id))})]})})}function r7(){const{id:t}=Bc(),s=qn();return t?e.jsx("div",{className:"max-w-7xl mx-auto",children:e.jsx(t7,{id:t,onBack:()=>s("/prospective-dashboard")})}):null}function a7(){const t=qn(),[s,n]=v.useState([]),[r,a]=v.useState(!0),[l,c]=v.useState("");v.useEffect(()=>{d()},[]);const d=async()=>{var x;a(!0);try{const f=await Te.getApplications();(x=f.data)!=null&&x.success&&n(f.data.data)}catch(f){console.error("Failed to fetch FDD applications:",f),ee.error("Failed to load assigned applications")}finally{a(!1)}},m=s.filter(x=>{var f;return x.applicationId.toLowerCase().includes(l.toLowerCase())||x.applicantName.toLowerCase().includes(l.toLowerCase())||((f=x.city)==null?void 0:f.toLowerCase().includes(l.toLowerCase()))});return e.jsxs("div",{className:"space-y-6 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-slate-900 tracking-tight",children:"FDD Dashboard"}),e.jsx("p",{className:"text-slate-500",children:"Manage financial due diligence for assigned dealer applications"})]}),e.jsxs("button",{onClick:d,className:"flex items-center gap-2 px-4 py-2 bg-white border border-slate-200 rounded-lg hover:bg-slate-50 transition-colors text-sm font-medium",children:[e.jsx(Rr,{className:`w-4 h-4 ${r?"animate-spin":""}`}),"Refresh"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsx(Ie,{className:"bg-white border-slate-200 shadow-sm",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider",children:"Total Assigned"}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900",children:s.length})]}),e.jsx("div",{className:"p-2 bg-slate-100 rounded-lg text-slate-600",children:e.jsx(fs,{className:"w-5 h-5"})})]})})}),e.jsx(Ie,{className:"bg-white border-slate-200 shadow-sm",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider",children:"Pending Reports"}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900",children:s.filter(x=>x.currentStage==="FDD"||x.overallStatus==="Active").length})]}),e.jsx("div",{className:"p-2 bg-slate-100 rounded-lg text-slate-600",children:e.jsx(Js,{className:"w-5 h-5"})})]})})}),e.jsx(Ie,{className:"bg-white border-slate-200 shadow-sm",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider",children:"Completed Reports"}),e.jsx("h3",{className:"text-2xl font-bold text-slate-900",children:"0"})]}),e.jsx("div",{className:"p-2 bg-slate-100 rounded-lg text-slate-600",children:e.jsx(Fn,{className:"w-5 h-5"})})]})})})]}),e.jsxs(Ie,{className:"shadow-sm border-slate-200 overflow-hidden",children:[e.jsxs(tt,{className:"bg-white border-b border-slate-100 px-6 py-4 flex flex-row items-center justify-between",children:[e.jsxs(nt,{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(fs,{className:"w-5 h-5 text-blue-600"}),"My Assigned Cases"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx("input",{type:"text",placeholder:"Search by ID or Name...",className:"pl-9 pr-4 py-2 bg-slate-50 border-slate-200 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 transition-all outline-none",value:l,onChange:x=>c(x.target.value)})]}),e.jsx("button",{className:"p-2 border border-slate-200 rounded-lg hover:bg-slate-50 transition-colors",children:e.jsx(B2,{className:"w-4 h-4 text-slate-600"})})]})]}),e.jsx(Me,{className:"p-0",children:r?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 px-6",children:[e.jsx(Rr,{className:"w-10 h-10 animate-spin text-blue-600 mb-4"}),e.jsx("p",{className:"text-slate-500 font-medium",children:"Synchronizing application data..."})]}):m.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 px-6 text-center",children:[e.jsx("div",{className:"w-20 h-20 bg-slate-50 rounded-full flex items-center justify-center mb-6",children:e.jsx(Gs,{className:"w-10 h-10 text-slate-200"})}),e.jsx("h3",{className:"text-xl font-bold text-slate-900 mb-2",children:"No Applications Found"}),e.jsx("p",{className:"text-slate-500 max-w-md mx-auto",children:"You don't have any applications assigned for Financial Due Diligence at this time."})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{className:"bg-slate-50 border-b border-slate-200",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider",children:"Application Details"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider",children:"Location"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider",children:"Current Stage"}),e.jsx("th",{className:"px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider text-right",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-slate-100",children:m.map(x=>e.jsxs("tr",{className:"hover:bg-slate-50 transition-colors cursor-pointer group",onClick:()=>t(`/fdd-details/${x.id}`),children:[e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center font-bold",children:x.applicantName.charAt(0)}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-slate-900 group-hover:text-blue-600 transition-colors",children:x.applicationId}),e.jsx("p",{className:"text-xs text-slate-500",children:x.applicantName})]})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-slate-700",children:[x.city,", ",x.state]}),e.jsx("p",{className:"text-xs text-slate-400 capitalize",children:x.locationType||"New Market"})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsx(Ae,{className:`px-3 py-1 rounded-full text-[10px] uppercase font-bold tracking-wider ${x.overallStatus==="Completed"?"bg-green-100 text-green-700":"bg-amber-100 text-amber-700"}`,children:x.overallStatus==="Active"?"FDD Pending":x.overallStatus})}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsx("button",{className:"p-2 text-slate-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-all",children:e.jsx(To,{className:"w-5 h-5"})})})]},x.id))})]})})})]})]})}const i7="modulepreload",l7=function(t){return"/"+t},n1={},Tl=function(s,n,r){let a=Promise.resolve();if(n&&n.length>0){let c=function(x){return Promise.all(x.map(f=>Promise.resolve(f).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=c(n.map(x=>{if(x=l7(x),x in n1)return;n1[x]=!0;const f=x.endsWith(".css"),h=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${x}"]${h}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":i7,f||(g.as="script"),g.crossOrigin="",g.href=x,m&&g.setAttribute("nonce",m),document.head.appendChild(g),f)return new Promise((u,j)=>{g.addEventListener("load",u),g.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${x}`)))})}))}function l(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return a.then(c=>{for(const d of c||[])d.status==="rejected"&&l(d.reason);return s().catch(l)})};function o7(t,s=[]){let n=[];function r(l,c){const d=v.createContext(c);d.displayName=l+"Context";const m=n.length;n=[...n,c];const x=h=>{var N;const{scope:g,children:u,...j}=h,p=((N=g==null?void 0:g[t])==null?void 0:N[m])||d,y=v.useMemo(()=>j,Object.values(j));return e.jsx(p.Provider,{value:y,children:u})};x.displayName=l+"Provider";function f(h,g){var p;const u=((p=g==null?void 0:g[t])==null?void 0:p[m])||d,j=v.useContext(u);if(j)return j;if(c!==void 0)return c;throw new Error(`\`${h}\` must be used within \`${l}\``)}return[x,f]}const a=()=>{const l=n.map(c=>v.createContext(c));return function(d){const m=(d==null?void 0:d[t])||l;return v.useMemo(()=>({[`__scope${t}`]:{...d,[t]:m}}),[d,m])}};return a.scopeName=t,[r,c7(a,...s)]}function c7(...t){const s=t[0];if(t.length===1)return s;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const c=r.reduce((d,{useScope:m,scopeName:x})=>{const h=m(l)[`__scope${x}`];return{...d,...h}},{});return v.useMemo(()=>({[`__scope${s.scopeName}`]:c}),[c])}};return n.scopeName=s.scopeName,n}var d7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Bb=d7.reduce((t,s)=>{const n=hu(`Primitive.${s}`),r=v.forwardRef((a,l)=>{const{asChild:c,...d}=a,m=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(m,{...d,ref:l})});return r.displayName=`Primitive.${s}`,{...t,[s]:r}},{}),Wx={exports:{}},Kx={};/** * @license React * use-sync-external-store-shim.production.js * @@ -681,72 +681,72 @@ For more information, see https://radix-ui.com/primitives/docs/components/${s.do * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var t1;function i7(){if(t1)return Hx;t1=1;var t=Lc();function s(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}var n=typeof Object.is=="function"?Object.is:s,r=t.useState,a=t.useEffect,l=t.useLayoutEffect,c=t.useDebugValue;function d(m,p){var u=p(),j=r({inst:{value:u,getSnapshot:p}}),g=j[0].inst,y=j[1];return l(function(){g.value=u,g.getSnapshot=p,h(g)&&y({inst:g})},[m,u,p]),a(function(){return h(g)&&y({inst:g}),m(function(){h(g)&&y({inst:g})})},[m]),c(u),u}function h(m){var p=m.getSnapshot;m=m.value;try{var u=p();return!n(m,u)}catch{return!0}}function x(m,p){return p()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?x:d;return Hx.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Hx}var s1;function l7(){return s1||(s1=1,Vx.exports=i7()),Vx.exports}var o7=l7();function c7(){return o7.useSyncExternalStore(d7,()=>!0,()=>!1)}function d7(){return()=>{}}var Mb="Avatar",[u7]=n7(Mb),[h7,XR]=u7(Mb),JR=v.forwardRef((t,s)=>{const{__scopeAvatar:n,...r}=t,[a,l]=v.useState("idle");return e.jsx(h7,{scope:n,imageLoadingStatus:a,onImageLoadingStatusChange:l,children:e.jsx(Lb.span,{...r,ref:s})})});JR.displayName=Mb;var eE="AvatarImage",m7=v.forwardRef((t,s)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:a=()=>{},...l}=t,c=XR(eE,n),d=f7(r,l),h=dr(x=>{a(x),c.onImageLoadingStatusChange(x)});return Zn(()=>{d!=="idle"&&h(d)},[d,h]),d==="loaded"?e.jsx(Lb.img,{...l,ref:s,src:r}):null});m7.displayName=eE;var tE="AvatarFallback",sE=v.forwardRef((t,s)=>{const{__scopeAvatar:n,delayMs:r,...a}=t,l=XR(tE,n),[c,d]=v.useState(r===void 0);return v.useEffect(()=>{if(r!==void 0){const h=window.setTimeout(()=>d(!0),r);return()=>window.clearTimeout(h)}},[r]),c&&l.imageLoadingStatus!=="loaded"?e.jsx(Lb.span,{...a,ref:s}):null});sE.displayName=tE;function n1(t,s){return t?s?(t.src!==s&&(t.src=s),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function f7(t,{referrerPolicy:s,crossOrigin:n}){const r=c7(),a=v.useRef(null),l=r?(a.current||(a.current=new window.Image),a.current):null,[c,d]=v.useState(()=>n1(l,t));return Zn(()=>{d(n1(l,t))},[l,t]),Zn(()=>{const h=m=>()=>{d(m)};if(!l)return;const x=h("loaded"),f=h("error");return l.addEventListener("load",x),l.addEventListener("error",f),s&&(l.referrerPolicy=s),typeof n=="string"&&(l.crossOrigin=n),()=>{l.removeEventListener("load",x),l.removeEventListener("error",f)}},[l,n,s]),c}var p7=JR,x7=sE;function Fh({className:t,...s}){return e.jsx(p7,{"data-slot":"avatar",className:Pt("relative flex size-10 shrink-0 overflow-hidden rounded-full",t),...s})}function Bh({className:t,...s}){return e.jsx(x7,{"data-slot":"avatar-fallback",className:Pt("bg-muted flex size-full items-center justify-center rounded-full",t),...s})}const $h="/collaboration",qh={getWorknotes:async(t,s)=>(await ze.get(`${$h}/worknotes`,{requestId:t,requestType:s})).data,addWorknote:async t=>(await ze.post(`${$h}/worknotes`,t)).data,uploadAttachment:async(t,s,n)=>{const r=new FormData;return r.append("file",t),s&&r.append("requestId",s),n&&r.append("requestType",n),(await ze.post(`${$h}/upload`,r,{headers:{"Content-Type":"multipart/form-data"}})).data},revokeParticipant:async(t,s)=>(await ze.delete(`${$h}/participants/${t}`,{data:{reason:s}})).data},Cd=t=>[...t].sort((s,n)=>new Date(s.createdAt).getTime()-new Date(n.createdAt).getTime()),Wx=t=>{var s,n,r,a,l;return{name:((s=t==null?void 0:t.author)==null?void 0:s.name)||((n=t==null?void 0:t.author)==null?void 0:n.fullName)||"System",email:((r=t==null?void 0:t.author)==null?void 0:r.email)||"",role:String(((a=t==null?void 0:t.author)==null?void 0:a.role)||((l=t==null?void 0:t.author)==null?void 0:l.roleCode)||"")}},g7=new Set(["internal","workflow","system","audit","status"]),v7=t=>g7.has(String(t.noteType||"").toLowerCase()),b7=t=>{const s=String(t.noteType||"").toLowerCase();return s==="workflow"?"Workflow activity":s==="internal"?"Review / approval":s==="system"?"System":s==="audit"?"Audit":s==="status"?"Status update":"Activity"},y7=t=>{const s=String(t.noteType||"").toLowerCase();return s==="internal"?"APPROVAL":s==="workflow"?"WORKFLOW":s==="system"?"SYSTEM":s==="audit"?"AUDIT":s==="status"?"STATUS":"ACTIVITY"},r1=t=>t?new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}):"",bc="https://dealeronboarding-uat.royalenfield.com/api".replace("/api","")||"http://localhost:5000";function nE(t){var Cs,Bs,Ft,ie,Fe;const{user:s}=Nn(Q=>Q.auth),{id:n,type:r}=Bc(),a=Ul(),l=qn(),c=t.requestId||n||"",d=t.requestType||r||((Cs=a.state)==null?void 0:Cs.requestType)||"application",h=t.mode||((Bs=a.state)==null?void 0:Bs.mode)||"page",[x,f]=v.useState(t.applicationName||((Ft=a.state)==null?void 0:Ft.applicationName)||"Application"),[m,p]=v.useState(t.registrationNumber||((ie=a.state)==null?void 0:ie.registrationNumber)||""),u=t.onBack||(()=>l(-1)),j=t.participants||((Fe=a.state)==null?void 0:Fe.participants)||[],[g,y]=v.useState(j),[N,S]=v.useState([]),[C,w]=v.useState(""),[R,P]=v.useState(!1),[A,I]=v.useState(""),[$,T]=v.useState(0),[E,_]=v.useState(!0),[M,q]=v.useState(!1),[G,Z]=v.useState([]),[W,z]=v.useState(!1),[F,B]=v.useState(!0),[D,O]=v.useState(""),[V,K]=v.useState(""),[Y,U]=v.useState(null),[X,ne]=v.useState(""),[oe,re]=v.useState(!1),{socket:ge}=Sk(),ve=v.useRef(null),Se=v.useRef(null),[We,Ce]=v.useState(null),fe=(Q,pe)=>Q.startsWith("image/")&&pe?e.jsx("img",{src:`${bc}/${pe.replace(/\\/g,"/")}`,className:"w-full h-full object-cover rounded",alt:"Thumbnail"}):Q.startsWith("image/")?e.jsx(dw,{className:"w-5 h-5 text-blue-500"}):Q==="application/pdf"?e.jsx(fs,{className:"w-5 h-5 text-red-500"}):e.jsx(vm,{className:"w-5 h-5 text-slate-500"}),Ye=["😊","😂","🤣","❤️","👍","🙏","🔥","✨","😍","🥰","😎","🤔","😅","🙌","👏","🎉","✅","❌","📌","📎","📍","💡","🔔","📢","⭐","🌟","💪","🚀","👀","💯","🌈","☀️","😢","😭","😞","😔","😟","😕","😠","😡","🤬","😤","😲","🙄","🤨","😓","😩","😫","🤐","😴","🤢","🤮","😱","🤡","💀","👻","🤝","👋","✌️","👌","✋","🍎","🍕","☕","💻","📱","⌚","📁","📄","📅","🔒","🔑","🛠️","⚙️","💬","💭","🌊","🍀","✈️","🏠"],be=Q=>Q.split(" ").map(pe=>pe[0]).join("").toUpperCase().substring(0,2),_e=Q=>{const pe=["bg-green-600","bg-blue-600","bg-purple-600","bg-amber-600","bg-pink-600","bg-indigo-600","bg-teal-600"],Ne=Q.length%pe.length;return pe[Ne]},ke=[],qe=new Set;g.forEach(Q=>{var Ee,it,st,bt,Ue,Lt,ut;const pe=((Ee=Q.user)==null?void 0:Ee.id)||Q.userId||"",Ne=Q.id;if(pe&&!qe.has(pe)){qe.add(pe);const yt=((it=Q.user)==null?void 0:it.fullName)||((st=Q.user)==null?void 0:st.name)||Q.fullName||Q.name||"Unknown User",kt=((bt=Q.user)==null?void 0:bt.email)||Q.email||"",Ie=((Ue=Q.user)==null?void 0:Ue.roleCode)||Q.roleCode||((Lt=Q.user)==null?void 0:Lt.role)||Q.role||"Participant";ke.push({id:pe,recordId:Ne,name:yt,email:kt,initials:be(yt),color:_e(yt),role:Ie,isOnline:!1,revokedAt:(ut=Q.metadata)==null?void 0:ut.revokedAt})}});const Ve=async()=>{try{_(!0);const Q=await qh.getWorknotes(c,d);if(Q.success){const pe=Q.data.map(Ne=>({id:Ne.id,noteText:Ne.noteText,noteType:Ne.noteType,createdAt:Ne.createdAt,userId:Ne.userId,author:Ne.author?Wx(Ne):{name:"System",email:"",role:"system"},attachments:Ne.attachments||[]}));S(Cd(pe))}}catch(Q){console.error("Fetch notes error:",Q),ee.error("Failed to load work notes")}finally{_(!1)}};v.useEffect(()=>{if(Ve(),ge)return ge.emit("join_room",c),ge.on("new_worknote",Q=>{const pe={id:Q.id,noteText:Q.noteText,noteType:Q.noteType,createdAt:Q.createdAt,userId:Q.userId,author:Q.author?Wx(Q):{name:"System",email:"",role:"system"},attachments:Q.attachments||[]};S(Ne=>{if(Ne.some(st=>st.id===pe.id))return Ne;const it=Ne.findIndex(st=>{var bt,Ue;return st.id.startsWith("temp-")&&st.noteText===pe.noteText&&((bt=st.author.email)==null?void 0:bt.toLowerCase())===((Ue=pe.author.email)==null?void 0:Ue.toLowerCase())});if(it!==-1){const st=[...Ne];return st[it]=pe,Cd(st)}return Cd([...Ne,pe])})}),()=>{ge.emit("leave_room",c),ge.off("new_worknote")}},[c,d,ge]),v.useEffect(()=>{if(!c||!d)return;(async()=>{var pe,Ne,Ee,it,st,bt,Ue,Lt,ut,yt;try{let kt=null;if(d==="application")kt=await ds.getApplicationById(c),kt&&(g.length===0&&kt.participants&&y(kt.participants),(!x||x==="Application")&&f(kt.companyName||"Application"),m||p(kt.registrationNumber||""));else if(d==="termination"){const{API:Ie}=await Tl(async()=>{const{API:ht}=await Promise.resolve().then(()=>Pd);return{API:ht}},void 0),_t=await Ie.getTerminationById(c);(pe=_t.data)!=null&&pe.success&&(kt=_t.data.termination,g.length===0&&kt.participants&&y(kt.participants),(!x||x==="Application"||x==="Termination")&&f(((Ne=kt.dealer)==null?void 0:Ne.businessName)||"Termination"),m||p(kt.requestId||""))}else if(d==="constitutional"||d==="constitutional-change"){const{API:Ie}=await Tl(async()=>{const{API:ht}=await Promise.resolve().then(()=>Pd);return{API:ht}},void 0),_t=await Ie.getConstitutionalChangeById(c);(Ee=_t.data)!=null&&Ee.success&&(kt=_t.data.request,g.length===0&&kt.participants&&y(kt.participants),(!x||x==="Application"||x==="Constitutional Change")&&f(((it=kt.outlet)==null?void 0:it.name)||"Constitutional Change"),m||p(kt.requestId||""))}else if(d==="resignation"){const{API:Ie}=await Tl(async()=>{const{API:ht}=await Promise.resolve().then(()=>Pd);return{API:ht}},void 0),_t=await Ie.getResignationById(c);(st=_t.data)!=null&&st.success&&(kt=_t.data.resignation,g.length===0&&kt.participants&&y(kt.participants),(!x||x==="Application"||x==="Resignation")&&f(((bt=kt.dealer)==null?void 0:bt.businessName)||"Resignation"),m||p(kt.resignationId||""))}else if(d==="fnf"){const{API:Ie}=await Tl(async()=>{const{API:ht}=await Promise.resolve().then(()=>Pd);return{API:ht}},void 0),_t=await Ie.getFnFSettlementById(c);if((Ue=_t.data)!=null&&Ue.success){kt=_t.data.fnf,g.length===0&&kt.participants&&y(kt.participants||[]);const ht=((ut=(Lt=kt.outlet)==null?void 0:Lt.dealer)==null?void 0:ut.fullName)||((yt=kt.dealer)==null?void 0:yt.fullName)||"F&F Settlement";(!x||x==="Application"||x==="F&F Settlement")&&f(ht),m||p(kt.settlementId||"")}}}catch(kt){console.error(`Failed to fetch ${d} details:`,kt)}})()},[c,d,g.length,x,m]);const dt=v.useRef(null);v.useEffect(()=>{dt.current&&dt.current.scrollIntoView({behavior:"smooth"})},[N]);const xt=Q=>{const pe=Q.target.value,Ne=Q.target.selectionStart||0;w(pe),T(Ne);const Ee=pe.substring(0,Ne),it=Ee.lastIndexOf("@");if(it!==-1&&it===Ee.length-1)P(!0),I("");else if(it!==-1){const st=Ee.substring(it+1);st.includes(" ")?P(!1):(P(!0),I(st))}else P(!1)},ye=Q=>{var bt;const Ne=C.substring(0,$).lastIndexOf("@"),Ee=C.substring($),it=`@${Q.name}`,st=C.substring(0,Ne)+it+" "+Ee;w(st),P(!1),(bt=ve.current)==null||bt.focus()},le=Q=>{var Ee,it;const pe=((Ee=ve.current)==null?void 0:Ee.selectionStart)||C.length,Ne=C.substring(0,pe)+Q+C.substring(pe);w(Ne),q(!1),(it=ve.current)==null||it.focus()},Qe=async Q=>{const pe=Q.target.files;if(!(!pe||pe.length===0)){z(!0);try{for(const Ne of Array.from(pe)){const Ee=await qh.uploadAttachment(Ne,c,d);Ee.success&&Z(it=>[...it,Ee.data])}}catch(Ne){console.error("File upload error:",Ne),ee.error("Failed to upload attachment")}finally{z(!1),Se.current&&(Se.current.value="")}}},rt=Q=>{Z(pe=>pe.filter(Ne=>Ne.id!==Q))},Kt=async()=>{if(!C.trim()&&G.length===0)return;const Q=C,pe=G;w(""),Z([]);let Ne=Q;const Ee=[];ke.forEach(it=>{if(it.id&&it.name){const st=it.name.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),bt=new RegExp(`@${st}\\b`,"gi");Ne.match(bt)&&(Ee.push(it.id),Ne=Ne.replace(bt,`@[${it.name}](user:${it.id})`))}});try{const it=`temp-${Date.now()}`,st={id:it,noteText:Ne,noteType:"General",createdAt:new Date().toISOString(),userId:s==null?void 0:s.id,author:{name:(s==null?void 0:s.name)||"You",email:(s==null?void 0:s.email)||"",role:(s==null?void 0:s.role)||""},attachments:pe};S(Ue=>Cd([...Ue,st]));const bt=await qh.addWorknote({requestId:c,requestType:d,noteText:Ne,noteType:"General",tags:Ee,attachmentDocIds:pe.map(Ue=>Ue.id)});if(bt.success&&bt.data){const Ue=bt.data,Lt={id:Ue.id,noteText:Ue.noteText,noteType:Ue.noteType,createdAt:Ue.createdAt,userId:Ue.userId,author:Ue.author?Wx(Ue):{name:"System",email:"",role:"system"},attachments:Ue.attachments||[]};S(ut=>Cd(ut.map(yt=>yt.id===it?Lt:yt)))}}catch(it){console.error("Send message error:",it),ee.error("Failed to send message")}},Rt=Q=>{if(!["DD Lead","DD Head","NBH","DD Admin","Super Admin"].includes((s==null?void 0:s.roleCode)||"")){ee.error("Only authorized roles can revoke participants");return}U(Q),ne("")},Re=async()=>{if(Y){re(!0);try{const Q=await qh.revokeParticipant(Y.recordId,X);Q.success&&(ee.success(Q.message),U(null),y([]))}catch{ee.error("Error revoking participant")}finally{re(!1)}}},Qt=Q=>{Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),Kt())},qt=Q=>{if(!Q)return"";const pe=/(@\[[^\]]+\]\([^\)]+\))/g;return Q.split(pe).map((Ee,it)=>{const st=Ee.match(/@\[([^\]]+)\]\(([^\)]+)\)/);if(st){const bt=st[1];return e.jsxs("span",{className:"text-blue-600 font-medium hover:underline cursor-pointer",children:["@",bt]},it)}return Ee})},ws=V.trim().toLowerCase(),_s=ws?N.filter(Q=>{var pe;return(Q.noteText||"").toLowerCase().includes(ws)||(((pe=Q.author)==null?void 0:pe.name)||"").toLowerCase().includes(ws)||(Q.noteType||"").toLowerCase().includes(ws)}):N,ns=ke.filter(Q=>{const pe=Q.name.toLowerCase().includes(A.toLowerCase()),Ne=Q.id&&(s==null?void 0:s.id)&&String(Q.id)===String(s.id)||Q.email&&(s==null?void 0:s.email)&&Q.email.toLowerCase()===s.email.toLowerCase();return pe&&!Ne});return e.jsxs("div",{className:"h-full flex flex-col bg-slate-50 overflow-hidden",children:[e.jsx("div",{className:"bg-white border-b border-slate-200 px-6 py-4 z-10","data-testid":"onboarding-worknotes-header",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"ghost",size:"icon",onClick:u,className:"hover:bg-slate-100","data-testid":"onboarding-worknotes-back-btn",children:e.jsx($r,{className:"w-5 h-5"})}),e.jsx("div",{className:"w-12 h-12 bg-purple-600 rounded-lg flex items-center justify-center",children:e.jsx(zr,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900","data-testid":"onboarding-worknotes-title",children:"Work Notes"}),e.jsxs("div",{className:"flex items-center gap-2 text-slate-600","data-testid":"onboarding-worknotes-meta",children:[e.jsx("span",{"data-testid":"onboarding-worknotes-app-name",children:x}),e.jsx("span",{className:"text-slate-400",children:"|"}),e.jsx("span",{className:"text-slate-500","data-testid":"onboarding-worknotes-reg-num",children:m})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"hidden sm:flex items-center -space-x-2 mr-2","data-testid":"onboarding-worknotes-participant-avatars",children:[ke.slice(0,3).map((Q,pe)=>e.jsx(Fh,{className:"w-8 h-8 border-2 border-white ring-1 ring-slate-100","data-testid":`onboarding-worknotes-avatar-${pe}`,children:e.jsx(Bh,{className:`${Q.color} text-white text-[10px]`,children:Q.initials})},pe)),ke.length>3&&e.jsx("div",{className:"w-8 h-8 rounded-full bg-slate-100 border-2 border-white flex items-center justify-center ring-1 ring-slate-100","data-testid":"onboarding-worknotes-avatar-more",children:e.jsxs("span",{className:"text-slate-600 text-[10px] font-bold",children:["+",ke.length-3]})})]}),e.jsxs(se,{variant:"ghost",size:"sm",onClick:Ve,className:"text-slate-500 hover:text-blue-600 flex items-center gap-1.5 px-2 h-9 rounded-lg hover:bg-slate-50 transition-colors",disabled:E,"data-testid":"onboarding-worknotes-sync-btn",children:[e.jsx(Ki,{className:`w-4 h-4 ${E?"animate-spin":""}`}),e.jsx("span",{className:"text-xs font-medium hidden md:inline",children:"Sync"})]}),e.jsxs(se,{variant:F?"secondary":"ghost",size:"sm",onClick:()=>B(!F),className:`flex items-center gap-1.5 px-2 h-9 rounded-lg transition-all ${F?"bg-blue-50 text-blue-600 hover:bg-blue-100":"text-slate-500 hover:bg-slate-50"}`,"data-testid":"onboarding-worknotes-toggle-sidebar-btn",children:[e.jsx(da,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs font-medium hidden md:inline",children:"Participants"})]})]})]})}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-white min-h-0 relative",children:[e.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4 custom-scrollbar bg-slate-50 relative z-0","data-testid":"onboarding-worknotes-chat-area",children:e.jsxs("div",{className:`max-w-4xl mx-auto flex flex-col py-4 gap-4 ${h==="modal"?"":"px-4"}`,children:[e.jsx("div",{className:"sticky top-0 z-[1] -mx-1 px-1 pb-1 bg-slate-50/95 backdrop-blur-sm",children:e.jsxs("div",{className:"relative",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"}),e.jsx(ot,{type:"search",value:V,onChange:Q=>K(Q.target.value),placeholder:"Search messages...",className:"pl-9 h-10 bg-white border-slate-200 rounded-xl text-sm shadow-sm","aria-label":"Search messages","data-testid":"onboarding-worknotes-search-input"})]})}),_s.map((Q,pe)=>{var Ee,it,st,bt,Ue,Lt,ut;if(v7(Q)){const yt=((Ee=Q.author)==null?void 0:Ee.name)||"System",kt=(it=Q.author)!=null&&it.role&&Q.author.role!=="0"&&Q.author.role!==""?Q.author.role:"";return e.jsx("div",{className:"flex w-full justify-center px-1 py-1 sm:px-2","data-testid":`onboarding-worknotes-activity-row-${pe}`,children:e.jsxs("div",{role:"status",title:b7(Q),className:"flex w-full max-w-[min(100%,42rem)] items-start gap-2.5 rounded-xl border border-slate-200/90 bg-slate-100/80 px-3 py-2.5 shadow-sm",children:[e.jsx(H5,{className:"mt-0.5 h-4 w-4 shrink-0 text-purple-600",strokeWidth:2.5,"aria-hidden":!0}),e.jsx("span",{className:"shrink-0 pt-0.5 text-[10px] font-bold uppercase tracking-wide text-slate-600","data-testid":`onboarding-worknotes-activity-type-${pe}`,children:y7(Q)}),e.jsx("div",{className:"min-w-0 flex-1 text-left",children:e.jsxs("p",{className:"text-sm leading-snug text-slate-800",children:[e.jsx("span",{className:"font-semibold text-slate-900","data-testid":`onboarding-worknotes-activity-who-${pe}`,children:yt}),kt?e.jsxs("span",{className:"text-xs font-normal text-slate-500",children:[" · ",kt]}):null,e.jsx("span",{className:"font-normal text-slate-600",children:" — "}),e.jsx("span",{className:"font-normal text-slate-700","data-testid":`onboarding-worknotes-activity-text-${pe}`,children:qt(Q.noteText)})]})}),e.jsx("time",{className:"shrink-0 whitespace-nowrap pt-0.5 text-right text-[10px] leading-tight text-slate-400 tabular-nums sm:text-[11px]",dateTime:Q.createdAt,"data-testid":`onboarding-worknotes-activity-time-${pe}`,children:r1(Q.createdAt)})]})},Q.id)}const Ne=((st=Q==null?void 0:Q.author)==null?void 0:st.email)&&(s==null?void 0:s.email)&&Q.author.email.toLowerCase()===s.email.toLowerCase()||(Q==null?void 0:Q.userId)&&(s==null?void 0:s.id)&&String(Q.userId)===String(s.id)||Q.id.startsWith("temp-");return e.jsx("div",{className:`flex w-full ${Ne?"justify-end":"justify-start"}`,"data-testid":`onboarding-worknotes-message-row-${pe}`,children:e.jsxs("div",{className:`flex gap-3 max-w-[min(85%,36rem)] ${Ne?"flex-row-reverse":""}`,children:[e.jsx(Fh,{className:"w-10 h-10 flex-shrink-0 mt-1","data-testid":`onboarding-worknotes-message-avatar-${pe}`,children:e.jsx(Bh,{className:`${_e(((bt=Q==null?void 0:Q.author)==null?void 0:bt.name)||"System")} text-white`,children:be(((Ue=Q==null?void 0:Q.author)==null?void 0:Ue.name)||"S")})}),e.jsxs("div",{className:`flex flex-col min-w-0 ${Ne?"items-end":"items-start"}`,children:[e.jsxs("div",{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 mb-1 px-1 ${Ne?"flex-row-reverse text-right":"text-left"}`,children:[e.jsx("span",{className:"text-slate-900 font-medium text-sm","data-testid":`onboarding-worknotes-message-author-${pe}`,children:Ne?"You":((Lt=Q==null?void 0:Q.author)==null?void 0:Lt.name)||"Unknown"}),e.jsx("span",{className:"text-slate-400 text-[10px] uppercase tracking-wide",children:(ut=Q==null?void 0:Q.author)!=null&&ut.role&&Q.author.role!=="0"&&Q.author.role!==""?`(${Q.author.role})`:""}),e.jsx("span",{className:"text-slate-400 text-[10px] tabular-nums","data-testid":`onboarding-worknotes-message-time-${pe}`,children:r1(Q.createdAt)})]}),e.jsxs("div",{className:`rounded-2xl border px-4 py-2.5 shadow-sm relative text-left ${Ne?"bg-blue-50 border-blue-100 text-slate-800 rounded-tr-none":"bg-white border-slate-200 text-slate-700 rounded-tl-none"}`,"data-testid":`onboarding-worknotes-message-bubble-${pe}`,children:[e.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words","data-testid":`onboarding-worknotes-message-text-${pe}`,children:qt(Q.noteText)}),Q.attachments&&Q.attachments.length>0&&e.jsx("div",{className:"mt-2 space-y-2 border-t border-slate-100 pt-2","data-testid":`onboarding-worknotes-message-attachments-${pe}`,children:Q.attachments.map((yt,kt)=>{const Ie=yt.mimeType.startsWith("image/");return e.jsx("div",{className:"flex items-center gap-2","data-testid":`onboarding-worknotes-message-attachment-${pe}-${kt}`,children:Ie?e.jsx("div",{className:"rounded-lg overflow-hidden border border-slate-100 max-w-[200px]",children:e.jsx("img",{src:`${bc}/${yt.filePath.replace(/\\/g,"/")}`,alt:yt.fileName,className:"w-full h-auto cursor-pointer",onClick:()=>Ce(yt),"data-testid":`onboarding-worknotes-message-attachment-img-${pe}-${kt}`})}):yt.mimeType==="application/pdf"?e.jsxs("button",{type:"button",onClick:()=>Ce(yt),className:"flex items-center gap-2 text-xs text-blue-600 hover:underline","data-testid":`onboarding-worknotes-message-attachment-preview-${pe}-${kt}`,children:[e.jsx(qd,{className:"w-3 h-3"}),yt.fileName," (Preview)"]}):e.jsxs("a",{href:`${bc}/${yt.filePath.replace(/\\/g,"/")}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-xs text-blue-600 hover:underline","data-testid":`onboarding-worknotes-message-attachment-link-${pe}-${kt}`,children:[e.jsx(qd,{className:"w-3 h-3"}),yt.fileName]})},yt.id)})})]})]})]})},Q.id)}),N.length===0&&!E&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center","data-testid":"onboarding-worknotes-empty-state",children:[e.jsx(zr,{className:"w-16 h-16 text-slate-300 mb-4"}),e.jsx("h3",{className:"text-slate-900 mb-2",children:"No messages yet"}),e.jsx("p",{className:"text-slate-600",children:"Start the conversation by sending a message below"})]}),N.length>0&&_s.length===0&&!E&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center text-slate-500 text-sm",children:['No messages match "',V.trim(),'". Clear the search box to see the full thread.']}),E&&e.jsx("div",{className:"flex justify-center items-center py-8",children:e.jsx("span",{className:"text-slate-500",children:"Loading notes..."})}),e.jsx("div",{ref:dt})]})}),e.jsx("div",{className:"bg-white border-t border-slate-100 px-6 py-4 shadow-[0_-4px_10px_-5px_rgba(0,0,0,0.05)]","data-testid":"onboarding-worknotes-composer",children:e.jsxs("div",{className:"max-w-4xl mx-auto space-y-4",children:[G.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3 mb-3","data-testid":"onboarding-worknotes-attached-files",children:G.map((Q,pe)=>{const Ne=Q.mimeType.startsWith("image/")||Q.mimeType==="application/pdf";return e.jsxs("div",{className:"flex items-center gap-3 p-2 bg-white rounded-xl border border-slate-200 shadow-sm hover:border-blue-300 transition-all group max-w-[200px]","data-testid":`onboarding-worknotes-attached-file-${pe}`,children:[e.jsx("div",{className:"w-10 h-10 bg-slate-50 rounded-lg flex items-center justify-center flex-shrink-0 overflow-hidden",children:fe(Q.mimeType,Q.filePath)}),e.jsxs("div",{className:"flex-1 min-w-0 pr-6 relative",children:[e.jsx("p",{className:`text-xs font-medium text-slate-700 truncate ${Ne?"hover:text-blue-600 cursor-pointer hover:underline":""}`,onClick:()=>Ne&&Ce(Q),children:Q.fileName}),e.jsx("button",{onClick:()=>rt(Q.id),className:"absolute -top-1 -right-1 p-1 bg-white rounded-full border border-slate-100 text-slate-400 hover:text-red-500 shadow-sm opacity-0 group-hover:opacity-100 transition-opacity","data-testid":`onboarding-worknotes-remove-attachment-${pe}`,children:e.jsx(Tc,{className:"w-3 h-3"})})]})]},Q.id)})}),e.jsxs("div",{className:"flex items-end gap-3 bg-white p-2.5 rounded-2xl border border-slate-200 shadow-sm focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-100 transition-all relative",children:[R&&ns.length>0&&e.jsx("div",{className:"absolute bottom-full left-0 mb-2 w-64 bg-white border border-slate-200 rounded-lg shadow-lg overflow-hidden max-h-48 overflow-y-auto z-50 custom-scrollbar","data-testid":"onboarding-worknotes-mention-suggestions",children:ns.map((Q,pe)=>e.jsxs("button",{onClick:()=>ye(Q),className:"w-full flex items-center gap-3 px-4 py-2 hover:bg-slate-50 transition-colors text-left","data-testid":`onboarding-worknotes-mention-item-${pe}`,children:[e.jsx(Fh,{className:"w-8 h-8",children:e.jsx(Bh,{className:`${Q.color} text-white text-xs`,children:Q.initials})}),e.jsx("div",{className:"flex flex-col",children:e.jsx("span",{className:"text-slate-900 text-sm font-medium",children:Q.name})})]},Q.id))}),e.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[e.jsx("input",{type:"file",ref:Se,className:"hidden",multiple:!0,onChange:Qe}),e.jsx(se,{variant:"ghost",size:"icon",className:"w-9 h-9 text-slate-400 hover:text-blue-600 hover:bg-blue-50 rounded-xl",onClick:()=>{var Q;return(Q=Se.current)==null?void 0:Q.click()},"data-testid":"onboarding-worknotes-attachment-btn",children:e.jsx(qd,{className:"w-5 h-5"})}),e.jsxs(se,{variant:"ghost",size:"icon",className:`w-9 h-9 text-slate-400 hover:text-blue-600 hover:bg-blue-50 rounded-xl relative ${M?"bg-blue-50 text-blue-600":""}`,onClick:()=>q(!M),"data-testid":"onboarding-worknotes-emoji-btn",children:[e.jsx(hI,{className:"w-5 h-5"}),M&&e.jsxs("div",{className:"absolute bottom-12 left-0 z-50 bg-white border border-slate-200 rounded-xl shadow-2xl w-72 animate-in fade-in slide-in-from-bottom-2 overflow-hidden","data-testid":"onboarding-worknotes-emoji-picker",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-slate-100 bg-slate-50 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider",children:"Emojis"}),e.jsx("button",{onClick:()=>q(!1),className:"text-slate-400 hover:text-slate-600 text-lg leading-none",children:"×"})]}),e.jsx("div",{className:"p-2 grid grid-cols-8 gap-1 max-h-60 overflow-y-auto custom-scrollbar",children:Ye.map((Q,pe)=>e.jsx("button",{className:"w-8 h-8 flex items-center justify-center hover:bg-blue-50 hover:scale-110 rounded-lg transition-all text-lg",onClick:Ne=>{Ne.stopPropagation(),le(Q)},"data-testid":`onboarding-worknotes-emoji-item-${pe}`,children:Q},Q))})]})]}),e.jsx(se,{variant:"ghost",size:"icon",className:"w-9 h-9 text-slate-400 hover:text-blue-600 hover:bg-blue-50 rounded-xl",onClick:()=>{var Q;return(Q=Se.current)==null?void 0:Q.click()},children:e.jsx(dw,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"flex-1 relative",children:e.jsx(ot,{ref:ve,type:"text",placeholder:"Type your message... Use @username to mention someone",value:C,onChange:xt,onKeyPress:Qt,className:"w-full pr-4 border-none focus-visible:ring-0 px-0"})}),e.jsx(se,{onClick:Kt,disabled:!C.trim()&&G.length===0||W,className:"bg-blue-600 hover:bg-blue-700 text-white rounded-xl h-10 w-10 p-0",children:W?e.jsx("div",{className:"h-4 w-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):e.jsx(fu,{className:"w-5 h-5"})})]}),e.jsxs("p",{className:"text-slate-400 text-[10px] px-1 flex items-center gap-1",children:[e.jsx(Xa,{className:"w-3 h-3"}),e.jsxs("span",{children:["Press Enter to send • Use @ to mention • ",W?"Uploading files...":"Files attached appear above"]})]})]})})]}),F&&e.jsxs("div",{className:`w-[280px] lg:w-[320px] bg-slate-50 border-l border-slate-200 flex flex-col transition-all animate-in slide-in-from-right-full ${h==="modal"?"hidden lg:flex":"flex"}`,children:[e.jsxs("div",{className:"p-4 border-b border-slate-200 bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(da,{className:"w-4 h-4 text-blue-600"}),"Participants",e.jsx(Ae,{variant:"secondary",className:"bg-slate-100 text-slate-600 ml-1",children:ke.length})]}),e.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-600",onClick:()=>B(!1),children:e.jsx(Tc,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ot,{type:"text",placeholder:"Search people...",value:D,onChange:Q=>O(Q.target.value),className:"pl-9 bg-slate-50 border-slate-200 h-9 text-sm rounded-lg focus-visible:bg-white transition-all"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-1 custom-scrollbar",children:[ke.filter(Q=>{var pe;return Q.name.toLowerCase().includes(D.toLowerCase())||((pe=Q.role)==null?void 0:pe.toLowerCase().includes(D.toLowerCase()))}).map(Q=>{const pe=!!Q.revokedAt,Ne=["DD Lead","DD Head","NBH","DD Admin","Super Admin"].includes((s==null?void 0:s.roleCode)||"")&&!pe&&Q.id!==(s==null?void 0:s.id);return e.jsxs("div",{className:Pt("group flex items-start gap-3 p-3 rounded-xl transition-all cursor-default border border-transparent",pe?"opacity-50 bg-slate-100 grayscale-[0.5]":"hover:bg-white hover:shadow-sm hover:border-slate-100"),children:[e.jsxs("div",{className:"relative",children:[e.jsx(Fh,{className:Pt("w-10 h-10 ring-2 ring-transparent transition-all",!pe&&"group-hover:ring-blue-100"),children:e.jsx(Bh,{className:`${Q.color} text-white text-xs font-bold`,children:Q.initials})}),Q.isOnline&&!pe&&e.jsx("span",{className:"absolute bottom-0 right-0 w-3 h-3 bg-green-500 border-2 border-slate-50 rounded-full shadow-sm"}),pe&&e.jsx("span",{className:"absolute -top-1 -right-1 bg-red-100 rounded-full p-0.5 border border-white",children:e.jsx(Rx,{className:"w-2.5 h-2.5 text-red-600"})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("p",{className:Pt("text-sm font-semibold truncate",pe?"text-slate-500 line-through":"text-slate-900"),children:Q.name}),pe&&e.jsx(Ae,{variant:"outline",className:"text-[8px] h-3.5 px-1 bg-red-50 text-red-600 border-red-100",children:"Revoked"})]}),Q.id===(s==null?void 0:s.id)&&e.jsx(Ae,{variant:"outline",className:"text-[9px] h-4 px-1 border-blue-200 text-blue-600 bg-blue-50",children:"You"})]}),e.jsx("p",{className:"text-[11px] text-slate-500 font-medium uppercase tracking-wider mb-1",children:Q.role}),e.jsx("p",{className:"text-[11px] text-slate-400 truncate italic",children:Q.email})]}),Ne&&e.jsx(se,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-slate-300 hover:text-red-600 hover:bg-red-50 opacity-0 group-hover:opacity-100 transition-all self-center",onClick:()=>Rt(Q),children:e.jsx(Rx,{className:"w-3.5 h-3.5"})}),!Ne&&!pe&&e.jsx(el,{className:"w-4 h-4 text-slate-300 group-hover:text-slate-400 opacity-0 group-hover:opacity-100 transition-all self-center"})]},Q.id)}),ke.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center opacity-50",children:[e.jsx(da,{className:"w-8 h-8 text-slate-300 mb-2"}),e.jsx("p",{className:"text-xs text-slate-500",children:"No participants found"})]})]}),e.jsxs("div",{className:"p-4 bg-white border-t border-slate-200",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),e.jsx("span",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-widest",children:"Active Session"})]}),e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-slate-50 border border-slate-100",children:[e.jsx(Js,{className:"w-4 h-4 text-slate-400"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 font-medium uppercase",children:"Last Activity"}),e.jsx("p",{className:"text-xs text-slate-900 font-semibold",children:"Just now"})]})]})]})]})]}),e.jsx(os,{open:!!We,onOpenChange:Q=>!Q&&Ce(null),children:e.jsxs(ls,{className:"max-w-6xl h-[90vh] flex flex-col p-4",children:[e.jsx(ms,{children:e.jsxs(us,{className:"flex items-center gap-2",children:[We&&fe(We.mimeType),e.jsx("span",{className:"truncate",children:We==null?void 0:We.fileName})]})}),e.jsx("div",{className:"flex-1 overflow-hidden rounded-lg bg-slate-100 flex items-center justify-center p-4",children:We!=null&&We.mimeType.startsWith("image/")?e.jsx("img",{src:`${bc}/${We.filePath.replace(/\\/g,"/")}`,className:"max-w-full max-h-full object-contain",alt:"Preview"}):(We==null?void 0:We.mimeType)==="application/pdf"?e.jsx("iframe",{src:`${bc}/${We.filePath.replace(/\\/g,"/")}`,className:"w-full h-full border-none",title:"PDF Preview"}):e.jsxs("div",{className:"text-center",children:[e.jsx(vm,{className:"w-16 h-16 text-slate-300 mx-auto mb-4"}),e.jsx("p",{className:"text-slate-500",children:"Preview not available for this file type."}),e.jsx("a",{href:`${bc}/${We==null?void 0:We.filePath.replace(/\\/g,"/")}`,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline text-sm",children:"Open in new tab"})]})})]})}),e.jsx(os,{open:!!Y,onOpenChange:Q=>!Q&&U(null),children:e.jsxs(ls,{className:"max-w-md p-0 overflow-hidden border-none shadow-2xl [&>button]:text-white [&>button]:opacity-100",children:[e.jsxs("div",{className:"bg-gradient-to-br from-red-600 to-red-700 p-6 text-white text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-white/20 rounded-full flex items-center justify-center mx-auto mb-4 border border-white/30 backdrop-blur-sm animate-pulse",children:e.jsx(Rx,{className:"w-8 h-8 text-white"})}),e.jsx("h3",{className:"text-xl font-bold mb-2",children:"Revoke Participant Access?"}),e.jsxs("p",{className:"text-red-100 text-sm",children:["You are about to revoke access for ",e.jsx("span",{className:"font-bold text-white",children:Y==null?void 0:Y.name}),". They will no longer be able to view or interact with this request."]})]}),e.jsxs("div",{className:"p-6 bg-white space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs font-bold text-slate-500 uppercase tracking-widest",children:"Reason for Revocation"}),e.jsx(ot,{value:X,onChange:Q=>ne(Q.target.value),placeholder:"e.g. Roles changed, Case transferred...",className:"bg-slate-50 border-slate-200 focus:bg-white transition-all h-11"})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx(se,{variant:"outline",className:"flex-1 h-11 border-slate-200 text-slate-600 hover:bg-slate-50",onClick:()=>U(null),children:"Cancel"}),e.jsxs(se,{className:"flex-1 h-11 bg-red-600 hover:bg-red-700 text-white font-bold shadow-lg shadow-red-200",onClick:Re,disabled:oe,children:[oe?e.jsx(Ki,{className:"w-4 h-4 animate-spin mr-2"}):null,"Revoke Access"]})]})]})]})})]})}const Fb="!w-[80vw] !max-w-[80vw] sm:!max-w-[80vw]",Kl=({isOpen:t,onClose:s,document:n})=>{var l;const a=n?`http://localhost:5000${n.filePath.startsWith("/")?"":"/"}${n.filePath}`:"";return e.jsx(os,{open:t,onOpenChange:s,children:e.jsx(ls,{className:`${Fb} h-[85vh] flex flex-col p-0 overflow-hidden bg-white shadow-2xl border-none`,children:n?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b bg-slate-50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-amber-100 flex items-center justify-center border border-amber-200",children:e.jsx(nn,{className:"w-5 h-5 text-amber-600"})}),e.jsxs("div",{children:[e.jsx(us,{className:"text-sm font-bold text-slate-900 leading-none mb-1",children:n.fileName}),e.jsx("p",{className:"text-[10px] text-slate-500 font-medium uppercase tracking-wider",children:n.documentType})]})]}),e.jsx("div",{className:"flex items-center gap-2 pr-10",children:e.jsxs(se,{variant:"outline",size:"sm",className:"h-8 gap-2",onClick:()=>window.open(a,"_blank"),children:[e.jsx(Ni,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Download"})]})})]}),e.jsx("div",{className:"flex-1 bg-slate-100 relative overflow-hidden flex items-center justify-center p-4",children:(l=n.fileName)!=null&&l.toLowerCase().endsWith(".pdf")?e.jsx("iframe",{src:`${a}#toolbar=0`,className:"w-full h-full bg-white shadow-inner rounded-sm",title:"Preview"}):e.jsx("img",{src:a,className:"max-h-full max-w-full object-contain shadow-lg rounded-sm",alt:"Preview"})})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-slate-400",children:"Loading document..."})})})};function j7(){var W,z,F,B;const{id:t}=Bc(),s=qn(),[n,r]=v.useState(null),[a,l]=v.useState(null),[c,d]=v.useState(!0),[h,x]=v.useState(!1),[f,m]=v.useState(""),[p,u]=v.useState("details"),[j,g]=v.useState(!1),[y,N]=v.useState(null),[S,C]=v.useState(!1),[w,R]=v.useState(!1),[P,A]=v.useState(""),I=Nn(D=>D.auth.user),$=(I==null?void 0:I.role)==="FDD";v.useEffect(()=>{t&&T()},[t]);const T=async()=>{var D,O,V,K;d(!0);try{const[Y,U]=await Promise.all([Te.getApplicationById(t),Te.getFddAssignment(t)]);(D=Y.data)!=null&&D.success&&r(Y.data.data),(O=U.data)!=null&&O.success&&l(U.data.data)}catch(Y){console.error("Error fetching application:",Y);const U=((K=(V=Y.response)==null?void 0:V.data)==null?void 0:K.message)||"Access Denied: Not authorized for FDD access";ee.error(U),s("/fdd-dashboard")}finally{d(!1)}},E=async D=>{var K,Y,U;const O=(K=D.target.files)==null?void 0:K[0];if(!O||!f){f||ee.error("Please select a document type first");return}x(!0);const V=new FormData;V.append("file",O),V.append("documentType",f),V.append("stage","FDD"),V.append("applicationId",t),V.append("requestType","application");try{const X=await Te.uploadDocument(t,V);if((Y=X.data)!=null&&Y.success){if(f==="FDD Final Audit Report"){const ne=((U=X.data.data)==null?void 0:U.id)||X.data.id;await Te.submitFddReport({assignmentId:a==null?void 0:a.id,applicationId:t,reportDocumentId:ne,findings:"Final Audit Report submitted.",recommendation:"REVIEW_PENDING"})}ee.success(`${f} uploaded successfully`),T(),m("")}}catch{ee.error("Failed to upload document")}finally{x(!1)}},_=D=>{if(!D||!D.filePath){ee.error("Document source file not found");return}N({fileName:D.originalName||D.fileName||"Document",filePath:D.filePath,documentType:D.documentType,createdAt:D.createdAt,mimeType:D.mimeType}),g(!0)};if(c)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-[70vh] bg-slate-50/50 rounded-2xl border border-slate-200 border-dashed",children:[e.jsx(ss,{className:"w-12 h-12 animate-spin text-blue-600 mb-4"}),e.jsx("p",{className:"text-slate-500 font-medium",children:"Authenticating and loading secure data..."})]});if(!n)return null;const M=n.currentStage==="FDD_VERIFICATION"||n.currentStage==="FDD",q=(a==null?void 0:a.status)==="Report Submitted",G=!M&&(n.overallStatus!=="Active"||n.currentProgress>=75)||q,Z=!M&&n.currentProgress<70&&!q;return e.jsxs("div",{className:"flex flex-col gap-6 max-w-7xl mx-auto mb-10",children:[(n==null?void 0:n.statutoryStatus)==="Flagged"&&e.jsxs("div",{className:"bg-red-50 border border-red-200 p-4 rounded-xl flex items-center gap-4 animate-in fade-in slide-in-from-top-4 duration-500","data-testid":"onboarding-fdd-details-flag-banner",children:[e.jsx("div",{className:"bg-red-100 p-2 rounded-lg",children:e.jsx(Ya,{className:"w-5 h-5 text-red-600"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-red-900 leading-none",children:"APPLICATION FLAGGED BY YOU"}),e.jsx("p",{className:"text-red-700 text-[10px] font-bold uppercase tracking-wider mt-1 opacity-80",children:"Marked as non-responsive for follow-up by DD Team"})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("button",{onClick:()=>s("/fdd-dashboard"),className:"flex items-center gap-2 text-slate-600 hover:text-slate-900 font-medium transition-all group","data-testid":"onboarding-fdd-details-back-btn",children:[e.jsx("div",{className:"p-2 rounded-full group-hover:bg-slate-100 transition-colors",children:e.jsx($r,{className:"w-5 h-5"})}),"Back to Dashboard"]}),e.jsx("div",{className:"flex items-center gap-3",children:Z?e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-slate-100 border border-slate-200 text-slate-500 font-bold text-[10px] uppercase tracking-[0.1em] rounded-lg","data-testid":"onboarding-fdd-details-awaiting-badge",children:[e.jsx(Js,{className:"w-4 h-4"}),"Awaiting Previous Stages"]}):G?e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-green-50 border border-green-200 text-green-700 font-bold text-[10px] uppercase tracking-[0.1em] rounded-lg shadow-inner","data-testid":"onboarding-fdd-details-submitted-badge",children:[e.jsx(Fn,{className:"w-4 h-4"}),"Final Audit Report Submitted"]}):e.jsx(e.Fragment,{children:$&&e.jsxs("button",{disabled:h,onClick:()=>R(!0),className:"px-4 py-2 bg-red-50 text-red-600 font-bold text-xs uppercase tracking-wider hover:bg-red-100 rounded-lg transition-all flex items-center gap-2 border border-red-100 shadow-sm","data-testid":"onboarding-fdd-details-flag-btn",children:[e.jsx(Ya,{className:"w-4 h-4"}),"Flag Non-Responsive"]})})})]}),e.jsx(Le,{className:"border border-slate-200 shadow-sm bg-white","data-testid":"onboarding-fdd-details-header",children:e.jsx(Me,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-14 h-14 bg-slate-900 text-white rounded-lg flex items-center justify-center font-bold text-xl","data-testid":"onboarding-fdd-details-avatar",children:n.applicantName.charAt(0)}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-900 tracking-tight","data-testid":"onboarding-fdd-details-name",children:n.applicantName}),e.jsx(Ae,{variant:"outline",className:"text-slate-500 font-medium px-2 py-0","data-testid":"onboarding-fdd-details-id-badge",children:n.applicationId})]}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-slate-500","data-testid":"onboarding-fdd-details-meta",children:[e.jsxs("span",{children:[n.city,", ",n.state]}),e.jsx("span",{className:"text-slate-300",children:"•"}),e.jsx("span",{children:n.businessType||"Dealership"})]})]})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"text-right hidden md:block",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Status"}),e.jsx("p",{className:"text-sm font-bold text-slate-700",children:"Financial Due Diligence"})]})})]})})}),e.jsxs("div",{className:"flex items-center gap-8 border-b border-slate-200","data-testid":"onboarding-fdd-details-tabs",children:[e.jsxs("button",{onClick:()=>u("details"),className:`pb-3 text-sm font-semibold transition-all relative ${p==="details"?"text-blue-600":"text-slate-500 hover:text-slate-700"}`,"data-testid":"onboarding-fdd-details-tab-workspace",children:["Workspace",p==="details"&&e.jsx("div",{className:"absolute bottom-[-1px] left-0 right-0 h-0.5 bg-blue-600"})]}),e.jsxs("button",{onClick:()=>u("worknotes"),className:`pb-3 text-sm font-semibold transition-all relative ${p==="worknotes"?"text-blue-600":"text-slate-500 hover:text-slate-700"}`,"data-testid":"onboarding-fdd-details-tab-worknotes",children:[e.jsx("div",{className:"flex items-center gap-2",children:"Work Notes"}),p==="worknotes"&&e.jsx("div",{className:"absolute bottom-[-1px] left-0 right-0 h-0.5 bg-blue-600"})]})]}),p==="details"?e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2 space-y-6",children:e.jsxs(Le,{className:"border border-slate-200 shadow-sm bg-white","data-testid":"onboarding-fdd-details-workspace-card",children:[e.jsx(tt,{className:"border-b border-slate-100 px-6 py-4",children:e.jsxs(nt,{className:"text-base font-bold flex items-center gap-2 text-slate-800",children:[e.jsx(Dr,{className:"w-4 h-4 text-slate-500"}),G?"Finalized Financial Reports":Z?"Audit Workspace":"Financial Report Submission"]})}),e.jsxs(Me,{className:"p-6",children:[Z&&e.jsxs("div",{className:"mb-6 p-8 bg-slate-50 border border-dashed border-slate-200 rounded-xl flex flex-col items-center justify-center text-center","data-testid":"onboarding-fdd-details-not-active",children:[e.jsx("div",{className:"w-16 h-16 bg-white rounded-full flex items-center justify-center text-slate-300 mb-4 shadow-sm",children:e.jsx(Js,{className:"w-8 h-8"})}),e.jsx("h4",{className:"text-lg font-bold text-slate-900 mb-2",children:"Stage Not Yet Active"}),e.jsx("p",{className:"text-sm text-slate-500 max-w-sm mb-6",children:"This application is still being processed in previous documentation or interview stages. The FDD workspace will activate once the previous stages are approved."}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-slate-400 uppercase tracking-widest px-4 py-1.5 bg-white rounded-full border border-slate-200",children:["Status: ",n.status||"Pending Review"]})]}),G&&e.jsxs("div",{className:"mb-6 p-4 bg-green-50/50 border border-green-100 rounded-xl flex items-center gap-4","data-testid":"onboarding-fdd-details-completed-alert",children:[e.jsx("div",{className:"w-10 h-10 bg-green-100 rounded-full flex items-center justify-center text-green-600 shrink-0",children:e.jsx(Fn,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-green-800",children:"Verification Stage Completed"}),e.jsx("p",{className:"text-[11px] text-green-600 font-medium",children:"The FDD report has been submitted and the case is now locked for further audits."})]})]}),!G&&!Z&&e.jsxs("div",{className:"p-10 border-2 border-dashed border-slate-200 rounded-lg flex flex-col items-center justify-center text-center","data-testid":"onboarding-fdd-details-upload-section",children:[e.jsx("div",{className:"w-12 h-12 bg-slate-50 text-slate-400 rounded-full flex items-center justify-center mb-4",children:e.jsx(fs,{className:"w-6 h-6"})}),e.jsx("p",{className:"text-slate-600 font-medium mb-1","data-testid":"onboarding-fdd-details-upload-title",children:$?"Select and upload the due diligence report":"View Authorized Documents"}),e.jsx("p",{className:"text-slate-400 text-xs mb-6","data-testid":"onboarding-fdd-details-upload-hint",children:$?"PDF or JPG formats accepted (Max 10MB)":"You are in View-Only mode for this Audit"}),$&&e.jsxs("div",{className:"w-full max-w-sm space-y-4",children:[e.jsxs("select",{value:f,onChange:D=>m(D.target.value),className:"w-full px-3 py-2 bg-slate-50 border border-slate-200 rounded text-sm font-medium text-slate-700 outline-none focus:ring-1 focus:ring-blue-500 transition-all","data-testid":"onboarding-fdd-details-doc-type-select",children:[e.jsx("option",{value:"",children:"Select Document Category..."}),e.jsx("option",{value:"FDD Final Audit Report",children:"FDD Final Audit Report"}),e.jsx("option",{value:"Bank Statement",children:"Bank Statement"}),e.jsx("option",{value:"Income Tax Returns (ITR)",children:"Income Tax Returns (ITR)"}),e.jsx("option",{value:"CIBIL Report",children:"CIBIL Report"}),e.jsx("option",{value:"Business Valuation Report",children:"Business Valuation Report"}),e.jsx("option",{value:"Property Documents",children:"Property Documents"})]}),e.jsx("div",{className:"relative",children:h?e.jsxs("div",{className:"w-full py-2.5 bg-slate-100 rounded flex items-center justify-center gap-2","data-testid":"onboarding-fdd-details-uploading-state",children:[e.jsx(ss,{className:"w-4 h-4 animate-spin text-slate-400"}),e.jsx("span",{className:"text-slate-500 text-xs font-bold uppercase tracking-wider",children:"Uploading..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:E,disabled:!f,"data-testid":"onboarding-fdd-details-file-input"}),e.jsx("div",{className:`w-full py-2.5 text-center font-bold uppercase tracking-wider text-xs rounded transition-all ${f?"bg-slate-900 text-white hover:bg-slate-800":"bg-slate-100 text-slate-300"}`,"data-testid":"onboarding-fdd-details-browse-btn",children:"Browse & Upload"})]})})]})]}),e.jsxs("div",{className:"mt-8 border-t border-slate-100 pt-8","data-testid":"onboarding-fdd-details-documents-section",children:[e.jsx("h3",{className:"text-sm font-bold text-slate-800 mb-4 px-1",children:"Submitted Documentation"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{"data-testid":"onboarding-fdd-details-applicant-docs",children:[e.jsxs("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2 flex items-center gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-blue-500"}),"Applicant's KYC & Financials"]}),e.jsxs("div",{className:"space-y-2",children:[(W=n.uploadedDocuments)==null?void 0:W.filter(D=>!D.uploader||D.uploader.roleCode!=="FDD").map((D,O)=>{var V;return e.jsxs("div",{className:"p-3 border border-slate-100 rounded flex items-center justify-between hover:bg-slate-50 transition-all group","data-testid":`onboarding-fdd-details-applicant-doc-row-${O}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-slate-100 flex items-center justify-center text-slate-400 group-hover:bg-white transition-colors",children:e.jsx(fs,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-xs font-bold text-slate-900","data-testid":`onboarding-fdd-details-applicant-doc-name-${O}`,children:D.originalName||D.fileName}),e.jsx("span",{className:"text-[8px] bg-slate-100 text-slate-500 px-1 py-0.5 rounded uppercase font-bold tracking-tighter",children:"APPLICANT"})]}),e.jsxs("p",{className:"text-[10px] text-slate-400 font-medium","data-testid":`onboarding-fdd-details-applicant-doc-meta-${O}`,children:[D.documentType," • ",Ht(D.createdAt),((V=D.uploader)==null?void 0:V.fullName)&&` • by ${D.uploader.fullName}`]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>_(D),className:"p-1.5 hover:bg-white rounded text-slate-400 hover:text-blue-600 transition-all","data-testid":`onboarding-fdd-details-applicant-doc-preview-${O}`,children:e.jsx(nn,{className:"w-4 h-4"})})})]},O)}),((z=n.uploadedDocuments)==null?void 0:z.filter(D=>!D.uploader||D.uploader.roleCode!=="FDD").length)===0&&e.jsx("p",{className:"text-[10px] text-slate-400 italic px-1","data-testid":"onboarding-fdd-details-applicant-docs-empty",children:"No documents from applicant yet."})]})]}),e.jsxs("div",{"data-testid":"onboarding-fdd-details-my-submissions",children:[e.jsxs("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2 flex items-center gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-amber-500"}),"My Uploaded Reports"]}),e.jsxs("div",{className:"space-y-2",children:[(F=n.uploadedDocuments)==null?void 0:F.filter(D=>{var O;return((O=D.uploader)==null?void 0:O.roleCode)==="FDD"}).map((D,O)=>{var V;return e.jsxs("div",{className:"p-3 border border-amber-100 bg-amber-50/30 rounded flex items-center justify-between hover:bg-amber-50 transition-all group","data-testid":`onboarding-fdd-details-my-report-row-${O}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-amber-100 flex items-center justify-center text-amber-500",children:e.jsx(fs,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-xs font-bold text-slate-900","data-testid":`onboarding-fdd-details-my-report-name-${O}`,children:D.originalName||D.fileName}),e.jsx("span",{className:"text-[8px] bg-amber-500 text-white px-1 py-0.5 rounded uppercase font-bold tracking-tighter",children:"YOUR AUDIT REPORT"})]}),e.jsxs("p",{className:"text-[10px] text-slate-400 font-medium","data-testid":`onboarding-fdd-details-my-report-meta-${O}`,children:[D.documentType," • ",Ht(D.createdAt),((V=D.uploader)==null?void 0:V.fullName)&&` • by ${D.uploader.fullName}`]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>_(D),className:"p-1.5 hover:bg-white rounded text-slate-400 hover:text-amber-600 transition-all","data-testid":`onboarding-fdd-details-my-report-preview-${O}`,children:e.jsx(nn,{className:"w-4 h-4"})})})]},O)}),((B=n.uploadedDocuments)==null?void 0:B.filter(D=>{var O;return((O=D.uploader)==null?void 0:O.roleCode)==="FDD"}).length)===0&&e.jsx("div",{className:"text-center py-4 bg-slate-50 border border-dashed border-slate-200 rounded-lg","data-testid":"onboarding-fdd-details-my-submissions-empty",children:e.jsx("p",{className:"text-slate-400 text-[10px]",children:"No audit reports uploaded yet."})})]})]})]})]})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(Le,{className:"border border-slate-200 shadow-sm bg-white","data-testid":"onboarding-fdd-details-profile-card",children:[e.jsx(tt,{className:"border-b border-slate-100 px-6 pt-4 pb-2.5",children:e.jsx(nt,{className:"text-xs font-bold uppercase tracking-wider text-slate-500",children:"Applicant Profile"})}),e.jsxs(Me,{className:"p-5 space-y-4",children:[e.jsxs("div",{className:"space-y-1 pb-3 border-b border-slate-50","data-testid":"onboarding-fdd-details-target-loc",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Target Location"}),e.jsxs("p",{className:"text-sm font-extrabold text-slate-900",children:[n.city,", ",n.state]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-xs","data-testid":"onboarding-fdd-details-profile-meta",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Education"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.education||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Experience"}),e.jsxs("p",{className:"font-bold text-slate-800",children:[n.experienceYears||"0"," Years"]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Investment Cap"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.investmentCapacity||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Age"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.age||"N/A"})]})]}),e.jsxs("div",{className:"space-y-1 pt-3 border-t border-slate-50 text-xs","data-testid":"onboarding-fdd-details-communication",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Communication"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.email}),e.jsx("p",{className:"text-slate-500 font-medium",children:n.phone})]})]})]}),e.jsxs(Le,{className:"border border-slate-200 shadow-sm bg-white","data-testid":"onboarding-fdd-details-statutory-card",children:[e.jsx(tt,{className:"border-b border-slate-100 px-6 pt-4 pb-2.5",children:e.jsx(nt,{className:"text-xs font-bold uppercase tracking-wider text-slate-500",children:"Statutory Details"})}),e.jsx(Me,{className:"p-5 space-y-3",children:e.jsxs("div",{className:"grid grid-cols-1 gap-2.5 text-xs",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Constitution Type"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.constitutionType||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"PAN Number"}),e.jsx("p",{className:"font-bold text-slate-800 uppercase tracking-tight",children:n.panNumber||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"GST Number"}),e.jsx("p",{className:"font-bold text-slate-800 uppercase tracking-tight",children:n.gstNumber||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Registered Address"}),e.jsx("p",{className:"font-medium text-slate-700 leading-relaxed text-[11px]",children:n.registeredAddress||"N/A"})]})]})})]}),e.jsxs(Le,{className:"border border-slate-200 shadow-sm bg-white","data-testid":"onboarding-fdd-details-bank-card",children:[e.jsx(tt,{className:"border-b border-slate-100 px-6 pt-4 pb-2.5",children:e.jsx(nt,{className:"text-xs font-bold uppercase tracking-wider text-slate-500",children:"Bank Details"})}),e.jsx(Me,{className:"p-5 space-y-3",children:e.jsxs("div",{className:"grid grid-cols-1 gap-2.5 text-xs",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Account Holder"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.accountHolderName||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Bank Name"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.bankName||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Account Number"}),e.jsx("p",{className:"font-bold text-slate-800 tabular-nums",children:n.accountNumber||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"IFSC Code & Branch"}),e.jsxs("p",{className:"font-bold text-slate-800 uppercase tracking-tight",children:[n.ifscCode||"N/A",n.branchName&&e.jsxs("span",{className:"text-slate-400 font-medium ml-2",children:["— ",n.branchName]})]})]})]})})]}),e.jsxs("div",{className:"p-6 bg-slate-900 rounded-lg text-white font-medium","data-testid":"onboarding-fdd-details-instructions",children:[e.jsx("h4",{className:"text-sm font-bold mb-2",children:"Instructions"}),e.jsxs("ul",{className:"text-xs text-slate-300 space-y-2 list-disc pl-4",children:[e.jsx("li",{children:"Bank statements must cover 12 months."}),e.jsx("li",{children:"GST discrepancies must be noted."}),e.jsx("li",{children:"Verify property papers with originals."})]})]})]})]}):e.jsx("div",{className:"bg-white rounded-lg border border-slate-200 min-h-[600px] overflow-hidden",children:e.jsx(nE,{onBack:()=>u("details"),requestId:t,requestType:"application"})}),e.jsx(Kl,{isOpen:j,onClose:()=>g(!1),document:y}),e.jsx(os,{open:S,onOpenChange:C,children:e.jsxs(ls,{className:"max-w-md p-0 overflow-hidden border-none shadow-2xl","data-testid":"onboarding-fdd-details-finalize-modal",children:[e.jsxs("div",{className:"bg-slate-950 p-6 flex items-center justify-center relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-600/20 to-transparent"}),e.jsx("div",{className:"w-16 h-16 bg-amber-600/20 rounded-full flex items-center justify-center animate-pulse relative z-10",children:e.jsx(Fl,{className:"w-8 h-8 text-amber-500"})})]}),e.jsxs("div",{className:"p-8 space-y-4",children:[e.jsxs(ms,{children:[e.jsx(us,{className:"text-2xl font-bold text-slate-900 text-center","data-testid":"onboarding-fdd-details-finalize-title",children:"Submit Audit Report"}),e.jsxs(vs,{className:"text-slate-500 text-center pt-2 leading-relaxed text-base","data-testid":"onboarding-fdd-details-finalize-desc",children:["You are about to submit your final findings. This action will ",e.jsx("span",{className:"font-bold text-slate-800 underline decoration-amber-500 decoration-2",children:"notify the Admin"})," for review and approval."]})]}),e.jsxs("div",{className:"bg-amber-50 p-4 rounded-xl flex gap-3 border border-amber-100 italic","data-testid":"onboarding-fdd-details-finalize-info",children:[e.jsx(Xa,{className:"w-5 h-5 text-amber-600 shrink-0 mt-0.5"}),e.jsx("p",{className:"text-xs text-amber-800 leading-normal",children:"Once submitted, you cannot edit the findings. Ensure all documents are uploaded."})]}),e.jsx("div",{className:"space-y-4 pt-2",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:"Detailed Audit Findings & Remarks"}),e.jsx(Fs,{placeholder:"Enter detailed financial observations...",className:"min-h-[120px] bg-slate-50 border-slate-200 rounded-xl focus:ring-amber-500 text-sm resize-none",value:P,onChange:D=>A(D.target.value),"data-testid":"onboarding-fdd-details-finalize-remarks"})]})}),e.jsxs(rn,{className:"flex flex-col sm:flex-row gap-3 pt-4 sm:pt-6",children:[e.jsx(se,{variant:"outline",className:"w-full sm:flex-1 h-12 rounded-xl font-bold text-slate-600 hover:bg-slate-50 border-slate-200",onClick:()=>C(!1),disabled:h,"data-testid":"onboarding-fdd-details-finalize-cancel",children:"Cancel"}),e.jsx(se,{className:"w-full sm:flex-1 h-12 rounded-xl font-bold bg-slate-950 hover:bg-slate-900 text-white shadow-lg shadow-slate-200 transition-all active:scale-95 border-b-2 border-amber-600","data-testid":"onboarding-fdd-details-finalize-confirm",onClick:async()=>{var D,O;try{if(!P.trim()){ee.error("Please provide findings.");return}x(!0);const V=(D=a==null?void 0:a.reports)==null?void 0:D[0];(O=(await Te.submitFddReport({assignmentId:a==null?void 0:a.id,applicationId:t,reportDocumentId:V==null?void 0:V.reportDocumentId,findings:P,recommendation:null})).data)!=null&&O.success&&(ee.success("FDD Report submitted successfully."),C(!1),T())}catch{ee.error("Failed to submit report")}finally{x(!1)}},disabled:h,children:h?e.jsx(ss,{className:"w-5 h-5 animate-spin"}):"Confirm & Submit"})]})]})]})}),e.jsx(os,{open:w,onOpenChange:R,children:e.jsxs(ls,{className:"max-w-md p-0 overflow-hidden border-none shadow-2xl","data-testid":"onboarding-fdd-details-flag-modal",children:[e.jsxs("div",{className:"bg-slate-950 p-6 flex items-center justify-center relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-600/20 to-transparent"}),e.jsx("div",{className:"w-16 h-16 bg-red-600/20 rounded-full flex items-center justify-center relative z-10",children:e.jsx(Ya,{className:"w-8 h-8 text-red-500"})})]}),e.jsxs("div",{className:"p-8 space-y-4",children:[e.jsxs(ms,{children:[e.jsx(us,{className:"text-2xl font-bold text-slate-900 text-center","data-testid":"onboarding-fdd-details-flag-modal-title",children:"Flag Applicant"}),e.jsxs(vs,{className:"text-slate-500 text-center pt-2 leading-relaxed text-base","data-testid":"onboarding-fdd-details-flag-modal-desc",children:["Are you sure you want to flag this applicant as ",e.jsx("span",{className:"font-bold text-red-600",children:"Non-Responsive"}),"?"]})]}),e.jsx("div",{className:"bg-red-50 p-4 rounded-xl flex gap-3 border border-red-100 italic",children:e.jsx("p",{className:"text-xs text-red-800 leading-normal text-center w-full","data-testid":"onboarding-fdd-details-flag-modal-text",children:'"Applicant is non-responsive to FDD queries."'})}),e.jsxs(rn,{className:"flex flex-col sm:flex-row gap-3 pt-4 sm:pt-6",children:[e.jsx(se,{variant:"outline",className:"w-full sm:flex-1 h-12 rounded-xl font-bold text-slate-600 hover:bg-slate-50 border-slate-200",onClick:()=>R(!1),disabled:h,"data-testid":"onboarding-fdd-details-flag-modal-cancel",children:"Go Back"}),e.jsx(se,{className:"w-full sm:flex-1 h-12 rounded-xl font-bold bg-slate-950 hover:bg-slate-900 text-white shadow-lg shadow-slate-200 transition-all active:scale-95 border-b-2 border-red-600","data-testid":"onboarding-fdd-details-flag-modal-confirm",onClick:async()=>{try{x(!0),await Te.flagNonResponsive({applicationId:t,remarks:"Applicant is non-responsive to FDD queries."}),ee.error("Application flagged for non-responsiveness."),R(!1),T()}catch{ee.error("Action failed")}finally{x(!1)}},disabled:h,children:h?e.jsx(ss,{className:"w-5 h-5 animate-spin"}):"Flag Applicant"})]})]})]})})]})}function N7(t,s=[]){let n=[];function r(l,c){const d=v.createContext(c);d.displayName=l+"Context";const h=n.length;n=[...n,c];const x=m=>{var N;const{scope:p,children:u,...j}=m,g=((N=p==null?void 0:p[t])==null?void 0:N[h])||d,y=v.useMemo(()=>j,Object.values(j));return e.jsx(g.Provider,{value:y,children:u})};x.displayName=l+"Provider";function f(m,p){var g;const u=((g=p==null?void 0:p[t])==null?void 0:g[h])||d,j=v.useContext(u);if(j)return j;if(c!==void 0)return c;throw new Error(`\`${m}\` must be used within \`${l}\``)}return[x,f]}const a=()=>{const l=n.map(c=>v.createContext(c));return function(d){const h=(d==null?void 0:d[t])||l;return v.useMemo(()=>({[`__scope${t}`]:{...d,[t]:h}}),[d,h])}};return a.scopeName=t,[r,w7(a,...s)]}function w7(...t){const s=t[0];if(t.length===1)return s;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const c=r.reduce((d,{useScope:h,scopeName:x})=>{const m=h(l)[`__scope${x}`];return{...d,...m}},{});return v.useMemo(()=>({[`__scope${s.scopeName}`]:c}),[c])}};return n.scopeName=s.scopeName,n}var S7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rE=S7.reduce((t,s)=>{const n=hu(`Primitive.${s}`),r=v.forwardRef((a,l)=>{const{asChild:c,...d}=a,h=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${s}`,{...t,[s]:r}},{}),Bb="Progress",$b=100,[C7]=N7(Bb),[A7,k7]=C7(Bb),aE=v.forwardRef((t,s)=>{const{__scopeProgress:n,value:r=null,max:a,getValueLabel:l=R7,...c}=t;(a||a===0)&&!a1(a)&&console.error(E7(`${a}`,"Progress"));const d=a1(a)?a:$b;r!==null&&!i1(r,d)&&console.error(D7(`${r}`,"Progress"));const h=i1(r,d)?r:null,x=Pm(h)?l(h,d):void 0;return e.jsx(A7,{scope:n,value:h,max:d,children:e.jsx(rE.div,{"aria-valuemax":d,"aria-valuemin":0,"aria-valuenow":Pm(h)?h:void 0,"aria-valuetext":x,role:"progressbar","data-state":oE(h,d),"data-value":h??void 0,"data-max":d,...c,ref:s})})});aE.displayName=Bb;var iE="ProgressIndicator",lE=v.forwardRef((t,s)=>{const{__scopeProgress:n,...r}=t,a=k7(iE,n);return e.jsx(rE.div,{"data-state":oE(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...r,ref:s})});lE.displayName=iE;function R7(t,s){return`${Math.round(t/s*100)}%`}function oE(t,s){return t==null?"indeterminate":t===s?"complete":"loading"}function Pm(t){return typeof t=="number"}function a1(t){return Pm(t)&&!isNaN(t)&&t>0}function i1(t,s){return Pm(t)&&!isNaN(t)&&t<=s&&t>=0}function E7(t,s){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${s}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${$b}\`.`}function D7(t,s){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${s}\`. The \`value\` prop must be: + */var r1;function u7(){if(r1)return Kx;r1=1;var t=Ic();function s(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var n=typeof Object.is=="function"?Object.is:s,r=t.useState,a=t.useEffect,l=t.useLayoutEffect,c=t.useDebugValue;function d(h,g){var u=g(),j=r({inst:{value:u,getSnapshot:g}}),p=j[0].inst,y=j[1];return l(function(){p.value=u,p.getSnapshot=g,m(p)&&y({inst:p})},[h,u,g]),a(function(){return m(p)&&y({inst:p}),h(function(){m(p)&&y({inst:p})})},[h]),c(u),u}function m(h){var g=h.getSnapshot;h=h.value;try{var u=g();return!n(h,u)}catch{return!0}}function x(h,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?x:d;return Kx.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Kx}var a1;function h7(){return a1||(a1=1,Wx.exports=u7()),Wx.exports}var m7=h7();function f7(){return m7.useSyncExternalStore(p7,()=>!0,()=>!1)}function p7(){return()=>{}}var $b="Avatar",[x7]=o7($b),[g7,sE]=x7($b),nE=v.forwardRef((t,s)=>{const{__scopeAvatar:n,...r}=t,[a,l]=v.useState("idle");return e.jsx(g7,{scope:n,imageLoadingStatus:a,onImageLoadingStatusChange:l,children:e.jsx(Bb.span,{...r,ref:s})})});nE.displayName=$b;var rE="AvatarImage",v7=v.forwardRef((t,s)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:a=()=>{},...l}=t,c=sE(rE,n),d=b7(r,l),m=dr(x=>{a(x),c.onImageLoadingStatusChange(x)});return Zn(()=>{d!=="idle"&&m(d)},[d,m]),d==="loaded"?e.jsx(Bb.img,{...l,ref:s,src:r}):null});v7.displayName=rE;var aE="AvatarFallback",iE=v.forwardRef((t,s)=>{const{__scopeAvatar:n,delayMs:r,...a}=t,l=sE(aE,n),[c,d]=v.useState(r===void 0);return v.useEffect(()=>{if(r!==void 0){const m=window.setTimeout(()=>d(!0),r);return()=>window.clearTimeout(m)}},[r]),c&&l.imageLoadingStatus!=="loaded"?e.jsx(Bb.span,{...a,ref:s}):null});iE.displayName=aE;function i1(t,s){return t?s?(t.src!==s&&(t.src=s),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function b7(t,{referrerPolicy:s,crossOrigin:n}){const r=f7(),a=v.useRef(null),l=r?(a.current||(a.current=new window.Image),a.current):null,[c,d]=v.useState(()=>i1(l,t));return Zn(()=>{d(i1(l,t))},[l,t]),Zn(()=>{const m=h=>()=>{d(h)};if(!l)return;const x=m("loaded"),f=m("error");return l.addEventListener("load",x),l.addEventListener("error",f),s&&(l.referrerPolicy=s),typeof n=="string"&&(l.crossOrigin=n),()=>{l.removeEventListener("load",x),l.removeEventListener("error",f)}},[l,n,s]),c}var y7=nE,j7=iE;function Fh({className:t,...s}){return e.jsx(y7,{"data-slot":"avatar",className:_t("relative flex size-10 shrink-0 overflow-hidden rounded-full",t),...s})}function Bh({className:t,...s}){return e.jsx(j7,{"data-slot":"avatar-fallback",className:_t("bg-muted flex size-full items-center justify-center rounded-full",t),...s})}const $h="/collaboration",qh={getWorknotes:async(t,s)=>(await ze.get(`${$h}/worknotes`,{requestId:t,requestType:s})).data,addWorknote:async t=>(await ze.post(`${$h}/worknotes`,t)).data,uploadAttachment:async(t,s,n)=>{const r=new FormData;return r.append("file",t),s&&r.append("requestId",s),n&&r.append("requestType",n),(await ze.post(`${$h}/upload`,r,{headers:{"Content-Type":"multipart/form-data"}})).data},revokeParticipant:async(t,s)=>(await ze.delete(`${$h}/participants/${t}`,{data:{reason:s}})).data},Cd=t=>[...t].sort((s,n)=>new Date(s.createdAt).getTime()-new Date(n.createdAt).getTime()),Gx=t=>{var s,n,r,a,l;return{name:((s=t==null?void 0:t.author)==null?void 0:s.name)||((n=t==null?void 0:t.author)==null?void 0:n.fullName)||"System",email:((r=t==null?void 0:t.author)==null?void 0:r.email)||"",role:String(((a=t==null?void 0:t.author)==null?void 0:a.role)||((l=t==null?void 0:t.author)==null?void 0:l.roleCode)||"")}},N7=new Set(["internal","workflow","system","audit","status"]),w7=t=>N7.has(String(t.noteType||"").toLowerCase()),S7=t=>{const s=String(t.noteType||"").toLowerCase();return s==="workflow"?"Workflow activity":s==="internal"?"Review / approval":s==="system"?"System":s==="audit"?"Audit":s==="status"?"Status update":"Activity"},C7=t=>{const s=String(t.noteType||"").toLowerCase();return s==="internal"?"APPROVAL":s==="workflow"?"WORKFLOW":s==="system"?"SYSTEM":s==="audit"?"AUDIT":s==="status"?"STATUS":"ACTIVITY"},l1=t=>t?new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}):"",bc="https://dealeronboarding-uat.royalenfield.com/api".replace("/api","")||"http://localhost:5000";function lE(t){var Cs,Bs,Ft,ie,Fe;const{user:s}=Nn(Q=>Q.auth),{id:n,type:r}=Bc(),a=Ul(),l=qn(),c=t.requestId||n||"",d=t.requestType||r||((Cs=a.state)==null?void 0:Cs.requestType)||"application",m=t.mode||((Bs=a.state)==null?void 0:Bs.mode)||"page",[x,f]=v.useState(t.applicationName||((Ft=a.state)==null?void 0:Ft.applicationName)||"Application"),[h,g]=v.useState(t.registrationNumber||((ie=a.state)==null?void 0:ie.registrationNumber)||""),u=t.onBack||(()=>l(-1)),j=t.participants||((Fe=a.state)==null?void 0:Fe.participants)||[],[p,y]=v.useState(j),[N,S]=v.useState([]),[A,w]=v.useState(""),[E,T]=v.useState(!1),[C,L]=v.useState(""),[$,_]=v.useState(0),[R,P]=v.useState(!0),[M,q]=v.useState(!1),[K,Z]=v.useState([]),[W,U]=v.useState(!1),[F,B]=v.useState(!0),[D,O]=v.useState(""),[z,G]=v.useState(""),[Y,V]=v.useState(null),[X,ne]=v.useState(""),[oe,re]=v.useState(!1),{socket:ge}=Rk(),ve=v.useRef(null),Se=v.useRef(null),[We,Ce]=v.useState(null),fe=(Q,pe)=>Q.startsWith("image/")&&pe?e.jsx("img",{src:`${bc}/${pe.replace(/\\/g,"/")}`,className:"w-full h-full object-cover rounded",alt:"Thumbnail"}):Q.startsWith("image/")?e.jsx(mw,{className:"w-5 h-5 text-blue-500"}):Q==="application/pdf"?e.jsx(fs,{className:"w-5 h-5 text-red-500"}):e.jsx(bm,{className:"w-5 h-5 text-slate-500"}),Ye=["😊","😂","🤣","❤️","👍","🙏","🔥","✨","😍","🥰","😎","🤔","😅","🙌","👏","🎉","✅","❌","📌","📎","📍","💡","🔔","📢","⭐","🌟","💪","🚀","👀","💯","🌈","☀️","😢","😭","😞","😔","😟","😕","😠","😡","🤬","😤","😲","🙄","🤨","😓","😩","😫","🤐","😴","🤢","🤮","😱","🤡","💀","👻","🤝","👋","✌️","👌","✋","🍎","🍕","☕","💻","📱","⌚","📁","📄","📅","🔒","🔑","🛠️","⚙️","💬","💭","🌊","🍀","✈️","🏠"],be=Q=>Q.split(" ").map(pe=>pe[0]).join("").toUpperCase().substring(0,2),Pe=Q=>{const pe=["bg-green-600","bg-blue-600","bg-purple-600","bg-amber-600","bg-pink-600","bg-indigo-600","bg-teal-600"],Ne=Q.length%pe.length;return pe[Ne]},ke=[],qe=new Set;p.forEach(Q=>{var Ee,it,st,bt,Ue,It,ut;const pe=((Ee=Q.user)==null?void 0:Ee.id)||Q.userId||"",Ne=Q.id;if(pe&&!qe.has(pe)){qe.add(pe);const yt=((it=Q.user)==null?void 0:it.fullName)||((st=Q.user)==null?void 0:st.name)||Q.fullName||Q.name||"Unknown User",kt=((bt=Q.user)==null?void 0:bt.email)||Q.email||"",Le=((Ue=Q.user)==null?void 0:Ue.roleCode)||Q.roleCode||((It=Q.user)==null?void 0:It.role)||Q.role||"Participant";ke.push({id:pe,recordId:Ne,name:yt,email:kt,initials:be(yt),color:Pe(yt),role:Le,isOnline:!1,revokedAt:(ut=Q.metadata)==null?void 0:ut.revokedAt})}});const Ve=async()=>{try{P(!0);const Q=await qh.getWorknotes(c,d);if(Q.success){const pe=Q.data.map(Ne=>({id:Ne.id,noteText:Ne.noteText,noteType:Ne.noteType,createdAt:Ne.createdAt,userId:Ne.userId,author:Ne.author?Gx(Ne):{name:"System",email:"",role:"system"},attachments:Ne.attachments||[]}));S(Cd(pe))}}catch(Q){console.error("Fetch notes error:",Q),ee.error("Failed to load work notes")}finally{P(!1)}};v.useEffect(()=>{if(Ve(),ge)return ge.emit("join_room",c),ge.on("new_worknote",Q=>{const pe={id:Q.id,noteText:Q.noteText,noteType:Q.noteType,createdAt:Q.createdAt,userId:Q.userId,author:Q.author?Gx(Q):{name:"System",email:"",role:"system"},attachments:Q.attachments||[]};S(Ne=>{if(Ne.some(st=>st.id===pe.id))return Ne;const it=Ne.findIndex(st=>{var bt,Ue;return st.id.startsWith("temp-")&&st.noteText===pe.noteText&&((bt=st.author.email)==null?void 0:bt.toLowerCase())===((Ue=pe.author.email)==null?void 0:Ue.toLowerCase())});if(it!==-1){const st=[...Ne];return st[it]=pe,Cd(st)}return Cd([...Ne,pe])})}),()=>{ge.emit("leave_room",c),ge.off("new_worknote")}},[c,d,ge]),v.useEffect(()=>{if(!c||!d)return;(async()=>{var pe,Ne,Ee,it,st,bt,Ue,It,ut,yt;try{let kt=null;if(d==="application")kt=await ds.getApplicationById(c),kt&&(p.length===0&&kt.participants&&y(kt.participants),(!x||x==="Application")&&f(kt.companyName||"Application"),h||g(kt.registrationNumber||""));else if(d==="termination"){const{API:Le}=await Tl(async()=>{const{API:ht}=await Promise.resolve().then(()=>_d);return{API:ht}},void 0),Pt=await Le.getTerminationById(c);(pe=Pt.data)!=null&&pe.success&&(kt=Pt.data.termination,p.length===0&&kt.participants&&y(kt.participants),(!x||x==="Application"||x==="Termination")&&f(((Ne=kt.dealer)==null?void 0:Ne.businessName)||"Termination"),h||g(kt.requestId||""))}else if(d==="constitutional"||d==="constitutional-change"){const{API:Le}=await Tl(async()=>{const{API:ht}=await Promise.resolve().then(()=>_d);return{API:ht}},void 0),Pt=await Le.getConstitutionalChangeById(c);(Ee=Pt.data)!=null&&Ee.success&&(kt=Pt.data.request,p.length===0&&kt.participants&&y(kt.participants),(!x||x==="Application"||x==="Constitutional Change")&&f(((it=kt.outlet)==null?void 0:it.name)||"Constitutional Change"),h||g(kt.requestId||""))}else if(d==="resignation"){const{API:Le}=await Tl(async()=>{const{API:ht}=await Promise.resolve().then(()=>_d);return{API:ht}},void 0),Pt=await Le.getResignationById(c);(st=Pt.data)!=null&&st.success&&(kt=Pt.data.resignation,p.length===0&&kt.participants&&y(kt.participants),(!x||x==="Application"||x==="Resignation")&&f(((bt=kt.dealer)==null?void 0:bt.businessName)||"Resignation"),h||g(kt.resignationId||""))}else if(d==="fnf"){const{API:Le}=await Tl(async()=>{const{API:ht}=await Promise.resolve().then(()=>_d);return{API:ht}},void 0),Pt=await Le.getFnFSettlementById(c);if((Ue=Pt.data)!=null&&Ue.success){kt=Pt.data.fnf,p.length===0&&kt.participants&&y(kt.participants||[]);const ht=((ut=(It=kt.outlet)==null?void 0:It.dealer)==null?void 0:ut.fullName)||((yt=kt.dealer)==null?void 0:yt.fullName)||"F&F Settlement";(!x||x==="Application"||x==="F&F Settlement")&&f(ht),h||g(kt.settlementId||"")}}}catch(kt){console.error(`Failed to fetch ${d} details:`,kt)}})()},[c,d,p.length,x,h]);const dt=v.useRef(null);v.useEffect(()=>{dt.current&&dt.current.scrollIntoView({behavior:"smooth"})},[N]);const xt=Q=>{const pe=Q.target.value,Ne=Q.target.selectionStart||0;w(pe),_(Ne);const Ee=pe.substring(0,Ne),it=Ee.lastIndexOf("@");if(it!==-1&&it===Ee.length-1)T(!0),L("");else if(it!==-1){const st=Ee.substring(it+1);st.includes(" ")?T(!1):(T(!0),L(st))}else T(!1)},ye=Q=>{var bt;const Ne=A.substring(0,$).lastIndexOf("@"),Ee=A.substring($),it=`@${Q.name}`,st=A.substring(0,Ne)+it+" "+Ee;w(st),T(!1),(bt=ve.current)==null||bt.focus()},le=Q=>{var Ee,it;const pe=((Ee=ve.current)==null?void 0:Ee.selectionStart)||A.length,Ne=A.substring(0,pe)+Q+A.substring(pe);w(Ne),q(!1),(it=ve.current)==null||it.focus()},Qe=async Q=>{const pe=Q.target.files;if(!(!pe||pe.length===0)){U(!0);try{for(const Ne of Array.from(pe)){const Ee=await qh.uploadAttachment(Ne,c,d);Ee.success&&Z(it=>[...it,Ee.data])}}catch(Ne){console.error("File upload error:",Ne),ee.error("Failed to upload attachment")}finally{U(!1),Se.current&&(Se.current.value="")}}},rt=Q=>{Z(pe=>pe.filter(Ne=>Ne.id!==Q))},Gt=async()=>{if(!A.trim()&&K.length===0)return;const Q=A,pe=K;w(""),Z([]);let Ne=Q;const Ee=[];ke.forEach(it=>{if(it.id&&it.name){const st=it.name.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),bt=new RegExp(`@${st}\\b`,"gi");Ne.match(bt)&&(Ee.push(it.id),Ne=Ne.replace(bt,`@[${it.name}](user:${it.id})`))}});try{const it=`temp-${Date.now()}`,st={id:it,noteText:Ne,noteType:"General",createdAt:new Date().toISOString(),userId:s==null?void 0:s.id,author:{name:(s==null?void 0:s.name)||"You",email:(s==null?void 0:s.email)||"",role:(s==null?void 0:s.role)||""},attachments:pe};S(Ue=>Cd([...Ue,st]));const bt=await qh.addWorknote({requestId:c,requestType:d,noteText:Ne,noteType:"General",tags:Ee,attachmentDocIds:pe.map(Ue=>Ue.id)});if(bt.success&&bt.data){const Ue=bt.data,It={id:Ue.id,noteText:Ue.noteText,noteType:Ue.noteType,createdAt:Ue.createdAt,userId:Ue.userId,author:Ue.author?Gx(Ue):{name:"System",email:"",role:"system"},attachments:Ue.attachments||[]};S(ut=>Cd(ut.map(yt=>yt.id===it?It:yt)))}}catch(it){console.error("Send message error:",it),ee.error("Failed to send message")}},Rt=Q=>{if(!["DD Lead","DD Head","NBH","DD Admin","Super Admin"].includes((s==null?void 0:s.roleCode)||"")){ee.error("Only authorized roles can revoke participants");return}V(Q),ne("")},Re=async()=>{if(Y){re(!0);try{const Q=await qh.revokeParticipant(Y.recordId,X);Q.success&&(ee.success(Q.message),V(null),y([]))}catch{ee.error("Error revoking participant")}finally{re(!1)}}},Qt=Q=>{Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),Gt())},qt=Q=>{if(!Q)return"";const pe=/(@\[[^\]]+\]\([^\)]+\))/g;return Q.split(pe).map((Ee,it)=>{const st=Ee.match(/@\[([^\]]+)\]\(([^\)]+)\)/);if(st){const bt=st[1];return e.jsxs("span",{className:"text-blue-600 font-medium hover:underline cursor-pointer",children:["@",bt]},it)}return Ee})},ws=z.trim().toLowerCase(),Ps=ws?N.filter(Q=>{var pe;return(Q.noteText||"").toLowerCase().includes(ws)||(((pe=Q.author)==null?void 0:pe.name)||"").toLowerCase().includes(ws)||(Q.noteType||"").toLowerCase().includes(ws)}):N,ns=ke.filter(Q=>{const pe=Q.name.toLowerCase().includes(C.toLowerCase()),Ne=Q.id&&(s==null?void 0:s.id)&&String(Q.id)===String(s.id)||Q.email&&(s==null?void 0:s.email)&&Q.email.toLowerCase()===s.email.toLowerCase();return pe&&!Ne});return e.jsxs("div",{className:"h-full flex flex-col bg-slate-50 overflow-hidden",children:[e.jsx("div",{className:"bg-white border-b border-slate-200 px-6 py-4 z-10","data-testid":"onboarding-worknotes-header",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"ghost",size:"icon",onClick:u,className:"hover:bg-slate-100","data-testid":"onboarding-worknotes-back-btn",children:e.jsx($r,{className:"w-5 h-5"})}),e.jsx("div",{className:"w-12 h-12 bg-purple-600 rounded-lg flex items-center justify-center",children:e.jsx(zr,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900","data-testid":"onboarding-worknotes-title",children:"Work Notes"}),e.jsxs("div",{className:"flex items-center gap-2 text-slate-600","data-testid":"onboarding-worknotes-meta",children:[e.jsx("span",{"data-testid":"onboarding-worknotes-app-name",children:x}),e.jsx("span",{className:"text-slate-400",children:"|"}),e.jsx("span",{className:"text-slate-500","data-testid":"onboarding-worknotes-reg-num",children:h})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"hidden sm:flex items-center -space-x-2 mr-2","data-testid":"onboarding-worknotes-participant-avatars",children:[ke.slice(0,3).map((Q,pe)=>e.jsx(Fh,{className:"w-8 h-8 border-2 border-white ring-1 ring-slate-100","data-testid":`onboarding-worknotes-avatar-${pe}`,children:e.jsx(Bh,{className:`${Q.color} text-white text-[10px]`,children:Q.initials})},pe)),ke.length>3&&e.jsx("div",{className:"w-8 h-8 rounded-full bg-slate-100 border-2 border-white flex items-center justify-center ring-1 ring-slate-100","data-testid":"onboarding-worknotes-avatar-more",children:e.jsxs("span",{className:"text-slate-600 text-[10px] font-bold",children:["+",ke.length-3]})})]}),e.jsxs(se,{variant:"ghost",size:"sm",onClick:Ve,className:"text-slate-500 hover:text-blue-600 flex items-center gap-1.5 px-2 h-9 rounded-lg hover:bg-slate-50 transition-colors",disabled:R,"data-testid":"onboarding-worknotes-sync-btn",children:[e.jsx(Gi,{className:`w-4 h-4 ${R?"animate-spin":""}`}),e.jsx("span",{className:"text-xs font-medium hidden md:inline",children:"Sync"})]}),e.jsxs(se,{variant:F?"secondary":"ghost",size:"sm",onClick:()=>B(!F),className:`flex items-center gap-1.5 px-2 h-9 rounded-lg transition-all ${F?"bg-blue-50 text-blue-600 hover:bg-blue-100":"text-slate-500 hover:bg-slate-50"}`,"data-testid":"onboarding-worknotes-toggle-sidebar-btn",children:[e.jsx(da,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs font-medium hidden md:inline",children:"Participants"})]})]})]})}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-white min-h-0 relative",children:[e.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4 custom-scrollbar bg-slate-50 relative z-0","data-testid":"onboarding-worknotes-chat-area",children:e.jsxs("div",{className:`max-w-4xl mx-auto flex flex-col py-4 gap-4 ${m==="modal"?"":"px-4"}`,children:[e.jsx("div",{className:"sticky top-0 z-[1] -mx-1 px-1 pb-1 bg-slate-50/95 backdrop-blur-sm",children:e.jsxs("div",{className:"relative",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"}),e.jsx(ot,{type:"search",value:z,onChange:Q=>G(Q.target.value),placeholder:"Search messages...",className:"pl-9 h-10 bg-white border-slate-200 rounded-xl text-sm shadow-sm","aria-label":"Search messages","data-testid":"onboarding-worknotes-search-input"})]})}),Ps.map((Q,pe)=>{var Ee,it,st,bt,Ue,It,ut;if(w7(Q)){const yt=((Ee=Q.author)==null?void 0:Ee.name)||"System",kt=(it=Q.author)!=null&&it.role&&Q.author.role!=="0"&&Q.author.role!==""?Q.author.role:"";return e.jsx("div",{className:"flex w-full justify-center px-1 py-1 sm:px-2","data-testid":`onboarding-worknotes-activity-row-${pe}`,children:e.jsxs("div",{role:"status",title:S7(Q),className:"flex w-full max-w-[min(100%,42rem)] items-start gap-2.5 rounded-xl border border-slate-200/90 bg-slate-100/80 px-3 py-2.5 shadow-sm",children:[e.jsx(Z5,{className:"mt-0.5 h-4 w-4 shrink-0 text-purple-600",strokeWidth:2.5,"aria-hidden":!0}),e.jsx("span",{className:"shrink-0 pt-0.5 text-[10px] font-bold uppercase tracking-wide text-slate-600","data-testid":`onboarding-worknotes-activity-type-${pe}`,children:C7(Q)}),e.jsx("div",{className:"min-w-0 flex-1 text-left",children:e.jsxs("p",{className:"text-sm leading-snug text-slate-800",children:[e.jsx("span",{className:"font-semibold text-slate-900","data-testid":`onboarding-worknotes-activity-who-${pe}`,children:yt}),kt?e.jsxs("span",{className:"text-xs font-normal text-slate-500",children:[" · ",kt]}):null,e.jsx("span",{className:"font-normal text-slate-600",children:" — "}),e.jsx("span",{className:"font-normal text-slate-700","data-testid":`onboarding-worknotes-activity-text-${pe}`,children:qt(Q.noteText)})]})}),e.jsx("time",{className:"shrink-0 whitespace-nowrap pt-0.5 text-right text-[10px] leading-tight text-slate-400 tabular-nums sm:text-[11px]",dateTime:Q.createdAt,"data-testid":`onboarding-worknotes-activity-time-${pe}`,children:l1(Q.createdAt)})]})},Q.id)}const Ne=((st=Q==null?void 0:Q.author)==null?void 0:st.email)&&(s==null?void 0:s.email)&&Q.author.email.toLowerCase()===s.email.toLowerCase()||(Q==null?void 0:Q.userId)&&(s==null?void 0:s.id)&&String(Q.userId)===String(s.id)||Q.id.startsWith("temp-");return e.jsx("div",{className:`flex w-full ${Ne?"justify-end":"justify-start"}`,"data-testid":`onboarding-worknotes-message-row-${pe}`,children:e.jsxs("div",{className:`flex gap-3 max-w-[min(85%,36rem)] ${Ne?"flex-row-reverse":""}`,children:[e.jsx(Fh,{className:"w-10 h-10 flex-shrink-0 mt-1","data-testid":`onboarding-worknotes-message-avatar-${pe}`,children:e.jsx(Bh,{className:`${Pe(((bt=Q==null?void 0:Q.author)==null?void 0:bt.name)||"System")} text-white`,children:be(((Ue=Q==null?void 0:Q.author)==null?void 0:Ue.name)||"S")})}),e.jsxs("div",{className:`flex flex-col min-w-0 ${Ne?"items-end":"items-start"}`,children:[e.jsxs("div",{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 mb-1 px-1 ${Ne?"flex-row-reverse text-right":"text-left"}`,children:[e.jsx("span",{className:"text-slate-900 font-medium text-sm","data-testid":`onboarding-worknotes-message-author-${pe}`,children:Ne?"You":((It=Q==null?void 0:Q.author)==null?void 0:It.name)||"Unknown"}),e.jsx("span",{className:"text-slate-400 text-[10px] uppercase tracking-wide",children:(ut=Q==null?void 0:Q.author)!=null&&ut.role&&Q.author.role!=="0"&&Q.author.role!==""?`(${Q.author.role})`:""}),e.jsx("span",{className:"text-slate-400 text-[10px] tabular-nums","data-testid":`onboarding-worknotes-message-time-${pe}`,children:l1(Q.createdAt)})]}),e.jsxs("div",{className:`rounded-2xl border px-4 py-2.5 shadow-sm relative text-left ${Ne?"bg-blue-50 border-blue-100 text-slate-800 rounded-tr-none":"bg-white border-slate-200 text-slate-700 rounded-tl-none"}`,"data-testid":`onboarding-worknotes-message-bubble-${pe}`,children:[e.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words","data-testid":`onboarding-worknotes-message-text-${pe}`,children:qt(Q.noteText)}),Q.attachments&&Q.attachments.length>0&&e.jsx("div",{className:"mt-2 space-y-2 border-t border-slate-100 pt-2","data-testid":`onboarding-worknotes-message-attachments-${pe}`,children:Q.attachments.map((yt,kt)=>{const Le=yt.mimeType.startsWith("image/");return e.jsx("div",{className:"flex items-center gap-2","data-testid":`onboarding-worknotes-message-attachment-${pe}-${kt}`,children:Le?e.jsx("div",{className:"rounded-lg overflow-hidden border border-slate-100 max-w-[200px]",children:e.jsx("img",{src:`${bc}/${yt.filePath.replace(/\\/g,"/")}`,alt:yt.fileName,className:"w-full h-auto cursor-pointer",onClick:()=>Ce(yt),"data-testid":`onboarding-worknotes-message-attachment-img-${pe}-${kt}`})}):yt.mimeType==="application/pdf"?e.jsxs("button",{type:"button",onClick:()=>Ce(yt),className:"flex items-center gap-2 text-xs text-blue-600 hover:underline","data-testid":`onboarding-worknotes-message-attachment-preview-${pe}-${kt}`,children:[e.jsx(qd,{className:"w-3 h-3"}),yt.fileName," (Preview)"]}):e.jsxs("a",{href:`${bc}/${yt.filePath.replace(/\\/g,"/")}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-xs text-blue-600 hover:underline","data-testid":`onboarding-worknotes-message-attachment-link-${pe}-${kt}`,children:[e.jsx(qd,{className:"w-3 h-3"}),yt.fileName]})},yt.id)})})]})]})]})},Q.id)}),N.length===0&&!R&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center","data-testid":"onboarding-worknotes-empty-state",children:[e.jsx(zr,{className:"w-16 h-16 text-slate-300 mb-4"}),e.jsx("h3",{className:"text-slate-900 mb-2",children:"No messages yet"}),e.jsx("p",{className:"text-slate-600",children:"Start the conversation by sending a message below"})]}),N.length>0&&Ps.length===0&&!R&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center text-slate-500 text-sm",children:['No messages match "',z.trim(),'". Clear the search box to see the full thread.']}),R&&e.jsx("div",{className:"flex justify-center items-center py-8",children:e.jsx("span",{className:"text-slate-500",children:"Loading notes..."})}),e.jsx("div",{ref:dt})]})}),e.jsx("div",{className:"bg-white border-t border-slate-100 px-6 py-4 shadow-[0_-4px_10px_-5px_rgba(0,0,0,0.05)]","data-testid":"onboarding-worknotes-composer",children:e.jsxs("div",{className:"max-w-4xl mx-auto space-y-4",children:[K.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3 mb-3","data-testid":"onboarding-worknotes-attached-files",children:K.map((Q,pe)=>{const Ne=Q.mimeType.startsWith("image/")||Q.mimeType==="application/pdf";return e.jsxs("div",{className:"flex items-center gap-3 p-2 bg-white rounded-xl border border-slate-200 shadow-sm hover:border-blue-300 transition-all group max-w-[200px]","data-testid":`onboarding-worknotes-attached-file-${pe}`,children:[e.jsx("div",{className:"w-10 h-10 bg-slate-50 rounded-lg flex items-center justify-center flex-shrink-0 overflow-hidden",children:fe(Q.mimeType,Q.filePath)}),e.jsxs("div",{className:"flex-1 min-w-0 pr-6 relative",children:[e.jsx("p",{className:`text-xs font-medium text-slate-700 truncate ${Ne?"hover:text-blue-600 cursor-pointer hover:underline":""}`,onClick:()=>Ne&&Ce(Q),children:Q.fileName}),e.jsx("button",{onClick:()=>rt(Q.id),className:"absolute -top-1 -right-1 p-1 bg-white rounded-full border border-slate-100 text-slate-400 hover:text-red-500 shadow-sm opacity-0 group-hover:opacity-100 transition-opacity","data-testid":`onboarding-worknotes-remove-attachment-${pe}`,children:e.jsx(Tc,{className:"w-3 h-3"})})]})]},Q.id)})}),e.jsxs("div",{className:"flex items-end gap-3 bg-white p-2.5 rounded-2xl border border-slate-200 shadow-sm focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-100 transition-all relative",children:[E&&ns.length>0&&e.jsx("div",{className:"absolute bottom-full left-0 mb-2 w-64 bg-white border border-slate-200 rounded-lg shadow-lg overflow-hidden max-h-48 overflow-y-auto z-50 custom-scrollbar","data-testid":"onboarding-worknotes-mention-suggestions",children:ns.map((Q,pe)=>e.jsxs("button",{onClick:()=>ye(Q),className:"w-full flex items-center gap-3 px-4 py-2 hover:bg-slate-50 transition-colors text-left","data-testid":`onboarding-worknotes-mention-item-${pe}`,children:[e.jsx(Fh,{className:"w-8 h-8",children:e.jsx(Bh,{className:`${Q.color} text-white text-xs`,children:Q.initials})}),e.jsx("div",{className:"flex flex-col",children:e.jsx("span",{className:"text-slate-900 text-sm font-medium",children:Q.name})})]},Q.id))}),e.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[e.jsx("input",{type:"file",ref:Se,className:"hidden",multiple:!0,onChange:Qe}),e.jsx(se,{variant:"ghost",size:"icon",className:"w-9 h-9 text-slate-400 hover:text-blue-600 hover:bg-blue-50 rounded-xl",onClick:()=>{var Q;return(Q=Se.current)==null?void 0:Q.click()},"data-testid":"onboarding-worknotes-attachment-btn",children:e.jsx(qd,{className:"w-5 h-5"})}),e.jsxs(se,{variant:"ghost",size:"icon",className:`w-9 h-9 text-slate-400 hover:text-blue-600 hover:bg-blue-50 rounded-xl relative ${M?"bg-blue-50 text-blue-600":""}`,onClick:()=>q(!M),"data-testid":"onboarding-worknotes-emoji-btn",children:[e.jsx(gL,{className:"w-5 h-5"}),M&&e.jsxs("div",{className:"absolute bottom-12 left-0 z-50 bg-white border border-slate-200 rounded-xl shadow-2xl w-72 animate-in fade-in slide-in-from-bottom-2 overflow-hidden","data-testid":"onboarding-worknotes-emoji-picker",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-slate-100 bg-slate-50 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider",children:"Emojis"}),e.jsx("button",{onClick:()=>q(!1),className:"text-slate-400 hover:text-slate-600 text-lg leading-none",children:"×"})]}),e.jsx("div",{className:"p-2 grid grid-cols-8 gap-1 max-h-60 overflow-y-auto custom-scrollbar",children:Ye.map((Q,pe)=>e.jsx("button",{className:"w-8 h-8 flex items-center justify-center hover:bg-blue-50 hover:scale-110 rounded-lg transition-all text-lg",onClick:Ne=>{Ne.stopPropagation(),le(Q)},"data-testid":`onboarding-worknotes-emoji-item-${pe}`,children:Q},Q))})]})]}),e.jsx(se,{variant:"ghost",size:"icon",className:"w-9 h-9 text-slate-400 hover:text-blue-600 hover:bg-blue-50 rounded-xl",onClick:()=>{var Q;return(Q=Se.current)==null?void 0:Q.click()},children:e.jsx(mw,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"flex-1 relative",children:e.jsx(ot,{ref:ve,type:"text",placeholder:"Type your message... Use @username to mention someone",value:A,onChange:xt,onKeyPress:Qt,className:"w-full pr-4 border-none focus-visible:ring-0 px-0"})}),e.jsx(se,{onClick:Gt,disabled:!A.trim()&&K.length===0||W,className:"bg-blue-600 hover:bg-blue-700 text-white rounded-xl h-10 w-10 p-0",children:W?e.jsx("div",{className:"h-4 w-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):e.jsx(fu,{className:"w-5 h-5"})})]}),e.jsxs("p",{className:"text-slate-400 text-[10px] px-1 flex items-center gap-1",children:[e.jsx(Xa,{className:"w-3 h-3"}),e.jsxs("span",{children:["Press Enter to send • Use @ to mention • ",W?"Uploading files...":"Files attached appear above"]})]})]})})]}),F&&e.jsxs("div",{className:`w-[280px] lg:w-[320px] bg-slate-50 border-l border-slate-200 flex flex-col transition-all animate-in slide-in-from-right-full ${m==="modal"?"hidden lg:flex":"flex"}`,children:[e.jsxs("div",{className:"p-4 border-b border-slate-200 bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"font-semibold text-slate-900 flex items-center gap-2",children:[e.jsx(da,{className:"w-4 h-4 text-blue-600"}),"Participants",e.jsx(Ae,{variant:"secondary",className:"bg-slate-100 text-slate-600 ml-1",children:ke.length})]}),e.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-600",onClick:()=>B(!1),children:e.jsx(Tc,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ot,{type:"text",placeholder:"Search people...",value:D,onChange:Q=>O(Q.target.value),className:"pl-9 bg-slate-50 border-slate-200 h-9 text-sm rounded-lg focus-visible:bg-white transition-all"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-1 custom-scrollbar",children:[ke.filter(Q=>{var pe;return Q.name.toLowerCase().includes(D.toLowerCase())||((pe=Q.role)==null?void 0:pe.toLowerCase().includes(D.toLowerCase()))}).map(Q=>{const pe=!!Q.revokedAt,Ne=["DD Lead","DD Head","NBH","DD Admin","Super Admin"].includes((s==null?void 0:s.roleCode)||"")&&!pe&&Q.id!==(s==null?void 0:s.id);return e.jsxs("div",{className:_t("group flex items-start gap-3 p-3 rounded-xl transition-all cursor-default border border-transparent",pe?"opacity-50 bg-slate-100 grayscale-[0.5]":"hover:bg-white hover:shadow-sm hover:border-slate-100"),children:[e.jsxs("div",{className:"relative",children:[e.jsx(Fh,{className:_t("w-10 h-10 ring-2 ring-transparent transition-all",!pe&&"group-hover:ring-blue-100"),children:e.jsx(Bh,{className:`${Q.color} text-white text-xs font-bold`,children:Q.initials})}),Q.isOnline&&!pe&&e.jsx("span",{className:"absolute bottom-0 right-0 w-3 h-3 bg-green-500 border-2 border-slate-50 rounded-full shadow-sm"}),pe&&e.jsx("span",{className:"absolute -top-1 -right-1 bg-red-100 rounded-full p-0.5 border border-white",children:e.jsx(Dx,{className:"w-2.5 h-2.5 text-red-600"})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("p",{className:_t("text-sm font-semibold truncate",pe?"text-slate-500 line-through":"text-slate-900"),children:Q.name}),pe&&e.jsx(Ae,{variant:"outline",className:"text-[8px] h-3.5 px-1 bg-red-50 text-red-600 border-red-100",children:"Revoked"})]}),Q.id===(s==null?void 0:s.id)&&e.jsx(Ae,{variant:"outline",className:"text-[9px] h-4 px-1 border-blue-200 text-blue-600 bg-blue-50",children:"You"})]}),e.jsx("p",{className:"text-[11px] text-slate-500 font-medium uppercase tracking-wider mb-1",children:Q.role}),e.jsx("p",{className:"text-[11px] text-slate-400 truncate italic",children:Q.email})]}),Ne&&e.jsx(se,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-slate-300 hover:text-red-600 hover:bg-red-50 opacity-0 group-hover:opacity-100 transition-all self-center",onClick:()=>Rt(Q),children:e.jsx(Dx,{className:"w-3.5 h-3.5"})}),!Ne&&!pe&&e.jsx(el,{className:"w-4 h-4 text-slate-300 group-hover:text-slate-400 opacity-0 group-hover:opacity-100 transition-all self-center"})]},Q.id)}),ke.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center opacity-50",children:[e.jsx(da,{className:"w-8 h-8 text-slate-300 mb-2"}),e.jsx("p",{className:"text-xs text-slate-500",children:"No participants found"})]})]}),e.jsxs("div",{className:"p-4 bg-white border-t border-slate-200",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),e.jsx("span",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-widest",children:"Active Session"})]}),e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-slate-50 border border-slate-100",children:[e.jsx(Js,{className:"w-4 h-4 text-slate-400"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 font-medium uppercase",children:"Last Activity"}),e.jsx("p",{className:"text-xs text-slate-900 font-semibold",children:"Just now"})]})]})]})]})]}),e.jsx(os,{open:!!We,onOpenChange:Q=>!Q&&Ce(null),children:e.jsxs(ls,{className:"max-w-6xl h-[90vh] flex flex-col p-4",children:[e.jsx(ms,{children:e.jsxs(us,{className:"flex items-center gap-2",children:[We&&fe(We.mimeType),e.jsx("span",{className:"truncate",children:We==null?void 0:We.fileName})]})}),e.jsx("div",{className:"flex-1 overflow-hidden rounded-lg bg-slate-100 flex items-center justify-center p-4",children:We!=null&&We.mimeType.startsWith("image/")?e.jsx("img",{src:`${bc}/${We.filePath.replace(/\\/g,"/")}`,className:"max-w-full max-h-full object-contain",alt:"Preview"}):(We==null?void 0:We.mimeType)==="application/pdf"?e.jsx("iframe",{src:`${bc}/${We.filePath.replace(/\\/g,"/")}`,className:"w-full h-full border-none",title:"PDF Preview"}):e.jsxs("div",{className:"text-center",children:[e.jsx(bm,{className:"w-16 h-16 text-slate-300 mx-auto mb-4"}),e.jsx("p",{className:"text-slate-500",children:"Preview not available for this file type."}),e.jsx("a",{href:`${bc}/${We==null?void 0:We.filePath.replace(/\\/g,"/")}`,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline text-sm",children:"Open in new tab"})]})})]})}),e.jsx(os,{open:!!Y,onOpenChange:Q=>!Q&&V(null),children:e.jsxs(ls,{className:"max-w-md p-0 overflow-hidden border-none shadow-2xl [&>button]:text-white [&>button]:opacity-100",children:[e.jsxs("div",{className:"bg-gradient-to-br from-red-600 to-red-700 p-6 text-white text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-white/20 rounded-full flex items-center justify-center mx-auto mb-4 border border-white/30 backdrop-blur-sm animate-pulse",children:e.jsx(Dx,{className:"w-8 h-8 text-white"})}),e.jsx("h3",{className:"text-xl font-bold mb-2",children:"Revoke Participant Access?"}),e.jsxs("p",{className:"text-red-100 text-sm",children:["You are about to revoke access for ",e.jsx("span",{className:"font-bold text-white",children:Y==null?void 0:Y.name}),". They will no longer be able to view or interact with this request."]})]}),e.jsxs("div",{className:"p-6 bg-white space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs font-bold text-slate-500 uppercase tracking-widest",children:"Reason for Revocation"}),e.jsx(ot,{value:X,onChange:Q=>ne(Q.target.value),placeholder:"e.g. Roles changed, Case transferred...",className:"bg-slate-50 border-slate-200 focus:bg-white transition-all h-11"})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx(se,{variant:"outline",className:"flex-1 h-11 border-slate-200 text-slate-600 hover:bg-slate-50",onClick:()=>V(null),children:"Cancel"}),e.jsxs(se,{className:"flex-1 h-11 bg-red-600 hover:bg-red-700 text-white font-bold shadow-lg shadow-red-200",onClick:Re,disabled:oe,children:[oe?e.jsx(Gi,{className:"w-4 h-4 animate-spin mr-2"}):null,"Revoke Access"]})]})]})]})})]})}const qb="!w-[80vw] !max-w-[80vw] sm:!max-w-[80vw]",Gl=({isOpen:t,onClose:s,document:n})=>{var l;const a=n?`http://localhost:5000${n.filePath.startsWith("/")?"":"/"}${n.filePath}`:"";return e.jsx(os,{open:t,onOpenChange:s,children:e.jsx(ls,{className:`${qb} h-[85vh] flex flex-col p-0 overflow-hidden bg-white shadow-2xl border-none`,children:n?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b bg-slate-50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-amber-100 flex items-center justify-center border border-amber-200",children:e.jsx(nn,{className:"w-5 h-5 text-amber-600"})}),e.jsxs("div",{children:[e.jsx(us,{className:"text-sm font-bold text-slate-900 leading-none mb-1",children:n.fileName}),e.jsx("p",{className:"text-[10px] text-slate-500 font-medium uppercase tracking-wider",children:n.documentType})]})]}),e.jsx("div",{className:"flex items-center gap-2 pr-10",children:e.jsxs(se,{variant:"outline",size:"sm",className:"h-8 gap-2",onClick:()=>window.open(a,"_blank"),children:[e.jsx(Ni,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Download"})]})})]}),e.jsx("div",{className:"flex-1 bg-slate-100 relative overflow-hidden flex items-center justify-center p-4",children:(l=n.fileName)!=null&&l.toLowerCase().endsWith(".pdf")?e.jsx("iframe",{src:`${a}#toolbar=0`,className:"w-full h-full bg-white shadow-inner rounded-sm",title:"Preview"}):e.jsx("img",{src:a,className:"max-h-full max-w-full object-contain shadow-lg rounded-sm",alt:"Preview"})})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-slate-400",children:"Loading document..."})})})};function A7(){var W,U,F,B;const{id:t}=Bc(),s=qn(),[n,r]=v.useState(null),[a,l]=v.useState(null),[c,d]=v.useState(!0),[m,x]=v.useState(!1),[f,h]=v.useState(""),[g,u]=v.useState("details"),[j,p]=v.useState(!1),[y,N]=v.useState(null),[S,A]=v.useState(!1),[w,E]=v.useState(!1),[T,C]=v.useState(""),L=Nn(D=>D.auth.user),$=(L==null?void 0:L.role)==="FDD";v.useEffect(()=>{t&&_()},[t]);const _=async()=>{var D,O,z,G;d(!0);try{const[Y,V]=await Promise.all([Te.getApplicationById(t),Te.getFddAssignment(t)]);(D=Y.data)!=null&&D.success&&r(Y.data.data),(O=V.data)!=null&&O.success&&l(V.data.data)}catch(Y){console.error("Error fetching application:",Y);const V=((G=(z=Y.response)==null?void 0:z.data)==null?void 0:G.message)||"Access Denied: Not authorized for FDD access";ee.error(V),s("/fdd-dashboard")}finally{d(!1)}},R=async D=>{var G,Y,V;const O=(G=D.target.files)==null?void 0:G[0];if(!O||!f){f||ee.error("Please select a document type first");return}x(!0);const z=new FormData;z.append("file",O),z.append("documentType",f),z.append("stage","FDD"),z.append("applicationId",t),z.append("requestType","application");try{const X=await Te.uploadDocument(t,z);if((Y=X.data)!=null&&Y.success){if(f==="FDD Final Audit Report"){const ne=((V=X.data.data)==null?void 0:V.id)||X.data.id;await Te.submitFddReport({assignmentId:a==null?void 0:a.id,applicationId:t,reportDocumentId:ne,findings:"Final Audit Report submitted.",recommendation:"REVIEW_PENDING"})}ee.success(`${f} uploaded successfully`),_(),h("")}}catch{ee.error("Failed to upload document")}finally{x(!1)}},P=D=>{if(!D||!D.filePath){ee.error("Document source file not found");return}N({fileName:D.originalName||D.fileName||"Document",filePath:D.filePath,documentType:D.documentType,createdAt:D.createdAt,mimeType:D.mimeType}),p(!0)};if(c)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-[70vh] bg-slate-50/50 rounded-2xl border border-slate-200 border-dashed",children:[e.jsx(ss,{className:"w-12 h-12 animate-spin text-blue-600 mb-4"}),e.jsx("p",{className:"text-slate-500 font-medium",children:"Authenticating and loading secure data..."})]});if(!n)return null;const M=n.currentStage==="FDD_VERIFICATION"||n.currentStage==="FDD",q=(a==null?void 0:a.status)==="Report Submitted",K=!M&&(n.overallStatus!=="Active"||n.currentProgress>=75)||q,Z=!M&&n.currentProgress<70&&!q;return e.jsxs("div",{className:"flex flex-col gap-6 max-w-7xl mx-auto mb-10",children:[(n==null?void 0:n.statutoryStatus)==="Flagged"&&e.jsxs("div",{className:"bg-red-50 border border-red-200 p-4 rounded-xl flex items-center gap-4 animate-in fade-in slide-in-from-top-4 duration-500","data-testid":"onboarding-fdd-details-flag-banner",children:[e.jsx("div",{className:"bg-red-100 p-2 rounded-lg",children:e.jsx(Ya,{className:"w-5 h-5 text-red-600"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-red-900 leading-none",children:"APPLICATION FLAGGED BY YOU"}),e.jsx("p",{className:"text-red-700 text-[10px] font-bold uppercase tracking-wider mt-1 opacity-80",children:"Marked as non-responsive for follow-up by DD Team"})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("button",{onClick:()=>s("/fdd-dashboard"),className:"flex items-center gap-2 text-slate-600 hover:text-slate-900 font-medium transition-all group","data-testid":"onboarding-fdd-details-back-btn",children:[e.jsx("div",{className:"p-2 rounded-full group-hover:bg-slate-100 transition-colors",children:e.jsx($r,{className:"w-5 h-5"})}),"Back to Dashboard"]}),e.jsx("div",{className:"flex items-center gap-3",children:Z?e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-slate-100 border border-slate-200 text-slate-500 font-bold text-[10px] uppercase tracking-[0.1em] rounded-lg","data-testid":"onboarding-fdd-details-awaiting-badge",children:[e.jsx(Js,{className:"w-4 h-4"}),"Awaiting Previous Stages"]}):K?e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-green-50 border border-green-200 text-green-700 font-bold text-[10px] uppercase tracking-[0.1em] rounded-lg shadow-inner","data-testid":"onboarding-fdd-details-submitted-badge",children:[e.jsx(Fn,{className:"w-4 h-4"}),"Final Audit Report Submitted"]}):e.jsx(e.Fragment,{children:$&&e.jsxs("button",{disabled:m,onClick:()=>E(!0),className:"px-4 py-2 bg-red-50 text-red-600 font-bold text-xs uppercase tracking-wider hover:bg-red-100 rounded-lg transition-all flex items-center gap-2 border border-red-100 shadow-sm","data-testid":"onboarding-fdd-details-flag-btn",children:[e.jsx(Ya,{className:"w-4 h-4"}),"Flag Non-Responsive"]})})})]}),e.jsx(Ie,{className:"border border-slate-200 shadow-sm bg-white","data-testid":"onboarding-fdd-details-header",children:e.jsx(Me,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-14 h-14 bg-slate-900 text-white rounded-lg flex items-center justify-center font-bold text-xl","data-testid":"onboarding-fdd-details-avatar",children:n.applicantName.charAt(0)}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-900 tracking-tight","data-testid":"onboarding-fdd-details-name",children:n.applicantName}),e.jsx(Ae,{variant:"outline",className:"text-slate-500 font-medium px-2 py-0","data-testid":"onboarding-fdd-details-id-badge",children:n.applicationId})]}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-slate-500","data-testid":"onboarding-fdd-details-meta",children:[e.jsxs("span",{children:[n.city,", ",n.state]}),e.jsx("span",{className:"text-slate-300",children:"•"}),e.jsx("span",{children:n.businessType||"Dealership"})]})]})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"text-right hidden md:block",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Status"}),e.jsx("p",{className:"text-sm font-bold text-slate-700",children:"Financial Due Diligence"})]})})]})})}),e.jsxs("div",{className:"flex items-center gap-8 border-b border-slate-200","data-testid":"onboarding-fdd-details-tabs",children:[e.jsxs("button",{onClick:()=>u("details"),className:`pb-3 text-sm font-semibold transition-all relative ${g==="details"?"text-blue-600":"text-slate-500 hover:text-slate-700"}`,"data-testid":"onboarding-fdd-details-tab-workspace",children:["Workspace",g==="details"&&e.jsx("div",{className:"absolute bottom-[-1px] left-0 right-0 h-0.5 bg-blue-600"})]}),e.jsxs("button",{onClick:()=>u("worknotes"),className:`pb-3 text-sm font-semibold transition-all relative ${g==="worknotes"?"text-blue-600":"text-slate-500 hover:text-slate-700"}`,"data-testid":"onboarding-fdd-details-tab-worknotes",children:[e.jsx("div",{className:"flex items-center gap-2",children:"Work Notes"}),g==="worknotes"&&e.jsx("div",{className:"absolute bottom-[-1px] left-0 right-0 h-0.5 bg-blue-600"})]})]}),g==="details"?e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2 space-y-6",children:e.jsxs(Ie,{className:"border border-slate-200 shadow-sm bg-white","data-testid":"onboarding-fdd-details-workspace-card",children:[e.jsx(tt,{className:"border-b border-slate-100 px-6 py-4",children:e.jsxs(nt,{className:"text-base font-bold flex items-center gap-2 text-slate-800",children:[e.jsx(Dr,{className:"w-4 h-4 text-slate-500"}),K?"Finalized Financial Reports":Z?"Audit Workspace":"Financial Report Submission"]})}),e.jsxs(Me,{className:"p-6",children:[Z&&e.jsxs("div",{className:"mb-6 p-8 bg-slate-50 border border-dashed border-slate-200 rounded-xl flex flex-col items-center justify-center text-center","data-testid":"onboarding-fdd-details-not-active",children:[e.jsx("div",{className:"w-16 h-16 bg-white rounded-full flex items-center justify-center text-slate-300 mb-4 shadow-sm",children:e.jsx(Js,{className:"w-8 h-8"})}),e.jsx("h4",{className:"text-lg font-bold text-slate-900 mb-2",children:"Stage Not Yet Active"}),e.jsx("p",{className:"text-sm text-slate-500 max-w-sm mb-6",children:"This application is still being processed in previous documentation or interview stages. The FDD workspace will activate once the previous stages are approved."}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-bold text-slate-400 uppercase tracking-widest px-4 py-1.5 bg-white rounded-full border border-slate-200",children:["Status: ",n.status||"Pending Review"]})]}),K&&e.jsxs("div",{className:"mb-6 p-4 bg-green-50/50 border border-green-100 rounded-xl flex items-center gap-4","data-testid":"onboarding-fdd-details-completed-alert",children:[e.jsx("div",{className:"w-10 h-10 bg-green-100 rounded-full flex items-center justify-center text-green-600 shrink-0",children:e.jsx(Fn,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-green-800",children:"Verification Stage Completed"}),e.jsx("p",{className:"text-[11px] text-green-600 font-medium",children:"The FDD report has been submitted and the case is now locked for further audits."})]})]}),!K&&!Z&&e.jsxs("div",{className:"p-10 border-2 border-dashed border-slate-200 rounded-lg flex flex-col items-center justify-center text-center","data-testid":"onboarding-fdd-details-upload-section",children:[e.jsx("div",{className:"w-12 h-12 bg-slate-50 text-slate-400 rounded-full flex items-center justify-center mb-4",children:e.jsx(fs,{className:"w-6 h-6"})}),e.jsx("p",{className:"text-slate-600 font-medium mb-1","data-testid":"onboarding-fdd-details-upload-title",children:$?"Select and upload the due diligence report":"View Authorized Documents"}),e.jsx("p",{className:"text-slate-400 text-xs mb-6","data-testid":"onboarding-fdd-details-upload-hint",children:$?"PDF or JPG formats accepted (Max 10MB)":"You are in View-Only mode for this Audit"}),$&&e.jsxs("div",{className:"w-full max-w-sm space-y-4",children:[e.jsxs("select",{value:f,onChange:D=>h(D.target.value),className:"w-full px-3 py-2 bg-slate-50 border border-slate-200 rounded text-sm font-medium text-slate-700 outline-none focus:ring-1 focus:ring-blue-500 transition-all","data-testid":"onboarding-fdd-details-doc-type-select",children:[e.jsx("option",{value:"",children:"Select Document Category..."}),e.jsx("option",{value:"FDD Final Audit Report",children:"FDD Final Audit Report"}),e.jsx("option",{value:"Bank Statement",children:"Bank Statement"}),e.jsx("option",{value:"Income Tax Returns (ITR)",children:"Income Tax Returns (ITR)"}),e.jsx("option",{value:"CIBIL Report",children:"CIBIL Report"}),e.jsx("option",{value:"Business Valuation Report",children:"Business Valuation Report"}),e.jsx("option",{value:"Property Documents",children:"Property Documents"})]}),e.jsx("div",{className:"relative",children:m?e.jsxs("div",{className:"w-full py-2.5 bg-slate-100 rounded flex items-center justify-center gap-2","data-testid":"onboarding-fdd-details-uploading-state",children:[e.jsx(ss,{className:"w-4 h-4 animate-spin text-slate-400"}),e.jsx("span",{className:"text-slate-500 text-xs font-bold uppercase tracking-wider",children:"Uploading..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:R,disabled:!f,"data-testid":"onboarding-fdd-details-file-input"}),e.jsx("div",{className:`w-full py-2.5 text-center font-bold uppercase tracking-wider text-xs rounded transition-all ${f?"bg-slate-900 text-white hover:bg-slate-800":"bg-slate-100 text-slate-300"}`,"data-testid":"onboarding-fdd-details-browse-btn",children:"Browse & Upload"})]})})]})]}),e.jsxs("div",{className:"mt-8 border-t border-slate-100 pt-8","data-testid":"onboarding-fdd-details-documents-section",children:[e.jsx("h3",{className:"text-sm font-bold text-slate-800 mb-4 px-1",children:"Submitted Documentation"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{"data-testid":"onboarding-fdd-details-applicant-docs",children:[e.jsxs("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2 flex items-center gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-blue-500"}),"Applicant's KYC & Financials"]}),e.jsxs("div",{className:"space-y-2",children:[(W=n.uploadedDocuments)==null?void 0:W.filter(D=>!D.uploader||D.uploader.roleCode!=="FDD").map((D,O)=>{var z;return e.jsxs("div",{className:"p-3 border border-slate-100 rounded flex items-center justify-between hover:bg-slate-50 transition-all group","data-testid":`onboarding-fdd-details-applicant-doc-row-${O}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-slate-100 flex items-center justify-center text-slate-400 group-hover:bg-white transition-colors",children:e.jsx(fs,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-xs font-bold text-slate-900","data-testid":`onboarding-fdd-details-applicant-doc-name-${O}`,children:D.originalName||D.fileName}),e.jsx("span",{className:"text-[8px] bg-slate-100 text-slate-500 px-1 py-0.5 rounded uppercase font-bold tracking-tighter",children:"APPLICANT"})]}),e.jsxs("p",{className:"text-[10px] text-slate-400 font-medium","data-testid":`onboarding-fdd-details-applicant-doc-meta-${O}`,children:[D.documentType," • ",Ht(D.createdAt),((z=D.uploader)==null?void 0:z.fullName)&&` • by ${D.uploader.fullName}`]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>P(D),className:"p-1.5 hover:bg-white rounded text-slate-400 hover:text-blue-600 transition-all","data-testid":`onboarding-fdd-details-applicant-doc-preview-${O}`,children:e.jsx(nn,{className:"w-4 h-4"})})})]},O)}),((U=n.uploadedDocuments)==null?void 0:U.filter(D=>!D.uploader||D.uploader.roleCode!=="FDD").length)===0&&e.jsx("p",{className:"text-[10px] text-slate-400 italic px-1","data-testid":"onboarding-fdd-details-applicant-docs-empty",children:"No documents from applicant yet."})]})]}),e.jsxs("div",{"data-testid":"onboarding-fdd-details-my-submissions",children:[e.jsxs("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2 flex items-center gap-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-amber-500"}),"My Uploaded Reports"]}),e.jsxs("div",{className:"space-y-2",children:[(F=n.uploadedDocuments)==null?void 0:F.filter(D=>{var O;return((O=D.uploader)==null?void 0:O.roleCode)==="FDD"}).map((D,O)=>{var z;return e.jsxs("div",{className:"p-3 border border-amber-100 bg-amber-50/30 rounded flex items-center justify-between hover:bg-amber-50 transition-all group","data-testid":`onboarding-fdd-details-my-report-row-${O}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-amber-100 flex items-center justify-center text-amber-500",children:e.jsx(fs,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-xs font-bold text-slate-900","data-testid":`onboarding-fdd-details-my-report-name-${O}`,children:D.originalName||D.fileName}),e.jsx("span",{className:"text-[8px] bg-amber-500 text-white px-1 py-0.5 rounded uppercase font-bold tracking-tighter",children:"YOUR AUDIT REPORT"})]}),e.jsxs("p",{className:"text-[10px] text-slate-400 font-medium","data-testid":`onboarding-fdd-details-my-report-meta-${O}`,children:[D.documentType," • ",Ht(D.createdAt),((z=D.uploader)==null?void 0:z.fullName)&&` • by ${D.uploader.fullName}`]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>P(D),className:"p-1.5 hover:bg-white rounded text-slate-400 hover:text-amber-600 transition-all","data-testid":`onboarding-fdd-details-my-report-preview-${O}`,children:e.jsx(nn,{className:"w-4 h-4"})})})]},O)}),((B=n.uploadedDocuments)==null?void 0:B.filter(D=>{var O;return((O=D.uploader)==null?void 0:O.roleCode)==="FDD"}).length)===0&&e.jsx("div",{className:"text-center py-4 bg-slate-50 border border-dashed border-slate-200 rounded-lg","data-testid":"onboarding-fdd-details-my-submissions-empty",children:e.jsx("p",{className:"text-slate-400 text-[10px]",children:"No audit reports uploaded yet."})})]})]})]})]})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(Ie,{className:"border border-slate-200 shadow-sm bg-white","data-testid":"onboarding-fdd-details-profile-card",children:[e.jsx(tt,{className:"border-b border-slate-100 px-6 pt-4 pb-2.5",children:e.jsx(nt,{className:"text-xs font-bold uppercase tracking-wider text-slate-500",children:"Applicant Profile"})}),e.jsxs(Me,{className:"p-5 space-y-4",children:[e.jsxs("div",{className:"space-y-1 pb-3 border-b border-slate-50","data-testid":"onboarding-fdd-details-target-loc",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Target Location"}),e.jsxs("p",{className:"text-sm font-extrabold text-slate-900",children:[n.city,", ",n.state]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-xs","data-testid":"onboarding-fdd-details-profile-meta",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Education"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.education||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Experience"}),e.jsxs("p",{className:"font-bold text-slate-800",children:[n.experienceYears||"0"," Years"]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Investment Cap"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.investmentCapacity||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Age"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.age||"N/A"})]})]}),e.jsxs("div",{className:"space-y-1 pt-3 border-t border-slate-50 text-xs","data-testid":"onboarding-fdd-details-communication",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Communication"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.email}),e.jsx("p",{className:"text-slate-500 font-medium",children:n.phone})]})]})]}),e.jsxs(Ie,{className:"border border-slate-200 shadow-sm bg-white","data-testid":"onboarding-fdd-details-statutory-card",children:[e.jsx(tt,{className:"border-b border-slate-100 px-6 pt-4 pb-2.5",children:e.jsx(nt,{className:"text-xs font-bold uppercase tracking-wider text-slate-500",children:"Statutory Details"})}),e.jsx(Me,{className:"p-5 space-y-3",children:e.jsxs("div",{className:"grid grid-cols-1 gap-2.5 text-xs",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Constitution Type"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.constitutionType||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"PAN Number"}),e.jsx("p",{className:"font-bold text-slate-800 uppercase tracking-tight",children:n.panNumber||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"GST Number"}),e.jsx("p",{className:"font-bold text-slate-800 uppercase tracking-tight",children:n.gstNumber||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Registered Address"}),e.jsx("p",{className:"font-medium text-slate-700 leading-relaxed text-[11px]",children:n.registeredAddress||"N/A"})]})]})})]}),e.jsxs(Ie,{className:"border border-slate-200 shadow-sm bg-white","data-testid":"onboarding-fdd-details-bank-card",children:[e.jsx(tt,{className:"border-b border-slate-100 px-6 pt-4 pb-2.5",children:e.jsx(nt,{className:"text-xs font-bold uppercase tracking-wider text-slate-500",children:"Bank Details"})}),e.jsx(Me,{className:"p-5 space-y-3",children:e.jsxs("div",{className:"grid grid-cols-1 gap-2.5 text-xs",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Account Holder"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.accountHolderName||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Bank Name"}),e.jsx("p",{className:"font-bold text-slate-800",children:n.bankName||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"Account Number"}),e.jsx("p",{className:"font-bold text-slate-800 tabular-nums",children:n.accountNumber||"N/A"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider",children:"IFSC Code & Branch"}),e.jsxs("p",{className:"font-bold text-slate-800 uppercase tracking-tight",children:[n.ifscCode||"N/A",n.branchName&&e.jsxs("span",{className:"text-slate-400 font-medium ml-2",children:["— ",n.branchName]})]})]})]})})]}),e.jsxs("div",{className:"p-6 bg-slate-900 rounded-lg text-white font-medium","data-testid":"onboarding-fdd-details-instructions",children:[e.jsx("h4",{className:"text-sm font-bold mb-2",children:"Instructions"}),e.jsxs("ul",{className:"text-xs text-slate-300 space-y-2 list-disc pl-4",children:[e.jsx("li",{children:"Bank statements must cover 12 months."}),e.jsx("li",{children:"GST discrepancies must be noted."}),e.jsx("li",{children:"Verify property papers with originals."})]})]})]})]}):e.jsx("div",{className:"bg-white rounded-lg border border-slate-200 min-h-[600px] overflow-hidden",children:e.jsx(lE,{onBack:()=>u("details"),requestId:t,requestType:"application"})}),e.jsx(Gl,{isOpen:j,onClose:()=>p(!1),document:y}),e.jsx(os,{open:S,onOpenChange:A,children:e.jsxs(ls,{className:"max-w-md p-0 overflow-hidden border-none shadow-2xl","data-testid":"onboarding-fdd-details-finalize-modal",children:[e.jsxs("div",{className:"bg-slate-950 p-6 flex items-center justify-center relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-600/20 to-transparent"}),e.jsx("div",{className:"w-16 h-16 bg-amber-600/20 rounded-full flex items-center justify-center animate-pulse relative z-10",children:e.jsx(Fl,{className:"w-8 h-8 text-amber-500"})})]}),e.jsxs("div",{className:"p-8 space-y-4",children:[e.jsxs(ms,{children:[e.jsx(us,{className:"text-2xl font-bold text-slate-900 text-center","data-testid":"onboarding-fdd-details-finalize-title",children:"Submit Audit Report"}),e.jsxs(vs,{className:"text-slate-500 text-center pt-2 leading-relaxed text-base","data-testid":"onboarding-fdd-details-finalize-desc",children:["You are about to submit your final findings. This action will ",e.jsx("span",{className:"font-bold text-slate-800 underline decoration-amber-500 decoration-2",children:"notify the Admin"})," for review and approval."]})]}),e.jsxs("div",{className:"bg-amber-50 p-4 rounded-xl flex gap-3 border border-amber-100 italic","data-testid":"onboarding-fdd-details-finalize-info",children:[e.jsx(Xa,{className:"w-5 h-5 text-amber-600 shrink-0 mt-0.5"}),e.jsx("p",{className:"text-xs text-amber-800 leading-normal",children:"Once submitted, you cannot edit the findings. Ensure all documents are uploaded."})]}),e.jsx("div",{className:"space-y-4 pt-2",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:"Detailed Audit Findings & Remarks"}),e.jsx(Fs,{placeholder:"Enter detailed financial observations...",className:"min-h-[120px] bg-slate-50 border-slate-200 rounded-xl focus:ring-amber-500 text-sm resize-none",value:T,onChange:D=>C(D.target.value),"data-testid":"onboarding-fdd-details-finalize-remarks"})]})}),e.jsxs(rn,{className:"flex flex-col sm:flex-row gap-3 pt-4 sm:pt-6",children:[e.jsx(se,{variant:"outline",className:"w-full sm:flex-1 h-12 rounded-xl font-bold text-slate-600 hover:bg-slate-50 border-slate-200",onClick:()=>A(!1),disabled:m,"data-testid":"onboarding-fdd-details-finalize-cancel",children:"Cancel"}),e.jsx(se,{className:"w-full sm:flex-1 h-12 rounded-xl font-bold bg-slate-950 hover:bg-slate-900 text-white shadow-lg shadow-slate-200 transition-all active:scale-95 border-b-2 border-amber-600","data-testid":"onboarding-fdd-details-finalize-confirm",onClick:async()=>{var D,O;try{if(!T.trim()){ee.error("Please provide findings.");return}x(!0);const z=(D=a==null?void 0:a.reports)==null?void 0:D[0];(O=(await Te.submitFddReport({assignmentId:a==null?void 0:a.id,applicationId:t,reportDocumentId:z==null?void 0:z.reportDocumentId,findings:T,recommendation:null})).data)!=null&&O.success&&(ee.success("FDD Report submitted successfully."),A(!1),_())}catch{ee.error("Failed to submit report")}finally{x(!1)}},disabled:m,children:m?e.jsx(ss,{className:"w-5 h-5 animate-spin"}):"Confirm & Submit"})]})]})]})}),e.jsx(os,{open:w,onOpenChange:E,children:e.jsxs(ls,{className:"max-w-md p-0 overflow-hidden border-none shadow-2xl","data-testid":"onboarding-fdd-details-flag-modal",children:[e.jsxs("div",{className:"bg-slate-950 p-6 flex items-center justify-center relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-600/20 to-transparent"}),e.jsx("div",{className:"w-16 h-16 bg-red-600/20 rounded-full flex items-center justify-center relative z-10",children:e.jsx(Ya,{className:"w-8 h-8 text-red-500"})})]}),e.jsxs("div",{className:"p-8 space-y-4",children:[e.jsxs(ms,{children:[e.jsx(us,{className:"text-2xl font-bold text-slate-900 text-center","data-testid":"onboarding-fdd-details-flag-modal-title",children:"Flag Applicant"}),e.jsxs(vs,{className:"text-slate-500 text-center pt-2 leading-relaxed text-base","data-testid":"onboarding-fdd-details-flag-modal-desc",children:["Are you sure you want to flag this applicant as ",e.jsx("span",{className:"font-bold text-red-600",children:"Non-Responsive"}),"?"]})]}),e.jsx("div",{className:"bg-red-50 p-4 rounded-xl flex gap-3 border border-red-100 italic",children:e.jsx("p",{className:"text-xs text-red-800 leading-normal text-center w-full","data-testid":"onboarding-fdd-details-flag-modal-text",children:'"Applicant is non-responsive to FDD queries."'})}),e.jsxs(rn,{className:"flex flex-col sm:flex-row gap-3 pt-4 sm:pt-6",children:[e.jsx(se,{variant:"outline",className:"w-full sm:flex-1 h-12 rounded-xl font-bold text-slate-600 hover:bg-slate-50 border-slate-200",onClick:()=>E(!1),disabled:m,"data-testid":"onboarding-fdd-details-flag-modal-cancel",children:"Go Back"}),e.jsx(se,{className:"w-full sm:flex-1 h-12 rounded-xl font-bold bg-slate-950 hover:bg-slate-900 text-white shadow-lg shadow-slate-200 transition-all active:scale-95 border-b-2 border-red-600","data-testid":"onboarding-fdd-details-flag-modal-confirm",onClick:async()=>{try{x(!0),await Te.flagNonResponsive({applicationId:t,remarks:"Applicant is non-responsive to FDD queries."}),ee.error("Application flagged for non-responsiveness."),E(!1),_()}catch{ee.error("Action failed")}finally{x(!1)}},disabled:m,children:m?e.jsx(ss,{className:"w-5 h-5 animate-spin"}):"Flag Applicant"})]})]})]})})]})}function k7(t,s=[]){let n=[];function r(l,c){const d=v.createContext(c);d.displayName=l+"Context";const m=n.length;n=[...n,c];const x=h=>{var N;const{scope:g,children:u,...j}=h,p=((N=g==null?void 0:g[t])==null?void 0:N[m])||d,y=v.useMemo(()=>j,Object.values(j));return e.jsx(p.Provider,{value:y,children:u})};x.displayName=l+"Provider";function f(h,g){var p;const u=((p=g==null?void 0:g[t])==null?void 0:p[m])||d,j=v.useContext(u);if(j)return j;if(c!==void 0)return c;throw new Error(`\`${h}\` must be used within \`${l}\``)}return[x,f]}const a=()=>{const l=n.map(c=>v.createContext(c));return function(d){const m=(d==null?void 0:d[t])||l;return v.useMemo(()=>({[`__scope${t}`]:{...d,[t]:m}}),[d,m])}};return a.scopeName=t,[r,R7(a,...s)]}function R7(...t){const s=t[0];if(t.length===1)return s;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const c=r.reduce((d,{useScope:m,scopeName:x})=>{const h=m(l)[`__scope${x}`];return{...d,...h}},{});return v.useMemo(()=>({[`__scope${s.scopeName}`]:c}),[c])}};return n.scopeName=s.scopeName,n}var E7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oE=E7.reduce((t,s)=>{const n=hu(`Primitive.${s}`),r=v.forwardRef((a,l)=>{const{asChild:c,...d}=a,m=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(m,{...d,ref:l})});return r.displayName=`Primitive.${s}`,{...t,[s]:r}},{}),zb="Progress",Ub=100,[D7]=k7(zb),[T7,_7]=D7(zb),cE=v.forwardRef((t,s)=>{const{__scopeProgress:n,value:r=null,max:a,getValueLabel:l=P7,...c}=t;(a||a===0)&&!o1(a)&&console.error(O7(`${a}`,"Progress"));const d=o1(a)?a:Ub;r!==null&&!c1(r,d)&&console.error(L7(`${r}`,"Progress"));const m=c1(r,d)?r:null,x=Pm(m)?l(m,d):void 0;return e.jsx(T7,{scope:n,value:m,max:d,children:e.jsx(oE.div,{"aria-valuemax":d,"aria-valuemin":0,"aria-valuenow":Pm(m)?m:void 0,"aria-valuetext":x,role:"progressbar","data-state":hE(m,d),"data-value":m??void 0,"data-max":d,...c,ref:s})})});cE.displayName=zb;var dE="ProgressIndicator",uE=v.forwardRef((t,s)=>{const{__scopeProgress:n,...r}=t,a=_7(dE,n);return e.jsx(oE.div,{"data-state":hE(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...r,ref:s})});uE.displayName=dE;function P7(t,s){return`${Math.round(t/s*100)}%`}function hE(t,s){return t==null?"indeterminate":t===s?"complete":"loading"}function Pm(t){return typeof t=="number"}function o1(t){return Pm(t)&&!isNaN(t)&&t>0}function c1(t,s){return Pm(t)&&!isNaN(t)&&t<=s&&t>=0}function O7(t,s){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${s}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ub}\`.`}function L7(t,s){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${s}\`. The \`value\` prop must be: - a positive number - - less than the value passed to \`max\` (or ${$b} if no \`max\` prop is set) + - less than the value passed to \`max\` (or ${Ub} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. -Defaulting to \`null\`.`}var T7=aE,P7=lE;function ji({className:t,value:s,...n}){return e.jsx(T7,{"data-slot":"progress",className:Pt("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",t),...n,children:e.jsx(P7,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(s||0)}%)`}})})}function Yl({className:t,...s}){return e.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:Pt("mx-auto flex w-full justify-center",t),...s})}function Zl({className:t,...s}){return e.jsx("ul",{"data-slot":"pagination-content",className:Pt("flex flex-row items-center gap-1",t),...s})}function an({...t}){return e.jsx("li",{"data-slot":"pagination-item",...t})}function Ci({className:t,isActive:s,size:n="icon",...r}){return e.jsx("a",{"aria-current":s?"page":void 0,"data-slot":"pagination-link","data-active":s,className:Pt(Km({variant:s?"outline":"ghost",size:n}),t),...r})}function Ql({className:t,...s}){return e.jsxs(Ci,{"aria-label":"Go to previous page",size:"default",className:Pt("gap-1 px-2.5 sm:pl-2.5",t),...s,children:[e.jsx(qc,{}),e.jsx("span",{className:"hidden sm:block",children:"Previous"})]})}function Xl({className:t,...s}){return e.jsxs(Ci,{"aria-label":"Go to next page",size:"default",className:Pt("gap-1 px-2.5 sm:pr-2.5",t),...s,children:[e.jsx("span",{className:"hidden sm:block",children:"Next"}),e.jsx(el,{})]})}function Jl({className:t,...s}){return e.jsxs("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:Pt("flex size-9 items-center justify-center",t),...s,children:[e.jsx(lI,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"More pages"})]})}function _7({onViewDetails:t,initialFilter:s}){const{user:n}=Nn(W=>W.auth),[r,a]=v.useState(""),[l,c]=v.useState("all"),[d,h]=v.useState(s||"all"),[x,f]=v.useState([]),[m,p]=v.useState("date"),[u,j]=v.useState(!1),[g,y]=v.useState(!1),[N,S]=v.useState([]),[C,w]=v.useState([]),[R,P]=v.useState(1),[A,I]=v.useState(null),$=10;v.useEffect(()=>{T()},[R,l,d,r]);const T=async()=>{try{const W=await ds.getApplications({page:R,limit:$,status:d!=="all"?d:void 0,location:l!=="all"?l:void 0,search:r||void 0,ddLeadShortlisted:"true",isShortlisted:"true",assignedTo:g?n==null?void 0:n.id:void 0}),z=W.data||[];I(W.meta);const F=z.map(B=>({id:B.id,registrationNumber:B.applicationId||"N/A",name:B.applicantName,email:B.email,phone:B.phone,age:B.age,education:B.education,residentialAddress:B.address||B.city||"",businessAddress:B.address||"",preferredLocation:B.preferredLocation,state:B.state,ownsBike:B.ownRoyalEnfield==="yes",pastExperience:B.experienceYears?`${B.experienceYears} years`:B.description||"",status:B.overallStatus,questionnaireMarks:0,rank:0,totalApplicantsAtLocation:0,submissionDate:B.createdAt,assignedUsers:[],assignedTo:B.assignedTo,progress:B.progressPercentage||0,isShortlisted:B.ddLeadShortlisted||B.isShortlisted||!1,companyName:B.companyName,source:B.source,existingDealer:B.existingDealer,royalEnfieldModel:B.royalEnfieldModel,description:B.description,pincode:B.pincode,locationType:B.locationType,ownRoyalEnfield:B.ownRoyalEnfield,address:B.address}));if(S(F),C.length===0){const B=Array.from(new Set(F.map(D=>D.preferredLocation))).filter(Boolean);w(B)}}catch(W){console.error("Failed to fetch applications",W)}finally{}},E=N.sort((W,z)=>m==="date"?new Date(z.submissionDate).getTime()-new Date(W.submissionDate).getTime():0),_=W=>{f(z=>z.includes(W)?z.filter(F=>F!==W):[...z,W])},M=()=>{x.length===E.length?f([]):f(E.map(W=>W.id))},q=()=>{alert(`Sending reminders to ${x.length} applicants`),f([])},G=()=>{alert("Exporting applications to CSV...")},Z=W=>({Submitted:"bg-slate-500","Questionnaire Pending":"bg-orange-500","Questionnaire Completed":"bg-blue-500",Shortlisted:"bg-cyan-500","Level 1 Pending":"bg-amber-500","Level 1 Approved":"bg-green-500","Level 2 Pending":"bg-purple-500","Level 2 Approved":"bg-green-600","Level 2 Recommended":"bg-teal-500","Level 3 Pending":"bg-indigo-500","FDD Verification":"bg-violet-500","Payment Pending":"bg-yellow-500","LOI Issued":"bg-lime-500","Dealer Code Generation":"bg-fuchsia-500","Architecture Team Assigned":"bg-blue-500","Architecture Document Upload":"bg-blue-500","Architecture Team Completion":"bg-blue-500","Statutory GST":"bg-emerald-500","Statutory PAN":"bg-emerald-500","Statutory Nodal":"bg-emerald-500","Statutory Check":"bg-emerald-500","Statutory Partnership":"bg-emerald-500","Statutory Firm Reg":"bg-emerald-500","Statutory Virtual Code":"bg-emerald-500","Statutory Domain":"bg-emerald-500","Statutory MSD":"bg-emerald-500","Statutory LOI Ack":"bg-emerald-500","EOR In Progress":"bg-sky-500","LOA Pending":"bg-emerald-500",Approved:"bg-green-700",Rejected:"bg-red-500",Disqualified:"bg-red-700"})[W]||"bg-slate-500";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ot,{type:"text",placeholder:"Search by name, ID, or email...",value:r,onChange:W=>a(W.target.value),className:"pl-10","data-testid":"onboarding-applications-search-input"})]}),e.jsxs(wt,{value:l,onValueChange:c,children:[e.jsx(Ct,{className:"w-full lg:w-48","data-testid":"onboarding-applications-location-filter",children:e.jsx(St,{placeholder:"All Locations"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All Locations"}),C.map(W=>e.jsx(Pe,{value:W,children:W},W))]})]}),e.jsxs(wt,{value:d,onValueChange:h,children:[e.jsx(Ct,{className:"w-full lg:w-48","data-testid":"onboarding-applications-status-filter",children:e.jsx(St,{placeholder:"All Statuses"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All Statuses"}),e.jsx(Pe,{value:"Questionnaire Pending",children:"Questionnaire Pending"}),e.jsx(Pe,{value:"Shortlisted",children:"Shortlisted"}),e.jsx(Pe,{value:"Level 1 Pending",children:"Level 1 Pending"}),e.jsx(Pe,{value:"Level 2 Pending",children:"Level 2 Pending"}),e.jsx(Pe,{value:"Level 3 Pending",children:"Level 3 Pending"}),e.jsx(Pe,{value:"EOR In Progress",children:"EOR In Progress"}),e.jsx(Pe,{value:"Approved",children:"Approved"}),e.jsx(Pe,{value:"Rejected",children:"Rejected"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Rn,{id:"my-assignments",checked:g,onCheckedChange:W=>y(W),"data-testid":"onboarding-applications-assignments-checkbox"}),e.jsx(ce,{htmlFor:"my-assignments","data-testid":"onboarding-applications-assignments-label",children:"My Assignments Only"})]}),e.jsxs(wt,{value:m,onValueChange:W=>p(W),children:[e.jsx(Ct,{className:"w-full lg:w-40","data-testid":"onboarding-applications-sort-select",children:e.jsx(St,{placeholder:"Sort By"})}),e.jsx(At,{children:e.jsx(Pe,{value:"date",children:"Date"})})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-4",children:[e.jsxs(se,{variant:"outline",size:"sm",onClick:G,"data-testid":"onboarding-applications-export-button",children:[e.jsx(Ni,{className:"w-4 h-4 mr-2"}),"Export"]}),x.length>0&&e.jsxs(se,{variant:"outline",size:"sm",onClick:q,"data-testid":"onboarding-applications-reminders-button",children:[e.jsx(qr,{className:"w-4 h-4 mr-2"}),"Send Reminders (",x.length,")"]}),e.jsxs("div",{className:"ml-auto text-slate-600","data-testid":"onboarding-applications-count-text",children:[A?A.total:E.length," application",(A==null?void 0:A.total)!==1?"s":""]})]})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200",children:[e.jsxs(ks,{"data-testid":"onboarding-applications-table",children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{className:"w-12",children:e.jsx(Rn,{checked:x.length===E.length&&E.length>0,onCheckedChange:M,"data-testid":"onboarding-applications-header-checkbox"})}),e.jsx(me,{children:"ID"}),e.jsx(me,{children:"Name"}),e.jsx(me,{children:"Preferred Location"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Applicant Location"}),e.jsx(me,{children:"Progress"}),e.jsx(me,{children:"Applied On"}),e.jsx(me,{children:"Actions"})]})}),e.jsx(Es,{children:E.map((W,z)=>e.jsxs(ct,{"data-testid":`onboarding-application-row-${z}`,children:[e.jsx(de,{children:e.jsx(Rn,{checked:x.includes(W.id),onCheckedChange:()=>_(W.id),"data-testid":`onboarding-application-checkbox-${z}`})}),e.jsx(de,{"data-testid":`onboarding-application-id-${z}`,children:W.registrationNumber}),e.jsx(de,{"data-testid":`onboarding-application-name-${z}`,children:W.name}),e.jsx(de,{"data-testid":`onboarding-application-pref-location-${z}`,children:W.preferredLocation}),e.jsx(de,{children:e.jsx(Ae,{className:Z(W.status),"data-testid":`onboarding-application-status-${z}`,children:W.status})}),e.jsx(de,{className:"text-slate-600 max-w-xs truncate","data-testid":`onboarding-application-addr-${z}`,children:W.residentialAddress}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ji,{value:W.progress,className:"h-2 w-20","data-testid":`onboarding-application-progress-bar-${z}`}),e.jsxs("span",{className:"text-slate-600","data-testid":`onboarding-application-progress-text-${z}`,children:[W.progress,"%"]})]})}),e.jsx(de,{"data-testid":`onboarding-application-date-${z}`,children:Ht(W.submissionDate)}),e.jsx(de,{children:e.jsx(se,{size:"sm",variant:"outline",onClick:()=>t(W.id),"data-testid":`onboarding-application-view-btn-${z}`,children:"View"})})]},W.id))})]}),A&&A.totalPages>1&&e.jsx("div",{className:"py-4 border-t px-4 flex justify-center",children:e.jsx(Yl,{children:e.jsxs(Zl,{children:[e.jsx(an,{children:e.jsx(Ql,{onClick:()=>P(W=>Math.max(1,W-1)),className:R===1?"pointer-events-none opacity-50":"cursor-pointer"})}),[...Array(A.totalPages)].map((W,z)=>{const F=z+1;return F===1||F===A.totalPages||F>=R-1&&F<=R+1?e.jsx(an,{children:e.jsx(Ci,{isActive:R===F,onClick:()=>P(F),className:"cursor-pointer",children:F})},F):F===2&&R>3||F===A.totalPages-1&&RP(W=>Math.min(A.totalPages,W+1)),className:R===A.totalPages?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]}),e.jsx(os,{open:u,onOpenChange:j,children:e.jsxs(ls,{className:"max-w-2xl","data-testid":"onboarding-new-app-modal",children:[e.jsx(ms,{children:e.jsx(us,{children:"Add New Application (Admin)"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-slate-600",children:"This form allows administrators to manually add applications to the system."}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Name"}),e.jsx(ot,{placeholder:"Full Name","data-testid":"onboarding-new-app-name"})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Email"}),e.jsx(ot,{type:"email",placeholder:"email@example.com","data-testid":"onboarding-new-app-email"})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Phone"}),e.jsx(ot,{placeholder:"+91 XXXXX XXXXX","data-testid":"onboarding-new-app-phone"})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Preferred Location"}),e.jsxs(wt,{children:[e.jsx(Ct,{"data-testid":"onboarding-new-app-location-select",children:e.jsx(St,{placeholder:"Select location"})}),e.jsx(At,{children:C.map(W=>e.jsx(Pe,{value:W,children:W},W))})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(se,{variant:"outline",onClick:()=>j(!1),"data-testid":"onboarding-new-app-cancel",children:"Cancel"}),e.jsx(se,{className:"bg-amber-600 hover:bg-amber-700","data-testid":"onboarding-new-app-submit",children:"Create Application"})]})]})]})})]})}function cE({application:t,onViewDetails:s}){var r;const n=a=>({Submitted:"bg-slate-500","Questionnaire Pending":"bg-orange-500","Questionnaire Completed":"bg-blue-500",Shortlisted:"bg-cyan-500","Level 1 Pending":"bg-amber-500","Level 1 Approved":"bg-green-500","Level 2 Pending":"bg-purple-500","Level 2 Approved":"bg-green-600","Level 2 Recommended":"bg-teal-500","Level 3 Pending":"bg-indigo-500","FDD Verification":"bg-violet-500","Payment Pending":"bg-yellow-500","LOI Issued":"bg-lime-500","Dealer Code Generation":"bg-fuchsia-500","Architecture Team Assigned":"bg-blue-500","Architecture Document Upload":"bg-blue-500","Architecture Team Completion":"bg-blue-500","Statutory GST":"bg-emerald-500","Statutory PAN":"bg-emerald-500","Statutory Nodal":"bg-emerald-500","Statutory Check":"bg-emerald-500","Statutory Partnership":"bg-emerald-500","Statutory Firm Reg":"bg-emerald-500","Statutory Virtual Code":"bg-emerald-500","Statutory Domain":"bg-emerald-500","Statutory MSD":"bg-emerald-500","Statutory LOI Ack":"bg-emerald-500","EOR In Progress":"bg-sky-500","LOA Pending":"bg-emerald-500",Approved:"bg-green-700",Rejected:"bg-red-500",Disqualified:"bg-red-700"})[a]||"bg-slate-500";return e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-6 hover:shadow-lg transition-shadow","data-testid":`onboarding-application-card-${t.id}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"text-slate-900","data-testid":"onboarding-application-card-name",children:t.name}),(r=t.tags)==null?void 0:r.map(a=>e.jsx(Ae,{variant:"outline",className:a==="Approved"?"border-green-500 text-green-700":"border-teal-500 text-teal-700","data-testid":`onboarding-application-card-tag-${a}`,children:a},a))]}),e.jsx("p",{className:"text-slate-600","data-testid":"onboarding-application-card-registration",children:t.registrationNumber})]}),e.jsx(Ae,{className:n(t.status),"data-testid":"onboarding-application-card-status",children:t.status})]}),e.jsxs("div",{className:"space-y-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[e.jsx(Er,{className:"w-4 h-4"}),e.jsx("span",{"data-testid":"onboarding-application-card-location",children:t.preferredLocation}),t.rank&&t.totalApplicantsAtLocation&&e.jsxs(Ae,{variant:"outline","data-testid":"onboarding-application-card-rank",children:["Rank ",t.rank,"/",t.totalApplicantsAtLocation]})]}),e.jsxs("div",{className:"flex items-start gap-2 text-slate-600",children:[e.jsx(Dc,{className:"w-4 h-4 mt-0.5"}),e.jsx("span",{className:"text-sm","data-testid":"onboarding-application-card-address",children:t.businessAddress})]}),e.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[e.jsx(qr,{className:"w-4 h-4"}),e.jsx("span",{"data-testid":"onboarding-application-card-email",children:t.email})]}),e.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[e.jsx(Zv,{className:"w-4 h-4"}),e.jsx("span",{"data-testid":"onboarding-application-card-phone",children:t.phone})]}),t.questionnaireMarks!==void 0&&e.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[e.jsx(_2,{className:"w-4 h-4"}),e.jsxs("span",{"data-testid":"onboarding-application-card-score",children:["Score: ",t.questionnaireMarks,"/100"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[e.jsx($n,{className:"w-4 h-4"}),e.jsxs("span",{"data-testid":"onboarding-application-card-submission-date",children:["Submitted: ",Ht(t.submissionDate)]})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-slate-600",children:"Progress"}),e.jsxs("span",{className:"text-slate-900","data-testid":"onboarding-application-card-progress-text",children:[t.progress,"%"]})]}),e.jsx(ji,{value:t.progress,className:"h-2","data-testid":"onboarding-application-card-progress-bar"})]}),t.deadline&&t.status==="Questionnaire Pending"&&e.jsx("div",{className:"mb-4 p-3 bg-orange-50 border border-orange-200 rounded-md","data-testid":"onboarding-application-card-deadline-warning",children:e.jsxs("p",{className:"text-orange-800",children:["Deadline: ",Ht(t.deadline)]})}),e.jsx(se,{onClick:()=>s(t.id),className:"w-full bg-amber-600 hover:bg-amber-700","data-testid":"onboarding-application-card-view-button",children:"View Details"})]})}function O7({onViewDetails:t,initialFilter:s="all"}){const[n,r]=v.useState("grid"),[a,l]=v.useState(""),[c,d]=v.useState(s),[h,x]=v.useState("all"),[f,m]=v.useState("all"),[p,u]=v.useState([]),[j,g]=v.useState(!1),[y,N]=v.useState(""),[S,C]=v.useState([]),[w,R]=v.useState(!0),[P,A]=v.useState([]),[I,$]=v.useState([]),[T,E]=v.useState(1),[_,M]=v.useState(null);v.useEffect(()=>{G()},[T,a,c,h,f]),v.useEffect(()=>{E(1)},[a,c,h,f]),v.useEffect(()=>{q()},[]);const q=async()=>{try{const K=await Ss.getStates(),U=(Array.isArray(K)?K:(K==null?void 0:K.data)||(K==null?void 0:K.states)||[]).map(X=>typeof X=="string"?X:X.name||X.stateName).filter(Boolean);A(U)}catch(K){console.error("Failed to fetch states:",K)}},G=async()=>{try{R(!0);const K=await ds.getApplications({page:T,limit:10,search:a,status:c==="all"?void 0:c,location:h!=="all"?h:void 0,state:f!=="all"?f:void 0,isShortlisted:void 0}),Y=K.data||[];M(K.meta);const U=Y.map(ne=>({id:ne.id,registrationNumber:ne.applicationId||"N/A",name:ne.applicantName,email:ne.email,phone:ne.phone,age:ne.age,education:ne.education,residentialAddress:ne.address||ne.city||"",businessAddress:ne.address||"",preferredLocation:ne.preferredLocation,state:ne.state,ownsBike:ne.ownRoyalEnfield==="yes",pastExperience:ne.experienceYears?`${ne.experienceYears} years`:ne.description||"",status:ne.overallStatus,questionnaireMarks:ne.score||ne.questionnaireMarks||0,rank:0,totalApplicantsAtLocation:0,submissionDate:ne.createdAt,assignedUsers:[],progress:ne.progressPercentage||0,isShortlisted:ne.isShortlisted||ne.ddLeadShortlisted,companyName:ne.companyName,source:ne.source,existingDealer:ne.existingDealer,royalEnfieldModel:ne.royalEnfieldModel,description:ne.description,pincode:ne.pincode,locationType:ne.locationType,ownRoyalEnfield:ne.ownRoyalEnfield,address:ne.address}));C(U);const X=Array.from(new Set(U.map(ne=>ne.preferredLocation))).filter(Boolean);$(X)}catch(K){console.error("Failed to fetch applications:",K),ee.error("Failed to load applications")}finally{R(!1)}},Z=S,W=K=>{u(K?Z.map(Y=>Y.id):[])},z=(K,Y)=>{u(Y?[...p,K]:p.filter(U=>U!==K))},F=()=>{if(p.length===0){ee.error("Please select at least one application to shortlist");return}g(!0)},B=async()=>{try{ee.success(`${p.length} application(s) shortlisted successfully!`),g(!1),G()}catch{ee.error("Failed to shortlist")}},D=()=>{ee.success(`Reminder emails sent to ${p.length} applicant(s)`)},O=["Submitted","Questionnaire Pending","Questionnaire Completed"],V=K=>({Submitted:"bg-blue-100 text-blue-800","Questionnaire Pending":"bg-yellow-100 text-yellow-800","Questionnaire Completed":"bg-cyan-100 text-cyan-800",Shortlisted:"bg-purple-100 text-purple-800","Level 1 Interview Pending":"bg-orange-100 text-orange-800","Level 1 Approved":"bg-green-100 text-green-800","Level 2 Interview Pending":"bg-orange-100 text-orange-800","Level 2 Approved":"bg-green-100 text-green-800","Level 2 Recommended":"bg-teal-100 text-teal-800","Level 3 Interview Pending":"bg-orange-100 text-orange-800","In Review":"bg-slate-100 text-slate-800","Level 3 Approved":"bg-green-100 text-green-800","FDD Verification":"bg-indigo-100 text-indigo-800","Payment Pending":"bg-amber-100 text-amber-800","LOI In Progress":"bg-sky-100 text-sky-800","LOI Issued":"bg-sky-100 text-sky-800","Dealer Code Generation":"bg-purple-100 text-purple-800","Architecture Team Assigned":"bg-blue-100 text-blue-800","Architecture Document Upload":"bg-blue-100 text-blue-800","Architecture Team Completion":"bg-blue-100 text-blue-800","Statutory GST":"bg-emerald-100 text-emerald-800","Statutory PAN":"bg-emerald-100 text-emerald-800","Statutory Nodal":"bg-emerald-100 text-emerald-800","Statutory Check":"bg-emerald-100 text-emerald-800","Statutory Partnership":"bg-emerald-100 text-emerald-800","Statutory Firm Reg":"bg-emerald-100 text-emerald-800","Statutory Rental":"bg-emerald-100 text-emerald-800","Statutory Virtual Code":"bg-emerald-100 text-emerald-800","Statutory Domain":"bg-emerald-100 text-emerald-800","Statutory MSD":"bg-emerald-100 text-emerald-800","Statutory LOI Ack":"bg-emerald-100 text-emerald-800","EOR In Progress":"bg-violet-100 text-violet-800","EOR Complete":"bg-violet-100 text-violet-800","LOA Pending":"bg-pink-100 text-pink-800",Inauguration:"bg-amber-100 text-amber-800",Approved:"bg-green-100 text-green-800",Rejected:"bg-red-100 text-red-800",Disqualified:"bg-gray-100 text-gray-800",Onboarded:"bg-emerald-100 text-emerald-800","LOI Approved":"bg-sky-100 text-sky-800","Security Details In Progress":"bg-amber-100 text-amber-800","Security Details Approved":"bg-green-100 text-green-800","Security Details":"bg-amber-100 text-amber-800","LOA Issued":"bg-pink-100 text-pink-800"})[K]||"bg-gray-100 text-gray-800";return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4","data-testid":"onboarding-all-apps-banner",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ks,{className:"w-5 h-5 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-amber-900 mb-1",children:"DD Workflow - Initial Application Review"}),e.jsxs("p",{className:"text-amber-800",children:["This page shows ",e.jsx("strong",{children:"only applications that haven't been shortlisted yet"}),". Review and select promising candidates using the ",e.jsx("strong",{children:"Shortlist"})," button. Once shortlisted, applications will be removed from here and moved to the ",e.jsx("strong",{children:"Dealership Requests"})," page for further processing."]})]})]})}),e.jsx("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ot,{type:"text",placeholder:"Search by name or registration number...",value:a,onChange:K=>l(K.target.value),className:"pl-10","data-testid":"onboarding-all-apps-search-input"})]}),e.jsxs(wt,{value:c,onValueChange:d,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-all-apps-status-filter",children:e.jsx(St,{placeholder:"Filter by status"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All Statuses"}),O.map(K=>e.jsx(Pe,{value:K,children:K},K))]})]}),e.jsxs(wt,{value:f,onValueChange:m,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-all-apps-state-filter",children:e.jsx(St,{placeholder:"Filter by state"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All States"}),P.map(K=>e.jsx(Pe,{value:K,children:K},K))]})]}),e.jsxs(wt,{value:h,onValueChange:x,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-all-apps-location-filter",children:e.jsx(St,{placeholder:"Filter by location"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All Locations"}),I.map(K=>e.jsx(Pe,{value:K,children:K},K))]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(se,{variant:n==="grid"?"default":"outline",size:"sm",onClick:()=>r("grid"),className:n==="grid"?"bg-amber-600 hover:bg-amber-700":"","data-testid":"onboarding-all-apps-grid-view-btn",children:[e.jsx(L2,{className:"w-4 h-4 mr-2"}),"Grid"]}),e.jsxs(se,{variant:n==="table"?"default":"outline",size:"sm",onClick:()=>r("table"),className:n==="table"?"bg-amber-600 hover:bg-amber-700":"","data-testid":"onboarding-all-apps-table-view-btn",children:[e.jsx(B2,{className:"w-4 h-4 mr-2"}),"Table"]})]}),e.jsxs(se,{variant:"outline",size:"sm","data-testid":"onboarding-all-apps-export-btn",children:[e.jsx(Ni,{className:"w-4 h-4 mr-2"}),"Export"]}),p.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{variant:"outline",size:"sm",onClick:D,"data-testid":"onboarding-all-apps-reminders-btn",children:[e.jsx(qr,{className:"w-4 h-4 mr-2"}),"Send Reminders (",p.length,")"]}),e.jsxs(se,{size:"sm",onClick:F,className:"bg-green-600 hover:bg-green-700","data-testid":"onboarding-all-apps-shortlist-btn",children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"}),"Shortlist (",p.length,")"]})]}),e.jsx("div",{className:"ml-auto",children:e.jsxs(Ae,{variant:"outline",className:"text-slate-600","data-testid":"onboarding-all-apps-pending-badge",children:[(_==null?void 0:_.total)||Z.length," pending shortlisting"]})})]})]})}),w?e.jsx("div",{className:"flex justify-center items-center h-96 bg-white rounded-lg border border-slate-200",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-amber-600"})}):n==="grid"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4","data-testid":"onboarding-all-apps-grid-container",children:Z.map((K,Y)=>e.jsxs("div",{className:"relative","data-testid":`onboarding-all-apps-grid-item-${Y}`,children:[e.jsx("div",{className:"absolute top-4 left-4 z-10",children:e.jsx(Rn,{checked:p.includes(K.id),onCheckedChange:U=>z(K.id,U),className:"bg-white","data-testid":`onboarding-all-apps-grid-checkbox-${Y}`})}),K.isShortlisted&&e.jsx("div",{className:"absolute top-4 right-4 z-10",children:e.jsx(Ae,{className:"bg-green-600","data-testid":`onboarding-all-apps-grid-shortlisted-badge-${Y}`,children:"Shortlisted"})}),e.jsx(cE,{application:K,onViewDetails:t})]},K.id))}):e.jsx("div",{className:"bg-white rounded-lg border border-slate-200",children:e.jsxs(ks,{"data-testid":"onboarding-all-apps-table",children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{className:"w-12",children:e.jsx(Rn,{checked:p.length===Z.length&&Z.length>0,onCheckedChange:W,"data-testid":"onboarding-all-apps-header-checkbox"})}),e.jsx(me,{children:"Registration"}),e.jsx(me,{children:"Name"}),e.jsx(me,{children:"Location"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Shortlisted"}),e.jsx(me,{children:"Progress"}),e.jsx(me,{children:"Submitted"})]})}),e.jsx(Es,{children:Z.map((K,Y)=>e.jsxs(ct,{className:"cursor-pointer hover:bg-slate-50",onClick:()=>t(K.id),"data-testid":`onboarding-all-apps-row-${Y}`,children:[e.jsx(de,{onClick:U=>U.stopPropagation(),children:e.jsx(Rn,{checked:p.includes(K.id),onCheckedChange:U=>z(K.id,U),"data-testid":`onboarding-all-apps-checkbox-${Y}`})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-900","data-testid":`onboarding-all-apps-reg-id-${Y}`,children:K.registrationNumber})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-900","data-testid":`onboarding-all-apps-name-${Y}`,children:K.name})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-600","data-testid":`onboarding-all-apps-location-${Y}`,children:K.preferredLocation})}),e.jsx(de,{children:e.jsx(Ae,{className:V(K.status),"data-testid":`onboarding-all-apps-status-${Y}`,children:K.status})}),e.jsx(de,{children:K.isShortlisted?e.jsx(Ae,{className:"bg-green-600","data-testid":`onboarding-all-apps-shortlisted-yes-${Y}`,children:"Yes"}):e.jsx(Ae,{variant:"outline","data-testid":`onboarding-all-apps-shortlisted-no-${Y}`,children:"No"})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ji,{value:K.progress,className:"w-20","data-testid":`onboarding-all-apps-progress-bar-${Y}`}),e.jsxs("span",{className:"text-slate-600","data-testid":`onboarding-all-apps-progress-text-${Y}`,children:[K.progress,"%"]})]})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-600","data-testid":`onboarding-all-apps-date-${Y}`,children:Ht(K.submissionDate)})})]},K.id))})]})}),_&&_.totalPages>1&&e.jsx("div",{className:"py-6 border-t border-slate-200 bg-white rounded-b-lg",children:e.jsx(Yl,{children:e.jsxs(Zl,{children:[e.jsx(an,{children:e.jsx(Ql,{onClick:()=>E(K=>Math.max(1,K-1)),className:T===1?"pointer-events-none opacity-50":"cursor-pointer"})}),[...Array(_.totalPages)].map((K,Y)=>{const U=Y+1;return U===1||U===_.totalPages||U>=T-1&&U<=T+1?e.jsx(an,{children:e.jsx(Ci,{isActive:T===U,onClick:()=>E(U),className:"cursor-pointer",children:U})},U):U===T-2||U===T+2?e.jsx(an,{children:e.jsx(Jl,{})},U):null}),e.jsx(an,{children:e.jsx(Xl,{onClick:()=>E(K=>Math.min(_.totalPages,K+1)),className:T===_.totalPages?"pointer-events-none opacity-50":"cursor-pointer"})})]})})}),e.jsx(os,{open:j,onOpenChange:g,children:e.jsxs(ls,{"data-testid":"onboarding-all-apps-shortlist-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{"data-testid":"onboarding-all-apps-shortlist-title",children:"Shortlist Applications"}),e.jsxs(vs,{"data-testid":"onboarding-all-apps-shortlist-desc",children:["You are about to shortlist ",p.length," application(s). These applications will be moved to the Dealership Requests page."]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{htmlFor:"shortlist-remark",children:"Shortlisting Remark (Optional)"}),e.jsx(Fs,{id:"shortlist-remark",placeholder:"Enter reason for shortlisting these applications...",value:y,onChange:K=>N(K.target.value),className:"mt-2",rows:4,"data-testid":"onboarding-all-apps-shortlist-remark"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>g(!1),"data-testid":"onboarding-all-apps-shortlist-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-green-600 hover:bg-green-700",onClick:B,"data-testid":"onboarding-all-apps-shortlist-confirm",children:"Confirm Shortlist"})]})]})]})})]})}function I7({onViewDetails:t}){const[s,n]=v.useState("table"),[r,a]=v.useState(""),[l,c]=v.useState("all"),[d,h]=v.useState("all"),[x,f]=v.useState("all"),[m,p]=v.useState(""),[u,j]=v.useState(""),[g,y]=v.useState("date-desc"),[N,S]=v.useState(1),[C,w]=v.useState(null),[R,P]=v.useState([]),[A,I]=v.useState(!1),[$,T]=v.useState(""),[E,_]=v.useState([]),[M,q]=v.useState([]),[G,Z]=v.useState([]),[W,z]=v.useState(!0);v.useEffect(()=>{B()},[m,u,l,r,N,d,x]),v.useEffect(()=>{S(1)},[m,u,l,r,d,x]),v.useEffect(()=>{F()},[]);const F=async()=>{try{const re=await Ss.getStates(),ve=(Array.isArray(re)?re:(re==null?void 0:re.data)||(re==null?void 0:re.states)||[]).map(Se=>typeof Se=="string"?Se:Se.name||Se.stateName).filter(Boolean);_(ve)}catch(re){console.error("Failed to fetch states:",re)}},B=async()=>{try{z(!0);const re=["Questionnaire Pending","Questionnaire Completed","Shortlisted"],ge=await ds.getApplications({fromDate:m,toDate:u,status:l==="all"?re.join(","):l,location:d!=="all"?d:void 0,state:x!=="all"?x:void 0,ddLeadShortlisted:"false",isShortlisted:"true",search:r,page:N,limit:10}),ve=ge.data||[];w(ge.meta);const Se=ve.map(Ce=>({id:Ce.id,registrationNumber:Ce.applicationId||"N/A",name:Ce.applicantName,email:Ce.email,phone:Ce.phone,age:Ce.age,education:Ce.education,residentialAddress:Ce.address||Ce.city||"",businessAddress:Ce.address||"",preferredLocation:Ce.preferredLocation,state:Ce.state,ownsBike:Ce.ownRoyalEnfield==="yes",pastExperience:Ce.experienceYears?`${Ce.experienceYears} years`:Ce.description||"",status:Ce.overallStatus,questionnaireMarks:Ce.score||Ce.questionnaireMarks||0,rank:0,totalApplicantsAtLocation:0,submissionDate:Ce.createdAt,assignedUsers:[],progress:Ce.progressPercentage||0,isShortlisted:Ce.isShortlisted,ddLeadShortlisted:Ce.ddLeadShortlisted,companyName:Ce.companyName,source:Ce.source,existingDealer:Ce.existingDealer,royalEnfieldModel:Ce.royalEnfieldModel,description:Ce.description,pincode:Ce.pincode,locationType:Ce.locationType,ownRoyalEnfield:Ce.ownRoyalEnfield,address:Ce.address}));Z(Se);const We=Array.from(new Set(Se.map(Ce=>Ce.preferredLocation))).filter(Boolean);q(We)}catch(re){console.error("Failed to fetch applications:",re),ee.error("Failed to load opportunity requests")}finally{z(!1)}},D=G.sort((re,ge)=>g==="score-desc"?(ge.questionnaireMarks||0)-(re.questionnaireMarks||0):g==="score-asc"?(re.questionnaireMarks||0)-(ge.questionnaireMarks||0):g==="date-desc"?new Date(ge.submissionDate).getTime()-new Date(re.submissionDate).getTime():g==="date-asc"?new Date(re.submissionDate).getTime()-new Date(ge.submissionDate).getTime():0),O=re=>{P(re?D.map(ge=>ge.id):[])},V=(re,ge)=>{P(ge?[...R,re]:R.filter(ve=>ve!==re))},K=()=>{if(R.length===0){ee.error("Please select at least one application to shortlist");return}I(!0)},Y=async()=>{try{const re=await ds.shortlistApplications(R,[],$);if(re&&re.success)await B(),P([]),I(!1),T(""),ee.success(`${R.length} application(s) shortlisted successfully. Users will be assigned automatically.`);else throw new Error((re==null?void 0:re.message)||"Failed to process shortlisting")}catch(re){console.error("Failed to shortlist applications:",re),ee.error(re.message||"Failed to process shortlisting")}},U=()=>{if(R.length===0){ee.error("Please select at least one application");return}ee.success(`Reminder emails sent to ${R.length} applicant(s)`)},X=async()=>{const re=D.filter(Se=>Se.status!=="Questionnaire Pending"),ge=re.filter(Se=>R.includes(Se.id));let ve=[];if(R.length>0){if(ge.length===0){ee.error('Selected applications are in "Questionnaire Pending" status and cannot be exported.');return}ve=ge.map(Se=>Se.id),ge.lengthSe.id);if(ve.length===0){ee.error("No applications with completed questionnaires available for export");return}try{const Se=ee.loading("Preparing Excel export..."),We=await ds.exportResponses(ve);if(ee.dismiss(Se),!We||We.length===0){ee.error("No response data found");return}const Ce=Object.keys(We[0]),Ye=[Ce.join(","),...We.map(qe=>Ce.map(Ve=>{const dt=qe[Ve]??"";return`"${String(dt).replace(/"/g,'""')}"`}).join(","))].join(` -`),be=new Blob([Ye],{type:"text/csv;charset=utf-8;"}),_e=URL.createObjectURL(be),ke=document.createElement("a");ke.setAttribute("href",_e),ke.setAttribute("download",`onboarding_responses_${new Date().toISOString().split("T")[0]}.xlsx`),document.body.appendChild(ke),ke.click(),document.body.removeChild(ke),ee.success(`Exported ${ve.length} records to Excel successfully`)}catch(Se){console.error("Export failed:",Se),ee.error(Se.message||"Failed to export responses")}},ne=["Questionnaire Pending","Questionnaire Completed","Shortlisted"],oe=re=>({Submitted:"bg-blue-100 text-blue-800","Questionnaire Pending":"bg-yellow-100 text-yellow-800","Questionnaire Completed":"bg-cyan-100 text-cyan-800",Shortlisted:"bg-purple-100 text-purple-800","Level 1 Interview Pending":"bg-orange-100 text-orange-800","Level 1 Approved":"bg-green-100 text-green-800","Level 2 Interview Pending":"bg-orange-100 text-orange-800","Level 2 Approved":"bg-green-100 text-green-800","Level 2 Recommended":"bg-teal-100 text-teal-800","Level 3 Interview Pending":"bg-orange-100 text-orange-800","FDD Verification":"bg-indigo-100 text-indigo-800","Payment Pending":"bg-amber-100 text-amber-800","LOI Issued":"bg-sky-100 text-sky-800","Dealer Code Generation":"bg-purple-100 text-purple-800","Architecture Team Assigned":"bg-blue-100 text-blue-800","Architecture Document Upload":"bg-blue-100 text-blue-800","Architecture Team Completion":"bg-blue-100 text-blue-800","Statutory GST":"bg-emerald-100 text-emerald-800","Statutory PAN":"bg-emerald-100 text-emerald-800","Statutory Nodal":"bg-emerald-100 text-emerald-800","Statutory Check":"bg-emerald-100 text-emerald-800","Statutory Partnership":"bg-emerald-100 text-emerald-800","Statutory Firm Reg":"bg-emerald-100 text-emerald-800","Statutory Rental":"bg-emerald-100 text-emerald-800","Statutory Virtual Code":"bg-emerald-100 text-emerald-800","Statutory Domain":"bg-emerald-100 text-emerald-800","Statutory MSD":"bg-emerald-100 text-emerald-800","Statutory LOI Ack":"bg-emerald-100 text-emerald-800","EOR In Progress":"bg-violet-100 text-violet-800","LOA Pending":"bg-pink-100 text-pink-800",Inauguration:"bg-green-100 text-green-800",Approved:"bg-green-100 text-green-800",Rejected:"bg-red-100 text-red-800",Disqualified:"bg-gray-100 text-gray-800","In Review":"bg-slate-100 text-slate-800","Level 3 Approved":"bg-green-100 text-green-800","LOI In Progress":"bg-sky-50 text-sky-700","LOI Approved":"bg-green-100 text-green-800","Security Details In Progress":"bg-blue-50 text-blue-700","Security Details Approved":"bg-green-100 text-green-800","Security Details":"bg-blue-100 text-blue-800","LOI Issued In Progress":"bg-sky-50 text-sky-700","Statutory Work In Progress":"bg-emerald-50 text-emerald-700","Statutory Work Completed":"bg-green-100 text-green-800","Architecture Work In Progress":"bg-blue-50 text-blue-700","Architecture Work Completed":"bg-green-100 text-green-800","Dealer Code Generation In Progress":"bg-purple-50 text-purple-700","Dealer Code Generated":"bg-green-100 text-green-800","LOA Issued":"bg-pink-100 text-pink-800","EOR Complete":"bg-violet-100 text-violet-800",Onboarded:"bg-green-200 text-green-900"})[re]||"bg-gray-100 text-gray-800";return W?e.jsx("div",{className:"flex justify-center items-center h-96",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-amber-600"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4","data-testid":"onboarding-opp-requests-banner",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ks,{className:"w-5 h-5 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-amber-900 mb-1",children:"DD Lead Workflow - Opportunity Requests"}),e.jsxs("p",{className:"text-amber-800",children:["This page shows ",e.jsx("strong",{children:"applications where dealerships are being offered"})," at the applicant's preferred location. These have been shortlisted by DD and are waiting for your review. Select and ",e.jsx("strong",{children:"Shortlist"})," promising candidates to move them to the ",e.jsx("strong",{children:"Dealership Requests"})," page for further processing."]})]})]})}),e.jsx("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ot,{type:"text",placeholder:"Search by name or registration number...",value:r,onChange:re=>a(re.target.value),className:"pl-10","data-testid":"onboarding-opp-requests-search-input"})]}),e.jsxs(wt,{value:l,onValueChange:c,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-opp-requests-status-select",children:e.jsx(St,{placeholder:"Filter by status"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All Statuses"}),ne.map(re=>e.jsx(Pe,{value:re,children:re},re))]})]}),e.jsxs(wt,{value:x,onValueChange:f,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-opp-requests-state-select",children:e.jsx(St,{placeholder:"Filter by state"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All States"}),E.map(re=>e.jsx(Pe,{value:re,children:re},re))]})]}),e.jsxs(wt,{value:d,onValueChange:h,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-opp-requests-location-select",children:e.jsx(St,{placeholder:"Filter by location"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All Locations"}),M.map(re=>e.jsx(Pe,{value:re,children:re},re))]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-1 md:flex-none",children:[e.jsxs("div",{className:"relative w-full md:w-40",children:[e.jsx($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"}),e.jsx(ot,{type:"date",value:m,onChange:re=>p(re.target.value),className:"pl-10 text-xs",placeholder:"From","data-testid":"onboarding-opp-requests-from-date"})]}),e.jsx("span",{className:"text-slate-400",children:"to"}),e.jsxs("div",{className:"relative w-full md:w-40",children:[e.jsx($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"}),e.jsx(ot,{type:"date",value:u,onChange:re=>j(re.target.value),className:"pl-10 text-xs",placeholder:"To","data-testid":"onboarding-opp-requests-to-date"})]})]}),e.jsxs(wt,{value:g,onValueChange:y,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-opp-requests-sort-select",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W5,{className:"w-4 h-4 text-slate-400"}),e.jsx(St,{placeholder:"Sort by"})]})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"date-desc",children:"Newest Applied"}),e.jsx(Pe,{value:"date-asc",children:"Oldest Applied"}),e.jsx(Pe,{value:"score-desc",children:"Highest Score"}),e.jsx(Pe,{value:"score-asc",children:"Lowest Score"})]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(se,{variant:s==="grid"?"default":"outline",size:"sm",onClick:()=>n("grid"),className:s==="grid"?"bg-amber-600 hover:bg-amber-700":"","data-testid":"onboarding-opp-requests-view-grid-btn",children:[e.jsx(L2,{className:"w-4 h-4 mr-2"}),"Grid"]}),e.jsxs(se,{variant:s==="table"?"default":"outline",size:"sm",onClick:()=>n("table"),className:s==="table"?"bg-amber-600 hover:bg-amber-700":"","data-testid":"onboarding-opp-requests-view-table-btn",children:[e.jsx(B2,{className:"w-4 h-4 mr-2"}),"Table"]})]}),e.jsxs(se,{variant:"outline",size:"sm",onClick:X,"data-testid":"onboarding-opp-requests-export-btn",children:[e.jsx(Ni,{className:"w-4 h-4 mr-2"}),"Export"]}),R.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{variant:"outline",size:"sm",onClick:U,"data-testid":"onboarding-opp-requests-bulk-reminder-btn",children:[e.jsx(qr,{className:"w-4 h-4 mr-2"}),"Send Reminders (",R.length,")"]}),e.jsxs(se,{size:"sm",onClick:K,className:"bg-green-600 hover:bg-green-700","data-testid":"onboarding-opp-requests-bulk-shortlist-btn",children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"}),"Shortlist (",R.length,")"]})]}),e.jsx("div",{className:"ml-auto",children:e.jsxs(Ae,{variant:"outline",className:"text-slate-600","data-testid":"onboarding-opp-requests-pending-count",children:[(C==null?void 0:C.total)||D.length," pending shortlisting"]})})]})]})}),s==="grid"?e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4","data-testid":"onboarding-opp-requests-grid",children:[D.map((re,ge)=>e.jsxs("div",{className:"relative","data-testid":`onboarding-opp-requests-grid-item-${ge}`,children:[e.jsx("div",{className:"absolute top-4 left-4 z-10",children:e.jsx(Rn,{checked:R.includes(re.id),onCheckedChange:ve=>V(re.id,ve),className:"bg-white","data-testid":`onboarding-opp-requests-grid-checkbox-${ge}`})}),e.jsx(cE,{application:re,onViewDetails:t})]},re.id)),D.length===0&&e.jsxs("div",{className:"col-span-full text-center py-12 text-slate-500 bg-white rounded-lg border border-slate-200","data-testid":"onboarding-opp-requests-grid-empty",children:[e.jsx(Ys,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{className:"text-lg mb-2",children:"No opportunity requests found"}),e.jsx("p",{className:"text-sm",children:"Try adjusting your filters"})]})]}):e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200","data-testid":"onboarding-opp-requests-table-container",children:[e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{className:"w-12",children:e.jsx(Rn,{checked:R.length===D.length&&D.length>0,onCheckedChange:O,"data-testid":"onboarding-opp-requests-table-select-all"})}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-reg",children:"Registration"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-name",children:"Name"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-pref-loc",children:"Preferred Location"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-status",children:"Status"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-score",children:"Score"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-app-loc",children:"Applicant Location"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-shortlisted",children:"Shortlisted"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-progress",children:"Progress"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-date",children:"Applied On"})]})}),e.jsxs(Es,{children:[D.map((re,ge)=>e.jsxs(ct,{className:"cursor-pointer hover:bg-slate-50",onClick:()=>t(re.id),"data-testid":`onboarding-opp-requests-row-${ge}`,children:[e.jsx(de,{onClick:ve=>ve.stopPropagation(),children:e.jsx(Rn,{checked:R.includes(re.id),onCheckedChange:ve=>V(re.id,ve),"data-testid":`onboarding-opp-requests-table-select-item-${re.id}`})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-900","data-testid":`onboarding-opp-requests-reg-${ge}`,children:re.registrationNumber})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-900","data-testid":`onboarding-opp-requests-name-${ge}`,children:re.name})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-600","data-testid":`onboarding-opp-requests-pref-loc-${ge}`,children:re.preferredLocation})}),e.jsx(de,{children:e.jsx(Ae,{className:oe(re.status),"data-testid":`onboarding-opp-requests-status-${ge}`,children:re.status})}),e.jsx(de,{children:e.jsx("span",{className:"font-semibold text-slate-900","data-testid":`onboarding-opp-requests-score-${ge}`,children:re.questionnaireMarks})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-600","data-testid":`onboarding-opp-requests-app-loc-${ge}`,children:re.businessAddress})}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline","data-testid":`onboarding-opp-requests-shortlisted-badge-${ge}`,children:"No"})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2","data-testid":`onboarding-opp-requests-progress-container-${ge}`,children:[e.jsx(ji,{value:re.progress,className:"w-20"}),e.jsxs("span",{className:"text-slate-600",children:[re.progress,"%"]})]})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-600","data-testid":`onboarding-opp-requests-date-${ge}`,children:Ht(re.submissionDate)})})]},re.id)),D.length===0&&e.jsx(ct,{children:e.jsxs(de,{colSpan:9,className:"text-center py-12 text-slate-500","data-testid":"onboarding-opp-requests-table-empty",children:[e.jsx(Ys,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{className:"text-lg mb-2",children:"No opportunity requests found"}),e.jsx("p",{className:"text-sm",children:"Try adjusting your filters"})]})})]})]}),C&&C.totalPages>1&&e.jsx("div",{className:"py-4 border-t border-slate-200",children:e.jsx(Yl,{children:e.jsxs(Zl,{children:[e.jsx(an,{children:e.jsx(Ql,{onClick:()=>S(re=>Math.max(1,re-1)),className:N===1?"pointer-events-none opacity-50":"cursor-pointer"})}),[...Array(C.totalPages)].map((re,ge)=>{const ve=ge+1;return ve===1||ve===C.totalPages||ve>=N-1&&ve<=N+1?e.jsx(an,{children:e.jsx(Ci,{isActive:N===ve,onClick:()=>S(ve),className:"cursor-pointer",children:ve})},ve):ve===N-2||ve===N+2?e.jsx(an,{children:e.jsx(Jl,{})},ve):null}),e.jsx(an,{children:e.jsx(Xl,{onClick:()=>S(re=>Math.min(C.totalPages,re+1)),className:N===C.totalPages?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]}),e.jsx(os,{open:A,onOpenChange:I,children:e.jsxs(ls,{className:"overflow-visible","data-testid":"onboarding-opp-requests-shortlist-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{"data-testid":"onboarding-opp-requests-shortlist-modal-title",children:"Shortlist Applications"}),e.jsxs(vs,{children:["You are about to shortlist ",R.length," application(s). These applications will be moved to the Dealership Requests page and users will be assigned automatically based on the applied location."]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Shortlisting Remark (Optional)"}),e.jsx(Fs,{placeholder:"Enter reason for shortlisting these applications...",value:$,onChange:re=>T(re.target.value),className:"mt-2",rows:4,"data-testid":"onboarding-opp-requests-remark-textarea"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>{I(!1),T("")},"data-testid":"onboarding-opp-requests-shortlist-cancel-btn",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-green-600 hover:bg-green-700",onClick:Y,"data-testid":"onboarding-opp-requests-shortlist-confirm-btn",children:"Confirm Shortlist"})]})]})]})})]})}function L7({onViewDetails:t}){var W,z;const[s,n]=v.useState(""),[r,a]=v.useState("all"),[l,c]=v.useState("all"),[d,h]=v.useState(""),[x,f]=v.useState(""),[m,p]=v.useState(1),[u,j]=v.useState(null),[g,y]=v.useState([]),[N,S]=v.useState(!0),[C,w]=v.useState([]),[R,P]=v.useState([]),[A,I]=v.useState([]),[$,T]=v.useState(!1),E=async()=>{var F,B,D,O;if(A.length!==0)try{T(!0);const V=await ds.bulkConvertToOpportunity({ids:A});V!=null&&V.success&&((((F=V.data)==null?void 0:F.success)>0||!V.data)&&ee.success(V.message||`Successfully converted ${((B=V.data)==null?void 0:B.success)||A.length} leads.`),((D=V.data)==null?void 0:D.failed)>0&&((O=V.data)!=null&&O.errors)&&V.data.errors.forEach(K=>{ee.error(K,{duration:5e3})}),I([]),await G())}catch(V){console.error("Bulk conversion error:",V),ee.error(V.message||"Failed to perform bulk conversion")}finally{T(!1)}},_=()=>{A.length===Z.length?I([]):I(Z.map(F=>F.id))},M=F=>{I(B=>B.includes(F)?B.filter(D=>D!==F):[...B,F])};v.useEffect(()=>{G()},[d,x,s,m,r,l]),v.useEffect(()=>{p(1)},[d,x,s,r,l]),v.useEffect(()=>{q()},[]);const q=async()=>{try{const F=await Ss.getStates(),D=(Array.isArray(F)?F:(F==null?void 0:F.data)||(F==null?void 0:F.states)||[]).map(O=>typeof O=="string"?O:O.name||O.stateName).filter(Boolean);w(D)}catch(F){console.error("Failed to fetch states:",F)}},G=async()=>{try{S(!0);const F=await ds.getApplications({fromDate:d,toDate:x,search:s,status:"Submitted",isShortlisted:"false",location:r!=="all"?r:void 0,state:l!=="all"?l:void 0,page:m,limit:10}),B=F.data||[];j(F.meta);const D=B.map(V=>({id:V.id,registrationNumber:V.applicationId||"N/A",name:V.applicantName,email:V.email,phone:V.phone,age:V.age,education:V.education,residentialAddress:V.address||V.city||"",businessAddress:V.address||"",preferredLocation:V.preferredLocation,state:V.state,ownsBike:V.ownRoyalEnfield==="yes",pastExperience:V.experienceYears?`${V.experienceYears} years`:V.description||"",status:V.overallStatus,questionnaireMarks:V.score||V.questionnaireMarks||0,rank:0,totalApplicantsAtLocation:0,submissionDate:V.createdAt,assignedUsers:[],progress:V.progressPercentage||0,isShortlisted:V.isShortlisted,companyName:V.companyName,source:V.source,existingDealer:V.existingDealer,royalEnfieldModel:V.royalEnfieldModel,description:V.description,pincode:V.pincode,locationType:V.locationType,ownRoyalEnfield:V.ownRoyalEnfield,address:V.address}));y(D);const O=Array.from(new Set(D.map(V=>V.preferredLocation))).filter(Boolean);P(O)}catch(F){console.error("Failed to fetch applications:",F),ee.error("Failed to load non-opportunity requests")}finally{S(!1)}},Z=g;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl mb-2",children:"Non-opportunities (Lead Generation)"}),e.jsx("p",{className:"text-slate-600",children:"Interest submissions from regions where dealerships are currently not being offered. These leads received non-opportunity notification and are stored for future reference."})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx("div",{className:"bg-white rounded-lg border border-slate-200 p-4","data-testid":"onboarding-non-opps-stat-total",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Total Leads"}),e.jsx("p",{className:"text-2xl text-slate-900 mt-1",children:(u==null?void 0:u.total)||g.length})]}),e.jsx("div",{className:"p-3 bg-blue-100 rounded-lg",children:e.jsx(ev,{className:"w-6 h-6 text-blue-600"})})]})}),e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-4","data-testid":"onboarding-non-opps-stat-locations",children:[e.jsx("p",{className:"text-slate-600",children:"Unique Locations"}),e.jsx("p",{className:"text-2xl text-slate-900 mt-1",children:((W=u==null?void 0:u.stats)==null?void 0:W.uniqueLocations)||0})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-4","data-testid":"onboarding-non-opps-stat-exp",children:[e.jsx("p",{className:"text-slate-600",children:"With Experience"}),e.jsx("p",{className:"text-2xl text-amber-600 mt-1",children:((z=u==null?void 0:u.stats)==null?void 0:z.withExperience)||0})]})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ot,{type:"text",placeholder:"Search by name, email, phone, or registration number...",value:s,onChange:F=>n(F.target.value),className:"pl-10","data-testid":"onboarding-non-opps-search-input"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative w-full md:w-36",children:[e.jsx($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"}),e.jsx(ot,{type:"date",value:d,onChange:F=>h(F.target.value),className:"pl-10 text-xs",placeholder:"From","data-testid":"onboarding-non-opps-from-date"})]}),e.jsx("span",{className:"text-slate-400",children:"to"}),e.jsxs("div",{className:"relative w-full md:w-36",children:[e.jsx($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"}),e.jsx(ot,{type:"date",value:x,onChange:F=>f(F.target.value),className:"pl-10 text-xs",placeholder:"To","data-testid":"onboarding-non-opps-to-date"})]})]}),e.jsxs(wt,{value:r,onValueChange:a,children:[e.jsx(Ct,{className:"w-full lg:w-48","data-testid":"onboarding-non-opps-location-select",children:e.jsx(St,{placeholder:"All Locations"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All Locations"}),R.map(F=>e.jsx(Pe,{value:F,children:F},F))]})]}),e.jsxs(wt,{value:l,onValueChange:c,children:[e.jsx(Ct,{className:"w-full lg:w-48","data-testid":"onboarding-non-opps-state-select",children:e.jsx(St,{placeholder:"All States"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All States"}),C.map(F=>e.jsx(Pe,{value:F,children:F},F))]})]}),e.jsx(se,{variant:"outline",size:"icon","data-testid":"onboarding-non-opps-export-btn",children:e.jsx(Ni,{className:"w-4 h-4"})}),A.length>0&&e.jsxs(se,{className:"bg-amber-600 hover:bg-amber-700 font-bold",onClick:E,disabled:$,children:[$?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(K5,{className:"w-4 h-4 mr-2"}),"Convert ",A.length," to Opportunity"]})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 overflow-hidden","data-testid":"onboarding-non-opps-table-container",children:[e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{className:"w-12",children:e.jsx(Rn,{checked:Z.length>0&&A.length===Z.length,onCheckedChange:_})}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-name",children:"Name"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-phone",children:"Phone"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-email",children:"Email"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-loc",children:"Preferred Location"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-address",children:"Main Address"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-age",children:"Age"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-exp",children:"Experience"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-edu",children:"Education"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-date",children:"Applied On"}),e.jsx(me,{className:"text-right","data-testid":"onboarding-non-opps-th-actions",children:"Actions"})]})}),e.jsx(Es,{children:N?e.jsx(ct,{children:e.jsxs(de,{colSpan:11,className:"text-center py-20",children:[e.jsx(ss,{className:"w-8 h-8 mx-auto animate-spin text-amber-600 mb-2"}),e.jsx("p",{className:"text-slate-500 text-sm",children:"Loading applications..."})]})}):Z.length===0?e.jsx(ct,{children:e.jsxs(de,{colSpan:11,className:"text-center py-12 text-slate-500","data-testid":"onboarding-non-opps-empty-state",children:[e.jsx(ev,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{className:"text-lg mb-2",children:"No lead generation data found"}),e.jsx("p",{className:"text-sm",children:"Try adjusting your filters"})]})}):Z.map((F,B)=>e.jsxs(ct,{"data-testid":`onboarding-non-opps-row-${B}`,className:A.includes(F.id)?"bg-amber-50/50":"",children:[e.jsx(de,{children:e.jsx(Rn,{checked:A.includes(F.id),onCheckedChange:()=>M(F.id)})}),e.jsx(de,{children:e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900","data-testid":`onboarding-non-opps-name-${B}`,children:F.name}),e.jsx("p",{className:"text-slate-500 text-sm","data-testid":`onboarding-non-opps-id-${B}`,children:F.registrationNumber})]})}),e.jsx(de,{className:"text-slate-900","data-testid":`onboarding-non-opps-phone-${B}`,children:F.phone}),e.jsx(de,{className:"text-slate-600","data-testid":`onboarding-non-opps-email-${B}`,children:F.email}),e.jsx(de,{children:e.jsxs("div",{"data-testid":`onboarding-non-opps-pref-loc-${B}`,children:[e.jsx("p",{className:"text-slate-900",children:F.preferredLocation}),e.jsx("p",{className:"text-slate-500 text-sm",children:F.state})]})}),e.jsx(de,{className:"text-slate-600 max-w-xs truncate","data-testid":`onboarding-non-opps-address-${B}`,children:F.residentialAddress}),e.jsx(de,{className:"text-slate-900","data-testid":`onboarding-non-opps-age-${B}`,children:F.age}),e.jsx(de,{className:"text-slate-600","data-testid":`onboarding-non-opps-experience-${B}`,children:F.pastExperience}),e.jsx(de,{className:"text-slate-900","data-testid":`onboarding-non-opps-education-${B}`,children:F.education}),e.jsx(de,{className:"text-slate-600","data-testid":`onboarding-non-opps-date-${B}`,children:Ht(F.submissionDate)}),e.jsx(de,{className:"text-right",children:e.jsx("div",{className:"flex justify-end gap-2",children:e.jsx(se,{variant:"outline",size:"sm",onClick:()=>t(F.id),"data-testid":`onboarding-non-opps-view-btn-${B}`,children:"View"})})})]},F.id))})]}),u&&u.totalPages>1&&e.jsx("div",{className:"py-4 border-t border-slate-200",children:e.jsx(Yl,{children:e.jsxs(Zl,{children:[e.jsx(an,{children:e.jsx(Ql,{onClick:()=>p(F=>Math.max(1,F-1)),className:m===1?"pointer-events-none opacity-50":"cursor-pointer"})}),[...Array(u.totalPages)].map((F,B)=>{const D=B+1;return D===1||D===u.totalPages||D>=m-1&&D<=m+1?e.jsx(an,{children:e.jsx(Ci,{isActive:m===D,onClick:()=>p(D),className:"cursor-pointer",children:D})},D):D===m-2||D===m+2?e.jsx(an,{children:e.jsx(Jl,{})},D):null}),e.jsx(an,{children:e.jsx(Xl,{onClick:()=>p(F=>Math.min(u.totalPages,F+1)),className:m===u.totalPages?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]})]})}function M7({application:t,isNonResponsive:s,isAdmin:n,onBack:r,onOpenWorknotes:a}){return e.jsxs(e.Fragment,{children:[s&&e.jsxs("div",{className:"bg-red-50 border border-red-200 p-4 rounded-2xl flex items-center justify-between animate-in fade-in slide-in-from-top-4 duration-500","data-testid":"onboarding-details-non-responsive-banner",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"bg-red-100 p-2 rounded-xl",children:e.jsx(Xv,{className:"w-6 h-6 text-red-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-black text-red-900 tracking-tight leading-none uppercase",children:"Applicant Flagged Non-Responsive"}),e.jsx("p",{className:"text-red-700 text-[11px] font-bold uppercase tracking-widest mt-1 opacity-80",children:"Audit process is currently on hold due to missing cooperation"})]})]}),n&&e.jsx(se,{variant:"outline",size:"sm",className:"bg-white border-red-200 text-red-600 hover:bg-red-50 font-black text-[10px] uppercase tracking-widest hidden sm:block h-9","data-testid":"onboarding-details-review-audit-button",onClick:()=>{const l=document.querySelector('[value="worknotes"]');l==null||l.click()},children:"Review Audit"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"outline",size:"icon",onClick:r,className:"shrink-0","data-testid":"onboarding-details-back-button",children:e.jsx($r,{className:"w-4 h-4"})}),e.jsxs("div",{className:"truncate",children:[e.jsx("h1",{className:"text-slate-900 truncate leading-tight","data-testid":"onboarding-details-application-name",children:t.name}),e.jsx("p",{className:"text-slate-600 truncate text-sm","data-testid":"onboarding-details-registration-number",children:t.registrationNumber})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsxs(se,{variant:"outline",className:"relative hover:bg-amber-50 hover:border-amber-300 hover:text-amber-700 transition-all shadow-sm",onClick:a,"data-testid":"onboarding-details-view-work-notes",children:[e.jsx(zr,{className:"w-4 h-4 mr-2"}),"View Work Notes"]})})]})]})}var F7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],B7=F7.reduce((t,s)=>{const n=hu(`Primitive.${s}`),r=v.forwardRef((a,l)=>{const{asChild:c,...d}=a,h=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${s}`,{...t,[s]:r}},{}),$7="Separator",l1="horizontal",q7=["horizontal","vertical"],dE=v.forwardRef((t,s)=>{const{decorative:n,orientation:r=l1,...a}=t,l=z7(r)?r:l1,d=n?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return e.jsx(B7.div,{"data-orientation":l,...d,...a,ref:s})});dE.displayName=$7;function z7(t){return q7.includes(t)}var U7=dE;function zd({className:t,orientation:s="horizontal",decorative:n=!0,...r}){return e.jsx(U7,{"data-slot":"separator-root",decorative:n,orientation:s,className:Pt("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}function V7({application:t,canEditStatutory:s,isEditingStatutory:n,isSavingStatutory:r,statutoryForm:a,onEditFirmType:l,onEditStatutory:c,onCancelEditStatutory:d,onSaveStatutory:h,onStatutoryFormChange:x}){return e.jsxs(Le,{"data-testid":"onboarding-applicant-info-card",children:[e.jsx(tt,{children:e.jsx(nt,{children:"Applicant Information"})}),e.jsxs(Me,{className:"p-4 sm:p-6 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-x-6 gap-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(kr,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Full Name"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-name",children:t.name})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(qr,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Email"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-email",children:t.email})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Zv,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Phone"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-phone",children:t.phone})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(kr,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Age"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-age",children:t.age?`${t.age} years`:"N/A"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(sI,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Education"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-education",children:t.education||"N/A"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Er,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Preferred Location"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-preferred-location",children:t.preferredLocation||"N/A"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Er,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location Type"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-location-type",children:t.locationType||"N/A"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ml,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-slate-600 flex items-center justify-between group cursor-pointer",onClick:l,"data-testid":"onboarding-applicant-info-edit-firm-type",children:["Proposed Firm Type",e.jsx(nv,{className:"w-3 h-3 text-slate-300 group-hover:text-amber-600 transition-colors"})]}),e.jsx("p",{className:"text-slate-900 font-black text-amber-700 tracking-tight leading-none mt-1","data-testid":"onboarding-applicant-info-firm-type",children:t.constitutionType||"Not Provided"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ow,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Owns Bike"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-owns-bike",children:t.ownRoyalEnfield==="yes"?"Yes":"No"})]})]}),t.ownRoyalEnfield==="yes"&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ow,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Bike Model"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-bike-model",children:t.royalEnfieldModel||"N/A"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(kr,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Existing Dealer"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-existing-dealer",children:t.existingDealer==="yes"?"Yes":"No"})]})]}),t.existingDealer==="yes"&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(kr,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Company Name"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-company-name",children:t.companyName||"N/A"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Fo,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Source"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-source",children:t.source||"N/A"})]})]}),t.questionnaireMarks!==void 0&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_2,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Questionnaire Score"}),e.jsxs("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-score",children:[t.questionnaireMarks,"/100"]})]})]})]}),e.jsx(zd,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 mb-2",children:"Address"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-address",children:t.address||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 mb-2",children:"Pincode"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-pincode",children:t.pincode||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 mb-2",children:"Description"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-description",children:t.description||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 mb-2",children:"Past Experience"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-experience",children:t.pastExperience||"N/A"})]}),e.jsxs("div",{className:"pt-6 border-t mt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-sm font-black text-slate-900 uppercase tracking-widest flex items-center gap-2",children:[e.jsx(mu,{className:"w-4 h-4 text-amber-600"})," Statutory & Bank Information"]}),s&&!n&&e.jsxs(se,{variant:"ghost",size:"sm",onClick:c,className:"h-8 text-amber-600 hover:text-amber-700 hover:bg-amber-50 gap-1.5","data-testid":"onboarding-applicant-info-edit-statutory",children:[e.jsx(nv,{className:"w-3.5 h-3.5"}),"Edit Details"]})]}),n?e.jsxs("div",{className:"bg-slate-50/50 p-6 rounded-xl border-2 border-amber-100 space-y-4","data-testid":"onboarding-applicant-info-statutory-edit-form",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"Legal Entity Name"}),e.jsx(ot,{value:a.accountHolderName,onChange:f=>x({...a,accountHolderName:f.target.value}),placeholder:"Enter Legal Entity Name",className:"bg-white border-slate-200","data-testid":"onboarding-applicant-info-input-legal-name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"PAN Number"}),e.jsx(ot,{value:a.panNumber,onChange:f=>x({...a,panNumber:f.target.value.toUpperCase()}),placeholder:"10-digit PAN",maxLength:10,className:"bg-white border-slate-200 uppercase","data-testid":"onboarding-applicant-info-input-pan"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"GST Number"}),e.jsx(ot,{value:a.gstNumber,onChange:f=>x({...a,gstNumber:f.target.value.toUpperCase()}),placeholder:"15-digit GSTIN",maxLength:15,className:"bg-white border-slate-200 uppercase","data-testid":"onboarding-applicant-info-input-gst"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"Registered Address"}),e.jsx(ot,{value:a.registeredAddress,onChange:f=>x({...a,registeredAddress:f.target.value}),placeholder:"Enter Registered Office Address",className:"bg-white border-slate-200","data-testid":"onboarding-applicant-info-input-registered-address"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"Bank Name"}),e.jsx(ot,{value:a.bankName,onChange:f=>x({...a,bankName:f.target.value}),placeholder:"Enter Bank Name",className:"bg-white border-slate-200","data-testid":"onboarding-applicant-info-input-bank-name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"Account Number"}),e.jsx(ot,{value:a.accountNumber,onChange:f=>x({...a,accountNumber:f.target.value}),placeholder:"Enter Account Number",className:"bg-white border-slate-200","data-testid":"onboarding-applicant-info-input-account-number"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"IFSC Code"}),e.jsx(ot,{value:a.ifscCode,onChange:f=>x({...a,ifscCode:f.target.value.toUpperCase()}),placeholder:"11-digit IFSC",maxLength:11,className:"bg-white border-slate-200 uppercase","data-testid":"onboarding-applicant-info-input-ifsc-code"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[e.jsx(se,{variant:"outline",size:"sm",onClick:d,disabled:r,"data-testid":"onboarding-applicant-info-statutory-cancel",children:"Cancel"}),e.jsx(se,{size:"sm",onClick:h,disabled:r,className:"bg-amber-600 hover:bg-amber-700","data-testid":"onboarding-applicant-info-statutory-save",children:r?e.jsx(ss,{className:"w-4 h-4 animate-spin"}):"Save Details"})]})]}):e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 bg-slate-50/50 p-4 rounded-xl border border-slate-100","data-testid":"onboarding-applicant-info-statutory-display",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-tight",children:"Legal Entity Name"}),e.jsx("p",{className:"text-xs font-semibold text-slate-900","data-testid":"onboarding-applicant-info-display-legal-name",children:t.accountHolderName||"Pending"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-tight",children:"PAN Number"}),e.jsx("p",{className:"text-xs font-semibold text-slate-900 uppercase","data-testid":"onboarding-applicant-info-display-pan",children:t.panNumber||"Pending"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-tight",children:"GST Number"}),e.jsx("p",{className:"text-xs font-semibold text-slate-900 uppercase","data-testid":"onboarding-applicant-info-display-gst",children:t.gstNumber||"Pending"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-tight",children:"Registered Address"}),e.jsx("p",{className:"text-xs font-semibold text-slate-900","data-testid":"onboarding-applicant-info-display-registered-address",children:t.registeredAddress||"Pending"})]}),e.jsxs("div",{className:"space-y-1","data-testid":"onboarding-applicant-info-display-bank-info",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-tight",children:"Bank Details"}),e.jsx("p",{className:"text-xs font-semibold text-slate-900",children:t.bankName||"N/A"}),e.jsxs("p",{className:"text-[10px] text-slate-600",children:["A/C: ",t.accountNumber||"N/A"]}),e.jsxs("p",{className:"text-[10px] text-slate-600",children:["IFSC: ",t.ifscCode||"N/A"]})]})]})]})]})]})}const H7=({application:t})=>{if(!t.questionnaireResponses||t.questionnaireResponses.length===0)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-300","data-testid":"onboarding-questionnaire-empty",children:[e.jsx(Fo,{className:"w-12 h-12 mb-3 text-slate-300"}),e.jsx("h3",{className:"text-lg font-medium text-slate-700",children:"Response is Pending"}),e.jsx("p",{className:"text-sm",children:"The applicant has not submitted the questionnaire yet."})]});const s=[...t.questionnaireResponses].sort((r,a)=>{var l,c;return(((l=r.question)==null?void 0:l.order)||0)-(((c=a.question)==null?void 0:c.order)||0)}),n=t.score||t.questionnaireMarks||0;return e.jsxs("div",{className:"space-y-6","data-testid":"onboarding-questionnaire-view",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Fo,{className:"w-5 h-5 text-amber-600"}),e.jsx("h3",{className:"text-slate-900",children:"Questionnaire Responses"})]}),n!==void 0&&e.jsxs(Ae,{className:"bg-amber-600","data-testid":"onboarding-questionnaire-total-score",children:["Score: ",n,"/100"]})]}),e.jsx("div",{className:"space-y-6",children:s.map((r,a)=>{const l=r.question,c=(l==null?void 0:l.questionText)||"Unknown Question",d=r.responseValue||"No Answer",h=(l==null?void 0:l.sectionName)||"General",x=(l==null?void 0:l.questionOptions)||[],f=x.find(g=>g.optionText===d),m=f?f.score:0,p=Math.max(...x.map(g=>g.score||0),0),u=typeof d=="string"&&d.startsWith("data:"),j=u&&d.startsWith("data:image");return e.jsxs("div",{className:"border border-slate-200 rounded-lg p-5 hover:border-amber-300 transition-colors","data-testid":`onboarding-questionnaire-item-${a}`,children:[e.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-100 flex items-center justify-center flex-shrink-0",children:e.jsx("span",{className:"text-amber-600",children:a+1})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Ae,{variant:"outline",className:"text-slate-600 bg-slate-50","data-testid":`onboarding-questionnaire-item-section-${a}`,children:h}),x.length>0&&p>0&&e.jsxs(Ae,{className:m>0?"bg-green-600":"bg-slate-400","data-testid":`onboarding-questionnaire-item-score-${a}`,children:[m,"/",p]})]}),e.jsx("h4",{className:"text-slate-900 font-medium","data-testid":`onboarding-questionnaire-item-text-${a}`,children:c})]})]}),e.jsx("div",{className:"ml-11",children:j?e.jsx("div",{className:"mt-2","data-testid":`onboarding-questionnaire-item-image-${a}`,children:e.jsx("img",{src:d,alt:"Response Attachment",className:"max-w-full h-auto max-h-64 rounded border p-1 object-contain"})}):u?e.jsx("a",{href:d,download:`upload_${a}.pdf`,className:"text-blue-600 underline text-sm break-all","data-testid":`onboarding-questionnaire-item-download-${a}`,children:"Download Attachment"}):e.jsx("div",{className:"text-slate-600 leading-relaxed break-words whitespace-pre-wrap","data-testid":`onboarding-questionnaire-item-answer-${a}`,children:r.attachmentUrl?e.jsx("a",{href:r.attachmentUrl,target:"_blank",rel:"noreferrer",className:"text-blue-600 underline","data-testid":`onboarding-questionnaire-item-attachment-${a}`,children:"View Attachment"}):d})})]},r.id)})})]})},W7=Vv("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function mi({className:t,variant:s,...n}){return e.jsx("div",{"data-slot":"alert",role:"alert",className:Pt(W7({variant:s}),t),...n})}function Hi({className:t,...s}){return e.jsx("div",{"data-slot":"alert-title",className:Pt("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...s})}function fi({className:t,...s}){return e.jsx("div",{"data-slot":"alert-description",className:Pt("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...s})}var G7={};function K7(t){const{application:s,activeTab:n,setActiveTab:r,processStages:a,documents:l,interviews:c,expandedBranches:d,setExpandedBranches:h,setSelectedStage:x,setShowDocumentsModal:f,setShowUploadForm:m,handleRetriggerEvaluators:p,handleCancelInterview:u,setSelectedEvaluationForView:j,setShowFeedbackDetailsModal:g,renderFddAuditContent:y,eorProgress:N,eorData:S,eorChecklist:C,setUploadDocType:w,isAdmin:R,fetchApplication:P,fetchEorData:A,deposits:I,getDeposit:$,paymentConfigs:T,setPreviewDoc:E,setShowPreviewModal:_,auditLoading:M,auditLogs:q,auditLogActionBadgeClass:G}=t,Z=z=>String(z||"").trim().toLowerCase().replace(/[_\s-]+/g," "),W=(z,F)=>{var O,V,K;const B=[(O=z==null?void 0:z.user)==null?void 0:O.role,(V=z==null?void 0:z.user)==null?void 0:V.roleCode,(K=z==null?void 0:z.metadata)==null?void 0:K.role].map(Z),D=F.map(Z);return B.some(Y=>D.includes(Y))};return e.jsx(Le,{"data-testid":"onboarding-details-tabs-container",children:e.jsxs(Pn,{value:n,onValueChange:r,children:[e.jsx(tt,{className:"pb-4 px-4 sm:px-6",children:e.jsx("div",{className:"overflow-x-auto custom-scrollbar-x -mx-4 px-4 sm:-mx-6 sm:px-6",children:e.jsxs(_n,{className:"w-max min-w-full justify-start h-11 bg-slate-100/80 p-1","data-testid":"onboarding-tabs-list",children:[e.jsx(Wt,{value:"questionnaire",className:"min-w-[120px]","data-testid":"onboarding-tab-trigger-questionnaire",children:"Questionnaire"}),e.jsx(Wt,{value:"progress",className:"min-w-[80px]","data-testid":"onboarding-tab-trigger-progress",children:"Progress"}),e.jsx(Wt,{value:"documents",className:"min-w-[100px]","data-testid":"onboarding-tab-trigger-documents",children:"Documents"}),e.jsx(Wt,{value:"interviews",className:"min-w-[100px]","data-testid":"onboarding-tab-trigger-interviews",children:"Interviews"}),e.jsx(Wt,{value:"fdd",className:"min-w-[120px]","data-testid":"onboarding-tab-trigger-fdd",children:"FDD Audit"}),e.jsx(Wt,{value:"eor",className:"min-w-[120px]","data-testid":"onboarding-tab-trigger-eor",children:"EOR Checklist"}),e.jsx(Wt,{value:"payments",className:"min-w-[100px]","data-testid":"onboarding-tab-trigger-payments",children:"Payments"}),e.jsx(Wt,{value:"audit",className:"min-w-[100px]","data-testid":"onboarding-tab-trigger-audit",children:"Audit Trail"})]})})}),e.jsxs(Me,{children:[e.jsx(Gt,{value:"questionnaire",className:"space-y-6","data-testid":"onboarding-tab-content-questionnaire",children:e.jsx(H7,{application:s})}),e.jsxs(Gt,{value:"progress",className:"space-y-6","data-testid":"onboarding-tab-content-progress",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-slate-900",children:"Application Journey"}),e.jsxs(Ae,{className:"bg-amber-600","data-testid":"onboarding-progress-percentage-badge",children:[s.progress,"% Complete"]})]}),e.jsx(ji,{value:s.progress,className:"h-3 mb-6","data-testid":"onboarding-progress-bar"})]}),e.jsx("div",{className:"relative","data-testid":"onboarding-progress-stages-container",children:(()=>{const z={1:["DD-ZM","RBM"],2:["DD Lead","ZBH"],3:["NBH","DD Head"]},F={LOI_APPROVAL:["DD Head","NBH"],LOA_APPROVAL:["DD Head","NBH"]},B=O=>(s.participants||[]).filter(K=>{var U,X,ne,oe,re,ge,ve,Se,We,Ce,fe,Ye;return((U=K.metadata)==null?void 0:U.stageCode)===O||((ne=(X=K.metadata)==null?void 0:X.allAssignments)==null?void 0:ne.includes(O))||typeof O=="number"&&(((oe=K.metadata)==null?void 0:oe.interviewLevel)===O||((re=K.metadata)==null?void 0:re.interviewLevel)===String(O)||((ve=(ge=K.metadata)==null?void 0:ge.allAssignments)==null?void 0:ve.includes(O))||((We=(Se=K.metadata)==null?void 0:Se.allAssignments)==null?void 0:We.includes(String(O))))||typeof O=="string"&&!isNaN(Number(O))&&(((Ce=K.metadata)==null?void 0:Ce.interviewLevel)===Number(O)||((Ye=(fe=K.metadata)==null?void 0:fe.allAssignments)==null?void 0:Ye.includes(Number(O))))?!0:typeof O=="number"?W(K,z[O]||[]):W(K,F[O]||[])}).map(K=>{var X,ne,oe,re,ge;const Y=typeof O=="number"?`INTERVIEW_LEVEL_${O}`:O,U=(s.stageApprovals||[]).find(ve=>ve.stageCode===Y&&String(ve.actorUserId)===String(K.userId));return{name:((X=K.user)==null?void 0:X.name)||((ne=K.user)==null?void 0:ne.fullName)||"Unknown",role:((oe=K.user)==null?void 0:oe.role)||((re=K.user)==null?void 0:re.roleCode)||((ge=K.metadata)==null?void 0:ge.role)||"Reviewer",status:U?U.decision==="Approved"?"approved":"rejected":"pending"}}),D=(O,V)=>{const Y={"1st Level Interview":1,"2nd Level Interview":2,"3rd Level Interview":3,"LOI Approval":"LOI_APPROVAL",LOA:"LOA_APPROVAL"}[O];if(!Y)return null;const U=B(Y);return U.length===0?null:e.jsx("div",{className:"flex flex-wrap gap-2 mt-3","data-testid":`onboarding-stage-approvers-${V}`,children:U.map((X,ne)=>e.jsxs("div",{className:"group relative flex items-center gap-1.5 bg-slate-50 border border-slate-200 rounded-full pl-1 pr-2.5 py-0.5 transition-all hover:bg-white hover:shadow-sm","data-testid":`onboarding-stage-approver-${V}-${ne}`,children:[e.jsx("div",{className:Pt("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold text-white",X.status==="approved"?"bg-green-500":X.status==="rejected"?"bg-red-500":"bg-slate-300"),children:X.name.split(" ").map(oe=>oe[0]).join("").substring(0,2).toUpperCase()}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[10px] font-medium text-slate-700 leading-none",children:X.name}),e.jsx("span",{className:"text-[8px] text-slate-500 leading-none mt-0.5",children:X.role})]}),e.jsx("div",{className:Pt("absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full border border-white",X.status==="approved"?"bg-green-500":X.status==="rejected"?"bg-red-500":"bg-amber-400"),"data-testid":`onboarding-stage-approver-status-dot-${V}-${ne}`}),e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-slate-900 text-white text-[10px] rounded opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity whitespace-nowrap z-50",children:[X.role,": ",X.status.toUpperCase()]})]},ne))})};return a.map((O,V)=>e.jsxs("div",{"data-testid":`onboarding-progress-stage-${V}`,children:[e.jsxs("div",{className:"flex gap-4 pb-8",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center border-2 z-10 relative ${O.status==="completed"?"bg-green-500 border-green-500 text-white shadow-md":O.status==="active"?O.isLocked?"bg-slate-400 border-slate-400 text-white":"bg-amber-500 border-amber-500 text-white animate-pulse-subtle":"bg-white border-slate-300 text-slate-400 shadow-none"}`,"data-testid":`onboarding-progress-stage-icon-${V}`,children:O.isParallel?e.jsx(tv,{className:"w-5 h-5"}):O.isLocked?e.jsxs("div",{className:"group relative",children:[e.jsx(sv,{className:"w-5 h-5 text-white cursor-help"}),e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-3 py-1.5 bg-slate-900 text-white text-[10px] rounded shadow-xl opacity-0 group-hover:opacity-100 pointer-events-none transition-all duration-200 whitespace-nowrap z-[100] border border-slate-700",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("span",{className:"font-bold text-amber-400 flex items-center gap-1",children:[e.jsx(Ks,{className:"w-3 h-3"})," Stage Locked"]}),e.jsx("span",{children:O.lockMessage})]}),e.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-8 border-transparent border-t-slate-900"})]})]}):e.jsx(e.Fragment,{children:O.status==="completed"?e.jsx(Fn,{className:"w-6 h-6"}):O.status==="active"?e.jsx(Js,{className:"w-5 h-5 text-white"}):e.jsx("div",{className:"w-3 h-3 bg-slate-300 rounded-full"})})}),V0&&!["LOI Approval","LOA","1st Level Interview","2nd Level Interview","3rd Level Interview"].includes(O.name)&&e.jsxs("p",{className:"text-amber-600 text-xs mt-1.5 flex items-center gap-1 bg-amber-50 w-fit px-2 py-0.5 rounded border border-amber-100","data-testid":`onboarding-progress-stage-evaluators-${V}`,children:[e.jsx(kr,{className:"w-3 h-3"}),"Evaluators: ",O.evaluators.join(" + ")]}),(()=>{var ge;const K={3:2,4:2,5:2,6:2,8:2,12:2},Y=Number(O.id),U=K[Y],ne={3:1,4:1,5:2,6:3,8:"LOI_APPROVAL",12:"LOA_APPROVAL"}[Y],oe=ne?B(ne).length:((ge=O.evaluators)==null?void 0:ge.length)||0,re=Y===3?O.status==="completed":O.status!=="pending";return U&&oe{const K=l.filter(Y=>{var U;return Y.stage===O.name||!Y.stage&&((U=Y.documentType)==null?void 0:U.toLowerCase().includes(O.name.toLowerCase().split(" ")[0]))}).length;return e.jsx("div",{className:"flex items-center gap-2 mt-1",children:e.jsxs("button",{onClick:()=>{x(O.name),f(!0),K===0&&m(!0)},className:"text-xs font-semibold text-blue-600 hover:text-blue-800 flex items-center gap-1.5 px-3 py-1 rounded-full bg-blue-50 border border-blue-100 hover:bg-blue-100 transition-all shadow-sm","data-testid":`onboarding-progress-stage-docs-${V}`,children:[e.jsx(fs,{className:"w-3.5 h-3.5"}),K>0?`${K} Documents`:"Upload"]})})})(),e.jsxs("p",{className:"text-slate-500 mt-1 text-xs","data-testid":`onboarding-progress-stage-status-text-${V}`,children:[O.status==="completed"&&O.date&&`Completed: ${Ht(O.date)}`,O.status==="active"&&"In Progress",O.status==="pending"&&"Pending"]})]})]}),O.isParallel&&O.branches&&e.jsxs("div",{className:"ml-5 mb-8","data-testid":`onboarding-progress-parallel-branches-${V}`,children:[O.branches.map((K,Y)=>{const U=K.name.toLowerCase().replace(/\s+/g,"-"),X=d[U],ne=K.color==="blue"?"blue":"green";return e.jsxs("div",{className:"mb-6 last:mb-0",children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsxs("button",{onClick:()=>h(oe=>({...oe,[U]:!oe[U]})),className:`flex-1 flex items-center gap-3 p-4 rounded-lg border-2 transition-all hover:shadow-md ${ne==="blue"?"border-blue-300 bg-blue-50 hover:bg-blue-100":"border-green-300 bg-green-50 hover:bg-green-100"}`,"data-testid":`onboarding-progress-branch-trigger-${U}`,children:[X?e.jsx(la,{className:`w-5 h-5 ${ne==="blue"?"text-blue-600":"text-green-600"}`}):e.jsx(el,{className:`w-5 h-5 ${ne==="blue"?"text-blue-600":"text-green-600"}`}),e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center ${ne==="blue"?"bg-blue-200":"bg-green-200"}`,children:e.jsx(tv,{className:`w-4 h-4 ${ne==="blue"?"text-blue-700":"text-green-700"}`})}),e.jsxs("div",{className:"flex-1 text-left",children:[e.jsx("p",{className:`${ne==="blue"?"text-blue-900":"text-green-900"} font-semibold tracking-tight`,children:K.name}),e.jsxs("p",{className:`text-[10px] uppercase font-bold tracking-wider ${ne==="blue"?"text-blue-500":"text-green-500"}`,children:[K.stages.length," SUB-STEPS"]})]})]})}),X&&e.jsx("div",{className:"mt-4 ml-8 border-l-2 border-slate-200 pl-6 space-y-6","data-testid":`onboarding-progress-branch-content-${U}`,children:K.stages.map((oe,re)=>e.jsx("div",{className:"relative",children:e.jsx("div",{className:"flex gap-4 text-xs","data-testid":`onboarding-progress-branch-stage-${U}-${re}`,children:(()=>{const ge=l.filter(Se=>{var We;return((We=Se.documentType)==null?void 0:We.toLowerCase().includes(oe.name.toLowerCase().split(" ")[0]))||Se.stage===oe.name}),ve=oe.status==="completed"||ge.length>0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"relative",children:e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center border-2 ${ve?`${ne==="blue"?"bg-blue-500 border-blue-500":"bg-green-500 border-green-500"}`:oe.status==="active"?"bg-amber-500 border-amber-500 text-white shadow-sm":"bg-white border-slate-300 text-slate-400"}`,"data-testid":`onboarding-progress-branch-stage-icon-${U}-${re}`,children:ve?e.jsx(Bn,{className:"w-4 h-4 text-white",strokeWidth:3}):oe.status==="active"?e.jsx(Js,{className:"w-4 h-4 text-white"}):e.jsx("div",{className:"w-2 h-2 bg-slate-300 rounded-full"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-semibold text-slate-800","data-testid":`onboarding-progress-branch-stage-name-${U}-${re}`,children:oe.name}),oe.description&&e.jsx("p",{className:"text-slate-500 text-xs mt-0.5",children:oe.description}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:e.jsxs("button",{onClick:()=>{x(oe.name),f(!0),ge.length===0&&m(!0)},className:Pt("text-[10px] font-medium flex items-center gap-1 transition-colors",ne==="blue"?"text-blue-600 hover:text-blue-800":"text-green-600 hover:text-green-800"),"data-testid":`onboarding-progress-branch-stage-docs-${U}-${re}`,children:[e.jsx(fs,{className:"w-2.5 h-2.5"}),ge.length>0?`${ge.length} Docs`:"Upload"]})}),e.jsx("p",{className:"text-slate-400 text-[10px] mt-1","data-testid":`onboarding-progress-branch-stage-status-${U}-${re}`,children:ve&&oe.date?`Done: ${Ht(oe.date)}`:ve&&ge.length>0?`Uploaded: ${Ht(ge[0].updatedAt||ge[0].createdAt)}`:oe.status==="active"?"Evaluating":"Pending"})]})]})})()})},oe.id))})]},Y)}),e.jsx("div",{className:"h-8 w-0.5 bg-slate-300 ml-5 opacity-50"})]})]},O.id))})()})]}),e.jsxs(Gt,{value:"documents",className:"space-y-4","data-testid":"onboarding-tab-content-documents",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-slate-900",children:"Uploaded Documents"}),e.jsxs(se,{size:"sm",className:"bg-amber-600 hover:bg-amber-700","data-testid":"onboarding-documents-upload-tab-button",onClick:()=>{x(null),f(!0),m(!0)},children:[e.jsx(Dr,{className:"w-4 h-4 mr-2"}),"Upload Document"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ks,{"data-testid":"onboarding-documents-table",children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{className:"min-w-[200px]",children:"File Name"}),e.jsx(me,{className:"min-w-[120px]",children:"Type"}),e.jsx(me,{className:"min-w-[120px]",children:"Upload Date"}),e.jsx(me,{className:"min-w-[150px]",children:"Uploader"}),e.jsx(me,{className:"text-right min-w-[100px]",children:"Actions"})]})}),e.jsx(Es,{children:l.length===0?e.jsx(ct,{"data-testid":"onboarding-documents-empty-row",children:e.jsx(de,{colSpan:5,className:"text-center py-8 text-slate-500",children:"No documents uploaded yet"})}):l.map((z,F)=>{var B;return e.jsxs(ct,{"data-testid":`onboarding-document-row-${F}`,children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"truncate max-w-[150px] md:max-w-[300px]","data-testid":`onboarding-document-name-${F}`,children:z.fileName})]}),e.jsx(de,{"data-testid":`onboarding-document-type-${F}`,children:z.documentType}),e.jsx(de,{children:Ht(z.createdAt)}),e.jsx(de,{"data-testid":`onboarding-document-uploader-${F}`,children:((B=z.uploader)==null?void 0:B.fullName)||(z.uploadedBy?"Unknown User":"Applicant")}),e.jsx(de,{children:e.jsx("div",{className:"flex justify-end gap-2",children:e.jsx(se,{size:"sm",variant:"outline","data-testid":`onboarding-document-download-${F}`,onClick:()=>{const D=G7.NEXT_PUBLIC_API_URL||"http://localhost:5000";window.open(`${D}/${z.filePath}`,"_blank")},children:e.jsx(Ni,{className:"w-3 h-3"})})})})]},z.id)})})]})})]}),e.jsxs(Gt,{value:"interviews",className:"space-y-6","data-testid":"onboarding-tab-content-interviews",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-slate-900 mb-4",children:"Scheduled Interviews"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ks,{"data-testid":"onboarding-interviews-scheduled-table",children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{className:"min-w-[100px]",children:"Level"}),e.jsx(me,{className:"min-w-[180px]",children:"Date & Time"}),e.jsx(me,{className:"min-w-[100px]",children:"Type"}),e.jsx(me,{className:"min-w-[200px]",children:"Location/Link"}),e.jsx(me,{className:"min-w-[120px]",children:"Status"}),e.jsx(me,{className:"min-w-[150px]",children:"Scheduled By"}),e.jsx(me,{className:"text-right",children:"Actions"})]})}),e.jsx(Es,{children:!c||c.length===0?e.jsx(ct,{"data-testid":"onboarding-interviews-empty-row",children:e.jsx(de,{colSpan:7,className:"text-center py-8 text-slate-500",children:"No interviews scheduled yet"})}):(Array.isArray(c)?c:[]).map((z,F)=>{var B,D;return e.jsxs(ct,{"data-testid":`onboarding-interview-row-${F}`,children:[e.jsxs(de,{className:"font-medium",children:["Level ",z.level]}),e.jsx(de,{children:z.scheduleDate?new Date(z.scheduleDate).toLocaleString():"N/A"}),e.jsx(de,{className:"capitalize",children:z.interviewType}),e.jsx(de,{children:(B=z.interviewType)!=null&&B.toLowerCase().includes("virtual")?e.jsx("a",{href:z.linkOrLocation,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline","data-testid":`onboarding-interview-link-${F}`,children:"Join Meeting"}):e.jsx("span",{"data-testid":`onboarding-interview-location-${F}`,children:z.linkOrLocation})}),e.jsx(de,{children:e.jsx(Ae,{variant:z.status==="Completed"?"default":"secondary","data-testid":`onboarding-interview-status-${F}`,children:z.status})}),e.jsx(de,{children:((D=z.scheduler)==null?void 0:D.fullName)||z.scheduledBy||"N/A"}),e.jsx(de,{className:"text-right",children:(z.status==="Scheduled"||z.status==="scheduled")&&e.jsx(se,{variant:"ghost",size:"sm",className:"text-red-500 hover:text-red-700 hover:bg-red-50 h-8 px-2","data-testid":`onboarding-interview-cancel-${F}`,onClick:()=>u(z.id),children:"Cancel"})})]},z.id)})})]})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-slate-900 mb-4",children:"Interview Feedback"}),!c||c.length===0?e.jsx("p",{className:"text-slate-500 italic","data-testid":"onboarding-interviews-no-feedback",children:"No interviews scheduled."}):(Array.isArray(c)?c:[]).map((z,F)=>e.jsxs("div",{className:"mb-6 border p-4 rounded-lg bg-slate-50/50","data-testid":`onboarding-interview-feedback-block-${F}`,children:[e.jsxs("h4",{className:"font-semibold text-slate-800 mb-2",children:["Level ",z.level," Interview",e.jsxs("span",{className:"font-normal text-slate-500 text-sm ml-2",children:["(",Ht(z.scheduleDate)," - ",z.interviewType,")"]})]}),z.evaluations&&z.evaluations.length>0?e.jsxs(ks,{"data-testid":`onboarding-interview-evaluations-table-${F}`,children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Interviewer"}),e.jsx(me,{children:"Role"}),e.jsx(me,{children:z.level===1?"Score (KT Matrix)":"Overall Score"}),e.jsx(me,{children:"Remarks"}),e.jsx(me,{children:"Recommendation"})]})}),e.jsx(Es,{children:z.evaluations.map((B,D)=>{var O,V,K;return e.jsxs(ct,{"data-testid":`onboarding-interview-evaluation-row-${F}-${D}`,children:[e.jsx(de,{className:"font-medium",children:(O=B.evaluator)==null?void 0:O.fullName}),e.jsx(de,{children:((K=(V=B.evaluator)==null?void 0:V.role)==null?void 0:K.roleName)||"N/A"}),e.jsx(de,{children:B.ktMatrixScore?e.jsxs(Ae,{variant:z.level===1?Number(B.ktMatrixScore)>=50?"outline":"destructive":Number(B.ktMatrixScore)>=5?"outline":"destructive","data-testid":`onboarding-interview-evaluation-score-${F}-${D}`,children:[B.ktMatrixScore,"/",z.level===1?"100":"10"]}):"N/A"}),e.jsx(de,{className:"max-w-xs truncate",title:B.remarks||B.qualitativeFeedback,children:B.remarks?e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"font-medium text-slate-800",children:B.remarks}),B.feedbackDetails&&B.feedbackDetails.length>0&&e.jsx(se,{variant:"link",className:"p-0 h-auto font-normal text-blue-600 text-xs w-fit","data-testid":`onboarding-interview-evaluation-details-btn-${F}-${D}`,onClick:()=>{j({...B,interview:z}),g(!0)},children:"View Detailed Feedback"})]}):B.feedbackDetails&&B.feedbackDetails.length>0?e.jsx(se,{variant:"link",className:"p-0 h-auto font-normal text-blue-600","data-testid":`onboarding-interview-evaluation-details-btn-${F}-${D}`,onClick:()=>{j({...B,interview:z}),g(!0)},children:"View Detailed Feedback"}):B.qualitativeFeedback||"-"}),e.jsx(de,{"data-testid":`onboarding-interview-evaluation-rec-${F}-${D}`,children:B.recommendation||"-"})]},B.id)})})]}):e.jsx("p",{className:"text-sm text-slate-500 italic pl-2",children:"No feedback recorded yet."})]},z.id))]}),["Level 2 Approved","Level 3 Interview Pending","Approved","Onboarded"].includes(s.status)&&e.jsxs("div",{"data-testid":"onboarding-interviews-summary-l2",children:[e.jsx("h3",{className:"text-slate-900 mb-4",children:"Level 2 Interview Summary"}),e.jsxs("div",{className:"p-4 bg-slate-50 rounded-lg",children:[e.jsx("p",{className:"text-slate-600",children:"Decision: Approved by both ZBH and DD Lead"}),e.jsx("p",{className:"text-slate-600 mt-2",children:"Overall Assessment: Strong candidate with excellent business plan"})]})]})]}),e.jsx(Gt,{value:"fdd",className:"space-y-6","data-testid":"onboarding-tab-content-fdd",children:y()}),e.jsxs(Gt,{value:"eor",className:"space-y-4","data-testid":"onboarding-tab-content-eor",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-slate-900",children:"Essential Operating Requirements"}),e.jsxs(Ae,{className:"bg-amber-600","data-testid":"onboarding-eor-progress-badge",children:[Math.round(N),"% Complete"]})]}),e.jsx(ji,{value:N,className:"h-3 mb-6","data-testid":"onboarding-eor-progress-bar"}),e.jsx("div",{className:"space-y-3","data-testid":"onboarding-eor-checklist",children:((S==null?void 0:S.items)||C).map((z,F)=>{const B=z.description||z.item,D=!!z.proofDocument;return e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-xl transition-all border border-transparent hover:border-slate-200 group","data-testid":`onboarding-eor-item-${F}`,children:[e.jsx(Rn,{checked:z.isCompliant||z.completed,className:"pointer-events-none shrink-0","data-testid":`onboarding-eor-checkbox-${F}`}),e.jsxs("div",{className:"flex flex-col flex-1 min-w-0 cursor-pointer","data-testid":`onboarding-eor-clickable-${F}`,onClick:()=>{x(`EOR: ${B}`),w(B),f(!0),m(!D)},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:z.isCompliant||z.completed?"text-slate-900 font-bold":"text-slate-600 font-medium",children:B}),D&&!z.isCompliant&&e.jsx(Ae,{variant:"outline",className:"text-[10px] h-4 px-1.5 bg-amber-50 text-amber-600 border-amber-200 uppercase tracking-wider font-bold",children:"Needs Verification"})]}),D&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-blue-600 font-semibold mt-1",children:[e.jsx(fs,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"truncate",children:z.proofDocument.fileName})]}),!D&&e.jsx("span",{className:"text-[10px] text-slate-400 mt-1 uppercase tracking-tighter",children:"Click to upload proof"})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[D&&!z.isCompliant&&R&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(se,{size:"sm",className:"h-8 px-3 bg-green-600 hover:bg-green-700 text-white font-bold rounded-lg shadow-sm","data-testid":`onboarding-eor-verify-btn-${F}`,onClick:async()=>{await(await Tl(async()=>{const{eorService:O}=await Promise.resolve().then(()=>Gx);return{eorService:O}},void 0)).eorService.updateItem(S.id,{...z,isCompliant:!0}),A(),ee.success(`${B} verified!`)},children:"Verify"}),e.jsx(se,{size:"sm",variant:"outline",className:"h-8 px-3 border-red-200 text-red-600 hover:bg-red-50 font-bold rounded-lg","data-testid":`onboarding-eor-reject-btn-${F}`,onClick:async()=>{await(await Tl(async()=>{const{eorService:O}=await Promise.resolve().then(()=>Gx);return{eorService:O}},void 0)).eorService.updateItem(S.id,{...z,isCompliant:!1,proofDocumentId:null}),A(),ee.success(`${B} rejected.`)},children:"Reject"})]}),(z.isCompliant||z.completed)&&e.jsx("div",{className:"bg-green-100 p-1.5 rounded-full","data-testid":`onboarding-eor-done-icon-${F}`,children:e.jsx(Ys,{className:"w-4 h-4 text-green-600"})}),!D&&e.jsx("div",{className:"p-2 text-slate-300 group-hover:text-amber-500 transition-colors","data-testid":`onboarding-eor-upload-hint-${F}`,children:e.jsx(Dr,{className:"w-4 h-4"})})]})]},z.id)})}),N===100&&R&&(s.status==="EOR In Progress"||s.status==="LOA Pending")&&e.jsx("div",{className:"mt-8 p-6 bg-green-50 rounded-xl border-2 border-green-200 animate-in fade-in slide-in-from-bottom-4 duration-500","data-testid":"onboarding-eor-complete-banner",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-100 flex items-center justify-center shrink-0",children:e.jsx(Fl,{className:"w-7 h-7 text-green-600"})}),e.jsxs("div",{className:"flex-1 text-center sm:text-left",children:[e.jsx("h4",{className:"text-green-900 font-bold text-lg",children:"EOR Checklist Complete"}),e.jsx("p",{className:"text-green-700 text-sm",children:"All 12 mandatory requirements have been verified. You can now complete the audit and move to final inauguration."})]}),e.jsx(se,{className:"w-full sm:w-auto bg-green-600 hover:bg-green-700 text-white font-bold h-12 px-8 rounded-xl shadow-lg shadow-green-600/20 transition-all hover:scale-[1.02] active:scale-[0.98]","data-testid":"onboarding-eor-submit-audit",onClick:async()=>{try{const z=S==null?void 0:S.id;if(!z)throw new Error("Checklist ID not found");await(await Tl(async()=>{const{eorService:F}=await Promise.resolve().then(()=>Gx);return{eorService:F}},void 0)).eorService.submitAudit(z,{status:"Completed",overallComments:"EOR Checklist verified and audit completed."}),ee.success("EOR Audit completed successfully!"),P(),A()}catch(z){ee.error(z.message||"Failed to complete EOR audit")}},children:"Complete Audit & Proceed"})]})})]}),e.jsxs(Gt,{value:"payments",className:"space-y-6","data-testid":"onboarding-tab-content-payments",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Security Deposits"}),e.jsxs(Ae,{variant:"outline",className:"bg-slate-50 text-slate-500 border-slate-200","data-testid":"onboarding-payments-count-badge",children:[I.length," Payment Record(s)"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(()=>{const z=$("SECURITY_DEPOSIT"),F=T.SECURITY_DEPOSIT,B=(F==null?void 0:F.amount)||5e5;return e.jsx(Le,{className:Pt("border-l-4",(z==null?void 0:z.status)==="Verified"?"border-l-green-500":(z==null?void 0:z.status)==="Rejected"?"border-l-red-500":"border-l-amber-500"),"data-testid":"onboarding-payment-card-security",children:e.jsxs(Me,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-amber-50 flex items-center justify-center text-amber-600",children:e.jsx(Fo,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-semibold text-slate-700",children:"Security Deposit"})]}),e.jsx(Ae,{className:Pt((z==null?void 0:z.status)==="Verified"?"bg-green-100 text-green-700 hover:bg-green-100":(z==null?void 0:z.status)==="Rejected"?"bg-red-100 text-red-700 hover:bg-red-100":"bg-amber-100 text-amber-700 hover:bg-amber-100"),"data-testid":"onboarding-payment-status-security",children:(z==null?void 0:z.status)||"Awaiting"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-baseline",children:[e.jsx("span",{className:"text-xs text-slate-500 uppercase font-bold tracking-wider",children:"Amount Received"}),e.jsxs("span",{className:"text-lg font-bold text-slate-900","data-testid":"onboarding-payment-amount-security",children:["₹",Number((z==null?void 0:z.amount)||0).toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-baseline border-t border-slate-100 pt-2",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Expected Total"}),e.jsxs("span",{className:"text-sm font-medium text-slate-600",children:["₹",B.toLocaleString()]})]}),(z==null?void 0:z.paymentReference)&&e.jsxs("div",{className:"bg-slate-50 p-2 rounded text-xs font-mono text-slate-600 flex justify-between items-center","data-testid":"onboarding-payment-ref-security",children:[e.jsxs("span",{children:["Ref: ",z.paymentReference]}),z.verifiedAt&&e.jsx("span",{children:Ht(z.verifiedAt)})]}),(z==null?void 0:z.remarks)&&e.jsxs("div",{className:"text-[11px] text-slate-500 bg-red-50/50 p-2 rounded border border-red-100 italic","data-testid":"onboarding-payment-remarks-security",children:['"',z.remarks,'"']}),e.jsxs("div",{className:"pt-4 mt-2 border-t border-slate-100",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2",children:"Verification Documents"}),e.jsxs("div",{className:"space-y-2",children:[l.filter(D=>{var O,V;return((O=D.documentType)==null?void 0:O.toLowerCase().includes("security"))&&((V=D.documentType)==null?void 0:V.toLowerCase().includes("deposit"))}).map((D,O)=>e.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-slate-50/50 border border-slate-100","data-testid":`onboarding-payment-doc-security-${O}`,children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx(fs,{className:"w-3 h-3 text-slate-400"}),e.jsx("span",{className:"text-[10px] font-medium text-slate-700 truncate",children:D.fileName||D.name})]}),e.jsx(se,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px] text-amber-600 hover:text-amber-700 hover:bg-amber-50","data-testid":`onboarding-payment-doc-view-security-${O}`,onClick:()=>{E(D),_(!0)},children:"View"})]},O)),l.filter(D=>{var O,V;return((O=D.documentType)==null?void 0:O.toLowerCase().includes("security"))&&((V=D.documentType)==null?void 0:V.toLowerCase().includes("deposit"))}).length===0&&e.jsx("p",{className:"text-[10px] text-slate-400 italic",children:"No proof uploaded"})]})]})]})]})})})(),(()=>{const z=$("FIRST_FILL"),F=T.FIRST_FILL,B=(F==null?void 0:F.amount)||15e5;return e.jsx(Le,{className:Pt("border-l-4",(z==null?void 0:z.status)==="Verified"?"border-l-green-500":(z==null?void 0:z.status)==="Rejected"?"border-l-red-500":"border-l-amber-500"),"data-testid":"onboarding-payment-card-first-fill",children:e.jsxs(Me,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-blue-50 flex items-center justify-center text-blue-600",children:e.jsx(Fl,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-semibold text-slate-700",children:"First Fill"})]}),e.jsx(Ae,{className:Pt((z==null?void 0:z.status)==="Verified"?"bg-green-100 text-green-700 hover:bg-green-100":(z==null?void 0:z.status)==="Rejected"?"bg-red-100 text-red-700 hover:bg-red-100":"bg-amber-100 text-amber-700 hover:bg-amber-100"),"data-testid":"onboarding-payment-status-first-fill",children:(z==null?void 0:z.status)||"Awaiting"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-baseline",children:[e.jsx("span",{className:"text-xs text-slate-500 uppercase font-bold tracking-wider",children:"Amount Received"}),e.jsxs("span",{className:"text-lg font-bold text-slate-900","data-testid":"onboarding-payment-amount-first-fill",children:["₹",Number((z==null?void 0:z.amount)||0).toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-baseline border-t border-slate-100 pt-2",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Expected Total"}),e.jsxs("span",{className:"text-sm font-medium text-slate-600",children:["₹",B.toLocaleString()]})]}),(z==null?void 0:z.paymentReference)&&e.jsxs("div",{className:"bg-slate-50 p-2 rounded text-xs font-mono text-slate-600 flex justify-between items-center","data-testid":"onboarding-payment-ref-first-fill",children:[e.jsxs("span",{children:["Ref: ",z.paymentReference]}),z.verifiedAt&&e.jsx("span",{children:Ht(z.verifiedAt)})]}),(z==null?void 0:z.remarks)&&e.jsxs("div",{className:"text-[11px] text-slate-500 bg-red-50/50 p-2 rounded border border-red-100 italic","data-testid":"onboarding-payment-remarks-first-fill",children:['"',z.remarks,'"']}),e.jsxs("div",{className:"pt-4 mt-2 border-t border-slate-100",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2",children:"Verification Documents"}),e.jsxs("div",{className:"space-y-2",children:[l.filter(D=>{var O,V;return((O=D.documentType)==null?void 0:O.toLowerCase().includes("first"))&&((V=D.documentType)==null?void 0:V.toLowerCase().includes("fill"))}).map((D,O)=>e.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-slate-50/50 border border-slate-100","data-testid":`onboarding-payment-doc-first-fill-${O}`,children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx(fs,{className:"w-3 h-3 text-slate-400"}),e.jsx("span",{className:"text-[10px] font-medium text-slate-700 truncate",children:D.fileName||D.name})]}),e.jsx(se,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px] text-blue-600 hover:text-blue-700 hover:bg-blue-50","data-testid":`onboarding-payment-doc-view-first-fill-${O}`,onClick:()=>{E(D),_(!0)},children:"View"})]},O)),l.filter(D=>{var O,V;return((O=D.documentType)==null?void 0:O.toLowerCase().includes("first"))&&((V=D.documentType)==null?void 0:V.toLowerCase().includes("fill"))}).length===0&&e.jsx("p",{className:"text-[10px] text-slate-400 italic",children:"No proof uploaded"})]})]})]})]})})})()]})]}),e.jsx(Gt,{value:"audit","data-testid":"onboarding-tab-content-audit",children:e.jsx(kb,{className:"h-[30rem] rounded-md border border-slate-100 bg-slate-50/50",children:e.jsx("div",{className:"space-y-2.5 p-3 pr-4","data-testid":"onboarding-audit-logs-container",children:M?e.jsxs("div",{className:"flex items-center justify-center py-10","data-testid":"onboarding-audit-loading",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-amber-600"}),e.jsx("span",{className:"ml-2 text-sm text-slate-500",children:"Loading audit trail…"})]}):q.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-slate-200 bg-white py-10 text-center text-sm text-slate-500","data-testid":"onboarding-audit-empty",children:"No audit logs recorded yet for this application."}):q.map((z,F)=>e.jsxs("div",{className:"rounded-lg border border-slate-200/90 bg-white p-3 text-sm shadow-sm","data-testid":`onboarding-audit-log-item-${F}`,children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-3 gap-y-1.5",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e.jsx(Ae,{variant:"outline",className:Pt("shrink-0 text-[10px] font-semibold uppercase tracking-wide",G(z.action)),"data-testid":`onboarding-audit-log-action-${F}`,children:String(z.action||"EVENT").replace(/_/g," ")}),z.stage?e.jsx("span",{className:"max-w-[200px] truncate text-[11px] text-slate-500",title:z.stage,"data-testid":`onboarding-audit-log-stage-${F}`,children:z.stage}):null]}),e.jsx("time",{className:"shrink-0 text-xs tabular-nums text-slate-400",dateTime:z.timestamp,"data-testid":`onboarding-audit-log-time-${F}`,children:Ht(z.timestamp)})]}),e.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-slate-800","data-testid":`onboarding-audit-log-desc-${F}`,children:z.description||"—"}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-slate-500",children:[e.jsx(kr,{className:"h-3.5 w-3.5 shrink-0 text-slate-400","aria-hidden":!0}),e.jsxs("span",{className:"min-w-0 truncate",children:[e.jsx("span",{className:"font-medium text-slate-600","data-testid":`onboarding-audit-log-user-${F}`,children:z.userName||"System"}),z.userEmail?e.jsxs("span",{className:"text-slate-400","data-testid":`onboarding-audit-log-email-${F}`,children:[" · ",z.userEmail]}):null]})]})]},z.id))})})})]})]})})}function Y7(t){var G;const{application:s,permissions:n,getDeposit:r,isNonResponsive:a,isAdmin:l,currentUserStageAction:c,currentUserEvaluation:d,onOpenApproveModal:h,onOpenRejectModal:x,onOpenWorknote:f,onOpenScheduleModal:m,currentUser:p,handleGenerateDealerCodes:u,onOpenAssignArchitectureModal:j,activeInterviewForUser:g,hasSubmittedFeedback:y,setSelectedInterviewForFeedback:N,setShowKTMatrixModal:S,setShowLevel2FeedbackModal:C,setShowLevel3FeedbackModal:w,onGoToDashboard:R,showAssignModal:P,setShowAssignModal:A,selectedUser:I,setSelectedUser:$,users:T,participantType:E,setParticipantType:_,handleAddParticipant:M,isAssigningParticipant:q}=t;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(Le,{"data-testid":"onboarding-details-summary-card",children:[e.jsx(tt,{children:e.jsx(nt,{children:"Summary"})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Registration ID"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-details-summary-reg-id",children:s.registrationNumber})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Current Status"}),e.jsx(Ae,{className:Pt("mt-1",s.status==="Onboarded"?"bg-green-600 hover:bg-green-700 text-white":s.status==="Rejected"?"bg-red-600":"bg-amber-600"),"data-testid":"onboarding-details-summary-status",children:s.status})]}),s.rank&&e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Rank"}),e.jsxs("p",{className:"text-slate-900","data-testid":"onboarding-details-summary-rank",children:[s.rank," of ",s.totalApplicantsAtLocation,e.jsxs("span",{className:"text-slate-500",children:[" in ",s.preferredLocation]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Progress"}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx(ji,{value:s.progress,className:"flex-1","data-testid":"onboarding-details-summary-progress-bar"}),e.jsxs("span",{className:"text-slate-900","data-testid":"onboarding-details-summary-progress-text",children:[s.progress,"%"]})]})]}),s.deadline&&e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Questionnaire Deadline"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-details-summary-deadline",children:Ht(s.deadline)})]})]})]}),(s.isShortlisted!==!1||s.status==="Submitted")&&e.jsxs(Le,{"data-testid":"onboarding-details-actions-card",children:[e.jsx(tt,{children:e.jsx(nt,{children:"Actions"})}),e.jsxs(Me,{className:"space-y-3",children:[n.isLoaLocked&&e.jsxs(mi,{variant:"destructive",className:"mb-4 bg-amber-50 border-amber-200 text-amber-800","data-testid":"onboarding-details-loa-locked-alert",children:[e.jsx(sv,{className:"w-4 h-4 text-amber-600"}),e.jsx(Hi,{className:"text-amber-900 font-semibold",children:"LOA approval locked"}),e.jsxs(fi,{className:"text-amber-800",children:[e.jsx("span",{className:"font-medium",children:"First Fill"})," (later-stage payment) must be verified by Finance before LOA approval can proceed. This is separate from the initial security deposit before LOI Issued."]})]}),((G=r("FIRST_FILL"))==null?void 0:G.status)==="Verified"&&s.status!=="LOA Pending"&&!["LOA Issued","EOR In Progress","EOR Complete","Inauguration","Approved","Onboarded","Rejected"].includes(s.status)&&e.jsxs(mi,{className:"mb-4 border-violet-200 bg-violet-50/90 text-violet-950","data-testid":"onboarding-details-first-fill-verified-alert",children:[e.jsx(Xa,{className:"h-4 w-4 text-violet-700"}),e.jsx(Hi,{className:"font-semibold",children:"First Fill verified on file"}),e.jsxs(fi,{className:"text-sm text-violet-900/90 leading-relaxed",children:["Finance has verified the ",e.jsx("span",{className:"font-medium",children:"First Fill"})," payment. The application status was ",e.jsx("span",{className:"font-medium",children:"not"})," changed until you reach"," ",e.jsx("span",{className:"font-medium",children:"LOA Pending"}),". When you get there, LOA approval will not be blocked by payment (same pattern as recording the initial security deposit before the LOI security step)."]})]}),n.isSecurityDetailsLocked&&e.jsxs(mi,{variant:"destructive",className:"mb-4 bg-amber-50 border-amber-200 text-amber-800","data-testid":"onboarding-details-security-locked-alert",children:[e.jsx(sv,{className:"w-4 h-4 text-amber-600"}),e.jsx(Hi,{className:"text-amber-900 font-semibold",children:"Security Details approval locked"}),e.jsxs(fi,{className:"text-amber-800",children:["Finance must verify the ",e.jsx("span",{className:"font-medium",children:"Security Deposit"})," before this stage can be approved. You can still use ",e.jsx("span",{className:"font-medium",children:"Reject"})," if needed."]})]}),["Security Details","Payment Pending"].includes(s.status)&&e.jsxs(mi,{className:"mb-4 border-sky-200 bg-sky-50/90 text-sky-900","data-testid":"onboarding-details-security-review-alert",children:[e.jsx(Xa,{className:"h-4 w-4 text-sky-700"}),e.jsx(Hi,{className:"text-sky-950 font-semibold",children:"Security Details review"}),e.jsxs(fi,{className:"text-sm text-sky-900/90 leading-relaxed",children:["Check the initial security deposit on the ",e.jsx("span",{className:"font-medium",children:"Payments"})," tab (Finance may have already marked it verified). When satisfied, use ",e.jsx("span",{className:"font-medium",children:"Approve"})," ","to move to ",e.jsx("span",{className:"font-medium",children:"LOI Issued"}),"."]})]}),a&&l&&e.jsxs(mi,{variant:"destructive",className:"mb-4 bg-red-50 border-red-200 text-red-800","data-testid":"onboarding-details-non-responsive-alert",children:[e.jsx(Ks,{className:"w-4 h-4 text-red-600"}),e.jsx(Hi,{className:"text-red-900 font-black uppercase tracking-tighter",children:"⚠️ Non-Responsive Flag"}),e.jsx(fi,{className:"text-red-800 text-xs font-bold leading-tight",children:"FDD Audit has flagged this applicant. Review audit logs before approval."})]}),l&&(s.status==="Level 3 Approved"||s.status==="FDD Verification")&&(!s.fddAssignments||s.fddAssignments.length===0)&&e.jsxs(mi,{className:"mb-4 bg-amber-50 border-amber-200 text-amber-800","data-testid":"onboarding-details-fdd-assignment-alert",children:[e.jsx(Ks,{className:"w-4 h-4 text-amber-600"}),e.jsx(Hi,{className:"text-amber-900 font-bold",children:"FDD Assignment Required"}),e.jsx(fi,{className:"text-amber-800 font-medium",children:"This application is pending financial due diligence. Please assign an FDD Agency to proceed with the audit."})]}),n.canApprove&&e.jsxs(se,{className:"w-full bg-green-600 hover:bg-green-700 font-bold",onClick:h,"data-testid":"onboarding-details-approve-button",children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"}),["Inauguration","Approved"].includes(s.status)?"Onboard Dealer":"Approve"]}),n.canReject&&e.jsxs(se,{variant:"destructive",className:"w-full font-bold",onClick:x,"data-testid":"onboarding-details-reject-button",children:[e.jsx(Za,{className:"w-4 h-4 mr-2"}),"Reject"]}),n.showDecisionMessage&&e.jsxs("div",{className:`w-full p-2 text-center rounded border ${(c==null?void 0:c.decision)==="Approved"||(d==null?void 0:d.decision)==="Approved"||(d==null?void 0:d.recommendation)==="Approved"||(d==null?void 0:d.decision)==="Selected"?"bg-green-50 border-green-200 text-green-700":"bg-red-50 border-red-200 text-red-700"}`,"data-testid":"onboarding-details-decision-message",children:["You have ",(c==null?void 0:c.decision)==="Approved"||(d==null?void 0:d.decision)==="Approved"||(d==null?void 0:d.recommendation)==="Approved"||(d==null?void 0:d.decision)==="Selected"?"Approved":"Rejected"]}),e.jsx(zd,{}),e.jsxs(se,{variant:"outline",className:"w-full",onClick:f,"data-testid":"onboarding-details-worknote-button",children:[e.jsx(zr,{className:"w-4 h-4 mr-2"}),"Work Note"]}),n.canSchedule&&e.jsxs(se,{variant:"outline",className:"w-full",onClick:m,"data-testid":"onboarding-details-schedule-button",children:[e.jsx($n,{className:"w-4 h-4 mr-2"}),"Schedule Interview"]}),p&&["DD Admin","Super Admin"].includes(p.role)&&["Dealer Code Generation","LOA Pending","Architecture Team Assigned","Architecture Document Upload","Architecture Team Completion"].includes(s.status)&&e.jsxs(e.Fragment,{children:[!s.dealerCode&&e.jsxs(se,{className:"w-full bg-blue-600 hover:bg-blue-700",onClick:u,"data-testid":"onboarding-details-generate-dealer-codes",children:[e.jsx(hw,{className:"w-4 h-4 mr-2"}),"Generate Dealer Codes"]}),s.dealerCode&&!s.architectureAssignedTo&&e.jsxs(se,{variant:"outline",className:"w-full border-blue-200 hover:bg-blue-50 text-blue-700",onClick:j,"data-testid":"onboarding-details-assign-architecture",children:[e.jsx(tv,{className:"w-4 h-4 mr-2"}),"Assign Architecture Team"]})]}),g&&!y&&e.jsxs(xb,{children:[e.jsx(gb,{asChild:!0,children:e.jsxs(se,{variant:"outline",className:"w-full","data-testid":"onboarding-details-feedback-dropdown-trigger",children:[e.jsx(mI,{className:"w-4 h-4 mr-2"}),"Interview Feedback",e.jsx(la,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(vb,{className:"w-56","data-testid":"onboarding-details-feedback-dropdown-content",children:e.jsxs(ck,{"data-testid":`onboarding-details-feedback-item-${g.id}`,onClick:()=>{N(g),g.level===1?S(!0):g.level===2?C(!0):w(!0)},children:["Level ",g.level," - ",g.interviewType]},g.id)})]}),s.status==="Questionnaire Pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{variant:"outline",className:"w-full","data-testid":"onboarding-details-send-reminder",children:[e.jsx(qr,{className:"w-4 h-4 mr-2"}),"Send Reminder"]}),e.jsxs(se,{variant:"outline",className:"w-full","data-testid":"onboarding-details-extend-deadline",children:[e.jsx(Js,{className:"w-4 h-4 mr-2"}),"Extend Deadline"]})]}),s.dealer&&e.jsxs("div",{className:"p-4 bg-green-50 border border-green-200 rounded-lg space-y-3","data-testid":"onboarding-details-dealer-active-banner",children:[e.jsxs("div",{className:"flex items-center gap-2 text-green-800 font-semibold",children:[e.jsx(Ys,{className:"w-5 h-5 text-green-600"}),"Dealer Profile Active"]}),e.jsx("div",{className:"text-sm text-green-700",children:"This application has been successfully onboarded as a dealer. A user account has been created for the dealer."}),s.dealerCode&&e.jsxs("div",{className:"flex items-center justify-between text-xs font-mono bg-white p-2 rounded border border-green-100","data-testid":"onboarding-details-active-dealer-code",children:[e.jsx("span",{className:"text-slate-500",children:"Dealer Code:"}),e.jsx("span",{className:"font-bold text-slate-900",children:s.dealerCode.code})]}),e.jsxs(se,{className:"w-full bg-green-600 hover:bg-green-700 text-white",onClick:R,"data-testid":"onboarding-details-goto-dashboard",children:[e.jsx(hw,{className:"w-4 h-4 mr-2"}),"Go to Dealer Dashboard"]})]}),p&&["DD Admin","Super Admin"].includes(p.role)&&e.jsxs(os,{open:P,onOpenChange:A,children:[e.jsx(Hl,{asChild:!0,children:e.jsxs(se,{variant:"outline",className:"w-full","data-testid":"onboarding-details-assign-user-trigger",children:[e.jsx(kr,{className:"w-4 h-4 mr-2"}),"Assign User"]})}),e.jsxs(ls,{"data-testid":"onboarding-details-assign-user-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Assign User to Application"}),e.jsx(vs,{children:"Select a user and their role for this application."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Select User"}),e.jsxs(wt,{value:I,onValueChange:$,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-details-assign-user-select",children:e.jsx(St,{placeholder:"Search users..."})}),e.jsx(At,{children:T.map(Z=>e.jsxs(Pe,{value:Z.id,children:[Z.fullName," (",Z.email,")"]},Z.id))})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Assignment Role"}),e.jsxs(wt,{value:E,onValueChange:_,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-details-assign-role-select",children:e.jsx(St,{placeholder:"Select role"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"owner",children:"Owner"}),e.jsx(Pe,{value:"contributor",children:"Contributor"}),e.jsx(Pe,{value:"reviewer",children:"Reviewer"})]})]})]}),e.jsx(se,{className:"w-full bg-amber-600 hover:bg-amber-700 font-bold h-11",onClick:M,disabled:q,"data-testid":"onboarding-details-assign-user-submit",children:q?"Assigning...":"Assign User"})]})]})]})]})]})]})}function Z7(t){const{application:s,fetchApplication:n,showApproveModal:r,setShowApproveModal:a,approvalRemark:l,setApprovalRemark:c,setApprovalFile:d,isApproving:h,handleApprove:x,showOnboardModal:f,setShowOnboardModal:m,isOnboarding:p,setIsOnboarding:u,showRejectModal:j,setShowRejectModal:g,rejectionReason:y,setRejectionReason:N,isRejecting:S,handleReject:C,showScheduleModal:w,setShowScheduleModal:R,showCancelInterviewModal:P,setShowCancelInterviewModal:A,setInterviewIdToCancel:I,isCancellingInterview:$,handleConfirmCancelInterview:T,interviewType:E,setInterviewType:_,interviewMode:M,setInterviewMode:q,interviewDate:G,setInterviewDate:Z,meetingLink:W,setMeetingLink:z,location:F,setLocation:B,isInterviewCompleted:D,isInterviewActive:O,users:V,selectedInterviewerId:K,setSelectedInterviewerId:Y,handleAddInterviewer:U,scheduledInterviewParticipants:X,handleRemoveInterviewer:ne,isScheduling:oe,handleScheduleInterview:re,showAssignArchitectureModal:ge,setShowAssignArchitectureModal:ve,architectureLeadId:Se,setArchitectureLeadId:We,isAssigningArchitecture:Ce,handleAssignArchitecture:fe,showArchitectureStatusModal:Ye,setShowArchitectureStatusModal:be,architectureStatus:_e,setArchitectureStatus:ke,architectureRemarks:qe,setArchitectureRemarks:Ve,isUpdatingArchitecture:dt,handleUpdateArchitectureStatus:xt}=t,ye=le=>{var Qe,rt;return(le==null?void 0:le.__stageRole)||((Qe=le==null?void 0:le.role)==null?void 0:Qe.roleName)||((rt=le==null?void 0:le.role)==null?void 0:rt.roleCode)||(le==null?void 0:le.roleCode)||(le==null?void 0:le.role)||"Panelist"};return e.jsxs(e.Fragment,{children:[e.jsx(os,{open:r,onOpenChange:a,children:e.jsxs(ls,{"data-testid":"onboarding-approve-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Approve Application"}),e.jsx(vs,{children:"Provide approval remarks and optionally attach supporting documents."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(ce,{children:["Remark ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(Fs,{placeholder:"Enter approval remarks...",value:l,onChange:le=>c(le.target.value),className:"mt-2",rows:4,"data-testid":"onboarding-approve-remark-textarea"})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Attach File (Optional)"}),e.jsx(ot,{type:"file",className:"mt-2",onChange:le=>d(le.target.files?le.target.files[0]:null),"data-testid":"onboarding-approve-file-input"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>a(!1),disabled:h,"data-testid":"onboarding-approve-cancel-button",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-green-600 hover:bg-green-700",onClick:x,disabled:h,"data-testid":"onboarding-approve-submit-button",children:h?e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}),"Approving..."]}):"Submit Approval"})]})]})]})}),e.jsx(os,{open:f,onOpenChange:m,children:e.jsxs(ls,{className:"max-w-md","data-testid":"onboarding-onboard-modal",children:[e.jsxs(ms,{children:[e.jsx("div",{className:"mx-auto w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mb-4",children:e.jsx(Ys,{className:"w-8 h-8 text-green-600"})}),e.jsx(us,{className:"text-center text-xl font-bold",children:"Finalize Onboarding"}),e.jsxs(vs,{className:"text-center pt-2",children:["You are about to officially onboard ",e.jsx("span",{className:"font-semibold text-slate-900",children:s.name})," as a Royal Enfield dealer."]})]}),e.jsxs("div",{className:"bg-slate-50 p-4 rounded-lg border border-slate-200 mt-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-1 bg-green-500 rounded-full p-0.5",children:e.jsx(Bn,{className:"w-3 h-3 text-white"})}),e.jsx("p",{className:"text-sm text-slate-600",children:"Official dealer profile will be created."})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-1 bg-green-500 rounded-full p-0.5",children:e.jsx(Bn,{className:"w-3 h-3 text-white"})}),e.jsxs("p",{className:"text-sm text-slate-600",children:["User account will be activated with role ",e.jsx("span",{className:"font-medium text-slate-900",children:"Dealer"}),"."]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-1 bg-green-500 rounded-full p-0.5",children:e.jsx(Bn,{className:"w-3 h-3 text-white"})}),e.jsx("p",{className:"text-sm text-slate-600",children:"Primary outlet will be registered in the system."})]})]}),e.jsxs("div",{className:"mt-6 flex flex-col gap-3",children:[e.jsx(se,{className:"w-full bg-green-600 hover:bg-green-700 h-11 text-lg font-semibold shadow-lg shadow-green-100","data-testid":"onboarding-onboard-confirm-button",onClick:async()=>{u(!0);try{await ds.createDealer({applicationId:s.id}),ee.success("Dealer profile and login account created successfully!"),m(!1),n()}catch{ee.error("Failed to create dealer profile")}finally{u(!1)}},disabled:p,children:p?e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"w-5 h-5 mr-2 animate-spin"}),"Processing Onboarding..."]}):"Confirm & Onboard Dealer"}),e.jsx(se,{variant:"ghost",className:"w-full text-slate-500 hover:text-slate-700",onClick:()=>m(!1),disabled:p,"data-testid":"onboarding-onboard-cancel-button",children:"Cancel"})]})]})}),e.jsx(os,{open:j,onOpenChange:g,children:e.jsxs(ls,{"data-testid":"onboarding-reject-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Reject Application"}),e.jsx(vs,{children:"Please provide a clear reason for rejecting this application."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(ce,{children:["Reason for Rejection ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(Fs,{placeholder:"Enter rejection reason...",value:y,onChange:le=>N(le.target.value),className:"mt-2",rows:4,"data-testid":"onboarding-reject-remark-textarea"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>g(!1),disabled:S,"data-testid":"onboarding-reject-cancel-button",children:"Cancel"}),e.jsx(se,{variant:"destructive",className:"flex-1",onClick:C,disabled:S,"data-testid":"onboarding-reject-submit-button",children:S?e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}),"Rejecting..."]}):"Confirm Rejection"})]})]})]})}),e.jsx(os,{open:w,onOpenChange:R,children:e.jsxs(ls,{"data-testid":"onboarding-schedule-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Schedule Interview"}),e.jsx(vs,{children:"Set up an interview session with the applicant and relevant team members."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Interview Type"}),e.jsxs(wt,{value:E,onValueChange:_,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-schedule-type-select",children:e.jsx(St,{placeholder:"Select interview type"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"level1",disabled:D(1)||O(1),children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("span",{children:"Level 1"}),D(1)&&e.jsx(Ys,{className:"w-4 h-4 text-green-500 ml-2 inline"}),O(1)&&e.jsx(Js,{className:"w-4 h-4 text-amber-500 ml-2 inline"})]})}),e.jsx(Pe,{value:"level2",disabled:!D(1)||D(2)||O(2),children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("span",{children:"Level 2"}),!D(1)&&e.jsx("span",{className:"text-[10px] text-slate-400 ml-2",children:"(Prerequisite: L1)"}),D(2)&&e.jsx(Ys,{className:"w-4 h-4 text-green-500 ml-2 inline"}),O(2)&&e.jsx(Js,{className:"w-4 h-4 text-amber-500 ml-2 inline"})]})}),e.jsx(Pe,{value:"level3",disabled:!D(2)||D(3)||O(3),children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("span",{children:"Level 3"}),!D(2)&&e.jsx("span",{className:"text-[10px] text-slate-400 ml-2",children:"(Prerequisite: L2)"}),D(3)&&e.jsx(Ys,{className:"w-4 h-4 text-green-500 ml-2 inline"}),O(3)&&e.jsx(Js,{className:"w-4 h-4 text-amber-500 ml-2 inline"})]})})]})]})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Interview Mode ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:M,onValueChange:q,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-schedule-mode-select",children:e.jsx(St,{placeholder:"Select interview mode"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"virtual",children:"Virtual"}),e.jsx(Pe,{value:"physical",children:"Physical"})]})]})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Date & Time ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{type:"datetime-local",className:"mt-2",value:G,onChange:le=>Z(le.target.value),"data-testid":"onboarding-schedule-date-input"})]}),M==="virtual"&&e.jsxs("div",{children:[e.jsx(ce,{children:"Meeting Link"}),e.jsx(ot,{placeholder:"https://meet.google.com/...",className:"mt-2",value:W,onChange:le=>z(le.target.value),"data-testid":"onboarding-schedule-link-input"})]}),M==="physical"&&e.jsxs("div",{children:[e.jsx(ce,{children:"Location"}),e.jsx(ot,{placeholder:"Enter interview location address",className:"mt-2",value:F,onChange:le=>B(le.target.value),"data-testid":"onboarding-schedule-location-input"})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Interviewers ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsxs(wt,{value:K,onValueChange:Y,children:[e.jsx(Ct,{className:"flex-1","data-testid":"onboarding-schedule-interviewer-select",children:e.jsx(St,{placeholder:"Select interviewer"})}),e.jsx(At,{children:V.map(le=>{var Qe;return e.jsxs(Pe,{value:le.id,children:[le.fullName||le.name," (",((Qe=le.role)==null?void 0:Qe.roleName)||le.roleCode,")"]},le.id)})})]}),e.jsx(se,{onClick:U,type:"button",variant:"secondary","data-testid":"onboarding-schedule-add-interviewer-button",children:"Add"})]}),X.length>0&&e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsx(ce,{className:"text-xs text-muted-foreground",children:"Selected Interviewers:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:X.map(le=>e.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-2 py-1 rounded text-sm","data-testid":`onboarding-schedule-participant-${le.id}`,children:[e.jsx("span",{children:le.fullName||le.name||"Unknown"}),e.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",ye(le),")"]}),e.jsx("button",{onClick:()=>ne(le.id),className:"text-muted-foreground hover:text-destructive","data-testid":`onboarding-schedule-remove-participant-${le.id}`,children:"×"})]},le.id))})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>R(!1),disabled:oe,"data-testid":"onboarding-schedule-cancel-button",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-amber-600 hover:bg-amber-700",onClick:re,disabled:oe,"data-testid":"onboarding-schedule-submit-button",children:oe?"Scheduling...":"Schedule"})]})]})]})}),e.jsx(os,{open:P,onOpenChange:le=>{A(le),le||I("")},children:e.jsxs(ls,{"data-testid":"onboarding-cancel-interview-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Cancel Interview"}),e.jsx(vs,{children:"Are you sure you want to cancel this interview?"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>{A(!1),I("")},disabled:$,"data-testid":"onboarding-cancel-interview-close",children:"No"}),e.jsx(se,{variant:"destructive",className:"flex-1",onClick:T,disabled:$,"data-testid":"onboarding-cancel-interview-confirm",children:$?"Cancelling...":"Yes, Cancel"})]})]})}),e.jsx(os,{open:ge,onOpenChange:ve,children:e.jsxs(ls,{"data-testid":"onboarding-architecture-assign-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Assign Architecture Team"}),e.jsx(vs,{children:"Select an architecture team lead for site planning and blueprints."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(ce,{children:["Select Architecture Lead ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:Se,onValueChange:We,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-architecture-lead-select",children:e.jsx(St,{placeholder:"Search users..."})}),e.jsxs(At,{children:[V.filter(le=>{var Qe;return le.roleCode==="ARCHITECTURE"||((Qe=le.role)==null?void 0:Qe.roleCode)==="ARCHITECTURE"||le.role==="Architecture"||le.role==="Architecture Team"}).map(le=>e.jsxs(Pe,{value:le.id,children:[le.fullName," (",le.email,")"]},le.id)),V.filter(le=>{var Qe;return le.roleCode==="ARCHITECTURE"||((Qe=le.role)==null?void 0:Qe.roleCode)==="ARCHITECTURE"||le.role==="Architecture"||le.role==="Architecture Team"}).length===0&&V.map(le=>e.jsxs(Pe,{value:le.id,children:[le.fullName," (",le.roleCode||le.role,")"]},le.id))]})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>ve(!1),disabled:Ce,"data-testid":"onboarding-architecture-assign-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-blue-600 hover:bg-blue-700",onClick:fe,disabled:Ce,"data-testid":"onboarding-architecture-assign-submit",children:Ce?"Assigning...":"Assign Team"})]})]})]})}),e.jsx(os,{open:Ye,onOpenChange:be,children:e.jsxs(ls,{"data-testid":"onboarding-architecture-status-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Update Architecture Status"}),e.jsx(vs,{children:"Mark the architectural work as completed and optionally add remarks."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(ce,{children:["Status ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:_e,onValueChange:ke,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-architecture-status-select",children:e.jsx(St,{placeholder:"Select status"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"COMPLETED",children:"Completed"}),e.jsx(Pe,{value:"REJECTED",children:"Rejected / Needs Revision"})]})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Remarks (Optional)"}),e.jsx(Fs,{placeholder:"Enter any planning or site-visit remarks...",value:qe,onChange:le=>Ve(le.target.value),className:"mt-2",rows:4,"data-testid":"onboarding-architecture-remarks-textarea"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>be(!1),disabled:dt,"data-testid":"onboarding-architecture-status-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-blue-600 hover:bg-blue-700",onClick:xt,disabled:dt,"data-testid":"onboarding-architecture-status-submit",children:dt?"Updating...":"Update Status"})]})]})]})})]})}function Q7(t){var Fe,Q,pe,Ne,Ee,it,st,bt;const{application:s,ktCriteria:n,l2Fields:r,l3Fields:a,showKTMatrixModal:l,setShowKTMatrixModal:c,ktMatrixSelectedValues:d,handleKTMatrixChange:h,ktMatrixRemarks:x,setKtMatrixRemarks:f,ktMatrixRecommendation:m,setKtMatrixRecommendation:p,calculateKTScore:u,handleSubmitKTMatrix:j,isSubmittingKT:g,showLevel2FeedbackModal:y,setShowLevel2FeedbackModal:N,level2Feedback:S,handleLevel2Change:C,level2Recommendation:w,setLevel2Recommendation:R,handleSubmitLevel2Feedback:P,isSubmittingLevel2:A,showFeedbackDetailsModal:I,setShowFeedbackDetailsModal:$,selectedEvaluationForView:T,selectedInterviewForFeedback:E,showLevel3FeedbackModal:_,setShowLevel3FeedbackModal:M,level3Feedback:q,handleLevel3Change:G,level3Recommendation:Z,setLevel3Recommendation:W,handleSubmitLevel3Feedback:z,isSubmittingLevel3:F,showDocumentsModal:B,setShowDocumentsModal:D,showUploadForm:O,setShowUploadForm:V,selectedStage:K,getDocumentsForStage:Y,setPreviewDoc:U,setShowPreviewModal:X,flattenedStages:ne,setSelectedStage:oe,uploadDocType:re,setUploadDocType:ge,setUploadFile:ve,isUploading:Se,handleUpload:We,uploadFile:Ce,documentConfigs:fe,showPreviewModal:Ye,previewDoc:be,showFddFinalizeModal:_e,setShowFddFinalizeModal:ke,currentUser:qe,fddAuditRecommendation:Ve,setFddAuditRecommendation:dt,fddAuditFindings:xt,setFddAuditFindings:ye,isFinalizingFdd:le,setIsFinalizingFdd:Qe,fetchApplication:rt,showFddFlagModal:Kt,setShowFddFlagModal:Rt,isFddFlagging:Re,setIsFddFlagging:Qt,showFirmTypeModal:qt,setShowFirmTypeModal:ws,tempFirmType:_s,setTempFirmType:ns,updatingFirmType:Cs,handleUpdateFirmType:Bs}=t,Ft=E!=null&&E.scheduleDate?new Date(E.scheduleDate).toISOString().split("T")[0]:"",ie=(qe==null?void 0:qe.fullName)||(qe==null?void 0:qe.name)||"";return e.jsxs(e.Fragment,{children:[e.jsx(os,{open:l,onOpenChange:c,children:e.jsxs(ls,{className:"flex min-h-0 max-h-[90vh] w-[calc(100%-2rem)] max-w-lg flex-col gap-0 overflow-hidden p-0 sm:max-w-lg","data-testid":"onboarding-kt-matrix-modal",children:[e.jsxs(ms,{className:"shrink-0 space-y-2 border-b px-5 py-4 text-left",children:[e.jsx(us,{className:"text-base",children:"KT matrix"}),e.jsxs(vs,{className:"text-sm leading-relaxed",children:["Level 1 interview · ",s.name,e.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:[Object.keys(d).length," of ",n.length," criteria answered"]})]})]}),e.jsx("div",{className:"custom-scrollbar-slim min-h-0 flex-1 overflow-y-auto px-5 py-5",children:e.jsxs("div",{className:"space-y-6",children:[n.length===0&&e.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800",children:"KT Matrix configuration is not available. Configure it in Master > Interview Configurations."}),n.map((Ue,Lt)=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{htmlFor:`kt-matrix-${Lt}`,className:"block text-sm font-medium leading-relaxed text-foreground",children:[e.jsxs("span",{className:"text-muted-foreground",children:[Lt+1,"."]})," ",Ue.name," ",e.jsx("span",{className:"text-red-500",children:"*"})," ",e.jsxs("span",{className:"font-normal text-muted-foreground",children:["(",Ue.weight,"%)"]})]}),e.jsxs(wt,{value:d[Ue.name]??void 0,onValueChange:ut=>{const yt=Ue.options.find(kt=>kt.value===ut);yt&&h(Ue.name,yt.value,yt.score)},children:[e.jsx(Ct,{id:`kt-matrix-${Lt}`,className:"h-10 w-full text-left text-sm font-normal","data-testid":`onboarding-kt-matrix-select-${Lt}`,children:e.jsx(St,{placeholder:"Choose an option…"})}),e.jsx(At,{position:"popper",className:"max-h-72 w-[var(--radix-select-trigger-width)]",children:Ue.options.map(ut=>e.jsxs(Pe,{value:ut.value,className:"py-2.5 text-sm leading-snug","data-testid":`onboarding-kt-matrix-option-${Lt}-${ut.value}`,children:[ut.label," ",e.jsxs("span",{className:"text-muted-foreground",children:["(",ut.score,")"]})]},ut.value))})]})]},Ue.name)),e.jsxs("div",{className:"space-y-2 border-t border-border pt-6",children:[e.jsxs(ce,{htmlFor:"kt-matrix-remarks",className:"text-sm font-medium",children:["Notes ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),e.jsx(Fs,{id:"kt-matrix-remarks",placeholder:"Optional remarks…",className:"min-h-[96px] resize-y text-sm leading-relaxed",value:x,onChange:Ue=>f(Ue.target.value),"data-testid":"onboarding-kt-matrix-remarks-textarea"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"text-sm font-medium",children:["Recommendation ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:m,onValueChange:p,children:[e.jsx(Ct,{"data-testid":"onboarding-kt-matrix-recommendation-select",children:e.jsx(St,{placeholder:"Select recommendation"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"Approve",children:"Approve"}),e.jsx(Pe,{value:"Reject",children:"Reject"}),e.jsx(Pe,{value:"Hold",children:"Hold"})]})]})]})]})}),e.jsxs("div",{className:"flex shrink-0 flex-col gap-4 border-t px-5 py-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Weighted total ",e.jsx("span",{className:"font-semibold tabular-nums text-foreground","data-testid":"onboarding-kt-matrix-total-score",children:u()}),e.jsx("span",{className:"text-muted-foreground",children:" / 100"})]}),e.jsxs("div",{className:"flex gap-2 sm:shrink-0",children:[e.jsx(se,{variant:"outline",onClick:()=>c(!1),"data-testid":"onboarding-kt-matrix-cancel",children:"Cancel"}),e.jsx(se,{onClick:j,disabled:g||n.length===0||Object.keys(d).lengthC("overallScore",Ue),children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-level2-overall-score-select",children:e.jsx(St,{placeholder:"Select score"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"10",children:"Outstanding (9-10)"}),e.jsx(Pe,{value:"8",children:"Excellent (7-8)"}),e.jsx(Pe,{value:"6",children:"Good (5-6)"}),e.jsx(Pe,{value:"4",children:"Average (3-4)"}),e.jsx(Pe,{value:"2",children:"Below Average (1-2)"})]})]})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Recommendation ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:w,onValueChange:R,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-level2-recommendation-select",children:e.jsx(St,{placeholder:"Select recommendation"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"Approve",children:"Approve"}),e.jsx(Pe,{value:"Reject",children:"Reject"}),e.jsx(Pe,{value:"Hold",children:"Hold"})]})]})]}),e.jsx(zd,{}),r.length===0&&e.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800",children:"Level 2 feedback configuration is not available. Configure it in Master > Interview Configurations."}),(r||[]).map((Ue,Lt)=>e.jsxs("div",{children:[e.jsxs(ce,{children:[Ue.label,Ue.isRequired&&e.jsx("span",{className:"text-red-500",children:"*"})]}),Ue.type==="select"?e.jsxs(wt,{value:S[Ue.itemKey]||"",onValueChange:ut=>C(Ue.itemKey,ut),children:[e.jsx(Ct,{className:"mt-2",children:e.jsx(St,{placeholder:`Select ${Ue.label}...`})}),e.jsx(At,{children:(Ue.options||[]).map((ut,yt)=>e.jsx(Pe,{value:ut.optionValue||ut.value,children:ut.optionLabel||ut.label},yt))})]}):Ue.type==="number"?e.jsx(ot,{type:"number",className:"mt-2",value:S[Ue.itemKey]||"",onChange:ut=>C(Ue.itemKey,ut.target.value)}):e.jsx(Fs,{placeholder:`Enter ${Ue.label.toLowerCase()}...`,className:"mt-2",rows:3,value:S[Ue.itemKey]||"",onChange:ut=>C(Ue.itemKey,ut.target.value)})]},Ue.itemKey||Lt)),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>N(!1),"data-testid":"onboarding-level2-feedback-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-black hover:bg-zinc-800 text-white",onClick:P,disabled:A||r.length===0,"data-testid":"onboarding-level2-feedback-submit",children:A?"Submitting...":"Submit Feedback"})]})]})]})}),e.jsx(os,{open:I,onOpenChange:$,children:e.jsxs(ls,{className:"max-w-2xl max-h-[90vh] overflow-y-auto","data-testid":"onboarding-feedback-details-modal",children:[e.jsx(ms,{children:e.jsx(us,{children:"Interview Feedback Details"})}),T&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 bg-slate-50 p-4 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-slate-500",children:"Interviewer"}),e.jsx("p",{className:"font-semibold","data-testid":"onboarding-feedback-details-interviewer",children:(Fe=T.evaluator)==null?void 0:Fe.fullName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-slate-500",children:"Role"}),e.jsx("p",{"data-testid":"onboarding-feedback-details-role",children:((pe=(Q=T.evaluator)==null?void 0:Q.role)==null?void 0:pe.roleName)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-slate-500",children:((Ne=T.interview)==null?void 0:Ne.level)===1?"Score (KT Matrix)":"Overall Score"}),e.jsx("p",{className:"font-bold text-lg","data-testid":"onboarding-feedback-details-score",children:T.ktMatrixScore?`${T.ktMatrixScore}/${((Ee=T.interview)==null?void 0:Ee.level)===1?"100":"10"}`:"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-slate-500",children:"Recommendation"}),e.jsx(Ae,{variant:(it=T.recommendation)!=null&&it.toLowerCase().includes("reject")?"destructive":(st=T.recommendation)!=null&&st.toLowerCase().includes("hold")?"secondary":"default","data-testid":"onboarding-feedback-details-recommendation",children:T.recommendation||"N/A"})]})]}),e.jsx(zd,{}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-3",children:"Detailed Feedback"}),((bt=T.feedbackDetails)==null?void 0:bt.length)>0?e.jsx("div",{className:"space-y-4",children:T.feedbackDetails.map((Ue,Lt)=>e.jsxs("div",{className:"border-b last:border-0 pb-3 last:pb-0","data-testid":`onboarding-feedback-detail-item-${Lt}`,children:[e.jsx("p",{className:"font-medium text-slate-900",children:Ue.feedbackType}),e.jsx("p",{className:"text-slate-700 mt-1 whitespace-pre-wrap text-sm",children:Ue.comments})]},Lt))}):e.jsx("p",{className:"text-slate-500 italic",children:"No detailed feedback available."})]})]})]})}),e.jsx(os,{open:_,onOpenChange:M,children:e.jsxs(ls,{className:"max-w-2xl max-h-[90vh] overflow-y-auto","data-testid":"onboarding-level3-feedback-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Level 3 Interview Feedback"}),e.jsx(vs,{children:"Provide detailed feedback from the Level 3 interview (NBH + DD-Head evaluation)."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(ce,{children:["Interview Date ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{type:"date",className:"mt-2",value:q.interviewDate||Ft,disabled:!0})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Interviewer Name ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{placeholder:"Enter your name",className:"mt-2",value:q.interviewerName||ie,disabled:!0})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Overall Performance Score ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:q.overallScore,onValueChange:Ue=>G("overallScore",Ue),children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-level3-overall-score-select",children:e.jsx(St,{placeholder:"Select score"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"10",children:"Outstanding (9-10)"}),e.jsx(Pe,{value:"8",children:"Excellent (7-8)"}),e.jsx(Pe,{value:"6",children:"Good (5-6)"}),e.jsx(Pe,{value:"4",children:"Average (3-4)"}),e.jsx(Pe,{value:"2",children:"Below Average (1-2)"})]})]})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Recommendation ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:Z,onValueChange:W,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-level3-recommendation-select",children:e.jsx(St,{placeholder:"Select recommendation"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"Approve",children:"Approve"}),e.jsx(Pe,{value:"Reject",children:"Reject"}),e.jsx(Pe,{value:"Hold",children:"Hold"})]})]})]}),e.jsx(zd,{}),a.length===0&&e.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800",children:"Level 3 feedback configuration is not available. Configure it in Master > Interview Configurations."}),(a||[]).map((Ue,Lt)=>e.jsxs("div",{children:[e.jsxs(ce,{children:[Ue.label,Ue.isRequired&&e.jsx("span",{className:"text-red-500",children:"*"})]}),Ue.type==="select"?e.jsxs(wt,{value:q[Ue.itemKey]||"",onValueChange:ut=>G(Ue.itemKey,ut),children:[e.jsx(Ct,{className:"mt-2",children:e.jsx(St,{placeholder:`Select ${Ue.label}...`})}),e.jsx(At,{children:(Ue.options||[]).map((ut,yt)=>e.jsx(Pe,{value:ut.optionValue||ut.value,children:ut.optionLabel||ut.label},yt))})]}):Ue.type==="number"?e.jsx(ot,{type:"number",className:"mt-2",value:q[Ue.itemKey]||"",onChange:ut=>G(Ue.itemKey,ut.target.value)}):e.jsx(Fs,{placeholder:`Enter ${Ue.label.toLowerCase()}...`,className:"mt-2",rows:3,value:q[Ue.itemKey]||"",onChange:ut=>G(Ue.itemKey,ut.target.value)})]},Ue.itemKey||Lt)),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>M(!1),"data-testid":"onboarding-level3-feedback-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-black hover:bg-zinc-800 text-white",onClick:z,disabled:F||a.length===0,"data-testid":"onboarding-level3-feedback-submit",children:F?"Submitting...":"Submit Feedback"})]})]})]})}),e.jsx(os,{open:B,onOpenChange:Ue=>{D(Ue),Ue||V(!1)},children:e.jsxs(ls,{className:"max-w-[95vw] sm:max-w-2xl md:max-w-3xl lg:max-w-4xl max-h-[90vh] overflow-hidden flex flex-col p-4 sm:p-6","data-testid":"onboarding-documents-modal",children:[e.jsxs(ms,{className:"pb-4",children:[e.jsxs(us,{className:"text-xl font-bold flex items-center gap-2",children:[e.jsx(fs,{className:"w-5 h-5 text-amber-600"}),"Documents - ",K||"General"]}),e.jsx(vs,{className:"text-slate-500",children:"View and manage documents uploaded for this stage."})]}),O?e.jsxs("div",{className:"space-y-6 py-4","data-testid":"onboarding-documents-upload-form",children:[e.jsxs("div",{className:"grid gap-6 bg-slate-50/50 p-4 sm:p-6 rounded-2xl border border-slate-200",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"text-slate-700 font-semibold px-1",children:["Stage context ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:K||"null",onValueChange:Ue=>oe(Ue==="null"?null:Ue),children:[e.jsx(Ct,{className:"bg-white border-slate-200 h-11 rounded-xl focus:ring-amber-500 shadow-sm","data-testid":"onboarding-documents-stage-select",children:e.jsx(St,{placeholder:"Select stage"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"null",children:"General / No Stage"}),ne.map((Ue,Lt)=>e.jsx(Pe,{value:Ue.name,children:Ue.parentBranch?`${Ue.parentBranch}: ${Ue.name}`:Ue.name},`${Ue.name}-${Lt}`))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"text-slate-700 font-semibold px-1",children:["Document Type ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:re,onValueChange:ge,children:[e.jsx(Ct,{className:"bg-white border-slate-200 h-11 rounded-xl focus:ring-amber-500 shadow-sm","data-testid":"onboarding-documents-type-select",children:e.jsx(St,{placeholder:"Select type"})}),e.jsx(At,{children:(()=>{const Ue=["Other"],Lt=fe.filter(yt=>{var _t;const kt=(_t=yt.stageCode)==null?void 0:_t.trim(),Ie=(K||"General").trim();return!!(kt===Ie||Ie.startsWith("EOR:")&&kt==="EOR"||!K&&kt==="General")});let ut=[];if(Lt.length>0?ut=Lt.map(yt=>yt.documentType):!K||K==="General"?ut=["PAN Card","GST Certificate","Aadhaar Card","Passport Size Photograph","Partnership Deed","LLP Agreement","Certificate of Incorporation","Board Resolution","Firm Registration Certificate","Cancelled Check","Bank Statement","Other"]:K!=null&&K.toLowerCase().includes("architecture")?ut=["Architecture Blueprint","Site Plan","Proposed Site City Map","Site Readiness Report","Architecture Completion Certificate","Other"]:K!=null&&K.toLowerCase().includes("fdd")?ut=["FDD Final Audit Report","Bank Statement","Income Tax Returns (ITR)","CIBIL Report","Other"]:ut=Ue,K!=null&&K.startsWith("EOR: ")){const yt=K.replace("EOR: ","");ut.includes(yt)||(ut=[yt,...ut])}return Array.from(new Set(ut)).map((yt,kt)=>e.jsx(Pe,{value:yt,"data-testid":`onboarding-documents-type-option-${kt}`,children:yt},`${yt}-${kt}`))})()})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"text-slate-700 font-semibold px-1",children:["Select File ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{type:"file",className:"bg-white border-slate-200 h-12 rounded-xl focus:ring-amber-500 shadow-sm file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-amber-50 file:text-amber-700 hover:file:bg-amber-100 cursor-pointer",onChange:Ue=>ve(Ue.target.files?Ue.target.files[0]:null),"data-testid":"onboarding-documents-file-input"})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-4",children:[e.jsx(se,{className:"flex-1 order-2 sm:order-1 py-3 sm:py-5 rounded-xl border-slate-200 font-semibold text-slate-600 hover:bg-slate-50",variant:"outline",onClick:()=>V(!1),disabled:Se,"data-testid":"onboarding-documents-upload-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 order-1 sm:order-2 bg-amber-600 hover:bg-amber-700 text-white font-bold py-3 sm:py-5 rounded-xl shadow-lg shadow-amber-600/15 transition-all hover:scale-[1.01] active:scale-[0.99]",onClick:async()=>{await We(),V(!1)},disabled:!Ce||!re||Se,"data-testid":"onboarding-documents-upload-submit",children:Se?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Uploading..."]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Dr,{className:"w-5 h-5"}),"Confirm Upload"]})})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 space-y-4",children:[Y(K||"").length>0?e.jsx("div",{className:"flex-1 overflow-auto border rounded-lg border-slate-200","data-testid":"onboarding-documents-table-container",children:e.jsxs(ks,{className:"w-full table-auto",children:[e.jsx(Rs,{className:"bg-slate-50/80 sticky top-0 z-10",children:e.jsxs(ct,{className:"hover:bg-transparent border-b",children:[e.jsx(me,{className:"w-[45%] min-w-[150px] font-semibold text-slate-900 py-3",children:"Document Name"}),e.jsx(me,{className:"w-[15%] min-w-[100px] font-semibold text-slate-900 py-3",children:"Type"}),e.jsx(me,{className:"w-[15%] min-w-[100px] font-semibold text-slate-900 py-3",children:"Upload Date"}),e.jsx(me,{className:"w-[15%] min-w-[140px] font-semibold text-slate-900 py-3",children:"Uploaded By"}),e.jsx(me,{className:"text-right w-[10%] min-w-[80px] font-semibold text-slate-900 py-3",children:"Actions"})]})}),e.jsx(Es,{children:Y(K||"").map((Ue,Lt)=>{var ut,yt;return e.jsxs(ct,{className:"hover:bg-slate-50/50 transition-colors","data-testid":`onboarding-document-row-${Lt}`,children:[e.jsx(de,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(fs,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsx("span",{className:"truncate font-medium text-slate-700",title:Ue.fileName,"data-testid":`onboarding-document-name-${Lt}`,children:Ue.fileName})]})}),e.jsx(de,{className:"py-3",children:e.jsx(Ae,{variant:"outline",className:"capitalize whitespace-nowrap font-normal border-slate-200 bg-white","data-testid":`onboarding-document-type-${Lt}`,children:((ut=Ue.documentType)==null?void 0:ut.toLowerCase())||"Other"})}),e.jsx(de,{className:"py-3 whitespace-nowrap text-slate-600",children:Ht(Ue.createdAt)}),e.jsx(de,{className:"py-3 text-slate-600",children:((yt=Ue.uploader)==null?void 0:yt.fullName)||(Ue.uploadedBy?"System User":"Applicant")}),e.jsx(de,{className:"text-right py-3",children:e.jsxs("div",{className:"flex gap-1 justify-end",children:[e.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 rounded-full",onClick:()=>{U(Ue),X(!0)},"data-testid":`onboarding-document-preview-${Lt}`,children:e.jsx(nn,{className:"w-4 h-4"})}),e.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-amber-600 hover:bg-amber-50 rounded-full",onClick:()=>{window.open(`https://dealeronboarding-uat.royalenfield.com/api/${Ue.filePath}`,"_blank")},"data-testid":`onboarding-document-download-${Lt}`,children:e.jsx(Ni,{className:"w-4 h-4"})})]})})]},Ue.id)})})]})}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-center border rounded-lg bg-slate-50/30","data-testid":"onboarding-documents-empty",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-slate-100 flex items-center justify-center mb-4",children:e.jsx(fs,{className:"w-8 h-8 text-slate-300"})}),e.jsx("h3",{className:"text-slate-900 font-semibold mb-2",children:"No Documents Found"}),e.jsx("p",{className:"text-slate-600 text-sm max-w-[250px]",children:"No documents have been uploaded for this stage yet."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-2 mt-auto",children:[e.jsxs(se,{className:"flex-1 bg-amber-600 hover:bg-amber-700 text-white font-bold py-3 sm:py-5 rounded-xl shadow-lg shadow-amber-600/15 transition-all hover:scale-[1.01] active:scale-[0.99]",onClick:()=>V(!0),"data-testid":"onboarding-documents-upload-button",children:[e.jsx(Dr,{className:"w-5 h-5 mr-3"}),"Upload Document"]}),e.jsx(se,{variant:"outline",className:"flex-1 sm:flex-none py-3 sm:py-5 px-8 rounded-xl border-slate-200 font-semibold text-slate-600 hover:bg-slate-50",onClick:()=>D(!1),"data-testid":"onboarding-documents-close-button",children:"Close"})]})]})]})}),e.jsx(Kl,{isOpen:Ye,onClose:()=>X(!1),document:be}),e.jsx(os,{open:_e,onOpenChange:ke,children:e.jsxs(ls,{className:"max-w-md p-0 overflow-hidden border-none shadow-2xl rounded-3xl","data-testid":"onboarding-fdd-finalize-modal",children:[e.jsxs("div",{className:"bg-slate-950 p-8 flex items-center justify-center relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-600/20 to-transparent"}),e.jsx("div",{className:"w-20 h-20 bg-amber-600/20 rounded-full flex items-center justify-center animate-pulse relative z-10 shadow-[0_0_40px_rgba(245,158,11,0.2)]",children:e.jsx(Fl,{className:"w-10 h-10 text-amber-500"})})]}),e.jsxs("div",{className:"p-8 space-y-6 bg-white",children:[e.jsxs(ms,{children:[e.jsx(us,{className:"text-2xl font-black text-slate-900 text-center tracking-tight",children:"Finalize FDD Audit"}),e.jsxs(vs,{className:"text-slate-500 text-center pt-2 leading-relaxed text-sm font-medium",children:["You are about to submit your final findings. This action will ",e.jsx("span",{className:"font-bold text-slate-900 underline decoration-amber-500 decoration-2",children:"lock the audit session"})," and trigger the LOI approval workflow."]})]}),e.jsxs("div",{className:"space-y-4",children:[(qe==null?void 0:qe.role)!=="FDD"&&(qe==null?void 0:qe.roleCode)!=="FDD"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:["Auditor Recommendation ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("div",{className:"flex gap-2",children:["Recommended","Qualified with Observations","Not Recommended"].map(Ue=>e.jsx(se,{variant:Ve===Ue?"default":"outline",className:Pt("flex-1 h-10 font-bold text-[9px] uppercase tracking-wider rounded-xl transition-all",Ve===Ue&&Ue==="Recommended"&&"bg-emerald-600 hover:bg-emerald-700",Ve===Ue&&Ue==="Qualified with Observations"&&"bg-amber-500 hover:bg-amber-600",Ve===Ue&&Ue==="Not Recommended"&&"bg-red-600 hover:bg-red-700"),onClick:()=>dt(Ue),"data-testid":`onboarding-fdd-recommendation-${Ue.replace(/\s+/g,"-").toLowerCase()}`,children:Ue},Ue))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:"Findings Summary"}),e.jsx(Fs,{placeholder:"Summarize key financial findings or discrepancies...",className:"min-h-[100px] rounded-xl border-slate-200 focus:ring-amber-500 text-sm",value:xt,onChange:Ue=>ye(Ue.target.value),"data-testid":"onboarding-fdd-findings-textarea"})]})]}),e.jsxs("div",{className:"bg-amber-50 p-4 rounded-2xl flex gap-3 border border-amber-100",children:[e.jsx(Xa,{className:"w-5 h-5 text-amber-600 shrink-0 mt-0.5"}),e.jsx("p",{className:"text-[11px] text-amber-800 font-medium italic",children:"Ensure the final PDF report is uploaded first. This satisfies the FDD statutory requirement."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-2",children:[e.jsx(se,{variant:"outline",className:"w-full sm:flex-1 h-12 rounded-2xl font-bold text-slate-600 hover:bg-slate-50 border-slate-200",onClick:()=>ke(!1),disabled:le,"data-testid":"onboarding-fdd-finalize-cancel",children:"Cancel"}),e.jsx(se,{className:"w-full sm:flex-1 h-12 rounded-2xl font-bold bg-slate-950 hover:bg-slate-900 text-white shadow-lg shadow-slate-200 transition-all active:scale-95 border-b-4 border-amber-500",disabled:le||!xt,"data-testid":"onboarding-fdd-finalize-submit",onClick:async()=>{try{Qe(!0),await ds.submitStageDecision({applicationId:s.id,stageCode:"FDD_VERIFICATION",decision:"Approved",remarks:(qe==null?void 0:qe.role)==="FDD"||(qe==null?void 0:qe.roleCode)==="FDD"?`Findings: ${xt}`:`[RECOMMENDATION: ${Ve}] -Findings: ${xt}`,nextStatus:"LOI In Progress",nextProgress:65}),ee.success("FDD Audit finalized and submitted."),ke(!1),rt()}catch{ee.error("Submission failed")}finally{Qe(!1)}},children:le?e.jsx(ss,{className:"w-5 h-5 animate-spin"}):"Confirm & Submit"})]})]})]})}),e.jsx(os,{open:Kt,onOpenChange:Rt,children:e.jsxs(ls,{className:"max-w-md p-0 overflow-hidden border-none shadow-2xl rounded-3xl","data-testid":"onboarding-fdd-flag-modal",children:[e.jsxs("div",{className:"bg-slate-950 p-8 flex items-center justify-center relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-600/20 to-transparent"}),e.jsx("div",{className:"w-20 h-20 bg-red-600/20 rounded-full flex items-center justify-center relative z-10 shadow-[0_0_40px_rgba(220,38,38,0.2)]",children:e.jsx(Xv,{className:"w-10 h-10 text-red-500"})})]}),e.jsxs("div",{className:"p-8 space-y-6 bg-white text-center",children:[e.jsxs(ms,{children:[e.jsx(us,{className:"text-2xl font-black text-slate-900 tracking-tight",children:"Flag Non-Responsive"}),e.jsx(vs,{className:"text-slate-500 pt-2 leading-relaxed text-sm font-medium",children:"Are you sure you want to flag this applicant? This will notify the DD Admin that the audit cannot proceed due to applicant's non-cooperation."})]}),e.jsxs("div",{className:"bg-red-50 p-4 rounded-2xl flex gap-3 border border-red-100",children:[e.jsx(Ks,{className:"w-5 h-5 text-red-600 shrink-0 mt-0.5"}),e.jsx("p",{className:"text-[11px] text-red-800 text-left font-medium",children:'"Applicant is unresponsive to multiple queries and financial document requests."'})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-2",children:[e.jsx(se,{variant:"outline",className:"w-full sm:flex-1 h-12 rounded-2xl font-bold text-slate-600 hover:bg-slate-50 border-slate-200",onClick:()=>Rt(!1),disabled:Re,"data-testid":"onboarding-fdd-flag-cancel",children:"Go Back"}),e.jsx(se,{className:"w-full sm:flex-1 h-12 rounded-2xl font-bold bg-slate-950 hover:bg-slate-900 text-white shadow-lg shadow-slate-200 transition-all active:scale-95 border-b-4 border-red-600",disabled:Re,"data-testid":"onboarding-fdd-flag-submit",onClick:async()=>{try{Qt(!0),await ds.submitStageDecision({applicationId:s.id,stageCode:"FDD_VERIFICATION",decision:"Rejected",remarks:"Applicant is non-responsive to FDD queries."}),ee.error("Applicant flagged as non-responsive."),Rt(!1),rt()}catch{ee.error("Action failed")}finally{Qt(!1)}},children:Re?e.jsx(ss,{className:"w-5 h-5 animate-spin"}):"Confirm Flag"})]})]})]})}),e.jsx(os,{open:qt,onOpenChange:ws,children:e.jsxs(ls,{className:"max-w-md p-0 overflow-hidden rounded-3xl border-none shadow-2xl","data-testid":"onboarding-firm-type-modal",children:[e.jsxs("div",{className:"bg-amber-600 p-8 text-white",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-white/20 flex items-center justify-center mb-6 backdrop-blur-sm border border-white/30 shadow-inner",children:e.jsx(Ml,{className:"w-8 h-8 text-white"})}),e.jsx("h3",{className:"text-2xl font-black tracking-tight mb-2",children:"Update Firm Type"}),e.jsx("p",{className:"text-amber-100/80 text-sm font-medium leading-relaxed",children:"Select the proposed legal constitution for this dealership application."})]}),e.jsxs("div",{className:"p-8 space-y-6 bg-white",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"text-[10px] text-slate-400 uppercase tracking-widest font-black",children:["Proposed Legal Constitution ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:_s,onValueChange:ns,children:[e.jsx(Ct,{className:"h-12 rounded-xl border-slate-200 focus:ring-amber-500","data-testid":"onboarding-firm-type-select",children:e.jsx(St,{placeholder:"Select Firm Type"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"Proprietorship","data-testid":"onboarding-firm-type-proprietorship",children:"Proprietorship"}),e.jsx(Pe,{value:"Partnership","data-testid":"onboarding-firm-type-partnership",children:"Partnership"}),e.jsx(Pe,{value:"Limited Liability partnership","data-testid":"onboarding-firm-type-llp",children:"LLP (Limited Liability partnership)"}),e.jsx(Pe,{value:"Private Limited Company","data-testid":"onboarding-firm-type-pvt-ltd",children:"Private Limited Company"}),e.jsx(Pe,{value:"Public Limited Company","data-testid":"onboarding-firm-type-pub-ltd",children:"Public Limited Company"})]})]})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx(se,{variant:"outline",className:"flex-1 h-12 rounded-xl font-bold text-slate-600 border-slate-200",onClick:()=>ws(!1),disabled:Cs,"data-testid":"onboarding-firm-type-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 h-12 rounded-xl font-bold bg-amber-600 hover:bg-amber-700 text-white shadow-lg shadow-amber-200 transition-all active:scale-95",disabled:Cs||!_s,onClick:Bs,"data-testid":"onboarding-firm-type-submit",children:Cs?e.jsx(ss,{className:"w-5 h-5 animate-spin"}):"Update Type"})]})]})]})})]})}var X7={};function J7({application:t,currentUser:s,documents:n,fddAgencies:r,selectedAgencyId:a,setSelectedAgencyId:l,isAssigningAgency:c,handleAssignAgency:d,setPreviewDoc:h,setShowPreviewModal:x,setIsUploading:f,fetchApplication:m,refreshDocuments:p}){var w,R;const u=(t==null?void 0:t.fddAssignments)||[],j=((w=t==null?void 0:t.participants)==null?void 0:w.filter(P=>{var A,I,$,T;return((A=P.user)==null?void 0:A.role)==="FDD"||((I=P.user)==null?void 0:I.roleCode)==="FDD"||((T=($=P.user)==null?void 0:$.allRoles)==null?void 0:T.includes("FDD"))}))||[],g=u.length>0||j.length>0,y=(R=j[0])==null?void 0:R.user,N=[{type:"Bank Statement",label:"Bank Statements"},{type:"Income Tax Returns (ITR)",label:"ITR (Last 3 Years)"},{type:"CIBIL Report",label:"CIBIL / Credit Reports"},{type:"Property Documents",label:"Property Documents"},{type:"Business Valuation Report",label:"Valuation Reports"},{type:"FDD Final Audit Report",label:"Final Audit Report"}],S=P=>{const A=P.toLowerCase();return(n||[]).find(I=>{const $=(I.documentType||"").toLowerCase(),T=(I.fileName||"").toLowerCase();return!!($===A||A.includes("itr")&&($.includes("itr")||T.includes("itr"))||A.includes("bank statement")&&($.includes("bank")||T.includes("bank"))||A.includes("cibil")&&($.includes("cibil")||T.includes("cibil")||$.includes("credit")))})},C=P=>{const A=(P.documentType||"").toLowerCase();return(P.stage||"").toLowerCase()==="fdd"||A.includes("report")||A.includes("itr")||A.includes("bank")||A.includes("cibil")||A.includes("valuation")};return!g&&!["FDD Verification","LOI In Progress","Payment Pending"].includes(t.status)?e.jsxs("div",{className:"space-y-6","data-testid":"onboarding-fdd-no-assignment",children:[e.jsxs("div",{className:"flex flex-col items-center justify-center p-12 bg-slate-50 rounded-2xl border-2 border-dashed border-slate-200",children:[e.jsx(Fl,{className:"w-12 h-12 text-slate-300 mb-4"}),e.jsx("h3",{className:"text-slate-900 font-semibold uppercase tracking-widest text-xs",children:"No FDD Assignment"}),e.jsx("p",{className:"text-slate-500 text-[10px] text-center max-w-xs mt-2 font-medium leading-relaxed uppercase tracking-tight",children:"The Financial Due Diligence process has not been initiated for this application yet."})]}),((s==null?void 0:s.role)==="DD Admin"||(s==null?void 0:s.role)==="Super Admin")&&e.jsxs(Le,{className:"border-amber-100 bg-amber-50/30 overflow-hidden rounded-2xl","data-testid":"onboarding-fdd-initiate-card",children:[e.jsx(tt,{className:"pb-2",children:e.jsxs(nt,{className:"text-xs font-black uppercase tracking-widest text-amber-800 flex items-center gap-2",children:[e.jsx(Xv,{className:"w-4 h-4"}),"Initiate FDD Audit"]})}),e.jsx(Me,{children:e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("label",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 mb-1.5 block",children:["Select FDD Agency ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("select",{className:"w-full h-11 bg-white border border-slate-200 rounded-xl px-4 text-sm font-medium focus:ring-2 focus:ring-amber-500/20 focus:border-amber-500 outline-none transition-all shadow-sm",value:a,onChange:P=>l(P.target.value),"data-testid":"onboarding-fdd-agency-select",children:[e.jsx("option",{value:"",children:"Choose partner agency..."}),(r||[]).map(P=>e.jsxs("option",{value:P.id,"data-testid":`onboarding-fdd-agency-option-${P.id}`,children:[P.fullName||P.name," (",P.email,")"]},P.id))]})]}),e.jsx("div",{className:"flex items-end",children:e.jsx(se,{className:"bg-slate-900 text-white hover:bg-slate-800 font-black text-[10px] uppercase tracking-widest px-8 h-11 border-none shadow-lg shadow-slate-900/10 transition-all active:scale-[0.98]",onClick:d,disabled:c||!a,"data-testid":"onboarding-fdd-assign-button",children:c?"Assigning...":"Assign & Start Audit"})})]})})]})]}):e.jsxs("div",{className:"space-y-8","data-testid":"onboarding-fdd-audit-content",children:[g&&e.jsx("div",{className:"flex items-center justify-between p-4 bg-slate-50 border border-slate-200 rounded-xl mb-6","data-testid":"onboarding-fdd-assignment-banner",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-amber-100 rounded-lg",children:e.jsx(Fl,{className:"w-5 h-5 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-slate-900",children:"FDD Assignment Active"}),y&&e.jsxs("p",{className:"text-xs text-slate-500 font-medium","data-testid":"onboarding-fdd-assigned-user",children:["Assigned to: ",y.name]})]})]})}),e.jsxs(Le,{className:"border-slate-200 shadow-sm overflow-hidden rounded-2xl","data-testid":"onboarding-fdd-checklist-card",children:[e.jsx(tt,{className:"bg-slate-50/50 border-b border-slate-100 py-4",children:e.jsxs(nt,{className:"text-sm font-black uppercase tracking-widest text-slate-500 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fo,{className:"w-4 h-4"})," Financial Artefacts Checklist"]}),e.jsx(Ae,{variant:"outline",className:"text-[10px] bg-white",children:"Verify before sign-off"})]})}),e.jsx(Me,{className:"p-0",children:e.jsx("div",{className:"divide-y divide-slate-100",children:N.map((P,A)=>{const I=S(P.type);return e.jsxs("div",{className:"flex items-center justify-between p-4 px-6 hover:bg-slate-50/50 transition-colors","data-testid":`onboarding-fdd-checklist-item-${A}`,children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:Pt("w-8 h-8 rounded-lg flex items-center justify-center",I?"bg-emerald-50 text-emerald-600":"bg-slate-50 text-slate-300"),children:I?e.jsx(Ys,{className:"w-5 h-5"}):e.jsx(Ks,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-slate-800",children:P.label}),e.jsx("p",{className:"text-[10px] text-slate-400 font-bold uppercase tracking-tighter","data-testid":`onboarding-fdd-checklist-status-${A}`,children:I?`Uploaded: ${Ht(I.createdAt)}`:"Missing in Documentation"})]})]}),I?e.jsxs(se,{variant:"ghost",size:"sm",className:"h-8 text-blue-600 font-black text-[10px] uppercase tracking-widest hover:bg-blue-50",onClick:()=>{h(I),x(!0)},"data-testid":`onboarding-fdd-checklist-preview-${A}`,children:[e.jsx(nn,{className:"w-4 h-4 mr-1"})," Preview"]}):e.jsxs(se,{variant:"outline",size:"sm",className:"h-8 border-slate-200 text-slate-500 font-black text-[10px] uppercase tracking-widest hover:bg-slate-50 hover:text-blue-600","data-testid":`onboarding-fdd-checklist-upload-${A}`,onClick:()=>{const $=document.createElement("input");$.type="file",$.onchange=async T=>{var _;const E=T.target.files[0];if(E)try{f(!0);const M=new FormData;M.append("file",E),M.append("documentType",P.type),M.append("stage","FDD"),M.append("applicationId",t.id);const q=await ds.uploadDocument(t.id,M);P.type==="FDD Final Audit Report"&&(await ds.submitFddReport({applicationId:t.id,reportDocumentId:((_=q.data)==null?void 0:_.id)||q.id,findings:"Final Audit Report uploaded via checklist.",recommendation:"REVIEW_PENDING"}),m()),ee.success(`${P.label} uploaded successfully`),p()}catch{ee.error("Upload failed")}finally{f(!1)}},$.click()},children:[e.jsx(Dr,{className:"w-4 h-4 mr-1 text-slate-300"})," Upload"]})]},P.type)})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Supporting Audit Documents"}),e.jsxs(Ae,{variant:"outline",className:"bg-slate-50 text-slate-500 border-slate-200","data-testid":"onboarding-fdd-support-docs-count",children:[(n||[]).filter(C).length," Document(s)"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4","data-testid":"onboarding-fdd-support-docs-grid",children:[(n||[]).filter(C).map((P,A)=>e.jsxs("div",{className:"group bg-white border border-slate-200 rounded-xl p-4 flex items-center justify-between hover:border-amber-400 transition-all hover:shadow-md","data-testid":`onboarding-fdd-support-doc-${A}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-slate-50 flex items-center justify-center",children:e.jsx(fs,{className:"w-5 h-5 text-slate-400"})}),e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("p",{className:"text-slate-900 font-bold text-sm truncate max-w-[150px]",title:P.fileName,"data-testid":`onboarding-fdd-support-doc-name-${A}`,children:P.fileName}),e.jsx("p",{className:"text-slate-500 text-[10px] font-medium uppercase",children:P.documentType})]})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-amber-600 hover:bg-amber-50",onClick:()=>{const I=X7.NEXT_PUBLIC_API_URL||"http://localhost:5000";window.open(`${I}/${P.filePath}`,"_blank")},"data-testid":`onboarding-fdd-support-doc-download-${A}`,children:e.jsx(Ni,{className:"w-4 h-4"})}),e.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-amber-600 hover:bg-amber-50",onClick:()=>{h(P),x(!0)},"data-testid":`onboarding-fdd-support-doc-preview-${A}`,children:e.jsx(nn,{className:"w-4 h-4"})})]})]},P.id)),(n||[]).filter(C).length===0&&e.jsx("div",{className:"col-span-full p-8 text-center bg-slate-50 rounded-xl border border-dashed border-slate-200","data-testid":"onboarding-fdd-support-docs-empty",children:e.jsx("p",{className:"text-slate-400 text-sm",children:"No supporting audit documents uploaded yet."})})]})]})]})}function e$(t){const s=String(t||"").toUpperCase();return s.includes("REJECT")||s.includes("DELET")||s.includes("DISQUALIF")?"border-red-200 bg-red-50/90 text-red-800":s==="CREATED"||s.includes("APPROV")||s.includes("COMPLETE")?"border-emerald-200 bg-emerald-50/90 text-emerald-900":s.includes("DOCUMENT")||s.includes("UPLOAD")||s.includes("ATTACHMENT")?"border-sky-200 bg-sky-50/80 text-sky-900":s.includes("PAYMENT")||s.includes("SECURITY")||s.includes("DEPOSIT")?"border-violet-200 bg-violet-50/80 text-violet-900":s.includes("FDD")||s.includes("QUESTIONNAIRE")||s.includes("INTERVIEW")?"border-amber-200 bg-amber-50/80 text-amber-900":"border-slate-200 bg-slate-50 text-slate-700"}function t$({application:t,interviews:s,currentUser:n,getDeposit:r,eorProgress:a}){var y,N,S;const l=Array.isArray(s)?s:[],c=l.find(C=>{var w;return["Scheduled","Rescheduled","Pending","In Progress"].includes(C.status)&&((w=C.participants)==null?void 0:w.some(R=>R.userId===(n==null?void 0:n.id)))}),d=[...l].reverse().find(C=>{var w;return(w=C.participants)==null?void 0:w.some(R=>R.userId===(n==null?void 0:n.id))}),h=(N=(y=c||d)==null?void 0:y.evaluations)==null?void 0:N.find(C=>C.evaluatorId===(n==null?void 0:n.id)),x=C=>l.some(w=>Number(w.level)===C&&w.status==="Completed"),f=C=>l.some(w=>Number(w.level)===C&&w.status==="Scheduled"),m=!!h,p={"Level 1 Interview Pending":"INTERVIEW_LEVEL_1","Level 2 Interview Pending":"INTERVIEW_LEVEL_2","Level 2 Recommended":"INTERVIEW_LEVEL_2","Level 3 Interview Pending":"INTERVIEW_LEVEL_3","LOI In Progress":"LOI_APPROVAL","LOA Pending":"LOA_APPROVAL"},u=p[t==null?void 0:t.status],j=(S=t==null?void 0:t.stageApprovals)==null?void 0:S.find(C=>C.stageCode===u&&String(C.actorUserId)===String(n==null?void 0:n.id));return{activeInterviewForUser:c,lastInterviewForUser:d,currentUserEvaluation:h,hasSubmittedFeedback:m,currentUserStageAction:j,isInterviewCompleted:x,isInterviewActive:f,permissions:(()=>{var G,Z,W,z,F;if(!t||!n)return{canApprove:!1,canReject:!1,canSchedule:!1,canAssign:!1,isLoaLocked:!1,isSecurityDetailsLocked:!1,showDecisionMessage:!1};const C=["DD Admin","Super Admin","NBH","DD Lead","DD Head","Finance","Finance Admin","FDD","ZBH","RBM"].includes(n.role),w=["Level 3 Approved","FDD Verification","LOI In Progress","Security Details","Payment Pending","LOI Issued","Statutory LOI Ack","Architecture Team Assigned","Architecture Document Upload","Architecture Team Completion","Statutory GST","Statutory PAN","Statutory Nodal","Statutory Check","Statutory Partnership","Statutory Firm Reg","Statutory Rental","Statutory Virtual Code","Statutory Domain","Statutory MSD","LOA Pending","EOR In Progress","EOR Complete","Inauguration","Approved"].includes(t.status),R=t.status==="LOA Pending"&&((G=r("FIRST_FILL"))==null?void 0:G.status)!=="Verified",P=["Security Details","Payment Pending"].includes(t.status)&&((Z=r("SECURITY_DEPOSIT"))==null?void 0:Z.status)!=="Verified",A=t.status==="Onboarded"||t.status==="Rejected",I=(W=t.stageApprovals)==null?void 0:W.some(B=>B.stageCode==="LOI_APPROVAL"&&B.actorRole==="DD Head"&&B.decision==="Approved"),$=(z=t.stageApprovals)==null?void 0:z.some(B=>B.stageCode==="LOA_APPROVAL"&&B.actorRole==="DD Head"&&B.decision==="Approved");let T=!0;["Super Admin","DD Admin","DD Lead","DD Head"].includes(n.role)||((t.status==="FDD Verification"||t.status==="Level 3 Approved")&&(T=!1),t.status==="LOI In Progress"&&(T=n.role==="NBH"?!!I:n.role==="DD Head"),t.status==="LOA Pending"&&(T=n.role==="NBH"?!!$:n.role==="DD Head"));const E=!!((F=t.stageApprovals)!=null&&F.find(B=>p[t.status]===B.stageCode&&String(B.actorUserId)===String(n.id))),_=["Approved","Rejected","Selected"].includes((h==null?void 0:h.decision)||(h==null?void 0:h.recommendation)||""),M=(c?_:!1)||E,q=!A&&!M&&C&&w&&T&&(!["EOR In Progress","Inauguration","Approved"].includes(t.status)||a===100);return{canApprove:q&&!R&&!P,canReject:q&&!R,isLoaLocked:R,isSecurityDetailsLocked:P,showDecisionMessage:M&&(!w||E),canSchedule:["DD Admin","Super Admin","DD AM","ASM"].includes(n.role)&&!A&&![1,2,3].every(B=>l.some(D=>D.level===B)),canAssign:["DD Admin","Super Admin","DD AM"].includes(n.role)}})()}}function s$({initialTab:t="questionnaire"}){const[s,n]=v.useState(!1),[r,a]=v.useState(!1),[l,c]=v.useState(""),[d,h]=v.useState(t),[x,f]=v.useState(!1),[m,p]=v.useState(!1),[u,j]=v.useState(!1),[g,y]=v.useState(!1),[N,S]=v.useState(""),[C,w]=v.useState([]),[R,P]=v.useState(!1),[A,I]=v.useState(!1),[$,T]=v.useState(""),[E,_]=v.useState(!1),[M,q]=v.useState(!1),[G,Z]=v.useState(!1),[W,z]=v.useState(!1),[F,B]=v.useState(!1),[D,O]=v.useState(null),[V,K]=v.useState("virtual"),[Y,U]=v.useState(""),[X,ne]=v.useState({}),[oe,re]=v.useState([]),[ge,ve]=v.useState(""),[Se,We]=v.useState("contributor"),[Ce,fe]=v.useState(""),[Ye,be]=v.useState("level1"),[_e,ke]=v.useState(""),[qe,Ve]=v.useState(""),[dt,xt]=v.useState(!1),[ye,le]=v.useState(null),[Qe,rt]=v.useState(""),[Kt,Rt]=v.useState(null),[Re,Qt]=v.useState(!1),[qt,ws]=v.useState(null),[_s,ns]=v.useState(!1),[Cs,Bs]=v.useState(""),[Ft,ie]=v.useState(!1),[Fe,Q]=v.useState({}),[pe,Ne]=v.useState(!1),[Ee,it]=v.useState([]),[st,bt]=v.useState(!1),[Ue,Lt]=v.useState(!1),[ut,yt]=v.useState(!1),[kt,Ie]=v.useState(""),[_t,ht]=v.useState(!1),[zt,rs]=v.useState(!1),[Yt,Os]=v.useState(""),[Is,zs]=v.useState(""),[en,he]=v.useState(!1),[Ge,at]=v.useState(!1),[pt,mt]=v.useState([]),[Bt,Ds]=v.useState([]),[as,Vs]=v.useState(""),[Ls,Ts]=v.useState(!1),[ln,pn]=v.useState(!1),[hn,Ws]=v.useState(!1),[Qs,zn]=v.useState({}),[on,Un]=v.useState({}),[yr,Tr]=v.useState(""),[er,tr]=v.useState("Approve"),[En,Xe]=v.useState(!1),[$t,Ze]=v.useState(null),[Ut,jt]=v.useState(!1),[In,jr]=v.useState(!1),[Pr,xn]=v.useState("Recommended"),[qs,ha]=v.useState(""),[Tt,xs]=v.useState(!1),[Vr,ta]=v.useState(!1),[ma,_r]=v.useState({}),[sr,gn]=v.useState("Approve"),[mn,Qn]=v.useState(!1),[fr,pr]=v.useState({}),[dn,wn]=v.useState("Approve"),[Da,fa]=v.useState(!1),[Ai,ki]=v.useState(null),[ni,rl]=v.useState(!1);return{showFirmTypeModal:s,setShowFirmTypeModal:n,updatingFirmType:r,setUpdatingFirmType:a,tempFirmType:l,setTempFirmType:c,activeTab:d,setActiveTab:h,showApproveModal:x,setShowApproveModal:f,showOnboardModal:m,setShowOnboardModal:p,isOnboarding:u,setIsOnboarding:j,showRejectModal:g,setShowRejectModal:y,rejectionReason:N,setRejectionReason:S,scheduledInterviewParticipants:C,setScheduledInterviewParticipants:w,showScheduleModal:R,setShowScheduleModal:P,showCancelInterviewModal:A,setShowCancelInterviewModal:I,interviewIdToCancel:$,setInterviewIdToCancel:T,showKTMatrixModal:E,setShowKTMatrixModal:_,showLevel2FeedbackModal:M,setShowLevel2FeedbackModal:q,showLevel3FeedbackModal:G,setShowLevel3FeedbackModal:Z,showDocumentsModal:W,setShowDocumentsModal:z,showAssignModal:F,setShowAssignModal:B,selectedStage:D,setSelectedStage:O,interviewMode:V,setInterviewMode:K,approvalRemark:Y,setApprovalRemark:U,expandedBranches:X,setExpandedBranches:ne,users:oe,setUsers:re,selectedUser:ge,setSelectedUser:ve,participantType:Se,setParticipantType:We,interviewDate:Ce,setInterviewDate:fe,interviewType:Ye,setInterviewType:be,meetingLink:_e,setMeetingLink:ke,location:qe,setLocation:Ve,showUploadForm:dt,setShowUploadForm:xt,uploadFile:ye,setUploadFile:le,uploadDocType:Qe,setUploadDocType:rt,approvalFile:Kt,setApprovalFile:Rt,isUploading:Re,setIsUploading:Qt,previewDoc:qt,setPreviewDoc:ws,showPreviewModal:_s,setShowPreviewModal:ns,selectedInterviewerId:Cs,setSelectedInterviewerId:Bs,isEditingStatutory:Ft,setIsEditingStatutory:ie,statutoryForm:Fe,setStatutoryForm:Q,isSavingStatutory:pe,setIsSavingStatutory:Ne,interviews:Ee,setInterviews:it,isScheduling:st,setIsScheduling:bt,isCancellingInterview:Ue,setIsCancellingInterview:Lt,showAssignArchitectureModal:ut,setShowAssignArchitectureModal:yt,architectureLeadId:kt,setArchitectureLeadId:Ie,isAssigningArchitecture:_t,setIsAssigningArchitecture:ht,showArchitectureStatusModal:zt,setShowArchitectureStatusModal:rs,architectureStatus:Yt,setArchitectureStatus:Os,architectureRemarks:Is,setArchitectureRemarks:zs,isUpdatingArchitecture:en,setIsUpdatingArchitecture:he,isAssigningParticipant:Ge,setIsAssigningParticipant:at,documentConfigs:pt,setDocumentConfigs:mt,fddAgencies:Bt,setFddAgencies:Ds,selectedAgencyId:as,setSelectedAgencyId:Vs,isAssigningAgency:Ls,setIsAssigningAgency:Ts,isApproving:ln,setIsApproving:pn,isRejecting:hn,setIsRejecting:Ws,ktMatrixScores:Qs,setKtMatrixScores:zn,ktMatrixSelectedValues:on,setKtMatrixSelectedValues:Un,ktMatrixRemarks:yr,setKtMatrixRemarks:Tr,ktMatrixRecommendation:er,setKtMatrixRecommendation:tr,isSubmittingKT:En,setIsSubmittingKT:Xe,selectedInterviewForFeedback:$t,setSelectedInterviewForFeedback:Ze,showFddFinalizeModal:Ut,setShowFddFinalizeModal:jt,showFddFlagModal:In,setShowFddFlagModal:jr,fddAuditRecommendation:Pr,setFddAuditRecommendation:xn,fddAuditFindings:qs,setFddAuditFindings:ha,isFinalizingFdd:Tt,setIsFinalizingFdd:xs,isFddFlagging:Vr,setIsFddFlagging:ta,level2Feedback:ma,setLevel2Feedback:_r,level2Recommendation:sr,setLevel2Recommendation:gn,isSubmittingLevel2:mn,setIsSubmittingLevel2:Qn,level3Feedback:fr,setLevel3Feedback:pr,level3Recommendation:dn,setLevel3Recommendation:wn,isSubmittingLevel3:Da,setIsSubmittingLevel3:fa,selectedEvaluationForView:Ai,setSelectedEvaluationForView:ki,showFeedbackDetailsModal:ni,setShowFeedbackDetailsModal:rl}}const uE=()=>new Date().toISOString().split("T")[0],n$=t=>({strategicVision:"",managementCapabilities:"",operationalUnderstanding:"",keyStrengths:"",areasOfConcern:"",additionalComments:"",overallScore:"",interviewerName:(t==null?void 0:t.name)||"",interviewDate:uE()}),r$=t=>({strategicVision:"",managementCapabilities:"",operationalUnderstanding:"",brandAlignment:"",executiveSummary:"",keyStrengths:"",areasOfConcern:"",additionalComments:"",overallScore:"",interviewerName:(t==null?void 0:t.name)||"",interviewDate:uE()});function a$({ktMatrixScores:t,setKtMatrixScores:s,setKtMatrixSelectedValues:n,ktMatrixRemarks:r,setKtMatrixRemarks:a,ktMatrixRecommendation:l,setKtMatrixRecommendation:c,selectedInterviewForFeedback:d,interviews:h,setIsSubmittingKT:x,setShowKTMatrixModal:f,level2Feedback:m,setLevel2Feedback:p,level2Recommendation:u,setLevel2Recommendation:j,setIsSubmittingLevel2:g,setShowLevel2FeedbackModal:y,level3Feedback:N,setLevel3Feedback:S,level3Recommendation:C,setLevel3Recommendation:w,setIsSubmittingLevel3:R,setShowLevel3FeedbackModal:P,currentUser:A,fetchInterviews:I,fetchApplication:$,ktMatrixConfig:T,level2Config:E,level3Config:_}){const M=ne=>ne==="Approve"?"Recommended":ne==="Reject"?"Not Recommended":"Hold",q=ne=>ne==="Approve"?"Approved":ne==="Reject"?"Rejected":null,G=()=>T!=null&&T.items&&T.items.length>0?T.items.map(ne=>({name:ne.label,weight:Number(ne.weight)||0,maxScore:Number(ne.maxScore)||10,options:(ne.options||[]).map(oe=>({label:oe.optionLabel,value:oe.optionValue,score:Number(oe.score)||0}))})):[],Z=()=>E!=null&&E.items&&E.items.length>0?E.items:[],W=()=>_!=null&&_.items&&_.items.length>0?_.items:[],z=G(),F=Z(),B=W();return{handleKTMatrixChange:(ne,oe,re)=>{s(ge=>({...ge,[ne]:re})),n(ge=>({...ge,[ne]:oe}))},calculateKTScore:()=>{let ne=0;return z.forEach(oe=>{const re=t[oe.name||oe.label]||0,ge=oe.maxScore||10,ve=oe.weight||0;ne+=re/ge*ve}),ne.toFixed(2)},handleSubmitKTMatrix:async()=>{var oe,re;if(z.length===0){ee.error("KT Matrix configuration is missing. Please configure it in Master > Interview Configurations.");return}if(Object.keys(t).lengthge.status!=="Completed"))==null?void 0:oe.id)||((re=h[0])==null?void 0:re.id);if(!ne){ee.error("No active interview found to link this KT Matrix to.");return}try{x(!0);const ge=z.map(Se=>({criterionName:Se.name||Se.label,score:t[Se.name||Se.label]||0,maxScore:Se.maxScore||10,weightage:Se.weight||0}));await ds.submitKTMatrix({interviewId:ne,criteriaScores:ge,feedback:r,recommendation:M(l)});const ve=q(l);ve&&await ds.updateInterviewDecision({interviewId:ne,decision:ve,remarks:r||`Level 1 ${ve.toLowerCase()} via KT Matrix`}),ee.success(ve?`KT Matrix submitted and interview ${ve.toLowerCase()}`:"KT Matrix submitted and interview kept on hold"),f(!1),s({}),n({}),a(""),c("Approve"),await I(),await $()}catch{ee.error("Failed to submit KT Matrix")}finally{x(!1)}},handleLevel2Change:(ne,oe)=>{p(re=>({...re,[ne]:oe}))},handleSubmitLevel2Feedback:async()=>{var oe;if(F.length===0){ee.error("Level 2 feedback configuration is missing. Please configure it in Master > Interview Configurations.");return}if(!m.overallScore){ee.warning("Please provide an overall score.");return}const ne=(d==null?void 0:d.id)||((oe=h.find(re=>re.status!=="Completed"&&re.level===2))==null?void 0:oe.id);if(!ne){ee.error("No active Level 2 interview found to link this feedback to.");return}try{g(!0);const re=F.map(Se=>({type:Se.label,comments:m[Se.itemKey]||""})).filter(Se=>Se.comments.trim()!=="");await ds.submitLevel2Feedback({interviewId:ne,overallScore:Number(m.overallScore),feedbackItems:re,recommendation:M(u)});const ge=q(u),ve=m.additionalComments||"Level 2 decision submitted via feedback modal";ge&&await ds.updateInterviewDecision({interviewId:ne,decision:ge,remarks:ve}),ee.success(ge?`Level 2 feedback submitted and interview ${ge.toLowerCase()}`:"Level 2 feedback submitted and interview kept on hold"),y(!1),p(n$(A)),j("Approve"),await I(),await $()}catch{ee.error("Failed to submit Level 2 Feedback")}finally{g(!1)}},handleLevel3Change:(ne,oe)=>{S(re=>({...re,[ne]:oe}))},handleSubmitLevel3Feedback:async()=>{var oe;if(B.length===0){ee.error("Level 3 feedback configuration is missing. Please configure it in Master > Interview Configurations.");return}if(!N.overallScore){ee.warning("Please provide an overall score.");return}const ne=(d==null?void 0:d.id)||((oe=h.find(re=>re.status!=="Completed"&&re.level===3))==null?void 0:oe.id);if(!ne){ee.error("No active Level 3 interview found to link this feedback to.");return}try{R(!0);const re=B.map(Se=>({type:Se.label,comments:N[Se.itemKey]||""})).filter(Se=>Se.comments.trim()!=="");await ds.submitLevel2Feedback({interviewId:ne,overallScore:Number(N.overallScore),feedbackItems:re,recommendation:M(C)});const ge=q(C),ve=N.executiveSummary||N.additionalComments||"Level 3 decision submitted via feedback modal";ge&&await ds.updateInterviewDecision({interviewId:ne,decision:ge,remarks:ve}),ee.success(ge?`Level 3 feedback submitted and interview ${ge.toLowerCase()}`:"Level 3 feedback submitted and interview kept on hold"),P(!1),S(r$(A)),w("Approve"),await I(),await $()}catch{ee.error("Failed to submit Level 3 Feedback")}finally{R(!1)}},ktCriteria:z,l2Fields:F,l3Fields:B}}function i$(){const[t,s]=v.useState(null),[n,r]=v.useState(null),[a,l]=v.useState(null),[c,d]=v.useState(!1),[h,x]=v.useState(null),f=v.useCallback(async p=>{var u,j;try{const g=await Te.getInterviewConfigByType(p);if((u=g.data)!=null&&u.success)return g.data.data}catch(g){((j=g==null?void 0:g.response)==null?void 0:j.status)!==404&&console.warn(`Failed to fetch ${p} config:`,g)}return null},[]),m=v.useCallback(async()=>{d(!0),x(null);try{const[p,u,j]=await Promise.all([f("KT_MATRIX"),f("LEVEL2_FEEDBACK"),f("LEVEL3_FEEDBACK")]);s(p),r(u),l(j)}catch{x("Failed to load interview configurations"),ee.error("Failed to load interview configurations")}finally{d(!1)}},[f]);return v.useEffect(()=>{m()},[m]),{ktMatrixConfig:t,level2Config:n,level3Config:a,loading:c,error:h,refresh:m}}function l$(t){const{application:s,applicationId:n,currentUser:r,interviews:a,approvalFile:l,approvalRemark:c,rejectionReason:d,architectureLeadId:h,architectureStatus:x,architectureRemarks:f,selectedUser:m,participantType:p,users:u,interviewDate:j,interviewType:g,interviewMode:y,meetingLink:N,location:S,scheduledInterviewParticipants:C,uploadFile:w,uploadDocType:R,selectedStage:P,setIsApproving:A,setShowApproveModal:I,setApprovalRemark:$,setApprovalFile:T,setIsRejecting:E,setShowRejectModal:_,setRejectionReason:M,setIsAssigningArchitecture:q,setShowAssignArchitectureModal:G,setIsUpdatingArchitecture:Z,setShowArchitectureStatusModal:W,setIsAssigningParticipant:z,setSelectedUser:F,setShowAssignModal:B,setLoading:D,setIsScheduling:O,setShowScheduleModal:V,setShowCancelInterviewModal:K,interviewIdToCancel:Y,setInterviewIdToCancel:U,setIsCancellingInterview:X,setIsUploading:ne,setShowUploadForm:oe,setUploadFile:re,setUploadDocType:ge,setDocuments:ve,selectedInterviewerId:Se,setSelectedInterviewerId:We,setScheduledInterviewParticipants:Ce,setUsers:fe,showScheduleModal:Ye,showAssignArchitectureModal:be,showAssignModal:_e,fetchApplication:ke,fetchInterviews:qe,fetchEorData:Ve}=t,dt=()=>{if(!Se)return;const ie=(Array.isArray(u)?u:[]).find(Fe=>Fe.id===Se);ie&&!C.find(Fe=>Fe.id===ie.id)&&(Ce([...C,ie]),We(""))},xt=Ft=>{Ce(C.filter(ie=>ie.id!==Ft))},ye=v.useCallback(async Ft=>{if(!(!r||!["DD Admin","Super Admin","DD Lead","DD Head","NBH"].includes(r.role)))try{const ie={};if(Ft){const Ne={level1:["DD-ZM","RBM"],level2:["DD Lead","ZBH"],level3:["NBH","DD Head"]};Ne[Ft]&&(ie.preferredRoleCode=Ne[Ft]),s&&(ie.locationId=s.districtId||s.areaId||s.regionId||s.zoneId)}ie.isExternal=!1;const Fe=await ds.getUsers(ie),pe=(Array.isArray(Fe)?Fe:Fe&&Array.isArray(Fe.data)?Fe.data:Fe&&Array.isArray(Fe.users)?Fe.users:[]).filter(Ne=>(Ne.status||"").toLowerCase()!=="inactive");fe(pe.sort((Ne,Ee)=>String(Ne.fullName||Ne.name||"").localeCompare(String(Ee.fullName||Ee.name||""))))}catch{fe([])}},[r,s,fe]),le=v.useCallback(()=>{if(!Ye||!s)return;const Ft=parseInt(g.replace("level",""))||1,ie={1:["DD-ZM","RBM"],2:["DD Lead","ZBH"],3:["NBH","DD Head"]},Fe=st=>String(st||"").trim().toLowerCase().replace(/[_\s-]+/g," "),Q=(ie[Ft]||[]).map(Fe),pe=(st,bt)=>{var ut,yt,kt;const Ue=[(ut=st==null?void 0:st.metadata)==null?void 0:ut.role,(yt=bt==null?void 0:bt.role)==null?void 0:yt.roleName,(kt=bt==null?void 0:bt.role)==null?void 0:kt.roleCode,bt==null?void 0:bt.roleCode,bt==null?void 0:bt.role].filter(Boolean),Lt=Ue.find(Ie=>Q.includes(Fe(Ie)));return String(Lt||Ue[0]||"Panelist")},Ne=((s==null?void 0:s.participants)||[]).filter(st=>{var bt,Ue,Lt,ut,yt,kt,Ie,_t,ht;return((bt=st.metadata)==null?void 0:bt.interviewLevel)===Ft||((Ue=st.metadata)==null?void 0:Ue.interviewLevel)===String(Ft)||((ut=(Lt=st.metadata)==null?void 0:Lt.allAssignments)==null?void 0:ut.includes(Ft))||((kt=(yt=st.metadata)==null?void 0:yt.allAssignments)==null?void 0:kt.includes(String(Ft)))||Q.includes(Fe((Ie=st.user)==null?void 0:Ie.role))||Q.includes(Fe((_t=st.user)==null?void 0:_t.roleCode))||Q.includes(Fe((ht=st.metadata)==null?void 0:ht.role))}).map(st=>{const bt=st.user||{};return{...bt,__stageRole:pe(st,bt)}}).filter(st=>!!(st!=null&&st.id));if(Ne.length===0){Ce([]);return}const Ee=[],it=new Set;Ne.forEach(st=>{st.id&&!it.has(st.id)&&(it.add(st.id),Ee.push(st))}),Ce(Ee)},[Ye,s,g,Ce]),Qe=async()=>{if(!j){ee.warning("Please select date and time");return}try{O(!0),await ds.scheduleInterview({applicationId:s==null?void 0:s.id,level:g,scheduledAt:j,type:y==="virtual"?"Virtual Interview":"Physical Interview",location:y==="virtual"?N:S,participants:C.map(Ft=>Ft.id)}),ee.success("Interview scheduled successfully"),V(!1),await qe(),await ke()}catch{ee.error("Failed to schedule interview")}finally{O(!1)}},rt=async Ft=>{U(Ft),K(!0)},Kt=async()=>{if(Y)try{X(!0),await ds.updateInterview(Y,{status:"Cancelled"}),ee.success("Interview cancelled successfully"),K(!1),U(""),await qe()}catch{ee.error("Failed to cancel interview")}finally{X(!1)}},Rt=async()=>{if(!w||!R){ee.warning("Please select a file and document type");return}try{ne(!0);const Ft=new FormData;Ft.append("file",w),Ft.append("documentType",R),P&&Ft.append("stage",P),await ds.uploadDocument(n,Ft),ee.success("Document uploaded successfully"),oe(!1),re(null),ge("");const ie=await ds.getDocuments(n);ve(ie||[]),await Ve()}catch{ee.error("Failed to upload document")}finally{ne(!1)}},Re=async()=>{var Ft;try{A(!0);const ie=a.find(Ne=>{var Ee;return Ne.status!=="Completed"&&Ne.status!=="Cancelled"&&((Ee=Ne.participants)==null?void 0:Ee.some(it=>it.userId===(r==null?void 0:r.id)))});if(l&&n)try{const Ne=new FormData;Ne.append("file",l),Ne.append("documentType","Approval Attachment");let Ee=null;ie&&(ie.level===1||ie.level==="1"?Ee="1st Level Interview":ie.level===2||ie.level==="2"?Ee="2nd Level Interview":(ie.level===3||ie.level==="3")&&(Ee="3rd Level Interview")),Ee||(s.status==="Shortlisted"||s.status==="Level 1 Interview Pending"?Ee="1st Level Interview":s.status==="Level 1 Approved"||s.status==="Level 2 Interview Pending"?Ee="2nd Level Interview":(s.status==="Level 2 Approved"||s.status==="Level 3 Interview Pending")&&(Ee="3rd Level Interview")),Ee&&Ne.append("stage",Ee),await ds.uploadDocument(n,Ne)}catch{ee.error("Failed to upload document")}if(ie)try{await ds.updateInterviewDecision({interviewId:ie.id,decision:"Approved",remarks:c}),ee.success("Interview approved successfully"),I(!1),$(""),T(null),await qe(),await ke();return}catch{ee.error("Failed to approve interview");return}if(!c.trim()){ee.warning("Please enter a remark");return}let Fe=s.status;switch(s.status){case"Shortlisted":case"Level 1 Interview Pending":Fe="Level 1 Approved";break;case"Level 1 Approved":case"Level 2 Interview Pending":Fe="Level 2 Approved";break;case"Level 2 Approved":case"Level 3 Interview Pending":Fe="Level 3 Approved";break;case"Level 3 Approved":Fe="FDD Verification";break;case"FDD Verification":Fe="LOI In Progress";break;case"LOI In Progress":Fe="Security Details";break;case"Security Details":case"Payment Pending":Fe="LOI Issued";break;case"LOI Issued":Fe="Dealer Code Generation";break;case"Dealer Code Generation":case"Architecture Team Assigned":case"Architecture Document Upload":case"Architecture Team Completion":case"Statutory GST":case"Statutory PAN":case"Statutory Nodal":case"Statutory Check":case"Statutory Partnership":case"Statutory Firm Reg":case"Statutory Rental":case"Statutory Virtual Code":case"Statutory Domain":case"Statutory MSD":case"Statutory LOI Ack":Fe="LOA Pending";break;case"LOA Pending":Fe="EOR In Progress";break;case"EOR In Progress":Fe="EOR Complete";break;case"EOR Complete":Fe="Inauguration";break;case"Inauguration":case"Approved":Fe="Onboarded";break;default:Fe="Onboarded"}const pe={"Level 1 Interview Pending":"INTERVIEW_LEVEL_1","Level 2 Interview Pending":"INTERVIEW_LEVEL_2","Level 2 Recommended":"INTERVIEW_LEVEL_2","Level 3 Interview Pending":"INTERVIEW_LEVEL_3","LOI In Progress":"LOI_APPROVAL","LOA Pending":"LOA_APPROVAL"}[s.status];if(pe){const Ne=await ds.submitStageDecision({applicationId:s.id,stageCode:pe,decision:"Approved",remarks:c,nextStatus:Fe});(Ft=Ne.data)!=null&&Ft.statusUpdated?ee.success(Ne.message||"Stage completed and moved to next step"):ee.info(Ne.message||"Approval recorded. Waiting for other mandatory approvers.")}else await ds.updateApplicationStatus(n,{status:Fe,remarks:c});Fe==="Onboarded"?(await ds.createDealer({applicationId:n}),ee.success("Application finalized and Dealer profile created!")):ee.success(`Application moved to ${Fe}`),I(!1),$(""),T(null),await ke()}catch(ie){ee.error(ie.message||"Failed to process approval")}finally{A(!1)}},Qt=async()=>{try{E(!0);const Ft=a.find(Q=>{var pe;return Q.status!=="Completed"&&Q.status!=="Cancelled"&&((pe=Q.participants)==null?void 0:pe.some(Ne=>Ne.userId===(r==null?void 0:r.id)))});if(Ft)try{await ds.updateInterviewDecision({interviewId:Ft.id,decision:"Rejected",remarks:d}),ee.success("Interview rejected"),_(!1),M(""),await qe(),await ke();return}catch{ee.error("Failed to reject interview");return}if(!d.trim()){ee.warning("Please enter a reason for rejection");return}const Fe={"Level 1 Interview Pending":"INTERVIEW_LEVEL_1","Level 2 Interview Pending":"INTERVIEW_LEVEL_2","Level 2 Recommended":"INTERVIEW_LEVEL_2","Level 3 Interview Pending":"INTERVIEW_LEVEL_3","LOI In Progress":"LOI_APPROVAL","LOA Pending":"LOA_APPROVAL"}[s.status];Fe?await ds.submitStageDecision({applicationId:s.id,stageCode:Fe,decision:"Rejected",remarks:d,interviewId:Ft==null?void 0:Ft.id}):await ds.updateApplicationStatus(n,{status:"Rejected",remarks:d}),ee.success("Application rejected"),_(!1),M(""),await ke()}catch(Ft){ee.error(Ft.message||"Failed to process rejection")}finally{E(!1)}},qt=async()=>{try{await ds.generateDealerCodes(n),ee.success("Dealer codes generated successfully"),await ke()}catch(Ft){ee.error(Ft.message||"Failed to generate dealer codes")}},ws=async()=>{if(!h){ee.warning("Please select an architecture lead");return}try{q(!0),await ds.assignArchitectureTeam(n,h),ee.success("Architecture team assigned successfully"),G(!1),await ke()}catch(Ft){ee.error(Ft.message||"Failed to assign architecture team")}finally{q(!1)}},_s=async()=>{try{Z(!0),await ds.updateArchitectureStatus(n,x,f),ee.success("Architecture status updated successfully"),W(!1),await ke()}catch{ee.error("Failed to update architecture status")}finally{Z(!1)}},ns=async()=>{if(!m){ee.warning("Please select a user");return}try{z(!0);const Ft=Array.isArray(u)?u.find(ie=>ie.id===m):null;Ft&&(Ft.role==="FDD"||Ft.roleCode==="FDD")&&(await ds.assignFddAgency({applicationId:n,assignedToAgency:m}),ee.info(`${Ft.fullName||Ft.name} assigned as FDD Agency based on role.`)),await ds.addParticipant({requestId:n,requestType:"application",userId:m,participantType:p||"contributor"}),ee.success("User assigned successfully!"),await ke(),F(""),B(!1)}catch{ee.error("Failed to assign user")}finally{z(!1)}},Cs=async()=>{try{D(!0),await ds.retriggerEvaluators(n),ee.success("Evaluators re-assigned successfully"),await ke()}catch{ee.error("Failed to re-assign evaluators")}finally{D(!1)}},Bs=v.useCallback(async()=>{if(Ye&&s){await ye(g),le();return}(be||_e)&&s&&await ye()},[Ye,be,_e,s,g,ye,le]);return{handleAddInterviewer:dt,handleRemoveInterviewer:xt,fetchUsers:ye,maybeFetchUsersForModal:Bs,handleScheduleInterview:Qe,handleCancelInterview:rt,handleConfirmCancelInterview:Kt,handleUpload:Rt,handleApprove:Re,handleReject:Qt,handleGenerateDealerCodes:qt,handleAssignArchitecture:ws,handleUpdateArchitectureStatus:_s,handleAddParticipant:ns,handleRetriggerEvaluators:Cs}}const hE={getChecklist:async(t,s)=>{const n=s?`/eor/relocation/${s}`:`/eor/application/${t}`;return(await ze.get(n)).data},createChecklist:async t=>(await ze.post("/eor",t)).data,updateItem:async(t,s)=>(await ze.post(`/eor/item/${t}`,s)).data,submitAudit:async(t,s)=>(await ze.post(`/eor/audit/${t}`,s)).data},Gx=Object.freeze(Object.defineProperty({__proto__:null,eorService:hE},Symbol.toStringTag,{value:"Module"})),o$={getAuditLogs:async(t,s,n=1,r=50)=>{var a;try{const l=await Te.getAuditLogs(t,s,n,r);return((a=l.data)==null?void 0:a.data)||l.data||[]}catch(l){throw console.error("Get audit logs error:",l),l}},getAuditSummary:async(t,s)=>{var n;try{const r=await Te.getAuditSummary(t,s);return((n=r.data)==null?void 0:n.data)||r.data}catch(r){throw console.error("Get audit summary error:",r),r}}},c$={getWorknotes:async(t,s)=>{var r,a;const n=await Te.getWorknotes(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to fetch worknotes");return((a=n.data)==null?void 0:a.data)||n.data},addWorknote:async t=>{var n,r;const s=await Te.addWorknote(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to add worknote");return((r=s.data)==null?void 0:r.data)||s.data},addParticipant:async t=>{var n;const s=await Te.addParticipant(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to add participant");return s.data},removeParticipant:async t=>{var n;const s=await Te.removeParticipant(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to remove participant");return s.data}};function d$({applicationId:t}){const[s,n]=v.useState(null),[r,a]=v.useState(!0),[l,c]=v.useState([]),[d,h]=v.useState(null),[x,f]=v.useState([]),[m,p]=v.useState(!1),[u,j]=v.useState([]),[g,y]=v.useState([]),[N,S]=v.useState({}),C=v.useCallback(async()=>{try{const A=await ds.getDocuments(t);c(A||[])}catch(A){console.error("Failed to refresh documents:",A)}},[t]),w=v.useCallback(async(A=!1)=>{try{A||a(!0);const I=await ds.getApplicationById(t),$=(E,_)=>{var q;const M=(q=I.progressTracking)==null?void 0:q.find(G=>G.stageName===E);if(M!=null&&M.stageCompletedAt)return new Date(M.stageCompletedAt).toISOString();if(M!=null&&M.stageStartedAt)return new Date(M.stageStartedAt).toISOString();if(_){const G=(I.statusHistory||[]).find(Z=>Z.newStatus===_);if(G)return new Date(G.createdAt).toISOString()}},T={id:I.id,registrationNumber:I.applicationId||"N/A",name:I.applicantName,email:I.email,phone:I.phone,age:I.age,education:I.education,residentialAddress:I.address||I.city||"",businessAddress:I.address||"",preferredLocation:I.preferredLocation,state:I.state,ownsBike:I.ownRoyalEnfield==="yes",pastExperience:I.experienceYears?`${I.experienceYears} years`:I.description||"",status:I.overallStatus,questionnaireMarks:I.score||I.questionnaireMarks||0,questionnaireResponses:I.questionnaireResponses||[],rank:0,totalApplicantsAtLocation:0,assignedUsers:[],progress:I.progressPercentage||0,isShortlisted:I.isShortlisted||!0,companyName:I.companyName,source:I.source,existingDealer:I.existingDealer,royalEnfieldModel:I.royalEnfieldModel,description:I.description,pincode:I.pincode,locationType:I.locationType,ownRoyalEnfield:I.ownRoyalEnfield,address:I.address,submissionDate:I.createdAt?new Date(I.createdAt).toISOString():"",questionnaireDate:$("Questionnaire","Questionnaire Completed")||$("Questionnaire","Questionnaire Pending"),shortlistDate:$("Shortlist","Shortlisted"),level1InterviewDate:$("1st Level Interview","Level 1 Approved"),level2InterviewDate:$("2nd Level Interview","Level 2 Approved"),level3InterviewDate:$("3rd Level Interview","Level 3 Approved"),fddDate:$("FDD","FDD Verification"),loiApprovalDate:$("LOI Approval","LOI In Progress"),securityDetailsDate:$("Security Details","Security Details"),loiIssueDate:$("LOI Issue","LOI Issued"),dealerCodeDate:$("Dealer Code Generation","Dealer Code Generation"),architectureAssignedDate:$("Architecture Team Assigned","Architecture Team Assigned"),architectureDocumentDate:$("Architecture Document Upload","Architecture Document Upload"),architectureCompletionDate:$("Architecture Team Completion","Architecture Team Completion"),loaDate:$("LOA","LOA Pending"),eorCompleteDate:$("EOR Complete","EOR Complete"),inaugurationDate:$("Inauguration","Inauguration"),onboardedDate:I.overallStatus==="Onboarded"?I.updatedAt?new Date(I.updatedAt).toISOString():new Date().toISOString():void 0,progressTracking:I.progressTracking||[],participants:I.participants||[],dealerCode:I.dealerCode,zoneId:I.zoneId,regionId:I.regionId,areaId:I.areaId,districtId:I.districtId,stageApprovals:I.stageApprovals||[],fddAssignments:I.fddAssignments||[],constitutionType:I.constitutionType,architectureStatus:I.architectureStatus,statutoryStatus:I.statutoryStatus,panNumber:I.panNumber,gstNumber:I.gstNumber,bankName:I.bankName,accountNumber:I.accountNumber,ifscCode:I.ifscCode,branchName:I.branchName,accountHolderName:I.accountHolderName,registeredAddress:I.registeredAddress};n(T),I.uploadedDocuments&&c(I.uploadedDocuments||[])}catch(I){console.error("Failed to fetch application details",I)}finally{a(!1)}},[t]),R=v.useCallback(async()=>{if(t)try{const A=await hE.getChecklist(t);A.success&&A.data&&h(A.data)}catch{h(null)}},[t]),P=A=>g.find(I=>I.depositType===A);return v.useEffect(()=>{t&&(w(),C())},[t]),v.useEffect(()=>{t&&R()},[t,s==null?void 0:s.status]),v.useEffect(()=>{if(!(s!=null&&s.id))return;(async()=>{p(!0);try{const I=await o$.getAuditLogs("application",s.id,1,100);f(Array.isArray(I)?I:[])}catch{f([])}finally{p(!1)}try{const I=await c$.getWorknotes("application",s.id);j(I.data||[])}catch{j([])}})()},[s==null?void 0:s.id]),v.useEffect(()=>{if(!t)return;(async()=>{try{const[I,$]=await Promise.all([ds.getSecurityDeposit(t),ds.getSystemConfigs({category:"SECURITY_DEPOSIT",format:"map"})]);y(Array.isArray(I)?I:[I].filter(Boolean)),S($||{})}catch(I){console.error("Failed to fetch payment data",I)}})()},[t]),{application:s,loading:r,setLoading:a,documents:l,setDocuments:c,eorData:d,auditLogs:x,auditLoading:m,worknotes:u,deposits:g,paymentConfigs:N,refreshDocuments:C,fetchApplication:w,fetchEorData:R,getDeposit:P}}function u$({application:t,applicationId:s,tempFirmType:n,setUpdatingFirmType:r,setShowFirmTypeModal:a,setStatutoryForm:l,setIsEditingStatutory:c,setIsSavingStatutory:d,statutoryForm:h,setFddAgencies:x,selectedAgencyId:f,setIsAssigningAgency:m,fetchApplication:p}){const u=async()=>{try{r(!0),await ds.updateApplication(s,{constitutionType:n}),ee.success("Firm type updated successfully"),a(!1),await p()}catch{ee.error("Failed to update firm type")}finally{r(!1)}},j=()=>{t&&(l({accountHolderName:t.accountHolderName||"",panNumber:t.panNumber||"",gstNumber:t.gstNumber||"",bankName:t.bankName||"",accountNumber:t.accountNumber||"",ifscCode:t.ifscCode||"",registeredAddress:t.registeredAddress||""}),c(!0))},g=async()=>{try{d(!0),await ds.updateApplication(s,h),ee.success("Statutory & Bank details updated successfully"),c(!1),await p(!0)}catch{ee.error("Failed to update details")}finally{d(!1)}},y=v.useCallback(async()=>{try{const S=await ds.getUsers({roleCode:"FDD"});x(Array.isArray(S)?S:[])}catch{x([])}},[x]);return{handleUpdateFirmType:u,handleEditStatutory:j,handleSaveStatutory:g,fetchFddAgencies:y,handleAssignAgency:async()=>{if(!f){ee.warning("Please select an agency");return}try{m(!0),await ds.assignFddAgency({applicationId:(t==null?void 0:t.id)||s,assignedToAgency:f}),await ds.addParticipant({requestId:(t==null?void 0:t.id)||s,requestType:"application",userId:f,participantType:"contributor"}),ee.success("FDD Agency assigned and added as participant"),await p()}catch{ee.error("Failed to assign agency")}finally{m(!1)}}}}function h$({application:t,documents:s,interviews:n,eorData:r,getDeposit:a}){var g;const l=y=>String(y||"").trim().toLowerCase().replace(/[_\s-]+/g," "),c=(y,N)=>{var w,R,P;const S=[(w=y==null?void 0:y.user)==null?void 0:w.role,(R=y==null?void 0:y.user)==null?void 0:R.roleCode,(P=y==null?void 0:y.metadata)==null?void 0:P.role].map(l),C=N.map(l);return S.some(A=>C.includes(A))},d=y=>{var N,S,C,w,R;return`${((N=y==null?void 0:y.user)==null?void 0:N.fullName)||((S=y==null?void 0:y.user)==null?void 0:S.name)||"User"} (${((C=y==null?void 0:y.user)==null?void 0:C.role)||((w=y==null?void 0:y.user)==null?void 0:w.roleCode)||((R=y==null?void 0:y.metadata)==null?void 0:R.role)||(y==null?void 0:y.participantType)||"participant"})`},h=y=>(s||[]).some(N=>N.documentType===y),x=y=>(n||[]).some(N=>{var S;return(N.level===y||N.level===y.toString())&&((S=N.status)==null?void 0:S.toLowerCase())==="scheduled"}),f=(y,N)=>{const S=(t.progressTracking||[]).find(C=>C.stageName===y);return S&&(S.status==="completed"||S.status==="active")?S.status:N()},m=[{id:1,name:"Submitted",status:"completed",date:t.submissionDate,description:"Application submitted",documentsUploaded:3},{id:2,name:"Questionnaire",status:f("Questionnaire",()=>["Questionnaire Completed","Shortlisted","Level 1 Interview Pending","Level 1 Approved","Level 2 Interview Pending","Level 2 Approved","Level 2 Recommended","Level 3 Interview Pending","Level 3 Approved","FDD Verification","LOI In Progress","Payment Pending","LOI Issued","Statutory LOI Ack","Dealer Code Generation","Architecture Work","Statutory Work","LOA Pending","LOA Issued","EOR In Progress","EOR Complete","Inauguration","Approved","Onboarded"].includes(t.status)?"completed":t.status==="Questionnaire Pending"?"active":"pending"),date:t.questionnaireDate,description:"Questionnaire completed",documentsUploaded:0},{id:3,name:"Shortlist",status:f("Shortlist",()=>["Shortlisted","Level 1 Interview Pending","Level 1 Approved","Level 2 Interview Pending","Level 2 Approved","Level 2 Recommended","Level 3 Interview Pending","Level 3 Approved","FDD Verification","LOI In Progress","Payment Pending","LOI Issued","Statutory LOI Ack","Dealer Code Generation","Architecture Work","Statutory Work","LOA Pending","LOA Issued","EOR In Progress","EOR Complete","Inauguration","Approved","Rejected","Onboarded"].includes(t.status)?"completed":"pending"),date:t.shortlistDate,description:"Application shortlisted by DD",evaluators:Array.from(new Set((t.participants||[]).filter(y=>y.participantType==="assignee").map(y=>{var N,S,C;return`${((N=y.user)==null?void 0:N.fullName)||((S=y.user)==null?void 0:S.name)||"User"} (${((C=y.user)==null?void 0:C.roleCode)||y.participantType})`}))),documentsUploaded:2},{id:4,name:"1st Level Interview",status:f("1st Level Interview",()=>["Level 1 Approved","Level 2 Interview Pending","Level 2 Approved","Level 2 Recommended","Level 3 Interview Pending","Level 3 Approved","FDD Verification","LOI In Progress","Payment Pending","LOI Issued","Statutory LOI Ack","Dealer Code Generation","Architecture Work","Statutory Work","LOA Pending","LOA Issued","EOR In Progress","EOR Complete","Inauguration","Approved","Onboarded"].includes(t.status)?"completed":t.status==="Level 1 Interview Pending"&&x(1)?"active":"pending"),date:t.level1InterviewDate,description:"DD-ZM + RBM evaluation",evaluators:Array.from(new Set((t.participants||[]).filter(y=>{var N,S,C,w,R,P;return((N=y.metadata)==null?void 0:N.interviewLevel)===1||((S=y.metadata)==null?void 0:S.interviewLevel)==="1"||((w=(C=y.metadata)==null?void 0:C.allAssignments)==null?void 0:w.includes(1))||((P=(R=y.metadata)==null?void 0:R.allAssignments)==null?void 0:P.includes("1"))||c(y,["DD-ZM","RBM"])}).map(d))),documentsUploaded:1},{id:5,name:"2nd Level Interview",status:f("2nd Level Interview",()=>["Level 2 Approved","Level 2 Recommended","Level 3 Interview Pending","Level 3 Approved","FDD Verification","LOI In Progress","Payment Pending","LOI Issued","Statutory LOI Ack","Dealer Code Generation","Architecture Work","Statutory Work","LOA Pending","LOA Issued","EOR In Progress","EOR Complete","Inauguration","Approved","Onboarded"].includes(t.status)?"completed":t.status==="Level 2 Interview Pending"&&x(2)?"active":"pending"),date:t.level2InterviewDate,description:"DD Lead + ZBH evaluation",evaluators:Array.from(new Set((t.participants||[]).filter(y=>{var N,S,C,w,R,P;return((N=y.metadata)==null?void 0:N.interviewLevel)===2||((S=y.metadata)==null?void 0:S.interviewLevel)==="2"||((w=(C=y.metadata)==null?void 0:C.allAssignments)==null?void 0:w.includes(2))||((P=(R=y.metadata)==null?void 0:R.allAssignments)==null?void 0:P.includes("2"))||c(y,["DD Lead","ZBH"])}).map(d))),documentsUploaded:1},{id:6,name:"3rd Level Interview",status:f("3rd Level Interview",()=>["Level 3 Approved","FDD Verification","LOI In Progress","Payment Pending","LOI Issued","Statutory LOI Ack","Dealer Code Generation","Architecture Work","Statutory Work","LOA Pending","LOA Issued","EOR In Progress","EOR Complete","Inauguration","Approved","Onboarded"].includes(t.status)?"completed":t.status==="Level 3 Interview Pending"&&x(3)?"active":"pending"),date:t.level3InterviewDate,description:"NBH + DD Head evaluation",evaluators:Array.from(new Set((t.participants||[]).filter(y=>{var N,S,C,w,R,P;return((N=y.metadata)==null?void 0:N.interviewLevel)===3||((S=y.metadata)==null?void 0:S.interviewLevel)==="3"||((w=(C=y.metadata)==null?void 0:C.allAssignments)==null?void 0:w.includes(3))||((P=(R=y.metadata)==null?void 0:R.allAssignments)==null?void 0:P.includes("3"))||c(y,["NBH","DD Head"])}).map(d))),documentsUploaded:2},{id:7,name:"FDD",status:f("FDD",()=>["LOI In Progress","Payment Pending","LOI Issued","Statutory LOI Ack","Dealer Code Generation","Architecture Work","Statutory Work","LOA Pending","LOA Issued","EOR In Progress","EOR Complete","Inauguration","Approved","Onboarded"].includes(t.status)?"completed":t.status==="FDD Verification"?"active":"pending"),date:t.fddDate,description:"Financial Due Diligence",documentsUploaded:5},{id:8,name:"LOI Approval",status:f("LOI Approval",()=>["Security Details","Payment Pending","LOI Issued","Statutory LOI Ack","Dealer Code Generation","Architecture Work","Statutory Work","LOA Pending","LOA Issued","EOR In Progress","EOR Complete","Inauguration","Approved","Onboarded"].includes(t.status)?"completed":t.status==="LOI In Progress"?"active":"pending"),date:t.loiApprovalDate,description:"Letter of Intent approval",evaluators:Array.from(new Set((t.participants||[]).filter(y=>{var N,S,C;return((N=y.metadata)==null?void 0:N.stageCode)==="LOI_APPROVAL"||((C=(S=y.metadata)==null?void 0:S.allAssignments)==null?void 0:C.includes("LOI_APPROVAL"))}).map(d))),documentsUploaded:1},{id:9,name:"Security Details",status:f("Security Details",()=>["LOI Issued","Statutory LOI Ack","Dealer Code Generation","Architecture Work","Statutory Work","LOA Pending","LOA Issued","EOR In Progress","EOR Complete","Inauguration","Approved","Onboarded"].includes(t.status)?"completed":t.status==="Security Details"||t.status==="Payment Pending"?"active":"pending"),date:t.securityDetailsDate,description:"Security verification",documentsUploaded:3},{id:10,name:"LOI Issue",status:f("LOI Issue",()=>["Statutory LOI Ack","Dealer Code Generation","Architecture Work","Statutory Work","LOA Pending","LOA Issued","EOR In Progress","EOR Complete","Inauguration","Approved","Onboarded"].includes(t.status)?"completed":t.status==="LOI Issued"?"active":"pending"),date:t.loiIssueDate,description:"Letter of Intent issued",documentsUploaded:1},{id:11,name:"Dealer Code Generation",status:f("Dealer Code Generation",()=>t.dealerCode||["Dealer Code Generation","Architecture Work","Statutory Work","LOA Pending","LOA Issued","EOR In Progress","EOR Complete","Inauguration","Approved","Onboarded"].includes(t.status)?"completed":"pending"),date:t.dealerCodeDate,description:"Dealer code generated and assigned",isParallel:!0,branches:[{name:"Architectural Work",color:"green",stages:[{id:"11a-1",name:"Architecture Assignment",status:t.architectureAssignedTo?"completed":t.status==="Architecture Team Assigned"?"active":"pending",description:"Assigned to architecture team"},{id:"11a-2",name:"Site Plan Blueprint",status:h("Architecture Blueprint")?"completed":t.architectureAssignedTo?"active":"pending",description:"Blueprints and site plans"},{id:"11a-3",name:"Architecture Work",status:t.architectureStatus==="COMPLETED"?"completed":t.architectureStatus==="IN_PROGRESS"||h("Architecture Blueprint")?"active":"pending",description:"Final architecture approval"}]},{name:"Statutory Documents",color:"green",stages:[{id:"11b-1",name:"GST",status:h("GST Certificate")||h("GST")?"completed":"active",description:"GST certificate"},{id:"11b-2",name:"PAN",status:h("PAN Card")||h("PAN")?"completed":"active",description:"PAN card"},{id:"11b-3",name:"Nodal Agreement",status:h("Nodal Agreement")?"completed":"active",description:"Nodal agreement document"},{id:"11b-4",name:"Cancelled Check",status:h("Cancelled Check")?"completed":"active",description:"Cancelled check copy"},{id:"11b-5",name:"Partnership Deed/LLP/MOA/AOA/COI",status:h("Partnership Deed/LLP/MOA/AOA/COI")||h("Partnership Deed")?"completed":"active",description:"Business entity documents"},{id:"11b-6",name:"Firm Registration Certificate",status:h("Firm Registration Certificate")||h("Firm Registration")?"completed":"active",description:"Firm registration certificate"},{id:"11b-7",name:"Rental agreement/ Lease agreement / Own/ Land agreement",status:h("Rental agreement/ Lease agreement / Own/ Land agreement")||h("Property Document")?"completed":"active",description:"Property agreement document"},{id:"11b-8",name:"Virtual Code",status:h("Virtual Code")||h("Virtual Code Confirmation")?"completed":"active",description:"Virtual code availability"},{id:"11b-9",name:"Domain ID",status:h("Domain ID")||h("Domain ID Setup")?"completed":"active",description:"Domain ID setup"},{id:"11b-10",name:"MSD Configuration",status:h("MSD Configuration")?"completed":"active",description:"Microsoft Dynamics configuration"},{id:"11b-11",name:"LOI Acknowledgement Copy",status:h("LOI Acknowledgement Copy")||h("LOI Acknowledgement")?"completed":"active",description:"LOI acknowledgement copy"}]}]},{id:12,name:"LOA",status:f("LOA",()=>["EOR In Progress","EOR Complete","Inauguration","Approved","Onboarded"].includes(t.status)?"completed":t.status==="LOA Pending"?"active":"pending"),isLocked:t.status==="LOA Pending"&&((g=a("FIRST_FILL"))==null?void 0:g.status)!=="Verified",lockMessage:"First Fill (₹15L) must be verified by Finance before LOA Approval.",evaluators:Array.from(new Set((t.participants||[]).filter(y=>{var N,S,C;return((N=y.metadata)==null?void 0:N.stageCode)==="LOA_APPROVAL"||((C=(S=y.metadata)==null?void 0:S.allAssignments)==null?void 0:C.includes("LOA_APPROVAL"))}).map(d))),description:"Letter of Authorization"},{id:13,name:"EOR Complete",status:f("EOR Complete",()=>["Inauguration","Approved","Onboarded"].includes(t.status)?"completed":t.status==="EOR Complete"?"active":"pending"),description:"Essential Operating Requirements"},{id:14,name:"Inauguration",status:f("Inauguration",()=>["Approved","Onboarded"].includes(t.status)?"completed":t.status==="Inauguration"?"active":"pending"),description:"Dealership inauguration"},{id:15,name:"Dealership Active",status:f("Onboarded",()=>t.status==="Onboarded"?"completed":["Inauguration","Approved"].includes(t.status)?"active":"pending"),description:"Dealer profile active"}],p=[{id:1,item:"Sales Standards",completed:!1},{id:2,item:"Service & Spares",completed:!1},{id:3,item:"DMS infra",completed:!1},{id:4,item:"Manpower Training",completed:!1},{id:5,item:"Trade certificate with test ride bikes registration",completed:!1},{id:6,item:"GST certificate including Accessories & Apparels billing",completed:!1},{id:7,item:"Inventory Funding",completed:!1},{id:8,item:"Virtual code availability",completed:!1},{id:9,item:"Vendor payments",completed:!1},{id:10,item:"Details for website submission",completed:!1},{id:11,item:"Infra Insurance both Showroom and Service center",completed:!1},{id:12,item:"Auto ordering",completed:!1}],u=m.reduce((y,N)=>(y.push({name:N.name}),N.branches&&N.branches.forEach(S=>S.stages.forEach(C=>y.push({name:C.name,parentBranch:S.name}))),(N.name==="EOR In Progress"||N.name==="EOR Complete")&&((r==null?void 0:r.items)||p).forEach(S=>y.push({name:`EOR: ${S.description||S.item}`,parentBranch:"EOR"})),y),[]);return{processStages:m,eorChecklist:p,flattenedStages:u,getDocumentsForStage:y=>s.filter(N=>{var S;return N.stage===y||!N.stage&&((S=N.documentType)==null?void 0:S.toLowerCase().includes(y.toLowerCase().split(" ")[0]))})}}const o1=()=>{var ul;const{id:t}=Bc(),s=qn(),{user:n}=Nn(ga=>ga.auth),r=t||"",a=()=>s(-1),{application:l,loading:c,setLoading:d,documents:h,setDocuments:x,eorData:f,auditLogs:m,auditLoading:p,worknotes:u,deposits:j,paymentConfigs:g,refreshDocuments:y,fetchApplication:N,fetchEorData:S,getDeposit:C}=d$({applicationId:r}),w=f!=null&&f.items?f.items.filter(ga=>ga.isCompliant).length/f.items.length*100:0,R=Ul(),{showFirmTypeModal:P,setShowFirmTypeModal:A,updatingFirmType:I,setUpdatingFirmType:$,tempFirmType:T,setTempFirmType:E,activeTab:_,setActiveTab:M,showApproveModal:q,setShowApproveModal:G,showOnboardModal:Z,setShowOnboardModal:W,isOnboarding:z,setIsOnboarding:F,showRejectModal:B,setShowRejectModal:D,rejectionReason:O,setRejectionReason:V,scheduledInterviewParticipants:K,setScheduledInterviewParticipants:Y,showScheduleModal:U,setShowScheduleModal:X,showCancelInterviewModal:ne,setShowCancelInterviewModal:oe,interviewIdToCancel:re,setInterviewIdToCancel:ge,showKTMatrixModal:ve,setShowKTMatrixModal:Se,showLevel2FeedbackModal:We,setShowLevel2FeedbackModal:Ce,showLevel3FeedbackModal:fe,setShowLevel3FeedbackModal:Ye,showDocumentsModal:be,setShowDocumentsModal:_e,showAssignModal:ke,setShowAssignModal:qe,selectedStage:Ve,setSelectedStage:dt,interviewMode:xt,setInterviewMode:ye,approvalRemark:le,setApprovalRemark:Qe,expandedBranches:rt,setExpandedBranches:Kt,users:Rt,setUsers:Re,selectedUser:Qt,setSelectedUser:qt,participantType:ws,setParticipantType:_s,interviewDate:ns,setInterviewDate:Cs,interviewType:Bs,setInterviewType:Ft,meetingLink:ie,setMeetingLink:Fe,location:Q,setLocation:pe,showUploadForm:Ne,setShowUploadForm:Ee,uploadFile:it,setUploadFile:st,uploadDocType:bt,setUploadDocType:Ue,approvalFile:Lt,setApprovalFile:ut,isUploading:yt,setIsUploading:kt,previewDoc:Ie,setPreviewDoc:_t,showPreviewModal:ht,setShowPreviewModal:zt,selectedInterviewerId:rs,setSelectedInterviewerId:Yt,isEditingStatutory:Os,setIsEditingStatutory:Is,statutoryForm:zs,setStatutoryForm:en,isSavingStatutory:he,setIsSavingStatutory:Ge,interviews:at,setInterviews:pt,isScheduling:mt,setIsScheduling:Bt,isCancellingInterview:Ds,setIsCancellingInterview:as,showAssignArchitectureModal:Vs,setShowAssignArchitectureModal:Ls,architectureLeadId:Ts,setArchitectureLeadId:ln,isAssigningArchitecture:pn,setIsAssigningArchitecture:hn,showArchitectureStatusModal:Ws,setShowArchitectureStatusModal:Qs,architectureStatus:zn,setArchitectureStatus:on,architectureRemarks:Un,setArchitectureRemarks:yr,isUpdatingArchitecture:Tr,setIsUpdatingArchitecture:er,isAssigningParticipant:tr,setIsAssigningParticipant:En,documentConfigs:Xe,setDocumentConfigs:$t,fddAgencies:Ze,setFddAgencies:Ut,selectedAgencyId:jt,setSelectedAgencyId:In,isAssigningAgency:jr,setIsAssigningAgency:Pr,isApproving:xn,setIsApproving:qs,isRejecting:ha,setIsRejecting:Tt,ktMatrixScores:xs,setKtMatrixScores:Vr,ktMatrixSelectedValues:ta,setKtMatrixSelectedValues:ma,ktMatrixRemarks:_r,setKtMatrixRemarks:sr,ktMatrixRecommendation:gn,setKtMatrixRecommendation:mn,isSubmittingKT:Qn,setIsSubmittingKT:fr,selectedInterviewForFeedback:pr,setSelectedInterviewForFeedback:dn,showFddFinalizeModal:wn,setShowFddFinalizeModal:Da,showFddFlagModal:fa,setShowFddFlagModal:Ai,fddAuditRecommendation:ki,setFddAuditRecommendation:ni,fddAuditFindings:rl,setFddAuditFindings:Go,isFinalizingFdd:Ta,setIsFinalizingFdd:ri,isFddFlagging:Pa,setIsFddFlagging:_a,level2Feedback:to,setLevel2Feedback:Zc,level2Recommendation:Oa,setLevel2Recommendation:Vn,isSubmittingLevel2:ai,setIsSubmittingLevel2:Ri,level3Feedback:Or,setLevel3Feedback:so,level3Recommendation:Ei,setLevel3Recommendation:no,isSubmittingLevel3:ii,setIsSubmittingLevel3:al,showFeedbackDetailsModal:ro,setShowFeedbackDetailsModal:Hs,selectedEvaluationForView:J,setSelectedEvaluationForView:te}=s$({initialTab:((ul=R.state)==null?void 0:ul.activeTab)||"questionnaire"}),ue=(u||[]).some(ga=>(ga.noteText||"").includes("FLAGGED:"))||(l==null?void 0:l.statutoryStatus)==="Flagged",{handleUpdateFirmType:xe,handleEditStatutory:we,handleSaveStatutory:$e,fetchFddAgencies:Be,handleAssignAgency:lt}=u$({application:l,applicationId:r,tempFirmType:T,setUpdatingFirmType:$,setShowFirmTypeModal:A,setStatutoryForm:en,setIsEditingStatutory:Is,setIsSavingStatutory:Ge,statutoryForm:zs,setFddAgencies:Ut,selectedAgencyId:jt,setIsAssigningAgency:Pr,fetchApplication:N}),Jt=(n==null?void 0:n.roleCode)==="Super Admin"||(n==null?void 0:n.roleCode)==="DD Admin"||(n==null?void 0:n.role)==="Super Admin"||(n==null?void 0:n.role)==="DD Admin",Mt=(n==null?void 0:n.roleCode)==="Super Admin"||(n==null?void 0:n.roleCode)==="DD Admin"||(n==null?void 0:n.role)==="Super Admin"||(n==null?void 0:n.role)==="DD Admin"||(n==null?void 0:n.role)==="NBH"||(n==null?void 0:n.role)==="DD Head"||(n==null?void 0:n.roleCode)==="NBH"||(n==null?void 0:n.roleCode)==="DD_HEAD";v.useEffect(()=>{(async()=>{try{const li=await ds.getDocumentConfigs({limit:1e3}),Bf=li.data||(Array.isArray(li)?li:[]);$t(Bf)}catch(li){console.error("Failed to fetch document configs:",li)}})()},[$t]),v.useEffect(()=>{U&&l&&(l.status==="Shortlisted"||l.status==="Questionnaire Completed"?Ft("level1"):l.status==="Level 1 Approved"?Ft("level2"):(l.status==="Level 2 Approved"||l.status==="Level 2 Recommended")&&Ft("level3"))},[U,l==null?void 0:l.status,Ft]);const Et=async()=>{if(r)try{const ga=await ds.getInterviews(r);pt(ga||[])}catch(ga){console.error("Failed to fetch interviews",ga)}};v.useEffect(()=>{Et()},[r]);const{ktMatrixConfig:gs,level2Config:tn,level3Config:Hn}=i$(),{handleKTMatrixChange:Ot,calculateKTScore:bs,handleSubmitKTMatrix:es,handleLevel2Change:Sn,handleSubmitLevel2Feedback:xr,handleLevel3Change:Dn,handleSubmitLevel3Feedback:nr,ktCriteria:Ir,l2Fields:Ia,l3Fields:rr}=a$({ktMatrixScores:xs,setKtMatrixScores:Vr,setKtMatrixSelectedValues:ma,ktMatrixRemarks:_r,setKtMatrixRemarks:sr,ktMatrixRecommendation:gn,setKtMatrixRecommendation:mn,selectedInterviewForFeedback:pr,interviews:at,setIsSubmittingKT:fr,setShowKTMatrixModal:Se,level2Feedback:to,setLevel2Feedback:Zc,level2Recommendation:Oa,setLevel2Recommendation:Vn,setIsSubmittingLevel2:Ri,setShowLevel2FeedbackModal:Ce,level3Feedback:Or,setLevel3Feedback:so,level3Recommendation:Ei,setLevel3Recommendation:no,setIsSubmittingLevel3:al,setShowLevel3FeedbackModal:Ye,currentUser:n,fetchInterviews:Et,fetchApplication:N,ktMatrixConfig:gs,level2Config:tn,level3Config:Hn});v.useEffect(()=>{["documents","progress","fdd","eor"].includes(_)&&r&&y(),_==="fdd"&&((n==null?void 0:n.role)==="DD Admin"||(n==null?void 0:n.role)==="Super Admin")&&Be()},[_,r,y,Be,n==null?void 0:n.role]);const{handleAddInterviewer:ao,handleRemoveInterviewer:il,maybeFetchUsersForModal:io,handleScheduleInterview:lo,handleCancelInterview:ll,handleConfirmCancelInterview:Di,handleUpload:La,handleApprove:Ko,handleReject:ar,handleGenerateDealerCodes:Yo,handleAssignArchitecture:pa,handleUpdateArchitectureStatus:ol,handleAddParticipant:Ti,handleRetriggerEvaluators:xa}=l$({application:l,applicationId:r,currentUser:n,interviews:at,approvalFile:Lt,approvalRemark:le,rejectionReason:O,architectureLeadId:Ts,architectureStatus:zn,architectureRemarks:Un,selectedUser:Qt,participantType:ws,users:Rt,interviewDate:ns,interviewType:Bs,interviewMode:xt,meetingLink:ie,location:Q,scheduledInterviewParticipants:K,uploadFile:it,uploadDocType:bt,selectedStage:Ve,setIsApproving:qs,setShowApproveModal:G,setApprovalRemark:Qe,setApprovalFile:ut,setIsRejecting:Tt,setShowRejectModal:D,setRejectionReason:V,setIsAssigningArchitecture:hn,setShowAssignArchitectureModal:Ls,setIsUpdatingArchitecture:er,setShowArchitectureStatusModal:Qs,setIsAssigningParticipant:En,setSelectedUser:qt,setShowAssignModal:qe,setLoading:d,setIsScheduling:Bt,setShowScheduleModal:X,setShowCancelInterviewModal:oe,interviewIdToCancel:re,setInterviewIdToCancel:ge,setIsCancellingInterview:as,setIsUploading:kt,setShowUploadForm:Ee,setUploadFile:st,setUploadDocType:Ue,setDocuments:x,selectedInterviewerId:rs,setSelectedInterviewerId:Yt,setScheduledInterviewParticipants:Y,setUsers:Re,showScheduleModal:U,showAssignArchitectureModal:Vs,showAssignModal:ke,fetchApplication:N,fetchInterviews:Et,fetchEorData:S});if(v.useEffect(()=>{io()},[U,Vs,ke,Bs,l==null?void 0:l.id,io]),c&&!l)return e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx(ss,{className:"w-10 h-10 animate-spin text-amber-600"})});if(!l)return e.jsx("div",{className:"flex justify-center items-center h-96",children:"Application not found"});const{processStages:Ma,eorChecklist:cl,flattenedStages:Pi,getDocumentsForStage:oo}=h$({application:l,documents:h,interviews:at,eorData:f,getDeposit:C}),{activeInterviewForUser:ku,currentUserEvaluation:dl,hasSubmittedFeedback:Lf,currentUserStageAction:Mf,isInterviewCompleted:Ff,isInterviewActive:Ru,permissions:Eu}=t$({application:l,interviews:at,currentUser:n,getDeposit:C,eorProgress:w}),co=()=>e.jsx(J7,{application:l,currentUser:n,documents:h,fddAgencies:Ze,selectedAgencyId:jt,setSelectedAgencyId:In,isAssigningAgency:jr,handleAssignAgency:lt,setPreviewDoc:_t,setShowPreviewModal:zt,setIsUploading:kt,fetchApplication:N,refreshDocuments:y});return e.jsxs("div",{className:"space-y-6",children:[e.jsx(M7,{application:l,isNonResponsive:ue,isAdmin:Mt,onBack:a,onOpenWorknotes:()=>s(`/worknotes/application/${l.id}`,{state:{applicationName:l.name,registrationNumber:l.registrationNumber,participants:l.participants}})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsx(V7,{application:l,canEditStatutory:Jt,isEditingStatutory:Os,isSavingStatutory:he,statutoryForm:zs,onEditFirmType:()=>{E(l.constitutionType||""),A(!0)},onEditStatutory:we,onCancelEditStatutory:()=>Is(!1),onSaveStatutory:$e,onStatutoryFormChange:en}),l.isShortlisted!==!1&&e.jsx(K7,{application:l,activeTab:_,setActiveTab:M,processStages:Ma,documents:h,interviews:at,expandedBranches:rt,setExpandedBranches:Kt,setSelectedStage:dt,setShowDocumentsModal:_e,setShowUploadForm:Ee,handleRetriggerEvaluators:xa,handleCancelInterview:ll,setSelectedEvaluationForView:te,setShowFeedbackDetailsModal:Hs,renderFddAuditContent:co,eorProgress:w,eorData:f,eorChecklist:cl,setUploadDocType:Ue,isAdmin:Mt,fetchApplication:N,fetchEorData:S,deposits:j,getDeposit:C,paymentConfigs:g,setPreviewDoc:_t,setShowPreviewModal:zt,auditLoading:p,auditLogs:m,auditLogActionBadgeClass:e$})]}),e.jsx(Y7,{application:l,permissions:Eu,getDeposit:C,isNonResponsive:ue,isAdmin:Mt,currentUserStageAction:Mf,currentUserEvaluation:dl,onOpenApproveModal:()=>G(!0),onOpenRejectModal:()=>D(!0),onOpenWorknote:()=>s(`/worknotes/application/${l.id}`,{state:{applicationName:l.name,registrationNumber:l.registrationNumber,participants:l.participants}}),onOpenScheduleModal:()=>X(!0),currentUser:n,handleGenerateDealerCodes:Yo,onOpenAssignArchitectureModal:()=>Ls(!0),activeInterviewForUser:ku,hasSubmittedFeedback:Lf,setSelectedInterviewForFeedback:dn,setShowKTMatrixModal:Se,setShowLevel2FeedbackModal:Ce,setShowLevel3FeedbackModal:Ye,onGoToDashboard:()=>s("/dashboard"),showAssignModal:ke,setShowAssignModal:qe,selectedUser:Qt,setSelectedUser:qt,users:Rt,participantType:ws,setParticipantType:_s,handleAddParticipant:Ti,isAssigningParticipant:tr}),e.jsx(Z7,{application:l,fetchApplication:N,showApproveModal:q,setShowApproveModal:G,approvalRemark:le,setApprovalRemark:Qe,setApprovalFile:ut,isApproving:xn,handleApprove:Ko,showOnboardModal:Z,setShowOnboardModal:W,isOnboarding:z,setIsOnboarding:F,showRejectModal:B,setShowRejectModal:D,rejectionReason:O,setRejectionReason:V,isRejecting:ha,handleReject:ar,showScheduleModal:U,setShowScheduleModal:X,showCancelInterviewModal:ne,setShowCancelInterviewModal:oe,setInterviewIdToCancel:ge,isCancellingInterview:Ds,handleConfirmCancelInterview:Di,interviewType:Bs,setInterviewType:Ft,interviewMode:xt,setInterviewMode:ye,interviewDate:ns,setInterviewDate:Cs,meetingLink:ie,setMeetingLink:Fe,location:Q,setLocation:pe,isInterviewCompleted:Ff,isInterviewActive:Ru,users:Rt,selectedInterviewerId:rs,setSelectedInterviewerId:Yt,handleAddInterviewer:ao,scheduledInterviewParticipants:K,handleRemoveInterviewer:il,isScheduling:mt,handleScheduleInterview:lo,showAssignArchitectureModal:Vs,setShowAssignArchitectureModal:Ls,architectureLeadId:Ts,setArchitectureLeadId:ln,isAssigningArchitecture:pn,handleAssignArchitecture:pa,showArchitectureStatusModal:Ws,setShowArchitectureStatusModal:Qs,architectureStatus:zn,setArchitectureStatus:on,architectureRemarks:Un,setArchitectureRemarks:yr,isUpdatingArchitecture:Tr,handleUpdateArchitectureStatus:ol}),e.jsx(Q7,{application:l,ktCriteria:Ir,l2Fields:Ia,l3Fields:rr,showKTMatrixModal:ve,setShowKTMatrixModal:Se,ktMatrixSelectedValues:ta,handleKTMatrixChange:Ot,ktMatrixRemarks:_r,setKtMatrixRemarks:sr,ktMatrixRecommendation:gn,setKtMatrixRecommendation:mn,calculateKTScore:bs,handleSubmitKTMatrix:es,isSubmittingKT:Qn,showLevel2FeedbackModal:We,setShowLevel2FeedbackModal:Ce,level2Feedback:to,handleLevel2Change:Sn,level2Recommendation:Oa,setLevel2Recommendation:Vn,handleSubmitLevel2Feedback:xr,isSubmittingLevel2:ai,showFeedbackDetailsModal:ro,setShowFeedbackDetailsModal:Hs,selectedEvaluationForView:J,selectedInterviewForFeedback:pr,showLevel3FeedbackModal:fe,setShowLevel3FeedbackModal:Ye,level3Feedback:Or,handleLevel3Change:Dn,level3Recommendation:Ei,setLevel3Recommendation:no,handleSubmitLevel3Feedback:nr,isSubmittingLevel3:ii,showDocumentsModal:be,setShowDocumentsModal:_e,showUploadForm:Ne,setShowUploadForm:Ee,selectedStage:Ve,getDocumentsForStage:oo,setPreviewDoc:_t,setShowPreviewModal:zt,flattenedStages:Pi,setSelectedStage:dt,uploadDocType:bt,setUploadDocType:Ue,setUploadFile:st,isUploading:yt,handleUpload:La,uploadFile:it,documentConfigs:Xe,showPreviewModal:ht,previewDoc:Ie,showFddFinalizeModal:wn,setShowFddFinalizeModal:Da,currentUser:n,fddAuditRecommendation:ki,setFddAuditRecommendation:ni,fddAuditFindings:rl,setFddAuditFindings:Go,isFinalizingFdd:Ta,setIsFinalizingFdd:ri,fetchApplication:N,showFddFlagModal:fa,setShowFddFlagModal:Ai,isFddFlagging:Pa,setIsFddFlagging:_a,showFirmTypeModal:P,setShowFirmTypeModal:A,tempFirmType:T,setTempFirmType:E,updatingFirmType:I,handleUpdateFirmType:xe})]})]})},Kx=t=>t.includes("Approved")||t.includes("Completed")?"bg-green-100 text-green-700 border-green-300":t.includes("Review")||t.includes("Pending")?"bg-yellow-100 text-yellow-700 border-yellow-300":t.includes("Rejected")?"bg-red-100 text-red-700 border-red-300":"bg-blue-100 text-blue-700 border-blue-300";function m$({onViewDetails:t}){const[s,n]=v.useState([]),[r,a]=v.useState(!0),[l,c]=v.useState(1),[d,h]=v.useState("all"),[x,f]=v.useState(null),m=10,p=async()=>{var y;a(!0);try{const S=(await Te.getResignations({page:l,limit:m,status:d==="all"?void 0:d==="open"?"open":"Completed,Closed"})).data;S!=null&&S.success&&(n(S.requests||((y=S.resignations)==null?void 0:y.rows)||S.resignations||[]),f(S.meta))}catch(N){console.error("Error fetching resignations:",N),ee.error("Failed to fetch resignation requests")}finally{a(!1)}};v.useEffect(()=>{p()},[l,d]);const u=y=>{h(y),c(1)},j=d==="open"?s:[],g=d==="completed"?s:[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs(Le,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"All Requests"}),e.jsx(nt,{className:"text-3xl",children:(x==null?void 0:x.total)||0})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Total Requests"})})]}),e.jsxs(Le,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Open"}),e.jsx(nt,{className:"text-3xl text-yellow-600",children:d==="open"?(x==null?void 0:x.total)||0:"..."})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Requires Your Action"})})]}),e.jsxs(Le,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Completed"}),e.jsx(nt,{className:"text-3xl text-green-600",children:d==="completed"?(x==null?void 0:x.total)||0:"..."})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Finalized"})})]})]}),e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(nt,{children:"Resignation Requests"}),e.jsxs(Zt,{children:["Track and manage dealer resignation requests",e.jsx("span",{className:"block mt-1 text-slate-500",children:"• Note: Resignation requests are initiated by the dealer or via ASM."})]})]})})}),e.jsx(Me,{children:e.jsxs(Pn,{value:d,onValueChange:u,className:"w-full",children:[e.jsxs(_n,{children:[e.jsx(Wt,{value:"all",children:"All Requests"}),e.jsx(Wt,{value:"open",children:"Open"}),e.jsx(Wt,{value:"completed",children:"Completed"})]}),e.jsx(Gt,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4 text-center py-1",children:r?e.jsx("div",{className:"text-center py-12",children:"Loading requests..."}):s.length>0?e.jsxs(e.Fragment,{children:[s.map(y=>{var N,S,C,w,R,P,A,I,$,T,E;return e.jsx(Le,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-amber-100 rounded-lg",children:e.jsx(fs,{className:"w-6 h-6 text-amber-600"})}),e.jsxs("div",{className:"flex-1 text-left",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:y.resignationId}),e.jsx(Ae,{className:Kx(y.status),children:y.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:((S=(N=y.dealer)==null?void 0:N.dealerProfile)==null?void 0:S.businessName)||((C=y.outlet)==null?void 0:C.name)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Code"}),e.jsx("p",{children:((P=(R=(w=y.dealer)==null?void 0:w.dealerProfile)==null?void 0:R.dealerCode)==null?void 0:P.dealerCode)||((A=y.outlet)==null?void 0:A.code)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:(($=(I=y.dealer)==null?void 0:I.dealerProfile)==null?void 0:$.registeredAddress)||((T=y.outlet)!=null&&T.city&&((E=y.outlet)!=null&&E.state)?`${y.outlet.city}, ${y.outlet.state}`:"N/A")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Type"}),e.jsx("p",{children:y.resignationType})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Reason"}),e.jsx("p",{className:"truncate max-w-[200px]",children:y.reason})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Current Stage"}),e.jsx("p",{children:y.currentStage})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx($n,{className:"w-4 h-4 text-slate-500"}),e.jsx("p",{children:Ht(y.submittedOn)})]})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>t(y.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},y.id)}),x&&x.totalPages>1&&e.jsx("div",{className:"py-4 border-t flex justify-center",children:e.jsx(Yl,{children:e.jsxs(Zl,{children:[e.jsx(an,{children:e.jsx(Ql,{onClick:()=>c(y=>Math.max(1,y-1)),className:l===1?"pointer-events-none opacity-50":"cursor-pointer"})}),[...Array(x.totalPages)].map((y,N)=>{const S=N+1;return S===1||S===x.totalPages||S>=l-1&&S<=l+1?e.jsx(an,{children:e.jsx(Ci,{isActive:l===S,onClick:()=>c(S),className:"cursor-pointer",children:S})},S):S===2&&l>3||S===x.totalPages-1&&lc(y=>Math.min(x.totalPages,y+1)),className:l===x.totalPages?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]}):e.jsx("div",{className:"text-center py-12 text-slate-500",children:e.jsx("p",{children:"No resignation requests found"})})})}),e.jsx(Gt,{value:"open",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:j.length>0?j.map(y=>{var N,S,C,w,R,P,A;return e.jsx(Le,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-yellow-100 rounded-lg",children:e.jsx(fs,{className:"w-6 h-6 text-yellow-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:y.resignationId}),e.jsx(Ae,{className:Kx(y.status),children:y.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:((S=(N=y.dealer)==null?void 0:N.dealerProfile)==null?void 0:S.businessName)||((C=y.outlet)==null?void 0:C.name)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:((R=(w=y.dealer)==null?void 0:w.dealerProfile)==null?void 0:R.registeredAddress)||((P=y.outlet)!=null&&P.city&&((A=y.outlet)!=null&&A.state)?`${y.outlet.city}, ${y.outlet.state}`:"N/A")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Current Stage"}),e.jsx("p",{children:y.currentStage})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:Ht(y.submittedOn)})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>t(y.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},y.id)}):e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(fs,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No requests requiring your action"})]})})}),e.jsx(Gt,{value:"completed",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:g.length>0?g.map(y=>{var N,S,C,w,R,P;return e.jsx(Le,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-green-100 rounded-lg",children:e.jsx(fs,{className:"w-6 h-6 text-green-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:y.resignationId}),e.jsx(Ae,{className:Kx(y.status),children:y.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:((S=(N=y.dealer)==null?void 0:N.dealerProfile)==null?void 0:S.businessName)||((C=y.outlet)==null?void 0:C.name)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:((R=(w=y.dealer)==null?void 0:w.dealerProfile)==null?void 0:R.registeredAddress)||((P=y.outlet)==null?void 0:P.city)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Final Stage"}),e.jsx("p",{children:y.currentStage})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:Ht(y.submittedOn)})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>t(y.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},y.id)}):e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(fs,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No completed resignations to display"})]})})})]})})]})]})}const f$=t=>{switch(t){case"Critical":return"bg-red-100 text-red-700 border-red-300";case"High":return"bg-orange-100 text-orange-700 border-orange-300";case"Medium":return"bg-yellow-100 text-yellow-700 border-yellow-300";case"Low":return"bg-blue-100 text-blue-700 border-blue-300";default:return"bg-slate-100 text-slate-700 border-slate-300"}},Yx=t=>t.includes("Approved")||t.includes("Terminated")?"bg-green-100 text-green-700 border-green-300":t.includes("Review")||t.includes("Pending")?"bg-yellow-100 text-yellow-700 border-yellow-300":t.includes("Rejected")?"bg-red-100 text-red-700 border-red-300":"bg-blue-100 text-blue-700 border-blue-300";function p$({currentUser:t,onViewDetails:s}){const[n,r]=v.useState(!1),[a,l]=v.useState([]),[c,d]=v.useState(""),[h,x]=v.useState(!1),[f,m]=v.useState(""),[p,u]=v.useState(null),[j,g]=v.useState([]),[y,N]=v.useState(!0),[S,C]=v.useState(1),[w,R]=v.useState(null),[P,A]=v.useState("all"),I=10,[$,T]=v.useState({terminationCategory:"",reason:"",proposedLwd:"",comments:"",document:null}),E=async()=>{N(!0);try{const D=(await Te.getTerminations({page:S,limit:I,status:P==="all"?void 0:P})).data;D!=null&&D.success&&(g(D.terminations),R(D.meta))}catch(B){console.error("Error fetching terminations:",B),ee.error("Failed to fetch termination requests")}finally{N(!1)}};v.useEffect(()=>{E()},[S,P]);const _=B=>{A(B),C(1)};v.useEffect(()=>{if(!n||!W)return;let B=!1;return(async()=>{try{x(!0);const O=(await Te.getDealers({onboarded:"true",activeOnly:"true"})).data;if(!B&&(O!=null&&O.success)){const V=(Array.isArray(O.data)?O.data:[]).filter(K=>{var X,ne;const Y=String((K==null?void 0:K.status)||"").toLowerCase(),U=String(((X=K==null?void 0:K.user)==null?void 0:X.status)||"").toLowerCase();return Y==="active"&&((ne=K==null?void 0:K.user)==null?void 0:ne.isActive)&&U==="active"});l(V)}}catch(D){B||(console.error("Error fetching dealers:",D),ee.error("Failed to load dealer list"))}finally{B||x(!1)}})(),()=>{B=!0}},[n]);const M=B=>{var D,O,V,K,Y,U;return{id:B.id,dealerId:B.id,dealerCode:((D=B.dealerCode)==null?void 0:D.dealerCode)||"",legalName:B.legalName||"N/A",businessName:B.businessName||"N/A",gstNumber:B.gstNumber||"N/A",address:B.registeredAddress||((O=B.application)==null?void 0:O.preferredLocation)||"N/A",city:((V=B.application)==null?void 0:V.city)||"N/A",state:((K=B.application)==null?void 0:K.state)||"N/A",email:((Y=B.user)==null?void 0:Y.email)||"N/A",phoneNumber:((U=B.user)==null?void 0:U.mobileNumber)||"N/A"}},q=B=>{d(B);const D=a.find(V=>String(V.id)===String(B));if(!D){m(""),u(null);return}const O=M(D);m(O.dealerCode),u(O)},G=B=>{m(B);const D=B.trim().toLowerCase();if(!D){d(""),u(null);return}const O=a.find(V=>{var K;return String(((K=V.dealerCode)==null?void 0:K.dealerCode)||"").toLowerCase()===D});if(!O){d(""),u(null);return}d(String(O.id)),u(M(O))},Z=async B=>{var D,O,V;if(B.preventDefault(),!p){ee.error("Please select a dealer");return}try{const K={dealerId:p.dealerId||p.id,category:$.terminationCategory,reason:$.reason,proposedLwd:$.proposedLwd,comments:$.comments};if(!K.dealerId){ee.error("Dealer record not found for the selected dealer");return}const U=(await Te.createTermination(K)).data;if(U!=null&&U.success){const X=(D=U.termination)==null?void 0:D.id;if(X&&$.document){const ne=new FormData;ne.append("file",$.document),ne.append("documentType","Termination Recommendation"),ne.append("stage","Submitted");try{await Te.uploadTerminationDocument(X,ne),ee.success("Termination request and supporting document submitted")}catch(oe){console.error("Error uploading supporting document:",oe),ee.warning("Termination created, but document upload failed. You can upload it from the details page.")}}else ee.success("Termination request submitted successfully");r(!1),E(),d(""),m(""),l([]),u(null),T({terminationCategory:"",reason:"",proposedLwd:"",comments:"",document:null})}}catch(K){console.error("Error submitting termination:",K),ee.error(((V=(O=K.response)==null?void 0:O.data)==null?void 0:V.message)||"Failed to submit termination request")}},W=(t==null?void 0:t.role)==="DD Lead",z=P==="open"||P==="all"?j:[],F=P==="completed"||P==="all"?j:[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(mi,{className:"border-red-200 bg-red-50",children:[e.jsx(Ya,{className:"h-4 w-4 text-red-600"}),e.jsx(Hi,{className:"text-red-900",children:"Restricted Access"}),e.jsx(fi,{className:"text-red-700",children:"This section contains sensitive information. All termination actions are logged and require proper authorization."})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs(Le,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"All Cases"}),e.jsx(nt,{className:"text-3xl",children:(w==null?void 0:w.total)||0})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Total Cases"})})]}),e.jsxs(Le,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Open"}),e.jsx(nt,{className:"text-3xl text-orange-600",children:P==="open"?(w==null?void 0:w.total)||0:"..."})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Requires Your Action"})})]}),e.jsxs(Le,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Completed"}),e.jsx(nt,{className:"text-3xl text-green-600",children:P==="completed"?(w==null?void 0:w.total)||0:"..."})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Finalized"})})]})]}),e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Termination Requests"}),e.jsxs(Zt,{children:["Manage dealer termination proceedings and legal compliance",!W&&e.jsxs("span",{className:"block mt-1 text-red-600",children:["• Note: Only DD Lead can create termination requests. Current role: ",(t==null?void 0:t.role)||"Not logged in"]})]})]}),W&&e.jsxs(os,{open:n,onOpenChange:r,children:[e.jsx(Hl,{asChild:!0,children:e.jsxs(se,{className:"bg-red-600 hover:bg-red-700",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Create Termination Request"]})}),e.jsxs(ls,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Create Termination Request"}),e.jsx(vs,{children:"Fill in the details to create a new termination request"})]}),e.jsxs("form",{onSubmit:Z,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Select Dealer *"}),e.jsxs(wt,{value:c,onValueChange:q,disabled:h,children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:h?"Loading dealers...":"Select dealer"})}),e.jsx(At,{children:a.map(B=>{var D;return e.jsxs(Pe,{value:String(B.id),children:[B.legalName||B.businessName||"Unnamed Dealer"," - ",((D=B.dealerCode)==null?void 0:D.dealerCode)||"No Code"]},B.id)})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"dealerCode",children:"Dealer Code *"}),e.jsx(ot,{id:"dealerCode",value:f,onChange:B=>G(B.target.value),placeholder:"Type dealer code to auto-select",required:!0})]}),p&&e.jsxs("div",{className:"grid grid-cols-2 gap-4 p-4 bg-slate-50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Name (Legal)"}),e.jsx("p",{children:p.legalName||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Business Name"}),e.jsx("p",{children:p.businessName||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GST"}),e.jsx("p",{children:p.gstNumber||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Address"}),e.jsx("p",{children:p.address})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"City/State"}),e.jsxs("p",{children:[p.city,", ",p.state]})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Code"}),e.jsx("p",{children:p.dealerCode||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Contact"}),e.jsxs("p",{children:[p.email," / ",p.phoneNumber]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Termination Category *"}),e.jsxs(wt,{value:$.terminationCategory,onValueChange:B=>T({...$,terminationCategory:B}),children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"Select termination category"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"Working Capital",children:"Working Capital"}),e.jsx(Pe,{value:"Performance Issues",children:"Performance Issues"}),e.jsx(Pe,{value:"Unethical Practical",children:"Unethical Practical"}),e.jsx(Pe,{value:"Unforeseen Circumstances",children:"Unforeseen Circumstances"}),e.jsx(Pe,{value:"Others",children:"Others"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Proposed LWD *"}),e.jsx(ot,{type:"date",value:$.proposedLwd,onChange:B=>T({...$,proposedLwd:B.target.value}),required:!0})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"reason",children:"Termination Reason *"}),e.jsx(ot,{id:"reason",value:$.reason,onChange:B=>T({...$,reason:B.target.value}),placeholder:"Primary reason for termination",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"comments",children:"Additional Comments *"}),e.jsx(Fs,{id:"comments",value:$.comments,onChange:B=>T({...$,comments:B.target.value}),placeholder:"Detailed observations and justification",rows:4,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"document",children:"Upload Supporting Document"}),e.jsx(ot,{id:"document",type:"file",onChange:B=>{var D;return T({...$,document:((D=B.target.files)==null?void 0:D[0])||null})}})]}),e.jsxs(rn,{children:[e.jsx(se,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(se,{type:"submit",className:"bg-red-600 hover:bg-red-700",children:"Submit Request"})]})]})]})]})]})}),e.jsxs(Me,{children:[e.jsxs(Pn,{value:P,onValueChange:_,className:"w-full",children:[e.jsxs(_n,{children:[e.jsx(Wt,{value:"all",children:"All Cases"}),e.jsx(Wt,{value:"open",children:"Open"}),e.jsx(Wt,{value:"completed",children:"Completed"})]}),e.jsx(Gt,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:y?e.jsx("div",{className:"text-center py-12",children:"Loading requests..."}):j.length>0?j.map(B=>{var D,O,V,K;return e.jsx(Le,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-red-100 rounded-lg",children:e.jsx(Za,{className:"w-6 h-6 text-red-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg font-bold",children:B.requestId||((O=(D=B.dealer)==null?void 0:D.dealerCode)==null?void 0:O.code)||"N/A"}),e.jsxs("span",{className:"text-slate-400 text-xs",children:["#",B.id.substring(0,8)]}),e.jsx(Ae,{className:f$(B.severity||"Medium"),children:B.severity||"Normal"}),e.jsx(Ae,{className:Yx(B.status),children:B.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:((V=B.dealer)==null?void 0:V.businessName)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:((K=B.dealer)==null?void 0:K.registeredAddress)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Category"}),e.jsx("p",{children:B.category})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Current Stage"}),e.jsx("p",{children:B.currentStage})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Proposed LWD"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx($n,{className:"w-4 h-4 text-slate-500"}),e.jsx("p",{children:B.proposedLwd})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:Ht(B.createdAt)})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(B.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},B.id)}):e.jsx("div",{className:"text-center py-12 text-slate-500",children:e.jsx("p",{children:"No termination requests found"})})})}),e.jsx(Gt,{value:"open",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:z.length>0?z.map(B=>{var D,O,V;return e.jsx(Le,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-orange-100 rounded-lg",children:e.jsx(Ya,{className:"w-6 h-6 text-orange-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg font-bold",children:B.requestId||((O=(D=B.dealer)==null?void 0:D.dealerCode)==null?void 0:O.code)||"N/A"}),e.jsxs("span",{className:"text-slate-400 text-xs",children:["#",B.id.substring(0,8)]}),e.jsx(Ae,{className:Yx(B.status),children:B.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:(V=B.dealer)==null?void 0:V.businessName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Reason"}),e.jsx("p",{className:"truncate",children:B.reason})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Current Stage"}),e.jsx("p",{children:B.currentStage})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:Ht(B.createdAt)})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(B.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},B.id)}):e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(Za,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No requests requiring your action"})]})})}),e.jsx(Gt,{value:"completed",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:F.length>0?F.map(B=>{var D,O,V;return e.jsx(Le,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-green-100 rounded-lg",children:e.jsx(Za,{className:"w-6 h-6 text-green-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg font-bold",children:B.requestId||((O=(D=B.dealer)==null?void 0:D.dealerCode)==null?void 0:O.code)||"N/A"}),e.jsxs("span",{className:"text-slate-400 text-xs",children:["#",B.id.substring(0,8)]}),e.jsx(Ae,{className:Yx(B.status),children:B.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:(V=B.dealer)==null?void 0:V.businessName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Closed On"}),e.jsx("p",{children:Ht(B.updatedAt)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Termination Category"}),e.jsx("p",{children:B.category})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"LWD"}),e.jsx("p",{children:B.proposedLwd})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(B.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},B.id)}):e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(Za,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No completed terminations to display"})]})})})]}),w&&w.totalPages>1&&e.jsx("div",{className:"py-4 border-t flex justify-center bg-white rounded-b-lg",children:e.jsx(Yl,{children:e.jsxs(Zl,{children:[e.jsx(an,{children:e.jsx(Ql,{onClick:()=>C(B=>Math.max(1,B-1)),className:S===1?"pointer-events-none opacity-50":"cursor-pointer"})}),[...Array(w.totalPages)].map((B,D)=>{const O=D+1;return O===1||O===w.totalPages||O>=S-1&&O<=S+1?e.jsx(an,{children:e.jsx(Ci,{isActive:S===O,onClick:()=>C(O),className:"cursor-pointer",children:O})},O):O===2&&S>3||O===w.totalPages-1&&SC(B=>Math.min(w.totalPages,B+1)),className:S===w.totalPages?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]})]})]})}const Ad=t=>{switch(t){case"Initiated":return"bg-blue-100 text-blue-700 border-blue-300";case"DD Clearance":case"Legal Clearance":return"bg-yellow-100 text-yellow-700 border-yellow-300";case"Finance Approval":case"Calculated":return"bg-orange-100 text-orange-700 border-orange-300";case"Completed":case"Settled":return"bg-green-100 text-green-700 border-green-300";default:return"bg-slate-100 text-slate-700 border-slate-300"}},kd=t=>t==="Resignation"?"bg-amber-100 text-amber-700 border-amber-300":"bg-red-100 text-red-700 border-red-300";function x$({currentUser:t,onViewDetails:s}){const[n,r]=v.useState([]),[a,l]=v.useState(!0);v.useEffect(()=>{c()},[]);const c=async()=>{try{l(!0);const j=(await Te.getFnFSettlements()).data;j.success&&r(j.settlements||[])}catch(u){console.error("Fetch settlements error:",u),ee.error("Failed to fetch settlement cases")}finally{l(!1)}};if(a)return e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-blue-600"})});const d=u=>{var j,g,y,N,S,C,w,R,P,A,I,$,T,E,_,M;return{id:u.id,caseNumber:u.settlementId||((j=u.resignation)==null?void 0:j.resignationId)||((g=u.terminationRequest)==null?void 0:g.requestId)||u.id.substring(0,8).toUpperCase(),status:u.status,requestType:u.resignationId?"Resignation":"Termination",dealerName:((N=(y=u.outlet)==null?void 0:y.dealer)==null?void 0:N.fullName)||((S=u.dealer)==null?void 0:S.legalName)||((C=u.dealer)==null?void 0:C.businessName)||((w=u.dealer)==null?void 0:w.fullName)||"N/A",dealerCode:((R=u.outlet)==null?void 0:R.code)||((A=(P=u.dealer)==null?void 0:P.dealerCode)==null?void 0:A.dealerCode)||"N/A",dealershipName:((I=u.outlet)==null?void 0:I.name)||"N/A",location:(($=u.outlet)==null?void 0:$.city)||((T=u.outlet)==null?void 0:T.location)||"N/A",originalRequestId:((E=u.resignation)==null?void 0:E.resignationId)||((_=u.terminationRequest)==null?void 0:_.requestId)||((M=u.terminationRequest)==null?void 0:M.id)||"N/A",submittedOn:Ht(u.createdAt),financeReportStatus:u.status==="Calculated"||u.status==="Settled"?"Completed":"Pending",totalRecoveryAmount:parseFloat(u.totalReceivables)||0,totalPayableAmount:parseFloat(u.totalPayables)||0,completedOn:u.settlementDate?Ht(u.settlementDate):null,departmentResponses:u.lineItems||[]}},h=n.map(d),x=h.filter(u=>u.status==="Initiated"),f=h.filter(u=>u.status==="DD Clearance"||u.status==="Legal Clearance"),m=h.filter(u=>u.status==="Finance Approval"||u.status==="Calculated"),p=h.filter(u=>u.status==="Completed"||u.status==="Settled");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[e.jsxs(Le,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Initiated"}),e.jsx(nt,{className:"text-3xl text-blue-600",children:x.length})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Newly created"})})]}),e.jsxs(Le,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Clearance"}),e.jsx(nt,{className:"text-3xl text-yellow-600",children:f.length})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Department / legal stage"})})]}),e.jsxs(Le,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Finance Approval"}),e.jsx(nt,{className:"text-3xl text-orange-600",children:m.length})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Ready for finance review"})})]}),e.jsxs(Le,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Completed"}),e.jsx(nt,{className:"text-3xl text-green-600",children:h.filter(u=>u.status==="Completed"||u.status==="Settled").length})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Finalized"})})]}),e.jsxs(Le,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"All Cases"}),e.jsx(nt,{className:"text-3xl",children:h.length})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Total"})})]})]}),e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Full & Final Settlement Cases"}),e.jsxs(Zt,{children:["Manage dealer exit dues clearance and settlement",t&&` • Current Role: ${t.role}`]})]}),e.jsx(Me,{children:e.jsxs(Pn,{defaultValue:"all",className:"w-full",children:[e.jsxs(_n,{children:[e.jsx(Wt,{value:"all",children:"All Cases"}),e.jsx(Wt,{value:"initiated",children:"Initiated"}),e.jsx(Wt,{value:"clearance",children:"Clearance"}),e.jsx(Wt,{value:"finance",children:"Finance Approval"}),e.jsx(Wt,{value:"completed",children:"Completed"})]}),e.jsx(Gt,{value:"initiated",className:"mt-6",children:e.jsxs("div",{className:"space-y-4",children:[x.map(u=>e.jsx(Le,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-blue-100 rounded-lg",children:e.jsx(_d,{className:"w-6 h-6 text-blue-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:u.caseNumber}),e.jsx(Ae,{className:Ad(u.status),children:u.status}),e.jsx(Ae,{className:kd(u.requestType),children:u.requestType})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:u.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Code"}),e.jsx("p",{children:u.dealerCode})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealership Name"}),e.jsx("p",{children:u.dealershipName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:u.location})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Original Request ID"}),e.jsx("p",{children:u.originalRequestId})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx($n,{className:"w-4 h-4 text-slate-500"}),e.jsx("p",{children:u.submittedOn})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Finance Report"}),e.jsx("p",{children:u.financeReportStatus})]})]})]})]}),e.jsx("div",{className:"flex items-center gap-2 ml-4",children:e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(u.id),children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})})]})})},u.id)),x.length===0&&e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(_d,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No initiated cases to display"})]})]})}),e.jsx(Gt,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:h.map(u=>e.jsx(Le,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:`p-3 rounded-lg ${u.status==="Initiated"?"bg-blue-100":u.status==="DD Clearance"||u.status==="Legal Clearance"?"bg-yellow-100":u.status==="Finance Approval"||u.status==="Calculated"?"bg-orange-100":"bg-green-100"}`,children:e.jsx(oa,{className:`w-6 h-6 ${u.status==="Initiated"?"text-blue-600":u.status==="DD Clearance"||u.status==="Legal Clearance"?"text-yellow-600":u.status==="Finance Approval"||u.status==="Calculated"?"text-orange-600":"text-green-600"}`})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:u.caseNumber}),e.jsx(Ae,{className:Ad(u.status),children:u.status}),e.jsx(Ae,{className:kd(u.requestType),children:u.requestType})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:u.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealership Name"}),e.jsx("p",{children:u.dealershipName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:u.location})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:u.submittedOn})]})]})]})]}),e.jsx("div",{className:"flex items-center gap-2 ml-4",children:e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(u.id),children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})})]})})},u.id))})}),e.jsx(Gt,{value:"clearance",className:"mt-6",children:e.jsxs("div",{className:"space-y-4",children:[f.map(u=>e.jsx(Le,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-yellow-100 rounded-lg",children:e.jsx(oa,{className:"w-6 h-6 text-yellow-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:u.caseNumber}),e.jsx(Ae,{className:Ad(u.status),children:u.status}),e.jsx(Ae,{className:kd(u.requestType),children:u.requestType})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:u.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Departments Responded"}),e.jsxs("p",{children:[u.departmentResponses.filter(j=>j.status!=="Pending").length," / ",u.departmentResponses.length]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:u.submittedOn})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(u.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},u.id)),f.length===0&&e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(oa,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No clearance-stage cases"})]})]})}),e.jsx(Gt,{value:"finance",className:"mt-6",children:e.jsxs("div",{className:"space-y-4",children:[m.map(u=>{var j,g;return e.jsx(Le,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-orange-100 rounded-lg",children:e.jsx(oa,{className:"w-6 h-6 text-orange-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:u.caseNumber}),e.jsx(Ae,{className:Ad(u.status),children:u.status}),e.jsx(Ae,{className:kd(u.requestType),children:u.requestType})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:u.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Receivable amount"}),e.jsxs("p",{className:"text-red-600",children:["₹",(j=u.totalRecoveryAmount)==null?void 0:j.toLocaleString()]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Payable Amount"}),e.jsxs("p",{className:"text-green-600",children:["₹",(g=u.totalPayableAmount)==null?void 0:g.toLocaleString()]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Finance Status"}),e.jsx("p",{children:u.financeReportStatus})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(u.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},u.id)}),m.length===0&&e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(oa,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No finance-approval cases"})]})]})}),e.jsx(Gt,{value:"completed",className:"mt-6",children:e.jsxs("div",{className:"space-y-4",children:[p.map(u=>e.jsx(Le,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-green-100 rounded-lg",children:e.jsx(_d,{className:"w-6 h-6 text-green-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:u.caseNumber}),e.jsx(Ae,{className:Ad(u.status),children:u.status}),e.jsx(Ae,{className:kd(u.requestType),children:u.requestType})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:u.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Completed On"}),e.jsx("p",{children:u.completedOn||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:u.submittedOn})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(u.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},u.id)),p.length===0&&e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(_d,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No completed cases"})]})]})})]})})]})]})}const Pl={getResignations:async()=>{try{return(await Te.getResignations()).data}catch(t){throw console.error("Get resignations error:",t),t}},createResignation:async t=>{try{return(await Te.createResignation(t)).data}catch(s){throw console.error("Create resignation error:",s),s}},getResignationById:async t=>{var s,n;try{const r=await Te.getResignationById(t);return((s=r.data)==null?void 0:s.resignation)||((n=r.data)==null?void 0:n.data)||r.data}catch(r){throw console.error("Get resignation error:",r),r}},updateClearance:async(t,s)=>{try{return(await Te.updateClearance(t,s)).data}catch(n){throw console.error("Update clearance error:",n),n}},uploadDocument:async(t,s)=>{try{return(await Te.uploadResignationDocument(t,s)).data}catch(n){throw console.error("Upload resignation document error:",n),n}},withdraw:async(t,s)=>{try{return(await Te.withdrawResignation(t,s)).data}catch(n){throw console.error("Withdraw resignation error:",n),n}}},Ud=["Resignation Letter","Dealer Undertaking","Approval Note","Legal Communication","Handover Document","Settlement Supporting Document","Other"],mE=["ASM","RBM","ZBH","DD Lead","NBH","DD Admin","Legal","F&F Initiated"],Zx=["Termination Recommendation","Show Cause Notice","SCN Response","Hearing Record","Approval Note","Termination Letter","Settlement Supporting Document","Other"],g$=["Submitted","RBM Review","ZBH Review","DD Lead Review","Legal Verification","NBH Evaluation","Show Cause Notice","Personal Hearing","NBH Final Approval","CCO Approval","CEO Final Approval","Legal - Termination Letter"],v$={ASM:"ASM",RBM:"RBM",ZBH:"ZBH","DD Lead":"DD Lead",NBH:"NBH","DD Admin":"DD Admin",Legal:"Legal Admin"},c1=["REJECTED","Rejected","REVOKED","Revoked","WITHDRAWN","Withdrawn"],d1={ASM:["ASM","ASM Review","Submission","Submitted"],RBM:["RBM","RBM Review","Regional Review"],ZBH:["ZBH","ZBH Review","ZM Review"],"DD Lead":["DD Lead","DD Lead Review","DDL Review"],NBH:["NBH","NBH Approval","NBH Review"],"DD Admin":["DD Admin","DD Admin Review"],Legal:["Legal","Legal - Resignation Letter"],"F&F Initiated":["F&F Initiated","FNF_INITIATED","FNF Initiated"],Completed:["Completed"]};function b$({resignationId:t,onBack:s,currentUser:n}){var _e,ke,qe,Ve,dt,xt,ye,le,Qe,rt,Kt,Rt,Re,Qt,qt,ws,_s,ns,Cs,Bs,Ft,ie,Fe,Q,pe,Ne,Ee,it,st,bt,Ue,Lt,ut,yt,kt;const r=(Ie,_t)=>{const ht=[...(A==null?void 0:A.documents)||[],...(A==null?void 0:A.uploadedDocuments)||[]],zt=[Ie,_t,..._t?d1[_t]||[]:[],...d1[Ie]||[]].filter(rs=>!!rs).map(rs=>rs.trim().toLowerCase());return ht.filter(rs=>{if(!(rs!=null&&rs.stage))return!1;const Yt=String(rs.stage).trim().toLowerCase();return zt.includes(Yt)})},a=qn(),[l,c]=v.useState({open:!1,type:null}),[d,h]=v.useState(""),[x,f]=v.useState(""),[m,p]=v.useState(""),[u,j]=v.useState(""),[g,y]=v.useState([]),[N,S]=v.useState(!1),[C,w]=v.useState(!1),[R,P]=v.useState({open:!1,stageName:"",documents:[]}),[A,I]=v.useState(null),[$,T]=v.useState(!1),[E,_]=v.useState([]),[M,q]=v.useState(!1),[G,Z]=v.useState(null),[W,z]=v.useState(!1),[F,B]=v.useState(null),[D,O]=v.useState(Ud[0]),[V,K]=v.useState(""),Y=async()=>{try{T(!0);const Ie=await Pl.getResignationById(t);I(Ie),U()}catch(Ie){console.error("Error fetching resignation:",Ie)}finally{T(!1)}},U=async()=>{try{const Ie=await Te.getAuditLogs("resignation",t);Ie.data&&Ie.data.success&&_(Ie.data.data||[])}catch(Ie){console.error("Error fetching audit logs:",Ie)}};v.useEffect(()=>{Y()},[t]);const X=[{id:1,name:"ASM Review",key:"ASM",description:"Area Sales Manager review"},{id:2,name:"RBM Review",key:"RBM",description:"Regional Business Manager evaluation"},{id:3,name:"ZBH Review",key:"ZBH",description:"Zonal Business Head approval"},{id:4,name:"DD Lead Review",key:"DD Lead",description:"DD Lead final review"},{id:5,name:"NBH Approval",key:"NBH",description:"National Business Head approval"},{id:6,name:"DD Admin Review",key:"DD Admin",description:"DD Admin verification"},{id:7,name:"Legal - Resignation Letter",key:"Legal",description:"Legal team issues resignation approval letter"},{id:8,name:"F&F Settlement",key:"F&F Initiated",description:"Full & Final settlement process"},{id:9,name:"Completed",key:"Completed",description:"Resignation process finalized"}],ne=["ASM","RBM","ZBH","DD Lead","NBH","DD Admin","Legal","F&F Initiated","Completed"],oe=A?["F&F Initiated","Completed","Settled","FNF_INITIATED"].includes(String(A.status||A.currentStage||""))?!0:(Array.isArray(A.timeline)?A.timeline:[]).some(ht=>{const zt=String((ht==null?void 0:ht.stage)||"").trim().toLowerCase(),rs=String((ht==null?void 0:ht.targetStage)||"").trim().toLowerCase(),Yt=String((ht==null?void 0:ht.action)||"").trim().toLowerCase(),Os=zt==="legal"||zt==="legal - resignation letter",Is=rs==="legal"||rs==="f&f initiated"||rs==="fnf_initiated"||Yt.includes("approved");return Os&&Is}):!1,ge=(()=>{if(!A||!n)return{canApprove:!1,canWithdraw:!1,canSendBack:!1,canPushToFnF:!1,canAssign:!1};const Ie=A.currentStage,_t=A.status,ht=n.role,zt=["Completed","Rejected","Withdrawn","Revoked"].includes(_t),rs=_t==="F&F Initiated"||Ie==="F&F Initiated"||_t==="Settled"||_t==="FNF_INITIATED",Yt=ne.indexOf(Ie),Os=ne.indexOf("NBH"),Is=Yt!==-1&&Os!==-1&&Yt>=Os,zs=ht==="Super Admin"||ht===v$[Ie];return{canApprove:zs&&!zt&&!rs&&!(Ie==="Legal"&&oe),canSendBack:zs&&!zt&&!rs&&Yt>0,canWithdraw:ht==="Dealer"&&!Is&&!zt,canRevoke:(ht==="Super Admin"||ht==="DD Admin")&&!zt&&!rs,canPushToFnF:["DD Lead","DD Head","NBH","DD Admin","Super Admin"].includes(ht)&&!rs&&!zt,canAssign:ht!=="Dealer"&&!zt}})(),ve={ASM:["ASM","ASM Review","Request Initiated"],RBM:["RBM","RBM Review"],ZBH:["ZBH","ZBH Review"],"DD Lead":["DD Lead","DD Lead Review","Lead Review"],NBH:["NBH","NBH Approval","NBH Review"],"DD Admin":["DD Admin","DD Admin Review"],Legal:["Legal","Legal - Resignation Letter","Legal Review"],"F&F Initiated":["F&F Initiated","FNF_INITIATED","F&F Settlement","Settled"],Completed:["Completed","Finalized"]},Se=Ie=>{if(!Ie)return"";const _t=String(Ie).trim();return ne.find(zt=>zt===_t||(ve[zt]||[]).includes(_t))||_t},We=Ie=>{if(!A)return"pending";const _t=["Rejected","Revoked","Withdrawn"].includes(A.status);let ht=A.currentStage;if(_t&&(!ht||c1.includes(String(ht)))){const Os=[...A.timeline||[]].reverse().find(Is=>(Is==null?void 0:Is.stage)&&!c1.includes(String(Is.stage)));Os!=null&&Os.stage&&(ht=Os.stage)}const zt=ne.indexOf(Se(ht)),rs=ne.indexOf(Ie);if((A.status==="Completed"||A.status==="Settled")&&rs<=zt)return"completed";const Yt=["Rejected","Revoked","Withdrawn"].includes(A.status);return Ie==="Legal"&&oe&&!Yt?"completed":zt===-1?Ie==="ASM"?"completed":"pending":rs{c({open:!0,type:Ie})},fe=(Ie,_t)=>{const ht=r(Ie,_t).map((zt,rs)=>{var Yt;return{id:zt.id||`${Ie}-${rs}`,name:zt.name||zt.fileName||"Document",type:zt.type||zt.documentType||"Document",uploadDate:zt.uploadDate||(zt.createdAt?Ht(zt.createdAt):"N/A"),uploader:typeof zt.uploader=="string"?zt.uploader:((Yt=zt.uploader)==null?void 0:Yt.fullName)||zt.uploadedBy||"System",filePath:zt.filePath||zt.path}});P({open:!0,stageName:Ie,documents:ht})},Ye=async()=>{var Ie,_t,ht,zt,rs,Yt,Os,Is;if(!d&&!["assign","pushfnf"].includes(l.type||"")){ee.error("Please provide remarks (min 5 characters)");return}if(["sendBack","revoke"].includes(l.type||"")&&d.trim().length<5){ee.error("Remarks are required for this action (min 5 characters).");return}if(l.type==="assign"&&!x){ee.error("Please select a designation");return}try{q(!0);const en={action:l.type==="sendBack"?"sendBack":l.type,remarks:d,assignTo:u||x,force:C},he=await Te.updateResignationStatus(t,en);if((Ie=he.data)!=null&&Ie.success)ee.success(((_t=he.data)==null?void 0:_t.message)||"Action completed successfully"),c({open:!1,type:null}),h(""),f(""),j(""),y([]),w(!1),Y();else{const Ge=((ht=he.data)==null?void 0:ht.message)||"Failed to submit action";ee.error(Ge),(zt=he.data)!=null&&zt.canForce&&ee.info('LWD restriction hit. Use "Push to F&F" and enable "Force Initiate F&F Settlement Immediately" if urgent.')}}catch(zs){console.error("Error submitting action:",zs),ee.error(((Yt=(rs=zs.response)==null?void 0:rs.data)==null?void 0:Yt.message)||"Failed to submit action"),(Is=(Os=zs==null?void 0:zs.response)==null?void 0:Os.data)!=null&&Is.canForce&&ee.info('LWD restriction hit. Use "Push to F&F" with force option if business-approved.')}finally{q(!1)}},be=async()=>{var Ie,_t;if(!F){ee.error("Please select a file to upload");return}try{q(!0);const ht=new FormData;ht.append("file",F),ht.append("documentType",D),V&&ht.append("stage",V),await Pl.uploadDocument(t,ht),ee.success("Document uploaded successfully"),z(!1),B(null),O(Ud[0]),K(""),Y()}catch(ht){ee.error(((_t=(Ie=ht==null?void 0:ht.response)==null?void 0:Ie.data)==null?void 0:_t.message)||"Failed to upload document")}finally{q(!1)}};return v.useEffect(()=>{(async()=>{if(l.type==="assign"&&(x||m)){const _t=setTimeout(async()=>{var ht;try{S(!0);const zt={asm:"ASM",rbm:"RBM",zbh:"ZBH",nbh:"NBH",legal:"Legal Admin"},rs={limit:20,search:m};x&&(rs.roleCode=zt[x]||x);const Yt=await Te.getUsers(rs);(ht=Yt.data)!=null&&ht.success&&y(Yt.data.data)}catch(zt){console.error("Error fetching users:",zt)}finally{S(!1)}},300);return()=>clearTimeout(_t)}})()},[x,m,l.type]),$&&!A?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-amber-600"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"outline",size:"icon",onClick:s,className:"hover:bg-slate-100 transition-colors",children:e.jsx($r,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl",children:(A==null?void 0:A.resignationId)||t}),e.jsx("p",{className:"text-slate-600",children:(_e=A==null?void 0:A.outlet)==null?void 0:_e.name})]}),e.jsx(Ae,{className:(A==null?void 0:A.status)==="Completed"||(A==null?void 0:A.status)==="Settled"?"bg-green-100 text-green-700 border-green-300":(A==null?void 0:A.status)==="Rejected"||(A==null?void 0:A.status)==="Withdrawn"||(A==null?void 0:A.status)==="Revoked"?"bg-red-100 text-red-700 border-red-300":"bg-yellow-100 text-yellow-700 border-yellow-300",children:(A==null?void 0:A.status)==="Settled"?"Completed":(A==null?void 0:A.status)||"Pending"})]})}),e.jsx(Le,{className:"border-slate-200 shadow-sm",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-slate-600 mr-2",children:"Workflow Actions:"}),ge.canApprove&&e.jsxs(se,{size:"sm",disabled:M,className:"bg-green-600 hover:bg-green-700 transition-all hover:shadow-md",onClick:()=>Ce("approve"),children:[M&&l.type==="approve"?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(Bn,{className:"w-4 h-4 mr-2"}),"Approve"]}),ge.canSendBack&&e.jsxs(se,{size:"sm",variant:"outline",disabled:M,className:"hover:bg-slate-50 transition-all font-bold",onClick:()=>Ce("sendBack"),children:[M&&l.type==="sendBack"?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(Qv,{className:"w-4 h-4 mr-2"}),"Send Back"]}),ge.canWithdraw&&e.jsxs(se,{size:"sm",variant:"outline",disabled:M,className:"text-red-600 border-red-300 hover:bg-red-50 transition-all font-bold",onClick:()=>Ce("withdrawal"),children:[M&&l.type==="withdrawal"?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(Tc,{className:"w-4 h-4 mr-2"}),"Withdrawal"]}),ge.canRevoke&&e.jsxs(se,{size:"sm",variant:"outline",disabled:M,className:"text-orange-600 border-orange-300 hover:bg-orange-50 transition-all font-bold",onClick:()=>Ce("revoke"),children:[M&&l.type==="revoke"?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(Yv,{className:"w-4 h-4 mr-2"}),"Revoke"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[ge.canPushToFnF&&e.jsxs(se,{size:"sm",variant:"outline",disabled:M,className:"text-amber-600 border-blue-300 hover:bg-blue-50 transition-all",onClick:()=>Ce("pushfnf"),children:[M&&l.type==="pushfnf"?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(fu,{className:"w-4 h-4 mr-2"}),"Push to F&F"]}),ge.canAssign&&e.jsxs(se,{size:"sm",variant:"outline",disabled:M,className:"hover:bg-slate-50 transition-all",onClick:()=>Ce("assign"),children:[M&&l.type==="assign"?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(Jv,{className:"w-4 h-4 mr-2"}),"Assign User"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-slate-200",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(zr,{className:"w-4 h-4 text-slate-500"}),e.jsx("span",{className:"text-sm text-slate-600",children:"Communication & Notes"})]}),e.jsxs(se,{size:"sm",variant:"outline",className:"relative hover:bg-amber-50 hover:border-amber-300 hover:text-amber-700 transition-all shadow-sm",onClick:()=>{var Ie;return a(`/worknotes/resignation/${t}`,{state:{applicationName:((Ie=A==null?void 0:A.outlet)==null?void 0:Ie.name)||"Resignation",registrationNumber:(A==null?void 0:A.resignationId)||"",participants:(A==null?void 0:A.participants)||[]}})},children:[e.jsx(zr,{className:"w-4 h-4 mr-2"}),"View Work Notes",((ke=A==null?void 0:A.worknotes)==null?void 0:ke.length)>0&&e.jsx(Ae,{className:"ml-2 bg-amber-600 hover:bg-amber-700 text-white h-5 px-2",children:A.worknotes.length})]})]})]})})}),e.jsxs(Pn,{defaultValue:"details",className:"w-full",children:[e.jsxs(_n,{className:"bg-slate-100 p-1",children:[e.jsx(Wt,{value:"details",className:"data-[state=active]:bg-white",children:"Details"}),e.jsx(Wt,{value:"progress",className:"data-[state=active]:bg-white",children:"Progress"}),e.jsx(Wt,{value:"documents",className:"data-[state=active]:bg-white",children:"Documents"}),e.jsx(Wt,{value:"audit",className:"data-[state=active]:bg-white",children:"Audit Trail"})]}),e.jsxs(Gt,{value:"details",className:"space-y-6",children:[e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Request Information"})}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:((qe=A==null?void 0:A.dealer)==null?void 0:qe.fullName)||((Ve=A==null?void 0:A.outlet)==null?void 0:Ve.name)})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GST"}),e.jsx("p",{children:((xt=(dt=A==null?void 0:A.dealer)==null?void 0:dt.dealerProfile)==null?void 0:xt.gstNumber)||((ye=A==null?void 0:A.outlet)==null?void 0:ye.gstNumber)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Email"}),e.jsx("p",{children:((le=A==null?void 0:A.dealer)==null?void 0:le.email)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Sales Code"}),e.jsx("p",{children:((Kt=(rt=(Qe=A==null?void 0:A.dealer)==null?void 0:Qe.dealerProfile)==null?void 0:rt.dealerCode)==null?void 0:Kt.salesCode)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Service Code"}),e.jsx("p",{children:((Qt=(Re=(Rt=A==null?void 0:A.dealer)==null?void 0:Rt.dealerProfile)==null?void 0:Re.dealerCode)==null?void 0:Qt.serviceCode)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GMA Code"}),e.jsx("p",{children:((_s=(ws=(qt=A==null?void 0:A.dealer)==null?void 0:qt.dealerProfile)==null?void 0:ws.dealerCode)==null?void 0:_s.gmaCode)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Gear Code"}),e.jsx("p",{children:((Bs=(Cs=(ns=A==null?void 0:A.dealer)==null?void 0:ns.dealerProfile)==null?void 0:Cs.dealerCode)==null?void 0:Bs.gearCode)||"N/A"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(ce,{className:"text-slate-600",children:"Address"}),e.jsx("p",{children:((ie=(Ft=A==null?void 0:A.dealer)==null?void 0:Ft.dealerProfile)==null?void 0:ie.registeredAddress)||((Fe=A==null?void 0:A.outlet)==null?void 0:Fe.address)})]})]})})]}),e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Operational Details"})}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Inauguration"}),e.jsx("p",{children:(pe=(Q=A==null?void 0:A.dealer)==null?void 0:Q.dealerProfile)!=null&&pe.onboardedAt?Ht(A.dealer.dealerProfile.onboardedAt,"date"):(Ne=A==null?void 0:A.outlet)!=null&&Ne.inaugurationDate?Ht(A.outlet.inaugurationDate,"date"):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"LOA Date"}),e.jsx("p",{children:(it=(Ee=A==null?void 0:A.dealer)==null?void 0:Ee.dealerProfile)!=null&&it.loaDate?Ht(A.dealer.dealerProfile.loaDate,"date"):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"LOI Date"}),e.jsx("p",{children:(bt=(st=A==null?void 0:A.dealer)==null?void 0:st.dealerProfile)!=null&&bt.loiDate?Ht(A.dealer.dealerProfile.loiDate,"date"):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealership Type"}),e.jsx("p",{children:((ut=(Lt=(Ue=A==null?void 0:A.dealer)==null?void 0:Ue.dealerProfile)==null?void 0:Lt.application)==null?void 0:ut.businessType)||((yt=A==null?void 0:A.outlet)==null?void 0:yt.type)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"City Category"}),e.jsx("p",{children:((kt=A==null?void 0:A.outlet)==null?void 0:kt.cityCategory)||"N/A"})]})]})})]}),e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Resignation Details"})}),e.jsx(Me,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Resignation Type"}),e.jsx("p",{children:A==null?void 0:A.resignationType})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Reason"}),e.jsx("p",{children:A==null?void 0:A.reason})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Last Operational Date (Sales)"}),e.jsx("p",{children:A!=null&&A.lastOperationalDateSales?Ht(A.lastOperationalDateSales,"date"):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Last Operational Date (Services)"}),e.jsx("p",{children:A!=null&&A.lastOperationalDateServices?Ht(A.lastOperationalDateServices,"date"):"N/A"})]})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Additional Info / Dealer Voice"}),e.jsx("p",{children:(A==null?void 0:A.additionalInfo)||"No additional info provided"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:A!=null&&A.submittedOn?Ht(A.submittedOn):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Current Stage"}),e.jsx("p",{children:A==null?void 0:A.currentStage})]})]})]})})]})]}),e.jsx(Gt,{value:"progress",children:e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Progress Timeline"}),e.jsx(Zt,{children:"Track the resignation request approval process"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:X.map((Ie,_t)=>{const ht=We(Ie.key),zt=r(Ie.name,Ie.key).length,rs=((A==null?void 0:A.timeline)||[]).filter(Os=>Os.stage===Ie.key||Os.stage===Ie.name),Yt=rs.length>0?rs[rs.length-1]:null;return e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${ht==="completed"?"bg-green-100 text-green-600":ht==="active"?"bg-blue-100 text-amber-600":"bg-slate-100 text-slate-400"}`,children:ht==="completed"?e.jsx(Bn,{className:"w-5 h-5"}):e.jsx("span",{children:Ie.id})}),_t0&&e.jsxs("button",{onClick:()=>fe(Ie.name,Ie.key),className:"flex items-center gap-1 px-2 py-1 rounded-full bg-amber-100 hover:bg-amber-200 text-amber-700 text-xs transition-colors cursor-pointer",children:[e.jsx(fs,{className:"w-3 h-3"}),e.jsxs("span",{children:[zt," ",zt===1?"doc":"docs"]})]})]}),Yt&&e.jsxs("div",{className:"flex items-center gap-1 text-sm text-slate-600",children:[e.jsx($n,{className:"w-4 h-4"}),e.jsx("span",{children:Ht(Yt.timestamp||Yt.createdAt)})]})]}),e.jsx("p",{className:"text-slate-600 text-sm mb-1",children:Ie.description}),Yt&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{variant:"secondary",className:"bg-slate-100 text-[10px] font-bold uppercase",children:Yt.user||"System"}),e.jsx("span",{className:"text-[10px] text-slate-500 italic",children:Yt.action})]}),e.jsx("div",{className:"bg-slate-50 p-3 rounded-lg border border-slate-100 text-sm text-slate-700 shadow-sm",children:Yt.comments||Yt.remarks||"No remarks provided."})]})]})]},Ie.id)})})})]})}),e.jsx(Gt,{value:"documents",children:e.jsxs(Le,{children:[e.jsxs(tt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Documents"}),e.jsx(Zt,{children:"View and manage resignation documents"})]}),e.jsxs(se,{size:"sm",onClick:()=>z(!0),className:"bg-amber-600 hover:bg-amber-700",children:[e.jsx(Dr,{className:"w-4 h-4 mr-2"}),"Upload Document"]})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Document Name"}),e.jsx(me,{children:"Type"}),e.jsx(me,{children:"Upload Date"}),e.jsx(me,{children:"Uploader"}),e.jsx(me,{children:"Actions"})]})}),e.jsx(Es,{children:(()=>{var _t;const Ie=[...(A==null?void 0:A.documents)||[],...(A==null?void 0:A.uploadedDocuments)||[]];return A!=null&&A.departmentalClearances&&Object.entries(A.departmentalClearances).forEach(([ht,zt])=>{zt.supportingDocument&&Ie.push({name:`${ht} Clearance Proof`,type:"Clearance NOC",path:zt.supportingDocument,createdAt:zt.updatedAt,uploadedBy:zt.updatedBy||"Department Admin"})}),(_t=A==null?void 0:A.settlement)!=null&&_t.clearances&&A.settlement.clearances.forEach(ht=>{ht.supportingDocument&&Ie.push({name:`${ht.department} Clearance NOC`,type:"Live NOC",path:ht.supportingDocument,createdAt:ht.clearedAt||ht.updatedAt,uploadedBy:"Department Admin"})}),Ie.length===0?e.jsx(ct,{children:e.jsx(de,{colSpan:5,className:"text-center py-4 text-slate-500",children:"No documents found"})}):Ie.map((ht,zt)=>{var rs;return e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-4 h-4 text-slate-500"}),e.jsx("span",{children:ht.name||ht.fileName})]})}),e.jsx(de,{children:ht.documentType||ht.type||"Document"}),e.jsx(de,{children:ht.createdAt?Ht(ht.createdAt):"N/A"}),e.jsx(de,{children:((rs=ht.uploader)==null?void 0:rs.fullName)||ht.uploadedBy||"Dealer"}),e.jsx(de,{children:e.jsx(se,{size:"sm",variant:"outline",onClick:()=>{const Yt=ht.filePath||ht.path,Os=Yt!=null&&Yt.startsWith("/uploads/")&&!Yt.startsWith("/uploads/documents/")?Yt.replace("/uploads/","/uploads/documents/"):Yt;Z({fileName:ht.fileName||ht.name,filePath:Os,documentType:ht.documentType||ht.type})},children:"View"})})]},zt)})})()})]})})]})}),e.jsx(Gt,{value:"audit",children:e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Audit Trail"}),e.jsx(Zt,{children:"Complete history of actions on this resignation request"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:E.length>0?E.map((Ie,_t)=>{var ht,zt,rs,Yt,Os,Is,zs,en,he,Ge,at;return e.jsxs("div",{className:"flex gap-3 pb-6 border-b border-slate-100 last:border-0 relative",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-slate-300 mt-2 z-10"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:` - ${(Ie.description||Ie.action||((ht=Ie.details)==null?void 0:ht.action)||"").toLowerCase().includes("reject")||(Ie.description||Ie.action||((zt=Ie.details)==null?void 0:zt.action)||"").toLowerCase().includes("revok")?"bg-red-100 text-red-700 border-red-200":(Ie.description||Ie.action||((rs=Ie.details)==null?void 0:rs.action)||"").toLowerCase().includes("sent back")||(Ie.description||Ie.action||((Yt=Ie.details)==null?void 0:Yt.action)||"").toLowerCase().includes("send back")?"bg-amber-100 text-amber-700 border-amber-200":(Ie.description||Ie.action||((Os=Ie.details)==null?void 0:Os.action)||"").toLowerCase().includes("approv")||(Ie.description||Ie.action||((Is=Ie.details)==null?void 0:Is.action)||"").toLowerCase().includes("initi")?"bg-emerald-100 text-emerald-700 border-emerald-200":"bg-slate-100 text-slate-700 border-slate-200"} - `,children:Ie.description||Ie.action}),e.jsxs("span",{className:"text-xs text-slate-500 font-medium italic",children:["by ",((zs=Ie.actor)==null?void 0:zs.name)||Ie.userName||"System"]})]}),e.jsx("span",{className:"text-xs text-slate-500",children:Ht(Ie.timestamp||Ie.createdAt)})]}),(Ie.remarks||((en=Ie.newData)==null?void 0:en.remarks)||((he=Ie.details)==null?void 0:he.remarks))&&e.jsx("div",{className:"p-3 bg-slate-50 border border-slate-100 rounded-lg text-sm text-slate-700 shadow-sm ml-1",children:Ie.remarks||((Ge=Ie.newData)==null?void 0:Ge.remarks)||((at=Ie.details)==null?void 0:at.remarks)})]})]},_t)}):e.jsx("div",{className:"text-center py-8 text-slate-500",children:e.jsx("p",{children:"No activity logs found for this case."})})})})]})})]}),e.jsx(os,{open:l.open,onOpenChange:Ie=>c({open:Ie,type:null}),children:e.jsxs(ls,{children:[e.jsxs(ms,{children:[e.jsxs(us,{children:[l.type==="approve"&&"Approve Resignation Request",l.type==="withdrawal"&&"Withdraw Resignation Request",l.type==="sendBack"&&"Send Back for Clarification",l.type==="revoke"&&"Revoke Resignation Request",l.type==="assign"&&"Assign to User",l.type==="pushfnf"&&"Push to Full & Final Settlement"]}),e.jsx(vs,{children:l.type==="assign"?"Select a user to assign this request to":l.type==="pushfnf"?"This will move the resignation request to F&F for dues clearance":"Please provide remarks for this action"})]}),e.jsx("div",{className:"space-y-4",children:l.type==="assign"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Designation Filter"}),e.jsxs(wt,{value:x,onValueChange:Ie=>{f(Ie),j("")},children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"All Roles"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All Roles"}),e.jsx(Pe,{value:"asm",children:"ASM"}),e.jsx(Pe,{value:"rbm",children:"RBM"}),e.jsx(Pe,{value:"zbh",children:"ZBH"}),e.jsx(Pe,{value:"nbh",children:"NBH"}),e.jsx(Pe,{value:"legal",children:"Legal"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Search Name/Email"}),e.jsxs("div",{className:"relative",children:[e.jsx(ot,{placeholder:"Search...",value:m,onChange:Ie=>p(Ie.target.value),className:"pr-8"}),N&&e.jsx(ss,{className:"w-4 h-4 animate-spin absolute right-2 top-2.5 text-slate-400"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Select Specific Person *"}),e.jsxs(wt,{value:u,onValueChange:j,children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:g.length>0?"Choose a user":"No users found"})}),e.jsx(At,{className:"max-h-60",children:g.map(Ie=>e.jsx(Pe,{value:Ie.id,children:e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx("span",{className:"font-medium",children:Ie.fullName}),e.jsxs("span",{className:"text-[10px] text-slate-500",children:[Ie.roleCode," • ",Ie.email]})]})},Ie.id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Assignment Remarks *"}),e.jsx(Fs,{value:d,onChange:Ie=>h(Ie.target.value),placeholder:"Why are you assigning this user?",rows:2})]})]}):l.type==="pushfnf"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded-lg flex items-start gap-3",children:[e.jsx(Ks,{className:"w-5 h-5 text-amber-600 mt-0.5"}),e.jsxs("div",{className:"text-sm text-amber-800",children:[e.jsx("p",{className:"font-bold",children:"Manual Trigger Notice"}),e.jsx("p",{children:"Normally F&F is triggered after LWD. Use manual trigger only if urgent clearance is required."})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"forceFnF",checked:C,onChange:Ie=>w(Ie.target.checked),className:"w-4 h-4 rounded border-slate-300"}),e.jsx(ce,{htmlFor:"forceFnF",className:"font-medium text-slate-900 cursor-pointer",children:"Force Initiate F&F Settlement Immediately"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Remarks (Optional)"}),e.jsx(Fs,{value:d,onChange:Ie=>h(Ie.target.value),placeholder:"Add any additional notes...",rows:3})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Remarks *"}),e.jsx(Fs,{value:d,onChange:Ie=>h(Ie.target.value),placeholder:"Enter your remarks here...",rows:4})]})}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>c({open:!1,type:null}),disabled:M,children:"Cancel"}),e.jsx(se,{onClick:Ye,disabled:M,className:l.type==="approve"?"bg-green-600 hover:bg-green-700":l.type==="withdrawal"?"bg-red-600 hover:bg-red-700":"bg-amber-600 hover:bg-amber-700",children:M?e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}),"Processing..."]}):e.jsxs(e.Fragment,{children:[l.type==="approve"&&"Approve",l.type==="withdrawal"&&"Withdraw",l.type==="sendBack"&&"Send Back",l.type==="revoke"&&"Revoke",l.type==="assign"&&"Assign",l.type==="pushfnf"&&"Push to F&F"]})})]})]})}),e.jsx(os,{open:R.open,onOpenChange:Ie=>P({open:Ie,stageName:"",documents:[]}),children:e.jsxs(ls,{className:Fb,children:[e.jsxs(ms,{children:[e.jsxs(us,{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-5 h-5 text-amber-600"}),"Documents - ",R.stageName]}),e.jsxs(vs,{children:["Documents uploaded for this stage (",R.documents.length," ",R.documents.length===1?"document":"documents",")"]})]}),e.jsx("div",{className:"max-h-96 overflow-y-auto",children:R.documents.length>0?e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Document Name"}),e.jsx(me,{children:"Type"}),e.jsx(me,{children:"Upload Date"}),e.jsx(me,{children:"Uploader"}),e.jsx(me,{children:"Action"})]})}),e.jsx(Es,{children:R.documents.map(Ie=>e.jsxs(ct,{children:[e.jsx(de,{children:Ie.name}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline",children:Ie.type})}),e.jsx(de,{children:Ie.uploadDate}),e.jsx(de,{children:Ie.uploader}),e.jsx(de,{children:e.jsxs(se,{size:"sm",variant:"outline",className:"text-amber-600 hover:text-blue-700",onClick:()=>{if(!Ie.filePath)return;const _t=Ie.filePath.startsWith("/uploads/")&&!Ie.filePath.startsWith("/uploads/documents/")?Ie.filePath.replace("/uploads/","/uploads/documents/"):Ie.filePath;Z({fileName:Ie.name,filePath:_t,documentType:Ie.type})},children:[e.jsx(fs,{className:"w-4 h-4 mr-1"}),"View"]})})]},Ie.id))})]}):e.jsx("div",{className:"text-center py-8 text-slate-500",children:"No documents uploaded for this stage yet"})}),e.jsx(rn,{children:e.jsx(se,{variant:"outline",onClick:()=>P({open:!1,stageName:"",documents:[]}),children:"Close"})})]})}),e.jsx(os,{open:W,onOpenChange:z,children:e.jsxs(ls,{children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Upload Resignation Document"}),e.jsx(vs,{children:"Add a document and map it to a stage (optional)."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Document Type"}),e.jsxs(wt,{value:D,onValueChange:O,children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"Select document type"})}),e.jsx(At,{children:Ud.map(Ie=>e.jsx(Pe,{value:Ie,children:Ie},Ie))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Stage (Optional)"}),e.jsxs(wt,{value:V||"none",onValueChange:Ie=>K(Ie==="none"?"":Ie),children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"Select stage"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"none",children:"No Stage Mapping"}),mE.map(Ie=>e.jsx(Pe,{value:Ie,children:Ie},Ie))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"File"}),e.jsx(ot,{type:"file",onChange:Ie=>{var _t;return B(((_t=Ie.target.files)==null?void 0:_t[0])||null)}})]})]}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>z(!1),disabled:M,children:"Cancel"}),e.jsx(se,{onClick:be,disabled:M,children:M?"Uploading...":"Upload"})]})]})}),e.jsx(Kl,{isOpen:!!G,onClose:()=>Z(null),document:G})]})}const So={getTerminationById:async t=>{const n=(await Te.getTerminationById(t)).data;return(n==null?void 0:n.termination)||(n==null?void 0:n.data)||n},updateTerminationStatus:async(t,s,n)=>(await Te.updateTerminationStatus(t,{action:s,remarks:n})).data,issueSCN:async(t,s)=>(await Te.issueSCN(t,s)).data,uploadSCNResponse:async(t,s,n)=>{const r=new FormData;return r.append("file",s),n&&r.append("remarks",n),(await Te.uploadSCNResponse(t,r)).data},uploadDocument:async(t,s)=>(await Te.uploadTerminationDocument(t,s)).data,finalizeTermination:async(t,s,n)=>(await Te.finalizeTermination(t,{decision:s,remarks:n})).data};function y$({terminationId:t,onBack:s,currentUser:n}){var Rt,Re,Qt,qt,ws,_s,ns,Cs,Bs,Ft,ie,Fe,Q,pe,Ne,Ee,it,st,bt,Ue,Lt,ut,yt,kt,Ie,_t,ht,zt,rs,Yt,Os,Is,zs,en;const r=qn(),[a,l]=v.useState({open:!1,type:null}),[c,d]=v.useState(""),[h,x]=v.useState(""),[f,m]=v.useState({open:!1,stageName:"",documents:[]}),[p,u]=v.useState(!0),[j,g]=v.useState(null),[y,N]=v.useState([]),[S,C]=v.useState(!1),[w,R]=v.useState(null),[P,A]=v.useState(""),[I,$]=v.useState(!1),[T,E]=v.useState(!1),[_,M]=v.useState("Approve"),[q,G]=v.useState(""),[Z,W]=v.useState(!1),[z,F]=v.useState(null),[B,D]=v.useState(Zx[0]),[O,V]=v.useState(""),[K,Y]=v.useState(null),U=async()=>{try{u(!0);const he=await So.getTerminationById(t);g(he),X()}catch(he){console.error("Error fetching termination:",he)}finally{u(!1)}},X=async()=>{try{const he=await Te.getAuditLogs("termination",t);he.data&&he.data.success&&N(he.data.data||[])}catch(he){console.error("Error fetching audit logs:",he)}};if(v.useEffect(()=>{U()},[t]),p)return e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:[e.jsx(ss,{className:"w-8 h-8 text-amber-600 animate-spin"}),e.jsx("p",{className:"text-slate-600",children:"Loading termination details..."})]});const ne=async()=>{try{$(!0),await So.issueSCN(t,{remarks:P}),ee.success("SCN issued successfully"),C(!1),U()}catch{ee.error("Failed to issue SCN")}finally{$(!1)}},oe=async()=>{if(w)try{$(!0),await So.uploadSCNResponse(t,w,P),ee.success("SCN response uploaded"),C(!1),U()}catch{ee.error("Failed to upload response")}finally{$(!1)}},re=async()=>{try{$(!0),await So.finalizeTermination(t,_,q),ee.success(`Termination ${_.toLowerCase()}ed`),E(!1),U()}catch{ee.error("Failed to finalize termination")}finally{$(!1)}},ge=async()=>{if(!z){ee.error("Please select a file to upload");return}try{$(!0);const he=new FormData;he.append("file",z),he.append("documentType",B),O&&he.append("stage",O),await So.uploadDocument(t,he),ee.success("Document uploaded successfully"),W(!1),F(null),D(Zx[0]),V(""),U()}catch{ee.error("Failed to upload document")}finally{$(!1)}},ve=n&&["DD Lead","DD Head","NBH","DD Admin","Super Admin"].includes(n.role||n.roleCode),We=(()=>{if(!j||!n)return{canApprove:!1,canWithdraw:!1,canIssueSCN:!1,canUploadSCNResponse:!1,canFinalize:!1,canPushToFnF:!1};const he=j.currentStage,Ge=j.status,at=n.role||n.roleCode,pt=["Show Cause Notice","Show Cause Notice (SCN)","SCN"].includes(he),mt=["Completed","Rejected","Withdrawn","Terminated"].includes(Ge)||he==="Terminated",Bt=Ge==="F&F Initiated"||he==="F&F Initiated"||Ge==="Settled"||Ge==="FNF_INITIATED";return{canApprove:(at==="Super Admin"||at==="DD Admin"||he==="RBM Review"&&at==="RBM"||he==="ZBH Review"&&at==="ZBH"||he==="DD Lead Review"&&at==="DD Lead"||he==="Legal Verification"&&at==="Legal Admin"||he==="DD Head Review"&&at==="DD Head"||he==="NBH Evaluation"&&at==="NBH"||he==="NBH Final Approval"&&at==="NBH"||he==="CCO Approval"&&at==="CCO"||he==="CEO Final Approval"&&at==="CEO"||he==="Legal - Termination Letter"&&at==="Legal Admin")&&!mt&&!Bt&&!["NBH Final Approval","CCO Approval","CEO Final Approval","Show Cause Notice","Show Cause Notice (SCN)","SCN"].includes(he),canIssueSCN:he==="NBH Evaluation"&&(at==="NBH"||at==="Super Admin")&&!mt,canUploadSCNResponse:pt&&["Legal Admin","DD Admin","Super Admin"].includes(at)&&!mt,canFinalize:(he==="NBH Final Approval"&&at==="NBH"||he==="CCO Approval"&&at==="CCO"||he==="CEO Final Approval"&&at==="CEO"||at==="Super Admin")&&["NBH Final Approval","CCO Approval","CEO Final Approval"].includes(he)&&!mt,canPushToFnF:ve&&!Bt&&["Legal - Termination Letter","Terminated","Dealer Terminated"].includes(he),canWithdraw:at==="ASM"&&he==="Request Initiated"&&!mt,isFinalState:mt,isSettlementPhase:Bt}})(),Ce=j||{},fe=["Show Cause Notice","Show Cause Notice (SCN)","SCN"].includes(Ce.currentStage),Ye={Submitted:["Submitted","Request Initiated"],"RBM Review":["RBM Review"],"ZBH Review":["ZBH Review"],"DD Lead Review":["DD Lead Review"],"Legal Verification":["Legal Verification"],"DD Head Review":["DD Head Review"],"NBH Evaluation":["NBH Evaluation"],"Show Cause Notice (SCN)":["Show Cause Notice","Show Cause Notice (SCN)","SCN"],"Personal Hearing":["Personal Hearing"],"NBH Final Approval":["NBH Final Approval"],"CCO Approval":["CCO Approval"],"CEO Final Approval":["CEO Final Approval"],"Legal - Termination Letter":["Legal - Termination Letter"],"Dealer Terminated":["Terminated","Dealer Terminated"]},be=["Submitted","RBM Review","ZBH Review","DD Lead Review","Legal Verification","DD Head Review","NBH Evaluation","Show Cause Notice (SCN)","Personal Hearing","NBH Final Approval","CCO Approval","CEO Final Approval","Legal - Termination Letter","Dealer Terminated"],_e=he=>{if(!he)return"";const Ge=String(he).trim();return be.find(pt=>(Ye[pt]||[pt]).includes(Ge))||Ge},ke=he=>{const Ge=["Rejected","Revoked","Withdrawn"].includes(Ce.status),at=["Completed","Terminated","Settled","F&F Initiated","FNF_INITIATED"].includes(Ce.status)||Ce.currentStage==="Terminated";let pt=Ce.currentStage||Ce.status;if(Ge&&(Ce.currentStage==="Rejected"||Ce.currentStage==="Revoked"||!Ce.currentStage)){const as=[...Ce.timeline||[]].reverse().find(Vs=>Vs.stage&&Vs.stage!=="Rejected"&&Vs.stage!=="Revoked");as&&(pt=as.stage)}const mt=_e(pt),Bt=be.indexOf(mt),Ds=be.indexOf(he);return at&&Ds<=Bt?"completed":Ds===-1?"pending":Bt===-1?he==="Submitted"?"completed":"pending":Ds{const at=Ye[Ge]||[Ge],pt=qe.filter(mt=>!mt.stage||at.includes(mt.stage)).map(mt=>{var Bt;return{id:mt.id||`${Ge}-${mt.fileName||mt.name}`,name:mt.fileName||mt.name||"Document",type:mt.documentType||mt.type||"Document",uploadDate:mt.uploadDate||mt.createdAt?Ht(mt.uploadDate||mt.createdAt):"N/A",uploader:((Bt=mt.uploader)==null?void 0:Bt.fullName)||mt.uploader||"-",path:mt.filePath||mt.path||mt.url}});return he[Ge]=pt,he},{}),dt=he=>{const Ge=Ye[he]||[he],at=(Ce.timeline||[]).filter(pt=>Ge.includes(pt.stage));return at.length===0?null:he==="Submitted"?at.find(mt=>String((mt==null?void 0:mt.action)||"").toLowerCase().includes("initiated"))||at[0]:at[at.length-1]},xt=[{id:1,name:"Submitted",status:ke("Submitted"),description:"Termination request initiated",date:"",actionType:"",actionBy:"",remarks:"",feedback:""},{id:2,name:"RBM Review",status:ke("RBM Review"),description:"Regional Business Manager review"},{id:3,name:"ZBH Review",status:ke("ZBH Review"),description:"Zonal Business Head evaluation"},{id:4,name:"DD Lead Review",status:ke("DD Lead Review"),description:"DD Lead validation"},{id:5,name:"Legal Verification",status:ke("Legal Verification"),description:"Legal team validates termination grounds"},{id:6,name:"DD Head Review",status:ke("DD Head Review"),description:"DD Head strategic review"},{id:7,name:"NBH Evaluation",status:ke("NBH Evaluation"),description:"National Business Head decision"},{id:8,name:"Show Cause Notice (SCN)",status:ke("Show Cause Notice (SCN)"),description:"SCN sent to dealer, awaiting response"},{id:9,name:"Personal Hearing",status:ke("Personal Hearing"),description:"Evaluation of SCN response & Hearing"},{id:10,name:"NBH Final Approval",status:ke("NBH Final Approval"),description:"NBH final termination decision"},{id:11,name:"CCO Approval",status:ke("CCO Approval"),description:"Chief Commercial Officer approval"},{id:12,name:"CEO Final Approval",status:ke("CEO Final Approval"),description:"CEO final authorization"},{id:13,name:"Legal - Termination Letter",status:ke("Legal - Termination Letter"),description:"Legal team issues final termination letter"},{id:14,name:"Dealer Terminated",status:ke("Dealer Terminated"),description:"Dealership termination effective",date:"",actionType:"",actionBy:"",remarks:"",feedback:""}],ye=he=>{const Ge=Ve[he]||[];m({open:!0,stageName:he,documents:Ge})},le=he=>{l({open:!0,type:he})},Qe=async()=>{var pt,mt;const he=a.type,Ge=he==="sendBack"?"sendBack":he||"approve",at=c.trim();if(["sendBack","revoke"].includes(he||"")&&at.length<5){ee.error("Please provide detailed remarks (minimum 5 characters required for Send Back / Revoke)");return}if(!at&&!["assign","pushfnf"].includes(he||"")){ee.error("Please provide remarks/comments for this action");return}if(he==="assign"&&!h){ee.error("Please select a user");return}$(!0);try{if(he==="approve"||he==="sendBack"||he==="withdrawal"||he==="revoke")await So.updateTerminationStatus(t,Ge,c);else if(he==="pushfnf")await So.updateTerminationStatus(t,"pushfnf",c);else{ee.error("Action logic not fully implemented for this type"),$(!1);return}const Bt={approve:"Request approved and forwarded",withdrawal:"Request withdrawn successfully",sendBack:"Request sent back for clarification",assign:`Request assigned to ${h}`,pushfnf:"Request pushed to F&F successfully",revoke:"Request revoked and withdrawn"};ee.success(Bt[he]||"Action completed"),l({open:!1,type:null}),d(""),x(""),U()}catch(Bt){const Ds=((mt=(pt=Bt.response)==null?void 0:pt.data)==null?void 0:mt.message)||"Failed to perform action";ee.error(Ds)}finally{$(!1)}},rt=he=>{switch(he){case"Critical":return"bg-red-100 text-red-700 border-red-300";case"High":return"bg-orange-100 text-orange-700 border-orange-300";case"Medium":return"bg-yellow-100 text-yellow-700 border-yellow-300";default:return"bg-blue-100 text-blue-700 border-blue-300"}},Kt=(Ce.worknotes||[]).length;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(mi,{className:"border-amber-200 bg-amber-50",children:[e.jsx(Ya,{className:"h-4 w-4 text-amber-600"}),e.jsx(Hi,{className:"text-amber-900",children:"Sensitive Information"}),e.jsx(fi,{className:"text-amber-700",children:"This is a termination case. All actions are logged and audited. Proceed with caution."})]}),e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"outline",size:"icon",onClick:s,className:"hover:bg-slate-100 transition-colors",children:e.jsx($r,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl",children:Ce.requestId||t}),e.jsx("p",{className:"text-slate-600",children:((Rt=Ce.dealer)==null?void 0:Rt.businessName)||((Re=Ce.dealer)==null?void 0:Re.legalName)||"Termination"})]}),e.jsx(Ae,{className:rt(Ce.severity),children:Ce.severity}),e.jsx(Ae,{className:Ce.status==="Completed"||Ce.status==="Terminated"||Ce.status==="Settled"?"bg-green-100 text-green-700 border-green-300":Ce.status==="Rejected"||Ce.status==="Withdrawn"?"bg-red-100 text-red-700 border-red-300":"bg-yellow-100 text-yellow-700 border-yellow-300",children:Ce.status==="Settled"?"Completed":Ce.status||"Pending"})]})}),e.jsx(Le,{className:"border-amber-200 shadow-sm",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-slate-600 mr-2",children:"Termination Actions:"}),(n==null?void 0:n.role)!=="Dealer"&&e.jsxs(e.Fragment,{children:[!We.canFinalize&&e.jsxs(e.Fragment,{children:[We.canApprove&&e.jsxs(se,{size:"sm",className:"bg-green-600 hover:bg-green-700 transition-all hover:shadow-md",onClick:()=>le("approve"),children:[e.jsx(Bn,{className:"w-4 h-4 mr-2"}),"Approve"]}),We.canIssueSCN&&e.jsxs(se,{size:"sm",className:"bg-purple-600 hover:bg-purple-700 transition-all shadow-sm",onClick:()=>C(!0),children:[e.jsx(Ya,{className:"w-4 h-4 mr-2"}),"Issue SCN"]}),We.canUploadSCNResponse&&e.jsxs(se,{size:"sm",className:"bg-amber-600 hover:bg-amber-700 transition-all shadow-sm",onClick:()=>{R(null),C(!0)},children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"Upload SCN Response"]}),We.canApprove&&e.jsxs(se,{size:"sm",variant:"outline",className:"hover:bg-slate-50 transition-all",onClick:()=>le("sendBack"),children:[e.jsx(Qv,{className:"w-4 h-4 mr-2"}),"Send Back"]})]}),We.canFinalize&&e.jsxs(se,{size:"sm",className:"bg-indigo-600 hover:bg-indigo-700 transition-all shadow-sm",onClick:()=>E(!0),children:[e.jsx(Fl,{className:"w-4 h-4 mr-2"}),"Final Authorization"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[We.canPushToFnF&&e.jsxs(se,{size:"sm",variant:"outline",className:"text-blue-600 border-blue-300 hover:bg-blue-50 transition-all",onClick:()=>le("pushfnf"),children:[e.jsx(fu,{className:"w-4 h-4 mr-2"}),"Push to F&F"]}),!We.isFinalState&&e.jsxs(se,{size:"sm",variant:"outline",className:"hover:bg-slate-50 transition-all",onClick:()=>le("assign"),children:[e.jsx(Jv,{className:"w-4 h-4 mr-2"}),"Assign User"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-amber-200",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(zr,{className:"w-4 h-4 text-slate-500"}),e.jsx("span",{className:"text-sm text-slate-600",children:"Communication & Notes"})]}),e.jsxs(se,{size:"sm",variant:"outline",className:"relative hover:bg-amber-50 hover:border-amber-300 hover:text-amber-700 transition-all shadow-sm",onClick:()=>{var he;return r(`/worknotes/termination/${t}`,{state:{applicationName:((he=Ce==null?void 0:Ce.dealer)==null?void 0:he.businessName)||"Termination",registrationNumber:t||"",participants:(Ce==null?void 0:Ce.participants)||[]}})},children:[e.jsx(zr,{className:"w-4 h-4 mr-2"}),"View Work Notes",Kt>0&&e.jsx(Ae,{className:"ml-2 bg-amber-600 hover:bg-amber-700 text-white h-5 px-2",children:Kt})]})]})]})})}),e.jsxs(Pn,{defaultValue:"details",className:"w-full",children:[e.jsxs(_n,{className:"bg-slate-100 p-1",children:[e.jsx(Wt,{value:"details",className:"data-[state=active]:bg-white",children:"Details"}),e.jsx(Wt,{value:"progress",className:"data-[state=active]:bg-white",children:"Progress"}),e.jsx(Wt,{value:"documents",className:"data-[state=active]:bg-white",children:"Documents"}),e.jsx(Wt,{value:"audit",className:"data-[state=active]:bg-white",children:"Audit Trail"})]}),e.jsxs(Gt,{value:"details",className:"space-y-6",children:[e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Dealer Information"})}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Code"}),e.jsx("p",{children:((qt=(Qt=Ce.dealer)==null?void 0:Qt.dealerCode)==null?void 0:qt.dealerCode)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:((ws=Ce.dealer)==null?void 0:ws.businessName)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GST"}),e.jsx("p",{children:((_s=Ce.dealer)==null?void 0:_s.gstNumber)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Email"}),e.jsx("p",{children:((Cs=(ns=Ce.dealer)==null?void 0:ns.user)==null?void 0:Cs.email)||"N/A"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(ce,{className:"text-slate-600",children:"Address"}),e.jsx("p",{children:((Bs=Ce.dealer)==null?void 0:Bs.registeredAddress)||((ie=(Ft=Ce.dealer)==null?void 0:Ft.application)==null?void 0:ie.address)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"City"}),e.jsx("p",{children:((Q=(Fe=Ce.dealer)==null?void 0:Fe.application)==null?void 0:Q.city)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"District"}),e.jsx("p",{children:((Ee=(Ne=(pe=Ce.dealer)==null?void 0:pe.application)==null?void 0:Ne.district)==null?void 0:Ee.name)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealership Name"}),e.jsx("p",{children:((it=Ce.dealer)==null?void 0:it.businessName)||Ce.dealershipName})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Sales Code"}),e.jsx("p",{children:((bt=(st=Ce.dealer)==null?void 0:st.dealerCode)==null?void 0:bt.salesCode)||Ce.salesCode||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Service Code"}),e.jsx("p",{children:((Lt=(Ue=Ce.dealer)==null?void 0:Ue.dealerCode)==null?void 0:Lt.serviceCode)||Ce.serviceCode||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GMA Code"}),e.jsx("p",{children:((yt=(ut=Ce.dealer)==null?void 0:ut.dealerCode)==null?void 0:yt.gmaCode)||Ce.accessoriesCode||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GMA Code"}),e.jsx("p",{children:((Ie=(kt=Ce.dealer)==null?void 0:kt.dealerCode)==null?void 0:Ie.gmaCode)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Gear Code"}),e.jsx("p",{children:((ht=(_t=Ce.dealer)==null?void 0:_t.dealerCode)==null?void 0:ht.gearCode)||"N/A"})]})]})})]}),e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Operational Details"})}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Inauguration"}),e.jsx("p",{children:(zt=Ce.dealer)!=null&&zt.onboardedAt?Ht(Ce.dealer.onboardedAt,"date"):Ce.inauguration||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"LOA Date"}),e.jsx("p",{children:(rs=Ce.dealer)!=null&&rs.loaDate?Ht(Ce.dealer.loaDate,"date"):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"LOI Date"}),e.jsx("p",{children:(Yt=Ce.dealer)!=null&&Yt.loiDate?Ht(Ce.dealer.loiDate,"date"):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Last 6 Months Sales"}),e.jsx("p",{children:Ce.lastSixMonthsSales})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Number of Dealerships"}),e.jsx("p",{children:Ce.numberOfDealerships})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Number of Studios"}),e.jsx("p",{children:Ce.numberOfStudios})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Constitution"}),e.jsx("p",{children:((Os=Ce.dealer)==null?void 0:Os.constitutionType)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealership Type"}),e.jsx("p",{children:((zs=(Is=Ce.dealer)==null?void 0:Is.application)==null?void 0:zs.businessType)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Type of Closure"}),e.jsx("p",{children:Ce.typeOfClosure||"Complete"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Format Category"}),e.jsx("p",{children:Ce.formatCategory||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Score Card Band"}),e.jsx("p",{children:Ce.dealerScoreCardBand||"N/A"})]})]})})]}),e.jsxs(Le,{className:"border-amber-200 bg-amber-50/30",children:[e.jsx(tt,{children:e.jsxs(nt,{className:"text-amber-900 flex items-center gap-2",children:[e.jsx(Ya,{className:"w-5 h-5"}),"Termination Details"]})}),e.jsx(Me,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Termination Category"}),e.jsx("p",{className:"text-amber-900",children:Ce.category})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Sub Category"}),e.jsx("p",{children:Ce.subCategory||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Description"}),e.jsx("p",{children:Ce.reason})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Severity"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ae,{className:rt(Ce.severity),children:Ce.severity})})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Submitted By"}),e.jsx("p",{children:((en=Ce.initiator)==null?void 0:en.fullName)||"System"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:Ht(Ce.createdAt)})]})]})]})})]})]}),e.jsx(Gt,{value:"progress",children:e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Termination Progress Timeline"}),e.jsx(Zt,{children:"Track the termination request approval process"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:xt.map((he,Ge)=>{var mt;const at=((mt=Ve[he.name])==null?void 0:mt.length)||0,pt=dt(he.name);return e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${he.status==="completed"?"bg-green-100 text-green-600":he.status==="active"?"bg-amber-100 text-amber-600":"bg-slate-100 text-slate-400"}`,children:he.status==="completed"?e.jsx(Bn,{className:"w-5 h-5"}):he.status==="active"?e.jsx(Ya,{className:"w-5 h-5"}):e.jsx("span",{children:he.id})}),Ge0&&e.jsxs("button",{onClick:()=>ye(he.name),className:"flex items-center gap-1 px-2 py-1 rounded-full bg-amber-100 hover:bg-amber-200 text-amber-700 text-xs transition-colors cursor-pointer",children:[e.jsx(fs,{className:"w-3 h-3"}),e.jsxs("span",{children:[at," ",at===1?"doc":"docs"]})]})]}),((pt==null?void 0:pt.timestamp)||he.date)&&e.jsxs("div",{className:"flex items-center gap-1 text-sm text-slate-600",children:[e.jsx($n,{className:"w-4 h-4"}),e.jsx("span",{children:Ht((pt==null?void 0:pt.timestamp)||he.date)})]})]}),e.jsx("p",{className:"text-slate-600 text-sm",children:he.description}),pt&&e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:"bg-blue-100 text-blue-700 border-blue-300",children:pt.action||"Updated"}),e.jsxs("span",{className:"text-xs text-slate-500",children:["by ",pt.user||"System"]})]}),e.jsx("div",{className:"bg-slate-50 border border-slate-200 rounded-lg p-3",children:e.jsx("div",{className:"space-y-2",children:e.jsxs("div",{children:[e.jsx(ce,{className:"text-xs text-slate-600",children:"Remarks:"}),e.jsx("p",{className:"text-sm text-slate-700 mt-1",children:pt.remarks||"No remarks provided."})]})})})]})]})]},he.id)})})})]})}),e.jsx(Gt,{value:"documents",children:e.jsxs(Le,{children:[e.jsxs(tt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Documents"}),e.jsx(Zt,{children:"View and manage termination case documents"})]}),e.jsxs(se,{size:"sm",onClick:()=>W(!0),className:"bg-amber-600 hover:bg-amber-700",children:[e.jsx(Dr,{className:"w-4 h-4 mr-2"}),"Upload Document"]})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Document Name"}),e.jsx(me,{children:"Type"}),e.jsx(me,{children:"Upload Date"}),e.jsx(me,{children:"Uploader"}),e.jsx(me,{children:"Actions"})]})}),e.jsx(Es,{children:(()=>{const he=[...Ce.documents||[],...Ce.uploadedDocuments||[]];return he.length===0?e.jsx(ct,{children:e.jsx(de,{colSpan:5,className:"text-center py-4 text-slate-500",children:"No documents found"})}):he.map((Ge,at)=>{var pt;return e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-4 h-4 text-slate-500"}),e.jsx("span",{children:Ge.name||Ge.fileName})]})}),e.jsx(de,{children:Ge.documentType||Ge.type||"Document"}),e.jsx(de,{children:Ht(Ge.uploadDate||Ge.createdAt)}),e.jsx(de,{children:((pt=Ge.uploader)==null?void 0:pt.fullName)||Ge.uploader||"-"}),e.jsx(de,{children:e.jsx(se,{size:"sm",variant:"outline",onClick:()=>{const mt=Ge.filePath||Ge.path||Ge.url;if(!mt)return;const Bt=mt.startsWith("/uploads/")&&!mt.startsWith("/uploads/documents/")?mt.replace("/uploads/","/uploads/documents/"):mt;Y({fileName:Ge.name||Ge.fileName||"Document",filePath:Bt,documentType:Ge.documentType||Ge.type||"Document"})},children:"View"})})]},Ge.id||at)})})()})]})})]})}),e.jsx(Gt,{value:"audit",children:e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Audit Trail"}),e.jsx(Zt,{children:"Complete history of actions on this termination case"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:y.length>0?y.map((he,Ge)=>{var at,pt,mt,Bt,Ds,as,Vs,Ls,Ts,ln,pn;return e.jsxs("div",{className:"flex gap-3 pb-6 border-b border-slate-100 last:border-0 relative",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-slate-300 mt-2 z-10"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:` +Defaulting to \`null\`.`}var I7=cE,M7=uE;function ji({className:t,value:s,...n}){return e.jsx(I7,{"data-slot":"progress",className:_t("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",t),...n,children:e.jsx(M7,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(s||0)}%)`}})})}function Yl({className:t,...s}){return e.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:_t("mx-auto flex w-full justify-center",t),...s})}function Zl({className:t,...s}){return e.jsx("ul",{"data-slot":"pagination-content",className:_t("flex flex-row items-center gap-1",t),...s})}function an({...t}){return e.jsx("li",{"data-slot":"pagination-item",...t})}function Ci({className:t,isActive:s,size:n="icon",...r}){return e.jsx("a",{"aria-current":s?"page":void 0,"data-slot":"pagination-link","data-active":s,className:_t(Zm({variant:s?"outline":"ghost",size:n}),t),...r})}function Ql({className:t,...s}){return e.jsxs(Ci,{"aria-label":"Go to previous page",size:"default",className:_t("gap-1 px-2.5 sm:pl-2.5",t),...s,children:[e.jsx(qc,{}),e.jsx("span",{className:"hidden sm:block",children:"Previous"})]})}function Xl({className:t,...s}){return e.jsxs(Ci,{"aria-label":"Go to next page",size:"default",className:_t("gap-1 px-2.5 sm:pr-2.5",t),...s,children:[e.jsx("span",{className:"hidden sm:block",children:"Next"}),e.jsx(el,{})]})}function Jl({className:t,...s}){return e.jsxs("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:_t("flex size-9 items-center justify-center",t),...s,children:[e.jsx(hL,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"More pages"})]})}function F7({onViewDetails:t,initialFilter:s}){const{user:n}=Nn(W=>W.auth),[r,a]=v.useState(""),[l,c]=v.useState("all"),[d,m]=v.useState(s||"all"),[x,f]=v.useState([]),[h,g]=v.useState("date"),[u,j]=v.useState(!1),[p,y]=v.useState(!1),[N,S]=v.useState([]),[A,w]=v.useState([]),[E,T]=v.useState(1),[C,L]=v.useState(null),$=10;v.useEffect(()=>{_()},[E,l,d,r]);const _=async()=>{try{const W=await ds.getApplications({page:E,limit:$,status:d!=="all"?d:void 0,location:l!=="all"?l:void 0,search:r||void 0,ddLeadShortlisted:"true",isShortlisted:"true",assignedTo:p?n==null?void 0:n.id:void 0}),U=W.data||[];L(W.meta);const F=U.map(B=>({id:B.id,registrationNumber:B.applicationId||"N/A",name:B.applicantName,email:B.email,phone:B.phone,age:B.age,education:B.education,residentialAddress:B.address||B.city||"",businessAddress:B.address||"",preferredLocation:B.preferredLocation,state:B.state,ownsBike:B.ownRoyalEnfield==="yes",pastExperience:B.experienceYears?`${B.experienceYears} years`:B.description||"",status:B.overallStatus,questionnaireMarks:0,rank:0,totalApplicantsAtLocation:0,submissionDate:B.createdAt,assignedUsers:[],assignedTo:B.assignedTo,progress:B.progressPercentage||0,isShortlisted:B.ddLeadShortlisted||B.isShortlisted||!1,companyName:B.companyName,source:B.source,existingDealer:B.existingDealer,royalEnfieldModel:B.royalEnfieldModel,description:B.description,pincode:B.pincode,locationType:B.locationType,ownRoyalEnfield:B.ownRoyalEnfield,address:B.address}));if(S(F),A.length===0){const B=Array.from(new Set(F.map(D=>D.preferredLocation))).filter(Boolean);w(B)}}catch(W){console.error("Failed to fetch applications",W)}finally{}},R=N.sort((W,U)=>h==="date"?new Date(U.submissionDate).getTime()-new Date(W.submissionDate).getTime():0),P=W=>{f(U=>U.includes(W)?U.filter(F=>F!==W):[...U,W])},M=()=>{x.length===R.length?f([]):f(R.map(W=>W.id))},q=()=>{alert(`Sending reminders to ${x.length} applicants`),f([])},K=()=>{alert("Exporting applications to CSV...")},Z=W=>({Submitted:"bg-slate-500","Questionnaire Pending":"bg-orange-500","Questionnaire Completed":"bg-blue-500",Shortlisted:"bg-cyan-500","Level 1 Pending":"bg-amber-500","Level 1 Approved":"bg-green-500","Level 2 Pending":"bg-purple-500","Level 2 Approved":"bg-green-600","Level 2 Recommended":"bg-teal-500","Level 3 Pending":"bg-indigo-500","FDD Verification":"bg-violet-500","Payment Pending":"bg-yellow-500","LOI Issued":"bg-lime-500","Dealer Code Generation":"bg-fuchsia-500","Architecture Team Assigned":"bg-blue-500","Architecture Document Upload":"bg-blue-500","Architecture Team Completion":"bg-blue-500","Statutory GST":"bg-emerald-500","Statutory PAN":"bg-emerald-500","Statutory Nodal":"bg-emerald-500","Statutory Check":"bg-emerald-500","Statutory Partnership":"bg-emerald-500","Statutory Firm Reg":"bg-emerald-500","Statutory Virtual Code":"bg-emerald-500","Statutory Domain":"bg-emerald-500","Statutory MSD":"bg-emerald-500","Statutory LOI Ack":"bg-emerald-500","EOR In Progress":"bg-sky-500","LOA Pending":"bg-emerald-500",Approved:"bg-green-700",Rejected:"bg-red-500",Disqualified:"bg-red-700"})[W]||"bg-slate-500";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-4",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ot,{type:"text",placeholder:"Search by name, ID, or email...",value:r,onChange:W=>a(W.target.value),className:"pl-10","data-testid":"onboarding-applications-search-input"})]}),e.jsxs(wt,{value:l,onValueChange:c,children:[e.jsx(Ct,{className:"w-full lg:w-48","data-testid":"onboarding-applications-location-filter",children:e.jsx(St,{placeholder:"All Locations"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All Locations"}),A.map(W=>e.jsx(_e,{value:W,children:W},W))]})]}),e.jsxs(wt,{value:d,onValueChange:m,children:[e.jsx(Ct,{className:"w-full lg:w-48","data-testid":"onboarding-applications-status-filter",children:e.jsx(St,{placeholder:"All Statuses"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All Statuses"}),e.jsx(_e,{value:"Questionnaire Pending",children:"Questionnaire Pending"}),e.jsx(_e,{value:"Shortlisted",children:"Shortlisted"}),e.jsx(_e,{value:"Level 1 Pending",children:"Level 1 Pending"}),e.jsx(_e,{value:"Level 2 Pending",children:"Level 2 Pending"}),e.jsx(_e,{value:"Level 3 Pending",children:"Level 3 Pending"}),e.jsx(_e,{value:"EOR In Progress",children:"EOR In Progress"}),e.jsx(_e,{value:"Approved",children:"Approved"}),e.jsx(_e,{value:"Rejected",children:"Rejected"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Rn,{id:"my-assignments",checked:p,onCheckedChange:W=>y(W),"data-testid":"onboarding-applications-assignments-checkbox"}),e.jsx(ce,{htmlFor:"my-assignments","data-testid":"onboarding-applications-assignments-label",children:"My Assignments Only"})]}),e.jsxs(wt,{value:h,onValueChange:W=>g(W),children:[e.jsx(Ct,{className:"w-full lg:w-40","data-testid":"onboarding-applications-sort-select",children:e.jsx(St,{placeholder:"Sort By"})}),e.jsx(At,{children:e.jsx(_e,{value:"date",children:"Date"})})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-4",children:[e.jsxs(se,{variant:"outline",size:"sm",onClick:K,"data-testid":"onboarding-applications-export-button",children:[e.jsx(Ni,{className:"w-4 h-4 mr-2"}),"Export"]}),x.length>0&&e.jsxs(se,{variant:"outline",size:"sm",onClick:q,"data-testid":"onboarding-applications-reminders-button",children:[e.jsx(qr,{className:"w-4 h-4 mr-2"}),"Send Reminders (",x.length,")"]}),e.jsxs("div",{className:"ml-auto text-slate-600","data-testid":"onboarding-applications-count-text",children:[C?C.total:R.length," application",(C==null?void 0:C.total)!==1?"s":""]})]})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200",children:[e.jsxs(ks,{"data-testid":"onboarding-applications-table",children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{className:"w-12",children:e.jsx(Rn,{checked:x.length===R.length&&R.length>0,onCheckedChange:M,"data-testid":"onboarding-applications-header-checkbox"})}),e.jsx(me,{children:"ID"}),e.jsx(me,{children:"Name"}),e.jsx(me,{children:"Preferred Location"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Applicant Location"}),e.jsx(me,{children:"Progress"}),e.jsx(me,{children:"Applied On"}),e.jsx(me,{children:"Actions"})]})}),e.jsx(Es,{children:R.map((W,U)=>e.jsxs(ct,{"data-testid":`onboarding-application-row-${U}`,children:[e.jsx(de,{children:e.jsx(Rn,{checked:x.includes(W.id),onCheckedChange:()=>P(W.id),"data-testid":`onboarding-application-checkbox-${U}`})}),e.jsx(de,{"data-testid":`onboarding-application-id-${U}`,children:W.registrationNumber}),e.jsx(de,{"data-testid":`onboarding-application-name-${U}`,children:W.name}),e.jsx(de,{"data-testid":`onboarding-application-pref-location-${U}`,children:W.preferredLocation}),e.jsx(de,{children:e.jsx(Ae,{className:Z(W.status),"data-testid":`onboarding-application-status-${U}`,children:W.status})}),e.jsx(de,{className:"text-slate-600 max-w-xs truncate","data-testid":`onboarding-application-addr-${U}`,children:W.residentialAddress}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ji,{value:W.progress,className:"h-2 w-20","data-testid":`onboarding-application-progress-bar-${U}`}),e.jsxs("span",{className:"text-slate-600","data-testid":`onboarding-application-progress-text-${U}`,children:[W.progress,"%"]})]})}),e.jsx(de,{"data-testid":`onboarding-application-date-${U}`,children:Ht(W.submissionDate)}),e.jsx(de,{children:e.jsx(se,{size:"sm",variant:"outline",onClick:()=>t(W.id),"data-testid":`onboarding-application-view-btn-${U}`,children:"View"})})]},W.id))})]}),C&&C.totalPages>1&&e.jsx("div",{className:"py-4 border-t px-4 flex justify-center",children:e.jsx(Yl,{children:e.jsxs(Zl,{children:[e.jsx(an,{children:e.jsx(Ql,{onClick:()=>T(W=>Math.max(1,W-1)),className:E===1?"pointer-events-none opacity-50":"cursor-pointer"})}),[...Array(C.totalPages)].map((W,U)=>{const F=U+1;return F===1||F===C.totalPages||F>=E-1&&F<=E+1?e.jsx(an,{children:e.jsx(Ci,{isActive:E===F,onClick:()=>T(F),className:"cursor-pointer",children:F})},F):F===2&&E>3||F===C.totalPages-1&&ET(W=>Math.min(C.totalPages,W+1)),className:E===C.totalPages?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]}),e.jsx(os,{open:u,onOpenChange:j,children:e.jsxs(ls,{className:"max-w-2xl","data-testid":"onboarding-new-app-modal",children:[e.jsx(ms,{children:e.jsx(us,{children:"Add New Application (Admin)"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-slate-600",children:"This form allows administrators to manually add applications to the system."}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Name"}),e.jsx(ot,{placeholder:"Full Name","data-testid":"onboarding-new-app-name"})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Email"}),e.jsx(ot,{type:"email",placeholder:"email@example.com","data-testid":"onboarding-new-app-email"})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Phone"}),e.jsx(ot,{placeholder:"+91 XXXXX XXXXX","data-testid":"onboarding-new-app-phone"})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Preferred Location"}),e.jsxs(wt,{children:[e.jsx(Ct,{"data-testid":"onboarding-new-app-location-select",children:e.jsx(St,{placeholder:"Select location"})}),e.jsx(At,{children:A.map(W=>e.jsx(_e,{value:W,children:W},W))})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(se,{variant:"outline",onClick:()=>j(!1),"data-testid":"onboarding-new-app-cancel",children:"Cancel"}),e.jsx(se,{className:"bg-amber-600 hover:bg-amber-700","data-testid":"onboarding-new-app-submit",children:"Create Application"})]})]})]})})]})}function mE({application:t,onViewDetails:s}){var r;const n=a=>({Submitted:"bg-slate-500","Questionnaire Pending":"bg-orange-500","Questionnaire Completed":"bg-blue-500",Shortlisted:"bg-cyan-500","Level 1 Pending":"bg-amber-500","Level 1 Approved":"bg-green-500","Level 2 Pending":"bg-purple-500","Level 2 Approved":"bg-green-600","Level 2 Recommended":"bg-teal-500","Level 3 Pending":"bg-indigo-500","FDD Verification":"bg-violet-500","Payment Pending":"bg-yellow-500","LOI Issued":"bg-lime-500","Dealer Code Generation":"bg-fuchsia-500","Architecture Team Assigned":"bg-blue-500","Architecture Document Upload":"bg-blue-500","Architecture Team Completion":"bg-blue-500","Statutory GST":"bg-emerald-500","Statutory PAN":"bg-emerald-500","Statutory Nodal":"bg-emerald-500","Statutory Check":"bg-emerald-500","Statutory Partnership":"bg-emerald-500","Statutory Firm Reg":"bg-emerald-500","Statutory Virtual Code":"bg-emerald-500","Statutory Domain":"bg-emerald-500","Statutory MSD":"bg-emerald-500","Statutory LOI Ack":"bg-emerald-500","EOR In Progress":"bg-sky-500","LOA Pending":"bg-emerald-500",Approved:"bg-green-700",Rejected:"bg-red-500",Disqualified:"bg-red-700"})[a]||"bg-slate-500";return e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-6 hover:shadow-lg transition-shadow","data-testid":`onboarding-application-card-${t.id}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"text-slate-900","data-testid":"onboarding-application-card-name",children:t.name}),(r=t.tags)==null?void 0:r.map(a=>e.jsx(Ae,{variant:"outline",className:a==="Approved"?"border-green-500 text-green-700":"border-teal-500 text-teal-700","data-testid":`onboarding-application-card-tag-${a}`,children:a},a))]}),e.jsx("p",{className:"text-slate-600","data-testid":"onboarding-application-card-registration",children:t.registrationNumber})]}),e.jsx(Ae,{className:n(t.status),"data-testid":"onboarding-application-card-status",children:t.status})]}),e.jsxs("div",{className:"space-y-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[e.jsx(Er,{className:"w-4 h-4"}),e.jsx("span",{"data-testid":"onboarding-application-card-location",children:t.preferredLocation}),t.rank&&t.totalApplicantsAtLocation&&e.jsxs(Ae,{variant:"outline","data-testid":"onboarding-application-card-rank",children:["Rank ",t.rank,"/",t.totalApplicantsAtLocation]})]}),e.jsxs("div",{className:"flex items-start gap-2 text-slate-600",children:[e.jsx(Dc,{className:"w-4 h-4 mt-0.5"}),e.jsx("span",{className:"text-sm","data-testid":"onboarding-application-card-address",children:t.businessAddress})]}),e.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[e.jsx(qr,{className:"w-4 h-4"}),e.jsx("span",{"data-testid":"onboarding-application-card-email",children:t.email})]}),e.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[e.jsx(Jv,{className:"w-4 h-4"}),e.jsx("span",{"data-testid":"onboarding-application-card-phone",children:t.phone})]}),t.questionnaireMarks!==void 0&&e.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[e.jsx(M2,{className:"w-4 h-4"}),e.jsxs("span",{"data-testid":"onboarding-application-card-score",children:["Score: ",t.questionnaireMarks,"/100"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[e.jsx($n,{className:"w-4 h-4"}),e.jsxs("span",{"data-testid":"onboarding-application-card-submission-date",children:["Submitted: ",Ht(t.submissionDate)]})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-slate-600",children:"Progress"}),e.jsxs("span",{className:"text-slate-900","data-testid":"onboarding-application-card-progress-text",children:[t.progress,"%"]})]}),e.jsx(ji,{value:t.progress,className:"h-2","data-testid":"onboarding-application-card-progress-bar"})]}),t.deadline&&t.status==="Questionnaire Pending"&&e.jsx("div",{className:"mb-4 p-3 bg-orange-50 border border-orange-200 rounded-md","data-testid":"onboarding-application-card-deadline-warning",children:e.jsxs("p",{className:"text-orange-800",children:["Deadline: ",Ht(t.deadline)]})}),e.jsx(se,{onClick:()=>s(t.id),className:"w-full bg-amber-600 hover:bg-amber-700","data-testid":"onboarding-application-card-view-button",children:"View Details"})]})}function B7({onViewDetails:t,initialFilter:s="all"}){const[n,r]=v.useState("grid"),[a,l]=v.useState(""),[c,d]=v.useState(s),[m,x]=v.useState("all"),[f,h]=v.useState("all"),[g,u]=v.useState([]),[j,p]=v.useState(!1),[y,N]=v.useState(""),[S,A]=v.useState([]),[w,E]=v.useState(!0),[T,C]=v.useState([]),[L,$]=v.useState([]),[_,R]=v.useState(1),[P,M]=v.useState(null);v.useEffect(()=>{K()},[_,a,c,m,f]),v.useEffect(()=>{R(1)},[a,c,m,f]),v.useEffect(()=>{q()},[]);const q=async()=>{try{const G=await Ss.getStates(),V=(Array.isArray(G)?G:(G==null?void 0:G.data)||(G==null?void 0:G.states)||[]).map(X=>typeof X=="string"?X:X.name||X.stateName).filter(Boolean);C(V)}catch(G){console.error("Failed to fetch states:",G)}},K=async()=>{try{E(!0);const G=await ds.getApplications({page:_,limit:10,search:a,status:c==="all"?void 0:c,location:m!=="all"?m:void 0,state:f!=="all"?f:void 0,isShortlisted:void 0}),Y=G.data||[];M(G.meta);const V=Y.map(ne=>({id:ne.id,registrationNumber:ne.applicationId||"N/A",name:ne.applicantName,email:ne.email,phone:ne.phone,age:ne.age,education:ne.education,residentialAddress:ne.address||ne.city||"",businessAddress:ne.address||"",preferredLocation:ne.preferredLocation,state:ne.state,ownsBike:ne.ownRoyalEnfield==="yes",pastExperience:ne.experienceYears?`${ne.experienceYears} years`:ne.description||"",status:ne.overallStatus,questionnaireMarks:ne.score||ne.questionnaireMarks||0,rank:0,totalApplicantsAtLocation:0,submissionDate:ne.createdAt,assignedUsers:[],progress:ne.progressPercentage||0,isShortlisted:ne.isShortlisted||ne.ddLeadShortlisted,companyName:ne.companyName,source:ne.source,existingDealer:ne.existingDealer,royalEnfieldModel:ne.royalEnfieldModel,description:ne.description,pincode:ne.pincode,locationType:ne.locationType,ownRoyalEnfield:ne.ownRoyalEnfield,address:ne.address}));A(V);const X=Array.from(new Set(V.map(ne=>ne.preferredLocation))).filter(Boolean);$(X)}catch(G){console.error("Failed to fetch applications:",G),ee.error("Failed to load applications")}finally{E(!1)}},Z=S,W=G=>{u(G?Z.map(Y=>Y.id):[])},U=(G,Y)=>{u(Y?[...g,G]:g.filter(V=>V!==G))},F=()=>{if(g.length===0){ee.error("Please select at least one application to shortlist");return}p(!0)},B=async()=>{try{ee.success(`${g.length} application(s) shortlisted successfully!`),p(!1),K()}catch{ee.error("Failed to shortlist")}},D=()=>{ee.success(`Reminder emails sent to ${g.length} applicant(s)`)},O=["Submitted","Questionnaire Pending","Questionnaire Completed"],z=G=>({Submitted:"bg-blue-100 text-blue-800","Questionnaire Pending":"bg-yellow-100 text-yellow-800","Questionnaire Completed":"bg-cyan-100 text-cyan-800",Shortlisted:"bg-purple-100 text-purple-800","Level 1 Interview Pending":"bg-orange-100 text-orange-800","Level 1 Approved":"bg-green-100 text-green-800","Level 2 Interview Pending":"bg-orange-100 text-orange-800","Level 2 Approved":"bg-green-100 text-green-800","Level 2 Recommended":"bg-teal-100 text-teal-800","Level 3 Interview Pending":"bg-orange-100 text-orange-800","In Review":"bg-slate-100 text-slate-800","Level 3 Approved":"bg-green-100 text-green-800","FDD Verification":"bg-indigo-100 text-indigo-800","Payment Pending":"bg-amber-100 text-amber-800","LOI In Progress":"bg-sky-100 text-sky-800","LOI Issued":"bg-sky-100 text-sky-800","Dealer Code Generation":"bg-purple-100 text-purple-800","Architecture Team Assigned":"bg-blue-100 text-blue-800","Architecture Document Upload":"bg-blue-100 text-blue-800","Architecture Team Completion":"bg-blue-100 text-blue-800","Statutory GST":"bg-emerald-100 text-emerald-800","Statutory PAN":"bg-emerald-100 text-emerald-800","Statutory Nodal":"bg-emerald-100 text-emerald-800","Statutory Check":"bg-emerald-100 text-emerald-800","Statutory Partnership":"bg-emerald-100 text-emerald-800","Statutory Firm Reg":"bg-emerald-100 text-emerald-800","Statutory Rental":"bg-emerald-100 text-emerald-800","Statutory Virtual Code":"bg-emerald-100 text-emerald-800","Statutory Domain":"bg-emerald-100 text-emerald-800","Statutory MSD":"bg-emerald-100 text-emerald-800","Statutory LOI Ack":"bg-emerald-100 text-emerald-800","EOR In Progress":"bg-violet-100 text-violet-800","EOR Complete":"bg-violet-100 text-violet-800","LOA Pending":"bg-pink-100 text-pink-800",Inauguration:"bg-amber-100 text-amber-800",Approved:"bg-green-100 text-green-800",Rejected:"bg-red-100 text-red-800",Disqualified:"bg-gray-100 text-gray-800",Onboarded:"bg-emerald-100 text-emerald-800","LOI Approved":"bg-sky-100 text-sky-800","Security Details In Progress":"bg-amber-100 text-amber-800","Security Details Approved":"bg-green-100 text-green-800","Security Details":"bg-amber-100 text-amber-800","LOA Issued":"bg-pink-100 text-pink-800"})[G]||"bg-gray-100 text-gray-800";return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4","data-testid":"onboarding-all-apps-banner",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Gs,{className:"w-5 h-5 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-amber-900 mb-1",children:"DD Workflow - Initial Application Review"}),e.jsxs("p",{className:"text-amber-800",children:["This page shows ",e.jsx("strong",{children:"only applications that haven't been shortlisted yet"}),". Review and select promising candidates using the ",e.jsx("strong",{children:"Shortlist"})," button. Once shortlisted, applications will be removed from here and moved to the ",e.jsx("strong",{children:"Dealership Requests"})," page for further processing."]})]})]})}),e.jsx("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ot,{type:"text",placeholder:"Search by name or registration number...",value:a,onChange:G=>l(G.target.value),className:"pl-10","data-testid":"onboarding-all-apps-search-input"})]}),e.jsxs(wt,{value:c,onValueChange:d,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-all-apps-status-filter",children:e.jsx(St,{placeholder:"Filter by status"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All Statuses"}),O.map(G=>e.jsx(_e,{value:G,children:G},G))]})]}),e.jsxs(wt,{value:f,onValueChange:h,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-all-apps-state-filter",children:e.jsx(St,{placeholder:"Filter by state"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All States"}),T.map(G=>e.jsx(_e,{value:G,children:G},G))]})]}),e.jsxs(wt,{value:m,onValueChange:x,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-all-apps-location-filter",children:e.jsx(St,{placeholder:"Filter by location"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All Locations"}),L.map(G=>e.jsx(_e,{value:G,children:G},G))]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(se,{variant:n==="grid"?"default":"outline",size:"sm",onClick:()=>r("grid"),className:n==="grid"?"bg-amber-600 hover:bg-amber-700":"","data-testid":"onboarding-all-apps-grid-view-btn",children:[e.jsx($2,{className:"w-4 h-4 mr-2"}),"Grid"]}),e.jsxs(se,{variant:n==="table"?"default":"outline",size:"sm",onClick:()=>r("table"),className:n==="table"?"bg-amber-600 hover:bg-amber-700":"","data-testid":"onboarding-all-apps-table-view-btn",children:[e.jsx(U2,{className:"w-4 h-4 mr-2"}),"Table"]})]}),e.jsxs(se,{variant:"outline",size:"sm","data-testid":"onboarding-all-apps-export-btn",children:[e.jsx(Ni,{className:"w-4 h-4 mr-2"}),"Export"]}),g.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{variant:"outline",size:"sm",onClick:D,"data-testid":"onboarding-all-apps-reminders-btn",children:[e.jsx(qr,{className:"w-4 h-4 mr-2"}),"Send Reminders (",g.length,")"]}),e.jsxs(se,{size:"sm",onClick:F,className:"bg-green-600 hover:bg-green-700","data-testid":"onboarding-all-apps-shortlist-btn",children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"}),"Shortlist (",g.length,")"]})]}),e.jsx("div",{className:"ml-auto",children:e.jsxs(Ae,{variant:"outline",className:"text-slate-600","data-testid":"onboarding-all-apps-pending-badge",children:[(P==null?void 0:P.total)||Z.length," pending shortlisting"]})})]})]})}),w?e.jsx("div",{className:"flex justify-center items-center h-96 bg-white rounded-lg border border-slate-200",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-amber-600"})}):n==="grid"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4","data-testid":"onboarding-all-apps-grid-container",children:Z.map((G,Y)=>e.jsxs("div",{className:"relative","data-testid":`onboarding-all-apps-grid-item-${Y}`,children:[e.jsx("div",{className:"absolute top-4 left-4 z-10",children:e.jsx(Rn,{checked:g.includes(G.id),onCheckedChange:V=>U(G.id,V),className:"bg-white","data-testid":`onboarding-all-apps-grid-checkbox-${Y}`})}),G.isShortlisted&&e.jsx("div",{className:"absolute top-4 right-4 z-10",children:e.jsx(Ae,{className:"bg-green-600","data-testid":`onboarding-all-apps-grid-shortlisted-badge-${Y}`,children:"Shortlisted"})}),e.jsx(mE,{application:G,onViewDetails:t})]},G.id))}):e.jsx("div",{className:"bg-white rounded-lg border border-slate-200",children:e.jsxs(ks,{"data-testid":"onboarding-all-apps-table",children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{className:"w-12",children:e.jsx(Rn,{checked:g.length===Z.length&&Z.length>0,onCheckedChange:W,"data-testid":"onboarding-all-apps-header-checkbox"})}),e.jsx(me,{children:"Registration"}),e.jsx(me,{children:"Name"}),e.jsx(me,{children:"Location"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Shortlisted"}),e.jsx(me,{children:"Progress"}),e.jsx(me,{children:"Submitted"})]})}),e.jsx(Es,{children:Z.map((G,Y)=>e.jsxs(ct,{className:"cursor-pointer hover:bg-slate-50",onClick:()=>t(G.id),"data-testid":`onboarding-all-apps-row-${Y}`,children:[e.jsx(de,{onClick:V=>V.stopPropagation(),children:e.jsx(Rn,{checked:g.includes(G.id),onCheckedChange:V=>U(G.id,V),"data-testid":`onboarding-all-apps-checkbox-${Y}`})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-900","data-testid":`onboarding-all-apps-reg-id-${Y}`,children:G.registrationNumber})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-900","data-testid":`onboarding-all-apps-name-${Y}`,children:G.name})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-600","data-testid":`onboarding-all-apps-location-${Y}`,children:G.preferredLocation})}),e.jsx(de,{children:e.jsx(Ae,{className:z(G.status),"data-testid":`onboarding-all-apps-status-${Y}`,children:G.status})}),e.jsx(de,{children:G.isShortlisted?e.jsx(Ae,{className:"bg-green-600","data-testid":`onboarding-all-apps-shortlisted-yes-${Y}`,children:"Yes"}):e.jsx(Ae,{variant:"outline","data-testid":`onboarding-all-apps-shortlisted-no-${Y}`,children:"No"})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ji,{value:G.progress,className:"w-20","data-testid":`onboarding-all-apps-progress-bar-${Y}`}),e.jsxs("span",{className:"text-slate-600","data-testid":`onboarding-all-apps-progress-text-${Y}`,children:[G.progress,"%"]})]})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-600","data-testid":`onboarding-all-apps-date-${Y}`,children:Ht(G.submissionDate)})})]},G.id))})]})}),P&&P.totalPages>1&&e.jsx("div",{className:"py-6 border-t border-slate-200 bg-white rounded-b-lg",children:e.jsx(Yl,{children:e.jsxs(Zl,{children:[e.jsx(an,{children:e.jsx(Ql,{onClick:()=>R(G=>Math.max(1,G-1)),className:_===1?"pointer-events-none opacity-50":"cursor-pointer"})}),[...Array(P.totalPages)].map((G,Y)=>{const V=Y+1;return V===1||V===P.totalPages||V>=_-1&&V<=_+1?e.jsx(an,{children:e.jsx(Ci,{isActive:_===V,onClick:()=>R(V),className:"cursor-pointer",children:V})},V):V===_-2||V===_+2?e.jsx(an,{children:e.jsx(Jl,{})},V):null}),e.jsx(an,{children:e.jsx(Xl,{onClick:()=>R(G=>Math.min(P.totalPages,G+1)),className:_===P.totalPages?"pointer-events-none opacity-50":"cursor-pointer"})})]})})}),e.jsx(os,{open:j,onOpenChange:p,children:e.jsxs(ls,{"data-testid":"onboarding-all-apps-shortlist-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{"data-testid":"onboarding-all-apps-shortlist-title",children:"Shortlist Applications"}),e.jsxs(vs,{"data-testid":"onboarding-all-apps-shortlist-desc",children:["You are about to shortlist ",g.length," application(s). These applications will be moved to the Dealership Requests page."]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{htmlFor:"shortlist-remark",children:"Shortlisting Remark (Optional)"}),e.jsx(Fs,{id:"shortlist-remark",placeholder:"Enter reason for shortlisting these applications...",value:y,onChange:G=>N(G.target.value),className:"mt-2",rows:4,"data-testid":"onboarding-all-apps-shortlist-remark"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>p(!1),"data-testid":"onboarding-all-apps-shortlist-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-green-600 hover:bg-green-700",onClick:B,"data-testid":"onboarding-all-apps-shortlist-confirm",children:"Confirm Shortlist"})]})]})]})})]})}function $7({onViewDetails:t}){const[s,n]=v.useState("table"),[r,a]=v.useState(""),[l,c]=v.useState("all"),[d,m]=v.useState("all"),[x,f]=v.useState("all"),[h,g]=v.useState(""),[u,j]=v.useState(""),[p,y]=v.useState("date-desc"),[N,S]=v.useState(1),[A,w]=v.useState(null),[E,T]=v.useState([]),[C,L]=v.useState(!1),[$,_]=v.useState(""),[R,P]=v.useState([]),[M,q]=v.useState([]),[K,Z]=v.useState([]),[W,U]=v.useState(!0);v.useEffect(()=>{B()},[h,u,l,r,N,d,x]),v.useEffect(()=>{S(1)},[h,u,l,r,d,x]),v.useEffect(()=>{F()},[]);const F=async()=>{try{const re=await Ss.getStates(),ve=(Array.isArray(re)?re:(re==null?void 0:re.data)||(re==null?void 0:re.states)||[]).map(Se=>typeof Se=="string"?Se:Se.name||Se.stateName).filter(Boolean);P(ve)}catch(re){console.error("Failed to fetch states:",re)}},B=async()=>{try{U(!0);const re=["Questionnaire Pending","Questionnaire Completed","Shortlisted"],ge=await ds.getApplications({fromDate:h,toDate:u,status:l==="all"?re.join(","):l,location:d!=="all"?d:void 0,state:x!=="all"?x:void 0,ddLeadShortlisted:"false",isShortlisted:"true",search:r,page:N,limit:10}),ve=ge.data||[];w(ge.meta);const Se=ve.map(Ce=>({id:Ce.id,registrationNumber:Ce.applicationId||"N/A",name:Ce.applicantName,email:Ce.email,phone:Ce.phone,age:Ce.age,education:Ce.education,residentialAddress:Ce.address||Ce.city||"",businessAddress:Ce.address||"",preferredLocation:Ce.preferredLocation,state:Ce.state,ownsBike:Ce.ownRoyalEnfield==="yes",pastExperience:Ce.experienceYears?`${Ce.experienceYears} years`:Ce.description||"",status:Ce.overallStatus,questionnaireMarks:Ce.score||Ce.questionnaireMarks||0,rank:0,totalApplicantsAtLocation:0,submissionDate:Ce.createdAt,assignedUsers:[],progress:Ce.progressPercentage||0,isShortlisted:Ce.isShortlisted,ddLeadShortlisted:Ce.ddLeadShortlisted,companyName:Ce.companyName,source:Ce.source,existingDealer:Ce.existingDealer,royalEnfieldModel:Ce.royalEnfieldModel,description:Ce.description,pincode:Ce.pincode,locationType:Ce.locationType,ownRoyalEnfield:Ce.ownRoyalEnfield,address:Ce.address}));Z(Se);const We=Array.from(new Set(Se.map(Ce=>Ce.preferredLocation))).filter(Boolean);q(We)}catch(re){console.error("Failed to fetch applications:",re),ee.error("Failed to load opportunity requests")}finally{U(!1)}},D=K.sort((re,ge)=>p==="score-desc"?(ge.questionnaireMarks||0)-(re.questionnaireMarks||0):p==="score-asc"?(re.questionnaireMarks||0)-(ge.questionnaireMarks||0):p==="date-desc"?new Date(ge.submissionDate).getTime()-new Date(re.submissionDate).getTime():p==="date-asc"?new Date(re.submissionDate).getTime()-new Date(ge.submissionDate).getTime():0),O=re=>{T(re?D.map(ge=>ge.id):[])},z=(re,ge)=>{T(ge?[...E,re]:E.filter(ve=>ve!==re))},G=()=>{if(E.length===0){ee.error("Please select at least one application to shortlist");return}L(!0)},Y=async()=>{try{const re=await ds.shortlistApplications(E,[],$);if(re&&re.success)await B(),T([]),L(!1),_(""),ee.success(`${E.length} application(s) shortlisted successfully. Users will be assigned automatically.`);else throw new Error((re==null?void 0:re.message)||"Failed to process shortlisting")}catch(re){console.error("Failed to shortlist applications:",re),ee.error(re.message||"Failed to process shortlisting")}},V=()=>{if(E.length===0){ee.error("Please select at least one application");return}ee.success(`Reminder emails sent to ${E.length} applicant(s)`)},X=async()=>{const re=D.filter(Se=>Se.status!=="Questionnaire Pending"),ge=re.filter(Se=>E.includes(Se.id));let ve=[];if(E.length>0){if(ge.length===0){ee.error('Selected applications are in "Questionnaire Pending" status and cannot be exported.');return}ve=ge.map(Se=>Se.id),ge.lengthSe.id);if(ve.length===0){ee.error("No applications with completed questionnaires available for export");return}try{const Se=ee.loading("Preparing Excel export..."),We=await ds.exportResponses(ve);if(ee.dismiss(Se),!We||We.length===0){ee.error("No response data found");return}const Ce=Object.keys(We[0]),Ye=[Ce.join(","),...We.map(qe=>Ce.map(Ve=>{const dt=qe[Ve]??"";return`"${String(dt).replace(/"/g,'""')}"`}).join(","))].join(` +`),be=new Blob([Ye],{type:"text/csv;charset=utf-8;"}),Pe=URL.createObjectURL(be),ke=document.createElement("a");ke.setAttribute("href",Pe),ke.setAttribute("download",`onboarding_responses_${new Date().toISOString().split("T")[0]}.xlsx`),document.body.appendChild(ke),ke.click(),document.body.removeChild(ke),ee.success(`Exported ${ve.length} records to Excel successfully`)}catch(Se){console.error("Export failed:",Se),ee.error(Se.message||"Failed to export responses")}},ne=["Questionnaire Pending","Questionnaire Completed","Shortlisted"],oe=re=>({Submitted:"bg-blue-100 text-blue-800","Questionnaire Pending":"bg-yellow-100 text-yellow-800","Questionnaire Completed":"bg-cyan-100 text-cyan-800",Shortlisted:"bg-purple-100 text-purple-800","Level 1 Interview Pending":"bg-orange-100 text-orange-800","Level 1 Approved":"bg-green-100 text-green-800","Level 2 Interview Pending":"bg-orange-100 text-orange-800","Level 2 Approved":"bg-green-100 text-green-800","Level 2 Recommended":"bg-teal-100 text-teal-800","Level 3 Interview Pending":"bg-orange-100 text-orange-800","FDD Verification":"bg-indigo-100 text-indigo-800","Payment Pending":"bg-amber-100 text-amber-800","LOI Issued":"bg-sky-100 text-sky-800","Dealer Code Generation":"bg-purple-100 text-purple-800","Architecture Team Assigned":"bg-blue-100 text-blue-800","Architecture Document Upload":"bg-blue-100 text-blue-800","Architecture Team Completion":"bg-blue-100 text-blue-800","Statutory GST":"bg-emerald-100 text-emerald-800","Statutory PAN":"bg-emerald-100 text-emerald-800","Statutory Nodal":"bg-emerald-100 text-emerald-800","Statutory Check":"bg-emerald-100 text-emerald-800","Statutory Partnership":"bg-emerald-100 text-emerald-800","Statutory Firm Reg":"bg-emerald-100 text-emerald-800","Statutory Rental":"bg-emerald-100 text-emerald-800","Statutory Virtual Code":"bg-emerald-100 text-emerald-800","Statutory Domain":"bg-emerald-100 text-emerald-800","Statutory MSD":"bg-emerald-100 text-emerald-800","Statutory LOI Ack":"bg-emerald-100 text-emerald-800","EOR In Progress":"bg-violet-100 text-violet-800","LOA Pending":"bg-pink-100 text-pink-800",Inauguration:"bg-green-100 text-green-800",Approved:"bg-green-100 text-green-800",Rejected:"bg-red-100 text-red-800",Disqualified:"bg-gray-100 text-gray-800","In Review":"bg-slate-100 text-slate-800","Level 3 Approved":"bg-green-100 text-green-800","LOI In Progress":"bg-sky-50 text-sky-700","LOI Approved":"bg-green-100 text-green-800","Security Details In Progress":"bg-blue-50 text-blue-700","Security Details Approved":"bg-green-100 text-green-800","Security Details":"bg-blue-100 text-blue-800","LOI Issued In Progress":"bg-sky-50 text-sky-700","Statutory Work In Progress":"bg-emerald-50 text-emerald-700","Statutory Work Completed":"bg-green-100 text-green-800","Architecture Work In Progress":"bg-blue-50 text-blue-700","Architecture Work Completed":"bg-green-100 text-green-800","Dealer Code Generation In Progress":"bg-purple-50 text-purple-700","Dealer Code Generated":"bg-green-100 text-green-800","LOA Issued":"bg-pink-100 text-pink-800","EOR Complete":"bg-violet-100 text-violet-800",Onboarded:"bg-green-200 text-green-900"})[re]||"bg-gray-100 text-gray-800";return W?e.jsx("div",{className:"flex justify-center items-center h-96",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-amber-600"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4","data-testid":"onboarding-opp-requests-banner",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Gs,{className:"w-5 h-5 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-amber-900 mb-1",children:"DD Lead Workflow - Opportunity Requests"}),e.jsxs("p",{className:"text-amber-800",children:["This page shows ",e.jsx("strong",{children:"applications where dealerships are being offered"})," at the applicant's preferred location. These have been shortlisted by DD and are waiting for your review. Select and ",e.jsx("strong",{children:"Shortlist"})," promising candidates to move them to the ",e.jsx("strong",{children:"Dealership Requests"})," page for further processing."]})]})]})}),e.jsx("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ot,{type:"text",placeholder:"Search by name or registration number...",value:r,onChange:re=>a(re.target.value),className:"pl-10","data-testid":"onboarding-opp-requests-search-input"})]}),e.jsxs(wt,{value:l,onValueChange:c,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-opp-requests-status-select",children:e.jsx(St,{placeholder:"Filter by status"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All Statuses"}),ne.map(re=>e.jsx(_e,{value:re,children:re},re))]})]}),e.jsxs(wt,{value:x,onValueChange:f,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-opp-requests-state-select",children:e.jsx(St,{placeholder:"Filter by state"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All States"}),R.map(re=>e.jsx(_e,{value:re,children:re},re))]})]}),e.jsxs(wt,{value:d,onValueChange:m,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-opp-requests-location-select",children:e.jsx(St,{placeholder:"Filter by location"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All Locations"}),M.map(re=>e.jsx(_e,{value:re,children:re},re))]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-1 md:flex-none",children:[e.jsxs("div",{className:"relative w-full md:w-40",children:[e.jsx($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"}),e.jsx(ot,{type:"date",value:h,onChange:re=>g(re.target.value),className:"pl-10 text-xs",placeholder:"From","data-testid":"onboarding-opp-requests-from-date"})]}),e.jsx("span",{className:"text-slate-400",children:"to"}),e.jsxs("div",{className:"relative w-full md:w-40",children:[e.jsx($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"}),e.jsx(ot,{type:"date",value:u,onChange:re=>j(re.target.value),className:"pl-10 text-xs",placeholder:"To","data-testid":"onboarding-opp-requests-to-date"})]})]}),e.jsxs(wt,{value:p,onValueChange:y,children:[e.jsx(Ct,{className:"w-full md:w-48","data-testid":"onboarding-opp-requests-sort-select",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q5,{className:"w-4 h-4 text-slate-400"}),e.jsx(St,{placeholder:"Sort by"})]})}),e.jsxs(At,{children:[e.jsx(_e,{value:"date-desc",children:"Newest Applied"}),e.jsx(_e,{value:"date-asc",children:"Oldest Applied"}),e.jsx(_e,{value:"score-desc",children:"Highest Score"}),e.jsx(_e,{value:"score-asc",children:"Lowest Score"})]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(se,{variant:s==="grid"?"default":"outline",size:"sm",onClick:()=>n("grid"),className:s==="grid"?"bg-amber-600 hover:bg-amber-700":"","data-testid":"onboarding-opp-requests-view-grid-btn",children:[e.jsx($2,{className:"w-4 h-4 mr-2"}),"Grid"]}),e.jsxs(se,{variant:s==="table"?"default":"outline",size:"sm",onClick:()=>n("table"),className:s==="table"?"bg-amber-600 hover:bg-amber-700":"","data-testid":"onboarding-opp-requests-view-table-btn",children:[e.jsx(U2,{className:"w-4 h-4 mr-2"}),"Table"]})]}),e.jsxs(se,{variant:"outline",size:"sm",onClick:X,"data-testid":"onboarding-opp-requests-export-btn",children:[e.jsx(Ni,{className:"w-4 h-4 mr-2"}),"Export"]}),E.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{variant:"outline",size:"sm",onClick:V,"data-testid":"onboarding-opp-requests-bulk-reminder-btn",children:[e.jsx(qr,{className:"w-4 h-4 mr-2"}),"Send Reminders (",E.length,")"]}),e.jsxs(se,{size:"sm",onClick:G,className:"bg-green-600 hover:bg-green-700","data-testid":"onboarding-opp-requests-bulk-shortlist-btn",children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"}),"Shortlist (",E.length,")"]})]}),e.jsx("div",{className:"ml-auto",children:e.jsxs(Ae,{variant:"outline",className:"text-slate-600","data-testid":"onboarding-opp-requests-pending-count",children:[(A==null?void 0:A.total)||D.length," pending shortlisting"]})})]})]})}),s==="grid"?e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4","data-testid":"onboarding-opp-requests-grid",children:[D.map((re,ge)=>e.jsxs("div",{className:"relative","data-testid":`onboarding-opp-requests-grid-item-${ge}`,children:[e.jsx("div",{className:"absolute top-4 left-4 z-10",children:e.jsx(Rn,{checked:E.includes(re.id),onCheckedChange:ve=>z(re.id,ve),className:"bg-white","data-testid":`onboarding-opp-requests-grid-checkbox-${ge}`})}),e.jsx(mE,{application:re,onViewDetails:t})]},re.id)),D.length===0&&e.jsxs("div",{className:"col-span-full text-center py-12 text-slate-500 bg-white rounded-lg border border-slate-200","data-testid":"onboarding-opp-requests-grid-empty",children:[e.jsx(Ys,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{className:"text-lg mb-2",children:"No opportunity requests found"}),e.jsx("p",{className:"text-sm",children:"Try adjusting your filters"})]})]}):e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200","data-testid":"onboarding-opp-requests-table-container",children:[e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{className:"w-12",children:e.jsx(Rn,{checked:E.length===D.length&&D.length>0,onCheckedChange:O,"data-testid":"onboarding-opp-requests-table-select-all"})}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-reg",children:"Registration"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-name",children:"Name"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-pref-loc",children:"Preferred Location"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-status",children:"Status"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-score",children:"Score"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-app-loc",children:"Applicant Location"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-shortlisted",children:"Shortlisted"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-progress",children:"Progress"}),e.jsx(me,{"data-testid":"onboarding-opp-requests-th-date",children:"Applied On"})]})}),e.jsxs(Es,{children:[D.map((re,ge)=>e.jsxs(ct,{className:"cursor-pointer hover:bg-slate-50",onClick:()=>t(re.id),"data-testid":`onboarding-opp-requests-row-${ge}`,children:[e.jsx(de,{onClick:ve=>ve.stopPropagation(),children:e.jsx(Rn,{checked:E.includes(re.id),onCheckedChange:ve=>z(re.id,ve),"data-testid":`onboarding-opp-requests-table-select-item-${re.id}`})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-900","data-testid":`onboarding-opp-requests-reg-${ge}`,children:re.registrationNumber})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-900","data-testid":`onboarding-opp-requests-name-${ge}`,children:re.name})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-600","data-testid":`onboarding-opp-requests-pref-loc-${ge}`,children:re.preferredLocation})}),e.jsx(de,{children:e.jsx(Ae,{className:oe(re.status),"data-testid":`onboarding-opp-requests-status-${ge}`,children:re.status})}),e.jsx(de,{children:e.jsx("span",{className:"font-semibold text-slate-900","data-testid":`onboarding-opp-requests-score-${ge}`,children:re.questionnaireMarks})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-600","data-testid":`onboarding-opp-requests-app-loc-${ge}`,children:re.businessAddress})}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline","data-testid":`onboarding-opp-requests-shortlisted-badge-${ge}`,children:"No"})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2","data-testid":`onboarding-opp-requests-progress-container-${ge}`,children:[e.jsx(ji,{value:re.progress,className:"w-20"}),e.jsxs("span",{className:"text-slate-600",children:[re.progress,"%"]})]})}),e.jsx(de,{children:e.jsx("span",{className:"text-slate-600","data-testid":`onboarding-opp-requests-date-${ge}`,children:Ht(re.submissionDate)})})]},re.id)),D.length===0&&e.jsx(ct,{children:e.jsxs(de,{colSpan:9,className:"text-center py-12 text-slate-500","data-testid":"onboarding-opp-requests-table-empty",children:[e.jsx(Ys,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{className:"text-lg mb-2",children:"No opportunity requests found"}),e.jsx("p",{className:"text-sm",children:"Try adjusting your filters"})]})})]})]}),A&&A.totalPages>1&&e.jsx("div",{className:"py-4 border-t border-slate-200",children:e.jsx(Yl,{children:e.jsxs(Zl,{children:[e.jsx(an,{children:e.jsx(Ql,{onClick:()=>S(re=>Math.max(1,re-1)),className:N===1?"pointer-events-none opacity-50":"cursor-pointer"})}),[...Array(A.totalPages)].map((re,ge)=>{const ve=ge+1;return ve===1||ve===A.totalPages||ve>=N-1&&ve<=N+1?e.jsx(an,{children:e.jsx(Ci,{isActive:N===ve,onClick:()=>S(ve),className:"cursor-pointer",children:ve})},ve):ve===N-2||ve===N+2?e.jsx(an,{children:e.jsx(Jl,{})},ve):null}),e.jsx(an,{children:e.jsx(Xl,{onClick:()=>S(re=>Math.min(A.totalPages,re+1)),className:N===A.totalPages?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]}),e.jsx(os,{open:C,onOpenChange:L,children:e.jsxs(ls,{className:"overflow-visible","data-testid":"onboarding-opp-requests-shortlist-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{"data-testid":"onboarding-opp-requests-shortlist-modal-title",children:"Shortlist Applications"}),e.jsxs(vs,{children:["You are about to shortlist ",E.length," application(s). These applications will be moved to the Dealership Requests page and users will be assigned automatically based on the applied location."]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Shortlisting Remark (Optional)"}),e.jsx(Fs,{placeholder:"Enter reason for shortlisting these applications...",value:$,onChange:re=>_(re.target.value),className:"mt-2",rows:4,"data-testid":"onboarding-opp-requests-remark-textarea"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>{L(!1),_("")},"data-testid":"onboarding-opp-requests-shortlist-cancel-btn",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-green-600 hover:bg-green-700",onClick:Y,"data-testid":"onboarding-opp-requests-shortlist-confirm-btn",children:"Confirm Shortlist"})]})]})]})})]})}function q7({onViewDetails:t}){var W,U;const[s,n]=v.useState(""),[r,a]=v.useState("all"),[l,c]=v.useState("all"),[d,m]=v.useState(""),[x,f]=v.useState(""),[h,g]=v.useState(1),[u,j]=v.useState(null),[p,y]=v.useState([]),[N,S]=v.useState(!0),[A,w]=v.useState([]),[E,T]=v.useState([]),[C,L]=v.useState([]),[$,_]=v.useState(!1),R=async()=>{var F,B,D,O;if(C.length!==0)try{_(!0);const z=await ds.bulkConvertToOpportunity({ids:C});z!=null&&z.success&&((((F=z.data)==null?void 0:F.success)>0||!z.data)&&ee.success(z.message||`Successfully converted ${((B=z.data)==null?void 0:B.success)||C.length} leads.`),((D=z.data)==null?void 0:D.failed)>0&&((O=z.data)!=null&&O.errors)&&z.data.errors.forEach(G=>{ee.error(G,{duration:5e3})}),L([]),await K())}catch(z){console.error("Bulk conversion error:",z),ee.error(z.message||"Failed to perform bulk conversion")}finally{_(!1)}},P=()=>{C.length===Z.length?L([]):L(Z.map(F=>F.id))},M=F=>{L(B=>B.includes(F)?B.filter(D=>D!==F):[...B,F])};v.useEffect(()=>{K()},[d,x,s,h,r,l]),v.useEffect(()=>{g(1)},[d,x,s,r,l]),v.useEffect(()=>{q()},[]);const q=async()=>{try{const F=await Ss.getStates(),D=(Array.isArray(F)?F:(F==null?void 0:F.data)||(F==null?void 0:F.states)||[]).map(O=>typeof O=="string"?O:O.name||O.stateName).filter(Boolean);w(D)}catch(F){console.error("Failed to fetch states:",F)}},K=async()=>{try{S(!0);const F=await ds.getApplications({fromDate:d,toDate:x,search:s,status:"Submitted",isShortlisted:"false",location:r!=="all"?r:void 0,state:l!=="all"?l:void 0,page:h,limit:10}),B=F.data||[];j(F.meta);const D=B.map(z=>({id:z.id,registrationNumber:z.applicationId||"N/A",name:z.applicantName,email:z.email,phone:z.phone,age:z.age,education:z.education,residentialAddress:z.address||z.city||"",businessAddress:z.address||"",preferredLocation:z.preferredLocation,state:z.state,ownsBike:z.ownRoyalEnfield==="yes",pastExperience:z.experienceYears?`${z.experienceYears} years`:z.description||"",status:z.overallStatus,questionnaireMarks:z.score||z.questionnaireMarks||0,rank:0,totalApplicantsAtLocation:0,submissionDate:z.createdAt,assignedUsers:[],progress:z.progressPercentage||0,isShortlisted:z.isShortlisted,companyName:z.companyName,source:z.source,existingDealer:z.existingDealer,royalEnfieldModel:z.royalEnfieldModel,description:z.description,pincode:z.pincode,locationType:z.locationType,ownRoyalEnfield:z.ownRoyalEnfield,address:z.address}));y(D);const O=Array.from(new Set(D.map(z=>z.preferredLocation))).filter(Boolean);T(O)}catch(F){console.error("Failed to fetch applications:",F),ee.error("Failed to load non-opportunity requests")}finally{S(!1)}},Z=p;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl mb-2",children:"Non-opportunities (Lead Generation)"}),e.jsx("p",{className:"text-slate-600",children:"Interest submissions from regions where dealerships are currently not being offered. These leads received non-opportunity notification and are stored for future reference."})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx("div",{className:"bg-white rounded-lg border border-slate-200 p-4","data-testid":"onboarding-non-opps-stat-total",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Total Leads"}),e.jsx("p",{className:"text-2xl text-slate-900 mt-1",children:(u==null?void 0:u.total)||p.length})]}),e.jsx("div",{className:"p-3 bg-blue-100 rounded-lg",children:e.jsx(nv,{className:"w-6 h-6 text-blue-600"})})]})}),e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-4","data-testid":"onboarding-non-opps-stat-locations",children:[e.jsx("p",{className:"text-slate-600",children:"Unique Locations"}),e.jsx("p",{className:"text-2xl text-slate-900 mt-1",children:((W=u==null?void 0:u.stats)==null?void 0:W.uniqueLocations)||0})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-4","data-testid":"onboarding-non-opps-stat-exp",children:[e.jsx("p",{className:"text-slate-600",children:"With Experience"}),e.jsx("p",{className:"text-2xl text-amber-600 mt-1",children:((U=u==null?void 0:u.stats)==null?void 0:U.withExperience)||0})]})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Ra,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(ot,{type:"text",placeholder:"Search by name, email, phone, or registration number...",value:s,onChange:F=>n(F.target.value),className:"pl-10","data-testid":"onboarding-non-opps-search-input"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative w-full md:w-36",children:[e.jsx($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"}),e.jsx(ot,{type:"date",value:d,onChange:F=>m(F.target.value),className:"pl-10 text-xs",placeholder:"From","data-testid":"onboarding-non-opps-from-date"})]}),e.jsx("span",{className:"text-slate-400",children:"to"}),e.jsxs("div",{className:"relative w-full md:w-36",children:[e.jsx($n,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"}),e.jsx(ot,{type:"date",value:x,onChange:F=>f(F.target.value),className:"pl-10 text-xs",placeholder:"To","data-testid":"onboarding-non-opps-to-date"})]})]}),e.jsxs(wt,{value:r,onValueChange:a,children:[e.jsx(Ct,{className:"w-full lg:w-48","data-testid":"onboarding-non-opps-location-select",children:e.jsx(St,{placeholder:"All Locations"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All Locations"}),E.map(F=>e.jsx(_e,{value:F,children:F},F))]})]}),e.jsxs(wt,{value:l,onValueChange:c,children:[e.jsx(Ct,{className:"w-full lg:w-48","data-testid":"onboarding-non-opps-state-select",children:e.jsx(St,{placeholder:"All States"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All States"}),A.map(F=>e.jsx(_e,{value:F,children:F},F))]})]}),e.jsx(se,{variant:"outline",size:"icon","data-testid":"onboarding-non-opps-export-btn",children:e.jsx(Ni,{className:"w-4 h-4"})}),C.length>0&&e.jsxs(se,{className:"bg-amber-600 hover:bg-amber-700 font-bold",onClick:R,disabled:$,children:[$?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(J5,{className:"w-4 h-4 mr-2"}),"Convert ",C.length," to Opportunity"]})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 overflow-hidden","data-testid":"onboarding-non-opps-table-container",children:[e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{className:"w-12",children:e.jsx(Rn,{checked:Z.length>0&&C.length===Z.length,onCheckedChange:P})}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-name",children:"Name"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-phone",children:"Phone"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-email",children:"Email"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-loc",children:"Preferred Location"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-address",children:"Main Address"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-age",children:"Age"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-exp",children:"Experience"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-edu",children:"Education"}),e.jsx(me,{"data-testid":"onboarding-non-opps-th-date",children:"Applied On"}),e.jsx(me,{className:"text-right","data-testid":"onboarding-non-opps-th-actions",children:"Actions"})]})}),e.jsx(Es,{children:N?e.jsx(ct,{children:e.jsxs(de,{colSpan:11,className:"text-center py-20",children:[e.jsx(ss,{className:"w-8 h-8 mx-auto animate-spin text-amber-600 mb-2"}),e.jsx("p",{className:"text-slate-500 text-sm",children:"Loading applications..."})]})}):Z.length===0?e.jsx(ct,{children:e.jsxs(de,{colSpan:11,className:"text-center py-12 text-slate-500","data-testid":"onboarding-non-opps-empty-state",children:[e.jsx(nv,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{className:"text-lg mb-2",children:"No lead generation data found"}),e.jsx("p",{className:"text-sm",children:"Try adjusting your filters"})]})}):Z.map((F,B)=>e.jsxs(ct,{"data-testid":`onboarding-non-opps-row-${B}`,className:C.includes(F.id)?"bg-amber-50/50":"",children:[e.jsx(de,{children:e.jsx(Rn,{checked:C.includes(F.id),onCheckedChange:()=>M(F.id)})}),e.jsx(de,{children:e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900","data-testid":`onboarding-non-opps-name-${B}`,children:F.name}),e.jsx("p",{className:"text-slate-500 text-sm","data-testid":`onboarding-non-opps-id-${B}`,children:F.registrationNumber})]})}),e.jsx(de,{className:"text-slate-900","data-testid":`onboarding-non-opps-phone-${B}`,children:F.phone}),e.jsx(de,{className:"text-slate-600","data-testid":`onboarding-non-opps-email-${B}`,children:F.email}),e.jsx(de,{children:e.jsxs("div",{"data-testid":`onboarding-non-opps-pref-loc-${B}`,children:[e.jsx("p",{className:"text-slate-900",children:F.preferredLocation}),e.jsx("p",{className:"text-slate-500 text-sm",children:F.state})]})}),e.jsx(de,{className:"text-slate-600 max-w-xs truncate","data-testid":`onboarding-non-opps-address-${B}`,children:F.residentialAddress}),e.jsx(de,{className:"text-slate-900","data-testid":`onboarding-non-opps-age-${B}`,children:F.age}),e.jsx(de,{className:"text-slate-600","data-testid":`onboarding-non-opps-experience-${B}`,children:F.pastExperience}),e.jsx(de,{className:"text-slate-900","data-testid":`onboarding-non-opps-education-${B}`,children:F.education}),e.jsx(de,{className:"text-slate-600","data-testid":`onboarding-non-opps-date-${B}`,children:Ht(F.submissionDate)}),e.jsx(de,{className:"text-right",children:e.jsx("div",{className:"flex justify-end gap-2",children:e.jsx(se,{variant:"outline",size:"sm",onClick:()=>t(F.id),"data-testid":`onboarding-non-opps-view-btn-${B}`,children:"View"})})})]},F.id))})]}),u&&u.totalPages>1&&e.jsx("div",{className:"py-4 border-t border-slate-200",children:e.jsx(Yl,{children:e.jsxs(Zl,{children:[e.jsx(an,{children:e.jsx(Ql,{onClick:()=>g(F=>Math.max(1,F-1)),className:h===1?"pointer-events-none opacity-50":"cursor-pointer"})}),[...Array(u.totalPages)].map((F,B)=>{const D=B+1;return D===1||D===u.totalPages||D>=h-1&&D<=h+1?e.jsx(an,{children:e.jsx(Ci,{isActive:h===D,onClick:()=>g(D),className:"cursor-pointer",children:D})},D):D===h-2||D===h+2?e.jsx(an,{children:e.jsx(Jl,{})},D):null}),e.jsx(an,{children:e.jsx(Xl,{onClick:()=>g(F=>Math.min(u.totalPages,F+1)),className:h===u.totalPages?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]})]})}function z7({application:t,isNonResponsive:s,isAdmin:n,onBack:r,onOpenWorknotes:a}){return e.jsxs(e.Fragment,{children:[s&&e.jsxs("div",{className:"bg-red-50 border border-red-200 p-4 rounded-2xl flex items-center justify-between animate-in fade-in slide-in-from-top-4 duration-500","data-testid":"onboarding-details-non-responsive-banner",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"bg-red-100 p-2 rounded-xl",children:e.jsx(tb,{className:"w-6 h-6 text-red-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-black text-red-900 tracking-tight leading-none uppercase",children:"Applicant Flagged Non-Responsive"}),e.jsx("p",{className:"text-red-700 text-[11px] font-bold uppercase tracking-widest mt-1 opacity-80",children:"Audit process is currently on hold due to missing cooperation"})]})]}),n&&e.jsx(se,{variant:"outline",size:"sm",className:"bg-white border-red-200 text-red-600 hover:bg-red-50 font-black text-[10px] uppercase tracking-widest hidden sm:block h-9","data-testid":"onboarding-details-review-audit-button",onClick:()=>{const l=document.querySelector('[value="worknotes"]');l==null||l.click()},children:"Review Audit"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"outline",size:"icon",onClick:r,className:"shrink-0","data-testid":"onboarding-details-back-button",children:e.jsx($r,{className:"w-4 h-4"})}),e.jsxs("div",{className:"truncate",children:[e.jsx("h1",{className:"text-slate-900 truncate leading-tight","data-testid":"onboarding-details-application-name",children:t.name}),e.jsx("p",{className:"text-slate-600 truncate text-sm","data-testid":"onboarding-details-registration-number",children:t.registrationNumber})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:e.jsxs(se,{variant:"outline",className:"relative hover:bg-amber-50 hover:border-amber-300 hover:text-amber-700 transition-all shadow-sm",onClick:a,"data-testid":"onboarding-details-view-work-notes",children:[e.jsx(zr,{className:"w-4 h-4 mr-2"}),"View Work Notes"]})})]})]})}var U7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V7=U7.reduce((t,s)=>{const n=hu(`Primitive.${s}`),r=v.forwardRef((a,l)=>{const{asChild:c,...d}=a,m=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(m,{...d,ref:l})});return r.displayName=`Primitive.${s}`,{...t,[s]:r}},{}),H7="Separator",d1="horizontal",W7=["horizontal","vertical"],fE=v.forwardRef((t,s)=>{const{decorative:n,orientation:r=d1,...a}=t,l=K7(r)?r:d1,d=n?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return e.jsx(V7.div,{"data-orientation":l,...d,...a,ref:s})});fE.displayName=H7;function K7(t){return W7.includes(t)}var G7=fE;function zd({className:t,orientation:s="horizontal",decorative:n=!0,...r}){return e.jsx(G7,{"data-slot":"separator-root",decorative:n,orientation:s,className:_t("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}function Y7({application:t,canEditStatutory:s,isEditingStatutory:n,isSavingStatutory:r,statutoryForm:a,onEditFirmType:l,onEditStatutory:c,onCancelEditStatutory:d,onSaveStatutory:m,onStatutoryFormChange:x}){return e.jsxs(Ie,{"data-testid":"onboarding-applicant-info-card",children:[e.jsx(tt,{children:e.jsx(nt,{children:"Applicant Information"})}),e.jsxs(Me,{className:"p-4 sm:p-6 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-x-6 gap-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(kr,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Full Name"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-name",children:t.name})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(qr,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Email"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-email",children:t.email})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Jv,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Phone"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-phone",children:t.phone})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(kr,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Age"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-age",children:t.age?`${t.age} years`:"N/A"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(lL,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Education"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-education",children:t.education||"N/A"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Er,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Preferred Location"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-preferred-location",children:t.preferredLocation||"N/A"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Er,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location Type"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-location-type",children:t.locationType||"N/A"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ml,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-slate-600 flex items-center justify-between group cursor-pointer",onClick:l,"data-testid":"onboarding-applicant-info-edit-firm-type",children:["Proposed Firm Type",e.jsx(iv,{className:"w-3 h-3 text-slate-300 group-hover:text-amber-600 transition-colors"})]}),e.jsx("p",{className:"text-slate-900 font-black text-amber-700 tracking-tight leading-none mt-1","data-testid":"onboarding-applicant-info-firm-type",children:t.constitutionType||"Not Provided"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(uw,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Owns Bike"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-owns-bike",children:t.ownRoyalEnfield==="yes"?"Yes":"No"})]})]}),t.ownRoyalEnfield==="yes"&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(uw,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Bike Model"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-bike-model",children:t.royalEnfieldModel||"N/A"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(kr,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Existing Dealer"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-existing-dealer",children:t.existingDealer==="yes"?"Yes":"No"})]})]}),t.existingDealer==="yes"&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(kr,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Company Name"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-company-name",children:t.companyName||"N/A"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Fo,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Source"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-source",children:t.source||"N/A"})]})]}),t.questionnaireMarks!==void 0&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(M2,{className:"w-5 h-5 text-slate-400 mt-1"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Questionnaire Score"}),e.jsxs("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-score",children:[t.questionnaireMarks,"/100"]})]})]})]}),e.jsx(zd,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 mb-2",children:"Address"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-address",children:t.address||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 mb-2",children:"Pincode"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-pincode",children:t.pincode||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 mb-2",children:"Description"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-description",children:t.description||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 mb-2",children:"Past Experience"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-applicant-info-experience",children:t.pastExperience||"N/A"})]}),e.jsxs("div",{className:"pt-6 border-t mt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-sm font-black text-slate-900 uppercase tracking-widest flex items-center gap-2",children:[e.jsx(mu,{className:"w-4 h-4 text-amber-600"})," Statutory & Bank Information"]}),s&&!n&&e.jsxs(se,{variant:"ghost",size:"sm",onClick:c,className:"h-8 text-amber-600 hover:text-amber-700 hover:bg-amber-50 gap-1.5","data-testid":"onboarding-applicant-info-edit-statutory",children:[e.jsx(iv,{className:"w-3.5 h-3.5"}),"Edit Details"]})]}),n?e.jsxs("div",{className:"bg-slate-50/50 p-6 rounded-xl border-2 border-amber-100 space-y-4","data-testid":"onboarding-applicant-info-statutory-edit-form",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"Legal Entity Name"}),e.jsx(ot,{value:a.accountHolderName,onChange:f=>x({...a,accountHolderName:f.target.value}),placeholder:"Enter Legal Entity Name",className:"bg-white border-slate-200","data-testid":"onboarding-applicant-info-input-legal-name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"PAN Number"}),e.jsx(ot,{value:a.panNumber,onChange:f=>x({...a,panNumber:f.target.value.toUpperCase()}),placeholder:"10-digit PAN",maxLength:10,className:"bg-white border-slate-200 uppercase","data-testid":"onboarding-applicant-info-input-pan"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"GST Number"}),e.jsx(ot,{value:a.gstNumber,onChange:f=>x({...a,gstNumber:f.target.value.toUpperCase()}),placeholder:"15-digit GSTIN",maxLength:15,className:"bg-white border-slate-200 uppercase","data-testid":"onboarding-applicant-info-input-gst"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"Registered Address"}),e.jsx(ot,{value:a.registeredAddress,onChange:f=>x({...a,registeredAddress:f.target.value}),placeholder:"Enter Registered Office Address",className:"bg-white border-slate-200","data-testid":"onboarding-applicant-info-input-registered-address"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"Bank Name"}),e.jsx(ot,{value:a.bankName,onChange:f=>x({...a,bankName:f.target.value}),placeholder:"Enter Bank Name",className:"bg-white border-slate-200","data-testid":"onboarding-applicant-info-input-bank-name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"Account Number"}),e.jsx(ot,{value:a.accountNumber,onChange:f=>x({...a,accountNumber:f.target.value}),placeholder:"Enter Account Number",className:"bg-white border-slate-200","data-testid":"onboarding-applicant-info-input-account-number"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] uppercase font-bold text-slate-500",children:"IFSC Code"}),e.jsx(ot,{value:a.ifscCode,onChange:f=>x({...a,ifscCode:f.target.value.toUpperCase()}),placeholder:"11-digit IFSC",maxLength:11,className:"bg-white border-slate-200 uppercase","data-testid":"onboarding-applicant-info-input-ifsc-code"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[e.jsx(se,{variant:"outline",size:"sm",onClick:d,disabled:r,"data-testid":"onboarding-applicant-info-statutory-cancel",children:"Cancel"}),e.jsx(se,{size:"sm",onClick:m,disabled:r,className:"bg-amber-600 hover:bg-amber-700","data-testid":"onboarding-applicant-info-statutory-save",children:r?e.jsx(ss,{className:"w-4 h-4 animate-spin"}):"Save Details"})]})]}):e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 bg-slate-50/50 p-4 rounded-xl border border-slate-100","data-testid":"onboarding-applicant-info-statutory-display",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-tight",children:"Legal Entity Name"}),e.jsx("p",{className:"text-xs font-semibold text-slate-900","data-testid":"onboarding-applicant-info-display-legal-name",children:t.accountHolderName||"Pending"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-tight",children:"PAN Number"}),e.jsx("p",{className:"text-xs font-semibold text-slate-900 uppercase","data-testid":"onboarding-applicant-info-display-pan",children:t.panNumber||"Pending"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-tight",children:"GST Number"}),e.jsx("p",{className:"text-xs font-semibold text-slate-900 uppercase","data-testid":"onboarding-applicant-info-display-gst",children:t.gstNumber||"Pending"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-tight",children:"Registered Address"}),e.jsx("p",{className:"text-xs font-semibold text-slate-900","data-testid":"onboarding-applicant-info-display-registered-address",children:t.registeredAddress||"Pending"})]}),e.jsxs("div",{className:"space-y-1","data-testid":"onboarding-applicant-info-display-bank-info",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold tracking-tight",children:"Bank Details"}),e.jsx("p",{className:"text-xs font-semibold text-slate-900",children:t.bankName||"N/A"}),e.jsxs("p",{className:"text-[10px] text-slate-600",children:["A/C: ",t.accountNumber||"N/A"]}),e.jsxs("p",{className:"text-[10px] text-slate-600",children:["IFSC: ",t.ifscCode||"N/A"]})]})]})]})]})]})}const Z7=({application:t})=>{if(!t.questionnaireResponses||t.questionnaireResponses.length===0)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-300","data-testid":"onboarding-questionnaire-empty",children:[e.jsx(Fo,{className:"w-12 h-12 mb-3 text-slate-300"}),e.jsx("h3",{className:"text-lg font-medium text-slate-700",children:"Response is Pending"}),e.jsx("p",{className:"text-sm",children:"The applicant has not submitted the questionnaire yet."})]});const s=[...t.questionnaireResponses].sort((r,a)=>{var l,c;return(((l=r.question)==null?void 0:l.order)||0)-(((c=a.question)==null?void 0:c.order)||0)}),n=t.score||t.questionnaireMarks||0;return e.jsxs("div",{className:"space-y-6","data-testid":"onboarding-questionnaire-view",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Fo,{className:"w-5 h-5 text-amber-600"}),e.jsx("h3",{className:"text-slate-900",children:"Questionnaire Responses"})]}),n!==void 0&&e.jsxs(Ae,{className:"bg-amber-600","data-testid":"onboarding-questionnaire-total-score",children:["Score: ",n,"/100"]})]}),e.jsx("div",{className:"space-y-6",children:s.map((r,a)=>{const l=r.question,c=(l==null?void 0:l.questionText)||"Unknown Question",d=r.responseValue||"No Answer",m=(l==null?void 0:l.sectionName)||"General",x=(l==null?void 0:l.questionOptions)||[],f=x.find(p=>p.optionText===d),h=f?f.score:0,g=Math.max(...x.map(p=>p.score||0),0),u=typeof d=="string"&&d.startsWith("data:"),j=u&&d.startsWith("data:image");return e.jsxs("div",{className:"border border-slate-200 rounded-lg p-5 hover:border-amber-300 transition-colors","data-testid":`onboarding-questionnaire-item-${a}`,children:[e.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-100 flex items-center justify-center flex-shrink-0",children:e.jsx("span",{className:"text-amber-600",children:a+1})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Ae,{variant:"outline",className:"text-slate-600 bg-slate-50","data-testid":`onboarding-questionnaire-item-section-${a}`,children:m}),x.length>0&&g>0&&e.jsxs(Ae,{className:h>0?"bg-green-600":"bg-slate-400","data-testid":`onboarding-questionnaire-item-score-${a}`,children:[h,"/",g]})]}),e.jsx("h4",{className:"text-slate-900 font-medium","data-testid":`onboarding-questionnaire-item-text-${a}`,children:c})]})]}),e.jsx("div",{className:"ml-11",children:j?e.jsx("div",{className:"mt-2","data-testid":`onboarding-questionnaire-item-image-${a}`,children:e.jsx("img",{src:d,alt:"Response Attachment",className:"max-w-full h-auto max-h-64 rounded border p-1 object-contain"})}):u?e.jsx("a",{href:d,download:`upload_${a}.pdf`,className:"text-blue-600 underline text-sm break-all","data-testid":`onboarding-questionnaire-item-download-${a}`,children:"Download Attachment"}):e.jsx("div",{className:"text-slate-600 leading-relaxed break-words whitespace-pre-wrap","data-testid":`onboarding-questionnaire-item-answer-${a}`,children:r.attachmentUrl?e.jsx("a",{href:r.attachmentUrl,target:"_blank",rel:"noreferrer",className:"text-blue-600 underline","data-testid":`onboarding-questionnaire-item-attachment-${a}`,children:"View Attachment"}):d})})]},r.id)})})]})},Q7=Kv("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function mi({className:t,variant:s,...n}){return e.jsx("div",{"data-slot":"alert",role:"alert",className:_t(Q7({variant:s}),t),...n})}function Hi({className:t,...s}){return e.jsx("div",{"data-slot":"alert-title",className:_t("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...s})}function fi({className:t,...s}){return e.jsx("div",{"data-slot":"alert-description",className:_t("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...s})}var X7={};function J7(t){const{application:s,activeTab:n,setActiveTab:r,processStages:a,documents:l,interviews:c,expandedBranches:d,setExpandedBranches:m,setSelectedStage:x,setShowDocumentsModal:f,setShowUploadForm:h,handleRetriggerEvaluators:g,handleCancelInterview:u,setSelectedEvaluationForView:j,setShowFeedbackDetailsModal:p,renderFddAuditContent:y,eorProgress:N,eorData:S,eorChecklist:A,setUploadDocType:w,isAdmin:E,fetchApplication:T,fetchEorData:C,deposits:L,getDeposit:$,paymentConfigs:_,setPreviewDoc:R,setShowPreviewModal:P,auditLoading:M,auditLogs:q,auditLogActionBadgeClass:K}=t,Z=U=>String(U||"").trim().toLowerCase().replace(/[_\s-]+/g," "),W=(U,F)=>{var O,z,G;const B=[(O=U==null?void 0:U.user)==null?void 0:O.role,(z=U==null?void 0:U.user)==null?void 0:z.roleCode,(G=U==null?void 0:U.metadata)==null?void 0:G.role].map(Z),D=F.map(Z);return B.some(Y=>D.includes(Y))};return e.jsx(Ie,{"data-testid":"onboarding-details-tabs-container",children:e.jsxs(_n,{value:n,onValueChange:r,children:[e.jsx(tt,{className:"pb-4 px-4 sm:px-6",children:e.jsx("div",{className:"overflow-x-auto custom-scrollbar-x -mx-4 px-4 sm:-mx-6 sm:px-6",children:e.jsxs(Pn,{className:"w-max min-w-full justify-start h-11 bg-slate-100/80 p-1","data-testid":"onboarding-tabs-list",children:[e.jsx(Wt,{value:"questionnaire",className:"min-w-[120px]","data-testid":"onboarding-tab-trigger-questionnaire",children:"Questionnaire"}),e.jsx(Wt,{value:"progress",className:"min-w-[80px]","data-testid":"onboarding-tab-trigger-progress",children:"Progress"}),e.jsx(Wt,{value:"documents",className:"min-w-[100px]","data-testid":"onboarding-tab-trigger-documents",children:"Documents"}),e.jsx(Wt,{value:"interviews",className:"min-w-[100px]","data-testid":"onboarding-tab-trigger-interviews",children:"Interviews"}),e.jsx(Wt,{value:"fdd",className:"min-w-[120px]","data-testid":"onboarding-tab-trigger-fdd",children:"FDD Audit"}),e.jsx(Wt,{value:"eor",className:"min-w-[120px]","data-testid":"onboarding-tab-trigger-eor",children:"EOR Checklist"}),e.jsx(Wt,{value:"payments",className:"min-w-[100px]","data-testid":"onboarding-tab-trigger-payments",children:"Payments"}),e.jsx(Wt,{value:"audit",className:"min-w-[100px]","data-testid":"onboarding-tab-trigger-audit",children:"Audit Trail"})]})})}),e.jsxs(Me,{children:[e.jsx(Kt,{value:"questionnaire",className:"space-y-6","data-testid":"onboarding-tab-content-questionnaire",children:e.jsx(Z7,{application:s})}),e.jsxs(Kt,{value:"progress",className:"space-y-6","data-testid":"onboarding-tab-content-progress",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-slate-900",children:"Application Journey"}),e.jsxs(Ae,{className:"bg-amber-600","data-testid":"onboarding-progress-percentage-badge",children:[s.progress,"% Complete"]})]}),e.jsx(ji,{value:s.progress,className:"h-3 mb-6","data-testid":"onboarding-progress-bar"})]}),e.jsx("div",{className:"relative","data-testid":"onboarding-progress-stages-container",children:(()=>{const U={1:["DD-ZM","RBM"],2:["DD Lead","ZBH"],3:["NBH","DD Head"]},F={LOI_APPROVAL:["DD Head","NBH"],LOA_APPROVAL:["DD Head","NBH"]},B=O=>(s.participants||[]).filter(G=>{var V,X,ne,oe,re,ge,ve,Se,We,Ce,fe,Ye;return((V=G.metadata)==null?void 0:V.stageCode)===O||((ne=(X=G.metadata)==null?void 0:X.allAssignments)==null?void 0:ne.includes(O))||typeof O=="number"&&(((oe=G.metadata)==null?void 0:oe.interviewLevel)===O||((re=G.metadata)==null?void 0:re.interviewLevel)===String(O)||((ve=(ge=G.metadata)==null?void 0:ge.allAssignments)==null?void 0:ve.includes(O))||((We=(Se=G.metadata)==null?void 0:Se.allAssignments)==null?void 0:We.includes(String(O))))||typeof O=="string"&&!isNaN(Number(O))&&(((Ce=G.metadata)==null?void 0:Ce.interviewLevel)===Number(O)||((Ye=(fe=G.metadata)==null?void 0:fe.allAssignments)==null?void 0:Ye.includes(Number(O))))?!0:typeof O=="number"?W(G,U[O]||[]):W(G,F[O]||[])}).map(G=>{var X,ne,oe,re,ge;const Y=typeof O=="number"?`INTERVIEW_LEVEL_${O}`:O,V=(s.stageApprovals||[]).find(ve=>ve.stageCode===Y&&String(ve.actorUserId)===String(G.userId));return{name:((X=G.user)==null?void 0:X.name)||((ne=G.user)==null?void 0:ne.fullName)||"Unknown",role:((oe=G.user)==null?void 0:oe.role)||((re=G.user)==null?void 0:re.roleCode)||((ge=G.metadata)==null?void 0:ge.role)||"Reviewer",status:V?V.decision==="Approved"?"approved":"rejected":"pending"}}),D=(O,z)=>{const Y={"1st Level Interview":1,"2nd Level Interview":2,"3rd Level Interview":3,"LOI Approval":"LOI_APPROVAL",LOA:"LOA_APPROVAL"}[O];if(!Y)return null;const V=B(Y);return V.length===0?null:e.jsx("div",{className:"flex flex-wrap gap-2 mt-3","data-testid":`onboarding-stage-approvers-${z}`,children:V.map((X,ne)=>e.jsxs("div",{className:"group relative flex items-center gap-1.5 bg-slate-50 border border-slate-200 rounded-full pl-1 pr-2.5 py-0.5 transition-all hover:bg-white hover:shadow-sm","data-testid":`onboarding-stage-approver-${z}-${ne}`,children:[e.jsx("div",{className:_t("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold text-white",X.status==="approved"?"bg-green-500":X.status==="rejected"?"bg-red-500":"bg-slate-300"),children:X.name.split(" ").map(oe=>oe[0]).join("").substring(0,2).toUpperCase()}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[10px] font-medium text-slate-700 leading-none",children:X.name}),e.jsx("span",{className:"text-[8px] text-slate-500 leading-none mt-0.5",children:X.role})]}),e.jsx("div",{className:_t("absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full border border-white",X.status==="approved"?"bg-green-500":X.status==="rejected"?"bg-red-500":"bg-amber-400"),"data-testid":`onboarding-stage-approver-status-dot-${z}-${ne}`}),e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-slate-900 text-white text-[10px] rounded opacity-0 group-hover:opacity-100 pointer-events-none transition-opacity whitespace-nowrap z-50",children:[X.role,": ",X.status.toUpperCase()]})]},ne))})};return a.map((O,z)=>e.jsxs("div",{"data-testid":`onboarding-progress-stage-${z}`,children:[e.jsxs("div",{className:"flex gap-4 pb-8",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center border-2 z-10 relative ${O.status==="completed"?"bg-green-500 border-green-500 text-white shadow-md":O.status==="active"?O.isLocked?"bg-slate-400 border-slate-400 text-white":"bg-amber-500 border-amber-500 text-white animate-pulse-subtle":"bg-white border-slate-300 text-slate-400 shadow-none"}`,"data-testid":`onboarding-progress-stage-icon-${z}`,children:O.isParallel?e.jsx(rv,{className:"w-5 h-5"}):O.isLocked?e.jsxs("div",{className:"group relative",children:[e.jsx(av,{className:"w-5 h-5 text-white cursor-help"}),e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-3 py-1.5 bg-slate-900 text-white text-[10px] rounded shadow-xl opacity-0 group-hover:opacity-100 pointer-events-none transition-all duration-200 whitespace-nowrap z-[100] border border-slate-700",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("span",{className:"font-bold text-amber-400 flex items-center gap-1",children:[e.jsx(Gs,{className:"w-3 h-3"})," Stage Locked"]}),e.jsx("span",{children:O.lockMessage})]}),e.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-8 border-transparent border-t-slate-900"})]})]}):e.jsx(e.Fragment,{children:O.status==="completed"?e.jsx(Fn,{className:"w-6 h-6"}):O.status==="active"?e.jsx(Js,{className:"w-5 h-5 text-white"}):e.jsx("div",{className:"w-3 h-3 bg-slate-300 rounded-full"})})}),z0&&!["LOI Approval","LOA","1st Level Interview","2nd Level Interview","3rd Level Interview"].includes(O.name)&&e.jsxs("p",{className:"text-amber-600 text-xs mt-1.5 flex items-center gap-1 bg-amber-50 w-fit px-2 py-0.5 rounded border border-amber-100","data-testid":`onboarding-progress-stage-evaluators-${z}`,children:[e.jsx(kr,{className:"w-3 h-3"}),"Evaluators: ",O.evaluators.join(" + ")]}),(()=>{var ge;const G={3:2,4:2,5:2,6:2,8:2,12:2},Y=Number(O.id),V=G[Y],ne={3:1,4:1,5:2,6:3,8:"LOI_APPROVAL",12:"LOA_APPROVAL"}[Y],oe=ne?B(ne).length:((ge=O.evaluators)==null?void 0:ge.length)||0,re=Y===3?O.status==="completed":O.status!=="pending";return V&&oe{const G=l.filter(Y=>{var V;return Y.stage===O.name||!Y.stage&&((V=Y.documentType)==null?void 0:V.toLowerCase().includes(O.name.toLowerCase().split(" ")[0]))}).length;return e.jsx("div",{className:"flex items-center gap-2 mt-1",children:e.jsxs("button",{onClick:()=>{x(O.name),f(!0),G===0&&h(!0)},className:"text-xs font-semibold text-blue-600 hover:text-blue-800 flex items-center gap-1.5 px-3 py-1 rounded-full bg-blue-50 border border-blue-100 hover:bg-blue-100 transition-all shadow-sm","data-testid":`onboarding-progress-stage-docs-${z}`,children:[e.jsx(fs,{className:"w-3.5 h-3.5"}),G>0?`${G} Documents`:"Upload"]})})})(),e.jsxs("p",{className:"text-slate-500 mt-1 text-xs","data-testid":`onboarding-progress-stage-status-text-${z}`,children:[O.status==="completed"&&O.date&&`Completed: ${Ht(O.date)}`,O.status==="active"&&"In Progress",O.status==="pending"&&"Pending"]})]})]}),O.isParallel&&O.branches&&e.jsxs("div",{className:"ml-5 mb-8","data-testid":`onboarding-progress-parallel-branches-${z}`,children:[O.branches.map((G,Y)=>{const V=G.name.toLowerCase().replace(/\s+/g,"-"),X=d[V],ne=G.color==="blue"?"blue":"green";return e.jsxs("div",{className:"mb-6 last:mb-0",children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsxs("button",{onClick:()=>m(oe=>({...oe,[V]:!oe[V]})),className:`flex-1 flex items-center gap-3 p-4 rounded-lg border-2 transition-all hover:shadow-md ${ne==="blue"?"border-blue-300 bg-blue-50 hover:bg-blue-100":"border-green-300 bg-green-50 hover:bg-green-100"}`,"data-testid":`onboarding-progress-branch-trigger-${V}`,children:[X?e.jsx(la,{className:`w-5 h-5 ${ne==="blue"?"text-blue-600":"text-green-600"}`}):e.jsx(el,{className:`w-5 h-5 ${ne==="blue"?"text-blue-600":"text-green-600"}`}),e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center ${ne==="blue"?"bg-blue-200":"bg-green-200"}`,children:e.jsx(rv,{className:`w-4 h-4 ${ne==="blue"?"text-blue-700":"text-green-700"}`})}),e.jsxs("div",{className:"flex-1 text-left",children:[e.jsx("p",{className:`${ne==="blue"?"text-blue-900":"text-green-900"} font-semibold tracking-tight`,children:G.name}),e.jsxs("p",{className:`text-[10px] uppercase font-bold tracking-wider ${ne==="blue"?"text-blue-500":"text-green-500"}`,children:[G.stages.length," SUB-STEPS"]})]})]})}),X&&e.jsx("div",{className:"mt-4 ml-8 border-l-2 border-slate-200 pl-6 space-y-6","data-testid":`onboarding-progress-branch-content-${V}`,children:G.stages.map((oe,re)=>e.jsx("div",{className:"relative",children:e.jsx("div",{className:"flex gap-4 text-xs","data-testid":`onboarding-progress-branch-stage-${V}-${re}`,children:(()=>{const ge=l.filter(Se=>{var We;return((We=Se.documentType)==null?void 0:We.toLowerCase().includes(oe.name.toLowerCase().split(" ")[0]))||Se.stage===oe.name}),ve=oe.status==="completed"||ge.length>0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"relative",children:e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center border-2 ${ve?`${ne==="blue"?"bg-blue-500 border-blue-500":"bg-green-500 border-green-500"}`:oe.status==="active"?"bg-amber-500 border-amber-500 text-white shadow-sm":"bg-white border-slate-300 text-slate-400"}`,"data-testid":`onboarding-progress-branch-stage-icon-${V}-${re}`,children:ve?e.jsx(Bn,{className:"w-4 h-4 text-white",strokeWidth:3}):oe.status==="active"?e.jsx(Js,{className:"w-4 h-4 text-white"}):e.jsx("div",{className:"w-2 h-2 bg-slate-300 rounded-full"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-semibold text-slate-800","data-testid":`onboarding-progress-branch-stage-name-${V}-${re}`,children:oe.name}),oe.description&&e.jsx("p",{className:"text-slate-500 text-xs mt-0.5",children:oe.description}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:e.jsxs("button",{onClick:()=>{x(oe.name),f(!0),ge.length===0&&h(!0)},className:_t("text-[10px] font-medium flex items-center gap-1 transition-colors",ne==="blue"?"text-blue-600 hover:text-blue-800":"text-green-600 hover:text-green-800"),"data-testid":`onboarding-progress-branch-stage-docs-${V}-${re}`,children:[e.jsx(fs,{className:"w-2.5 h-2.5"}),ge.length>0?`${ge.length} Docs`:"Upload"]})}),e.jsx("p",{className:"text-slate-400 text-[10px] mt-1","data-testid":`onboarding-progress-branch-stage-status-${V}-${re}`,children:ve&&oe.date?`Done: ${Ht(oe.date)}`:ve&&ge.length>0?`Uploaded: ${Ht(ge[0].updatedAt||ge[0].createdAt)}`:oe.status==="active"?"Evaluating":"Pending"})]})]})})()})},oe.id))})]},Y)}),e.jsx("div",{className:"h-8 w-0.5 bg-slate-300 ml-5 opacity-50"})]})]},O.id))})()})]}),e.jsxs(Kt,{value:"documents",className:"space-y-4","data-testid":"onboarding-tab-content-documents",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-slate-900",children:"Uploaded Documents"}),e.jsxs(se,{size:"sm",className:"bg-amber-600 hover:bg-amber-700","data-testid":"onboarding-documents-upload-tab-button",onClick:()=>{x(null),f(!0),h(!0)},children:[e.jsx(Dr,{className:"w-4 h-4 mr-2"}),"Upload Document"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ks,{"data-testid":"onboarding-documents-table",children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{className:"min-w-[200px]",children:"File Name"}),e.jsx(me,{className:"min-w-[120px]",children:"Type"}),e.jsx(me,{className:"min-w-[120px]",children:"Upload Date"}),e.jsx(me,{className:"min-w-[150px]",children:"Uploader"}),e.jsx(me,{className:"text-right min-w-[100px]",children:"Actions"})]})}),e.jsx(Es,{children:l.length===0?e.jsx(ct,{"data-testid":"onboarding-documents-empty-row",children:e.jsx(de,{colSpan:5,className:"text-center py-8 text-slate-500",children:"No documents uploaded yet"})}):l.map((U,F)=>{var B;return e.jsxs(ct,{"data-testid":`onboarding-document-row-${F}`,children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"truncate max-w-[150px] md:max-w-[300px]","data-testid":`onboarding-document-name-${F}`,children:U.fileName})]}),e.jsx(de,{"data-testid":`onboarding-document-type-${F}`,children:U.documentType}),e.jsx(de,{children:Ht(U.createdAt)}),e.jsx(de,{"data-testid":`onboarding-document-uploader-${F}`,children:((B=U.uploader)==null?void 0:B.fullName)||(U.uploadedBy?"Unknown User":"Applicant")}),e.jsx(de,{children:e.jsx("div",{className:"flex justify-end gap-2",children:e.jsx(se,{size:"sm",variant:"outline","data-testid":`onboarding-document-download-${F}`,onClick:()=>{const D=X7.NEXT_PUBLIC_API_URL||"http://localhost:5000";window.open(`${D}/${U.filePath}`,"_blank")},children:e.jsx(Ni,{className:"w-3 h-3"})})})})]},U.id)})})]})})]}),e.jsxs(Kt,{value:"interviews",className:"space-y-6","data-testid":"onboarding-tab-content-interviews",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-slate-900 mb-4",children:"Scheduled Interviews"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ks,{"data-testid":"onboarding-interviews-scheduled-table",children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{className:"min-w-[100px]",children:"Level"}),e.jsx(me,{className:"min-w-[180px]",children:"Date & Time"}),e.jsx(me,{className:"min-w-[100px]",children:"Type"}),e.jsx(me,{className:"min-w-[200px]",children:"Location/Link"}),e.jsx(me,{className:"min-w-[120px]",children:"Status"}),e.jsx(me,{className:"min-w-[150px]",children:"Scheduled By"}),e.jsx(me,{className:"text-right",children:"Actions"})]})}),e.jsx(Es,{children:!c||c.length===0?e.jsx(ct,{"data-testid":"onboarding-interviews-empty-row",children:e.jsx(de,{colSpan:7,className:"text-center py-8 text-slate-500",children:"No interviews scheduled yet"})}):(Array.isArray(c)?c:[]).map((U,F)=>{var B,D;return e.jsxs(ct,{"data-testid":`onboarding-interview-row-${F}`,children:[e.jsxs(de,{className:"font-medium",children:["Level ",U.level]}),e.jsx(de,{children:U.scheduleDate?new Date(U.scheduleDate).toLocaleString():"N/A"}),e.jsx(de,{className:"capitalize",children:U.interviewType}),e.jsx(de,{children:(B=U.interviewType)!=null&&B.toLowerCase().includes("virtual")?e.jsx("a",{href:U.linkOrLocation,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline","data-testid":`onboarding-interview-link-${F}`,children:"Join Meeting"}):e.jsx("span",{"data-testid":`onboarding-interview-location-${F}`,children:U.linkOrLocation})}),e.jsx(de,{children:e.jsx(Ae,{variant:U.status==="Completed"?"default":"secondary","data-testid":`onboarding-interview-status-${F}`,children:U.status})}),e.jsx(de,{children:((D=U.scheduler)==null?void 0:D.fullName)||U.scheduledBy||"N/A"}),e.jsx(de,{className:"text-right",children:(U.status==="Scheduled"||U.status==="scheduled")&&e.jsx(se,{variant:"ghost",size:"sm",className:"text-red-500 hover:text-red-700 hover:bg-red-50 h-8 px-2","data-testid":`onboarding-interview-cancel-${F}`,onClick:()=>u(U.id),children:"Cancel"})})]},U.id)})})]})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-slate-900 mb-4",children:"Interview Feedback"}),!c||c.length===0?e.jsx("p",{className:"text-slate-500 italic","data-testid":"onboarding-interviews-no-feedback",children:"No interviews scheduled."}):(Array.isArray(c)?c:[]).map((U,F)=>e.jsxs("div",{className:"mb-6 border p-4 rounded-lg bg-slate-50/50","data-testid":`onboarding-interview-feedback-block-${F}`,children:[e.jsxs("h4",{className:"font-semibold text-slate-800 mb-2",children:["Level ",U.level," Interview",e.jsxs("span",{className:"font-normal text-slate-500 text-sm ml-2",children:["(",Ht(U.scheduleDate)," - ",U.interviewType,")"]})]}),U.evaluations&&U.evaluations.length>0?e.jsxs(ks,{"data-testid":`onboarding-interview-evaluations-table-${F}`,children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Interviewer"}),e.jsx(me,{children:"Role"}),e.jsx(me,{children:U.level===1?"Score (KT Matrix)":"Overall Score"}),e.jsx(me,{children:"Remarks"}),e.jsx(me,{children:"Recommendation"})]})}),e.jsx(Es,{children:U.evaluations.map((B,D)=>{var O,z,G;return e.jsxs(ct,{"data-testid":`onboarding-interview-evaluation-row-${F}-${D}`,children:[e.jsx(de,{className:"font-medium",children:(O=B.evaluator)==null?void 0:O.fullName}),e.jsx(de,{children:((G=(z=B.evaluator)==null?void 0:z.role)==null?void 0:G.roleName)||"N/A"}),e.jsx(de,{children:B.ktMatrixScore?e.jsxs(Ae,{variant:U.level===1?Number(B.ktMatrixScore)>=50?"outline":"destructive":Number(B.ktMatrixScore)>=5?"outline":"destructive","data-testid":`onboarding-interview-evaluation-score-${F}-${D}`,children:[B.ktMatrixScore,"/",U.level===1?"100":"10"]}):"N/A"}),e.jsx(de,{className:"max-w-xs truncate",title:B.remarks||B.qualitativeFeedback,children:B.remarks?e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"font-medium text-slate-800",children:B.remarks}),B.feedbackDetails&&B.feedbackDetails.length>0&&e.jsx(se,{variant:"link",className:"p-0 h-auto font-normal text-blue-600 text-xs w-fit","data-testid":`onboarding-interview-evaluation-details-btn-${F}-${D}`,onClick:()=>{j({...B,interview:U}),p(!0)},children:"View Detailed Feedback"})]}):B.feedbackDetails&&B.feedbackDetails.length>0?e.jsx(se,{variant:"link",className:"p-0 h-auto font-normal text-blue-600","data-testid":`onboarding-interview-evaluation-details-btn-${F}-${D}`,onClick:()=>{j({...B,interview:U}),p(!0)},children:"View Detailed Feedback"}):B.qualitativeFeedback||"-"}),e.jsx(de,{"data-testid":`onboarding-interview-evaluation-rec-${F}-${D}`,children:B.recommendation||"-"})]},B.id)})})]}):e.jsx("p",{className:"text-sm text-slate-500 italic pl-2",children:"No feedback recorded yet."})]},U.id))]}),["Level 2 Approved","Level 3 Interview Pending","Approved","Onboarded"].includes(s.status)&&e.jsxs("div",{"data-testid":"onboarding-interviews-summary-l2",children:[e.jsx("h3",{className:"text-slate-900 mb-4",children:"Level 2 Interview Summary"}),e.jsxs("div",{className:"p-4 bg-slate-50 rounded-lg",children:[e.jsx("p",{className:"text-slate-600",children:"Decision: Approved by both ZBH and DD Lead"}),e.jsx("p",{className:"text-slate-600 mt-2",children:"Overall Assessment: Strong candidate with excellent business plan"})]})]})]}),e.jsx(Kt,{value:"fdd",className:"space-y-6","data-testid":"onboarding-tab-content-fdd",children:y()}),e.jsxs(Kt,{value:"eor",className:"space-y-4","data-testid":"onboarding-tab-content-eor",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-slate-900",children:"Essential Operating Requirements"}),e.jsxs(Ae,{className:"bg-amber-600","data-testid":"onboarding-eor-progress-badge",children:[Math.round(N),"% Complete"]})]}),e.jsx(ji,{value:N,className:"h-3 mb-6","data-testid":"onboarding-eor-progress-bar"}),e.jsx("div",{className:"space-y-3","data-testid":"onboarding-eor-checklist",children:((S==null?void 0:S.items)||A).map((U,F)=>{const B=U.description||U.item,D=!!U.proofDocument;return e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-xl transition-all border border-transparent hover:border-slate-200 group","data-testid":`onboarding-eor-item-${F}`,children:[e.jsx(Rn,{checked:U.isCompliant||U.completed,className:"pointer-events-none shrink-0","data-testid":`onboarding-eor-checkbox-${F}`}),e.jsxs("div",{className:"flex flex-col flex-1 min-w-0 cursor-pointer","data-testid":`onboarding-eor-clickable-${F}`,onClick:()=>{x(`EOR: ${B}`),w(B),f(!0),h(!D)},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:U.isCompliant||U.completed?"text-slate-900 font-bold":"text-slate-600 font-medium",children:B}),D&&!U.isCompliant&&e.jsx(Ae,{variant:"outline",className:"text-[10px] h-4 px-1.5 bg-amber-50 text-amber-600 border-amber-200 uppercase tracking-wider font-bold",children:"Needs Verification"})]}),D&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-blue-600 font-semibold mt-1",children:[e.jsx(fs,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"truncate",children:U.proofDocument.fileName})]}),!D&&e.jsx("span",{className:"text-[10px] text-slate-400 mt-1 uppercase tracking-tighter",children:"Click to upload proof"})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[D&&!U.isCompliant&&E&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(se,{size:"sm",className:"h-8 px-3 bg-green-600 hover:bg-green-700 text-white font-bold rounded-lg shadow-sm","data-testid":`onboarding-eor-verify-btn-${F}`,onClick:async()=>{await(await Tl(async()=>{const{eorService:O}=await Promise.resolve().then(()=>Zx);return{eorService:O}},void 0)).eorService.updateItem(S.id,{...U,isCompliant:!0}),C(),ee.success(`${B} verified!`)},children:"Verify"}),e.jsx(se,{size:"sm",variant:"outline",className:"h-8 px-3 border-red-200 text-red-600 hover:bg-red-50 font-bold rounded-lg","data-testid":`onboarding-eor-reject-btn-${F}`,onClick:async()=>{await(await Tl(async()=>{const{eorService:O}=await Promise.resolve().then(()=>Zx);return{eorService:O}},void 0)).eorService.updateItem(S.id,{...U,isCompliant:!1,proofDocumentId:null}),C(),ee.success(`${B} rejected.`)},children:"Reject"})]}),(U.isCompliant||U.completed)&&e.jsx("div",{className:"bg-green-100 p-1.5 rounded-full","data-testid":`onboarding-eor-done-icon-${F}`,children:e.jsx(Ys,{className:"w-4 h-4 text-green-600"})}),!D&&e.jsx("div",{className:"p-2 text-slate-300 group-hover:text-amber-500 transition-colors","data-testid":`onboarding-eor-upload-hint-${F}`,children:e.jsx(Dr,{className:"w-4 h-4"})})]})]},U.id)})}),N===100&&E&&(s.status==="EOR In Progress"||s.status==="LOA Pending")&&e.jsx("div",{className:"mt-8 p-6 bg-green-50 rounded-xl border-2 border-green-200 animate-in fade-in slide-in-from-bottom-4 duration-500","data-testid":"onboarding-eor-complete-banner",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-100 flex items-center justify-center shrink-0",children:e.jsx(Fl,{className:"w-7 h-7 text-green-600"})}),e.jsxs("div",{className:"flex-1 text-center sm:text-left",children:[e.jsx("h4",{className:"text-green-900 font-bold text-lg",children:"EOR Checklist Complete"}),e.jsx("p",{className:"text-green-700 text-sm",children:"All 12 mandatory requirements have been verified. You can now complete the audit and move to final inauguration."})]}),e.jsx(se,{className:"w-full sm:w-auto bg-green-600 hover:bg-green-700 text-white font-bold h-12 px-8 rounded-xl shadow-lg shadow-green-600/20 transition-all hover:scale-[1.02] active:scale-[0.98]","data-testid":"onboarding-eor-submit-audit",onClick:async()=>{try{const U=S==null?void 0:S.id;if(!U)throw new Error("Checklist ID not found");await(await Tl(async()=>{const{eorService:F}=await Promise.resolve().then(()=>Zx);return{eorService:F}},void 0)).eorService.submitAudit(U,{status:"Completed",overallComments:"EOR Checklist verified and audit completed."}),ee.success("EOR Audit completed successfully!"),T(),C()}catch(U){ee.error(U.message||"Failed to complete EOR audit")}},children:"Complete Audit & Proceed"})]})})]}),e.jsxs(Kt,{value:"payments",className:"space-y-6","data-testid":"onboarding-tab-content-payments",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Security Deposits"}),e.jsxs(Ae,{variant:"outline",className:"bg-slate-50 text-slate-500 border-slate-200","data-testid":"onboarding-payments-count-badge",children:[L.length," Payment Record(s)"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(()=>{const U=$("SECURITY_DEPOSIT"),F=_.SECURITY_DEPOSIT,B=(F==null?void 0:F.amount)||5e5;return e.jsx(Ie,{className:_t("border-l-4",(U==null?void 0:U.status)==="Verified"?"border-l-green-500":(U==null?void 0:U.status)==="Rejected"?"border-l-red-500":"border-l-amber-500"),"data-testid":"onboarding-payment-card-security",children:e.jsxs(Me,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-amber-50 flex items-center justify-center text-amber-600",children:e.jsx(Fo,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-semibold text-slate-700",children:"Security Deposit"})]}),e.jsx(Ae,{className:_t((U==null?void 0:U.status)==="Verified"?"bg-green-100 text-green-700 hover:bg-green-100":(U==null?void 0:U.status)==="Rejected"?"bg-red-100 text-red-700 hover:bg-red-100":"bg-amber-100 text-amber-700 hover:bg-amber-100"),"data-testid":"onboarding-payment-status-security",children:(U==null?void 0:U.status)||"Awaiting"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-baseline",children:[e.jsx("span",{className:"text-xs text-slate-500 uppercase font-bold tracking-wider",children:"Amount Received"}),e.jsxs("span",{className:"text-lg font-bold text-slate-900","data-testid":"onboarding-payment-amount-security",children:["₹",Number((U==null?void 0:U.amount)||0).toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-baseline border-t border-slate-100 pt-2",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Expected Total"}),e.jsxs("span",{className:"text-sm font-medium text-slate-600",children:["₹",B.toLocaleString()]})]}),(U==null?void 0:U.paymentReference)&&e.jsxs("div",{className:"bg-slate-50 p-2 rounded text-xs font-mono text-slate-600 flex justify-between items-center","data-testid":"onboarding-payment-ref-security",children:[e.jsxs("span",{children:["Ref: ",U.paymentReference]}),U.verifiedAt&&e.jsx("span",{children:Ht(U.verifiedAt)})]}),(U==null?void 0:U.remarks)&&e.jsxs("div",{className:"text-[11px] text-slate-500 bg-red-50/50 p-2 rounded border border-red-100 italic","data-testid":"onboarding-payment-remarks-security",children:['"',U.remarks,'"']}),e.jsxs("div",{className:"pt-4 mt-2 border-t border-slate-100",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2",children:"Verification Documents"}),e.jsxs("div",{className:"space-y-2",children:[l.filter(D=>{var O,z;return((O=D.documentType)==null?void 0:O.toLowerCase().includes("security"))&&((z=D.documentType)==null?void 0:z.toLowerCase().includes("deposit"))}).map((D,O)=>e.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-slate-50/50 border border-slate-100","data-testid":`onboarding-payment-doc-security-${O}`,children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx(fs,{className:"w-3 h-3 text-slate-400"}),e.jsx("span",{className:"text-[10px] font-medium text-slate-700 truncate",children:D.fileName||D.name})]}),e.jsx(se,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px] text-amber-600 hover:text-amber-700 hover:bg-amber-50","data-testid":`onboarding-payment-doc-view-security-${O}`,onClick:()=>{R(D),P(!0)},children:"View"})]},O)),l.filter(D=>{var O,z;return((O=D.documentType)==null?void 0:O.toLowerCase().includes("security"))&&((z=D.documentType)==null?void 0:z.toLowerCase().includes("deposit"))}).length===0&&e.jsx("p",{className:"text-[10px] text-slate-400 italic",children:"No proof uploaded"})]})]})]})]})})})(),(()=>{const U=$("FIRST_FILL"),F=_.FIRST_FILL,B=(F==null?void 0:F.amount)||15e5;return e.jsx(Ie,{className:_t("border-l-4",(U==null?void 0:U.status)==="Verified"?"border-l-green-500":(U==null?void 0:U.status)==="Rejected"?"border-l-red-500":"border-l-amber-500"),"data-testid":"onboarding-payment-card-first-fill",children:e.jsxs(Me,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-blue-50 flex items-center justify-center text-blue-600",children:e.jsx(Fl,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-semibold text-slate-700",children:"First Fill"})]}),e.jsx(Ae,{className:_t((U==null?void 0:U.status)==="Verified"?"bg-green-100 text-green-700 hover:bg-green-100":(U==null?void 0:U.status)==="Rejected"?"bg-red-100 text-red-700 hover:bg-red-100":"bg-amber-100 text-amber-700 hover:bg-amber-100"),"data-testid":"onboarding-payment-status-first-fill",children:(U==null?void 0:U.status)||"Awaiting"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-baseline",children:[e.jsx("span",{className:"text-xs text-slate-500 uppercase font-bold tracking-wider",children:"Amount Received"}),e.jsxs("span",{className:"text-lg font-bold text-slate-900","data-testid":"onboarding-payment-amount-first-fill",children:["₹",Number((U==null?void 0:U.amount)||0).toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-baseline border-t border-slate-100 pt-2",children:[e.jsx("span",{className:"text-xs text-slate-500",children:"Expected Total"}),e.jsxs("span",{className:"text-sm font-medium text-slate-600",children:["₹",B.toLocaleString()]})]}),(U==null?void 0:U.paymentReference)&&e.jsxs("div",{className:"bg-slate-50 p-2 rounded text-xs font-mono text-slate-600 flex justify-between items-center","data-testid":"onboarding-payment-ref-first-fill",children:[e.jsxs("span",{children:["Ref: ",U.paymentReference]}),U.verifiedAt&&e.jsx("span",{children:Ht(U.verifiedAt)})]}),(U==null?void 0:U.remarks)&&e.jsxs("div",{className:"text-[11px] text-slate-500 bg-red-50/50 p-2 rounded border border-red-100 italic","data-testid":"onboarding-payment-remarks-first-fill",children:['"',U.remarks,'"']}),e.jsxs("div",{className:"pt-4 mt-2 border-t border-slate-100",children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider mb-2",children:"Verification Documents"}),e.jsxs("div",{className:"space-y-2",children:[l.filter(D=>{var O,z;return((O=D.documentType)==null?void 0:O.toLowerCase().includes("first"))&&((z=D.documentType)==null?void 0:z.toLowerCase().includes("fill"))}).map((D,O)=>e.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-slate-50/50 border border-slate-100","data-testid":`onboarding-payment-doc-first-fill-${O}`,children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx(fs,{className:"w-3 h-3 text-slate-400"}),e.jsx("span",{className:"text-[10px] font-medium text-slate-700 truncate",children:D.fileName||D.name})]}),e.jsx(se,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px] text-blue-600 hover:text-blue-700 hover:bg-blue-50","data-testid":`onboarding-payment-doc-view-first-fill-${O}`,onClick:()=>{R(D),P(!0)},children:"View"})]},O)),l.filter(D=>{var O,z;return((O=D.documentType)==null?void 0:O.toLowerCase().includes("first"))&&((z=D.documentType)==null?void 0:z.toLowerCase().includes("fill"))}).length===0&&e.jsx("p",{className:"text-[10px] text-slate-400 italic",children:"No proof uploaded"})]})]})]})]})})})()]})]}),e.jsx(Kt,{value:"audit","data-testid":"onboarding-tab-content-audit",children:e.jsx(Db,{className:"h-[30rem] rounded-md border border-slate-100 bg-slate-50/50",children:e.jsx("div",{className:"space-y-2.5 p-3 pr-4","data-testid":"onboarding-audit-logs-container",children:M?e.jsxs("div",{className:"flex items-center justify-center py-10","data-testid":"onboarding-audit-loading",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-amber-600"}),e.jsx("span",{className:"ml-2 text-sm text-slate-500",children:"Loading audit trail…"})]}):q.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-slate-200 bg-white py-10 text-center text-sm text-slate-500","data-testid":"onboarding-audit-empty",children:"No audit logs recorded yet for this application."}):q.map((U,F)=>e.jsxs("div",{className:"rounded-lg border border-slate-200/90 bg-white p-3 text-sm shadow-sm","data-testid":`onboarding-audit-log-item-${F}`,children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-3 gap-y-1.5",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e.jsx(Ae,{variant:"outline",className:_t("shrink-0 text-[10px] font-semibold uppercase tracking-wide",K(U.action)),"data-testid":`onboarding-audit-log-action-${F}`,children:String(U.action||"EVENT").replace(/_/g," ")}),U.stage?e.jsx("span",{className:"max-w-[200px] truncate text-[11px] text-slate-500",title:U.stage,"data-testid":`onboarding-audit-log-stage-${F}`,children:U.stage}):null]}),e.jsx("time",{className:"shrink-0 text-xs tabular-nums text-slate-400",dateTime:U.timestamp,"data-testid":`onboarding-audit-log-time-${F}`,children:Ht(U.timestamp)})]}),e.jsx("p",{className:"mt-2 text-[13px] leading-relaxed text-slate-800","data-testid":`onboarding-audit-log-desc-${F}`,children:U.description||"—"}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-slate-500",children:[e.jsx(kr,{className:"h-3.5 w-3.5 shrink-0 text-slate-400","aria-hidden":!0}),e.jsxs("span",{className:"min-w-0 truncate",children:[e.jsx("span",{className:"font-medium text-slate-600","data-testid":`onboarding-audit-log-user-${F}`,children:U.userName||"System"}),U.userEmail?e.jsxs("span",{className:"text-slate-400","data-testid":`onboarding-audit-log-email-${F}`,children:[" · ",U.userEmail]}):null]})]})]},U.id))})})})]})]})})}function e$(t){var K;const{application:s,permissions:n,getDeposit:r,isNonResponsive:a,isAdmin:l,currentUserStageAction:c,currentUserEvaluation:d,onOpenApproveModal:m,onOpenRejectModal:x,onOpenWorknote:f,onOpenScheduleModal:h,currentUser:g,handleGenerateDealerCodes:u,onOpenAssignArchitectureModal:j,activeInterviewForUser:p,hasSubmittedFeedback:y,setSelectedInterviewForFeedback:N,setShowKTMatrixModal:S,setShowLevel2FeedbackModal:A,setShowLevel3FeedbackModal:w,onGoToDashboard:E,showAssignModal:T,setShowAssignModal:C,selectedUser:L,setSelectedUser:$,users:_,participantType:R,setParticipantType:P,handleAddParticipant:M,isAssigningParticipant:q}=t;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(Ie,{"data-testid":"onboarding-details-summary-card",children:[e.jsx(tt,{children:e.jsx(nt,{children:"Summary"})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Registration ID"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-details-summary-reg-id",children:s.registrationNumber})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Current Status"}),e.jsx(Ae,{className:_t("mt-1",s.status==="Onboarded"?"bg-green-600 hover:bg-green-700 text-white":s.status==="Rejected"?"bg-red-600":"bg-amber-600"),"data-testid":"onboarding-details-summary-status",children:s.status})]}),s.rank&&e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Rank"}),e.jsxs("p",{className:"text-slate-900","data-testid":"onboarding-details-summary-rank",children:[s.rank," of ",s.totalApplicantsAtLocation,e.jsxs("span",{className:"text-slate-500",children:[" in ",s.preferredLocation]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Progress"}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx(ji,{value:s.progress,className:"flex-1","data-testid":"onboarding-details-summary-progress-bar"}),e.jsxs("span",{className:"text-slate-900","data-testid":"onboarding-details-summary-progress-text",children:[s.progress,"%"]})]})]}),s.deadline&&e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Questionnaire Deadline"}),e.jsx("p",{className:"text-slate-900","data-testid":"onboarding-details-summary-deadline",children:Ht(s.deadline)})]})]})]}),(s.isShortlisted!==!1||s.status==="Submitted")&&e.jsxs(Ie,{"data-testid":"onboarding-details-actions-card",children:[e.jsx(tt,{children:e.jsx(nt,{children:"Actions"})}),e.jsxs(Me,{className:"space-y-3",children:[n.isLoaLocked&&e.jsxs(mi,{variant:"destructive",className:"mb-4 bg-amber-50 border-amber-200 text-amber-800","data-testid":"onboarding-details-loa-locked-alert",children:[e.jsx(av,{className:"w-4 h-4 text-amber-600"}),e.jsx(Hi,{className:"text-amber-900 font-semibold",children:"LOA approval locked"}),e.jsxs(fi,{className:"text-amber-800",children:[e.jsx("span",{className:"font-medium",children:"First Fill"})," (later-stage payment) must be verified by Finance before LOA approval can proceed. This is separate from the initial security deposit before LOI Issued."]})]}),((K=r("FIRST_FILL"))==null?void 0:K.status)==="Verified"&&s.status!=="LOA Pending"&&!["LOA Issued","EOR In Progress","EOR Complete","Inauguration","Approved","Onboarded","Rejected"].includes(s.status)&&e.jsxs(mi,{className:"mb-4 border-violet-200 bg-violet-50/90 text-violet-950","data-testid":"onboarding-details-first-fill-verified-alert",children:[e.jsx(Xa,{className:"h-4 w-4 text-violet-700"}),e.jsx(Hi,{className:"font-semibold",children:"First Fill verified on file"}),e.jsxs(fi,{className:"text-sm text-violet-900/90 leading-relaxed",children:["Finance has verified the ",e.jsx("span",{className:"font-medium",children:"First Fill"})," payment. The application status was ",e.jsx("span",{className:"font-medium",children:"not"})," changed until you reach"," ",e.jsx("span",{className:"font-medium",children:"LOA Pending"}),". When you get there, LOA approval will not be blocked by payment (same pattern as recording the initial security deposit before the LOI security step)."]})]}),n.isSecurityDetailsLocked&&e.jsxs(mi,{variant:"destructive",className:"mb-4 bg-amber-50 border-amber-200 text-amber-800","data-testid":"onboarding-details-security-locked-alert",children:[e.jsx(av,{className:"w-4 h-4 text-amber-600"}),e.jsx(Hi,{className:"text-amber-900 font-semibold",children:"Security Details approval locked"}),e.jsxs(fi,{className:"text-amber-800",children:["Finance must verify the ",e.jsx("span",{className:"font-medium",children:"Security Deposit"})," before this stage can be approved. You can still use ",e.jsx("span",{className:"font-medium",children:"Reject"})," if needed."]})]}),["Security Details","Payment Pending"].includes(s.status)&&e.jsxs(mi,{className:"mb-4 border-sky-200 bg-sky-50/90 text-sky-900","data-testid":"onboarding-details-security-review-alert",children:[e.jsx(Xa,{className:"h-4 w-4 text-sky-700"}),e.jsx(Hi,{className:"text-sky-950 font-semibold",children:"Security Details review"}),e.jsxs(fi,{className:"text-sm text-sky-900/90 leading-relaxed",children:["Check the initial security deposit on the ",e.jsx("span",{className:"font-medium",children:"Payments"})," tab (Finance may have already marked it verified). When satisfied, use ",e.jsx("span",{className:"font-medium",children:"Approve"})," ","to move to ",e.jsx("span",{className:"font-medium",children:"LOI Issued"}),"."]})]}),a&&l&&e.jsxs(mi,{variant:"destructive",className:"mb-4 bg-red-50 border-red-200 text-red-800","data-testid":"onboarding-details-non-responsive-alert",children:[e.jsx(Gs,{className:"w-4 h-4 text-red-600"}),e.jsx(Hi,{className:"text-red-900 font-black uppercase tracking-tighter",children:"⚠️ Non-Responsive Flag"}),e.jsx(fi,{className:"text-red-800 text-xs font-bold leading-tight",children:"FDD Audit has flagged this applicant. Review audit logs before approval."})]}),l&&(s.status==="Level 3 Approved"||s.status==="FDD Verification")&&(!s.fddAssignments||s.fddAssignments.length===0)&&e.jsxs(mi,{className:"mb-4 bg-amber-50 border-amber-200 text-amber-800","data-testid":"onboarding-details-fdd-assignment-alert",children:[e.jsx(Gs,{className:"w-4 h-4 text-amber-600"}),e.jsx(Hi,{className:"text-amber-900 font-bold",children:"FDD Assignment Required"}),e.jsx(fi,{className:"text-amber-800 font-medium",children:"This application is pending financial due diligence. Please assign an FDD Agency to proceed with the audit."})]}),n.canApprove&&e.jsxs(se,{className:"w-full bg-green-600 hover:bg-green-700 font-bold",onClick:m,"data-testid":"onboarding-details-approve-button",children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"}),["Inauguration","Approved"].includes(s.status)?"Onboard Dealer":"Approve"]}),n.canReject&&e.jsxs(se,{variant:"destructive",className:"w-full font-bold",onClick:x,"data-testid":"onboarding-details-reject-button",children:[e.jsx(Za,{className:"w-4 h-4 mr-2"}),"Reject"]}),n.showDecisionMessage&&e.jsxs("div",{className:`w-full p-2 text-center rounded border ${(c==null?void 0:c.decision)==="Approved"||(d==null?void 0:d.decision)==="Approved"||(d==null?void 0:d.recommendation)==="Approved"||(d==null?void 0:d.decision)==="Selected"?"bg-green-50 border-green-200 text-green-700":"bg-red-50 border-red-200 text-red-700"}`,"data-testid":"onboarding-details-decision-message",children:["You have ",(c==null?void 0:c.decision)==="Approved"||(d==null?void 0:d.decision)==="Approved"||(d==null?void 0:d.recommendation)==="Approved"||(d==null?void 0:d.decision)==="Selected"?"Approved":"Rejected"]}),e.jsx(zd,{}),e.jsxs(se,{variant:"outline",className:"w-full",onClick:f,"data-testid":"onboarding-details-worknote-button",children:[e.jsx(zr,{className:"w-4 h-4 mr-2"}),"Work Note"]}),n.canSchedule&&e.jsxs(se,{variant:"outline",className:"w-full",onClick:h,"data-testid":"onboarding-details-schedule-button",children:[e.jsx($n,{className:"w-4 h-4 mr-2"}),"Schedule Interview"]}),g&&["DD Admin","Super Admin"].includes(g.role)&&["Dealer Code Generation","LOA Pending","Architecture Team Assigned","Architecture Document Upload","Architecture Team Completion"].includes(s.status)&&e.jsxs(e.Fragment,{children:[!s.dealerCode&&e.jsxs(se,{className:"w-full bg-blue-600 hover:bg-blue-700",onClick:u,"data-testid":"onboarding-details-generate-dealer-codes",children:[e.jsx(pw,{className:"w-4 h-4 mr-2"}),"Generate Dealer Codes"]}),s.dealerCode&&!s.architectureAssignedTo&&e.jsxs(se,{variant:"outline",className:"w-full border-blue-200 hover:bg-blue-50 text-blue-700",onClick:j,"data-testid":"onboarding-details-assign-architecture",children:[e.jsx(rv,{className:"w-4 h-4 mr-2"}),"Assign Architecture Team"]})]}),p&&!y&&e.jsxs(bb,{children:[e.jsx(yb,{asChild:!0,children:e.jsxs(se,{variant:"outline",className:"w-full","data-testid":"onboarding-details-feedback-dropdown-trigger",children:[e.jsx(vL,{className:"w-4 h-4 mr-2"}),"Interview Feedback",e.jsx(la,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(jb,{className:"w-56","data-testid":"onboarding-details-feedback-dropdown-content",children:e.jsxs(mk,{"data-testid":`onboarding-details-feedback-item-${p.id}`,onClick:()=>{N(p),p.level===1?S(!0):p.level===2?A(!0):w(!0)},children:["Level ",p.level," - ",p.interviewType]},p.id)})]}),s.status==="Questionnaire Pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{variant:"outline",className:"w-full","data-testid":"onboarding-details-send-reminder",children:[e.jsx(qr,{className:"w-4 h-4 mr-2"}),"Send Reminder"]}),e.jsxs(se,{variant:"outline",className:"w-full","data-testid":"onboarding-details-extend-deadline",children:[e.jsx(Js,{className:"w-4 h-4 mr-2"}),"Extend Deadline"]})]}),s.dealer&&e.jsxs("div",{className:"p-4 bg-green-50 border border-green-200 rounded-lg space-y-3","data-testid":"onboarding-details-dealer-active-banner",children:[e.jsxs("div",{className:"flex items-center gap-2 text-green-800 font-semibold",children:[e.jsx(Ys,{className:"w-5 h-5 text-green-600"}),"Dealer Profile Active"]}),e.jsx("div",{className:"text-sm text-green-700",children:"This application has been successfully onboarded as a dealer. A user account has been created for the dealer."}),s.dealerCode&&e.jsxs("div",{className:"flex items-center justify-between text-xs font-mono bg-white p-2 rounded border border-green-100","data-testid":"onboarding-details-active-dealer-code",children:[e.jsx("span",{className:"text-slate-500",children:"Dealer Code:"}),e.jsx("span",{className:"font-bold text-slate-900",children:s.dealerCode.code})]}),e.jsxs(se,{className:"w-full bg-green-600 hover:bg-green-700 text-white",onClick:E,"data-testid":"onboarding-details-goto-dashboard",children:[e.jsx(pw,{className:"w-4 h-4 mr-2"}),"Go to Dealer Dashboard"]})]}),g&&["DD Admin","Super Admin"].includes(g.role)&&e.jsxs(os,{open:T,onOpenChange:C,children:[e.jsx(Hl,{asChild:!0,children:e.jsxs(se,{variant:"outline",className:"w-full","data-testid":"onboarding-details-assign-user-trigger",children:[e.jsx(kr,{className:"w-4 h-4 mr-2"}),"Assign User"]})}),e.jsxs(ls,{"data-testid":"onboarding-details-assign-user-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Assign User to Application"}),e.jsx(vs,{children:"Select a user and their role for this application."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Select User"}),e.jsxs(wt,{value:L,onValueChange:$,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-details-assign-user-select",children:e.jsx(St,{placeholder:"Search users..."})}),e.jsx(At,{children:_.map(Z=>e.jsxs(_e,{value:Z.id,children:[Z.fullName," (",Z.email,")"]},Z.id))})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Assignment Role"}),e.jsxs(wt,{value:R,onValueChange:P,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-details-assign-role-select",children:e.jsx(St,{placeholder:"Select role"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"owner",children:"Owner"}),e.jsx(_e,{value:"contributor",children:"Contributor"}),e.jsx(_e,{value:"reviewer",children:"Reviewer"})]})]})]}),e.jsx(se,{className:"w-full bg-amber-600 hover:bg-amber-700 font-bold h-11",onClick:M,disabled:q,"data-testid":"onboarding-details-assign-user-submit",children:q?"Assigning...":"Assign User"})]})]})]})]})]})]})}function t$(t){const{application:s,fetchApplication:n,showApproveModal:r,setShowApproveModal:a,approvalRemark:l,setApprovalRemark:c,setApprovalFile:d,isApproving:m,handleApprove:x,showOnboardModal:f,setShowOnboardModal:h,isOnboarding:g,setIsOnboarding:u,showRejectModal:j,setShowRejectModal:p,rejectionReason:y,setRejectionReason:N,isRejecting:S,handleReject:A,showScheduleModal:w,setShowScheduleModal:E,showCancelInterviewModal:T,setShowCancelInterviewModal:C,setInterviewIdToCancel:L,isCancellingInterview:$,handleConfirmCancelInterview:_,interviewType:R,setInterviewType:P,interviewMode:M,setInterviewMode:q,interviewDate:K,setInterviewDate:Z,meetingLink:W,setMeetingLink:U,location:F,setLocation:B,isInterviewCompleted:D,isInterviewActive:O,users:z,selectedInterviewerId:G,setSelectedInterviewerId:Y,handleAddInterviewer:V,scheduledInterviewParticipants:X,handleRemoveInterviewer:ne,isScheduling:oe,handleScheduleInterview:re,showAssignArchitectureModal:ge,setShowAssignArchitectureModal:ve,architectureLeadId:Se,setArchitectureLeadId:We,isAssigningArchitecture:Ce,handleAssignArchitecture:fe,showArchitectureStatusModal:Ye,setShowArchitectureStatusModal:be,architectureStatus:Pe,setArchitectureStatus:ke,architectureRemarks:qe,setArchitectureRemarks:Ve,isUpdatingArchitecture:dt,handleUpdateArchitectureStatus:xt}=t,ye=le=>{var Qe,rt;return(le==null?void 0:le.__stageRole)||((Qe=le==null?void 0:le.role)==null?void 0:Qe.roleName)||((rt=le==null?void 0:le.role)==null?void 0:rt.roleCode)||(le==null?void 0:le.roleCode)||(le==null?void 0:le.role)||"Panelist"};return e.jsxs(e.Fragment,{children:[e.jsx(os,{open:r,onOpenChange:a,children:e.jsxs(ls,{"data-testid":"onboarding-approve-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Approve Application"}),e.jsx(vs,{children:"Provide approval remarks and optionally attach supporting documents."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(ce,{children:["Remark ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(Fs,{placeholder:"Enter approval remarks...",value:l,onChange:le=>c(le.target.value),className:"mt-2",rows:4,"data-testid":"onboarding-approve-remark-textarea"})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Attach File (Optional)"}),e.jsx(ot,{type:"file",className:"mt-2",onChange:le=>d(le.target.files?le.target.files[0]:null),"data-testid":"onboarding-approve-file-input"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>a(!1),disabled:m,"data-testid":"onboarding-approve-cancel-button",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-green-600 hover:bg-green-700",onClick:x,disabled:m,"data-testid":"onboarding-approve-submit-button",children:m?e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}),"Approving..."]}):"Submit Approval"})]})]})]})}),e.jsx(os,{open:f,onOpenChange:h,children:e.jsxs(ls,{className:"max-w-md","data-testid":"onboarding-onboard-modal",children:[e.jsxs(ms,{children:[e.jsx("div",{className:"mx-auto w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mb-4",children:e.jsx(Ys,{className:"w-8 h-8 text-green-600"})}),e.jsx(us,{className:"text-center text-xl font-bold",children:"Finalize Onboarding"}),e.jsxs(vs,{className:"text-center pt-2",children:["You are about to officially onboard ",e.jsx("span",{className:"font-semibold text-slate-900",children:s.name})," as a Royal Enfield dealer."]})]}),e.jsxs("div",{className:"bg-slate-50 p-4 rounded-lg border border-slate-200 mt-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-1 bg-green-500 rounded-full p-0.5",children:e.jsx(Bn,{className:"w-3 h-3 text-white"})}),e.jsx("p",{className:"text-sm text-slate-600",children:"Official dealer profile will be created."})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-1 bg-green-500 rounded-full p-0.5",children:e.jsx(Bn,{className:"w-3 h-3 text-white"})}),e.jsxs("p",{className:"text-sm text-slate-600",children:["User account will be activated with role ",e.jsx("span",{className:"font-medium text-slate-900",children:"Dealer"}),"."]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-1 bg-green-500 rounded-full p-0.5",children:e.jsx(Bn,{className:"w-3 h-3 text-white"})}),e.jsx("p",{className:"text-sm text-slate-600",children:"Primary outlet will be registered in the system."})]})]}),e.jsxs("div",{className:"mt-6 flex flex-col gap-3",children:[e.jsx(se,{className:"w-full bg-green-600 hover:bg-green-700 h-11 text-lg font-semibold shadow-lg shadow-green-100","data-testid":"onboarding-onboard-confirm-button",onClick:async()=>{u(!0);try{await ds.createDealer({applicationId:s.id}),ee.success("Dealer profile and login account created successfully!"),h(!1),n()}catch{ee.error("Failed to create dealer profile")}finally{u(!1)}},disabled:g,children:g?e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"w-5 h-5 mr-2 animate-spin"}),"Processing Onboarding..."]}):"Confirm & Onboard Dealer"}),e.jsx(se,{variant:"ghost",className:"w-full text-slate-500 hover:text-slate-700",onClick:()=>h(!1),disabled:g,"data-testid":"onboarding-onboard-cancel-button",children:"Cancel"})]})]})}),e.jsx(os,{open:j,onOpenChange:p,children:e.jsxs(ls,{"data-testid":"onboarding-reject-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Reject Application"}),e.jsx(vs,{children:"Please provide a clear reason for rejecting this application."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(ce,{children:["Reason for Rejection ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(Fs,{placeholder:"Enter rejection reason...",value:y,onChange:le=>N(le.target.value),className:"mt-2",rows:4,"data-testid":"onboarding-reject-remark-textarea"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>p(!1),disabled:S,"data-testid":"onboarding-reject-cancel-button",children:"Cancel"}),e.jsx(se,{variant:"destructive",className:"flex-1",onClick:A,disabled:S,"data-testid":"onboarding-reject-submit-button",children:S?e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}),"Rejecting..."]}):"Confirm Rejection"})]})]})]})}),e.jsx(os,{open:w,onOpenChange:E,children:e.jsxs(ls,{"data-testid":"onboarding-schedule-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Schedule Interview"}),e.jsx(vs,{children:"Set up an interview session with the applicant and relevant team members."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Interview Type"}),e.jsxs(wt,{value:R,onValueChange:P,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-schedule-type-select",children:e.jsx(St,{placeholder:"Select interview type"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"level1",disabled:D(1)||O(1),children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("span",{children:"Level 1"}),D(1)&&e.jsx(Ys,{className:"w-4 h-4 text-green-500 ml-2 inline"}),O(1)&&e.jsx(Js,{className:"w-4 h-4 text-amber-500 ml-2 inline"})]})}),e.jsx(_e,{value:"level2",disabled:!D(1)||D(2)||O(2),children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("span",{children:"Level 2"}),!D(1)&&e.jsx("span",{className:"text-[10px] text-slate-400 ml-2",children:"(Prerequisite: L1)"}),D(2)&&e.jsx(Ys,{className:"w-4 h-4 text-green-500 ml-2 inline"}),O(2)&&e.jsx(Js,{className:"w-4 h-4 text-amber-500 ml-2 inline"})]})}),e.jsx(_e,{value:"level3",disabled:!D(2)||D(3)||O(3),children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("span",{children:"Level 3"}),!D(2)&&e.jsx("span",{className:"text-[10px] text-slate-400 ml-2",children:"(Prerequisite: L2)"}),D(3)&&e.jsx(Ys,{className:"w-4 h-4 text-green-500 ml-2 inline"}),O(3)&&e.jsx(Js,{className:"w-4 h-4 text-amber-500 ml-2 inline"})]})})]})]})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Interview Mode ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:M,onValueChange:q,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-schedule-mode-select",children:e.jsx(St,{placeholder:"Select interview mode"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"virtual",children:"Virtual"}),e.jsx(_e,{value:"physical",children:"Physical"})]})]})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Date & Time ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{type:"datetime-local",className:"mt-2",value:K,onChange:le=>Z(le.target.value),"data-testid":"onboarding-schedule-date-input"})]}),M==="virtual"&&e.jsxs("div",{children:[e.jsx(ce,{children:"Meeting Link"}),e.jsx(ot,{placeholder:"https://meet.google.com/...",className:"mt-2",value:W,onChange:le=>U(le.target.value),"data-testid":"onboarding-schedule-link-input"})]}),M==="physical"&&e.jsxs("div",{children:[e.jsx(ce,{children:"Location"}),e.jsx(ot,{placeholder:"Enter interview location address",className:"mt-2",value:F,onChange:le=>B(le.target.value),"data-testid":"onboarding-schedule-location-input"})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Interviewers ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsxs(wt,{value:G,onValueChange:Y,children:[e.jsx(Ct,{className:"flex-1","data-testid":"onboarding-schedule-interviewer-select",children:e.jsx(St,{placeholder:"Select interviewer"})}),e.jsx(At,{children:z.map(le=>{var Qe;return e.jsxs(_e,{value:le.id,children:[le.fullName||le.name," (",((Qe=le.role)==null?void 0:Qe.roleName)||le.roleCode,")"]},le.id)})})]}),e.jsx(se,{onClick:V,type:"button",variant:"secondary","data-testid":"onboarding-schedule-add-interviewer-button",children:"Add"})]}),X.length>0&&e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsx(ce,{className:"text-xs text-muted-foreground",children:"Selected Interviewers:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:X.map(le=>e.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-2 py-1 rounded text-sm","data-testid":`onboarding-schedule-participant-${le.id}`,children:[e.jsx("span",{children:le.fullName||le.name||"Unknown"}),e.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",ye(le),")"]}),e.jsx("button",{onClick:()=>ne(le.id),className:"text-muted-foreground hover:text-destructive","data-testid":`onboarding-schedule-remove-participant-${le.id}`,children:"×"})]},le.id))})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>E(!1),disabled:oe,"data-testid":"onboarding-schedule-cancel-button",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-amber-600 hover:bg-amber-700",onClick:re,disabled:oe,"data-testid":"onboarding-schedule-submit-button",children:oe?"Scheduling...":"Schedule"})]})]})]})}),e.jsx(os,{open:T,onOpenChange:le=>{C(le),le||L("")},children:e.jsxs(ls,{"data-testid":"onboarding-cancel-interview-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Cancel Interview"}),e.jsx(vs,{children:"Are you sure you want to cancel this interview?"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>{C(!1),L("")},disabled:$,"data-testid":"onboarding-cancel-interview-close",children:"No"}),e.jsx(se,{variant:"destructive",className:"flex-1",onClick:_,disabled:$,"data-testid":"onboarding-cancel-interview-confirm",children:$?"Cancelling...":"Yes, Cancel"})]})]})}),e.jsx(os,{open:ge,onOpenChange:ve,children:e.jsxs(ls,{"data-testid":"onboarding-architecture-assign-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Assign Architecture Team"}),e.jsx(vs,{children:"Select an architecture team lead for site planning and blueprints."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(ce,{children:["Select Architecture Lead ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:Se,onValueChange:We,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-architecture-lead-select",children:e.jsx(St,{placeholder:"Search users..."})}),e.jsxs(At,{children:[z.filter(le=>{var Qe;return le.roleCode==="ARCHITECTURE"||((Qe=le.role)==null?void 0:Qe.roleCode)==="ARCHITECTURE"||le.role==="Architecture"||le.role==="Architecture Team"}).map(le=>e.jsxs(_e,{value:le.id,children:[le.fullName," (",le.email,")"]},le.id)),z.filter(le=>{var Qe;return le.roleCode==="ARCHITECTURE"||((Qe=le.role)==null?void 0:Qe.roleCode)==="ARCHITECTURE"||le.role==="Architecture"||le.role==="Architecture Team"}).length===0&&z.map(le=>e.jsxs(_e,{value:le.id,children:[le.fullName," (",le.roleCode||le.role,")"]},le.id))]})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>ve(!1),disabled:Ce,"data-testid":"onboarding-architecture-assign-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-blue-600 hover:bg-blue-700",onClick:fe,disabled:Ce,"data-testid":"onboarding-architecture-assign-submit",children:Ce?"Assigning...":"Assign Team"})]})]})]})}),e.jsx(os,{open:Ye,onOpenChange:be,children:e.jsxs(ls,{"data-testid":"onboarding-architecture-status-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Update Architecture Status"}),e.jsx(vs,{children:"Mark the architectural work as completed and optionally add remarks."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(ce,{children:["Status ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:Pe,onValueChange:ke,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-architecture-status-select",children:e.jsx(St,{placeholder:"Select status"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"COMPLETED",children:"Completed"}),e.jsx(_e,{value:"REJECTED",children:"Rejected / Needs Revision"})]})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Remarks (Optional)"}),e.jsx(Fs,{placeholder:"Enter any planning or site-visit remarks...",value:qe,onChange:le=>Ve(le.target.value),className:"mt-2",rows:4,"data-testid":"onboarding-architecture-remarks-textarea"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>be(!1),disabled:dt,"data-testid":"onboarding-architecture-status-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-blue-600 hover:bg-blue-700",onClick:xt,disabled:dt,"data-testid":"onboarding-architecture-status-submit",children:dt?"Updating...":"Update Status"})]})]})]})})]})}function s$(t){var Fe,Q,pe,Ne,Ee,it,st,bt;const{application:s,ktCriteria:n,l2Fields:r,l3Fields:a,showKTMatrixModal:l,setShowKTMatrixModal:c,ktMatrixSelectedValues:d,handleKTMatrixChange:m,ktMatrixRemarks:x,setKtMatrixRemarks:f,ktMatrixRecommendation:h,setKtMatrixRecommendation:g,calculateKTScore:u,handleSubmitKTMatrix:j,isSubmittingKT:p,showLevel2FeedbackModal:y,setShowLevel2FeedbackModal:N,level2Feedback:S,handleLevel2Change:A,level2Recommendation:w,setLevel2Recommendation:E,handleSubmitLevel2Feedback:T,isSubmittingLevel2:C,showFeedbackDetailsModal:L,setShowFeedbackDetailsModal:$,selectedEvaluationForView:_,selectedInterviewForFeedback:R,showLevel3FeedbackModal:P,setShowLevel3FeedbackModal:M,level3Feedback:q,handleLevel3Change:K,level3Recommendation:Z,setLevel3Recommendation:W,handleSubmitLevel3Feedback:U,isSubmittingLevel3:F,showDocumentsModal:B,setShowDocumentsModal:D,showUploadForm:O,setShowUploadForm:z,selectedStage:G,getDocumentsForStage:Y,setPreviewDoc:V,setShowPreviewModal:X,flattenedStages:ne,setSelectedStage:oe,uploadDocType:re,setUploadDocType:ge,setUploadFile:ve,isUploading:Se,handleUpload:We,uploadFile:Ce,documentConfigs:fe,showPreviewModal:Ye,previewDoc:be,showFddFinalizeModal:Pe,setShowFddFinalizeModal:ke,currentUser:qe,fddAuditRecommendation:Ve,setFddAuditRecommendation:dt,fddAuditFindings:xt,setFddAuditFindings:ye,isFinalizingFdd:le,setIsFinalizingFdd:Qe,fetchApplication:rt,showFddFlagModal:Gt,setShowFddFlagModal:Rt,isFddFlagging:Re,setIsFddFlagging:Qt,showFirmTypeModal:qt,setShowFirmTypeModal:ws,tempFirmType:Ps,setTempFirmType:ns,updatingFirmType:Cs,handleUpdateFirmType:Bs}=t,Ft=R!=null&&R.scheduleDate?new Date(R.scheduleDate).toISOString().split("T")[0]:"",ie=(qe==null?void 0:qe.fullName)||(qe==null?void 0:qe.name)||"";return e.jsxs(e.Fragment,{children:[e.jsx(os,{open:l,onOpenChange:c,children:e.jsxs(ls,{className:"flex min-h-0 max-h-[90vh] w-[calc(100%-2rem)] max-w-lg flex-col gap-0 overflow-hidden p-0 sm:max-w-lg","data-testid":"onboarding-kt-matrix-modal",children:[e.jsxs(ms,{className:"shrink-0 space-y-2 border-b px-5 py-4 text-left",children:[e.jsx(us,{className:"text-base",children:"KT matrix"}),e.jsxs(vs,{className:"text-sm leading-relaxed",children:["Level 1 interview · ",s.name,e.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:[Object.keys(d).length," of ",n.length," criteria answered"]})]})]}),e.jsx("div",{className:"custom-scrollbar-slim min-h-0 flex-1 overflow-y-auto px-5 py-5",children:e.jsxs("div",{className:"space-y-6",children:[n.length===0&&e.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800",children:"KT Matrix configuration is not available. Configure it in Master > Interview Configurations."}),n.map((Ue,It)=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{htmlFor:`kt-matrix-${It}`,className:"block text-sm font-medium leading-relaxed text-foreground",children:[e.jsxs("span",{className:"text-muted-foreground",children:[It+1,"."]})," ",Ue.name," ",e.jsx("span",{className:"text-red-500",children:"*"})," ",e.jsxs("span",{className:"font-normal text-muted-foreground",children:["(",Ue.weight,"%)"]})]}),e.jsxs(wt,{value:d[Ue.name]??void 0,onValueChange:ut=>{const yt=Ue.options.find(kt=>kt.value===ut);yt&&m(Ue.name,yt.value,yt.score)},children:[e.jsx(Ct,{id:`kt-matrix-${It}`,className:"h-10 w-full text-left text-sm font-normal","data-testid":`onboarding-kt-matrix-select-${It}`,children:e.jsx(St,{placeholder:"Choose an option…"})}),e.jsx(At,{position:"popper",className:"max-h-72 w-[var(--radix-select-trigger-width)]",children:Ue.options.map(ut=>e.jsxs(_e,{value:ut.value,className:"py-2.5 text-sm leading-snug","data-testid":`onboarding-kt-matrix-option-${It}-${ut.value}`,children:[ut.label," ",e.jsxs("span",{className:"text-muted-foreground",children:["(",ut.score,")"]})]},ut.value))})]})]},Ue.name)),e.jsxs("div",{className:"space-y-2 border-t border-border pt-6",children:[e.jsxs(ce,{htmlFor:"kt-matrix-remarks",className:"text-sm font-medium",children:["Remarks ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(Fs,{id:"kt-matrix-remarks",placeholder:"Enter remarks...",className:"min-h-[96px] resize-y text-sm leading-relaxed",value:x,onChange:Ue=>f(Ue.target.value),"data-testid":"onboarding-kt-matrix-remarks-textarea"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"text-sm font-medium",children:["Recommendation ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:h,onValueChange:g,children:[e.jsx(Ct,{"data-testid":"onboarding-kt-matrix-recommendation-select",children:e.jsx(St,{placeholder:"Select recommendation"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"Approve",children:"Approve"}),e.jsx(_e,{value:"Reject",children:"Reject"}),e.jsx(_e,{value:"Hold",children:"Hold"})]})]})]})]})}),e.jsxs("div",{className:"flex shrink-0 flex-col gap-4 border-t px-5 py-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Weighted total ",e.jsx("span",{className:"font-semibold tabular-nums text-foreground","data-testid":"onboarding-kt-matrix-total-score",children:u()}),e.jsx("span",{className:"text-muted-foreground",children:" / 100"})]}),e.jsxs("div",{className:"flex gap-2 sm:shrink-0",children:[e.jsx(se,{variant:"outline",onClick:()=>c(!1),"data-testid":"onboarding-kt-matrix-cancel",children:"Cancel"}),e.jsx(se,{onClick:j,disabled:p||n.length===0||Object.keys(d).lengthA("overallScore",Ue),children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-level2-overall-score-select",children:e.jsx(St,{placeholder:"Select score"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"10",children:"Outstanding (9-10)"}),e.jsx(_e,{value:"8",children:"Excellent (7-8)"}),e.jsx(_e,{value:"6",children:"Good (5-6)"}),e.jsx(_e,{value:"4",children:"Average (3-4)"}),e.jsx(_e,{value:"2",children:"Below Average (1-2)"})]})]})]}),e.jsx(zd,{}),r.length===0&&e.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800",children:"Level 2 feedback configuration is not available. Configure it in Master > Interview Configurations."}),(r||[]).map((Ue,It)=>e.jsxs("div",{children:[e.jsxs(ce,{children:[Ue.label,Ue.isRequired&&e.jsx("span",{className:"text-red-500",children:"*"})]}),Ue.type==="select"?e.jsxs(wt,{value:S[Ue.itemKey]||"",onValueChange:ut=>A(Ue.itemKey,ut),children:[e.jsx(Ct,{className:"mt-2",children:e.jsx(St,{placeholder:`Select ${Ue.label}...`})}),e.jsx(At,{children:(Ue.options||[]).map((ut,yt)=>e.jsx(_e,{value:ut.optionValue||ut.value,children:ut.optionLabel||ut.label},yt))})]}):Ue.type==="number"?e.jsx(ot,{type:"number",className:"mt-2",value:S[Ue.itemKey]||"",onChange:ut=>A(Ue.itemKey,ut.target.value)}):e.jsx(Fs,{placeholder:`Enter ${Ue.label.toLowerCase()}...`,className:"mt-2",rows:3,value:S[Ue.itemKey]||"",onChange:ut=>A(Ue.itemKey,ut.target.value)})]},Ue.itemKey||It)),e.jsxs("div",{children:[e.jsxs(ce,{children:["Recommendation ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:w,onValueChange:E,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-level2-recommendation-select",children:e.jsx(St,{placeholder:"Select recommendation"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"Approve",children:"Approve"}),e.jsx(_e,{value:"Reject",children:"Reject"}),e.jsx(_e,{value:"Hold",children:"Hold"})]})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>N(!1),"data-testid":"onboarding-level2-feedback-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-black hover:bg-zinc-800 text-white",onClick:T,disabled:C||r.length===0,"data-testid":"onboarding-level2-feedback-submit",children:C?"Submitting...":"Submit Feedback"})]})]})]})}),e.jsx(os,{open:L,onOpenChange:$,children:e.jsxs(ls,{className:"max-w-2xl max-h-[90vh] overflow-y-auto","data-testid":"onboarding-feedback-details-modal",children:[e.jsx(ms,{children:e.jsx(us,{children:"Interview Feedback Details"})}),_&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 bg-slate-50 p-4 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-slate-500",children:"Interviewer"}),e.jsx("p",{className:"font-semibold","data-testid":"onboarding-feedback-details-interviewer",children:(Fe=_.evaluator)==null?void 0:Fe.fullName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-slate-500",children:"Role"}),e.jsx("p",{"data-testid":"onboarding-feedback-details-role",children:((pe=(Q=_.evaluator)==null?void 0:Q.role)==null?void 0:pe.roleName)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-slate-500",children:((Ne=_.interview)==null?void 0:Ne.level)===1?"Score (KT Matrix)":"Overall Score"}),e.jsx("p",{className:"font-bold text-lg","data-testid":"onboarding-feedback-details-score",children:_.ktMatrixScore?`${_.ktMatrixScore}/${((Ee=_.interview)==null?void 0:Ee.level)===1?"100":"10"}`:"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-slate-500",children:"Recommendation"}),e.jsx(Ae,{variant:(it=_.recommendation)!=null&&it.toLowerCase().includes("reject")?"destructive":(st=_.recommendation)!=null&&st.toLowerCase().includes("hold")?"secondary":"default","data-testid":"onboarding-feedback-details-recommendation",children:_.recommendation||"N/A"})]})]}),e.jsx(zd,{}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-3",children:"Detailed Feedback"}),((bt=_.feedbackDetails)==null?void 0:bt.length)>0?e.jsx("div",{className:"space-y-4",children:_.feedbackDetails.map((Ue,It)=>e.jsxs("div",{className:"border-b last:border-0 pb-3 last:pb-0","data-testid":`onboarding-feedback-detail-item-${It}`,children:[e.jsx("p",{className:"font-medium text-slate-900",children:Ue.feedbackType}),e.jsx("p",{className:"text-slate-700 mt-1 whitespace-pre-wrap text-sm",children:Ue.comments})]},It))}):e.jsx("p",{className:"text-slate-500 italic",children:"No detailed feedback available."})]})]})]})}),e.jsx(os,{open:P,onOpenChange:M,children:e.jsxs(ls,{className:"max-w-2xl max-h-[90vh] overflow-y-auto","data-testid":"onboarding-level3-feedback-modal",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Level 3 Interview Feedback"}),e.jsx(vs,{children:"Provide detailed feedback from the Level 3 interview (NBH + DD-Head evaluation)."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(ce,{children:["Interview Date ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{type:"date",className:"mt-2",value:q.interviewDate||Ft,disabled:!0})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Interviewer Name ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{placeholder:"Enter your name",className:"mt-2",value:q.interviewerName||ie,disabled:!0})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Overall Performance Score ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:q.overallScore,onValueChange:Ue=>K("overallScore",Ue),children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-level3-overall-score-select",children:e.jsx(St,{placeholder:"Select score"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"10",children:"Outstanding (9-10)"}),e.jsx(_e,{value:"8",children:"Excellent (7-8)"}),e.jsx(_e,{value:"6",children:"Good (5-6)"}),e.jsx(_e,{value:"4",children:"Average (3-4)"}),e.jsx(_e,{value:"2",children:"Below Average (1-2)"})]})]})]}),e.jsx(zd,{}),a.length===0&&e.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800",children:"Level 3 feedback configuration is not available. Configure it in Master > Interview Configurations."}),(a||[]).map((Ue,It)=>e.jsxs("div",{children:[e.jsxs(ce,{children:[Ue.label,Ue.isRequired&&e.jsx("span",{className:"text-red-500",children:"*"})]}),Ue.type==="select"?e.jsxs(wt,{value:q[Ue.itemKey]||"",onValueChange:ut=>K(Ue.itemKey,ut),children:[e.jsx(Ct,{className:"mt-2",children:e.jsx(St,{placeholder:`Select ${Ue.label}...`})}),e.jsx(At,{children:(Ue.options||[]).map((ut,yt)=>e.jsx(_e,{value:ut.optionValue||ut.value,children:ut.optionLabel||ut.label},yt))})]}):Ue.type==="number"?e.jsx(ot,{type:"number",className:"mt-2",value:q[Ue.itemKey]||"",onChange:ut=>K(Ue.itemKey,ut.target.value)}):e.jsx(Fs,{placeholder:`Enter ${Ue.label.toLowerCase()}...`,className:"mt-2",rows:3,value:q[Ue.itemKey]||"",onChange:ut=>K(Ue.itemKey,ut.target.value)})]},Ue.itemKey||It)),e.jsxs("div",{children:[e.jsxs(ce,{children:["Recommendation ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:Z,onValueChange:W,children:[e.jsx(Ct,{className:"mt-2","data-testid":"onboarding-level3-recommendation-select",children:e.jsx(St,{placeholder:"Select recommendation"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"Approve",children:"Approve"}),e.jsx(_e,{value:"Reject",children:"Reject"}),e.jsx(_e,{value:"Hold",children:"Hold"})]})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>M(!1),"data-testid":"onboarding-level3-feedback-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-black hover:bg-zinc-800 text-white",onClick:U,disabled:F||a.length===0,"data-testid":"onboarding-level3-feedback-submit",children:F?"Submitting...":"Submit Feedback"})]})]})]})}),e.jsx(os,{open:B,onOpenChange:Ue=>{D(Ue),Ue||z(!1)},children:e.jsxs(ls,{className:"max-w-[95vw] sm:max-w-2xl md:max-w-3xl lg:max-w-4xl max-h-[90vh] overflow-hidden flex flex-col p-4 sm:p-6","data-testid":"onboarding-documents-modal",children:[e.jsxs(ms,{className:"pb-4",children:[e.jsxs(us,{className:"text-xl font-bold flex items-center gap-2",children:[e.jsx(fs,{className:"w-5 h-5 text-amber-600"}),"Documents - ",G||"General"]}),e.jsx(vs,{className:"text-slate-500",children:"View and manage documents uploaded for this stage."})]}),O?e.jsxs("div",{className:"space-y-6 py-4","data-testid":"onboarding-documents-upload-form",children:[e.jsxs("div",{className:"grid gap-6 bg-slate-50/50 p-4 sm:p-6 rounded-2xl border border-slate-200",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"text-slate-700 font-semibold px-1",children:["Stage context ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:G||"null",onValueChange:Ue=>oe(Ue==="null"?null:Ue),children:[e.jsx(Ct,{className:"bg-white border-slate-200 h-11 rounded-xl focus:ring-amber-500 shadow-sm","data-testid":"onboarding-documents-stage-select",children:e.jsx(St,{placeholder:"Select stage"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"null",children:"General / No Stage"}),ne.map((Ue,It)=>e.jsx(_e,{value:Ue.name,children:Ue.parentBranch?`${Ue.parentBranch}: ${Ue.name}`:Ue.name},`${Ue.name}-${It}`))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"text-slate-700 font-semibold px-1",children:["Document Type ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:re,onValueChange:ge,children:[e.jsx(Ct,{className:"bg-white border-slate-200 h-11 rounded-xl focus:ring-amber-500 shadow-sm","data-testid":"onboarding-documents-type-select",children:e.jsx(St,{placeholder:"Select type"})}),e.jsx(At,{children:(()=>{const Ue=["Other"],It=fe.filter(yt=>{var Pt;const kt=(Pt=yt.stageCode)==null?void 0:Pt.trim(),Le=(G||"General").trim();return!!(kt===Le||Le.startsWith("EOR:")&&kt==="EOR"||!G&&kt==="General")});let ut=[];if(It.length>0?ut=It.map(yt=>yt.documentType):!G||G==="General"?ut=["PAN Card","GST Certificate","Aadhaar Card","Passport Size Photograph","Partnership Deed","LLP Agreement","Certificate of Incorporation","Board Resolution","Firm Registration Certificate","Cancelled Check","Bank Statement","Other"]:G!=null&&G.toLowerCase().includes("architecture")?ut=["Architecture Blueprint","Site Plan","Proposed Site City Map","Site Readiness Report","Architecture Completion Certificate","Other"]:G!=null&&G.toLowerCase().includes("fdd")?ut=["FDD Final Audit Report","Bank Statement","Income Tax Returns (ITR)","CIBIL Report","Other"]:ut=Ue,G!=null&&G.startsWith("EOR: ")){const yt=G.replace("EOR: ","");ut.includes(yt)||(ut=[yt,...ut])}return Array.from(new Set(ut)).map((yt,kt)=>e.jsx(_e,{value:yt,"data-testid":`onboarding-documents-type-option-${kt}`,children:yt},`${yt}-${kt}`))})()})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"text-slate-700 font-semibold px-1",children:["Select File ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{type:"file",className:"bg-white border-slate-200 h-12 rounded-xl focus:ring-amber-500 shadow-sm file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-amber-50 file:text-amber-700 hover:file:bg-amber-100 cursor-pointer",onChange:Ue=>ve(Ue.target.files?Ue.target.files[0]:null),"data-testid":"onboarding-documents-file-input"})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-4",children:[e.jsx(se,{className:"flex-1 order-2 sm:order-1 py-3 sm:py-5 rounded-xl border-slate-200 font-semibold text-slate-600 hover:bg-slate-50",variant:"outline",onClick:()=>z(!1),disabled:Se,"data-testid":"onboarding-documents-upload-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 order-1 sm:order-2 bg-amber-600 hover:bg-amber-700 text-white font-bold py-3 sm:py-5 rounded-xl shadow-lg shadow-amber-600/15 transition-all hover:scale-[1.01] active:scale-[0.99]",onClick:async()=>{await We(),z(!1)},disabled:!Ce||!re||Se,"data-testid":"onboarding-documents-upload-submit",children:Se?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Uploading..."]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Dr,{className:"w-5 h-5"}),"Confirm Upload"]})})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 space-y-4",children:[Y(G||"").length>0?e.jsx("div",{className:"custom-scrollbar-x-slim flex-1 overflow-auto border rounded-lg border-slate-200","data-testid":"onboarding-documents-table-container",children:e.jsxs(ks,{className:"w-full table-auto",children:[e.jsx(Rs,{className:"bg-slate-50/80 sticky top-0 z-10",children:e.jsxs(ct,{className:"hover:bg-transparent border-b",children:[e.jsx(me,{className:"w-[45%] min-w-[150px] font-semibold text-slate-900 py-3",children:"Document Name"}),e.jsx(me,{className:"w-[15%] min-w-[100px] font-semibold text-slate-900 py-3",children:"Type"}),e.jsx(me,{className:"w-[15%] min-w-[100px] font-semibold text-slate-900 py-3",children:"Upload Date"}),e.jsx(me,{className:"w-[15%] min-w-[140px] font-semibold text-slate-900 py-3",children:"Uploaded By"}),e.jsx(me,{className:"text-right w-[10%] min-w-[80px] font-semibold text-slate-900 py-3",children:"Actions"})]})}),e.jsx(Es,{children:Y(G||"").map((Ue,It)=>{var ut,yt;return e.jsxs(ct,{className:"hover:bg-slate-50/50 transition-colors","data-testid":`onboarding-document-row-${It}`,children:[e.jsx(de,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(fs,{className:"w-4 h-4 text-slate-400 shrink-0"}),e.jsx("span",{className:"truncate font-medium text-slate-700",title:Ue.fileName,"data-testid":`onboarding-document-name-${It}`,children:Ue.fileName})]})}),e.jsx(de,{className:"py-3",children:e.jsx(Ae,{variant:"outline",className:"capitalize whitespace-nowrap font-normal border-slate-200 bg-white","data-testid":`onboarding-document-type-${It}`,children:((ut=Ue.documentType)==null?void 0:ut.toLowerCase())||"Other"})}),e.jsx(de,{className:"py-3 whitespace-nowrap text-slate-600",children:Ht(Ue.createdAt)}),e.jsx(de,{className:"py-3 text-slate-600",children:((yt=Ue.uploader)==null?void 0:yt.fullName)||(Ue.uploadedBy?"System User":"Applicant")}),e.jsx(de,{className:"text-right py-3",children:e.jsxs("div",{className:"flex gap-1 justify-end",children:[e.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 rounded-full",onClick:()=>{V(Ue),X(!0)},"data-testid":`onboarding-document-preview-${It}`,children:e.jsx(nn,{className:"w-4 h-4"})}),e.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-amber-600 hover:bg-amber-50 rounded-full",onClick:()=>{window.open(`https://dealeronboarding-uat.royalenfield.com/api/${Ue.filePath}`,"_blank")},"data-testid":`onboarding-document-download-${It}`,children:e.jsx(Ni,{className:"w-4 h-4"})})]})})]},Ue.id)})})]})}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-center border rounded-lg bg-slate-50/30","data-testid":"onboarding-documents-empty",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-slate-100 flex items-center justify-center mb-4",children:e.jsx(fs,{className:"w-8 h-8 text-slate-300"})}),e.jsx("h3",{className:"text-slate-900 font-semibold mb-2",children:"No Documents Found"}),e.jsx("p",{className:"text-slate-600 text-sm max-w-[250px]",children:"No documents have been uploaded for this stage yet."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-2 mt-auto",children:[e.jsxs(se,{className:"flex-1 bg-amber-600 hover:bg-amber-700 text-white font-bold py-3 sm:py-5 rounded-xl shadow-lg shadow-amber-600/15 transition-all hover:scale-[1.01] active:scale-[0.99]",onClick:()=>z(!0),"data-testid":"onboarding-documents-upload-button",children:[e.jsx(Dr,{className:"w-5 h-5 mr-3"}),"Upload Document"]}),e.jsx(se,{variant:"outline",className:"flex-1 sm:flex-none py-3 sm:py-5 px-8 rounded-xl border-slate-200 font-semibold text-slate-600 hover:bg-slate-50",onClick:()=>D(!1),"data-testid":"onboarding-documents-close-button",children:"Close"})]})]})]})}),e.jsx(Gl,{isOpen:Ye,onClose:()=>X(!1),document:be}),e.jsx(os,{open:Pe,onOpenChange:ke,children:e.jsxs(ls,{className:"max-w-md p-0 overflow-hidden border-none shadow-2xl rounded-3xl","data-testid":"onboarding-fdd-finalize-modal",children:[e.jsxs("div",{className:"bg-slate-950 p-8 flex items-center justify-center relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-600/20 to-transparent"}),e.jsx("div",{className:"w-20 h-20 bg-amber-600/20 rounded-full flex items-center justify-center animate-pulse relative z-10 shadow-[0_0_40px_rgba(245,158,11,0.2)]",children:e.jsx(Fl,{className:"w-10 h-10 text-amber-500"})})]}),e.jsxs("div",{className:"p-8 space-y-6 bg-white",children:[e.jsxs(ms,{children:[e.jsx(us,{className:"text-2xl font-black text-slate-900 text-center tracking-tight",children:"Finalize FDD Audit"}),e.jsxs(vs,{className:"text-slate-500 text-center pt-2 leading-relaxed text-sm font-medium",children:["You are about to submit your final findings. This action will ",e.jsx("span",{className:"font-bold text-slate-900 underline decoration-amber-500 decoration-2",children:"lock the audit session"})," and trigger the LOI approval workflow."]})]}),e.jsxs("div",{className:"space-y-4",children:[(qe==null?void 0:qe.role)!=="FDD"&&(qe==null?void 0:qe.roleCode)!=="FDD"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:["Auditor Recommendation ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("div",{className:"flex gap-2",children:["Recommended","Qualified with Observations","Not Recommended"].map(Ue=>e.jsx(se,{variant:Ve===Ue?"default":"outline",className:_t("flex-1 h-10 font-bold text-[9px] uppercase tracking-wider rounded-xl transition-all",Ve===Ue&&Ue==="Recommended"&&"bg-emerald-600 hover:bg-emerald-700",Ve===Ue&&Ue==="Qualified with Observations"&&"bg-amber-500 hover:bg-amber-600",Ve===Ue&&Ue==="Not Recommended"&&"bg-red-600 hover:bg-red-700"),onClick:()=>dt(Ue),"data-testid":`onboarding-fdd-recommendation-${Ue.replace(/\s+/g,"-").toLowerCase()}`,children:Ue},Ue))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{className:"text-[10px] font-black uppercase tracking-widest text-slate-400",children:"Findings Summary"}),e.jsx(Fs,{placeholder:"Summarize key financial findings or discrepancies...",className:"min-h-[100px] rounded-xl border-slate-200 focus:ring-amber-500 text-sm",value:xt,onChange:Ue=>ye(Ue.target.value),"data-testid":"onboarding-fdd-findings-textarea"})]})]}),e.jsxs("div",{className:"bg-amber-50 p-4 rounded-2xl flex gap-3 border border-amber-100",children:[e.jsx(Xa,{className:"w-5 h-5 text-amber-600 shrink-0 mt-0.5"}),e.jsx("p",{className:"text-[11px] text-amber-800 font-medium italic",children:"Ensure the final PDF report is uploaded first. This satisfies the FDD statutory requirement."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-2",children:[e.jsx(se,{variant:"outline",className:"w-full sm:flex-1 h-12 rounded-2xl font-bold text-slate-600 hover:bg-slate-50 border-slate-200",onClick:()=>ke(!1),disabled:le,"data-testid":"onboarding-fdd-finalize-cancel",children:"Cancel"}),e.jsx(se,{className:"w-full sm:flex-1 h-12 rounded-2xl font-bold bg-slate-950 hover:bg-slate-900 text-white shadow-lg shadow-slate-200 transition-all active:scale-95 border-b-4 border-amber-500",disabled:le||!xt,"data-testid":"onboarding-fdd-finalize-submit",onClick:async()=>{try{Qe(!0),await ds.submitStageDecision({applicationId:s.id,stageCode:"FDD_VERIFICATION",decision:"Approved",remarks:(qe==null?void 0:qe.role)==="FDD"||(qe==null?void 0:qe.roleCode)==="FDD"?`Findings: ${xt}`:`[RECOMMENDATION: ${Ve}] +Findings: ${xt}`,nextStatus:"LOI In Progress",nextProgress:65}),ee.success("FDD Audit finalized and submitted."),ke(!1),rt()}catch{ee.error("Submission failed")}finally{Qe(!1)}},children:le?e.jsx(ss,{className:"w-5 h-5 animate-spin"}):"Confirm & Submit"})]})]})]})}),e.jsx(os,{open:Gt,onOpenChange:Rt,children:e.jsxs(ls,{className:"max-w-md p-0 overflow-hidden border-none shadow-2xl rounded-3xl","data-testid":"onboarding-fdd-flag-modal",children:[e.jsxs("div",{className:"bg-slate-950 p-8 flex items-center justify-center relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-600/20 to-transparent"}),e.jsx("div",{className:"w-20 h-20 bg-red-600/20 rounded-full flex items-center justify-center relative z-10 shadow-[0_0_40px_rgba(220,38,38,0.2)]",children:e.jsx(tb,{className:"w-10 h-10 text-red-500"})})]}),e.jsxs("div",{className:"p-8 space-y-6 bg-white text-center",children:[e.jsxs(ms,{children:[e.jsx(us,{className:"text-2xl font-black text-slate-900 tracking-tight",children:"Flag Non-Responsive"}),e.jsx(vs,{className:"text-slate-500 pt-2 leading-relaxed text-sm font-medium",children:"Are you sure you want to flag this applicant? This will notify the DD Admin that the audit cannot proceed due to applicant's non-cooperation."})]}),e.jsxs("div",{className:"bg-red-50 p-4 rounded-2xl flex gap-3 border border-red-100",children:[e.jsx(Gs,{className:"w-5 h-5 text-red-600 shrink-0 mt-0.5"}),e.jsx("p",{className:"text-[11px] text-red-800 text-left font-medium",children:'"Applicant is unresponsive to multiple queries and financial document requests."'})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-2",children:[e.jsx(se,{variant:"outline",className:"w-full sm:flex-1 h-12 rounded-2xl font-bold text-slate-600 hover:bg-slate-50 border-slate-200",onClick:()=>Rt(!1),disabled:Re,"data-testid":"onboarding-fdd-flag-cancel",children:"Go Back"}),e.jsx(se,{className:"w-full sm:flex-1 h-12 rounded-2xl font-bold bg-slate-950 hover:bg-slate-900 text-white shadow-lg shadow-slate-200 transition-all active:scale-95 border-b-4 border-red-600",disabled:Re,"data-testid":"onboarding-fdd-flag-submit",onClick:async()=>{try{Qt(!0),await ds.submitStageDecision({applicationId:s.id,stageCode:"FDD_VERIFICATION",decision:"Rejected",remarks:"Applicant is non-responsive to FDD queries."}),ee.error("Applicant flagged as non-responsive."),Rt(!1),rt()}catch{ee.error("Action failed")}finally{Qt(!1)}},children:Re?e.jsx(ss,{className:"w-5 h-5 animate-spin"}):"Confirm Flag"})]})]})]})}),e.jsx(os,{open:qt,onOpenChange:ws,children:e.jsxs(ls,{className:"max-w-md p-0 overflow-hidden rounded-3xl border-none shadow-2xl","data-testid":"onboarding-firm-type-modal",children:[e.jsxs("div",{className:"bg-amber-600 p-8 text-white",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-white/20 flex items-center justify-center mb-6 backdrop-blur-sm border border-white/30 shadow-inner",children:e.jsx(Ml,{className:"w-8 h-8 text-white"})}),e.jsx("h3",{className:"text-2xl font-black tracking-tight mb-2",children:"Update Firm Type"}),e.jsx("p",{className:"text-amber-100/80 text-sm font-medium leading-relaxed",children:"Select the proposed legal constitution for this dealership application."})]}),e.jsxs("div",{className:"p-8 space-y-6 bg-white",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ce,{className:"text-[10px] text-slate-400 uppercase tracking-widest font-black",children:["Proposed Legal Constitution ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:Ps,onValueChange:ns,children:[e.jsx(Ct,{className:"h-12 rounded-xl border-slate-200 focus:ring-amber-500","data-testid":"onboarding-firm-type-select",children:e.jsx(St,{placeholder:"Select Firm Type"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"Proprietorship","data-testid":"onboarding-firm-type-proprietorship",children:"Proprietorship"}),e.jsx(_e,{value:"Partnership","data-testid":"onboarding-firm-type-partnership",children:"Partnership"}),e.jsx(_e,{value:"Limited Liability partnership","data-testid":"onboarding-firm-type-llp",children:"LLP (Limited Liability partnership)"}),e.jsx(_e,{value:"Private Limited Company","data-testid":"onboarding-firm-type-pvt-ltd",children:"Private Limited Company"}),e.jsx(_e,{value:"Public Limited Company","data-testid":"onboarding-firm-type-pub-ltd",children:"Public Limited Company"})]})]})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx(se,{variant:"outline",className:"flex-1 h-12 rounded-xl font-bold text-slate-600 border-slate-200",onClick:()=>ws(!1),disabled:Cs,"data-testid":"onboarding-firm-type-cancel",children:"Cancel"}),e.jsx(se,{className:"flex-1 h-12 rounded-xl font-bold bg-amber-600 hover:bg-amber-700 text-white shadow-lg shadow-amber-200 transition-all active:scale-95",disabled:Cs||!Ps,onClick:Bs,"data-testid":"onboarding-firm-type-submit",children:Cs?e.jsx(ss,{className:"w-5 h-5 animate-spin"}):"Update Type"})]})]})]})})]})}var n$={};function r$({application:t,currentUser:s,documents:n,fddAgencies:r,selectedAgencyId:a,setSelectedAgencyId:l,isAssigningAgency:c,handleAssignAgency:d,setPreviewDoc:m,setShowPreviewModal:x,setIsUploading:f,fetchApplication:h,refreshDocuments:g}){var w,E;const u=(t==null?void 0:t.fddAssignments)||[],j=((w=t==null?void 0:t.participants)==null?void 0:w.filter(T=>{var C,L,$,_;return((C=T.user)==null?void 0:C.role)==="FDD"||((L=T.user)==null?void 0:L.roleCode)==="FDD"||((_=($=T.user)==null?void 0:$.allRoles)==null?void 0:_.includes("FDD"))}))||[],p=u.length>0||j.length>0,y=(E=j[0])==null?void 0:E.user,N=[{type:"Bank Statement",label:"Bank Statements"},{type:"Income Tax Returns (ITR)",label:"ITR (Last 3 Years)"},{type:"CIBIL Report",label:"CIBIL / Credit Reports"},{type:"Property Documents",label:"Property Documents"},{type:"Business Valuation Report",label:"Valuation Reports"},{type:"FDD Final Audit Report",label:"Final Audit Report"}],S=T=>{const C=T.toLowerCase();return(n||[]).find(L=>{const $=(L.documentType||"").toLowerCase(),_=(L.fileName||"").toLowerCase();return!!($===C||C.includes("itr")&&($.includes("itr")||_.includes("itr"))||C.includes("bank statement")&&($.includes("bank")||_.includes("bank"))||C.includes("cibil")&&($.includes("cibil")||_.includes("cibil")||$.includes("credit")))})},A=T=>{const C=(T.documentType||"").toLowerCase();return(T.stage||"").toLowerCase()==="fdd"||C.includes("report")||C.includes("itr")||C.includes("bank")||C.includes("cibil")||C.includes("valuation")};return!p&&!["FDD Verification","LOI In Progress","Payment Pending"].includes(t.status)?e.jsxs("div",{className:"space-y-6","data-testid":"onboarding-fdd-no-assignment",children:[e.jsxs("div",{className:"flex flex-col items-center justify-center p-12 bg-slate-50 rounded-2xl border-2 border-dashed border-slate-200",children:[e.jsx(Fl,{className:"w-12 h-12 text-slate-300 mb-4"}),e.jsx("h3",{className:"text-slate-900 font-semibold uppercase tracking-widest text-xs",children:"No FDD Assignment"}),e.jsx("p",{className:"text-slate-500 text-[10px] text-center max-w-xs mt-2 font-medium leading-relaxed uppercase tracking-tight",children:"The Financial Due Diligence process has not been initiated for this application yet."})]}),((s==null?void 0:s.role)==="DD Admin"||(s==null?void 0:s.role)==="Super Admin")&&e.jsxs(Ie,{className:"border-amber-100 bg-amber-50/30 overflow-hidden rounded-2xl","data-testid":"onboarding-fdd-initiate-card",children:[e.jsx(tt,{className:"pb-2",children:e.jsxs(nt,{className:"text-xs font-black uppercase tracking-widest text-amber-800 flex items-center gap-2",children:[e.jsx(tb,{className:"w-4 h-4"}),"Initiate FDD Audit"]})}),e.jsx(Me,{children:e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("label",{className:"text-[10px] font-black uppercase tracking-widest text-slate-400 mb-1.5 block",children:["Select FDD Agency ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("select",{className:"w-full h-11 bg-white border border-slate-200 rounded-xl px-4 text-sm font-medium focus:ring-2 focus:ring-amber-500/20 focus:border-amber-500 outline-none transition-all shadow-sm",value:a,onChange:T=>l(T.target.value),"data-testid":"onboarding-fdd-agency-select",children:[e.jsx("option",{value:"",children:"Choose partner agency..."}),(r||[]).map(T=>e.jsxs("option",{value:T.id,"data-testid":`onboarding-fdd-agency-option-${T.id}`,children:[T.fullName||T.name," (",T.email,")"]},T.id))]})]}),e.jsx("div",{className:"flex items-end",children:e.jsx(se,{className:"bg-slate-900 text-white hover:bg-slate-800 font-black text-[10px] uppercase tracking-widest px-8 h-11 border-none shadow-lg shadow-slate-900/10 transition-all active:scale-[0.98]",onClick:d,disabled:c||!a,"data-testid":"onboarding-fdd-assign-button",children:c?"Assigning...":"Assign & Start Audit"})})]})})]})]}):e.jsxs("div",{className:"space-y-8","data-testid":"onboarding-fdd-audit-content",children:[p&&e.jsx("div",{className:"flex items-center justify-between p-4 bg-slate-50 border border-slate-200 rounded-xl mb-6","data-testid":"onboarding-fdd-assignment-banner",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-amber-100 rounded-lg",children:e.jsx(Fl,{className:"w-5 h-5 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-slate-900",children:"FDD Assignment Active"}),y&&e.jsxs("p",{className:"text-xs text-slate-500 font-medium","data-testid":"onboarding-fdd-assigned-user",children:["Assigned to: ",y.name]})]})]})}),e.jsxs(Ie,{className:"border-slate-200 shadow-sm overflow-hidden rounded-2xl","data-testid":"onboarding-fdd-checklist-card",children:[e.jsx(tt,{className:"bg-slate-50/50 border-b border-slate-100 py-4",children:e.jsxs(nt,{className:"text-sm font-black uppercase tracking-widest text-slate-500 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fo,{className:"w-4 h-4"})," Financial Artefacts Checklist"]}),e.jsx(Ae,{variant:"outline",className:"text-[10px] bg-white",children:"Verify before sign-off"})]})}),e.jsx(Me,{className:"p-0",children:e.jsx("div",{className:"divide-y divide-slate-100",children:N.map((T,C)=>{const L=S(T.type);return e.jsxs("div",{className:"flex items-center justify-between p-4 px-6 hover:bg-slate-50/50 transition-colors","data-testid":`onboarding-fdd-checklist-item-${C}`,children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:_t("w-8 h-8 rounded-lg flex items-center justify-center",L?"bg-emerald-50 text-emerald-600":"bg-slate-50 text-slate-300"),children:L?e.jsx(Ys,{className:"w-5 h-5"}):e.jsx(Gs,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-slate-800",children:T.label}),e.jsx("p",{className:"text-[10px] text-slate-400 font-bold uppercase tracking-tighter","data-testid":`onboarding-fdd-checklist-status-${C}`,children:L?`Uploaded: ${Ht(L.createdAt)}`:"Missing in Documentation"})]})]}),L?e.jsxs(se,{variant:"ghost",size:"sm",className:"h-8 text-blue-600 font-black text-[10px] uppercase tracking-widest hover:bg-blue-50",onClick:()=>{m(L),x(!0)},"data-testid":`onboarding-fdd-checklist-preview-${C}`,children:[e.jsx(nn,{className:"w-4 h-4 mr-1"})," Preview"]}):e.jsxs(se,{variant:"outline",size:"sm",className:"h-8 border-slate-200 text-slate-500 font-black text-[10px] uppercase tracking-widest hover:bg-slate-50 hover:text-blue-600","data-testid":`onboarding-fdd-checklist-upload-${C}`,onClick:()=>{const $=document.createElement("input");$.type="file",$.onchange=async _=>{var P;const R=_.target.files[0];if(R)try{f(!0);const M=new FormData;M.append("file",R),M.append("documentType",T.type),M.append("stage","FDD"),M.append("applicationId",t.id);const q=await ds.uploadDocument(t.id,M);T.type==="FDD Final Audit Report"&&(await ds.submitFddReport({applicationId:t.id,reportDocumentId:((P=q.data)==null?void 0:P.id)||q.id,findings:"Final Audit Report uploaded via checklist.",recommendation:"REVIEW_PENDING"}),h()),ee.success(`${T.label} uploaded successfully`),g()}catch{ee.error("Upload failed")}finally{f(!1)}},$.click()},children:[e.jsx(Dr,{className:"w-4 h-4 mr-1 text-slate-300"})," Upload"]})]},T.type)})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Supporting Audit Documents"}),e.jsxs(Ae,{variant:"outline",className:"bg-slate-50 text-slate-500 border-slate-200","data-testid":"onboarding-fdd-support-docs-count",children:[(n||[]).filter(A).length," Document(s)"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4","data-testid":"onboarding-fdd-support-docs-grid",children:[(n||[]).filter(A).map((T,C)=>e.jsxs("div",{className:"group bg-white border border-slate-200 rounded-xl p-4 flex items-center justify-between hover:border-amber-400 transition-all hover:shadow-md","data-testid":`onboarding-fdd-support-doc-${C}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-slate-50 flex items-center justify-center",children:e.jsx(fs,{className:"w-5 h-5 text-slate-400"})}),e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("p",{className:"text-slate-900 font-bold text-sm truncate max-w-[150px]",title:T.fileName,"data-testid":`onboarding-fdd-support-doc-name-${C}`,children:T.fileName}),e.jsx("p",{className:"text-slate-500 text-[10px] font-medium uppercase",children:T.documentType})]})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-amber-600 hover:bg-amber-50",onClick:()=>{const L=n$.NEXT_PUBLIC_API_URL||"http://localhost:5000";window.open(`${L}/${T.filePath}`,"_blank")},"data-testid":`onboarding-fdd-support-doc-download-${C}`,children:e.jsx(Ni,{className:"w-4 h-4"})}),e.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-amber-600 hover:bg-amber-50",onClick:()=>{m(T),x(!0)},"data-testid":`onboarding-fdd-support-doc-preview-${C}`,children:e.jsx(nn,{className:"w-4 h-4"})})]})]},T.id)),(n||[]).filter(A).length===0&&e.jsx("div",{className:"col-span-full p-8 text-center bg-slate-50 rounded-xl border border-dashed border-slate-200","data-testid":"onboarding-fdd-support-docs-empty",children:e.jsx("p",{className:"text-slate-400 text-sm",children:"No supporting audit documents uploaded yet."})})]})]})]})}function a$(t){const s=String(t||"").toUpperCase();return s.includes("REJECT")||s.includes("DELET")||s.includes("DISQUALIF")?"border-red-200 bg-red-50/90 text-red-800":s==="CREATED"||s.includes("APPROV")||s.includes("COMPLETE")?"border-emerald-200 bg-emerald-50/90 text-emerald-900":s.includes("DOCUMENT")||s.includes("UPLOAD")||s.includes("ATTACHMENT")?"border-sky-200 bg-sky-50/80 text-sky-900":s.includes("PAYMENT")||s.includes("SECURITY")||s.includes("DEPOSIT")?"border-violet-200 bg-violet-50/80 text-violet-900":s.includes("FDD")||s.includes("QUESTIONNAIRE")||s.includes("INTERVIEW")?"border-amber-200 bg-amber-50/80 text-amber-900":"border-slate-200 bg-slate-50 text-slate-700"}function Om(t,s){return t==null||s==null?!1:String(t).trim()===String(s).trim()}function pE(t){return String(t??"").trim().toLowerCase().replace(/\s+/g," ")}function zh(t){const s=pE(t);return s?s==="scheduled"||s==="rescheduled"||s==="pending"||s==="in progress"||s==="inprogress":!1}function i$(t){return pE(t)==="completed"}function Yx(t,s){var n;return!s||!((n=t==null?void 0:t.participants)!=null&&n.length)?!1:t.participants.some(r=>{var a;return Om(r.userId,s)||Om((a=r.user)==null?void 0:a.id,s)})}function l$(t){const s=String(t??"").trim();return{"Level 1 Interview Pending":1,"Level 1 Recommended":1,"Level 2 Interview Pending":2,"Level 2 Recommended":2,"Level 3 Interview Pending":3,"Level 3 Recommended":3}[s]}function u1(t){return String(t??"").trim().toLowerCase().replace(/[_\s-]+/g,"")}function o$(t,s){var d,m;if(!t)return!1;const n=["Super Admin","DD Admin"];if(n.includes(String(t.role??""))||n.includes(String(t.roleCode??"")))return!0;const a={1:["DD-ZM","DD ZM","RBM"],2:["DD Lead","ZBH"],3:["NBH","DD Head"]}[s];if(!(a!=null&&a.length))return!1;const l=a.map(u1),c=[t.role,t.roleCode,t.roleName,(d=t.role)==null?void 0:d.roleCode,(m=t.role)==null?void 0:m.roleName].filter(Boolean).map(u1);for(const x of c)if(x){for(const f of l)if(f&&(x===f||x.includes(f)||f.includes(x)))return!0}return!1}function c$({application:t,interviews:s,currentUser:n,getDeposit:r,eorProgress:a}){var A,w,E;const l=Array.isArray(s)?s:[],c=l$(t==null?void 0:t.status),d=(c!=null?l.find(T=>zh(T.status)&&Yx(T,n==null?void 0:n.id)&&Number(T.level)===c):void 0)??l.find(T=>zh(T.status)&&Yx(T,n==null?void 0:n.id)),m=c!=null&&n&&o$(n,c)?l.find(T=>Number(T.level)===c&&zh(T.status)):void 0,x=d??m,f=l.find(T=>Yx(T,n==null?void 0:n.id)),h=((A=x==null?void 0:x.evaluations)==null?void 0:A.find(T=>Om(T.evaluatorId,n==null?void 0:n.id)))??((w=f==null?void 0:f.evaluations)==null?void 0:w.find(T=>Om(T.evaluatorId,n==null?void 0:n.id))),g=T=>l.some(C=>Number(C.level)===T&&i$(C.status)),u=T=>l.some(C=>Number(C.level)===T&&zh(C.status)),j=!!h,p={"Level 1 Interview Pending":"INTERVIEW_LEVEL_1","Level 2 Interview Pending":"INTERVIEW_LEVEL_2","Level 2 Recommended":"INTERVIEW_LEVEL_2","Level 3 Interview Pending":"INTERVIEW_LEVEL_3","LOI In Progress":"LOI_APPROVAL","LOA Pending":"LOA_APPROVAL"},y=p[t==null?void 0:t.status],N=(E=t==null?void 0:t.stageApprovals)==null?void 0:E.find(T=>T.stageCode===y&&String(T.actorUserId)===String(n==null?void 0:n.id));return{activeInterviewForUser:x,lastInterviewForUser:f,currentUserEvaluation:h,hasSubmittedFeedback:j,currentUserStageAction:N,isInterviewCompleted:g,isInterviewActive:u,permissions:(()=>{var U,F,B,D,O;if(!t||!n)return{canApprove:!1,canReject:!1,canSchedule:!1,canAssign:!1,isLoaLocked:!1,isSecurityDetailsLocked:!1,showDecisionMessage:!1};const T=["DD Admin","Super Admin","NBH","DD Lead","DD Head","Finance","Finance Admin","FDD","ZBH","RBM"].includes(n.role),C=["Level 3 Approved","FDD Verification","LOI In Progress","Security Details","Payment Pending","LOI Issued","Statutory LOI Ack","Architecture Team Assigned","Architecture Document Upload","Architecture Team Completion","Statutory GST","Statutory PAN","Statutory Nodal","Statutory Check","Statutory Partnership","Statutory Firm Reg","Statutory Rental","Statutory Virtual Code","Statutory Domain","Statutory MSD","LOA Pending","EOR In Progress","EOR Complete","Inauguration","Approved"].includes(t.status),L=t.status==="LOA Pending"&&((U=r("FIRST_FILL"))==null?void 0:U.status)!=="Verified",$=["Security Details","Payment Pending"].includes(t.status)&&((F=r("SECURITY_DEPOSIT"))==null?void 0:F.status)!=="Verified",_=t.status==="Onboarded"||t.status==="Rejected",R=(B=t.stageApprovals)==null?void 0:B.some(z=>z.stageCode==="LOI_APPROVAL"&&z.actorRole==="DD Head"&&z.decision==="Approved"),P=(D=t.stageApprovals)==null?void 0:D.some(z=>z.stageCode==="LOA_APPROVAL"&&z.actorRole==="DD Head"&&z.decision==="Approved");let M=!0;["Super Admin","DD Admin","DD Lead","DD Head"].includes(n.role)||((t.status==="FDD Verification"||t.status==="Level 3 Approved")&&(M=!1),t.status==="LOI In Progress"&&(M=n.role==="NBH"?!!R:n.role==="DD Head"),t.status==="LOA Pending"&&(M=n.role==="NBH"?!!P:n.role==="DD Head"));const q=!!((O=t.stageApprovals)!=null&&O.find(z=>p[t.status]===z.stageCode&&String(z.actorUserId)===String(n.id))),K=["Approved","Rejected","Selected"].includes((h==null?void 0:h.decision)||(h==null?void 0:h.recommendation)||""),Z=(x?K:!1)||q,W=!_&&!Z&&T&&C&&M&&(!["EOR In Progress","Inauguration","Approved"].includes(t.status)||a===100);return{canApprove:W&&!L&&!$,canReject:W&&!L,isLoaLocked:L,isSecurityDetailsLocked:$,showDecisionMessage:Z&&(!C||q),canSchedule:["DD Admin","Super Admin","DD AM","ASM"].includes(n.role)&&!_&&![1,2,3].every(z=>l.some(G=>G.level===z)),canAssign:["DD Admin","Super Admin","DD AM"].includes(n.role)}})()}}function d$({initialTab:t="questionnaire"}){const[s,n]=v.useState(!1),[r,a]=v.useState(!1),[l,c]=v.useState(""),[d,m]=v.useState(t),[x,f]=v.useState(!1),[h,g]=v.useState(!1),[u,j]=v.useState(!1),[p,y]=v.useState(!1),[N,S]=v.useState(""),[A,w]=v.useState([]),[E,T]=v.useState(!1),[C,L]=v.useState(!1),[$,_]=v.useState(""),[R,P]=v.useState(!1),[M,q]=v.useState(!1),[K,Z]=v.useState(!1),[W,U]=v.useState(!1),[F,B]=v.useState(!1),[D,O]=v.useState(null),[z,G]=v.useState("virtual"),[Y,V]=v.useState(""),[X,ne]=v.useState({}),[oe,re]=v.useState([]),[ge,ve]=v.useState(""),[Se,We]=v.useState("contributor"),[Ce,fe]=v.useState(""),[Ye,be]=v.useState("level1"),[Pe,ke]=v.useState(""),[qe,Ve]=v.useState(""),[dt,xt]=v.useState(!1),[ye,le]=v.useState(null),[Qe,rt]=v.useState(""),[Gt,Rt]=v.useState(null),[Re,Qt]=v.useState(!1),[qt,ws]=v.useState(null),[Ps,ns]=v.useState(!1),[Cs,Bs]=v.useState(""),[Ft,ie]=v.useState(!1),[Fe,Q]=v.useState({}),[pe,Ne]=v.useState(!1),[Ee,it]=v.useState([]),[st,bt]=v.useState(!1),[Ue,It]=v.useState(!1),[ut,yt]=v.useState(!1),[kt,Le]=v.useState(""),[Pt,ht]=v.useState(!1),[zt,rs]=v.useState(!1),[Yt,Os]=v.useState(""),[Ls,zs]=v.useState(""),[en,he]=v.useState(!1),[Ke,at]=v.useState(!1),[pt,mt]=v.useState([]),[Bt,Ds]=v.useState([]),[as,Vs]=v.useState(""),[Is,Ts]=v.useState(!1),[ln,pn]=v.useState(!1),[hn,Ws]=v.useState(!1),[Qs,zn]=v.useState({}),[on,Un]=v.useState({}),[yr,Tr]=v.useState(""),[er,tr]=v.useState("Approve"),[En,Xe]=v.useState(!1),[$t,Ze]=v.useState(null),[Ut,jt]=v.useState(!1),[Ln,jr]=v.useState(!1),[_r,xn]=v.useState("Recommended"),[qs,ha]=v.useState(""),[Tt,xs]=v.useState(!1),[Vr,ta]=v.useState(!1),[ma,Pr]=v.useState({}),[sr,gn]=v.useState("Approve"),[mn,Qn]=v.useState(!1),[fr,pr]=v.useState({}),[dn,wn]=v.useState("Approve"),[Da,fa]=v.useState(!1),[Ai,ki]=v.useState(null),[ni,rl]=v.useState(!1);return{showFirmTypeModal:s,setShowFirmTypeModal:n,updatingFirmType:r,setUpdatingFirmType:a,tempFirmType:l,setTempFirmType:c,activeTab:d,setActiveTab:m,showApproveModal:x,setShowApproveModal:f,showOnboardModal:h,setShowOnboardModal:g,isOnboarding:u,setIsOnboarding:j,showRejectModal:p,setShowRejectModal:y,rejectionReason:N,setRejectionReason:S,scheduledInterviewParticipants:A,setScheduledInterviewParticipants:w,showScheduleModal:E,setShowScheduleModal:T,showCancelInterviewModal:C,setShowCancelInterviewModal:L,interviewIdToCancel:$,setInterviewIdToCancel:_,showKTMatrixModal:R,setShowKTMatrixModal:P,showLevel2FeedbackModal:M,setShowLevel2FeedbackModal:q,showLevel3FeedbackModal:K,setShowLevel3FeedbackModal:Z,showDocumentsModal:W,setShowDocumentsModal:U,showAssignModal:F,setShowAssignModal:B,selectedStage:D,setSelectedStage:O,interviewMode:z,setInterviewMode:G,approvalRemark:Y,setApprovalRemark:V,expandedBranches:X,setExpandedBranches:ne,users:oe,setUsers:re,selectedUser:ge,setSelectedUser:ve,participantType:Se,setParticipantType:We,interviewDate:Ce,setInterviewDate:fe,interviewType:Ye,setInterviewType:be,meetingLink:Pe,setMeetingLink:ke,location:qe,setLocation:Ve,showUploadForm:dt,setShowUploadForm:xt,uploadFile:ye,setUploadFile:le,uploadDocType:Qe,setUploadDocType:rt,approvalFile:Gt,setApprovalFile:Rt,isUploading:Re,setIsUploading:Qt,previewDoc:qt,setPreviewDoc:ws,showPreviewModal:Ps,setShowPreviewModal:ns,selectedInterviewerId:Cs,setSelectedInterviewerId:Bs,isEditingStatutory:Ft,setIsEditingStatutory:ie,statutoryForm:Fe,setStatutoryForm:Q,isSavingStatutory:pe,setIsSavingStatutory:Ne,interviews:Ee,setInterviews:it,isScheduling:st,setIsScheduling:bt,isCancellingInterview:Ue,setIsCancellingInterview:It,showAssignArchitectureModal:ut,setShowAssignArchitectureModal:yt,architectureLeadId:kt,setArchitectureLeadId:Le,isAssigningArchitecture:Pt,setIsAssigningArchitecture:ht,showArchitectureStatusModal:zt,setShowArchitectureStatusModal:rs,architectureStatus:Yt,setArchitectureStatus:Os,architectureRemarks:Ls,setArchitectureRemarks:zs,isUpdatingArchitecture:en,setIsUpdatingArchitecture:he,isAssigningParticipant:Ke,setIsAssigningParticipant:at,documentConfigs:pt,setDocumentConfigs:mt,fddAgencies:Bt,setFddAgencies:Ds,selectedAgencyId:as,setSelectedAgencyId:Vs,isAssigningAgency:Is,setIsAssigningAgency:Ts,isApproving:ln,setIsApproving:pn,isRejecting:hn,setIsRejecting:Ws,ktMatrixScores:Qs,setKtMatrixScores:zn,ktMatrixSelectedValues:on,setKtMatrixSelectedValues:Un,ktMatrixRemarks:yr,setKtMatrixRemarks:Tr,ktMatrixRecommendation:er,setKtMatrixRecommendation:tr,isSubmittingKT:En,setIsSubmittingKT:Xe,selectedInterviewForFeedback:$t,setSelectedInterviewForFeedback:Ze,showFddFinalizeModal:Ut,setShowFddFinalizeModal:jt,showFddFlagModal:Ln,setShowFddFlagModal:jr,fddAuditRecommendation:_r,setFddAuditRecommendation:xn,fddAuditFindings:qs,setFddAuditFindings:ha,isFinalizingFdd:Tt,setIsFinalizingFdd:xs,isFddFlagging:Vr,setIsFddFlagging:ta,level2Feedback:ma,setLevel2Feedback:Pr,level2Recommendation:sr,setLevel2Recommendation:gn,isSubmittingLevel2:mn,setIsSubmittingLevel2:Qn,level3Feedback:fr,setLevel3Feedback:pr,level3Recommendation:dn,setLevel3Recommendation:wn,isSubmittingLevel3:Da,setIsSubmittingLevel3:fa,selectedEvaluationForView:Ai,setSelectedEvaluationForView:ki,showFeedbackDetailsModal:ni,setShowFeedbackDetailsModal:rl}}const xE=()=>new Date().toISOString().split("T")[0],u$=t=>({strategicVision:"",managementCapabilities:"",operationalUnderstanding:"",keyStrengths:"",areasOfConcern:"",additionalComments:"",overallScore:"",interviewerName:(t==null?void 0:t.name)||"",interviewDate:xE()}),h$=t=>({strategicVision:"",managementCapabilities:"",operationalUnderstanding:"",brandAlignment:"",executiveSummary:"",keyStrengths:"",areasOfConcern:"",additionalComments:"",overallScore:"",interviewerName:(t==null?void 0:t.name)||"",interviewDate:xE()});function m$({ktMatrixScores:t,setKtMatrixScores:s,setKtMatrixSelectedValues:n,ktMatrixRemarks:r,setKtMatrixRemarks:a,ktMatrixRecommendation:l,setKtMatrixRecommendation:c,selectedInterviewForFeedback:d,interviews:m,setIsSubmittingKT:x,setShowKTMatrixModal:f,level2Feedback:h,setLevel2Feedback:g,level2Recommendation:u,setLevel2Recommendation:j,setIsSubmittingLevel2:p,setShowLevel2FeedbackModal:y,level3Feedback:N,setLevel3Feedback:S,level3Recommendation:A,setLevel3Recommendation:w,setIsSubmittingLevel3:E,setShowLevel3FeedbackModal:T,currentUser:C,fetchInterviews:L,fetchApplication:$,ktMatrixConfig:_,level2Config:R,level3Config:P}){const M=ne=>ne==="Approve"?"Recommended":ne==="Reject"?"Not Recommended":"Hold",q=ne=>ne==="Approve"?"Approved":ne==="Reject"?"Rejected":null,K=()=>_!=null&&_.items&&_.items.length>0?_.items.map(ne=>({name:ne.label,weight:Number(ne.weight)||0,maxScore:Number(ne.maxScore)||10,options:(ne.options||[]).map(oe=>({label:oe.optionLabel,value:oe.optionValue,score:Number(oe.score)||0}))})):[],Z=()=>R!=null&&R.items&&R.items.length>0?R.items:[],W=()=>P!=null&&P.items&&P.items.length>0?P.items:[],U=K(),F=Z(),B=W();return{handleKTMatrixChange:(ne,oe,re)=>{s(ge=>({...ge,[ne]:re})),n(ge=>({...ge,[ne]:oe}))},calculateKTScore:()=>{let ne=0;return U.forEach(oe=>{const re=t[oe.name||oe.label]||0,ge=oe.maxScore||10,ve=oe.weight||0;ne+=re/ge*ve}),ne.toFixed(2)},handleSubmitKTMatrix:async()=>{var oe,re;if(U.length===0){ee.error("KT Matrix configuration is missing. Please configure it in Master > Interview Configurations.");return}if(Object.keys(t).lengthge.status!=="Completed"))==null?void 0:oe.id)||((re=m[0])==null?void 0:re.id);if(!ne){ee.error("No active interview found to link this KT Matrix to.");return}try{x(!0);const ge=U.map(Se=>({criterionName:Se.name||Se.label,score:t[Se.name||Se.label]||0,maxScore:Se.maxScore||10,weightage:Se.weight||0}));await ds.submitKTMatrix({interviewId:ne,criteriaScores:ge,feedback:r,recommendation:M(l)});const ve=q(l);ve&&await ds.updateInterviewDecision({interviewId:ne,decision:ve,remarks:r||`Level 1 ${ve.toLowerCase()} via KT Matrix`}),ee.success(ve?`KT Matrix submitted and interview ${ve.toLowerCase()}`:"KT Matrix submitted and interview kept on hold"),f(!1),s({}),n({}),a(""),c("Approve"),await L(),await $()}catch{ee.error("Failed to submit KT Matrix")}finally{x(!1)}},handleLevel2Change:(ne,oe)=>{g(re=>({...re,[ne]:oe}))},handleSubmitLevel2Feedback:async()=>{var oe;if(F.length===0){ee.error("Level 2 feedback configuration is missing. Please configure it in Master > Interview Configurations.");return}if(!h.overallScore){ee.warning("Please provide an overall score.");return}const ne=(d==null?void 0:d.id)||((oe=m.find(re=>re.status!=="Completed"&&re.level===2))==null?void 0:oe.id);if(!ne){ee.error("No active Level 2 interview found to link this feedback to.");return}try{p(!0);const re=F.map(Se=>({type:Se.label,comments:h[Se.itemKey]||""})).filter(Se=>Se.comments.trim()!=="");await ds.submitLevel2Feedback({interviewId:ne,overallScore:Number(h.overallScore),feedbackItems:re,recommendation:M(u)});const ge=q(u),ve=h.additionalComments||"Level 2 decision submitted via feedback modal";ge&&await ds.updateInterviewDecision({interviewId:ne,decision:ge,remarks:ve}),ee.success(ge?`Level 2 feedback submitted and interview ${ge.toLowerCase()}`:"Level 2 feedback submitted and interview kept on hold"),y(!1),g(u$(C)),j("Approve"),await L(),await $()}catch{ee.error("Failed to submit Level 2 Feedback")}finally{p(!1)}},handleLevel3Change:(ne,oe)=>{S(re=>({...re,[ne]:oe}))},handleSubmitLevel3Feedback:async()=>{var oe;if(B.length===0){ee.error("Level 3 feedback configuration is missing. Please configure it in Master > Interview Configurations.");return}if(!N.overallScore){ee.warning("Please provide an overall score.");return}const ne=(d==null?void 0:d.id)||((oe=m.find(re=>re.status!=="Completed"&&re.level===3))==null?void 0:oe.id);if(!ne){ee.error("No active Level 3 interview found to link this feedback to.");return}try{E(!0);const re=B.map(Se=>({type:Se.label,comments:N[Se.itemKey]||""})).filter(Se=>Se.comments.trim()!=="");await ds.submitLevel2Feedback({interviewId:ne,overallScore:Number(N.overallScore),feedbackItems:re,recommendation:M(A)});const ge=q(A),ve=N.executiveSummary||N.additionalComments||"Level 3 decision submitted via feedback modal";ge&&await ds.updateInterviewDecision({interviewId:ne,decision:ge,remarks:ve}),ee.success(ge?`Level 3 feedback submitted and interview ${ge.toLowerCase()}`:"Level 3 feedback submitted and interview kept on hold"),T(!1),S(h$(C)),w("Approve"),await L(),await $()}catch{ee.error("Failed to submit Level 3 Feedback")}finally{E(!1)}},ktCriteria:U,l2Fields:F,l3Fields:B}}function f$(){const[t,s]=v.useState(null),[n,r]=v.useState(null),[a,l]=v.useState(null),[c,d]=v.useState(!1),[m,x]=v.useState(null),f=v.useCallback(async g=>{var u,j;try{const p=await Te.getInterviewConfigByType(g);if((u=p.data)!=null&&u.success)return p.data.data}catch(p){((j=p==null?void 0:p.response)==null?void 0:j.status)!==404&&console.warn(`Failed to fetch ${g} config:`,p)}return null},[]),h=v.useCallback(async()=>{d(!0),x(null);try{const[g,u,j]=await Promise.all([f("KT_MATRIX"),f("LEVEL2_FEEDBACK"),f("LEVEL3_FEEDBACK")]);s(g),r(u),l(j)}catch{x("Failed to load interview configurations"),ee.error("Failed to load interview configurations")}finally{d(!1)}},[f]);return v.useEffect(()=>{h()},[h]),{ktMatrixConfig:t,level2Config:n,level3Config:a,loading:c,error:m,refresh:h}}function p$(t){const{application:s,applicationId:n,currentUser:r,interviews:a,approvalFile:l,approvalRemark:c,rejectionReason:d,architectureLeadId:m,architectureStatus:x,architectureRemarks:f,selectedUser:h,participantType:g,users:u,interviewDate:j,interviewType:p,interviewMode:y,meetingLink:N,location:S,scheduledInterviewParticipants:A,uploadFile:w,uploadDocType:E,selectedStage:T,setIsApproving:C,setShowApproveModal:L,setApprovalRemark:$,setApprovalFile:_,setIsRejecting:R,setShowRejectModal:P,setRejectionReason:M,setIsAssigningArchitecture:q,setShowAssignArchitectureModal:K,setIsUpdatingArchitecture:Z,setShowArchitectureStatusModal:W,setIsAssigningParticipant:U,setSelectedUser:F,setShowAssignModal:B,setLoading:D,setIsScheduling:O,setShowScheduleModal:z,setShowCancelInterviewModal:G,interviewIdToCancel:Y,setInterviewIdToCancel:V,setIsCancellingInterview:X,setIsUploading:ne,setShowUploadForm:oe,setUploadFile:re,setUploadDocType:ge,setDocuments:ve,selectedInterviewerId:Se,setSelectedInterviewerId:We,setScheduledInterviewParticipants:Ce,setUsers:fe,showScheduleModal:Ye,showAssignArchitectureModal:be,showAssignModal:Pe,fetchApplication:ke,fetchInterviews:qe,fetchEorData:Ve}=t,dt=()=>{if(!Se)return;const ie=(Array.isArray(u)?u:[]).find(Fe=>Fe.id===Se);ie&&!A.find(Fe=>Fe.id===ie.id)&&(Ce([...A,ie]),We(""))},xt=Ft=>{Ce(A.filter(ie=>ie.id!==Ft))},ye=v.useCallback(async Ft=>{if(!(!r||!["DD Admin","Super Admin","DD Lead","DD Head","NBH"].includes(r.role)))try{const ie={};if(Ft){const Ne={level1:["DD-ZM","RBM"],level2:["DD Lead","ZBH"],level3:["NBH","DD Head"]};Ne[Ft]&&(ie.preferredRoleCode=Ne[Ft]),s&&(ie.locationId=s.districtId||s.areaId||s.regionId||s.zoneId)}ie.isExternal=!1;const Fe=await ds.getUsers(ie),pe=(Array.isArray(Fe)?Fe:Fe&&Array.isArray(Fe.data)?Fe.data:Fe&&Array.isArray(Fe.users)?Fe.users:[]).filter(Ne=>(Ne.status||"").toLowerCase()!=="inactive");fe(pe.sort((Ne,Ee)=>String(Ne.fullName||Ne.name||"").localeCompare(String(Ee.fullName||Ee.name||""))))}catch{fe([])}},[r,s,fe]),le=v.useCallback(()=>{if(!Ye||!s)return;const Ft=parseInt(p.replace("level",""))||1,ie={1:["DD-ZM","RBM"],2:["DD Lead","ZBH"],3:["NBH","DD Head"]},Fe=st=>String(st||"").trim().toLowerCase().replace(/[_\s-]+/g," "),Q=(ie[Ft]||[]).map(Fe),pe=(st,bt)=>{var ut,yt,kt;const Ue=[(ut=st==null?void 0:st.metadata)==null?void 0:ut.role,(yt=bt==null?void 0:bt.role)==null?void 0:yt.roleName,(kt=bt==null?void 0:bt.role)==null?void 0:kt.roleCode,bt==null?void 0:bt.roleCode,bt==null?void 0:bt.role].filter(Boolean),It=Ue.find(Le=>Q.includes(Fe(Le)));return String(It||Ue[0]||"Panelist")},Ne=((s==null?void 0:s.participants)||[]).filter(st=>{var bt,Ue,It,ut,yt,kt,Le,Pt,ht;return((bt=st.metadata)==null?void 0:bt.interviewLevel)===Ft||((Ue=st.metadata)==null?void 0:Ue.interviewLevel)===String(Ft)||((ut=(It=st.metadata)==null?void 0:It.allAssignments)==null?void 0:ut.includes(Ft))||((kt=(yt=st.metadata)==null?void 0:yt.allAssignments)==null?void 0:kt.includes(String(Ft)))||Q.includes(Fe((Le=st.user)==null?void 0:Le.role))||Q.includes(Fe((Pt=st.user)==null?void 0:Pt.roleCode))||Q.includes(Fe((ht=st.metadata)==null?void 0:ht.role))}).map(st=>{const bt=st.user||{};return{...bt,__stageRole:pe(st,bt)}}).filter(st=>!!(st!=null&&st.id));if(Ne.length===0){Ce([]);return}const Ee=[],it=new Set;Ne.forEach(st=>{st.id&&!it.has(st.id)&&(it.add(st.id),Ee.push(st))}),Ce(Ee)},[Ye,s,p,Ce]),Qe=async()=>{if(!j){ee.warning("Please select date and time");return}try{O(!0),await ds.scheduleInterview({applicationId:s==null?void 0:s.id,level:p,scheduledAt:j,type:y==="virtual"?"Virtual Interview":"Physical Interview",location:y==="virtual"?N:S,participants:A.map(Ft=>Ft.id)}),ee.success("Interview scheduled successfully"),z(!1),await qe(),await ke()}catch{ee.error("Failed to schedule interview")}finally{O(!1)}},rt=async Ft=>{V(Ft),G(!0)},Gt=async()=>{if(Y)try{X(!0),await ds.updateInterview(Y,{status:"Cancelled"}),ee.success("Interview cancelled successfully"),G(!1),V(""),await qe()}catch{ee.error("Failed to cancel interview")}finally{X(!1)}},Rt=async()=>{if(!w||!E){ee.warning("Please select a file and document type");return}try{ne(!0);const Ft=new FormData;Ft.append("file",w),Ft.append("documentType",E),T&&Ft.append("stage",T),await ds.uploadDocument(n,Ft),ee.success("Document uploaded successfully"),oe(!1),re(null),ge("");const ie=await ds.getDocuments(n);ve(ie||[]),await Ve()}catch{ee.error("Failed to upload document")}finally{ne(!1)}},Re=async()=>{var Ft;try{C(!0);const ie=a.find(Ne=>{var Ee;return Ne.status!=="Completed"&&Ne.status!=="Cancelled"&&((Ee=Ne.participants)==null?void 0:Ee.some(it=>it.userId===(r==null?void 0:r.id)))});if(l&&n)try{const Ne=new FormData;Ne.append("file",l),Ne.append("documentType","Approval Attachment");let Ee=null;ie&&(ie.level===1||ie.level==="1"?Ee="1st Level Interview":ie.level===2||ie.level==="2"?Ee="2nd Level Interview":(ie.level===3||ie.level==="3")&&(Ee="3rd Level Interview")),Ee||(s.status==="Shortlisted"||s.status==="Level 1 Interview Pending"?Ee="1st Level Interview":s.status==="Level 1 Approved"||s.status==="Level 2 Interview Pending"?Ee="2nd Level Interview":(s.status==="Level 2 Approved"||s.status==="Level 3 Interview Pending")&&(Ee="3rd Level Interview")),Ee&&Ne.append("stage",Ee),await ds.uploadDocument(n,Ne)}catch{ee.error("Failed to upload document")}if(ie)try{await ds.updateInterviewDecision({interviewId:ie.id,decision:"Approved",remarks:c}),ee.success("Interview approved successfully"),L(!1),$(""),_(null),await qe(),await ke();return}catch{ee.error("Failed to approve interview");return}if(!c.trim()){ee.warning("Please enter a remark");return}let Fe=s.status;switch(s.status){case"Shortlisted":case"Level 1 Interview Pending":Fe="Level 1 Approved";break;case"Level 1 Approved":case"Level 2 Interview Pending":Fe="Level 2 Approved";break;case"Level 2 Approved":case"Level 3 Interview Pending":Fe="Level 3 Approved";break;case"Level 3 Approved":Fe="FDD Verification";break;case"FDD Verification":Fe="LOI In Progress";break;case"LOI In Progress":Fe="Security Details";break;case"Security Details":case"Payment Pending":Fe="LOI Issued";break;case"LOI Issued":Fe="Dealer Code Generation";break;case"Dealer Code Generation":case"Architecture Team Assigned":case"Architecture Document Upload":case"Architecture Team Completion":case"Statutory GST":case"Statutory PAN":case"Statutory Nodal":case"Statutory Check":case"Statutory Partnership":case"Statutory Firm Reg":case"Statutory Rental":case"Statutory Virtual Code":case"Statutory Domain":case"Statutory MSD":case"Statutory LOI Ack":Fe="LOA Pending";break;case"LOA Pending":Fe="EOR In Progress";break;case"EOR In Progress":Fe="EOR Complete";break;case"EOR Complete":Fe="Inauguration";break;case"Inauguration":case"Approved":Fe="Onboarded";break;default:Fe="Onboarded"}const pe={"Level 1 Interview Pending":"INTERVIEW_LEVEL_1","Level 2 Interview Pending":"INTERVIEW_LEVEL_2","Level 2 Recommended":"INTERVIEW_LEVEL_2","Level 3 Interview Pending":"INTERVIEW_LEVEL_3","LOI In Progress":"LOI_APPROVAL","LOA Pending":"LOA_APPROVAL"}[s.status];if(pe){const Ne=await ds.submitStageDecision({applicationId:s.id,stageCode:pe,decision:"Approved",remarks:c,nextStatus:Fe});(Ft=Ne.data)!=null&&Ft.statusUpdated?ee.success(Ne.message||"Stage completed and moved to next step"):ee.info(Ne.message||"Approval recorded. Waiting for other mandatory approvers.")}else await ds.updateApplicationStatus(n,{status:Fe,remarks:c});Fe==="Onboarded"?(await ds.createDealer({applicationId:n}),ee.success("Application finalized and Dealer profile created!")):ee.success(`Application moved to ${Fe}`),L(!1),$(""),_(null),await ke()}catch(ie){ee.error(ie.message||"Failed to process approval")}finally{C(!1)}},Qt=async()=>{try{R(!0);const Ft=a.find(Q=>{var pe;return Q.status!=="Completed"&&Q.status!=="Cancelled"&&((pe=Q.participants)==null?void 0:pe.some(Ne=>Ne.userId===(r==null?void 0:r.id)))});if(Ft)try{await ds.updateInterviewDecision({interviewId:Ft.id,decision:"Rejected",remarks:d}),ee.success("Interview rejected"),P(!1),M(""),await qe(),await ke();return}catch{ee.error("Failed to reject interview");return}if(!d.trim()){ee.warning("Please enter a reason for rejection");return}const Fe={"Level 1 Interview Pending":"INTERVIEW_LEVEL_1","Level 2 Interview Pending":"INTERVIEW_LEVEL_2","Level 2 Recommended":"INTERVIEW_LEVEL_2","Level 3 Interview Pending":"INTERVIEW_LEVEL_3","LOI In Progress":"LOI_APPROVAL","LOA Pending":"LOA_APPROVAL"}[s.status];Fe?await ds.submitStageDecision({applicationId:s.id,stageCode:Fe,decision:"Rejected",remarks:d,interviewId:Ft==null?void 0:Ft.id}):await ds.updateApplicationStatus(n,{status:"Rejected",remarks:d}),ee.success("Application rejected"),P(!1),M(""),await ke()}catch(Ft){ee.error(Ft.message||"Failed to process rejection")}finally{R(!1)}},qt=async()=>{try{await ds.generateDealerCodes(n),ee.success("Dealer codes generated successfully"),await ke()}catch(Ft){ee.error(Ft.message||"Failed to generate dealer codes")}},ws=async()=>{if(!m){ee.warning("Please select an architecture lead");return}try{q(!0),await ds.assignArchitectureTeam(n,m),ee.success("Architecture team assigned successfully"),K(!1),await ke()}catch(Ft){ee.error(Ft.message||"Failed to assign architecture team")}finally{q(!1)}},Ps=async()=>{try{Z(!0),await ds.updateArchitectureStatus(n,x,f),ee.success("Architecture status updated successfully"),W(!1),await ke()}catch{ee.error("Failed to update architecture status")}finally{Z(!1)}},ns=async()=>{if(!h){ee.warning("Please select a user");return}try{U(!0);const Ft=Array.isArray(u)?u.find(ie=>ie.id===h):null;Ft&&(Ft.role==="FDD"||Ft.roleCode==="FDD")&&(await ds.assignFddAgency({applicationId:n,assignedToAgency:h}),ee.info(`${Ft.fullName||Ft.name} assigned as FDD Agency based on role.`)),await ds.addParticipant({requestId:n,requestType:"application",userId:h,participantType:g||"contributor"}),ee.success("User assigned successfully!"),await ke(),F(""),B(!1)}catch{ee.error("Failed to assign user")}finally{U(!1)}},Cs=async()=>{try{D(!0),await ds.retriggerEvaluators(n),ee.success("Evaluators re-assigned successfully"),await ke()}catch{ee.error("Failed to re-assign evaluators")}finally{D(!1)}},Bs=v.useCallback(async()=>{if(Ye&&s){await ye(p),le();return}(be||Pe)&&s&&await ye()},[Ye,be,Pe,s,p,ye,le]);return{handleAddInterviewer:dt,handleRemoveInterviewer:xt,fetchUsers:ye,maybeFetchUsersForModal:Bs,handleScheduleInterview:Qe,handleCancelInterview:rt,handleConfirmCancelInterview:Gt,handleUpload:Rt,handleApprove:Re,handleReject:Qt,handleGenerateDealerCodes:qt,handleAssignArchitecture:ws,handleUpdateArchitectureStatus:Ps,handleAddParticipant:ns,handleRetriggerEvaluators:Cs}}const gE={getChecklist:async(t,s)=>{const n=s?`/eor/relocation/${s}`:`/eor/application/${t}`;return(await ze.get(n)).data},createChecklist:async t=>(await ze.post("/eor",t)).data,updateItem:async(t,s)=>(await ze.post(`/eor/item/${t}`,s)).data,submitAudit:async(t,s)=>(await ze.post(`/eor/audit/${t}`,s)).data},Zx=Object.freeze(Object.defineProperty({__proto__:null,eorService:gE},Symbol.toStringTag,{value:"Module"})),x$={getAuditLogs:async(t,s,n=1,r=50)=>{var a;try{const l=await Te.getAuditLogs(t,s,n,r);return((a=l.data)==null?void 0:a.data)||l.data||[]}catch(l){throw console.error("Get audit logs error:",l),l}},getAuditSummary:async(t,s)=>{var n;try{const r=await Te.getAuditSummary(t,s);return((n=r.data)==null?void 0:n.data)||r.data}catch(r){throw console.error("Get audit summary error:",r),r}}},g$={getWorknotes:async(t,s)=>{var r,a;const n=await Te.getWorknotes(t,s);if(!n.ok)throw new Error(((r=n.data)==null?void 0:r.message)||"Failed to fetch worknotes");return((a=n.data)==null?void 0:a.data)||n.data},addWorknote:async t=>{var n,r;const s=await Te.addWorknote(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to add worknote");return((r=s.data)==null?void 0:r.data)||s.data},addParticipant:async t=>{var n;const s=await Te.addParticipant(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to add participant");return s.data},removeParticipant:async t=>{var n;const s=await Te.removeParticipant(t);if(!s.ok)throw new Error(((n=s.data)==null?void 0:n.message)||"Failed to remove participant");return s.data}};function v$({applicationId:t}){const[s,n]=v.useState(null),[r,a]=v.useState(!0),[l,c]=v.useState([]),[d,m]=v.useState(null),[x,f]=v.useState([]),[h,g]=v.useState(!1),[u,j]=v.useState([]),[p,y]=v.useState([]),[N,S]=v.useState({}),A=v.useCallback(async()=>{try{const C=await ds.getDocuments(t);c(C||[])}catch(C){console.error("Failed to refresh documents:",C)}},[t]),w=v.useCallback(async(C=!1)=>{try{C||a(!0);const L=await ds.getApplicationById(t),$=(R,P)=>{var q;const M=(q=L.progressTracking)==null?void 0:q.find(K=>K.stageName===R);if(M!=null&&M.stageCompletedAt)return new Date(M.stageCompletedAt).toISOString();if(M!=null&&M.stageStartedAt)return new Date(M.stageStartedAt).toISOString();if(P){const K=(L.statusHistory||[]).find(Z=>Z.newStatus===P);if(K)return new Date(K.createdAt).toISOString()}},_={id:L.id,registrationNumber:L.applicationId||"N/A",name:L.applicantName,email:L.email,phone:L.phone,age:L.age,education:L.education,residentialAddress:L.address||L.city||"",businessAddress:L.address||"",preferredLocation:L.preferredLocation,state:L.state,ownsBike:L.ownRoyalEnfield==="yes",pastExperience:L.experienceYears?`${L.experienceYears} years`:L.description||"",status:L.overallStatus,questionnaireMarks:L.score||L.questionnaireMarks||0,questionnaireResponses:L.questionnaireResponses||[],rank:0,totalApplicantsAtLocation:0,assignedUsers:[],progress:L.progressPercentage||0,isShortlisted:L.isShortlisted||!0,companyName:L.companyName,source:L.source,existingDealer:L.existingDealer,royalEnfieldModel:L.royalEnfieldModel,description:L.description,pincode:L.pincode,locationType:L.locationType,ownRoyalEnfield:L.ownRoyalEnfield,address:L.address,submissionDate:L.createdAt?new Date(L.createdAt).toISOString():"",questionnaireDate:$("Questionnaire","Questionnaire Completed")||$("Questionnaire","Questionnaire Pending"),shortlistDate:$("Shortlist","Shortlisted"),level1InterviewDate:$("1st Level Interview","Level 1 Approved"),level2InterviewDate:$("2nd Level Interview","Level 2 Approved"),level3InterviewDate:$("3rd Level Interview","Level 3 Approved"),fddDate:$("FDD","FDD Verification"),loiApprovalDate:$("LOI Approval","LOI In Progress"),securityDetailsDate:$("Security Details","Security Details"),loiIssueDate:$("LOI Issue","LOI Issued"),dealerCodeDate:$("Dealer Code Generation","Dealer Code Generation"),architectureAssignedDate:$("Architecture Team Assigned","Architecture Team Assigned"),architectureDocumentDate:$("Architecture Document Upload","Architecture Document Upload"),architectureCompletionDate:$("Architecture Team Completion","Architecture Team Completion"),loaDate:$("LOA","LOA Pending"),eorCompleteDate:$("EOR Complete","EOR Complete"),inaugurationDate:$("Inauguration","Inauguration"),onboardedDate:L.overallStatus==="Onboarded"?L.updatedAt?new Date(L.updatedAt).toISOString():new Date().toISOString():void 0,progressTracking:L.progressTracking||[],participants:L.participants||[],dealerCode:L.dealerCode,zoneId:L.zoneId,regionId:L.regionId,areaId:L.areaId,districtId:L.districtId,stageApprovals:L.stageApprovals||[],fddAssignments:L.fddAssignments||[],constitutionType:L.constitutionType,architectureStatus:L.architectureStatus,statutoryStatus:L.statutoryStatus,panNumber:L.panNumber,gstNumber:L.gstNumber,bankName:L.bankName,accountNumber:L.accountNumber,ifscCode:L.ifscCode,branchName:L.branchName,accountHolderName:L.accountHolderName,registeredAddress:L.registeredAddress};n(_),L.uploadedDocuments&&c(L.uploadedDocuments||[])}catch(L){console.error("Failed to fetch application details",L)}finally{a(!1)}},[t]),E=v.useCallback(async()=>{if(t)try{const C=await gE.getChecklist(t);C.success&&C.data&&m(C.data)}catch{m(null)}},[t]),T=C=>p.find(L=>L.depositType===C);return v.useEffect(()=>{t&&(w(),A())},[t]),v.useEffect(()=>{t&&E()},[t,s==null?void 0:s.status]),v.useEffect(()=>{if(!(s!=null&&s.id))return;(async()=>{g(!0);try{const L=await x$.getAuditLogs("application",s.id,1,100);f(Array.isArray(L)?L:[])}catch{f([])}finally{g(!1)}try{const L=await g$.getWorknotes("application",s.id);j(L.data||[])}catch{j([])}})()},[s==null?void 0:s.id]),v.useEffect(()=>{if(!t)return;(async()=>{try{const[L,$]=await Promise.all([ds.getSecurityDeposit(t),ds.getSystemConfigs({category:"SECURITY_DEPOSIT",format:"map"})]);y(Array.isArray(L)?L:[L].filter(Boolean)),S($||{})}catch(L){console.error("Failed to fetch payment data",L)}})()},[t]),{application:s,loading:r,setLoading:a,documents:l,setDocuments:c,eorData:d,auditLogs:x,auditLoading:h,worknotes:u,deposits:p,paymentConfigs:N,refreshDocuments:A,fetchApplication:w,fetchEorData:E,getDeposit:T}}function b$({application:t,applicationId:s,tempFirmType:n,setUpdatingFirmType:r,setShowFirmTypeModal:a,setStatutoryForm:l,setIsEditingStatutory:c,setIsSavingStatutory:d,statutoryForm:m,setFddAgencies:x,selectedAgencyId:f,setIsAssigningAgency:h,fetchApplication:g}){const u=async()=>{try{r(!0),await ds.updateApplication(s,{constitutionType:n}),ee.success("Firm type updated successfully"),a(!1),await g()}catch{ee.error("Failed to update firm type")}finally{r(!1)}},j=()=>{t&&(l({accountHolderName:t.accountHolderName||"",panNumber:t.panNumber||"",gstNumber:t.gstNumber||"",bankName:t.bankName||"",accountNumber:t.accountNumber||"",ifscCode:t.ifscCode||"",registeredAddress:t.registeredAddress||""}),c(!0))},p=async()=>{try{d(!0),await ds.updateApplication(s,m),ee.success("Statutory & Bank details updated successfully"),c(!1),await g(!0)}catch{ee.error("Failed to update details")}finally{d(!1)}},y=v.useCallback(async()=>{try{const S=await ds.getUsers({roleCode:"FDD"});x(Array.isArray(S)?S:[])}catch{x([])}},[x]);return{handleUpdateFirmType:u,handleEditStatutory:j,handleSaveStatutory:p,fetchFddAgencies:y,handleAssignAgency:async()=>{if(!f){ee.warning("Please select an agency");return}try{h(!0),await ds.assignFddAgency({applicationId:(t==null?void 0:t.id)||s,assignedToAgency:f}),await ds.addParticipant({requestId:(t==null?void 0:t.id)||s,requestType:"application",userId:f,participantType:"contributor"}),ee.success("FDD Agency assigned and added as participant"),await g()}catch{ee.error("Failed to assign agency")}finally{h(!1)}}}}function y$({application:t,documents:s,interviews:n,eorData:r,getDeposit:a}){var j;const l=p=>String(p||"").trim().toLowerCase().replace(/[_\s-]+/g," "),c=(p,y)=>{var A,w,E;const N=[(A=p==null?void 0:p.user)==null?void 0:A.role,(w=p==null?void 0:p.user)==null?void 0:w.roleCode,(E=p==null?void 0:p.metadata)==null?void 0:E.role].map(l),S=y.map(l);return N.some(T=>S.includes(T))},d=p=>{var y,N,S,A,w;return`${((y=p==null?void 0:p.user)==null?void 0:y.fullName)||((N=p==null?void 0:p.user)==null?void 0:N.name)||"User"} (${((S=p==null?void 0:p.user)==null?void 0:S.role)||((A=p==null?void 0:p.user)==null?void 0:A.roleCode)||((w=p==null?void 0:p.metadata)==null?void 0:w.role)||(p==null?void 0:p.participantType)||"participant"})`},m=p=>(s||[]).some(y=>y.documentType===p),x=(p,y="pending")=>{const N=(t.progressTracking||[]).find(S=>S.stageName===p);return N!=null&&N.status?N.status:y},f=[{id:1,name:"Submitted",status:"completed",date:t.submissionDate,description:"Application submitted",documentsUploaded:3},{id:2,name:"Questionnaire",status:x("Questionnaire"),date:t.questionnaireDate,description:"Questionnaire completed",documentsUploaded:0},{id:3,name:"Shortlist",status:x("Shortlist"),date:t.shortlistDate,description:"Application shortlisted by DD",evaluators:Array.from(new Set((t.participants||[]).filter(p=>p.participantType==="assignee").map(p=>{var y,N,S;return`${((y=p.user)==null?void 0:y.fullName)||((N=p.user)==null?void 0:N.name)||"User"} (${((S=p.user)==null?void 0:S.roleCode)||p.participantType})`}))),documentsUploaded:2},{id:4,name:"1st Level Interview",status:x("1st Level Interview"),date:t.level1InterviewDate,description:"DD-ZM + RBM evaluation",evaluators:Array.from(new Set((t.participants||[]).filter(p=>{var y,N,S,A,w,E;return((y=p.metadata)==null?void 0:y.interviewLevel)===1||((N=p.metadata)==null?void 0:N.interviewLevel)==="1"||((A=(S=p.metadata)==null?void 0:S.allAssignments)==null?void 0:A.includes(1))||((E=(w=p.metadata)==null?void 0:w.allAssignments)==null?void 0:E.includes("1"))||c(p,["DD-ZM","RBM"])}).map(d))),documentsUploaded:1},{id:5,name:"2nd Level Interview",status:x("2nd Level Interview"),date:t.level2InterviewDate,description:"DD Lead + ZBH evaluation",evaluators:Array.from(new Set((t.participants||[]).filter(p=>{var y,N,S,A,w,E;return((y=p.metadata)==null?void 0:y.interviewLevel)===2||((N=p.metadata)==null?void 0:N.interviewLevel)==="2"||((A=(S=p.metadata)==null?void 0:S.allAssignments)==null?void 0:A.includes(2))||((E=(w=p.metadata)==null?void 0:w.allAssignments)==null?void 0:E.includes("2"))||c(p,["DD Lead","ZBH"])}).map(d))),documentsUploaded:1},{id:6,name:"3rd Level Interview",status:x("3rd Level Interview"),date:t.level3InterviewDate,description:"NBH + DD Head evaluation",evaluators:Array.from(new Set((t.participants||[]).filter(p=>{var y,N,S,A,w,E;return((y=p.metadata)==null?void 0:y.interviewLevel)===3||((N=p.metadata)==null?void 0:N.interviewLevel)==="3"||((A=(S=p.metadata)==null?void 0:S.allAssignments)==null?void 0:A.includes(3))||((E=(w=p.metadata)==null?void 0:w.allAssignments)==null?void 0:E.includes("3"))||c(p,["NBH","DD Head"])}).map(d))),documentsUploaded:2},{id:7,name:"FDD",status:x("FDD"),date:t.fddDate,description:"Financial Due Diligence",documentsUploaded:5},{id:8,name:"LOI Approval",status:x("LOI Approval"),date:t.loiApprovalDate,description:"Letter of Intent approval",evaluators:Array.from(new Set((t.participants||[]).filter(p=>{var y,N,S;return((y=p.metadata)==null?void 0:y.stageCode)==="LOI_APPROVAL"||((S=(N=p.metadata)==null?void 0:N.allAssignments)==null?void 0:S.includes("LOI_APPROVAL"))}).map(d))),documentsUploaded:1},{id:9,name:"Security Details",status:x("Security Details"),date:t.securityDetailsDate,description:"Security verification",documentsUploaded:3},{id:10,name:"LOI Issue",status:x("LOI Issue"),date:t.loiIssueDate,description:"Letter of Intent issued",documentsUploaded:1},{id:11,name:"Dealer Code Generation",status:x("Dealer Code Generation"),date:t.dealerCodeDate,description:"Dealer code generated and assigned",isParallel:!0,branches:[{name:"Architectural Work",color:"green",stages:[{id:"11a-1",name:"Architecture Assignment",status:t.architectureAssignedTo?"completed":t.status==="Architecture Team Assigned"?"active":"pending",description:"Assigned to architecture team"},{id:"11a-2",name:"Site Plan Blueprint",status:m("Architecture Blueprint")?"completed":t.architectureAssignedTo?"active":"pending",description:"Blueprints and site plans"},{id:"11a-3",name:"Architecture Work",status:t.architectureStatus==="COMPLETED"?"completed":t.architectureStatus==="IN_PROGRESS"||m("Architecture Blueprint")?"active":"pending",description:"Final architecture approval"}]},{name:"Statutory Documents",color:"green",stages:[{id:"11b-1",name:"GST",status:m("GST Certificate")||m("GST")?"completed":"active",description:"GST certificate"},{id:"11b-2",name:"PAN",status:m("PAN Card")||m("PAN")?"completed":"active",description:"PAN card"},{id:"11b-3",name:"Nodal Agreement",status:m("Nodal Agreement")?"completed":"active",description:"Nodal agreement document"},{id:"11b-4",name:"Cancelled Check",status:m("Cancelled Check")?"completed":"active",description:"Cancelled check copy"},{id:"11b-5",name:"Partnership Deed/LLP/MOA/AOA/COI",status:m("Partnership Deed/LLP/MOA/AOA/COI")||m("Partnership Deed")?"completed":"active",description:"Business entity documents"},{id:"11b-6",name:"Firm Registration Certificate",status:m("Firm Registration Certificate")||m("Firm Registration")?"completed":"active",description:"Firm registration certificate"},{id:"11b-7",name:"Rental agreement/ Lease agreement / Own/ Land agreement",status:m("Rental agreement/ Lease agreement / Own/ Land agreement")||m("Property Document")?"completed":"active",description:"Property agreement document"},{id:"11b-8",name:"Virtual Code",status:m("Virtual Code")||m("Virtual Code Confirmation")?"completed":"active",description:"Virtual code availability"},{id:"11b-9",name:"Domain ID",status:m("Domain ID")||m("Domain ID Setup")?"completed":"active",description:"Domain ID setup"},{id:"11b-10",name:"MSD Configuration",status:m("MSD Configuration")?"completed":"active",description:"Microsoft Dynamics configuration"},{id:"11b-11",name:"LOI Acknowledgement Copy",status:m("LOI Acknowledgement Copy")||m("LOI Acknowledgement")?"completed":"active",description:"LOI acknowledgement copy"}]}]},{id:12,name:"LOA",status:x("LOA"),isLocked:t.status==="LOA Pending"&&((j=a("FIRST_FILL"))==null?void 0:j.status)!=="Verified",lockMessage:"First Fill (₹15L) must be verified by Finance before LOA Approval.",evaluators:Array.from(new Set((t.participants||[]).filter(p=>{var y,N,S;return((y=p.metadata)==null?void 0:y.stageCode)==="LOA_APPROVAL"||((S=(N=p.metadata)==null?void 0:N.allAssignments)==null?void 0:S.includes("LOA_APPROVAL"))}).map(d))),description:"Letter of Authorization"},{id:13,name:"EOR Complete",status:x("EOR Complete"),description:"Essential Operating Requirements"},{id:14,name:"Inauguration",status:x("Inauguration"),description:"Dealership inauguration"},{id:15,name:"Dealership Active",status:x("Onboarded"),description:"Dealer profile active"}],h=[{id:1,item:"Sales Standards",completed:!1},{id:2,item:"Service & Spares",completed:!1},{id:3,item:"DMS infra",completed:!1},{id:4,item:"Manpower Training",completed:!1},{id:5,item:"Trade certificate with test ride bikes registration",completed:!1},{id:6,item:"GST certificate including Accessories & Apparels billing",completed:!1},{id:7,item:"Inventory Funding",completed:!1},{id:8,item:"Virtual code availability",completed:!1},{id:9,item:"Vendor payments",completed:!1},{id:10,item:"Details for website submission",completed:!1},{id:11,item:"Infra Insurance both Showroom and Service center",completed:!1},{id:12,item:"Auto ordering",completed:!1}],g=f.reduce((p,y)=>(p.push({name:y.name}),y.branches&&y.branches.forEach(N=>N.stages.forEach(S=>p.push({name:S.name,parentBranch:N.name}))),(y.name==="EOR In Progress"||y.name==="EOR Complete")&&((r==null?void 0:r.items)||h).forEach(N=>p.push({name:`EOR: ${N.description||N.item}`,parentBranch:"EOR"})),p),[]);return{processStages:f,eorChecklist:h,flattenedStages:g,getDocumentsForStage:p=>s.filter(y=>{var N;return y.stage===p||!y.stage&&((N=y.documentType)==null?void 0:N.toLowerCase().includes(p.toLowerCase().split(" ")[0]))})}}const h1=()=>{var ul;const{id:t}=Bc(),s=qn(),{user:n}=Nn(ga=>ga.auth),r=t||"",a=()=>s(-1),{application:l,loading:c,setLoading:d,documents:m,setDocuments:x,eorData:f,auditLogs:h,auditLoading:g,worknotes:u,deposits:j,paymentConfigs:p,refreshDocuments:y,fetchApplication:N,fetchEorData:S,getDeposit:A}=v$({applicationId:r}),w=f!=null&&f.items?f.items.filter(ga=>ga.isCompliant).length/f.items.length*100:0,E=Ul(),{showFirmTypeModal:T,setShowFirmTypeModal:C,updatingFirmType:L,setUpdatingFirmType:$,tempFirmType:_,setTempFirmType:R,activeTab:P,setActiveTab:M,showApproveModal:q,setShowApproveModal:K,showOnboardModal:Z,setShowOnboardModal:W,isOnboarding:U,setIsOnboarding:F,showRejectModal:B,setShowRejectModal:D,rejectionReason:O,setRejectionReason:z,scheduledInterviewParticipants:G,setScheduledInterviewParticipants:Y,showScheduleModal:V,setShowScheduleModal:X,showCancelInterviewModal:ne,setShowCancelInterviewModal:oe,interviewIdToCancel:re,setInterviewIdToCancel:ge,showKTMatrixModal:ve,setShowKTMatrixModal:Se,showLevel2FeedbackModal:We,setShowLevel2FeedbackModal:Ce,showLevel3FeedbackModal:fe,setShowLevel3FeedbackModal:Ye,showDocumentsModal:be,setShowDocumentsModal:Pe,showAssignModal:ke,setShowAssignModal:qe,selectedStage:Ve,setSelectedStage:dt,interviewMode:xt,setInterviewMode:ye,approvalRemark:le,setApprovalRemark:Qe,expandedBranches:rt,setExpandedBranches:Gt,users:Rt,setUsers:Re,selectedUser:Qt,setSelectedUser:qt,participantType:ws,setParticipantType:Ps,interviewDate:ns,setInterviewDate:Cs,interviewType:Bs,setInterviewType:Ft,meetingLink:ie,setMeetingLink:Fe,location:Q,setLocation:pe,showUploadForm:Ne,setShowUploadForm:Ee,uploadFile:it,setUploadFile:st,uploadDocType:bt,setUploadDocType:Ue,approvalFile:It,setApprovalFile:ut,isUploading:yt,setIsUploading:kt,previewDoc:Le,setPreviewDoc:Pt,showPreviewModal:ht,setShowPreviewModal:zt,selectedInterviewerId:rs,setSelectedInterviewerId:Yt,isEditingStatutory:Os,setIsEditingStatutory:Ls,statutoryForm:zs,setStatutoryForm:en,isSavingStatutory:he,setIsSavingStatutory:Ke,interviews:at,setInterviews:pt,isScheduling:mt,setIsScheduling:Bt,isCancellingInterview:Ds,setIsCancellingInterview:as,showAssignArchitectureModal:Vs,setShowAssignArchitectureModal:Is,architectureLeadId:Ts,setArchitectureLeadId:ln,isAssigningArchitecture:pn,setIsAssigningArchitecture:hn,showArchitectureStatusModal:Ws,setShowArchitectureStatusModal:Qs,architectureStatus:zn,setArchitectureStatus:on,architectureRemarks:Un,setArchitectureRemarks:yr,isUpdatingArchitecture:Tr,setIsUpdatingArchitecture:er,isAssigningParticipant:tr,setIsAssigningParticipant:En,documentConfigs:Xe,setDocumentConfigs:$t,fddAgencies:Ze,setFddAgencies:Ut,selectedAgencyId:jt,setSelectedAgencyId:Ln,isAssigningAgency:jr,setIsAssigningAgency:_r,isApproving:xn,setIsApproving:qs,isRejecting:ha,setIsRejecting:Tt,ktMatrixScores:xs,setKtMatrixScores:Vr,ktMatrixSelectedValues:ta,setKtMatrixSelectedValues:ma,ktMatrixRemarks:Pr,setKtMatrixRemarks:sr,ktMatrixRecommendation:gn,setKtMatrixRecommendation:mn,isSubmittingKT:Qn,setIsSubmittingKT:fr,selectedInterviewForFeedback:pr,setSelectedInterviewForFeedback:dn,showFddFinalizeModal:wn,setShowFddFinalizeModal:Da,showFddFlagModal:fa,setShowFddFlagModal:Ai,fddAuditRecommendation:ki,setFddAuditRecommendation:ni,fddAuditFindings:rl,setFddAuditFindings:Ko,isFinalizingFdd:Ta,setIsFinalizingFdd:ri,isFddFlagging:_a,setIsFddFlagging:Pa,level2Feedback:to,setLevel2Feedback:Zc,level2Recommendation:Oa,setLevel2Recommendation:Vn,isSubmittingLevel2:ai,setIsSubmittingLevel2:Ri,level3Feedback:Or,setLevel3Feedback:so,level3Recommendation:Ei,setLevel3Recommendation:no,isSubmittingLevel3:ii,setIsSubmittingLevel3:al,showFeedbackDetailsModal:ro,setShowFeedbackDetailsModal:Hs,selectedEvaluationForView:J,setSelectedEvaluationForView:te}=d$({initialTab:((ul=E.state)==null?void 0:ul.activeTab)||"questionnaire"}),ue=(u||[]).some(ga=>(ga.noteText||"").includes("FLAGGED:"))||(l==null?void 0:l.statutoryStatus)==="Flagged",{handleUpdateFirmType:xe,handleEditStatutory:we,handleSaveStatutory:$e,fetchFddAgencies:Be,handleAssignAgency:lt}=b$({application:l,applicationId:r,tempFirmType:_,setUpdatingFirmType:$,setShowFirmTypeModal:C,setStatutoryForm:en,setIsEditingStatutory:Ls,setIsSavingStatutory:Ke,statutoryForm:zs,setFddAgencies:Ut,selectedAgencyId:jt,setIsAssigningAgency:_r,fetchApplication:N}),Jt=(n==null?void 0:n.roleCode)==="Super Admin"||(n==null?void 0:n.roleCode)==="DD Admin"||(n==null?void 0:n.role)==="Super Admin"||(n==null?void 0:n.role)==="DD Admin",Mt=(n==null?void 0:n.roleCode)==="Super Admin"||(n==null?void 0:n.roleCode)==="DD Admin"||(n==null?void 0:n.role)==="Super Admin"||(n==null?void 0:n.role)==="DD Admin"||(n==null?void 0:n.role)==="NBH"||(n==null?void 0:n.role)==="DD Head"||(n==null?void 0:n.roleCode)==="NBH"||(n==null?void 0:n.roleCode)==="DD_HEAD";v.useEffect(()=>{(async()=>{try{const li=await ds.getDocumentConfigs({limit:1e3}),qf=li.data||(Array.isArray(li)?li:[]);$t(qf)}catch(li){console.error("Failed to fetch document configs:",li)}})()},[$t]),v.useEffect(()=>{V&&l&&(l.status==="Shortlisted"||l.status==="Questionnaire Completed"?Ft("level1"):l.status==="Level 1 Approved"?Ft("level2"):(l.status==="Level 2 Approved"||l.status==="Level 2 Recommended")&&Ft("level3"))},[V,l==null?void 0:l.status,Ft]);const Et=async()=>{if(r)try{const ga=await ds.getInterviews(r);pt(ga||[])}catch(ga){console.error("Failed to fetch interviews",ga)}};v.useEffect(()=>{Et()},[r]);const{ktMatrixConfig:gs,level2Config:tn,level3Config:Hn}=f$(),{handleKTMatrixChange:Ot,calculateKTScore:bs,handleSubmitKTMatrix:es,handleLevel2Change:Sn,handleSubmitLevel2Feedback:xr,handleLevel3Change:Dn,handleSubmitLevel3Feedback:nr,ktCriteria:Lr,l2Fields:La,l3Fields:rr}=m$({ktMatrixScores:xs,setKtMatrixScores:Vr,setKtMatrixSelectedValues:ma,ktMatrixRemarks:Pr,setKtMatrixRemarks:sr,ktMatrixRecommendation:gn,setKtMatrixRecommendation:mn,selectedInterviewForFeedback:pr,interviews:at,setIsSubmittingKT:fr,setShowKTMatrixModal:Se,level2Feedback:to,setLevel2Feedback:Zc,level2Recommendation:Oa,setLevel2Recommendation:Vn,setIsSubmittingLevel2:Ri,setShowLevel2FeedbackModal:Ce,level3Feedback:Or,setLevel3Feedback:so,level3Recommendation:Ei,setLevel3Recommendation:no,setIsSubmittingLevel3:al,setShowLevel3FeedbackModal:Ye,currentUser:n,fetchInterviews:Et,fetchApplication:N,ktMatrixConfig:gs,level2Config:tn,level3Config:Hn});v.useEffect(()=>{["documents","progress","fdd","eor"].includes(P)&&r&&y(),P==="fdd"&&((n==null?void 0:n.role)==="DD Admin"||(n==null?void 0:n.role)==="Super Admin")&&Be()},[P,r,y,Be,n==null?void 0:n.role]);const{handleAddInterviewer:ao,handleRemoveInterviewer:il,maybeFetchUsersForModal:io,handleScheduleInterview:lo,handleCancelInterview:ll,handleConfirmCancelInterview:Di,handleUpload:Ia,handleApprove:Go,handleReject:ar,handleGenerateDealerCodes:Yo,handleAssignArchitecture:pa,handleUpdateArchitectureStatus:ol,handleAddParticipant:Ti,handleRetriggerEvaluators:xa}=p$({application:l,applicationId:r,currentUser:n,interviews:at,approvalFile:It,approvalRemark:le,rejectionReason:O,architectureLeadId:Ts,architectureStatus:zn,architectureRemarks:Un,selectedUser:Qt,participantType:ws,users:Rt,interviewDate:ns,interviewType:Bs,interviewMode:xt,meetingLink:ie,location:Q,scheduledInterviewParticipants:G,uploadFile:it,uploadDocType:bt,selectedStage:Ve,setIsApproving:qs,setShowApproveModal:K,setApprovalRemark:Qe,setApprovalFile:ut,setIsRejecting:Tt,setShowRejectModal:D,setRejectionReason:z,setIsAssigningArchitecture:hn,setShowAssignArchitectureModal:Is,setIsUpdatingArchitecture:er,setShowArchitectureStatusModal:Qs,setIsAssigningParticipant:En,setSelectedUser:qt,setShowAssignModal:qe,setLoading:d,setIsScheduling:Bt,setShowScheduleModal:X,setShowCancelInterviewModal:oe,interviewIdToCancel:re,setInterviewIdToCancel:ge,setIsCancellingInterview:as,setIsUploading:kt,setShowUploadForm:Ee,setUploadFile:st,setUploadDocType:Ue,setDocuments:x,selectedInterviewerId:rs,setSelectedInterviewerId:Yt,setScheduledInterviewParticipants:Y,setUsers:Re,showScheduleModal:V,showAssignArchitectureModal:Vs,showAssignModal:ke,fetchApplication:N,fetchInterviews:Et,fetchEorData:S});if(v.useEffect(()=>{io()},[V,Vs,ke,Bs,l==null?void 0:l.id,io]),c&&!l)return e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx(ss,{className:"w-10 h-10 animate-spin text-amber-600"})});if(!l)return e.jsx("div",{className:"flex justify-center items-center h-96",children:"Application not found"});const{processStages:Ma,eorChecklist:cl,flattenedStages:_i,getDocumentsForStage:oo}=y$({application:l,documents:m,interviews:at,eorData:f,getDeposit:A}),{activeInterviewForUser:ku,currentUserEvaluation:dl,hasSubmittedFeedback:Ff,currentUserStageAction:Bf,isInterviewCompleted:$f,isInterviewActive:Ru,permissions:Eu}=c$({application:l,interviews:at,currentUser:n,getDeposit:A,eorProgress:w}),co=()=>e.jsx(r$,{application:l,currentUser:n,documents:m,fddAgencies:Ze,selectedAgencyId:jt,setSelectedAgencyId:Ln,isAssigningAgency:jr,handleAssignAgency:lt,setPreviewDoc:Pt,setShowPreviewModal:zt,setIsUploading:kt,fetchApplication:N,refreshDocuments:y});return e.jsxs("div",{className:"space-y-6",children:[e.jsx(z7,{application:l,isNonResponsive:ue,isAdmin:Mt,onBack:a,onOpenWorknotes:()=>s(`/worknotes/application/${l.id}`,{state:{applicationName:l.name,registrationNumber:l.registrationNumber,participants:l.participants}})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsx(Y7,{application:l,canEditStatutory:Jt,isEditingStatutory:Os,isSavingStatutory:he,statutoryForm:zs,onEditFirmType:()=>{R(l.constitutionType||""),C(!0)},onEditStatutory:we,onCancelEditStatutory:()=>Ls(!1),onSaveStatutory:$e,onStatutoryFormChange:en}),l.isShortlisted!==!1&&e.jsx(J7,{application:l,activeTab:P,setActiveTab:M,processStages:Ma,documents:m,interviews:at,expandedBranches:rt,setExpandedBranches:Gt,setSelectedStage:dt,setShowDocumentsModal:Pe,setShowUploadForm:Ee,handleRetriggerEvaluators:xa,handleCancelInterview:ll,setSelectedEvaluationForView:te,setShowFeedbackDetailsModal:Hs,renderFddAuditContent:co,eorProgress:w,eorData:f,eorChecklist:cl,setUploadDocType:Ue,isAdmin:Mt,fetchApplication:N,fetchEorData:S,deposits:j,getDeposit:A,paymentConfigs:p,setPreviewDoc:Pt,setShowPreviewModal:zt,auditLoading:g,auditLogs:h,auditLogActionBadgeClass:a$})]}),e.jsx(e$,{application:l,permissions:Eu,getDeposit:A,isNonResponsive:ue,isAdmin:Mt,currentUserStageAction:Bf,currentUserEvaluation:dl,onOpenApproveModal:()=>K(!0),onOpenRejectModal:()=>D(!0),onOpenWorknote:()=>s(`/worknotes/application/${l.id}`,{state:{applicationName:l.name,registrationNumber:l.registrationNumber,participants:l.participants}}),onOpenScheduleModal:()=>X(!0),currentUser:n,handleGenerateDealerCodes:Yo,onOpenAssignArchitectureModal:()=>Is(!0),activeInterviewForUser:ku,hasSubmittedFeedback:Ff,setSelectedInterviewForFeedback:dn,setShowKTMatrixModal:Se,setShowLevel2FeedbackModal:Ce,setShowLevel3FeedbackModal:Ye,onGoToDashboard:()=>s("/dashboard"),showAssignModal:ke,setShowAssignModal:qe,selectedUser:Qt,setSelectedUser:qt,users:Rt,participantType:ws,setParticipantType:Ps,handleAddParticipant:Ti,isAssigningParticipant:tr}),e.jsx(t$,{application:l,fetchApplication:N,showApproveModal:q,setShowApproveModal:K,approvalRemark:le,setApprovalRemark:Qe,setApprovalFile:ut,isApproving:xn,handleApprove:Go,showOnboardModal:Z,setShowOnboardModal:W,isOnboarding:U,setIsOnboarding:F,showRejectModal:B,setShowRejectModal:D,rejectionReason:O,setRejectionReason:z,isRejecting:ha,handleReject:ar,showScheduleModal:V,setShowScheduleModal:X,showCancelInterviewModal:ne,setShowCancelInterviewModal:oe,setInterviewIdToCancel:ge,isCancellingInterview:Ds,handleConfirmCancelInterview:Di,interviewType:Bs,setInterviewType:Ft,interviewMode:xt,setInterviewMode:ye,interviewDate:ns,setInterviewDate:Cs,meetingLink:ie,setMeetingLink:Fe,location:Q,setLocation:pe,isInterviewCompleted:$f,isInterviewActive:Ru,users:Rt,selectedInterviewerId:rs,setSelectedInterviewerId:Yt,handleAddInterviewer:ao,scheduledInterviewParticipants:G,handleRemoveInterviewer:il,isScheduling:mt,handleScheduleInterview:lo,showAssignArchitectureModal:Vs,setShowAssignArchitectureModal:Is,architectureLeadId:Ts,setArchitectureLeadId:ln,isAssigningArchitecture:pn,handleAssignArchitecture:pa,showArchitectureStatusModal:Ws,setShowArchitectureStatusModal:Qs,architectureStatus:zn,setArchitectureStatus:on,architectureRemarks:Un,setArchitectureRemarks:yr,isUpdatingArchitecture:Tr,handleUpdateArchitectureStatus:ol}),e.jsx(s$,{application:l,ktCriteria:Lr,l2Fields:La,l3Fields:rr,showKTMatrixModal:ve,setShowKTMatrixModal:Se,ktMatrixSelectedValues:ta,handleKTMatrixChange:Ot,ktMatrixRemarks:Pr,setKtMatrixRemarks:sr,ktMatrixRecommendation:gn,setKtMatrixRecommendation:mn,calculateKTScore:bs,handleSubmitKTMatrix:es,isSubmittingKT:Qn,showLevel2FeedbackModal:We,setShowLevel2FeedbackModal:Ce,level2Feedback:to,handleLevel2Change:Sn,level2Recommendation:Oa,setLevel2Recommendation:Vn,handleSubmitLevel2Feedback:xr,isSubmittingLevel2:ai,showFeedbackDetailsModal:ro,setShowFeedbackDetailsModal:Hs,selectedEvaluationForView:J,selectedInterviewForFeedback:pr,showLevel3FeedbackModal:fe,setShowLevel3FeedbackModal:Ye,level3Feedback:Or,handleLevel3Change:Dn,level3Recommendation:Ei,setLevel3Recommendation:no,handleSubmitLevel3Feedback:nr,isSubmittingLevel3:ii,showDocumentsModal:be,setShowDocumentsModal:Pe,showUploadForm:Ne,setShowUploadForm:Ee,selectedStage:Ve,getDocumentsForStage:oo,setPreviewDoc:Pt,setShowPreviewModal:zt,flattenedStages:_i,setSelectedStage:dt,uploadDocType:bt,setUploadDocType:Ue,setUploadFile:st,isUploading:yt,handleUpload:Ia,uploadFile:it,documentConfigs:Xe,showPreviewModal:ht,previewDoc:Le,showFddFinalizeModal:wn,setShowFddFinalizeModal:Da,currentUser:n,fddAuditRecommendation:ki,setFddAuditRecommendation:ni,fddAuditFindings:rl,setFddAuditFindings:Ko,isFinalizingFdd:Ta,setIsFinalizingFdd:ri,fetchApplication:N,showFddFlagModal:fa,setShowFddFlagModal:Ai,isFddFlagging:_a,setIsFddFlagging:Pa,showFirmTypeModal:T,setShowFirmTypeModal:C,tempFirmType:_,setTempFirmType:R,updatingFirmType:L,handleUpdateFirmType:xe})]})]})},Qx=t=>t.includes("Approved")||t.includes("Completed")?"bg-green-100 text-green-700 border-green-300":t.includes("Review")||t.includes("Pending")?"bg-yellow-100 text-yellow-700 border-yellow-300":t.includes("Rejected")?"bg-red-100 text-red-700 border-red-300":"bg-blue-100 text-blue-700 border-blue-300";function j$({onViewDetails:t}){const[s,n]=v.useState([]),[r,a]=v.useState(!0),[l,c]=v.useState(1),[d,m]=v.useState("all"),[x,f]=v.useState(null),h=10,g=async()=>{var y;a(!0);try{const S=(await Te.getResignations({page:l,limit:h,status:d==="all"?void 0:d==="open"?"open":"Completed,Closed"})).data;S!=null&&S.success&&(n(S.requests||((y=S.resignations)==null?void 0:y.rows)||S.resignations||[]),f(S.meta))}catch(N){console.error("Error fetching resignations:",N),ee.error("Failed to fetch resignation requests")}finally{a(!1)}};v.useEffect(()=>{g()},[l,d]);const u=y=>{m(y),c(1)},j=d==="open"?s:[],p=d==="completed"?s:[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs(Ie,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"All Requests"}),e.jsx(nt,{className:"text-3xl",children:(x==null?void 0:x.total)||0})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Total Requests"})})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Open"}),e.jsx(nt,{className:"text-3xl text-yellow-600",children:d==="open"?(x==null?void 0:x.total)||0:"..."})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Requires Your Action"})})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Completed"}),e.jsx(nt,{className:"text-3xl text-green-600",children:d==="completed"?(x==null?void 0:x.total)||0:"..."})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Finalized"})})]})]}),e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx(nt,{children:"Resignation Requests"}),e.jsxs(Zt,{children:["Track and manage dealer resignation requests",e.jsx("span",{className:"block mt-1 text-slate-500",children:"• Note: Resignation requests are initiated by the dealer or via ASM."})]})]})})}),e.jsx(Me,{children:e.jsxs(_n,{value:d,onValueChange:u,className:"w-full",children:[e.jsxs(Pn,{children:[e.jsx(Wt,{value:"all",children:"All Requests"}),e.jsx(Wt,{value:"open",children:"Open"}),e.jsx(Wt,{value:"completed",children:"Completed"})]}),e.jsx(Kt,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4 text-center py-1",children:r?e.jsx("div",{className:"text-center py-12",children:"Loading requests..."}):s.length>0?e.jsxs(e.Fragment,{children:[s.map(y=>{var N,S,A,w,E,T,C,L,$,_,R;return e.jsx(Ie,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-amber-100 rounded-lg",children:e.jsx(fs,{className:"w-6 h-6 text-amber-600"})}),e.jsxs("div",{className:"flex-1 text-left",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:y.resignationId}),e.jsx(Ae,{className:Qx(y.status),children:y.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:((S=(N=y.dealer)==null?void 0:N.dealerProfile)==null?void 0:S.businessName)||((A=y.outlet)==null?void 0:A.name)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Code"}),e.jsx("p",{children:((T=(E=(w=y.dealer)==null?void 0:w.dealerProfile)==null?void 0:E.dealerCode)==null?void 0:T.dealerCode)||((C=y.outlet)==null?void 0:C.code)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:(($=(L=y.dealer)==null?void 0:L.dealerProfile)==null?void 0:$.registeredAddress)||((_=y.outlet)!=null&&_.city&&((R=y.outlet)!=null&&R.state)?`${y.outlet.city}, ${y.outlet.state}`:"N/A")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Type"}),e.jsx("p",{children:y.resignationType})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Reason"}),e.jsx("p",{className:"truncate max-w-[200px]",children:y.reason})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Current Stage"}),e.jsx("p",{children:y.currentStage})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx($n,{className:"w-4 h-4 text-slate-500"}),e.jsx("p",{children:Ht(y.submittedOn)})]})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>t(y.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},y.id)}),x&&x.totalPages>1&&e.jsx("div",{className:"py-4 border-t flex justify-center",children:e.jsx(Yl,{children:e.jsxs(Zl,{children:[e.jsx(an,{children:e.jsx(Ql,{onClick:()=>c(y=>Math.max(1,y-1)),className:l===1?"pointer-events-none opacity-50":"cursor-pointer"})}),[...Array(x.totalPages)].map((y,N)=>{const S=N+1;return S===1||S===x.totalPages||S>=l-1&&S<=l+1?e.jsx(an,{children:e.jsx(Ci,{isActive:l===S,onClick:()=>c(S),className:"cursor-pointer",children:S})},S):S===2&&l>3||S===x.totalPages-1&&lc(y=>Math.min(x.totalPages,y+1)),className:l===x.totalPages?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]}):e.jsx("div",{className:"text-center py-12 text-slate-500",children:e.jsx("p",{children:"No resignation requests found"})})})}),e.jsx(Kt,{value:"open",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:j.length>0?j.map(y=>{var N,S,A,w,E,T,C;return e.jsx(Ie,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-yellow-100 rounded-lg",children:e.jsx(fs,{className:"w-6 h-6 text-yellow-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:y.resignationId}),e.jsx(Ae,{className:Qx(y.status),children:y.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:((S=(N=y.dealer)==null?void 0:N.dealerProfile)==null?void 0:S.businessName)||((A=y.outlet)==null?void 0:A.name)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:((E=(w=y.dealer)==null?void 0:w.dealerProfile)==null?void 0:E.registeredAddress)||((T=y.outlet)!=null&&T.city&&((C=y.outlet)!=null&&C.state)?`${y.outlet.city}, ${y.outlet.state}`:"N/A")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Current Stage"}),e.jsx("p",{children:y.currentStage})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:Ht(y.submittedOn)})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>t(y.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},y.id)}):e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(fs,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No requests requiring your action"})]})})}),e.jsx(Kt,{value:"completed",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:p.length>0?p.map(y=>{var N,S,A,w,E,T;return e.jsx(Ie,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-green-100 rounded-lg",children:e.jsx(fs,{className:"w-6 h-6 text-green-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:y.resignationId}),e.jsx(Ae,{className:Qx(y.status),children:y.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:((S=(N=y.dealer)==null?void 0:N.dealerProfile)==null?void 0:S.businessName)||((A=y.outlet)==null?void 0:A.name)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:((E=(w=y.dealer)==null?void 0:w.dealerProfile)==null?void 0:E.registeredAddress)||((T=y.outlet)==null?void 0:T.city)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Final Stage"}),e.jsx("p",{children:y.currentStage})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:Ht(y.submittedOn)})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>t(y.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},y.id)}):e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(fs,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No completed resignations to display"})]})})})]})})]})]})}const N$=t=>{switch(t){case"Critical":return"bg-red-100 text-red-700 border-red-300";case"High":return"bg-orange-100 text-orange-700 border-orange-300";case"Medium":return"bg-yellow-100 text-yellow-700 border-yellow-300";case"Low":return"bg-blue-100 text-blue-700 border-blue-300";default:return"bg-slate-100 text-slate-700 border-slate-300"}},Xx=t=>t.includes("Approved")||t.includes("Terminated")?"bg-green-100 text-green-700 border-green-300":t.includes("Review")||t.includes("Pending")?"bg-yellow-100 text-yellow-700 border-yellow-300":t.includes("Rejected")?"bg-red-100 text-red-700 border-red-300":"bg-blue-100 text-blue-700 border-blue-300";function w$({currentUser:t,onViewDetails:s}){const[n,r]=v.useState(!1),[a,l]=v.useState([]),[c,d]=v.useState(""),[m,x]=v.useState(!1),[f,h]=v.useState(""),[g,u]=v.useState(null),[j,p]=v.useState([]),[y,N]=v.useState(!0),[S,A]=v.useState(1),[w,E]=v.useState(null),[T,C]=v.useState("all"),L=10,[$,_]=v.useState({terminationCategory:"",reason:"",proposedLwd:"",comments:"",document:null}),R=async()=>{N(!0);try{const D=(await Te.getTerminations({page:S,limit:L,status:T==="all"?void 0:T})).data;D!=null&&D.success&&(p(D.terminations),E(D.meta))}catch(B){console.error("Error fetching terminations:",B),ee.error("Failed to fetch termination requests")}finally{N(!1)}};v.useEffect(()=>{R()},[S,T]);const P=B=>{C(B),A(1)};v.useEffect(()=>{if(!n||!W)return;let B=!1;return(async()=>{try{x(!0);const O=(await Te.getDealers({onboarded:"true",activeOnly:"true"})).data;if(!B&&(O!=null&&O.success)){const z=(Array.isArray(O.data)?O.data:[]).filter(G=>{var X,ne;const Y=String((G==null?void 0:G.status)||"").toLowerCase(),V=String(((X=G==null?void 0:G.user)==null?void 0:X.status)||"").toLowerCase();return Y==="active"&&((ne=G==null?void 0:G.user)==null?void 0:ne.isActive)&&V==="active"});l(z)}}catch(D){B||(console.error("Error fetching dealers:",D),ee.error("Failed to load dealer list"))}finally{B||x(!1)}})(),()=>{B=!0}},[n]);const M=B=>{var D,O,z,G,Y,V;return{id:B.id,dealerId:B.id,dealerCode:((D=B.dealerCode)==null?void 0:D.dealerCode)||"",legalName:B.legalName||"N/A",businessName:B.businessName||"N/A",gstNumber:B.gstNumber||"N/A",address:B.registeredAddress||((O=B.application)==null?void 0:O.preferredLocation)||"N/A",city:((z=B.application)==null?void 0:z.city)||"N/A",state:((G=B.application)==null?void 0:G.state)||"N/A",email:((Y=B.user)==null?void 0:Y.email)||"N/A",phoneNumber:((V=B.user)==null?void 0:V.mobileNumber)||"N/A"}},q=B=>{d(B);const D=a.find(z=>String(z.id)===String(B));if(!D){h(""),u(null);return}const O=M(D);h(O.dealerCode),u(O)},K=B=>{h(B);const D=B.trim().toLowerCase();if(!D){d(""),u(null);return}const O=a.find(z=>{var G;return String(((G=z.dealerCode)==null?void 0:G.dealerCode)||"").toLowerCase()===D});if(!O){d(""),u(null);return}d(String(O.id)),u(M(O))},Z=async B=>{var D,O,z;if(B.preventDefault(),!g){ee.error("Please select a dealer");return}try{const G={dealerId:g.dealerId||g.id,category:$.terminationCategory,reason:$.reason,proposedLwd:$.proposedLwd,comments:$.comments};if(!G.dealerId){ee.error("Dealer record not found for the selected dealer");return}const V=(await Te.createTermination(G)).data;if(V!=null&&V.success){const X=(D=V.termination)==null?void 0:D.id;if(X&&$.document){const ne=new FormData;ne.append("file",$.document),ne.append("documentType","Termination Recommendation"),ne.append("stage","Submitted");try{await Te.uploadTerminationDocument(X,ne),ee.success("Termination request and supporting document submitted")}catch(oe){console.error("Error uploading supporting document:",oe),ee.warning("Termination created, but document upload failed. You can upload it from the details page.")}}else ee.success("Termination request submitted successfully");r(!1),R(),d(""),h(""),l([]),u(null),_({terminationCategory:"",reason:"",proposedLwd:"",comments:"",document:null})}}catch(G){console.error("Error submitting termination:",G),ee.error(((z=(O=G.response)==null?void 0:O.data)==null?void 0:z.message)||"Failed to submit termination request")}},W=(t==null?void 0:t.role)==="DD Lead",U=T==="open"||T==="all"?j:[],F=T==="completed"||T==="all"?j:[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(mi,{className:"border-red-200 bg-red-50",children:[e.jsx(Ya,{className:"h-4 w-4 text-red-600"}),e.jsx(Hi,{className:"text-red-900",children:"Restricted Access"}),e.jsx(fi,{className:"text-red-700",children:"This section contains sensitive information. All termination actions are logged and require proper authorization."})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs(Ie,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"All Cases"}),e.jsx(nt,{className:"text-3xl",children:(w==null?void 0:w.total)||0})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Total Cases"})})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Open"}),e.jsx(nt,{className:"text-3xl text-orange-600",children:T==="open"?(w==null?void 0:w.total)||0:"..."})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Requires Your Action"})})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Completed"}),e.jsx(nt,{className:"text-3xl text-green-600",children:T==="completed"?(w==null?void 0:w.total)||0:"..."})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Finalized"})})]})]}),e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Termination Requests"}),e.jsxs(Zt,{children:["Manage dealer termination proceedings and legal compliance",!W&&e.jsxs("span",{className:"block mt-1 text-red-600",children:["• Note: Only DD Lead can create termination requests. Current role: ",(t==null?void 0:t.role)||"Not logged in"]})]})]}),W&&e.jsxs(os,{open:n,onOpenChange:r,children:[e.jsx(Hl,{asChild:!0,children:e.jsxs(se,{className:"bg-red-600 hover:bg-red-700",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Create Termination Request"]})}),e.jsxs(ls,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Create Termination Request"}),e.jsx(vs,{children:"Fill in the details to create a new termination request"})]}),e.jsxs("form",{onSubmit:Z,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Select Dealer *"}),e.jsxs(wt,{value:c,onValueChange:q,disabled:m,children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:m?"Loading dealers...":"Select dealer"})}),e.jsx(At,{children:a.map(B=>{var D;return e.jsxs(_e,{value:String(B.id),children:[B.legalName||B.businessName||"Unnamed Dealer"," - ",((D=B.dealerCode)==null?void 0:D.dealerCode)||"No Code"]},B.id)})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"dealerCode",children:"Dealer Code *"}),e.jsx(ot,{id:"dealerCode",value:f,onChange:B=>K(B.target.value),placeholder:"Type dealer code to auto-select",required:!0})]}),g&&e.jsxs("div",{className:"grid grid-cols-2 gap-4 p-4 bg-slate-50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Name (Legal)"}),e.jsx("p",{children:g.legalName||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Business Name"}),e.jsx("p",{children:g.businessName||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GST"}),e.jsx("p",{children:g.gstNumber||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Address"}),e.jsx("p",{children:g.address})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"City/State"}),e.jsxs("p",{children:[g.city,", ",g.state]})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Code"}),e.jsx("p",{children:g.dealerCode||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Contact"}),e.jsxs("p",{children:[g.email," / ",g.phoneNumber]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Termination Category *"}),e.jsxs(wt,{value:$.terminationCategory,onValueChange:B=>_({...$,terminationCategory:B}),children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"Select termination category"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"Working Capital",children:"Working Capital"}),e.jsx(_e,{value:"Performance Issues",children:"Performance Issues"}),e.jsx(_e,{value:"Unethical Practical",children:"Unethical Practical"}),e.jsx(_e,{value:"Unforeseen Circumstances",children:"Unforeseen Circumstances"}),e.jsx(_e,{value:"Others",children:"Others"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Proposed LWD *"}),e.jsx(ot,{type:"date",value:$.proposedLwd,onChange:B=>_({...$,proposedLwd:B.target.value}),required:!0})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"reason",children:"Termination Reason *"}),e.jsx(ot,{id:"reason",value:$.reason,onChange:B=>_({...$,reason:B.target.value}),placeholder:"Primary reason for termination",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"comments",children:"Additional Comments *"}),e.jsx(Fs,{id:"comments",value:$.comments,onChange:B=>_({...$,comments:B.target.value}),placeholder:"Detailed observations and justification",rows:4,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"document",children:"Upload Supporting Document"}),e.jsx(ot,{id:"document",type:"file",onChange:B=>{var D;return _({...$,document:((D=B.target.files)==null?void 0:D[0])||null})}})]}),e.jsxs(rn,{children:[e.jsx(se,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(se,{type:"submit",className:"bg-red-600 hover:bg-red-700",children:"Submit Request"})]})]})]})]})]})}),e.jsxs(Me,{children:[e.jsxs(_n,{value:T,onValueChange:P,className:"w-full",children:[e.jsxs(Pn,{children:[e.jsx(Wt,{value:"all",children:"All Cases"}),e.jsx(Wt,{value:"open",children:"Open"}),e.jsx(Wt,{value:"completed",children:"Completed"})]}),e.jsx(Kt,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:y?e.jsx("div",{className:"text-center py-12",children:"Loading requests..."}):j.length>0?j.map(B=>{var D,O,z,G;return e.jsx(Ie,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-red-100 rounded-lg",children:e.jsx(Za,{className:"w-6 h-6 text-red-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg font-bold",children:B.requestId||((O=(D=B.dealer)==null?void 0:D.dealerCode)==null?void 0:O.code)||"N/A"}),e.jsxs("span",{className:"text-slate-400 text-xs",children:["#",B.id.substring(0,8)]}),e.jsx(Ae,{className:N$(B.severity||"Medium"),children:B.severity||"Normal"}),e.jsx(Ae,{className:Xx(B.status),children:B.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:((z=B.dealer)==null?void 0:z.businessName)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:((G=B.dealer)==null?void 0:G.registeredAddress)||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Category"}),e.jsx("p",{children:B.category})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Current Stage"}),e.jsx("p",{children:B.currentStage})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Proposed LWD"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx($n,{className:"w-4 h-4 text-slate-500"}),e.jsx("p",{children:B.proposedLwd})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:Ht(B.createdAt)})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(B.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},B.id)}):e.jsx("div",{className:"text-center py-12 text-slate-500",children:e.jsx("p",{children:"No termination requests found"})})})}),e.jsx(Kt,{value:"open",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:U.length>0?U.map(B=>{var D,O,z;return e.jsx(Ie,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-orange-100 rounded-lg",children:e.jsx(Ya,{className:"w-6 h-6 text-orange-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg font-bold",children:B.requestId||((O=(D=B.dealer)==null?void 0:D.dealerCode)==null?void 0:O.code)||"N/A"}),e.jsxs("span",{className:"text-slate-400 text-xs",children:["#",B.id.substring(0,8)]}),e.jsx(Ae,{className:Xx(B.status),children:B.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:(z=B.dealer)==null?void 0:z.businessName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Reason"}),e.jsx("p",{className:"truncate",children:B.reason})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Current Stage"}),e.jsx("p",{children:B.currentStage})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:Ht(B.createdAt)})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(B.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},B.id)}):e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(Za,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No requests requiring your action"})]})})}),e.jsx(Kt,{value:"completed",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:F.length>0?F.map(B=>{var D,O,z;return e.jsx(Ie,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-green-100 rounded-lg",children:e.jsx(Za,{className:"w-6 h-6 text-green-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg font-bold",children:B.requestId||((O=(D=B.dealer)==null?void 0:D.dealerCode)==null?void 0:O.code)||"N/A"}),e.jsxs("span",{className:"text-slate-400 text-xs",children:["#",B.id.substring(0,8)]}),e.jsx(Ae,{className:Xx(B.status),children:B.status})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:(z=B.dealer)==null?void 0:z.businessName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Closed On"}),e.jsx("p",{children:Ht(B.updatedAt)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Termination Category"}),e.jsx("p",{children:B.category})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"LWD"}),e.jsx("p",{children:B.proposedLwd})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(B.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},B.id)}):e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(Za,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No completed terminations to display"})]})})})]}),w&&w.totalPages>1&&e.jsx("div",{className:"py-4 border-t flex justify-center bg-white rounded-b-lg",children:e.jsx(Yl,{children:e.jsxs(Zl,{children:[e.jsx(an,{children:e.jsx(Ql,{onClick:()=>A(B=>Math.max(1,B-1)),className:S===1?"pointer-events-none opacity-50":"cursor-pointer"})}),[...Array(w.totalPages)].map((B,D)=>{const O=D+1;return O===1||O===w.totalPages||O>=S-1&&O<=S+1?e.jsx(an,{children:e.jsx(Ci,{isActive:S===O,onClick:()=>A(O),className:"cursor-pointer",children:O})},O):O===2&&S>3||O===w.totalPages-1&&SA(B=>Math.min(w.totalPages,B+1)),className:S===w.totalPages?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]})]})]})}const Ad=t=>{switch(t){case"Initiated":return"bg-blue-100 text-blue-700 border-blue-300";case"DD Clearance":case"Legal Clearance":return"bg-yellow-100 text-yellow-700 border-yellow-300";case"Finance Approval":case"Calculated":return"bg-orange-100 text-orange-700 border-orange-300";case"Completed":case"Settled":return"bg-green-100 text-green-700 border-green-300";default:return"bg-slate-100 text-slate-700 border-slate-300"}},kd=t=>t==="Resignation"?"bg-amber-100 text-amber-700 border-amber-300":"bg-red-100 text-red-700 border-red-300";function S$({currentUser:t,onViewDetails:s}){const[n,r]=v.useState([]),[a,l]=v.useState(!0);v.useEffect(()=>{c()},[]);const c=async()=>{try{l(!0);const j=(await Te.getFnFSettlements()).data;j.success&&r(j.settlements||[])}catch(u){console.error("Fetch settlements error:",u),ee.error("Failed to fetch settlement cases")}finally{l(!1)}};if(a)return e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-blue-600"})});const d=u=>{var j,p,y,N,S,A,w,E,T,C,L,$,_,R,P,M;return{id:u.id,caseNumber:u.settlementId||((j=u.resignation)==null?void 0:j.resignationId)||((p=u.terminationRequest)==null?void 0:p.requestId)||u.id.substring(0,8).toUpperCase(),status:u.status,requestType:u.resignationId?"Resignation":"Termination",dealerName:((N=(y=u.outlet)==null?void 0:y.dealer)==null?void 0:N.fullName)||((S=u.dealer)==null?void 0:S.legalName)||((A=u.dealer)==null?void 0:A.businessName)||((w=u.dealer)==null?void 0:w.fullName)||"N/A",dealerCode:((E=u.outlet)==null?void 0:E.code)||((C=(T=u.dealer)==null?void 0:T.dealerCode)==null?void 0:C.dealerCode)||"N/A",dealershipName:((L=u.outlet)==null?void 0:L.name)||"N/A",location:(($=u.outlet)==null?void 0:$.city)||((_=u.outlet)==null?void 0:_.location)||"N/A",originalRequestId:((R=u.resignation)==null?void 0:R.resignationId)||((P=u.terminationRequest)==null?void 0:P.requestId)||((M=u.terminationRequest)==null?void 0:M.id)||"N/A",submittedOn:Ht(u.createdAt),financeReportStatus:u.status==="Calculated"||u.status==="Settled"?"Completed":"Pending",totalRecoveryAmount:parseFloat(u.totalReceivables)||0,totalPayableAmount:parseFloat(u.totalPayables)||0,completedOn:u.settlementDate?Ht(u.settlementDate):null,departmentResponses:u.lineItems||[]}},m=n.map(d),x=m.filter(u=>u.status==="Initiated"),f=m.filter(u=>u.status==="DD Clearance"||u.status==="Legal Clearance"),h=m.filter(u=>u.status==="Finance Approval"||u.status==="Calculated"),g=m.filter(u=>u.status==="Completed"||u.status==="Settled");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[e.jsxs(Ie,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Initiated"}),e.jsx(nt,{className:"text-3xl text-blue-600",children:x.length})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Newly created"})})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Clearance"}),e.jsx(nt,{className:"text-3xl text-yellow-600",children:f.length})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Department / legal stage"})})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Finance Approval"}),e.jsx(nt,{className:"text-3xl text-orange-600",children:h.length})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Ready for finance review"})})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"Completed"}),e.jsx(nt,{className:"text-3xl text-green-600",children:m.filter(u=>u.status==="Completed"||u.status==="Settled").length})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Finalized"})})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{className:"pb-3",children:[e.jsx(Zt,{children:"All Cases"}),e.jsx(nt,{className:"text-3xl",children:m.length})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-slate-600",children:"Total"})})]})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Full & Final Settlement Cases"}),e.jsxs(Zt,{children:["Manage dealer exit dues clearance and settlement",t&&` • Current Role: ${t.role}`]})]}),e.jsx(Me,{children:e.jsxs(_n,{defaultValue:"all",className:"w-full",children:[e.jsxs(Pn,{children:[e.jsx(Wt,{value:"all",children:"All Cases"}),e.jsx(Wt,{value:"initiated",children:"Initiated"}),e.jsx(Wt,{value:"clearance",children:"Clearance"}),e.jsx(Wt,{value:"finance",children:"Finance Approval"}),e.jsx(Wt,{value:"completed",children:"Completed"})]}),e.jsx(Kt,{value:"initiated",className:"mt-6",children:e.jsxs("div",{className:"space-y-4",children:[x.map(u=>e.jsx(Ie,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-blue-100 rounded-lg",children:e.jsx(Pd,{className:"w-6 h-6 text-blue-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:u.caseNumber}),e.jsx(Ae,{className:Ad(u.status),children:u.status}),e.jsx(Ae,{className:kd(u.requestType),children:u.requestType})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:u.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Code"}),e.jsx("p",{children:u.dealerCode})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealership Name"}),e.jsx("p",{children:u.dealershipName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:u.location})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Original Request ID"}),e.jsx("p",{children:u.originalRequestId})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx($n,{className:"w-4 h-4 text-slate-500"}),e.jsx("p",{children:u.submittedOn})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Finance Report"}),e.jsx("p",{children:u.financeReportStatus})]})]})]})]}),e.jsx("div",{className:"flex items-center gap-2 ml-4",children:e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(u.id),children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})})]})})},u.id)),x.length===0&&e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(Pd,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No initiated cases to display"})]})]})}),e.jsx(Kt,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:m.map(u=>e.jsx(Ie,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:`p-3 rounded-lg ${u.status==="Initiated"?"bg-blue-100":u.status==="DD Clearance"||u.status==="Legal Clearance"?"bg-yellow-100":u.status==="Finance Approval"||u.status==="Calculated"?"bg-orange-100":"bg-green-100"}`,children:e.jsx(oa,{className:`w-6 h-6 ${u.status==="Initiated"?"text-blue-600":u.status==="DD Clearance"||u.status==="Legal Clearance"?"text-yellow-600":u.status==="Finance Approval"||u.status==="Calculated"?"text-orange-600":"text-green-600"}`})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:u.caseNumber}),e.jsx(Ae,{className:Ad(u.status),children:u.status}),e.jsx(Ae,{className:kd(u.requestType),children:u.requestType})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:u.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealership Name"}),e.jsx("p",{children:u.dealershipName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:u.location})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:u.submittedOn})]})]})]})]}),e.jsx("div",{className:"flex items-center gap-2 ml-4",children:e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(u.id),children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})})]})})},u.id))})}),e.jsx(Kt,{value:"clearance",className:"mt-6",children:e.jsxs("div",{className:"space-y-4",children:[f.map(u=>e.jsx(Ie,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-yellow-100 rounded-lg",children:e.jsx(oa,{className:"w-6 h-6 text-yellow-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:u.caseNumber}),e.jsx(Ae,{className:Ad(u.status),children:u.status}),e.jsx(Ae,{className:kd(u.requestType),children:u.requestType})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:u.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Departments Responded"}),e.jsxs("p",{children:[u.departmentResponses.filter(j=>j.status!=="Pending").length," / ",u.departmentResponses.length]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:u.submittedOn})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(u.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},u.id)),f.length===0&&e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(oa,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No clearance-stage cases"})]})]})}),e.jsx(Kt,{value:"finance",className:"mt-6",children:e.jsxs("div",{className:"space-y-4",children:[h.map(u=>{var j,p;return e.jsx(Ie,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-orange-100 rounded-lg",children:e.jsx(oa,{className:"w-6 h-6 text-orange-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:u.caseNumber}),e.jsx(Ae,{className:Ad(u.status),children:u.status}),e.jsx(Ae,{className:kd(u.requestType),children:u.requestType})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:u.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Receivable amount"}),e.jsxs("p",{className:"text-red-600",children:["₹",(j=u.totalRecoveryAmount)==null?void 0:j.toLocaleString()]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Payable Amount"}),e.jsxs("p",{className:"text-green-600",children:["₹",(p=u.totalPayableAmount)==null?void 0:p.toLocaleString()]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Finance Status"}),e.jsx("p",{children:u.financeReportStatus})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(u.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},u.id)}),h.length===0&&e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(oa,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No finance-approval cases"})]})]})}),e.jsx(Kt,{value:"completed",className:"mt-6",children:e.jsxs("div",{className:"space-y-4",children:[g.map(u=>e.jsx(Ie,{className:"border-slate-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[e.jsx("div",{className:"p-3 bg-green-100 rounded-lg",children:e.jsx(Pd,{className:"w-6 h-6 text-green-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg",children:u.caseNumber}),e.jsx(Ae,{className:Ad(u.status),children:u.status}),e.jsx(Ae,{className:kd(u.requestType),children:u.requestType})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:u.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Completed On"}),e.jsx("p",{children:u.completedOn||"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:u.submittedOn})]})]})]})]}),e.jsxs(se,{size:"sm",variant:"outline",onClick:()=>s(u.id),className:"ml-4",children:[e.jsx(nn,{className:"w-4 h-4 mr-2"}),"View Details"]})]})})},u.id)),g.length===0&&e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx(Pd,{className:"w-12 h-12 mx-auto mb-4 text-slate-400"}),e.jsx("p",{children:"No completed cases"})]})]})})]})})]})]})}const _l={getResignations:async()=>{try{return(await Te.getResignations()).data}catch(t){throw console.error("Get resignations error:",t),t}},createResignation:async t=>{try{return(await Te.createResignation(t)).data}catch(s){throw console.error("Create resignation error:",s),s}},getResignationById:async t=>{var s,n;try{const r=await Te.getResignationById(t);return((s=r.data)==null?void 0:s.resignation)||((n=r.data)==null?void 0:n.data)||r.data}catch(r){throw console.error("Get resignation error:",r),r}},updateClearance:async(t,s)=>{try{return(await Te.updateClearance(t,s)).data}catch(n){throw console.error("Update clearance error:",n),n}},uploadDocument:async(t,s)=>{try{return(await Te.uploadResignationDocument(t,s)).data}catch(n){throw console.error("Upload resignation document error:",n),n}},withdraw:async(t,s)=>{try{return(await Te.withdrawResignation(t,s)).data}catch(n){throw console.error("Withdraw resignation error:",n),n}}},Ud=["Resignation Letter","Dealer Undertaking","Approval Note","Legal Communication","Handover Document","Settlement Supporting Document","Other"],vE=["ASM","RBM","ZBH","DD Lead","NBH","DD Admin","Legal","F&F Initiated"],Jx=["Termination Recommendation","Show Cause Notice","SCN Response","Hearing Record","Approval Note","Termination Letter","Settlement Supporting Document","Other"],C$=["Submitted","RBM Review","ZBH Review","DD Lead Review","Legal Verification","NBH Evaluation","Show Cause Notice","Personal Hearing","NBH Final Approval","CCO Approval","CEO Final Approval","Legal - Termination Letter"],A$={ASM:"ASM",RBM:"RBM",ZBH:"ZBH","DD Lead":"DD Lead",NBH:"NBH","DD Admin":"DD Admin",Legal:"Legal Admin"},m1=["REJECTED","Rejected","REVOKED","Revoked","WITHDRAWN","Withdrawn"],f1={ASM:["ASM","ASM Review","Submission","Submitted"],RBM:["RBM","RBM Review","Regional Review"],ZBH:["ZBH","ZBH Review","ZM Review"],"DD Lead":["DD Lead","DD Lead Review","DDL Review"],NBH:["NBH","NBH Approval","NBH Review"],"DD Admin":["DD Admin","DD Admin Review"],Legal:["Legal","Legal - Resignation Letter"],"F&F Initiated":["F&F Initiated","FNF_INITIATED","FNF Initiated"],Completed:["Completed"]};function k$({resignationId:t,onBack:s,currentUser:n}){var Pe,ke,qe,Ve,dt,xt,ye,le,Qe,rt,Gt,Rt,Re,Qt,qt,ws,Ps,ns,Cs,Bs,Ft,ie,Fe,Q,pe,Ne,Ee,it,st,bt,Ue,It,ut,yt,kt;const r=(Le,Pt)=>{const ht=[...(C==null?void 0:C.documents)||[],...(C==null?void 0:C.uploadedDocuments)||[]],zt=[Le,Pt,...Pt?f1[Pt]||[]:[],...f1[Le]||[]].filter(rs=>!!rs).map(rs=>rs.trim().toLowerCase());return ht.filter(rs=>{if(!(rs!=null&&rs.stage))return!1;const Yt=String(rs.stage).trim().toLowerCase();return zt.includes(Yt)})},a=qn(),[l,c]=v.useState({open:!1,type:null}),[d,m]=v.useState(""),[x,f]=v.useState(""),[h,g]=v.useState(""),[u,j]=v.useState(""),[p,y]=v.useState([]),[N,S]=v.useState(!1),[A,w]=v.useState(!1),[E,T]=v.useState({open:!1,stageName:"",documents:[]}),[C,L]=v.useState(null),[$,_]=v.useState(!1),[R,P]=v.useState([]),[M,q]=v.useState(!1),[K,Z]=v.useState(null),[W,U]=v.useState(!1),[F,B]=v.useState(null),[D,O]=v.useState(Ud[0]),[z,G]=v.useState(""),Y=async()=>{try{_(!0);const Le=await _l.getResignationById(t);L(Le),V()}catch(Le){console.error("Error fetching resignation:",Le)}finally{_(!1)}},V=async()=>{try{const Le=await Te.getAuditLogs("resignation",t);Le.data&&Le.data.success&&P(Le.data.data||[])}catch(Le){console.error("Error fetching audit logs:",Le)}};v.useEffect(()=>{Y()},[t]);const X=[{id:1,name:"ASM Review",key:"ASM",description:"Area Sales Manager review"},{id:2,name:"RBM Review",key:"RBM",description:"Regional Business Manager evaluation"},{id:3,name:"ZBH Review",key:"ZBH",description:"Zonal Business Head approval"},{id:4,name:"DD Lead Review",key:"DD Lead",description:"DD Lead final review"},{id:5,name:"NBH Approval",key:"NBH",description:"National Business Head approval"},{id:6,name:"DD Admin Review",key:"DD Admin",description:"DD Admin verification"},{id:7,name:"Legal - Resignation Letter",key:"Legal",description:"Legal team issues resignation approval letter"},{id:8,name:"F&F Settlement",key:"F&F Initiated",description:"Full & Final settlement process"},{id:9,name:"Completed",key:"Completed",description:"Resignation process finalized"}],ne=["ASM","RBM","ZBH","DD Lead","NBH","DD Admin","Legal","F&F Initiated","Completed"],oe=C?["F&F Initiated","Completed","Settled","FNF_INITIATED"].includes(String(C.status||C.currentStage||""))?!0:(Array.isArray(C.timeline)?C.timeline:[]).some(ht=>{const zt=String((ht==null?void 0:ht.stage)||"").trim().toLowerCase(),rs=String((ht==null?void 0:ht.targetStage)||"").trim().toLowerCase(),Yt=String((ht==null?void 0:ht.action)||"").trim().toLowerCase(),Os=zt==="legal"||zt==="legal - resignation letter",Ls=rs==="legal"||rs==="f&f initiated"||rs==="fnf_initiated"||Yt.includes("approved");return Os&&Ls}):!1,ge=(()=>{if(!C||!n)return{canApprove:!1,canWithdraw:!1,canSendBack:!1,canPushToFnF:!1,canAssign:!1};const Le=C.currentStage,Pt=C.status,ht=n.role,zt=["Completed","Rejected","Withdrawn","Revoked"].includes(Pt),rs=Pt==="F&F Initiated"||Le==="F&F Initiated"||Pt==="Settled"||Pt==="FNF_INITIATED",Yt=ne.indexOf(Le),Os=ne.indexOf("NBH"),Ls=Yt!==-1&&Os!==-1&&Yt>=Os,zs=ht==="Super Admin"||ht===A$[Le];return{canApprove:zs&&!zt&&!rs&&!(Le==="Legal"&&oe),canSendBack:zs&&!zt&&!rs&&Yt>0,canWithdraw:ht==="Dealer"&&!Ls&&!zt,canRevoke:(ht==="Super Admin"||ht==="DD Admin")&&!zt&&!rs,canPushToFnF:["DD Lead","DD Head","NBH","DD Admin","Super Admin"].includes(ht)&&!rs&&!zt,canAssign:ht!=="Dealer"&&!zt}})(),ve={ASM:["ASM","ASM Review","Request Initiated"],RBM:["RBM","RBM Review"],ZBH:["ZBH","ZBH Review"],"DD Lead":["DD Lead","DD Lead Review","Lead Review"],NBH:["NBH","NBH Approval","NBH Review"],"DD Admin":["DD Admin","DD Admin Review"],Legal:["Legal","Legal - Resignation Letter","Legal Review"],"F&F Initiated":["F&F Initiated","FNF_INITIATED","F&F Settlement","Settled"],Completed:["Completed","Finalized"]},Se=Le=>{if(!Le)return"";const Pt=String(Le).trim();return ne.find(zt=>zt===Pt||(ve[zt]||[]).includes(Pt))||Pt},We=Le=>{if(!C)return"pending";const Pt=["Rejected","Revoked","Withdrawn"].includes(C.status);let ht=C.currentStage;if(Pt&&(!ht||m1.includes(String(ht)))){const Os=[...C.timeline||[]].reverse().find(Ls=>(Ls==null?void 0:Ls.stage)&&!m1.includes(String(Ls.stage)));Os!=null&&Os.stage&&(ht=Os.stage)}const zt=ne.indexOf(Se(ht)),rs=ne.indexOf(Le);if((C.status==="Completed"||C.status==="Settled")&&rs<=zt)return"completed";const Yt=["Rejected","Revoked","Withdrawn"].includes(C.status);return Le==="Legal"&&oe&&!Yt?"completed":zt===-1?Le==="ASM"?"completed":"pending":rs{c({open:!0,type:Le})},fe=(Le,Pt)=>{const ht=r(Le,Pt).map((zt,rs)=>{var Yt;return{id:zt.id||`${Le}-${rs}`,name:zt.name||zt.fileName||"Document",type:zt.type||zt.documentType||"Document",uploadDate:zt.uploadDate||(zt.createdAt?Ht(zt.createdAt):"N/A"),uploader:typeof zt.uploader=="string"?zt.uploader:((Yt=zt.uploader)==null?void 0:Yt.fullName)||zt.uploadedBy||"System",filePath:zt.filePath||zt.path}});T({open:!0,stageName:Le,documents:ht})},Ye=async()=>{var Le,Pt,ht,zt,rs,Yt,Os,Ls;if(!d&&!["assign","pushfnf"].includes(l.type||"")){ee.error("Please provide remarks (min 5 characters)");return}if(["sendBack","revoke"].includes(l.type||"")&&d.trim().length<5){ee.error("Remarks are required for this action (min 5 characters).");return}if(l.type==="assign"&&!x){ee.error("Please select a designation");return}try{q(!0);const en={action:l.type==="sendBack"?"sendBack":l.type,remarks:d,assignTo:u||x,force:A},he=await Te.updateResignationStatus(t,en);if((Le=he.data)!=null&&Le.success)ee.success(((Pt=he.data)==null?void 0:Pt.message)||"Action completed successfully"),c({open:!1,type:null}),m(""),f(""),j(""),y([]),w(!1),Y();else{const Ke=((ht=he.data)==null?void 0:ht.message)||"Failed to submit action";ee.error(Ke),(zt=he.data)!=null&&zt.canForce&&ee.info('LWD restriction hit. Use "Push to F&F" and enable "Force Initiate F&F Settlement Immediately" if urgent.')}}catch(zs){console.error("Error submitting action:",zs),ee.error(((Yt=(rs=zs.response)==null?void 0:rs.data)==null?void 0:Yt.message)||"Failed to submit action"),(Ls=(Os=zs==null?void 0:zs.response)==null?void 0:Os.data)!=null&&Ls.canForce&&ee.info('LWD restriction hit. Use "Push to F&F" with force option if business-approved.')}finally{q(!1)}},be=async()=>{var Le,Pt;if(!F){ee.error("Please select a file to upload");return}try{q(!0);const ht=new FormData;ht.append("file",F),ht.append("documentType",D),z&&ht.append("stage",z),await _l.uploadDocument(t,ht),ee.success("Document uploaded successfully"),U(!1),B(null),O(Ud[0]),G(""),Y()}catch(ht){ee.error(((Pt=(Le=ht==null?void 0:ht.response)==null?void 0:Le.data)==null?void 0:Pt.message)||"Failed to upload document")}finally{q(!1)}};return v.useEffect(()=>{(async()=>{if(l.type==="assign"&&(x||h)){const Pt=setTimeout(async()=>{var ht;try{S(!0);const zt={asm:"ASM",rbm:"RBM",zbh:"ZBH",nbh:"NBH",legal:"Legal Admin"},rs={limit:20,search:h};x&&(rs.roleCode=zt[x]||x);const Yt=await Te.getUsers(rs);(ht=Yt.data)!=null&&ht.success&&y(Yt.data.data)}catch(zt){console.error("Error fetching users:",zt)}finally{S(!1)}},300);return()=>clearTimeout(Pt)}})()},[x,h,l.type]),$&&!C?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-amber-600"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"outline",size:"icon",onClick:s,className:"hover:bg-slate-100 transition-colors",children:e.jsx($r,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl",children:(C==null?void 0:C.resignationId)||t}),e.jsx("p",{className:"text-slate-600",children:(Pe=C==null?void 0:C.outlet)==null?void 0:Pe.name})]}),e.jsx(Ae,{className:(C==null?void 0:C.status)==="Completed"||(C==null?void 0:C.status)==="Settled"?"bg-green-100 text-green-700 border-green-300":(C==null?void 0:C.status)==="Rejected"||(C==null?void 0:C.status)==="Withdrawn"||(C==null?void 0:C.status)==="Revoked"?"bg-red-100 text-red-700 border-red-300":"bg-yellow-100 text-yellow-700 border-yellow-300",children:(C==null?void 0:C.status)==="Settled"?"Completed":(C==null?void 0:C.status)||"Pending"})]})}),e.jsx(Ie,{className:"border-slate-200 shadow-sm",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-slate-600 mr-2",children:"Workflow Actions:"}),ge.canApprove&&e.jsxs(se,{size:"sm",disabled:M,className:"bg-green-600 hover:bg-green-700 transition-all hover:shadow-md",onClick:()=>Ce("approve"),children:[M&&l.type==="approve"?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(Bn,{className:"w-4 h-4 mr-2"}),"Approve"]}),ge.canSendBack&&e.jsxs(se,{size:"sm",variant:"outline",disabled:M,className:"hover:bg-slate-50 transition-all font-bold",onClick:()=>Ce("sendBack"),children:[M&&l.type==="sendBack"?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(eb,{className:"w-4 h-4 mr-2"}),"Send Back"]}),ge.canWithdraw&&e.jsxs(se,{size:"sm",variant:"outline",disabled:M,className:"text-red-600 border-red-300 hover:bg-red-50 transition-all font-bold",onClick:()=>Ce("withdrawal"),children:[M&&l.type==="withdrawal"?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(Tc,{className:"w-4 h-4 mr-2"}),"Withdrawal"]}),ge.canRevoke&&e.jsxs(se,{size:"sm",variant:"outline",disabled:M,className:"text-orange-600 border-orange-300 hover:bg-orange-50 transition-all font-bold",onClick:()=>Ce("revoke"),children:[M&&l.type==="revoke"?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(Xv,{className:"w-4 h-4 mr-2"}),"Revoke"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[ge.canPushToFnF&&e.jsxs(se,{size:"sm",variant:"outline",disabled:M,className:"text-amber-600 border-blue-300 hover:bg-blue-50 transition-all",onClick:()=>Ce("pushfnf"),children:[M&&l.type==="pushfnf"?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(fu,{className:"w-4 h-4 mr-2"}),"Push to F&F"]}),ge.canAssign&&e.jsxs(se,{size:"sm",variant:"outline",disabled:M,className:"hover:bg-slate-50 transition-all",onClick:()=>Ce("assign"),children:[M&&l.type==="assign"?e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(sb,{className:"w-4 h-4 mr-2"}),"Assign User"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-slate-200",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(zr,{className:"w-4 h-4 text-slate-500"}),e.jsx("span",{className:"text-sm text-slate-600",children:"Communication & Notes"})]}),e.jsxs(se,{size:"sm",variant:"outline",className:"relative hover:bg-amber-50 hover:border-amber-300 hover:text-amber-700 transition-all shadow-sm",onClick:()=>{var Le;return a(`/worknotes/resignation/${t}`,{state:{applicationName:((Le=C==null?void 0:C.outlet)==null?void 0:Le.name)||"Resignation",registrationNumber:(C==null?void 0:C.resignationId)||"",participants:(C==null?void 0:C.participants)||[]}})},children:[e.jsx(zr,{className:"w-4 h-4 mr-2"}),"View Work Notes",((ke=C==null?void 0:C.worknotes)==null?void 0:ke.length)>0&&e.jsx(Ae,{className:"ml-2 bg-amber-600 hover:bg-amber-700 text-white h-5 px-2",children:C.worknotes.length})]})]})]})})}),e.jsxs(_n,{defaultValue:"details",className:"w-full",children:[e.jsxs(Pn,{className:"bg-slate-100 p-1",children:[e.jsx(Wt,{value:"details",className:"data-[state=active]:bg-white",children:"Details"}),e.jsx(Wt,{value:"progress",className:"data-[state=active]:bg-white",children:"Progress"}),e.jsx(Wt,{value:"documents",className:"data-[state=active]:bg-white",children:"Documents"}),e.jsx(Wt,{value:"audit",className:"data-[state=active]:bg-white",children:"Audit Trail"})]}),e.jsxs(Kt,{value:"details",className:"space-y-6",children:[e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Request Information"})}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:((qe=C==null?void 0:C.dealer)==null?void 0:qe.fullName)||((Ve=C==null?void 0:C.outlet)==null?void 0:Ve.name)})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GST"}),e.jsx("p",{children:((xt=(dt=C==null?void 0:C.dealer)==null?void 0:dt.dealerProfile)==null?void 0:xt.gstNumber)||((ye=C==null?void 0:C.outlet)==null?void 0:ye.gstNumber)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Email"}),e.jsx("p",{children:((le=C==null?void 0:C.dealer)==null?void 0:le.email)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Sales Code"}),e.jsx("p",{children:((Gt=(rt=(Qe=C==null?void 0:C.dealer)==null?void 0:Qe.dealerProfile)==null?void 0:rt.dealerCode)==null?void 0:Gt.salesCode)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Service Code"}),e.jsx("p",{children:((Qt=(Re=(Rt=C==null?void 0:C.dealer)==null?void 0:Rt.dealerProfile)==null?void 0:Re.dealerCode)==null?void 0:Qt.serviceCode)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GMA Code"}),e.jsx("p",{children:((Ps=(ws=(qt=C==null?void 0:C.dealer)==null?void 0:qt.dealerProfile)==null?void 0:ws.dealerCode)==null?void 0:Ps.gmaCode)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Gear Code"}),e.jsx("p",{children:((Bs=(Cs=(ns=C==null?void 0:C.dealer)==null?void 0:ns.dealerProfile)==null?void 0:Cs.dealerCode)==null?void 0:Bs.gearCode)||"N/A"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(ce,{className:"text-slate-600",children:"Address"}),e.jsx("p",{children:((ie=(Ft=C==null?void 0:C.dealer)==null?void 0:Ft.dealerProfile)==null?void 0:ie.registeredAddress)||((Fe=C==null?void 0:C.outlet)==null?void 0:Fe.address)})]})]})})]}),e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Operational Details"})}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Inauguration"}),e.jsx("p",{children:(pe=(Q=C==null?void 0:C.dealer)==null?void 0:Q.dealerProfile)!=null&&pe.onboardedAt?Ht(C.dealer.dealerProfile.onboardedAt,"date"):(Ne=C==null?void 0:C.outlet)!=null&&Ne.inaugurationDate?Ht(C.outlet.inaugurationDate,"date"):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"LOA Date"}),e.jsx("p",{children:(it=(Ee=C==null?void 0:C.dealer)==null?void 0:Ee.dealerProfile)!=null&&it.loaDate?Ht(C.dealer.dealerProfile.loaDate,"date"):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"LOI Date"}),e.jsx("p",{children:(bt=(st=C==null?void 0:C.dealer)==null?void 0:st.dealerProfile)!=null&&bt.loiDate?Ht(C.dealer.dealerProfile.loiDate,"date"):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealership Type"}),e.jsx("p",{children:((ut=(It=(Ue=C==null?void 0:C.dealer)==null?void 0:Ue.dealerProfile)==null?void 0:It.application)==null?void 0:ut.businessType)||((yt=C==null?void 0:C.outlet)==null?void 0:yt.type)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"City Category"}),e.jsx("p",{children:((kt=C==null?void 0:C.outlet)==null?void 0:kt.cityCategory)||"N/A"})]})]})})]}),e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Resignation Details"})}),e.jsx(Me,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Resignation Type"}),e.jsx("p",{children:C==null?void 0:C.resignationType})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Reason"}),e.jsx("p",{children:C==null?void 0:C.reason})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Last Operational Date (Sales)"}),e.jsx("p",{children:C!=null&&C.lastOperationalDateSales?Ht(C.lastOperationalDateSales,"date"):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Last Operational Date (Services)"}),e.jsx("p",{children:C!=null&&C.lastOperationalDateServices?Ht(C.lastOperationalDateServices,"date"):"N/A"})]})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Additional Info / Dealer Voice"}),e.jsx("p",{children:(C==null?void 0:C.additionalInfo)||"No additional info provided"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:C!=null&&C.submittedOn?Ht(C.submittedOn):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Current Stage"}),e.jsx("p",{children:C==null?void 0:C.currentStage})]})]})]})})]})]}),e.jsx(Kt,{value:"progress",children:e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Progress Timeline"}),e.jsx(Zt,{children:"Track the resignation request approval process"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:X.map((Le,Pt)=>{const ht=We(Le.key),zt=r(Le.name,Le.key).length,rs=((C==null?void 0:C.timeline)||[]).filter(Os=>Os.stage===Le.key||Os.stage===Le.name),Yt=rs.length>0?rs[rs.length-1]:null;return e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${ht==="completed"?"bg-green-100 text-green-600":ht==="active"?"bg-blue-100 text-amber-600":"bg-slate-100 text-slate-400"}`,children:ht==="completed"?e.jsx(Bn,{className:"w-5 h-5"}):e.jsx("span",{children:Le.id})}),Pt0&&e.jsxs("button",{onClick:()=>fe(Le.name,Le.key),className:"flex items-center gap-1 px-2 py-1 rounded-full bg-amber-100 hover:bg-amber-200 text-amber-700 text-xs transition-colors cursor-pointer",children:[e.jsx(fs,{className:"w-3 h-3"}),e.jsxs("span",{children:[zt," ",zt===1?"doc":"docs"]})]})]}),Yt&&e.jsxs("div",{className:"flex items-center gap-1 text-sm text-slate-600",children:[e.jsx($n,{className:"w-4 h-4"}),e.jsx("span",{children:Ht(Yt.timestamp||Yt.createdAt)})]})]}),e.jsx("p",{className:"text-slate-600 text-sm mb-1",children:Le.description}),Yt&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{variant:"secondary",className:"bg-slate-100 text-[10px] font-bold uppercase",children:Yt.user||"System"}),e.jsx("span",{className:"text-[10px] text-slate-500 italic",children:Yt.action})]}),e.jsx("div",{className:"bg-slate-50 p-3 rounded-lg border border-slate-100 text-sm text-slate-700 shadow-sm",children:Yt.comments||Yt.remarks||"No remarks provided."})]})]})]},Le.id)})})})]})}),e.jsx(Kt,{value:"documents",children:e.jsxs(Ie,{children:[e.jsxs(tt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Documents"}),e.jsx(Zt,{children:"View and manage resignation documents"})]}),e.jsxs(se,{size:"sm",onClick:()=>U(!0),className:"bg-amber-600 hover:bg-amber-700",children:[e.jsx(Dr,{className:"w-4 h-4 mr-2"}),"Upload Document"]})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Document Name"}),e.jsx(me,{children:"Type"}),e.jsx(me,{children:"Upload Date"}),e.jsx(me,{children:"Uploader"}),e.jsx(me,{children:"Actions"})]})}),e.jsx(Es,{children:(()=>{var Pt;const Le=[...(C==null?void 0:C.documents)||[],...(C==null?void 0:C.uploadedDocuments)||[]];return C!=null&&C.departmentalClearances&&Object.entries(C.departmentalClearances).forEach(([ht,zt])=>{zt.supportingDocument&&Le.push({name:`${ht} Clearance Proof`,type:"Clearance NOC",path:zt.supportingDocument,createdAt:zt.updatedAt,uploadedBy:zt.updatedBy||"Department Admin"})}),(Pt=C==null?void 0:C.settlement)!=null&&Pt.clearances&&C.settlement.clearances.forEach(ht=>{ht.supportingDocument&&Le.push({name:`${ht.department} Clearance NOC`,type:"Live NOC",path:ht.supportingDocument,createdAt:ht.clearedAt||ht.updatedAt,uploadedBy:"Department Admin"})}),Le.length===0?e.jsx(ct,{children:e.jsx(de,{colSpan:5,className:"text-center py-4 text-slate-500",children:"No documents found"})}):Le.map((ht,zt)=>{var rs;return e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-4 h-4 text-slate-500"}),e.jsx("span",{children:ht.name||ht.fileName})]})}),e.jsx(de,{children:ht.documentType||ht.type||"Document"}),e.jsx(de,{children:ht.createdAt?Ht(ht.createdAt):"N/A"}),e.jsx(de,{children:((rs=ht.uploader)==null?void 0:rs.fullName)||ht.uploadedBy||"Dealer"}),e.jsx(de,{children:e.jsx(se,{size:"sm",variant:"outline",onClick:()=>{const Yt=ht.filePath||ht.path,Os=Yt!=null&&Yt.startsWith("/uploads/")&&!Yt.startsWith("/uploads/documents/")?Yt.replace("/uploads/","/uploads/documents/"):Yt;Z({fileName:ht.fileName||ht.name,filePath:Os,documentType:ht.documentType||ht.type})},children:"View"})})]},zt)})})()})]})})]})}),e.jsx(Kt,{value:"audit",children:e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Audit Trail"}),e.jsx(Zt,{children:"Complete history of actions on this resignation request"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:R.length>0?R.map((Le,Pt)=>{var ht,zt,rs,Yt,Os,Ls,zs,en,he,Ke,at;return e.jsxs("div",{className:"flex gap-3 pb-6 border-b border-slate-100 last:border-0 relative",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-slate-300 mt-2 z-10"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:` + ${(Le.description||Le.action||((ht=Le.details)==null?void 0:ht.action)||"").toLowerCase().includes("reject")||(Le.description||Le.action||((zt=Le.details)==null?void 0:zt.action)||"").toLowerCase().includes("revok")?"bg-red-100 text-red-700 border-red-200":(Le.description||Le.action||((rs=Le.details)==null?void 0:rs.action)||"").toLowerCase().includes("sent back")||(Le.description||Le.action||((Yt=Le.details)==null?void 0:Yt.action)||"").toLowerCase().includes("send back")?"bg-amber-100 text-amber-700 border-amber-200":(Le.description||Le.action||((Os=Le.details)==null?void 0:Os.action)||"").toLowerCase().includes("approv")||(Le.description||Le.action||((Ls=Le.details)==null?void 0:Ls.action)||"").toLowerCase().includes("initi")?"bg-emerald-100 text-emerald-700 border-emerald-200":"bg-slate-100 text-slate-700 border-slate-200"} + `,children:Le.description||Le.action}),e.jsxs("span",{className:"text-xs text-slate-500 font-medium italic",children:["by ",((zs=Le.actor)==null?void 0:zs.name)||Le.userName||"System"]})]}),e.jsx("span",{className:"text-xs text-slate-500",children:Ht(Le.timestamp||Le.createdAt)})]}),(Le.remarks||((en=Le.newData)==null?void 0:en.remarks)||((he=Le.details)==null?void 0:he.remarks))&&e.jsx("div",{className:"p-3 bg-slate-50 border border-slate-100 rounded-lg text-sm text-slate-700 shadow-sm ml-1",children:Le.remarks||((Ke=Le.newData)==null?void 0:Ke.remarks)||((at=Le.details)==null?void 0:at.remarks)})]})]},Pt)}):e.jsx("div",{className:"text-center py-8 text-slate-500",children:e.jsx("p",{children:"No activity logs found for this case."})})})})]})})]}),e.jsx(os,{open:l.open,onOpenChange:Le=>c({open:Le,type:null}),children:e.jsxs(ls,{children:[e.jsxs(ms,{children:[e.jsxs(us,{children:[l.type==="approve"&&"Approve Resignation Request",l.type==="withdrawal"&&"Withdraw Resignation Request",l.type==="sendBack"&&"Send Back for Clarification",l.type==="revoke"&&"Revoke Resignation Request",l.type==="assign"&&"Assign to User",l.type==="pushfnf"&&"Push to Full & Final Settlement"]}),e.jsx(vs,{children:l.type==="assign"?"Select a user to assign this request to":l.type==="pushfnf"?"This will move the resignation request to F&F for dues clearance":"Please provide remarks for this action"})]}),e.jsx("div",{className:"space-y-4",children:l.type==="assign"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Designation Filter"}),e.jsxs(wt,{value:x,onValueChange:Le=>{f(Le),j("")},children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"All Roles"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All Roles"}),e.jsx(_e,{value:"asm",children:"ASM"}),e.jsx(_e,{value:"rbm",children:"RBM"}),e.jsx(_e,{value:"zbh",children:"ZBH"}),e.jsx(_e,{value:"nbh",children:"NBH"}),e.jsx(_e,{value:"legal",children:"Legal"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Search Name/Email"}),e.jsxs("div",{className:"relative",children:[e.jsx(ot,{placeholder:"Search...",value:h,onChange:Le=>g(Le.target.value),className:"pr-8"}),N&&e.jsx(ss,{className:"w-4 h-4 animate-spin absolute right-2 top-2.5 text-slate-400"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Select Specific Person *"}),e.jsxs(wt,{value:u,onValueChange:j,children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:p.length>0?"Choose a user":"No users found"})}),e.jsx(At,{className:"max-h-60",children:p.map(Le=>e.jsx(_e,{value:Le.id,children:e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx("span",{className:"font-medium",children:Le.fullName}),e.jsxs("span",{className:"text-[10px] text-slate-500",children:[Le.roleCode," • ",Le.email]})]})},Le.id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Assignment Remarks *"}),e.jsx(Fs,{value:d,onChange:Le=>m(Le.target.value),placeholder:"Why are you assigning this user?",rows:2})]})]}):l.type==="pushfnf"?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded-lg flex items-start gap-3",children:[e.jsx(Gs,{className:"w-5 h-5 text-amber-600 mt-0.5"}),e.jsxs("div",{className:"text-sm text-amber-800",children:[e.jsx("p",{className:"font-bold",children:"Manual Trigger Notice"}),e.jsx("p",{children:"Normally F&F is triggered after LWD. Use manual trigger only if urgent clearance is required."})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"forceFnF",checked:A,onChange:Le=>w(Le.target.checked),className:"w-4 h-4 rounded border-slate-300"}),e.jsx(ce,{htmlFor:"forceFnF",className:"font-medium text-slate-900 cursor-pointer",children:"Force Initiate F&F Settlement Immediately"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Remarks (Optional)"}),e.jsx(Fs,{value:d,onChange:Le=>m(Le.target.value),placeholder:"Add any additional notes...",rows:3})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Remarks *"}),e.jsx(Fs,{value:d,onChange:Le=>m(Le.target.value),placeholder:"Enter your remarks here...",rows:4})]})}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>c({open:!1,type:null}),disabled:M,children:"Cancel"}),e.jsx(se,{onClick:Ye,disabled:M,className:l.type==="approve"?"bg-green-600 hover:bg-green-700":l.type==="withdrawal"?"bg-red-600 hover:bg-red-700":"bg-amber-600 hover:bg-amber-700",children:M?e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"w-4 h-4 mr-2 animate-spin"}),"Processing..."]}):e.jsxs(e.Fragment,{children:[l.type==="approve"&&"Approve",l.type==="withdrawal"&&"Withdraw",l.type==="sendBack"&&"Send Back",l.type==="revoke"&&"Revoke",l.type==="assign"&&"Assign",l.type==="pushfnf"&&"Push to F&F"]})})]})]})}),e.jsx(os,{open:E.open,onOpenChange:Le=>T({open:Le,stageName:"",documents:[]}),children:e.jsxs(ls,{className:qb,children:[e.jsxs(ms,{children:[e.jsxs(us,{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-5 h-5 text-amber-600"}),"Documents - ",E.stageName]}),e.jsxs(vs,{children:["Documents uploaded for this stage (",E.documents.length," ",E.documents.length===1?"document":"documents",")"]})]}),e.jsx("div",{className:"max-h-96 overflow-y-auto",children:E.documents.length>0?e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Document Name"}),e.jsx(me,{children:"Type"}),e.jsx(me,{children:"Upload Date"}),e.jsx(me,{children:"Uploader"}),e.jsx(me,{children:"Action"})]})}),e.jsx(Es,{children:E.documents.map(Le=>e.jsxs(ct,{children:[e.jsx(de,{children:Le.name}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline",children:Le.type})}),e.jsx(de,{children:Le.uploadDate}),e.jsx(de,{children:Le.uploader}),e.jsx(de,{children:e.jsxs(se,{size:"sm",variant:"outline",className:"text-amber-600 hover:text-blue-700",onClick:()=>{if(!Le.filePath)return;const Pt=Le.filePath.startsWith("/uploads/")&&!Le.filePath.startsWith("/uploads/documents/")?Le.filePath.replace("/uploads/","/uploads/documents/"):Le.filePath;Z({fileName:Le.name,filePath:Pt,documentType:Le.type})},children:[e.jsx(fs,{className:"w-4 h-4 mr-1"}),"View"]})})]},Le.id))})]}):e.jsx("div",{className:"text-center py-8 text-slate-500",children:"No documents uploaded for this stage yet"})}),e.jsx(rn,{children:e.jsx(se,{variant:"outline",onClick:()=>T({open:!1,stageName:"",documents:[]}),children:"Close"})})]})}),e.jsx(os,{open:W,onOpenChange:U,children:e.jsxs(ls,{children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Upload Resignation Document"}),e.jsx(vs,{children:"Add a document and map it to a stage (optional)."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Document Type"}),e.jsxs(wt,{value:D,onValueChange:O,children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"Select document type"})}),e.jsx(At,{children:Ud.map(Le=>e.jsx(_e,{value:Le,children:Le},Le))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Stage (Optional)"}),e.jsxs(wt,{value:z||"none",onValueChange:Le=>G(Le==="none"?"":Le),children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"Select stage"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"none",children:"No Stage Mapping"}),vE.map(Le=>e.jsx(_e,{value:Le,children:Le},Le))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"File"}),e.jsx(ot,{type:"file",onChange:Le=>{var Pt;return B(((Pt=Le.target.files)==null?void 0:Pt[0])||null)}})]})]}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>U(!1),disabled:M,children:"Cancel"}),e.jsx(se,{onClick:be,disabled:M,children:M?"Uploading...":"Upload"})]})]})}),e.jsx(Gl,{isOpen:!!K,onClose:()=>Z(null),document:K})]})}const So={getTerminationById:async t=>{const n=(await Te.getTerminationById(t)).data;return(n==null?void 0:n.termination)||(n==null?void 0:n.data)||n},updateTerminationStatus:async(t,s,n)=>(await Te.updateTerminationStatus(t,{action:s,remarks:n})).data,issueSCN:async(t,s)=>(await Te.issueSCN(t,s)).data,uploadSCNResponse:async(t,s,n)=>{const r=new FormData;return r.append("file",s),n&&r.append("remarks",n),(await Te.uploadSCNResponse(t,r)).data},uploadDocument:async(t,s)=>(await Te.uploadTerminationDocument(t,s)).data,finalizeTermination:async(t,s,n)=>(await Te.finalizeTermination(t,{decision:s,remarks:n})).data};function R$({terminationId:t,onBack:s,currentUser:n}){var Rt,Re,Qt,qt,ws,Ps,ns,Cs,Bs,Ft,ie,Fe,Q,pe,Ne,Ee,it,st,bt,Ue,It,ut,yt,kt,Le,Pt,ht,zt,rs,Yt,Os,Ls,zs,en;const r=qn(),[a,l]=v.useState({open:!1,type:null}),[c,d]=v.useState(""),[m,x]=v.useState(""),[f,h]=v.useState({open:!1,stageName:"",documents:[]}),[g,u]=v.useState(!0),[j,p]=v.useState(null),[y,N]=v.useState([]),[S,A]=v.useState(!1),[w,E]=v.useState(null),[T,C]=v.useState(""),[L,$]=v.useState(!1),[_,R]=v.useState(!1),[P,M]=v.useState("Approve"),[q,K]=v.useState(""),[Z,W]=v.useState(!1),[U,F]=v.useState(null),[B,D]=v.useState(Jx[0]),[O,z]=v.useState(""),[G,Y]=v.useState(null),V=async()=>{try{u(!0);const he=await So.getTerminationById(t);p(he),X()}catch(he){console.error("Error fetching termination:",he)}finally{u(!1)}},X=async()=>{try{const he=await Te.getAuditLogs("termination",t);he.data&&he.data.success&&N(he.data.data||[])}catch(he){console.error("Error fetching audit logs:",he)}};if(v.useEffect(()=>{V()},[t]),g)return e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:[e.jsx(ss,{className:"w-8 h-8 text-amber-600 animate-spin"}),e.jsx("p",{className:"text-slate-600",children:"Loading termination details..."})]});const ne=async()=>{try{$(!0),await So.issueSCN(t,{remarks:T}),ee.success("SCN issued successfully"),A(!1),V()}catch{ee.error("Failed to issue SCN")}finally{$(!1)}},oe=async()=>{if(w)try{$(!0),await So.uploadSCNResponse(t,w,T),ee.success("SCN response uploaded"),A(!1),V()}catch{ee.error("Failed to upload response")}finally{$(!1)}},re=async()=>{try{$(!0),await So.finalizeTermination(t,P,q),ee.success(`Termination ${P.toLowerCase()}ed`),R(!1),V()}catch{ee.error("Failed to finalize termination")}finally{$(!1)}},ge=async()=>{if(!U){ee.error("Please select a file to upload");return}try{$(!0);const he=new FormData;he.append("file",U),he.append("documentType",B),O&&he.append("stage",O),await So.uploadDocument(t,he),ee.success("Document uploaded successfully"),W(!1),F(null),D(Jx[0]),z(""),V()}catch{ee.error("Failed to upload document")}finally{$(!1)}},ve=n&&["DD Lead","DD Head","NBH","DD Admin","Super Admin"].includes(n.role||n.roleCode),We=(()=>{if(!j||!n)return{canApprove:!1,canWithdraw:!1,canIssueSCN:!1,canUploadSCNResponse:!1,canFinalize:!1,canPushToFnF:!1};const he=j.currentStage,Ke=j.status,at=n.role||n.roleCode,pt=["Show Cause Notice","Show Cause Notice (SCN)","SCN"].includes(he),mt=["Completed","Rejected","Withdrawn","Terminated"].includes(Ke)||he==="Terminated",Bt=Ke==="F&F Initiated"||he==="F&F Initiated"||Ke==="Settled"||Ke==="FNF_INITIATED";return{canApprove:(at==="Super Admin"||at==="DD Admin"||he==="RBM Review"&&at==="RBM"||he==="ZBH Review"&&at==="ZBH"||he==="DD Lead Review"&&at==="DD Lead"||he==="Legal Verification"&&at==="Legal Admin"||he==="DD Head Review"&&at==="DD Head"||he==="NBH Evaluation"&&at==="NBH"||he==="NBH Final Approval"&&at==="NBH"||he==="CCO Approval"&&at==="CCO"||he==="CEO Final Approval"&&at==="CEO"||he==="Legal - Termination Letter"&&at==="Legal Admin")&&!mt&&!Bt&&!["NBH Final Approval","CCO Approval","CEO Final Approval","Show Cause Notice","Show Cause Notice (SCN)","SCN"].includes(he),canIssueSCN:he==="NBH Evaluation"&&(at==="NBH"||at==="Super Admin")&&!mt,canUploadSCNResponse:pt&&["Legal Admin","DD Admin","Super Admin"].includes(at)&&!mt,canFinalize:(he==="NBH Final Approval"&&at==="NBH"||he==="CCO Approval"&&at==="CCO"||he==="CEO Final Approval"&&at==="CEO"||at==="Super Admin")&&["NBH Final Approval","CCO Approval","CEO Final Approval"].includes(he)&&!mt,canPushToFnF:ve&&!Bt&&["Legal - Termination Letter","Terminated","Dealer Terminated"].includes(he),canWithdraw:at==="ASM"&&he==="Request Initiated"&&!mt,isFinalState:mt,isSettlementPhase:Bt}})(),Ce=j||{},fe=["Show Cause Notice","Show Cause Notice (SCN)","SCN"].includes(Ce.currentStage),Ye={Submitted:["Submitted","Request Initiated"],"RBM Review":["RBM Review"],"ZBH Review":["ZBH Review"],"DD Lead Review":["DD Lead Review"],"Legal Verification":["Legal Verification"],"DD Head Review":["DD Head Review"],"NBH Evaluation":["NBH Evaluation"],"Show Cause Notice (SCN)":["Show Cause Notice","Show Cause Notice (SCN)","SCN"],"Personal Hearing":["Personal Hearing"],"NBH Final Approval":["NBH Final Approval"],"CCO Approval":["CCO Approval"],"CEO Final Approval":["CEO Final Approval"],"Legal - Termination Letter":["Legal - Termination Letter"],"Dealer Terminated":["Terminated","Dealer Terminated"]},be=["Submitted","RBM Review","ZBH Review","DD Lead Review","Legal Verification","DD Head Review","NBH Evaluation","Show Cause Notice (SCN)","Personal Hearing","NBH Final Approval","CCO Approval","CEO Final Approval","Legal - Termination Letter","Dealer Terminated"],Pe=he=>{if(!he)return"";const Ke=String(he).trim();return be.find(pt=>(Ye[pt]||[pt]).includes(Ke))||Ke},ke=he=>{const Ke=["Rejected","Revoked","Withdrawn"].includes(Ce.status),at=["Completed","Terminated","Settled","F&F Initiated","FNF_INITIATED"].includes(Ce.status)||Ce.currentStage==="Terminated";let pt=Ce.currentStage||Ce.status;if(Ke&&(Ce.currentStage==="Rejected"||Ce.currentStage==="Revoked"||!Ce.currentStage)){const as=[...Ce.timeline||[]].reverse().find(Vs=>Vs.stage&&Vs.stage!=="Rejected"&&Vs.stage!=="Revoked");as&&(pt=as.stage)}const mt=Pe(pt),Bt=be.indexOf(mt),Ds=be.indexOf(he);return at&&Ds<=Bt?"completed":Ds===-1?"pending":Bt===-1?he==="Submitted"?"completed":"pending":Ds{const at=Ye[Ke]||[Ke],pt=qe.filter(mt=>!mt.stage||at.includes(mt.stage)).map(mt=>{var Bt;return{id:mt.id||`${Ke}-${mt.fileName||mt.name}`,name:mt.fileName||mt.name||"Document",type:mt.documentType||mt.type||"Document",uploadDate:mt.uploadDate||mt.createdAt?Ht(mt.uploadDate||mt.createdAt):"N/A",uploader:((Bt=mt.uploader)==null?void 0:Bt.fullName)||mt.uploader||"-",path:mt.filePath||mt.path||mt.url}});return he[Ke]=pt,he},{}),dt=he=>{const Ke=Ye[he]||[he],at=(Ce.timeline||[]).filter(pt=>Ke.includes(pt.stage));return at.length===0?null:he==="Submitted"?at.find(mt=>String((mt==null?void 0:mt.action)||"").toLowerCase().includes("initiated"))||at[0]:at[at.length-1]},xt=[{id:1,name:"Submitted",status:ke("Submitted"),description:"Termination request initiated",date:"",actionType:"",actionBy:"",remarks:"",feedback:""},{id:2,name:"RBM Review",status:ke("RBM Review"),description:"Regional Business Manager review"},{id:3,name:"ZBH Review",status:ke("ZBH Review"),description:"Zonal Business Head evaluation"},{id:4,name:"DD Lead Review",status:ke("DD Lead Review"),description:"DD Lead validation"},{id:5,name:"Legal Verification",status:ke("Legal Verification"),description:"Legal team validates termination grounds"},{id:6,name:"DD Head Review",status:ke("DD Head Review"),description:"DD Head strategic review"},{id:7,name:"NBH Evaluation",status:ke("NBH Evaluation"),description:"National Business Head decision"},{id:8,name:"Show Cause Notice (SCN)",status:ke("Show Cause Notice (SCN)"),description:"SCN sent to dealer, awaiting response"},{id:9,name:"Personal Hearing",status:ke("Personal Hearing"),description:"Evaluation of SCN response & Hearing"},{id:10,name:"NBH Final Approval",status:ke("NBH Final Approval"),description:"NBH final termination decision"},{id:11,name:"CCO Approval",status:ke("CCO Approval"),description:"Chief Commercial Officer approval"},{id:12,name:"CEO Final Approval",status:ke("CEO Final Approval"),description:"CEO final authorization"},{id:13,name:"Legal - Termination Letter",status:ke("Legal - Termination Letter"),description:"Legal team issues final termination letter"},{id:14,name:"Dealer Terminated",status:ke("Dealer Terminated"),description:"Dealership termination effective",date:"",actionType:"",actionBy:"",remarks:"",feedback:""}],ye=he=>{const Ke=Ve[he]||[];h({open:!0,stageName:he,documents:Ke})},le=he=>{l({open:!0,type:he})},Qe=async()=>{var pt,mt;const he=a.type,Ke=he==="sendBack"?"sendBack":he||"approve",at=c.trim();if(["sendBack","revoke"].includes(he||"")&&at.length<5){ee.error("Please provide detailed remarks (minimum 5 characters required for Send Back / Revoke)");return}if(!at&&!["assign","pushfnf"].includes(he||"")){ee.error("Please provide remarks/comments for this action");return}if(he==="assign"&&!m){ee.error("Please select a user");return}$(!0);try{if(he==="approve"||he==="sendBack"||he==="withdrawal"||he==="revoke")await So.updateTerminationStatus(t,Ke,c);else if(he==="pushfnf")await So.updateTerminationStatus(t,"pushfnf",c);else{ee.error("Action logic not fully implemented for this type"),$(!1);return}const Bt={approve:"Request approved and forwarded",withdrawal:"Request withdrawn successfully",sendBack:"Request sent back for clarification",assign:`Request assigned to ${m}`,pushfnf:"Request pushed to F&F successfully",revoke:"Request revoked and withdrawn"};ee.success(Bt[he]||"Action completed"),l({open:!1,type:null}),d(""),x(""),V()}catch(Bt){const Ds=((mt=(pt=Bt.response)==null?void 0:pt.data)==null?void 0:mt.message)||"Failed to perform action";ee.error(Ds)}finally{$(!1)}},rt=he=>{switch(he){case"Critical":return"bg-red-100 text-red-700 border-red-300";case"High":return"bg-orange-100 text-orange-700 border-orange-300";case"Medium":return"bg-yellow-100 text-yellow-700 border-yellow-300";default:return"bg-blue-100 text-blue-700 border-blue-300"}},Gt=(Ce.worknotes||[]).length;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(mi,{className:"border-amber-200 bg-amber-50",children:[e.jsx(Ya,{className:"h-4 w-4 text-amber-600"}),e.jsx(Hi,{className:"text-amber-900",children:"Sensitive Information"}),e.jsx(fi,{className:"text-amber-700",children:"This is a termination case. All actions are logged and audited. Proceed with caution."})]}),e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"outline",size:"icon",onClick:s,className:"hover:bg-slate-100 transition-colors",children:e.jsx($r,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl",children:Ce.requestId||t}),e.jsx("p",{className:"text-slate-600",children:((Rt=Ce.dealer)==null?void 0:Rt.businessName)||((Re=Ce.dealer)==null?void 0:Re.legalName)||"Termination"})]}),e.jsx(Ae,{className:rt(Ce.severity),children:Ce.severity}),e.jsx(Ae,{className:Ce.status==="Completed"||Ce.status==="Terminated"||Ce.status==="Settled"?"bg-green-100 text-green-700 border-green-300":Ce.status==="Rejected"||Ce.status==="Withdrawn"?"bg-red-100 text-red-700 border-red-300":"bg-yellow-100 text-yellow-700 border-yellow-300",children:Ce.status==="Settled"?"Completed":Ce.status||"Pending"})]})}),e.jsx(Ie,{className:"border-amber-200 shadow-sm",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-slate-600 mr-2",children:"Termination Actions:"}),(n==null?void 0:n.role)!=="Dealer"&&e.jsxs(e.Fragment,{children:[!We.canFinalize&&e.jsxs(e.Fragment,{children:[We.canApprove&&e.jsxs(se,{size:"sm",className:"bg-green-600 hover:bg-green-700 transition-all hover:shadow-md",onClick:()=>le("approve"),children:[e.jsx(Bn,{className:"w-4 h-4 mr-2"}),"Approve"]}),We.canIssueSCN&&e.jsxs(se,{size:"sm",className:"bg-purple-600 hover:bg-purple-700 transition-all shadow-sm",onClick:()=>A(!0),children:[e.jsx(Ya,{className:"w-4 h-4 mr-2"}),"Issue SCN"]}),We.canUploadSCNResponse&&e.jsxs(se,{size:"sm",className:"bg-amber-600 hover:bg-amber-700 transition-all shadow-sm",onClick:()=>{E(null),A(!0)},children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"Upload SCN Response"]}),We.canApprove&&e.jsxs(se,{size:"sm",variant:"outline",className:"hover:bg-slate-50 transition-all",onClick:()=>le("sendBack"),children:[e.jsx(eb,{className:"w-4 h-4 mr-2"}),"Send Back"]})]}),We.canFinalize&&e.jsxs(se,{size:"sm",className:"bg-indigo-600 hover:bg-indigo-700 transition-all shadow-sm",onClick:()=>R(!0),children:[e.jsx(Fl,{className:"w-4 h-4 mr-2"}),"Final Authorization"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[We.canPushToFnF&&e.jsxs(se,{size:"sm",variant:"outline",className:"text-blue-600 border-blue-300 hover:bg-blue-50 transition-all",onClick:()=>le("pushfnf"),children:[e.jsx(fu,{className:"w-4 h-4 mr-2"}),"Push to F&F"]}),!We.isFinalState&&e.jsxs(se,{size:"sm",variant:"outline",className:"hover:bg-slate-50 transition-all",onClick:()=>le("assign"),children:[e.jsx(sb,{className:"w-4 h-4 mr-2"}),"Assign User"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-amber-200",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(zr,{className:"w-4 h-4 text-slate-500"}),e.jsx("span",{className:"text-sm text-slate-600",children:"Communication & Notes"})]}),e.jsxs(se,{size:"sm",variant:"outline",className:"relative hover:bg-amber-50 hover:border-amber-300 hover:text-amber-700 transition-all shadow-sm",onClick:()=>{var he;return r(`/worknotes/termination/${t}`,{state:{applicationName:((he=Ce==null?void 0:Ce.dealer)==null?void 0:he.businessName)||"Termination",registrationNumber:t||"",participants:(Ce==null?void 0:Ce.participants)||[]}})},children:[e.jsx(zr,{className:"w-4 h-4 mr-2"}),"View Work Notes",Gt>0&&e.jsx(Ae,{className:"ml-2 bg-amber-600 hover:bg-amber-700 text-white h-5 px-2",children:Gt})]})]})]})})}),e.jsxs(_n,{defaultValue:"details",className:"w-full",children:[e.jsxs(Pn,{className:"bg-slate-100 p-1",children:[e.jsx(Wt,{value:"details",className:"data-[state=active]:bg-white",children:"Details"}),e.jsx(Wt,{value:"progress",className:"data-[state=active]:bg-white",children:"Progress"}),e.jsx(Wt,{value:"documents",className:"data-[state=active]:bg-white",children:"Documents"}),e.jsx(Wt,{value:"audit",className:"data-[state=active]:bg-white",children:"Audit Trail"})]}),e.jsxs(Kt,{value:"details",className:"space-y-6",children:[e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Dealer Information"})}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Code"}),e.jsx("p",{children:((qt=(Qt=Ce.dealer)==null?void 0:Qt.dealerCode)==null?void 0:qt.dealerCode)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:((ws=Ce.dealer)==null?void 0:ws.businessName)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GST"}),e.jsx("p",{children:((Ps=Ce.dealer)==null?void 0:Ps.gstNumber)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Email"}),e.jsx("p",{children:((Cs=(ns=Ce.dealer)==null?void 0:ns.user)==null?void 0:Cs.email)||"N/A"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(ce,{className:"text-slate-600",children:"Address"}),e.jsx("p",{children:((Bs=Ce.dealer)==null?void 0:Bs.registeredAddress)||((ie=(Ft=Ce.dealer)==null?void 0:Ft.application)==null?void 0:ie.address)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"City"}),e.jsx("p",{children:((Q=(Fe=Ce.dealer)==null?void 0:Fe.application)==null?void 0:Q.city)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"District"}),e.jsx("p",{children:((Ee=(Ne=(pe=Ce.dealer)==null?void 0:pe.application)==null?void 0:Ne.district)==null?void 0:Ee.name)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealership Name"}),e.jsx("p",{children:((it=Ce.dealer)==null?void 0:it.businessName)||Ce.dealershipName})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Sales Code"}),e.jsx("p",{children:((bt=(st=Ce.dealer)==null?void 0:st.dealerCode)==null?void 0:bt.salesCode)||Ce.salesCode||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Service Code"}),e.jsx("p",{children:((It=(Ue=Ce.dealer)==null?void 0:Ue.dealerCode)==null?void 0:It.serviceCode)||Ce.serviceCode||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GMA Code"}),e.jsx("p",{children:((yt=(ut=Ce.dealer)==null?void 0:ut.dealerCode)==null?void 0:yt.gmaCode)||Ce.accessoriesCode||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GMA Code"}),e.jsx("p",{children:((Le=(kt=Ce.dealer)==null?void 0:kt.dealerCode)==null?void 0:Le.gmaCode)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Gear Code"}),e.jsx("p",{children:((ht=(Pt=Ce.dealer)==null?void 0:Pt.dealerCode)==null?void 0:ht.gearCode)||"N/A"})]})]})})]}),e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Operational Details"})}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Inauguration"}),e.jsx("p",{children:(zt=Ce.dealer)!=null&&zt.onboardedAt?Ht(Ce.dealer.onboardedAt,"date"):Ce.inauguration||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"LOA Date"}),e.jsx("p",{children:(rs=Ce.dealer)!=null&&rs.loaDate?Ht(Ce.dealer.loaDate,"date"):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"LOI Date"}),e.jsx("p",{children:(Yt=Ce.dealer)!=null&&Yt.loiDate?Ht(Ce.dealer.loiDate,"date"):"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Last 6 Months Sales"}),e.jsx("p",{children:Ce.lastSixMonthsSales})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Number of Dealerships"}),e.jsx("p",{children:Ce.numberOfDealerships})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Number of Studios"}),e.jsx("p",{children:Ce.numberOfStudios})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Constitution"}),e.jsx("p",{children:((Os=Ce.dealer)==null?void 0:Os.constitutionType)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealership Type"}),e.jsx("p",{children:((zs=(Ls=Ce.dealer)==null?void 0:Ls.application)==null?void 0:zs.businessType)||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Type of Closure"}),e.jsx("p",{children:Ce.typeOfClosure||"Complete"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Format Category"}),e.jsx("p",{children:Ce.formatCategory||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Score Card Band"}),e.jsx("p",{children:Ce.dealerScoreCardBand||"N/A"})]})]})})]}),e.jsxs(Ie,{className:"border-amber-200 bg-amber-50/30",children:[e.jsx(tt,{children:e.jsxs(nt,{className:"text-amber-900 flex items-center gap-2",children:[e.jsx(Ya,{className:"w-5 h-5"}),"Termination Details"]})}),e.jsx(Me,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Termination Category"}),e.jsx("p",{className:"text-amber-900",children:Ce.category})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Sub Category"}),e.jsx("p",{children:Ce.subCategory||"N/A"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Description"}),e.jsx("p",{children:Ce.reason})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Severity"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ae,{className:rt(Ce.severity),children:Ce.severity})})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Submitted By"}),e.jsx("p",{children:((en=Ce.initiator)==null?void 0:en.fullName)||"System"})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:Ht(Ce.createdAt)})]})]})]})})]})]}),e.jsx(Kt,{value:"progress",children:e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Termination Progress Timeline"}),e.jsx(Zt,{children:"Track the termination request approval process"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:xt.map((he,Ke)=>{var mt;const at=((mt=Ve[he.name])==null?void 0:mt.length)||0,pt=dt(he.name);return e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${he.status==="completed"?"bg-green-100 text-green-600":he.status==="active"?"bg-amber-100 text-amber-600":"bg-slate-100 text-slate-400"}`,children:he.status==="completed"?e.jsx(Bn,{className:"w-5 h-5"}):he.status==="active"?e.jsx(Ya,{className:"w-5 h-5"}):e.jsx("span",{children:he.id})}),Ke0&&e.jsxs("button",{onClick:()=>ye(he.name),className:"flex items-center gap-1 px-2 py-1 rounded-full bg-amber-100 hover:bg-amber-200 text-amber-700 text-xs transition-colors cursor-pointer",children:[e.jsx(fs,{className:"w-3 h-3"}),e.jsxs("span",{children:[at," ",at===1?"doc":"docs"]})]})]}),((pt==null?void 0:pt.timestamp)||he.date)&&e.jsxs("div",{className:"flex items-center gap-1 text-sm text-slate-600",children:[e.jsx($n,{className:"w-4 h-4"}),e.jsx("span",{children:Ht((pt==null?void 0:pt.timestamp)||he.date)})]})]}),e.jsx("p",{className:"text-slate-600 text-sm",children:he.description}),pt&&e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:"bg-blue-100 text-blue-700 border-blue-300",children:pt.action||"Updated"}),e.jsxs("span",{className:"text-xs text-slate-500",children:["by ",pt.user||"System"]})]}),e.jsx("div",{className:"bg-slate-50 border border-slate-200 rounded-lg p-3",children:e.jsx("div",{className:"space-y-2",children:e.jsxs("div",{children:[e.jsx(ce,{className:"text-xs text-slate-600",children:"Remarks:"}),e.jsx("p",{className:"text-sm text-slate-700 mt-1",children:pt.remarks||"No remarks provided."})]})})})]})]})]},he.id)})})})]})}),e.jsx(Kt,{value:"documents",children:e.jsxs(Ie,{children:[e.jsxs(tt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Documents"}),e.jsx(Zt,{children:"View and manage termination case documents"})]}),e.jsxs(se,{size:"sm",onClick:()=>W(!0),className:"bg-amber-600 hover:bg-amber-700",children:[e.jsx(Dr,{className:"w-4 h-4 mr-2"}),"Upload Document"]})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Document Name"}),e.jsx(me,{children:"Type"}),e.jsx(me,{children:"Upload Date"}),e.jsx(me,{children:"Uploader"}),e.jsx(me,{children:"Actions"})]})}),e.jsx(Es,{children:(()=>{const he=[...Ce.documents||[],...Ce.uploadedDocuments||[]];return he.length===0?e.jsx(ct,{children:e.jsx(de,{colSpan:5,className:"text-center py-4 text-slate-500",children:"No documents found"})}):he.map((Ke,at)=>{var pt;return e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-4 h-4 text-slate-500"}),e.jsx("span",{children:Ke.name||Ke.fileName})]})}),e.jsx(de,{children:Ke.documentType||Ke.type||"Document"}),e.jsx(de,{children:Ht(Ke.uploadDate||Ke.createdAt)}),e.jsx(de,{children:((pt=Ke.uploader)==null?void 0:pt.fullName)||Ke.uploader||"-"}),e.jsx(de,{children:e.jsx(se,{size:"sm",variant:"outline",onClick:()=>{const mt=Ke.filePath||Ke.path||Ke.url;if(!mt)return;const Bt=mt.startsWith("/uploads/")&&!mt.startsWith("/uploads/documents/")?mt.replace("/uploads/","/uploads/documents/"):mt;Y({fileName:Ke.name||Ke.fileName||"Document",filePath:Bt,documentType:Ke.documentType||Ke.type||"Document"})},children:"View"})})]},Ke.id||at)})})()})]})})]})}),e.jsx(Kt,{value:"audit",children:e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Audit Trail"}),e.jsx(Zt,{children:"Complete history of actions on this termination case"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:y.length>0?y.map((he,Ke)=>{var at,pt,mt,Bt,Ds,as,Vs,Is,Ts,ln,pn;return e.jsxs("div",{className:"flex gap-3 pb-6 border-b border-slate-100 last:border-0 relative",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-slate-300 mt-2 z-10"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:` ${(he.description||he.action||((at=he.details)==null?void 0:at.action)||"").toLowerCase().includes("reject")||(he.description||he.action||((pt=he.details)==null?void 0:pt.action)||"").toLowerCase().includes("revok")?"bg-red-100 text-red-700 border-red-200":(he.description||he.action||((mt=he.details)==null?void 0:mt.action)||"").toLowerCase().includes("sent back")||(he.description||he.action||((Bt=he.details)==null?void 0:Bt.action)||"").toLowerCase().includes("send back")?"bg-amber-100 text-amber-700 border-amber-200":(he.description||he.action||((Ds=he.details)==null?void 0:Ds.action)||"").toLowerCase().includes("approv")||(he.description||he.action||((as=he.details)==null?void 0:as.action)||"").toLowerCase().includes("initi")?"bg-emerald-100 text-emerald-700 border-emerald-200":"bg-slate-100 text-slate-700 border-slate-200"} - `,children:he.description||he.action}),e.jsxs("span",{className:"text-xs text-slate-500 font-medium italic",children:["by ",((Vs=he.actor)==null?void 0:Vs.name)||he.userName||"System"]})]}),e.jsx("span",{className:"text-xs text-slate-500",children:Ht(he.timestamp||he.createdAt)})]}),(he.remarks||((Ls=he.newData)==null?void 0:Ls.remarks)||((Ts=he.details)==null?void 0:Ts.remarks))&&e.jsx("div",{className:"p-3 bg-slate-50 border border-slate-100 rounded-lg text-sm text-slate-700 shadow-sm ml-1",children:he.remarks||((ln=he.newData)==null?void 0:ln.remarks)||((pn=he.details)==null?void 0:pn.remarks)})]})]},Ge)}):e.jsx("div",{className:"text-center py-8 text-slate-500",children:e.jsx("p",{children:"No activity logs found for this case."})})})})]})})]}),e.jsx(os,{open:a.open,onOpenChange:he=>l({open:he,type:null}),children:e.jsxs(ls,{children:[e.jsxs(ms,{children:[e.jsxs(us,{children:[a.type==="approve"&&"Approve Termination Request",a.type==="withdrawal"&&"Withdraw Termination Request",a.type==="sendBack"&&"Send Back for Clarification",a.type==="revoke"&&"Revoke Termination Request",a.type==="assign"&&"Assign to User",a.type==="pushfnf"&&"Push to Full & Final Settlement"]}),e.jsx(vs,{children:a.type==="assign"?"Select a user to assign this request to":a.type==="pushfnf"?"This will move the termination case to F&F for dues clearance":"Please provide remarks for this action"})]}),e.jsx("div",{className:"space-y-4",children:a.type==="assign"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Select User"}),e.jsxs(wt,{value:h,onValueChange:x,children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"Choose a user"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"rbm",children:"RBM - Regional Business Manager"}),e.jsx(Pe,{value:"zbh",children:"ZBH - Zonal Business Head"}),e.jsx(Pe,{value:"dd-lead",children:"DD Lead"}),e.jsx(Pe,{value:"legal",children:"Legal Team"}),e.jsx(Pe,{value:"nbh",children:"NBH - National Business Head"}),e.jsx(Pe,{value:"cco",children:"CCO - Chief Commercial Officer"}),e.jsx(Pe,{value:"ceo",children:"CEO"})]})]})]}):a.type==="pushfnf"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Remarks (Optional)"}),e.jsx(Fs,{value:c,onChange:he=>d(he.target.value),placeholder:"Add any additional notes...",rows:3})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Remarks *"}),e.jsx(Fs,{value:c,onChange:he=>d(he.target.value),placeholder:"Enter your remarks here...",rows:4})]})}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>l({open:!1,type:null}),children:"Cancel"}),e.jsx(se,{onClick:Qe,className:a.type==="approve"?"bg-green-600 hover:bg-green-700":a.type==="withdrawal"?"bg-red-600 hover:bg-red-700":"bg-blue-600 hover:bg-blue-700",children:"Confirm"})]})]})}),e.jsx(os,{open:f.open,onOpenChange:he=>m({open:he,stageName:"",documents:[]}),children:e.jsxs(ls,{className:Fb,children:[e.jsxs(ms,{children:[e.jsxs(us,{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-5 h-5 text-amber-600"}),"Documents - ",f.stageName]}),e.jsxs(vs,{children:["Documents uploaded for this stage (",f.documents.length," ",f.documents.length===1?"document":"documents",")"]})]}),e.jsx("div",{className:"max-h-96 overflow-y-auto",children:f.documents.length>0?e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Document Name"}),e.jsx(me,{children:"Type"}),e.jsx(me,{children:"Upload Date"}),e.jsx(me,{children:"Uploader"}),e.jsx(me,{children:"Action"})]})}),e.jsx(Es,{children:f.documents.map(he=>e.jsxs(ct,{children:[e.jsx(de,{children:he.name}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline",children:he.type})}),e.jsx(de,{children:he.uploadDate}),e.jsx(de,{children:he.uploader}),e.jsx(de,{children:e.jsxs(se,{size:"sm",variant:"outline",className:"text-amber-600 hover:text-amber-700",onClick:()=>{const Ge=he.path;if(!Ge)return;const at=Ge.startsWith("/uploads/")&&!Ge.startsWith("/uploads/documents/")?Ge.replace("/uploads/","/uploads/documents/"):Ge;Y({fileName:he.name||"Document",filePath:at,documentType:he.type||"Document"})},children:[e.jsx(fs,{className:"w-4 h-4 mr-1"}),"View"]})})]},he.id))})]}):e.jsx("div",{className:"text-center py-8 text-slate-500",children:"No documents uploaded for this stage yet"})}),e.jsx(rn,{children:e.jsx(se,{variant:"outline",onClick:()=>m({open:!1,stageName:"",documents:[]}),children:"Close"})})]})}),e.jsx(os,{open:S,onOpenChange:C,children:e.jsxs(ls,{className:"bg-white",children:[e.jsxs(ms,{children:[e.jsx(us,{children:fe?"Upload SCN Response":"Issue Show Cause Notice (SCN)"}),e.jsx(vs,{children:fe?"Upload the response received from the dealer regarding the SCN.":"Confirm the issuance of a formal Show Cause Notice to the dealer."})]}),e.jsxs("div",{className:"space-y-4 pt-4",children:[fe&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"SCN Response File"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("input",{type:"file",className:"hidden",id:"scn-file-upload",onChange:he=>{var Ge;return R(((Ge=he.target.files)==null?void 0:Ge[0])||null)}}),e.jsx(se,{variant:"outline",className:"w-full border-dashed",onClick:()=>{var he;return(he=document.getElementById("scn-file-upload"))==null?void 0:he.click()},children:w?w.name:"Select PDF or Image"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Remarks/Details"}),e.jsx(Fs,{placeholder:"Add any internal remarks or justification...",value:P,onChange:he=>A(he.target.value),rows:4})]}),e.jsxs(rn,{className:"gap-2 sm:gap-0",children:[e.jsx(se,{variant:"outline",onClick:()=>C(!1),disabled:I,children:"Cancel"}),e.jsx(se,{className:fe?"bg-amber-600 hover:bg-amber-700":"bg-purple-600 hover:bg-purple-700",onClick:fe?oe:ne,disabled:I||fe&&!w,children:I?"Processing...":fe?"Upload Response":"Issue SCN"})]})]})]})}),e.jsx(os,{open:T,onOpenChange:E,children:e.jsxs(ls,{className:"bg-white",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Final Termination Authorization"}),e.jsx(vs,{children:"Provide your final decision on this termination case."})]}),e.jsxs("div",{className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Final Decision"}),e.jsxs(wt,{value:_,onValueChange:he=>M(he),children:[e.jsx(Ct,{className:"mt-2 text-slate-900 border-slate-300",children:e.jsx(St,{placeholder:"Select decision"})}),e.jsxs(At,{className:"bg-white border-slate-200 shadow-xl overflow-visible z-[9999]",children:[e.jsx(Pe,{value:"Approve",className:"text-amber-700 focus:bg-amber-50",children:"Confirm Termination"}),e.jsx(Pe,{value:"Reject",className:"text-slate-600 focus:bg-slate-50",children:"Reject Termination"}),e.jsx(Pe,{value:"Reconsider",className:"text-amber-600 focus:bg-amber-50",children:"Reconsider / Give More Time"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Authorization Remarks"}),e.jsx(Fs,{placeholder:"Provide your rationale for this decision...",value:q,onChange:he=>G(he.target.value),rows:4})]}),e.jsxs(rn,{className:"gap-2 sm:gap-0",children:[e.jsx(se,{variant:"outline",onClick:()=>E(!1),disabled:I,children:"Cancel"}),e.jsx(se,{className:"bg-indigo-600 hover:bg-indigo-700",onClick:re,disabled:I||!q,children:I?"Authorizing...":"Submit Decision"})]})]})]})}),e.jsx(os,{open:Z,onOpenChange:W,children:e.jsxs(ls,{children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Upload Termination Document"}),e.jsx(vs,{children:"Add a document and map it to a stage (optional)."})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Document Type"}),e.jsxs(wt,{value:B,onValueChange:D,children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"Select document type"})}),e.jsx(At,{children:Zx.map(he=>e.jsx(Pe,{value:he,children:he},he))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Stage (Optional)"}),e.jsxs(wt,{value:O||"none",onValueChange:he=>V(he==="none"?"":he),children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"Select stage"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"none",children:"No Stage Mapping"}),g$.map(he=>e.jsx(Pe,{value:he,children:he},he))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"File"}),e.jsx("input",{type:"file",onChange:he=>{var Ge;return F(((Ge=he.target.files)==null?void 0:Ge[0])||null)}})]})]}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>W(!1),disabled:I,children:"Cancel"}),e.jsx(se,{onClick:ge,disabled:I,children:I?"Uploading...":"Upload"})]})]})}),e.jsx(Kl,{isOpen:!!K,onClose:()=>Y(null),document:K})]})}const aa=t=>{if(!t)return"-";try{const s=new Date(t);return isNaN(s.getTime())?"-":s.toLocaleString("en-IN",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}catch{return"-"}},u1=t=>{if(!t)return"-";try{const s=new Date(t);return isNaN(s.getTime())?"-":s.toLocaleDateString("en-IN",{day:"2-digit",month:"short",year:"numeric"})}catch{return"-"}},fE=({isOpen:t,onClose:s,onSubmit:n,editingBank:r,isSubmitting:a})=>e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"sm:max-w-[500px]",children:[e.jsxs(ms,{children:[e.jsx(us,{children:r?"Edit Bank Details":"Add Bank Account"}),e.jsx(vs,{children:"Enter the dealer's bank information for settlement transfers."})]}),e.jsxs("form",{onSubmit:n,"data-testid":"onboarding-bank-details-form",children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"bankName",className:"text-right text-xs",children:"Bank Name"}),e.jsx("div",{className:"col-span-3",children:e.jsx(ot,{id:"bankName",name:"bankName",defaultValue:r==null?void 0:r.bankName,required:!0,placeholder:"e.g. HDFC Bank, ICICI Bank",className:"h-9","data-testid":"onboarding-bank-name-input"})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"accountHolderName",className:"text-right text-xs",children:"Holder Name"}),e.jsx("div",{className:"col-span-3",children:e.jsx(ot,{id:"accountHolderName",name:"accountHolderName",defaultValue:r==null?void 0:r.accountHolderName,required:!0,placeholder:"Full name as per bank records",className:"h-9","data-testid":"onboarding-account-holder-name-input"})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"accountNumber",className:"text-right text-xs",children:"A/C Number"}),e.jsx("div",{className:"col-span-3",children:e.jsx(ot,{id:"accountNumber",name:"accountNumber",defaultValue:r==null?void 0:r.accountNumber,required:!0,placeholder:"Enter account number",className:"h-9","data-testid":"onboarding-account-number-input"})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"ifscCode",className:"text-right text-xs",children:"IFSC Code"}),e.jsx("div",{className:"col-span-3",children:e.jsx(ot,{id:"ifscCode",name:"ifscCode",defaultValue:r==null?void 0:r.ifscCode,required:!0,placeholder:"11-character code",className:"h-9","data-testid":"onboarding-ifsc-code-input"})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"branchName",className:"text-right text-xs",children:"Branch"}),e.jsx("div",{className:"col-span-3",children:e.jsx(ot,{id:"branchName",name:"branchName",defaultValue:r==null?void 0:r.branchName,required:!0,placeholder:"Branch location",className:"h-9","data-testid":"onboarding-branch-name-input"})})]}),e.jsx("div",{className:"grid grid-cols-4 items-center gap-4",children:e.jsxs("div",{className:"flex items-center gap-2 col-start-2 col-span-3",children:[e.jsx("input",{type:"checkbox",id:"isPrimaryModal",name:"isPrimary",defaultChecked:r==null?void 0:r.isPrimary,className:"w-4 h-4 rounded border-slate-300 text-amber-600 focus:ring-amber-500","data-testid":"onboarding-is-primary-checkbox"}),e.jsx(ce,{htmlFor:"isPrimaryModal",className:"text-xs font-medium cursor-pointer",children:"Set as primary account"})]})})]}),e.jsxs(rn,{children:[e.jsx(se,{type:"button",variant:"outline",size:"sm",onClick:s,"data-testid":"onboarding-bank-details-cancel",children:"Cancel"}),e.jsxs(se,{type:"submit",disabled:a,size:"sm",className:"bg-amber-600","data-testid":"onboarding-bank-details-submit",children:[a?e.jsx(ss,{className:"w-4 h-4 animate-spin mr-2"}):null,r?"Update Account":"Save Bank Details"]})]})]})]})}),h1=["Warranty Department","Accessories Department","Sales Department","RTO Department","Service Department","Parts Department","Finance Department","Insurance Department","Inventory Department","Marketing Department","HR Department","IT Department","Legal Department","Quality Department","Logistics Department","Customer Relations Department"],j$="[DEPARTMENT_CLAIM]",N$="[FINANCE_VALIDATED]";function w$({fnfId:t,onBack:s,currentUser:n}){var ke,qe,Ve,dt,xt;const r=qn(),[a,l]=v.useState(null),[c,d]=v.useState(!0),[h,x]=v.useState("details"),[f,m]=v.useState(!1),[p,u]=v.useState(null),[j,g]=v.useState([]),[y,N]=v.useState([]),[S,C]=v.useState(!1),[w,R]=v.useState(null),[P,A]=v.useState(!1),[I,$]=v.useState(!1),[T,E]=v.useState(null),[_,M]=v.useState(!1),[q,G]=v.useState({remarks:"",amount:0,type:"Receivable"}),[Z,W]=v.useState(null);v.useEffect(()=>{V(),K()},[t]);const z=ye=>{if(!ye)return ye;let le=ye.trim();const Qe=h1.find(Rt=>Rt.toLowerCase()===le.toLowerCase());if(Qe)return Qe;const Kt={sales:"Sales Department",service:"Service Department",spares:"Parts Department",parts:"Parts Department","spares / parts":"Parts Department",finance:"Finance Department",accounts:"Finance Department",warranty:"Warranty Department",marketing:"Marketing Department",hr:"HR Department",it:"IT Department",legal:"Legal Department",logistics:"Logistics Department",quality:"Quality Department",fdd:"Finance Department",apparel:"Accessories Department",accessories:"Accessories Department",dms:"IT Department",rto:"Admin Department",admin:"Admin Department","admin / dd-admin":"Admin Department"}[le.toLowerCase().replace(" department","")];return Kt||ye},F=(ye,le)=>le==="DepartmentClaim"||typeof ye=="string"&&(ye.startsWith(j$)||ye.includes("Clearance:")),B=ye=>(ye==null?void 0:ye.sourceType)==="FinanceValidated"&&typeof(ye==null?void 0:ye.description)=="string"&&ye.description.includes("Auto-seeded from department claim"),D=(ye,le)=>le==="FinanceValidated"||typeof ye=="string"&&ye.startsWith(N$),O=ye=>ye?{ADD_LINE_ITEM:"Line Item Added",UPDATE_LINE_ITEM:"Line Item Updated",REMOVE_LINE_ITEM:"Line Item Removed",UPDATE_CLEARANCE:"Clearance Status Updated",SETTLE_CASE:"Settlement Finalized",FNF_UPDATED:"F&F Case Updated"}[ye]||ye.split("_").map(Qe=>Qe.charAt(0).toUpperCase()+Qe.slice(1).toLowerCase()).join(" "):"Action",V=async(ye=!0)=>{var le,Qe,rt,Kt,Rt,Re,Qt,qt,ws,_s,ns,Cs,Bs,Ft,ie,Fe,Q,pe,Ne,Ee,it,st,bt,Ue,Lt,ut,yt,kt,Ie,_t,ht,zt,rs,Yt,Os,Is,zs,en,he,Ge,at,pt,mt,Bt,Ds,as,Vs,Ls,Ts,ln,pn,hn,Ws,Qs,zn,on,Un,yr,Tr,er,tr,En,Xe,$t;try{ye&&d(!0);const Ut=(await Te.getFnFSettlementById(t)).data;if(Ut.success){const jt=Ut.fnf,In=(jt.lineItems||[]).filter(Tt=>Tt.isActive!==!1),Pr=In.some(Tt=>D(Tt.description,Tt.sourceType))?In.filter(Tt=>D(Tt.description,Tt.sourceType)):In.filter(Tt=>!F(Tt.description,Tt.sourceType)),xn={id:jt.id,caseNumber:jt.settlementId||((le=jt.resignation)==null?void 0:le.resignationId)||((Qe=jt.terminationRequest)==null?void 0:Qe.requestId)||jt.id.substring(0,8),status:jt.status,requestType:jt.resignationId?"Resignation":"Termination",dealerName:((Kt=(rt=jt.outlet)==null?void 0:rt.dealer)==null?void 0:Kt.fullName)||((Rt=jt.dealer)==null?void 0:Rt.fullName)||"N/A",dealerCode:((Re=jt.outlet)==null?void 0:Re.code)||((qt=(Qt=jt.dealer)==null?void 0:Qt.dealerCode)==null?void 0:qt.dealerCode)||"N/A",dealershipName:((ws=jt.outlet)==null?void 0:ws.name)||((_s=jt.dealer)==null?void 0:_s.businessName)||"N/A",location:((ns=jt.outlet)==null?void 0:ns.city)||((Cs=jt.outlet)==null?void 0:Cs.location)||"N/A",originalRequestId:((Bs=jt.resignation)==null?void 0:Bs.resignationId)||((Ft=jt.terminationRequest)==null?void 0:Ft.requestId)||((ie=jt.terminationRequest)==null?void 0:ie.id)||"N/A",submittedOn:aa(jt.createdAt),lastOperationalDateSales:(Fe=jt.resignation)!=null&&Fe.lastOperationalDateSales||(Q=jt.terminationRequest)!=null&&Q.proposedLwd?u1(((pe=jt.resignation)==null?void 0:pe.lastOperationalDateSales)||((Ne=jt.terminationRequest)==null?void 0:Ne.proposedLwd)):"N/A",lastOperationalDateServices:(Ee=jt.resignation)!=null&&Ee.lastOperationalDateServices||(it=jt.terminationRequest)!=null&&it.proposedLwd?u1(((st=jt.resignation)==null?void 0:st.lastOperationalDateServices)||((bt=jt.terminationRequest)==null?void 0:bt.proposedLwd)):"N/A",typeOfClosure:jt.resignationId?"Voluntary":"Involuntary",gst:((ut=(Lt=(Ue=jt.outlet)==null?void 0:Ue.dealer)==null?void 0:Lt.dealerProfile)==null?void 0:ut.gstNumber)||((yt=jt.dealer)==null?void 0:yt.gstNumber)||"N/A",pan:((_t=(Ie=(kt=jt.outlet)==null?void 0:kt.dealer)==null?void 0:Ie.dealerProfile)==null?void 0:_t.panNumber)||((ht=jt.dealer)==null?void 0:ht.panNumber)||"N/A",salesCode:((rs=(zt=jt.dealer)==null?void 0:zt.dealerCode)==null?void 0:rs.salesCode)||((zs=(Is=(Os=(Yt=jt.outlet)==null?void 0:Yt.dealer)==null?void 0:Os.dealerProfile)==null?void 0:Is.dealerCode)==null?void 0:zs.salesCode)||"N/A",serviceCode:((he=(en=jt.dealer)==null?void 0:en.dealerCode)==null?void 0:he.serviceCode)||((mt=(pt=(at=(Ge=jt.outlet)==null?void 0:Ge.dealer)==null?void 0:at.dealerProfile)==null?void 0:pt.dealerCode)==null?void 0:mt.serviceCode)||"N/A",gearCode:((Ds=(Bt=jt.dealer)==null?void 0:Bt.dealerCode)==null?void 0:Ds.gearCode)||((Ts=(Ls=(Vs=(as=jt.outlet)==null?void 0:as.dealer)==null?void 0:Vs.dealerProfile)==null?void 0:Ls.dealerCode)==null?void 0:Ts.gearCode)||"N/A",gmaCode:((pn=(ln=jt.dealer)==null?void 0:ln.dealerCode)==null?void 0:pn.gmaCode)||((zn=(Qs=(Ws=(hn=jt.outlet)==null?void 0:hn.dealer)==null?void 0:Ws.dealerProfile)==null?void 0:Qs.dealerCode)==null?void 0:zn.gmaCode)||"N/A",financeReportStatus:jt.status==="Finance Approval"?"In Progress":jt.status==="Completed"?"Completed":"Pending",totalPayableAmount:Pr.filter(Tt=>Tt.itemType==="Payable").reduce((Tt,xs)=>Tt+(parseFloat(xs.amount)||0),0),totalRecoveryAmount:Pr.filter(Tt=>Tt.itemType==="Receivable"||Tt.itemType==="Recovery").reduce((Tt,xs)=>Tt+(parseFloat(xs.amount)||0),0),totalDeductions:Pr.filter(Tt=>Tt.itemType==="Deduction").reduce((Tt,xs)=>Tt+(parseFloat(xs.amount)||0),0),allLineItems:In,netAmount:0,departmentResponses:[]};xn.netAmount=xn.totalPayableAmount-xn.totalRecoveryAmount-xn.totalDeductions,xn.departmentResponses=["Warranty Department","Accessories Department","Sales Department","RTO Department","Service Department","Parts Department","Finance Department","Insurance Department","Inventory Department","Marketing Department","HR Department","IT Department","Legal Department","Quality Department","Logistics Department","Customer Relations Department"].map(Tt=>{const xs=(jt.clearances||[]).find(dn=>z(dn.department)===Tt),Vr=In.filter(dn=>z(dn.department)===Tt&&F(dn.description,dn.sourceType)),ta=In.filter(dn=>z(dn.department)===Tt&&B(dn)),ma=Vr.length>0?Vr:ta;let _r=0,sr=0;ma.forEach(dn=>{const wn=Math.abs(parseFloat(dn.amount)||0);dn.itemType==="Payable"?_r+=wn:sr+=wn});const gn=_r-sr,mn=Math.abs(gn)>0,Qn=(xs==null?void 0:xs.status)||"Pending",fr=mn?"Dues Pending":Qn==="Cleared"?"NOC Submitted":Qn,pr=gn>0?"payable":gn<0?"recovery":null;return{id:(xs==null?void 0:xs.id)||`dept-${Tt}`,clearanceId:(xs==null?void 0:xs.id)||null,departmentName:Tt,status:fr,duesFlow:pr,amountType:gn>0?"Payable to dealer":gn<0?"Receivable from dealer":null,amount:Math.abs(gn),submittedDate:xs!=null&&xs.clearedAt?aa(xs.clearedAt):"-",remarks:(xs==null?void 0:xs.remarks)||"-",supportingDocument:(xs==null?void 0:xs.supportingDocument)||null}});const qs={...xn,documents:[...(((on=jt.resignation)==null?void 0:on.uploadedDocuments)||[]).map(Tt=>({id:`res-${Tt.id}`,name:Tt.fileName,type:"Resignation",uploadDate:aa(Tt.createdAt),status:"Verified",url:Tt.filePath})),...(jt.clearances||[]).filter(Tt=>Tt.supportingDocument).map(Tt=>({id:`clr-${Tt.id}`,name:Tt.supportingDocument.split("/").pop(),type:`${Tt.department} Proof`,uploadDate:aa(Tt.clearedAt),status:"Attached",url:Tt.supportingDocument})),...(jt.settlementDocs||[]).map(Tt=>({id:`set-${Tt.id}`,name:Tt.fileName,type:"Settlement Proof",uploadDate:aa(Tt.createdAt),status:"Finance",url:Tt.filePath}))],participants:jt.participants||[]};l(qs);const ha=jt.bankDetails||((Un=jt.dealer)==null?void 0:Un.bankDetails)||((er=(Tr=(yr=jt.outlet)==null?void 0:yr.dealer)==null?void 0:Tr.dealerProfile)==null?void 0:er.bankDetails);ha&&ha.length>0?N(ha):((En=(tr=jt.outlet)==null?void 0:tr.dealer)!=null&&En.id||jt.dealerId)&&Y((($t=(Xe=jt.outlet)==null?void 0:Xe.dealer)==null?void 0:$t.id)||jt.dealerId)}}catch(Ze){console.error("Fetch F&F details error:",Ze),ee.error("Failed to fetch settlement details")}finally{ye&&d(!1)}},K=async()=>{try{const le=(await Te.getAuditLogs("fnf",t)).data;le.success&&g(le.data||[])}catch(ye){console.error("Fetch audit logs error:",ye)}},Y=async ye=>{try{const Qe=(await Te.getDealerBankDetails(ye)).data;Qe.success&&N(Qe.bankDetails||[])}catch(le){console.error("Fetch bank details error:",le)}},U=async ye=>{var rt,Kt;ye.preventDefault();const le=new FormData(ye.currentTarget),Qe=Object.fromEntries(le.entries());try{A(!0);const Rt=((Kt=(rt=a==null?void 0:a.outlet)==null?void 0:rt.dealer)==null?void 0:Kt.id)||(a==null?void 0:a.dealerId);if(!Rt){ee.error("Dealer information missing");return}(await Te.saveBankDetail(Rt,{...Qe,id:w==null?void 0:w.id,isPrimary:le.get("isPrimary")==="on"})).data.success&&(ee.success("Bank details saved successfully"),Y(Rt),C(!1),R(null))}catch{ee.error("Failed to save bank details")}finally{A(!1)}},X=async ye=>{var le,Qe;if(confirm("Are you sure you want to delete this bank account?"))try{if((await Te.deleteBankDetail(ye)).data.success){ee.success("Bank detail deleted");const Kt=((Qe=(le=a==null?void 0:a.outlet)==null?void 0:le.dealer)==null?void 0:Qe.id)||(a==null?void 0:a.dealerId);Kt&&Y(Kt)}}catch{ee.error("Failed to delete bank detail")}};if(c)return e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-amber-600"})});if(!a)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-slate-600",children:"Case not found"}),e.jsx(se,{onClick:s,className:"mt-4",children:"Go Back"})]});const oe=(ye=>{const le=new Date(ye),rt=Math.abs(new Date().getTime()-le.getTime());return Math.ceil(rt/(1e3*60*60*24))})(a.submittedOn),re=ye=>{if(!a||!ye)return!1;const le=String((n==null?void 0:n.role)||"").toLowerCase();if(!le||ye.status!=="Pending")return!1;const rt=["Finance Approval","Completed"].includes(a.status),Kt=le.includes("super admin")||le.includes("finance")||le.includes("dd admin");if(rt&&!Kt)return!1;if(Kt)return!0;const Rt=ye.departmentName.replace(" Department","").toLowerCase();return le.includes(Rt)},ge=((a==null?void 0:a.departmentResponses)||[]).some(ye=>re(ye)),ve=async()=>{var ye;if(!(T!=null&&T.clearanceId)||!t){ee.error("Clearance record not available for this department");return}try{M(!0);const le=new FormData,Qe=Number(q.amount)>0?"Dues Pending":"NOC Submitted";le.append("status",Qe),le.append("remarks",q.remarks),le.append("amount",String(q.amount)),le.append("type",q.type),Z&&le.append("file",Z);const rt=await Te.updateFnFClearance(t,T.clearanceId,le);if(!rt.ok){ee.error(((ye=rt.data)==null?void 0:ye.message)||"Failed to update department clearance"),M(!1);return}ee.success(`Clearance updated for ${T.departmentName}`),$(!1),W(null),x("departments"),V(!1)}catch(le){console.error("Update clearance error:",le),ee.error("Failed to update department clearance")}finally{M(!1)}},Se=()=>{ee.success("Notifications sent to all 16 departments"),m(!1)},We=ye=>{switch(ye){case"New":return"bg-amber-100 text-blue-700 border-blue-300";case"In Progress":return"bg-yellow-100 text-yellow-700 border-yellow-300";case"Under Review":return"bg-orange-100 text-orange-700 border-orange-300";case"Completed":return"bg-green-100 text-green-700 border-green-300";default:return"bg-slate-100 text-slate-700 border-slate-300"}},Ce=ye=>{switch(ye){case"NOC Submitted":return"bg-green-100 text-green-700 border-green-300";case"Dues Pending":return"bg-red-100 text-red-700 border-red-300";case"Pending":return"bg-slate-100 text-slate-700 border-slate-300";default:return"bg-slate-100 text-slate-700 border-slate-300"}},fe=a.departmentResponses.filter(ye=>ye.status!=="Pending").length,Ye=a.departmentResponses.length,be=fe/Ye*100,_e=h1.map(ye=>{const le=(a.departmentResponses||[]).find(ns=>ns.departmentName===ye),Qe=Number(le==null?void 0:le.amount)||0,rt=(le==null?void 0:le.amountType)||"-",Kt=(a.allLineItems||[]).filter(ns=>z(ns.department)===ye),Rt=Kt.filter(ns=>ns.sourceType==="FinanceValidated"&&ns.itemType==="Payable").reduce((ns,Cs)=>ns+Math.abs(parseFloat(Cs.amount)||0),0),Re=Kt.filter(ns=>ns.sourceType==="FinanceValidated"&&(ns.itemType==="Receivable"||ns.itemType==="Recovery")).reduce((ns,Cs)=>ns+Math.abs(parseFloat(Cs.amount)||0),0),Qt=Kt.filter(ns=>ns.sourceType==="FinanceValidated"&&ns.itemType==="Deduction").reduce((ns,Cs)=>ns+Math.abs(parseFloat(Cs.amount)||0),0),qt=Rt-Re-Qt,ws=Math.abs(qt),_s=qt>0?"Payable":qt<0?"Receivable":"-";return{department:ye,claimAmount:Qe,claimType:rt,validatedAmount:ws,validatedType:_s,variance:ws-Qe}});return e.jsxs("div",{className:"space-y-6",children:[e.jsx(Le,{className:`border-none shadow-md bg-gradient-to-r ${(a.totalRecoveryAmount||0)>(a.totalPayableAmount||0)?"from-red-600 to-red-500":"from-green-600 to-green-500"} text-white`,children:e.jsxs(Me,{className:"p-6 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 bg-white/20 rounded-full",children:e.jsx(F2,{className:"w-6 h-6"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white/80 text-sm font-medium",children:"Net Settlement Balance"}),e.jsxs("h2",{className:"text-3xl font-bold",children:["₹",Math.abs(a.netAmount||0).toLocaleString()]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx(Ae,{className:"bg-white/20 hover:bg-white/30 text-white border-none px-4 py-1 mb-2",children:(a.totalRecoveryAmount||0)>(a.totalPayableAmount||0)?"Receivable from Dealer":"Payable to Dealer"}),e.jsx("p",{className:"text-xs text-white/70",children:a.status==="Completed"?"Settlement Finalized":"Draft Calculation"})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"outline",size:"icon",onClick:s,children:e.jsx($r,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl",children:a.caseNumber}),e.jsx("p",{className:"text-slate-600",children:a.dealerName})]}),e.jsx(Ae,{className:We(a.status),children:a.status}),e.jsx(Ae,{className:a.requestType==="Resignation"?"bg-amber-100 text-amber-700 border-amber-300":"bg-red-100 text-red-700 border-red-300",children:a.requestType})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs(se,{variant:"outline",onClick:()=>r(`/worknotes/fnf/${t}`,{state:{applicationName:a.dealerName||"F&F Settlement",registrationNumber:a.caseNumber||"",participants:a.participants||[]}}),children:[e.jsx(zr,{className:"w-4 h-4 mr-2"}),"View Work Notes"]})})]}),e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Overall Progress"}),e.jsxs(Zt,{children:["Department responses: ",fe," / ",Ye]})]}),e.jsxs(Me,{children:[e.jsx(ji,{value:be,className:"h-3"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-sm",children:"NOC Submitted"}),e.jsx("p",{className:"text-2xl text-green-600",children:a.departmentResponses.filter(ye=>ye.status==="NOC Submitted").length})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-sm",children:"Dues Pending"}),e.jsx("p",{className:"text-2xl text-red-600",children:a.departmentResponses.filter(ye=>ye.status==="Dues Pending").length})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-sm",children:"Pending"}),e.jsx("p",{className:"text-2xl text-slate-600",children:a.departmentResponses.filter(ye=>ye.status==="Pending").length})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-sm",children:"Finance Status"}),e.jsx("p",{className:"text-lg",children:a.financeReportStatus})]})]})]})]}),e.jsxs(Pn,{value:h,onValueChange:x,className:"w-full",children:[e.jsxs(_n,{children:[e.jsx(Wt,{value:"progress",children:"Progress"}),e.jsx(Wt,{value:"details",children:"Case Details"}),e.jsx(Wt,{value:"departments",children:"Department Responses"}),e.jsx(Wt,{value:"financial",children:"Financial Summary"}),e.jsx(Wt,{value:"documents",children:"Documents"}),e.jsx(Wt,{value:"bank",children:"Bank Details"}),e.jsx(Wt,{value:"audit",children:"Audit Trail"})]}),e.jsx(Gt,{value:"progress",children:e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"F&F Settlement Progress"}),e.jsx(Zt,{children:"Track the complete journey from initiation to completion"})]}),e.jsx(Me,{children:e.jsx("div",{className:"relative",children:e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex shrink-0 flex-col items-center",children:[e.jsx("div",{className:"size-12 shrink-0 aspect-square rounded-full bg-green-100 border-2 border-green-600 flex items-center justify-center",children:e.jsx(Bn,{className:"w-6 h-6 text-green-600"})}),e.jsx("div",{className:"w-0.5 h-full bg-green-300 mt-2"})]}),e.jsxs("div",{className:"flex-1 pb-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-slate-900",children:"F&F Initiated"}),e.jsx(Ae,{className:"bg-green-600",children:"Completed"})]}),e.jsx("span",{className:"text-sm text-slate-600",children:a.submittedOn})]}),e.jsx("p",{className:"text-slate-600 text-sm mb-3",children:"Full & Final settlement process has been initiated. Case created and basic information collected."}),e.jsx(Le,{className:"bg-green-50 border-green-200",children:e.jsx(Me,{className:"p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Case Number"}),e.jsx("p",{className:"text-slate-900",children:a.caseNumber})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Request Type"}),e.jsx("p",{className:"text-slate-900",children:a.requestType})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer"}),e.jsx("p",{className:"text-slate-900",children:a.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{className:"text-slate-900",children:a.location})]})]})})})]})]}),e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex shrink-0 flex-col items-center",children:[e.jsx("div",{className:`size-12 shrink-0 aspect-square rounded-full flex items-center justify-center border-2 ${fe===Ye||["Finance Approval","Completed"].includes(a.status)?"bg-green-100 border-green-600":fe>0?"bg-amber-100 border-amber-600":"bg-slate-100 border-slate-300"}`,children:fe===Ye||["Finance Approval","Completed"].includes(a.status)?e.jsx(Bn,{className:"w-6 h-6 text-green-600"}):fe>0?e.jsx(da,{className:"w-6 h-6 text-amber-600"}):e.jsx(Js,{className:"w-6 h-6 text-slate-400"})}),e.jsx("div",{className:`w-0.5 h-full mt-2 ${fe===Ye||["Finance Approval","Completed"].includes(a.status)?"bg-green-300":"bg-slate-200"}`})]}),e.jsxs("div",{className:"flex-1 pb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-slate-900",children:"Department Responses Received"}),e.jsx(Ae,{className:fe===Ye||["Finance Approval","Completed"].includes(a.status)?"bg-green-600":fe>0?"bg-amber-600":"bg-slate-400",children:fe===Ye||["Finance Approval","Completed"].includes(a.status)?"Completed":fe>0?"In Progress":"Pending"})]})}),e.jsxs("p",{className:"text-slate-600 text-sm mb-3",children:["All stakeholder departments submit their NOC or dues information.",fe>0&&` (${fe}/${Ye} responses received)`]}),fe>0&&e.jsx(Le,{className:fe===Ye||["Finance Approval","Completed"].includes(a.status)?"bg-green-50 border-green-200":"bg-blue-50 border-amber-200",children:e.jsx(Me,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-slate-600",children:"Progress"}),e.jsxs("span",{className:"text-sm",children:[fe," / ",Ye," ","departments"]})]}),e.jsx(ji,{value:be,className:"h-2"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[e.jsxs("div",{className:"text-center p-2 bg-green-100 rounded",children:[e.jsx("p",{className:"text-green-700",children:"NOC Submitted"}),e.jsx("p",{className:"text-green-900",children:a.departmentResponses.filter(ye=>ye.status==="NOC Submitted").length})]}),e.jsxs("div",{className:"text-center p-2 bg-red-100 rounded",children:[e.jsx("p",{className:"text-red-700",children:"Dues Pending"}),e.jsx("p",{className:"text-red-900",children:a.departmentResponses.filter(ye=>ye.status==="Dues Pending").length})]}),e.jsxs("div",{className:"text-center p-2 bg-slate-100 rounded",children:[e.jsx("p",{className:"text-slate-700",children:"Pending"}),e.jsx("p",{className:"text-slate-900",children:a.departmentResponses.filter(ye=>ye.status==="Pending").length})]})]})]})})})]})]}),e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex shrink-0 flex-col items-center",children:[e.jsx("div",{className:`size-12 shrink-0 aspect-square rounded-full flex items-center justify-center border-2 ${a.status==="Completed"?"bg-green-100 border-green-600":a.status==="Finance Approval"?"bg-amber-100 border-amber-600":"bg-slate-100 border-slate-300"}`,children:a.status==="Completed"?e.jsx(Bn,{className:"w-6 h-6 text-green-600"}):a.status==="Finance Approval"?e.jsx(_d,{className:"w-6 h-6 text-amber-600"}):e.jsx(Js,{className:"w-6 h-6 text-slate-400"})}),e.jsx("div",{className:`w-0.5 h-full mt-2 ${a.status==="Completed"?"bg-green-300":"bg-slate-200"}`})]}),e.jsxs("div",{className:"flex-1 pb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-slate-900",children:"Finance Final Summary"}),e.jsx(Ae,{className:a.status==="Completed"?"bg-green-600":a.status==="Finance Approval"?"bg-amber-600":"bg-slate-400",children:a.status==="Completed"?"Completed":a.status==="Finance Approval"?"In Progress":"Pending"})]})}),e.jsx("p",{className:"text-slate-600 text-sm mb-3",children:"Finance department consolidates all department responses and prepares final settlement summary with total payable and recovery amounts."}),["Finance Approval","Completed"].includes(a.status)&&e.jsx(Le,{className:a.status==="Completed"?"bg-green-50 border-green-200":"bg-blue-50 border-amber-200",children:e.jsx(Me,{className:"p-4",children:e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"text-center p-3 bg-green-100 rounded-lg",children:[e.jsx("p",{className:"text-xs text-green-700 mb-1",children:"Payable Amount"}),e.jsxs("p",{className:"text-green-900",children:["₹",((ke=a.totalPayableAmount)==null?void 0:ke.toLocaleString())||"0"]})]}),e.jsxs("div",{className:"text-center p-3 bg-red-100 rounded-lg",children:[e.jsx("p",{className:"text-xs text-red-700 mb-1",children:"Receivable amount"}),e.jsxs("p",{className:"text-red-900",children:["₹",((qe=a.totalRecoveryAmount)==null?void 0:qe.toLocaleString())||"0"]})]}),e.jsxs("div",{className:"text-center p-3 bg-amber-100 rounded-lg",children:[e.jsx("p",{className:"text-xs text-blue-700 mb-1",children:"Net Amount"}),e.jsxs("p",{className:(a.totalRecoveryAmount||0)>(a.totalPayableAmount||0)?"text-red-900":"text-green-900",children:["₹",Math.abs((a.totalRecoveryAmount||0)-(a.totalPayableAmount||0)).toLocaleString()]})]})]})})})]})]}),e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex shrink-0 flex-col items-center",children:[e.jsx("div",{className:`size-12 shrink-0 aspect-square rounded-full flex items-center justify-center border-2 ${a.status==="Completed"?"bg-green-100 border-green-600":a.status==="Finance Approval"?"bg-amber-100 border-amber-600":"bg-slate-100 border-slate-300"}`,children:a.status==="Completed"?e.jsx(Bn,{className:"w-6 h-6 text-green-600"}):a.status==="Finance Approval"?e.jsx(zr,{className:"w-6 h-6 text-amber-600"}):e.jsx(Js,{className:"w-6 h-6 text-slate-400"})}),e.jsx("div",{className:`w-0.5 h-full mt-2 ${a.status==="Completed"?"bg-green-300":"bg-slate-200"}`})]}),e.jsxs("div",{className:"flex-1 pb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-slate-900",children:"Financial Discussion with Dealer"}),e.jsx(Ae,{className:a.status==="Completed"?"bg-green-600":a.status==="Finance Approval"?"bg-amber-600":"bg-slate-400",children:a.status==="Completed"?"Completed":a.status==="Finance Approval"?"In Progress":"Pending"})]})}),e.jsx("p",{className:"text-slate-600 text-sm mb-3",children:"Finance team, legal team, and relevant departments discuss final settlement with the dealer. Dealer reviews and agrees to the financial terms."}),a.status==="Finance Approval"&&e.jsx(Le,{className:"bg-orange-50 border-orange-200",children:e.jsx(Me,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ks,{className:"w-5 h-5 text-orange-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-orange-900 mb-1",children:"Ongoing Discussions"}),e.jsx("p",{className:"text-xs text-orange-700",children:"Negotiations in progress regarding recovery/payable amounts. Finance team is working with departments and dealer to resolve discrepancies."})]})]})})})]})]}),e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex shrink-0 flex-col items-center",children:[e.jsx("div",{className:`size-12 shrink-0 aspect-square rounded-full flex items-center justify-center border-2 ${a.status==="Completed"?"bg-green-100 border-green-600":"bg-slate-100 border-slate-300"}`,children:a.status==="Completed"?e.jsx(Bn,{className:"w-6 h-6 text-green-600"}):e.jsx(Js,{className:"w-6 h-6 text-slate-400"})}),e.jsx("div",{className:`w-0.5 h-full mt-2 ${a.status==="Completed"?"bg-green-300":"bg-slate-200"}`})]}),e.jsxs("div",{className:"flex-1 pb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-slate-900",children:"Full and Final Settlement"}),e.jsx(Ae,{className:a.status==="Completed"?"bg-green-600":"bg-slate-400",children:a.status==="Completed"?"Completed":"Pending"})]})}),e.jsx("p",{className:"text-slate-600 text-sm mb-3",children:"All financial settlements are processed. Payments made or recoveries completed as per agreed terms. All documentation finalized."})]})]}),e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsx("div",{className:"flex shrink-0 flex-col items-center",children:e.jsx("div",{className:`size-12 shrink-0 aspect-square rounded-full flex items-center justify-center border-2 ${a.status==="Completed"?"bg-green-100 border-green-600":"bg-slate-100 border-slate-300"}`,children:a.status==="Completed"?e.jsx(Fn,{className:"w-6 h-6 text-green-600"}):e.jsx(Js,{className:"w-6 h-6 text-slate-400"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-slate-900",children:"F&F Complete"}),e.jsx(Ae,{className:a.status==="Completed"?"bg-green-600":"bg-slate-400",children:a.status==="Completed"?"Completed":"Pending"})]}),a.status==="Completed"&&e.jsx("span",{className:"text-sm text-slate-600",children:a.settlementDate||"Oct 15, 2025"})]}),e.jsx("p",{className:"text-slate-600 text-sm mb-3",children:"Full & Final settlement process completed successfully. Case closed. All obligations fulfilled."}),a.status==="Completed"&&e.jsx(Le,{className:"bg-gradient-to-r from-green-50 to-blue-50 border-green-300",children:e.jsx(Me,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-12 shrink-0 aspect-square rounded-full bg-green-600 flex items-center justify-center",children:e.jsx(Fn,{className:"w-7 h-7 text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-green-900",children:"Settlement Successfully Completed"}),e.jsxs("p",{className:"text-xs text-green-700 mt-1",children:["All processes completed. Case Number:"," ",a.caseNumber]})]})]})})})]})]})]})})})]})}),e.jsxs(Gt,{value:"details",className:"space-y-6",children:[e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Basic Information"})}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Case Number"}),e.jsx("p",{children:a.caseNumber})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Code"}),e.jsx("p",{children:a.dealerCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:a.dealerName})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealership Name"}),e.jsx("p",{children:a.dealershipName})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:a.location})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Request Type"}),e.jsx("p",{children:a.requestType})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Original Request ID"}),e.jsx("p",{children:a.originalRequestId})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:a.submittedOn})]})]})})]}),e.jsxs(Le,{className:"border-amber-200 bg-blue-50/30",children:[e.jsx(tt,{children:e.jsx(nt,{className:"text-blue-900",children:"F&F Settlement Information"})}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Last Operational Date (Sales)"}),e.jsx("p",{children:a.lastOperationalDateSales})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Last Operational Date (Services)"}),e.jsx("p",{children:a.lastOperationalDateServices})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Submitted Date (F&F Start)"}),e.jsx("p",{children:a.submittedOn})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Days Elapsed since Submission"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("p",{children:[oe," days"]}),e.jsx(Ae,{variant:"outline",className:oe<30?"bg-green-100 text-green-700 border-green-300":oe<60?"bg-yellow-100 text-yellow-700 border-yellow-300":"bg-red-100 text-red-700 border-red-300",children:oe<30?"Recent":oe<60?"In Progress":"Overdue"})]})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Type of Closure"}),e.jsx("p",{children:a.typeOfClosure})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GST"}),e.jsx("p",{children:a.gst})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Sales Code"}),e.jsx("p",{children:a.salesCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Service Code"}),e.jsx("p",{children:a.serviceCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Gear Code"}),e.jsx("p",{children:a.gearCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GMA Code"}),e.jsx("p",{children:a.gmaCode})]})]})})]}),a.status==="Under Review"&&e.jsxs(Le,{className:"border-orange-200 bg-orange-50",children:[e.jsxs(tt,{children:[e.jsx(nt,{className:"text-orange-900",children:"Under Review"}),e.jsx(Zt,{className:"text-orange-700",children:"This case is under negotiation/discussion with the dealer, finance team, legal team, and relevant departments"})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-sm text-orange-800",children:"Discussions ongoing regarding recovery/payable amounts. Finance team is working with departments to resolve discrepancies."})})]})]}),e.jsx(Gt,{value:"departments",children:e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsxs(nt,{children:["Department Responses (",fe," / ",Ye,")"]}),e.jsx(Zt,{children:"Status of NOC and dues from all departments"})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Amount Type"}),e.jsx(me,{children:"Amount"}),e.jsx(me,{children:"Submitted Date"}),e.jsx(me,{children:"Remarks"}),ge&&e.jsx(me,{children:"Actions"})]})}),e.jsx(Es,{children:a.departmentResponses.map(ye=>e.jsxs(ct,{children:[e.jsx(de,{children:ye.departmentName}),e.jsx(de,{children:e.jsx(Ae,{className:Ce(ye.status),children:ye.status})}),e.jsx(de,{children:ye.amountType?e.jsx(Ae,{variant:"outline",className:ye.duesFlow==="recovery"?"bg-red-100 text-red-900 border-red-400 font-semibold":"bg-emerald-100 text-emerald-900 border-emerald-400 font-semibold",children:ye.amountType}):"-"}),e.jsx(de,{children:ye.amount?e.jsxs("span",{className:`font-semibold tabular-nums ${ye.duesFlow==="recovery"?"text-red-700":"text-emerald-700"}`,children:["₹",ye.amount.toLocaleString()]}):"-"}),e.jsx(de,{children:ye.submittedDate||"-"}),e.jsx(de,{className:"max-w-xs truncate",children:ye.remarks||"-"}),ge&&e.jsx(de,{children:re(ye)?e.jsx(se,{variant:"ghost",size:"sm",className:"text-amber-600 hover:text-blue-700",onClick:()=>{E(ye),G({remarks:ye.remarks==="-"?"":ye.remarks,amount:ye.amount||0,type:ye.duesFlow==="payable"?"Payable":"Receivable"}),W(null),$(!0)},children:"Action"}):e.jsx("span",{className:"text-slate-400 text-sm",children:"-"})})]},ye.id))})]})})]})}),e.jsx(Gt,{value:"financial",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs(Le,{className:"border-blue-200 bg-blue-50",children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Department Claim vs Finance Validation"}),e.jsx(Zt,{children:"Final settlement totals are based on finance validated values."})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Department Claim"}),e.jsx(me,{children:"Finance Validated"}),e.jsx(me,{children:"Variance"})]})}),e.jsx(Es,{children:_e.map(ye=>e.jsxs(ct,{children:[e.jsx(de,{children:ye.department}),e.jsx(de,{children:ye.claimAmount>0?`${ye.claimType} ₹${ye.claimAmount.toLocaleString()}`:"-"}),e.jsx(de,{children:ye.validatedAmount>0?`${ye.validatedType} ₹${ye.validatedAmount.toLocaleString()}`:"-"}),e.jsx(de,{className:ye.variance===0?"text-slate-600":ye.variance>0?"text-red-600":"text-green-600",children:ye.claimAmount===0&&ye.validatedAmount===0?"-":`₹${ye.variance.toLocaleString()}`})]},ye.department))})]})})]}),e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Financial Summary"}),e.jsx(Zt,{children:"Consolidated view of all payable and receivable amounts"})]}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"p-6 bg-green-50 rounded-lg border border-green-200",children:[e.jsx("p",{className:"text-sm text-green-700 mb-2",children:"Total Payable Amount"}),e.jsxs("p",{className:"text-3xl text-green-600",children:["₹",((Ve=a.totalPayableAmount)==null?void 0:Ve.toLocaleString())||"0"]}),e.jsx("p",{className:"text-xs text-green-600 mt-1",children:"Amount to be paid to dealer"})]}),e.jsxs("div",{className:"p-6 bg-red-50 rounded-lg border border-red-200",children:[e.jsx("p",{className:"text-sm text-red-700 mb-2",children:"Total receivable amount"}),e.jsxs("p",{className:"text-3xl text-red-600",children:["₹",((dt=a.totalRecoveryAmount)==null?void 0:dt.toLocaleString())||"0"]}),e.jsx("p",{className:"text-xs text-red-600 mt-1",children:"Amount receivable from dealer"})]}),e.jsxs("div",{className:"p-6 bg-amber-50 rounded-lg border border-amber-200",children:[e.jsx("p",{className:"text-sm text-amber-700 mb-2",children:"Total Deductions"}),e.jsxs("p",{className:"text-3xl text-amber-600 font-bold",children:["₹",((xt=a.totalDeductions)==null?void 0:xt.toLocaleString())||"0"]}),e.jsx("p",{className:"text-xs text-amber-600 mt-1",children:"Warranty holdbacks / Policy penalties"})]}),e.jsxs("div",{className:"p-6 bg-blue-50 rounded-lg border border-blue-200",children:[e.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"Net Settlement Amount"}),e.jsxs("p",{className:`text-3xl font-extrabold ${(a.netAmount||0)<0?"text-red-600":"text-green-600"}`,children:["₹",Math.abs(a.netAmount||0).toLocaleString()]}),e.jsx("p",{className:"text-xs text-blue-600 mt-1",children:(a.netAmount||0)<0?"Receivable from dealer":"Payment to dealer"})]})]})})]}),e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Finance Report Status"})}),e.jsxs(Me,{children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Ae,{className:a.financeReportStatus==="Completed"?"bg-green-100 text-green-700 border-green-300":a.financeReportStatus==="In Progress"?"bg-yellow-100 text-yellow-700 border-yellow-300":"bg-slate-100 text-slate-700 border-slate-300",children:a.financeReportStatus}),a.financeReportStatus==="Pending"&&e.jsx("p",{className:"text-slate-600 text-sm",children:"Waiting for all department responses before finance can prepare final report"}),a.financeReportStatus==="In Progress"&&e.jsx("p",{className:"text-slate-600 text-sm",children:"Finance team is reviewing department responses and preparing final settlement report"})]}),a.financeRemarks&&e.jsxs("div",{className:"mt-4 p-4 bg-slate-50 rounded-lg",children:[e.jsx(ce,{className:"text-slate-600",children:"Finance Remarks"}),e.jsx("p",{className:"mt-1",children:a.financeRemarks})]})]})]})]})}),e.jsx(Gt,{value:"documents",children:e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Documents"}),e.jsx(Zt,{children:"All NOC documents and due statements from departments"})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Document Name"}),e.jsx(me,{children:"Type"}),e.jsx(me,{children:"Upload Date"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Actions"})]})}),e.jsx(Es,{children:a.documents.map(ye=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-4 h-4 text-slate-500"}),e.jsx("span",{children:ye.name})]})}),e.jsx(de,{children:ye.type}),e.jsx(de,{children:ye.uploadDate}),e.jsx(de,{children:e.jsx(Ae,{variant:ye.status==="Verified"?"default":"secondary",children:ye.status})}),e.jsx(de,{children:e.jsx(se,{size:"sm",variant:"outline",onClick:()=>{const le=ye.url,Qe=le.startsWith("/uploads/")&&!le.startsWith("/uploads/documents/")?le.replace("/uploads/","/uploads/documents/"):le;u({fileName:ye.name,filePath:Qe,documentType:ye.type})},children:"View"})})]},ye.id))})]})})]})}),e.jsx(Gt,{value:"bank",children:e.jsxs(Le,{children:[e.jsxs(tt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Bank Details"}),e.jsx(Zt,{children:"Dealer bank accounts for settlement disbursement"})]}),e.jsxs(se,{onClick:()=>{R(null),C(!0)},className:"bg-amber-600",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add Account"]})]}),e.jsx(Me,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:y.length>0?y.map(ye=>e.jsxs(Le,{className:`relative overflow-hidden ${ye.isPrimary?"border-amber-500 bg-blue-50/30":""}`,children:[ye.isPrimary&&e.jsx("div",{className:"absolute top-0 right-0 p-1 bg-amber-600 text-white text-[10px] uppercase font-bold px-2 rounded-bl",children:"Primary"}),e.jsxs(Me,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"p-2 bg-amber-100 rounded-lg",children:e.jsx(Ml,{className:"w-5 h-5 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-slate-900",children:ye.bankName}),e.jsx("p",{className:"text-xs text-slate-500",children:ye.branchName})]})]}),e.jsxs("div",{className:"space-y-3 mb-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Account Holder"}),e.jsx("p",{className:"text-sm font-medium",children:ye.accountHolderName})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Account Number"}),e.jsx("p",{className:"text-sm font-mono tracking-wider",children:ye.accountNumber.replace(/.(?=.{4})/g,"*")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"IFSC"}),e.jsx("p",{className:"text-sm font-mono",children:ye.ifscCode})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-slate-100",children:[e.jsxs(se,{variant:"ghost",size:"sm",className:"h-8 text-amber-600",onClick:()=>{R(ye),C(!0)},children:[e.jsx(nv,{className:"w-3 h-3 mr-1"}),"Edit"]}),e.jsxs(se,{variant:"ghost",size:"sm",className:"h-8 text-red-600",onClick:()=>X(ye.id),children:[e.jsx(Gn,{className:"w-3 h-3 mr-1"}),"Delete"]})]})]})]},ye.id)):e.jsxs("div",{className:"col-span-full py-12 text-center border-2 border-dashed rounded-lg bg-slate-50",children:[e.jsx(Ml,{className:"w-12 h-12 text-slate-300 mx-auto mb-3"}),e.jsx("p",{className:"text-slate-600",children:"No bank details found"}),e.jsx(se,{variant:"link",onClick:()=>C(!0),children:"Add first bank account"})]})})})]})}),e.jsx(Gt,{value:"audit",children:e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Audit Trail"}),e.jsx(Zt,{children:"Complete history of actions on this F&F case"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:j.length>0?j.map(ye=>{var le,Qe,rt,Kt,Rt,Re;return e.jsxs("div",{className:"flex gap-3 pb-4 border-b border-slate-100 last:border-0",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-slate-400 mt-2"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("p",{className:"font-semibold text-slate-900 flex items-center gap-2",children:[ye.action==="FNF_CREATED"&&e.jsx(Ae,{className:"bg-amber-600 h-2 w-2 p-0 rounded-full"}),ye.description&&!((le=ye.newData)!=null&&le.action)?ye.description:e.jsxs(e.Fragment,{children:[O(((Qe=ye.newData)==null?void 0:Qe.action)||ye.action),((rt=ye.newData)==null?void 0:rt.department)&&e.jsxs("span",{className:"text-amber-600 ml-1 font-bold",children:["- ",ye.newData.department]})]})]}),e.jsx("span",{className:"text-xs text-slate-500",children:aa(ye.createdAt||ye.timestamp)})]}),e.jsx("div",{className:"flex items-center gap-2 text-sm text-slate-600 mb-2",children:e.jsx(Ae,{variant:"outline",className:"text-[10px] uppercase",children:((Kt=ye.actor)==null?void 0:Kt.name)||ye.userName||"System"})}),(((Rt=ye.newData)==null?void 0:Rt.remarks)||ye.remarks)&&e.jsx("div",{className:"mt-2 p-3 bg-slate-50 border border-slate-200 rounded text-sm text-slate-700",children:((Re=ye.newData)==null?void 0:Re.remarks)||ye.remarks}),ye.newData&&Object.keys(ye.newData).filter(Qt=>Qt!=="remarks"&&Qt!=="status"&&Qt!=="action"&&Qt!=="department").length>0&&e.jsxs("div",{className:"mt-2 space-y-1",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold px-1",children:"Changes:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(ye.newData).filter(([Qt])=>Qt!=="remarks"&&Qt!=="action"&&Qt!=="department").map(([Qt,qt])=>e.jsxs("div",{className:"text-[11px] bg-slate-100 border rounded px-2 py-0.5 flex items-center gap-1",children:[e.jsxs("span",{className:"text-slate-500",children:[Qt,":"]}),e.jsx("span",{className:"text-slate-900 font-medium",children:String(qt)})]},Qt))})]})]})]},ye.id)}):e.jsx("div",{className:"text-center py-8 text-slate-500",children:e.jsx("p",{children:"No activity logs found for this case."})})})})]})})]}),e.jsx(os,{open:f,onOpenChange:m,children:e.jsxs(ls,{children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Send to All Stakeholders"}),e.jsx(vs,{children:"This will send notifications to all 16 departments to submit their NOC or dues information"})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"p-4 bg-blue-50 rounded-lg border border-amber-200",children:[e.jsx("p",{className:"text-sm text-blue-900 mb-2",children:"Notifications will be sent to:"}),e.jsxs("ul",{className:"text-sm text-blue-800 space-y-1 ml-4",children:[e.jsx("li",{children:"• All 16 departments"}),e.jsxs("li",{children:["• Case Number: ",a.caseNumber]}),e.jsxs("li",{children:["• Dealer: ",a.dealerName]}),e.jsxs("li",{children:["• Type: ",a.requestType]})]})]})}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>m(!1),children:"Cancel"}),e.jsxs(se,{onClick:Se,className:"bg-amber-600 hover:bg-blue-700",children:[e.jsx(fu,{className:"w-4 h-4 mr-2"}),"Send Notifications"]})]})]})}),e.jsx(os,{open:I,onOpenChange:$,children:e.jsxs(ls,{className:"sm:max-w-[460px]",children:[e.jsxs(ms,{children:[e.jsxs(us,{children:["Update ",T==null?void 0:T.departmentName," Response"]}),e.jsx(vs,{children:"Provide dues/NOC response with remarks and optional supporting proof."})]}),e.jsxs("div",{className:"grid gap-4 py-2",children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"type",className:"text-right",children:"Type"}),e.jsxs("select",{id:"type",className:"col-span-3 flex h-10 w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm",value:q.type,onChange:ye=>G({...q,type:ye.target.value}),children:[e.jsx("option",{value:"Receivable",children:"Receivable (from dealer)"}),e.jsx("option",{value:"Payable",children:"Payable (to dealer)"}),e.jsx("option",{value:"Deduction",children:"Deduction"})]})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"amount",className:"text-right",children:"Amount"}),e.jsxs("div",{className:"col-span-3 relative",children:[e.jsx("span",{className:"absolute left-3 top-2.5 text-slate-500 font-medium",children:"₹"}),e.jsx("input",{id:"amount",type:"number",className:"flex h-10 w-full rounded-md border border-slate-200 bg-white pl-7 pr-3 py-2 text-sm",value:q.amount,onChange:ye=>G({...q,amount:Number(ye.target.value)})})]})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"remarks",className:"text-right",children:"Remarks"}),e.jsx("textarea",{id:"remarks",className:"col-span-3 flex min-h-[80px] w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm",placeholder:"Add response details...",value:q.remarks,onChange:ye=>G({...q,remarks:ye.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"proof",className:"text-right",children:"Proof"}),e.jsx("input",{id:"proof",type:"file",className:"col-span-3 text-sm",onChange:ye=>{var le;return W(((le=ye.target.files)==null?void 0:le[0])||null)}})]})]}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>$(!1),children:"Cancel"}),e.jsx(se,{className:"bg-amber-600 hover:bg-blue-700",onClick:ve,disabled:_,children:_?"Saving...":"Submit Response"})]})]})}),e.jsx(fE,{isOpen:S,onClose:()=>{C(!1),R(null)},onSubmit:U,editingBank:w,isSubmitting:P}),e.jsx(Kl,{isOpen:!!p,onClose:()=>u(null),document:p})]})}function S$({onViewPaymentDetails:t}={}){const[s,n]=v.useState([]),[r,a]=v.useState(!0),[l,c]=v.useState("pending");v.useEffect(()=>{d()},[]);const d=async()=>{try{a(!0);const u=await ds.getApplications();n(u.data||[])}catch(u){console.error("Fetch error:",u),ee.error("Failed to fetch applications")}finally{a(!1)}},h=u=>String(u||"").trim().toLowerCase(),x=u=>{const j=h(u);return j==="verified"||j==="paid"},f=s.flatMap(u=>{const j=u.overallStatus||u.status,g=["Payment Pending","Security Details","LOI In Progress","LOI Issued","LOA Pending","Dealer Code Generation","LOA_APPROVAL"].includes(j),y=u.securityDeposits||[];return y.length>0?y.map(N=>({id:N.id,applicationId:u.applicationId||u.id,application:u,paymentStatus:N.status,paymentType:N.depositType,amount:N.amount,createdAt:N.createdAt,verificationDate:N.verifiedAt,isVirtual:!1})):g?["Payment Pending","Security Details","LOI In Progress"].includes(j)?[{id:`virtual-${u.id}-sd`,applicationId:u.applicationId||u.id,application:u,paymentStatus:"Pending",paymentType:"SECURITY_DEPOSIT",amount:5e5,createdAt:u.updatedAt,verificationDate:null,isVirtual:!0}]:[{id:`virtual-${u.id}-ff`,applicationId:u.applicationId||u.id,application:u,paymentStatus:"Pending",paymentType:"FIRST_FILL",amount:15e5,createdAt:u.updatedAt,verificationDate:null,isVirtual:!0}]:[]}),m=f.filter(u=>l==="all"?!0:l==="pending"?!x(u.paymentStatus):l==="verified"?x(u.paymentStatus):!0),p=u=>{t&&t(u)};return r?e.jsxs("div",{className:"flex items-center justify-center p-20 text-blue-600",children:[e.jsx(Js,{className:"w-8 h-8 animate-spin mr-3"}),e.jsx("span",{children:"Loading Finance Queue..."})]}):e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between bg-white p-6 rounded-2xl border border-slate-100 shadow-sm",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-slate-900 tracking-tight mb-1",children:"Payment Verification"}),e.jsx("p",{className:"text-slate-500",children:"Review and verify dealer security deposits and first fill payments"})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs(se,{onClick:d,variant:"outline",size:"sm",className:"bg-white hover:bg-slate-50","data-testid":"onboarding-finance-queue-sync-btn",children:[e.jsx(Js,{className:"w-4 h-4 mr-2"}),"Sync Dashboard"]})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[e.jsx("div",{className:"inline-flex p-1 bg-slate-100 rounded-xl",children:e.jsxs("div",{className:"flex items-center px-4 py-2 bg-white rounded-lg text-slate-900 shadow-sm font-medium text-sm","data-testid":"onboarding-finance-queue-pending-count",children:[e.jsx(oa,{className:"w-4 h-4 mr-2 text-blue-600"}),"Pending Payments (",f.filter(u=>!x(u.paymentStatus)).length,")"]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(se,{variant:l==="pending"?"secondary":"ghost",size:"sm",onClick:()=>c("pending"),className:l==="pending"?"bg-slate-200 text-slate-900":"text-slate-500","data-testid":"onboarding-finance-queue-filter-pending",children:"Pending"}),e.jsx(se,{variant:l==="verified"?"secondary":"ghost",size:"sm",onClick:()=>c("verified"),className:l==="verified"?"bg-slate-200 text-slate-900":"text-slate-500","data-testid":"onboarding-finance-queue-filter-verified",children:"Verified"}),e.jsx(se,{variant:l==="all"?"secondary":"ghost",size:"sm",onClick:()=>c("all"),className:l==="all"?"bg-slate-200 text-slate-900":"text-slate-500","data-testid":"onboarding-finance-queue-filter-all",children:"All"})]})]}),e.jsx(Le,{className:"border-none shadow-xl overflow-hidden rounded-2xl bg-white","data-testid":"onboarding-finance-queue-table-card",children:e.jsx(Me,{className:"p-0",children:e.jsxs(ks,{children:[e.jsx(Rs,{className:"bg-slate-50/50",children:e.jsxs(ct,{className:"border-b border-slate-100 uppercase text-[10px] tracking-wider font-bold text-slate-400",children:[e.jsx(me,{className:"py-4 pl-6","data-testid":"onboarding-finance-queue-th-details",children:"Application Details"}),e.jsx(me,{"data-testid":"onboarding-finance-queue-th-location",children:"Location"}),e.jsx(me,{"data-testid":"onboarding-finance-queue-th-stage",children:"Payment Stage"}),e.jsx(me,{"data-testid":"onboarding-finance-queue-th-status",children:"Current Status"}),e.jsx(me,{className:"text-right pr-6","data-testid":"onboarding-finance-queue-th-action",children:"Workflow Action"})]})}),e.jsx(Es,{children:m.length>0?m.map((u,j)=>{const g=u.paymentStatus||"Awaiting Payment",y=u.application||{};return e.jsxs(ct,{className:"hover:bg-blue-50/20 group transition-all","data-testid":`onboarding-finance-queue-row-${j}`,children:[e.jsx(de,{className:"py-4 pl-6",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-mono text-xs font-bold text-blue-600 mb-1","data-testid":`onboarding-finance-queue-app-id-${j}`,children:y.applicationId||y.id}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-semibold text-slate-900","data-testid":`onboarding-finance-queue-name-${j}`,children:y.applicantName})})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex flex-col text-sm","data-testid":`onboarding-finance-queue-location-${j}`,children:[e.jsx("span",{className:"text-slate-600 leading-none",children:y.city}),e.jsx("span",{className:"text-slate-400 text-xs mt-1",children:y.state})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2","data-testid":`onboarding-finance-queue-type-${j}`,children:[e.jsx(mu,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"text-sm font-medium",children:u.paymentType==="SECURITY_DEPOSIT"?"Security Deposit (₹5L)":"First Fill (₹15L)"})]})}),e.jsx(de,{children:e.jsx(Ae,{className:g==="Verified"?"bg-emerald-50 text-emerald-700 border-emerald-100 px-3 py-1 rounded-full":g==="Rejected"?"bg-rose-50 text-rose-700 border-rose-100 px-3 py-1 rounded-full":"bg-amber-50 text-amber-700 border-amber-100 px-3 py-1 rounded-full",variant:"outline","data-testid":`onboarding-finance-queue-status-${j}`,children:g})}),e.jsx(de,{className:"text-right pr-6",children:e.jsx(se,{size:"sm",variant:x(g)?"outline":"default",className:x(g)?"bg-white text-slate-600 border-slate-200":"bg-blue-600 hover:bg-blue-700 shadow-md",onClick:()=>p(u.applicationId||y.id),"data-testid":`onboarding-finance-queue-action-btn-${j}`,children:e.jsxs(e.Fragment,{children:[e.jsx(oa,{className:"w-4 h-4 mr-2"}),x(g)?"View Receipt":"Record Payment"]})})})]},u.id)}):e.jsx(ct,{children:e.jsx(de,{colSpan:5,className:"h-48 text-center text-slate-400 py-10","data-testid":"onboarding-finance-queue-empty",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 bg-slate-50 rounded-full flex items-center justify-center",children:e.jsx(Ys,{className:"w-6 h-6 text-slate-200"})}),e.jsx("p",{className:"text-sm",children:l==="verified"?"No verified payments found":l==="pending"?"No pending payments in the queue":"No onboarding payments found"})]})})})})]})})})]})}function C$({onViewFnFDetails:t}={}){const[s,n]=v.useState([]),[r,a]=v.useState(!0),[l,c]=v.useState(null),[d,h]=v.useState(!1),[x,f]=v.useState(!1),[m,p]=v.useState(""),[u,j]=v.useState(""),[g,y]=v.useState("all");v.useEffect(()=>{N()},[]);const N=async()=>{try{a(!0);const _=(await Te.getFnFSettlements()).data;_.success&&n(_.settlements||[])}catch(E){console.error("Fetch settlements error:",E),ee.error("Failed to fetch settlement cases")}finally{a(!1)}},S=E=>{var _,M,q,G,Z,W,z,F,B,D,O,V;return{id:E.id,caseId:E.settlementId||((_=E.resignation)==null?void 0:_.resignationId)||((M=E.terminationRequest)==null?void 0:M.requestId)||E.id.substring(0,8),dealerCode:((q=E.outlet)==null?void 0:q.code)||((Z=(G=E.dealer)==null?void 0:G.dealerCode)==null?void 0:Z.dealerCode)||"N/A",dealerName:((z=(W=E.outlet)==null?void 0:W.dealer)==null?void 0:z.fullName)||((F=E.dealer)==null?void 0:F.legalName)||((B=E.dealer)==null?void 0:B.businessName)||((D=E.dealer)==null?void 0:D.fullName)||"N/A",location:((O=E.outlet)==null?void 0:O.city)||((V=E.outlet)==null?void 0:V.location)||"N/A",terminationType:E.resignationId?"Resignation":"Termination",submittedDate:Ht(E.createdAt),status:E.status==="Calculated"?"Pending Finance Review":E.status==="Settled"?"Settled":E.status,financialData:{totalPayables:parseFloat(E.totalPayables)||0,totalReceivables:parseFloat(E.totalReceivables)||0,netAmount:parseFloat(E.netAmount)||0},settlementAmount:Math.abs(parseFloat(E.netAmount)||0),settlementType:parseFloat(E.netAmount)>0?"Payable to Dealer":"Receivable from Dealer",approvedDate:E.settlementDate?Ht(E.settlementDate):null}},C=s.map(S),w=C.filter(E=>g==="all"?!0:g==="pending"?E.status==="Pending Finance Review"||E.status==="Calculated"||E.status==="Initiated"||E.status==="Under Review":g==="approved"?E.status==="Settled"||E.status==="Completed":!0),R=E=>({receivables:E.totalReceivables||0,payables:E.totalPayables||0,deductions:0,netSettlement:E.netAmount||0,settlementType:(E.netAmount||0)>0?"Payable to Dealer":"Receivable from Dealer",settlementAmount:Math.abs(E.netAmount||0)}),P=E=>{t?t(E.id):(c(E),h(!0))},A=E=>{t?t(E.id):(c(E),f(!0))},I=()=>{const E=R(l.financialData);ee.success(`Settlement approved: ${E.settlementType} - ₹${E.settlementAmount.toLocaleString()}`),h(!1),p(""),j(""),c(null)},$=C.filter(E=>E.status==="Pending Finance Review"||E.status==="Calculated"||E.status==="Initiated"||E.status==="Under Review").length,T=C.filter(E=>E.status==="Settled"||E.status==="Completed").length;return r?e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-amber-600"})}):e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900 mb-2",children:"F&F Financial Settlement"}),e.jsx("p",{className:"text-slate-600",children:"Review and process full & final settlements for dealerships"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs(Le,{children:[e.jsx(tt,{className:"pb-3",children:e.jsx(nt,{className:"text-sm text-slate-600",children:"Pending Review"})}),e.jsx(Me,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-slate-900 text-2xl",children:$}),e.jsx(O2,{className:"w-8 h-8 text-amber-600"})]})})]}),e.jsxs(Le,{children:[e.jsx(tt,{className:"pb-3",children:e.jsx(nt,{className:"text-sm text-slate-600",children:"Approved Settlements"})}),e.jsx(Me,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-slate-900 text-2xl",children:T}),e.jsx(Ys,{className:"w-8 h-8 text-green-600"})]})})]}),e.jsxs(Le,{children:[e.jsx(tt,{className:"pb-3",children:e.jsx(nt,{className:"text-sm text-slate-600",children:"Total Cases"})}),e.jsx(Me,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-slate-900 text-2xl",children:C.length}),e.jsx(fs,{className:"w-8 h-8 text-blue-600"})]})})]}),e.jsxs(Le,{children:[e.jsx(tt,{className:"pb-3",children:e.jsx(nt,{className:"text-sm text-slate-600",children:"Net Financial Position"})}),e.jsxs(Me,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:`text-2xl ${C.reduce((E,_)=>E+(_.financialData.netAmount||0),0)<0?"text-green-600":"text-red-600"}`,children:["₹",Math.abs(C.reduce((E,_)=>E+(_.financialData.netAmount||0),0)).toLocaleString("en-IN")]}),e.jsx(Wi,{className:"w-8 h-8 text-purple-600"})]}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1",children:C.reduce((E,_)=>E+(_.financialData.netAmount||0),0)<0?"Net Receivable":"Net Payable"})]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(se,{variant:g==="all"?"default":"outline",onClick:()=>y("all"),className:g==="all"?"bg-amber-600 hover:bg-amber-700":"",children:["All Cases (",C.length,")"]}),e.jsxs(se,{variant:g==="pending"?"default":"outline",onClick:()=>y("pending"),className:g==="pending"?"bg-amber-600 hover:bg-amber-700":"",children:["Pending Review (",$,")"]}),e.jsxs(se,{variant:g==="approved"?"default":"outline",onClick:()=>y("approved"),className:g==="approved"?"bg-amber-600 hover:bg-amber-700":"",children:["Approved (",T,")"]})]}),e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"F&F Settlement Queue"}),e.jsx(Zt,{children:"Review financial status and calculate settlements"})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Case ID"}),e.jsx(me,{children:"Dealer Details"}),e.jsx(me,{children:"Location"}),e.jsx(me,{children:"Type"}),e.jsx(me,{children:"Submitted Date"}),e.jsx(me,{children:"Net Settlement"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Actions"})]})}),e.jsx(Es,{children:w.map(E=>{const _=R(E.financialData);return e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{children:[e.jsx("div",{className:"text-slate-900",children:E.caseId}),e.jsx("div",{className:"text-sm text-slate-500",children:E.dealerCode})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(kr,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"text-slate-900",children:E.dealerName})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Er,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"text-slate-900",children:E.location})]})}),e.jsx(de,{children:e.jsx(Ae,{variant:E.terminationType==="Resignation"?"default":"secondary",children:E.terminationType})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($n,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"text-slate-900",children:E.submittedDate})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[_.settlementType==="Payable to Dealer"?e.jsx(Po,{className:"w-4 h-4 text-red-600"}):e.jsx(Wi,{className:"w-4 h-4 text-green-600"}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-slate-900",children:["₹",_.settlementAmount.toLocaleString()]}),e.jsx("div",{className:"text-xs text-slate-500",children:_.settlementType})]})]})}),e.jsx(de,{children:e.jsx(Ae,{variant:E.status==="Settlement Approved"?"default":"secondary",className:E.status==="Settlement Approved"?"bg-green-600 text-white":"bg-amber-600 text-white",children:E.status})}),e.jsx(de,{children:e.jsxs(se,{size:"sm",variant:E.status==="Pending Finance Review"?"default":"outline",className:E.status==="Pending Finance Review"?"bg-amber-600 hover:bg-amber-700":"",onClick:()=>A(E),children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"View Details"]})})]},E.id)})})]})})]}),e.jsx(os,{open:d,onOpenChange:h,children:e.jsxs(ls,{className:"max-w-5xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Financial Settlement Review"}),e.jsxs(vs,{children:["Review financial details and calculate final settlement for ",l==null?void 0:l.dealerName]})]}),l&&e.jsxs(Pn,{defaultValue:"breakdown",className:"w-full",children:[e.jsxs(_n,{className:"grid w-full grid-cols-3",children:[e.jsx(Wt,{value:"breakdown",children:"Financial Breakdown"}),e.jsx(Wt,{value:"calculation",children:"Settlement Calculation"}),e.jsx(Wt,{value:"summary",children:"Final Summary"})]}),e.jsxs(Gt,{value:"breakdown",className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(Le,{className:"border-green-200 bg-green-50",children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(bm,{className:"w-5 h-5 text-green-600"}),"Payables to Dealer"]}),e.jsx(Zt,{children:"Amounts company owes to dealer"})]}),e.jsxs(Me,{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Security Deposit"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.securityDeposit.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Inventory Value"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.inventoryValue.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Equipment Value"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.equipmentValue.toLocaleString()]})]}),e.jsx("div",{className:"pt-3 border-t border-green-300",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-900",children:"Total Payables"}),e.jsxs("span",{className:"text-slate-900 text-lg",children:["₹",(l.financialData.securityDeposit+l.financialData.inventoryValue+l.financialData.equipmentValue).toLocaleString()]})]})})]})]}),e.jsxs(Le,{className:"border-red-200 bg-red-50",children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(rv,{className:"w-5 h-5 text-red-600"}),"Receivables from Dealer"]}),e.jsx(Zt,{children:"Amounts dealer owes to company"})]}),e.jsxs(Me,{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Outstanding Invoices"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.outstandingInvoices.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Service Dues"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.serviceDues.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Parts Dues"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.partsDues.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Advances Given"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.advancesGiven.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Penalties"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.penalties.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Other Charges"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.otherCharges.toLocaleString()]})]}),e.jsx("div",{className:"pt-3 border-t border-red-300",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-900",children:"Total Receivables"}),e.jsxs("span",{className:"text-slate-900 text-lg",children:["₹",R(l.financialData).receivables.toLocaleString()]})]})})]})]})]}),e.jsxs(Le,{className:"border-amber-200 bg-amber-50",children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(Ks,{className:"w-5 h-5 text-amber-600"}),"Deductions"]}),e.jsx(Zt,{children:"Pending claims and deductions"})]}),e.jsx(Me,{children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Warranty Claims Pending"}),e.jsxs("span",{className:"text-slate-900 text-lg",children:["₹",l.financialData.warrantyPending.toLocaleString()]})]})})]})]}),e.jsx(Gt,{value:"calculation",className:"space-y-4",children:e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Settlement Calculation"}),e.jsx(Zt,{children:"Step-by-step calculation of final settlement amount"})]}),e.jsx(Me,{className:"space-y-4",children:(()=>{const E=R(l.financialData);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center p-3 bg-green-50 rounded",children:[e.jsx("span",{className:"text-slate-900",children:"Total Payables (to Dealer)"}),e.jsxs("span",{className:"text-green-600 text-lg",children:["+ ₹",E.payables.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-red-50 rounded",children:[e.jsx("span",{className:"text-slate-900",children:"Total Receivables (from Dealer)"}),e.jsxs("span",{className:"text-red-600 text-lg",children:["- ₹",E.receivables.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-amber-50 rounded",children:[e.jsx("span",{className:"text-slate-900",children:"Total Deductions"}),e.jsxs("span",{className:"text-amber-600 text-lg",children:["- ₹",E.deductions.toLocaleString()]})]})]}),e.jsx("div",{className:"h-px bg-slate-300"}),e.jsxs("div",{className:`p-4 rounded-lg ${E.netSettlement>0?"bg-red-100 border-2 border-red-300":"bg-green-100 border-2 border-green-300"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-slate-900",children:"Net Settlement"}),e.jsxs("span",{className:"text-2xl text-slate-900",children:["₹",E.settlementAmount.toLocaleString()]})]}),e.jsx("div",{className:"flex items-center gap-2",children:E.settlementType==="Payable to Dealer"?e.jsxs(e.Fragment,{children:[e.jsx(Po,{className:"w-5 h-5 text-red-600"}),e.jsx("span",{className:"text-red-700",children:"Company needs to pay dealer"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Wi,{className:"w-5 h-5 text-green-600"}),e.jsx("span",{className:"text-green-700",children:"Dealer needs to pay company"})]})})]}),e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[e.jsx(Ks,{className:"w-5 h-5 text-blue-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-900 mb-1",children:"Calculation Formula"}),e.jsx("p",{className:"text-sm text-slate-600",children:"Net Settlement = Total Payables - Total Receivables - Total Deductions"}),e.jsxs("p",{className:"text-sm text-slate-600 mt-2",children:["= ₹",E.payables.toLocaleString()," - ₹",E.receivables.toLocaleString()," - ₹",E.deductions.toLocaleString()]})]})]})]})})()})]})}),e.jsxs(Gt,{value:"summary",className:"space-y-4",children:[e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Case Summary"})}),e.jsx(Me,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Case ID"}),e.jsx("p",{className:"text-slate-900",children:l.id})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Dealer Name"}),e.jsx("p",{className:"text-slate-900",children:l.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Dealer Code"}),e.jsx("p",{className:"text-slate-900",children:l.dealerCode})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Location"}),e.jsx("p",{className:"text-slate-900",children:l.location})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Termination Type"}),e.jsx("p",{className:"text-slate-900",children:l.terminationType})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Submitted Date"}),e.jsx("p",{className:"text-slate-900",children:l.submittedDate})]})]})})]}),e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Final Settlement"})}),e.jsxs(Me,{className:"space-y-4",children:[(()=>{const E=R(l.financialData);return e.jsxs("div",{className:`p-6 rounded-lg text-center ${E.settlementType==="Payable to Dealer"?"bg-red-100 border-2 border-red-300":"bg-green-100 border-2 border-green-300"}`,children:[e.jsxs("div",{className:"flex items-center justify-center gap-3 mb-3",children:[E.settlementType==="Payable to Dealer"?e.jsx(Po,{className:"w-8 h-8 text-red-600"}):e.jsx(Wi,{className:"w-8 h-8 text-green-600"}),e.jsx("span",{className:`text-lg ${E.settlementType==="Payable to Dealer"?"text-red-700":"text-green-700"}`,children:E.settlementType})]}),e.jsxs("div",{className:"text-4xl text-slate-900 mb-2",children:["₹",E.settlementAmount.toLocaleString()]}),e.jsx("p",{className:"text-slate-600",children:E.settlementType==="Payable to Dealer"?"Company will pay this amount to the dealer":"Dealer must pay this amount to the company"})]})})(),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"adjustments",children:"Adjustments (if any)"}),e.jsx(ot,{id:"adjustments",value:m,onChange:E=>p(E.target.value),placeholder:"Enter any adjustments to the settlement amount"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"finalNotes",children:"Final Notes"}),e.jsx(Fs,{id:"finalNotes",value:u,onChange:E=>j(E.target.value),placeholder:"Enter any final notes or remarks for this settlement...",rows:4})]})]})]})]})]}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),e.jsxs(se,{className:"bg-green-600 hover:bg-green-700",onClick:I,children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"}),"Approve Settlement"]})]})]})}),e.jsx(os,{open:x,onOpenChange:f,children:e.jsxs(ls,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Settlement Details"}),e.jsxs(vs,{children:["Complete settlement information for ",l==null?void 0:l.dealerName]})]}),l&&e.jsxs(Pn,{defaultValue:"info",className:"w-full",children:[e.jsxs(_n,{className:"grid w-full grid-cols-2",children:[e.jsx(Wt,{value:"info",children:"Case Information"}),e.jsx(Wt,{value:"financial",children:"Financial Breakdown"})]}),e.jsx(Gt,{value:"info",className:"space-y-4 mt-4",children:e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{className:"text-base",children:"Case Details"})}),e.jsx(Me,{className:"space-y-3",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Case ID"}),e.jsx("p",{className:"text-slate-900",children:l.id})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Dealer Code"}),e.jsx("p",{className:"text-slate-900",children:l.dealerCode})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Dealer Name"}),e.jsx("p",{className:"text-slate-900",children:l.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Location"}),e.jsx("p",{className:"text-slate-900",children:l.location})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Termination Type"}),e.jsx(Ae,{variant:l.terminationType==="Resignation"?"default":"secondary",children:l.terminationType})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Status"}),e.jsx(Ae,{variant:l.status==="Settlement Approved"?"default":"secondary",className:l.status==="Settlement Approved"?"bg-green-600 text-white":"bg-amber-600 text-white",children:l.status})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Submitted Date"}),e.jsx("p",{className:"text-slate-900",children:l.submittedDate})]}),l.approvedDate&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Approved Date"}),e.jsx("p",{className:"text-slate-900",children:l.approvedDate})]})]})})]})}),e.jsx(Gt,{value:"financial",className:"space-y-4 mt-4",children:(()=>{const E=R(l.financialData);return e.jsxs(e.Fragment,{children:[e.jsxs(Le,{className:"border-green-200 bg-green-50",children:[e.jsx(tt,{children:e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(bm,{className:"w-5 h-5 text-green-600"}),"Payables to Dealer"]})}),e.jsxs(Me,{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Security Deposit"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.securityDeposit.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Inventory Value"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.inventoryValue.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Equipment Value"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.equipmentValue.toLocaleString()]})]}),e.jsx("div",{className:"pt-2 border-t border-green-300",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-900",children:"Total Payables"}),e.jsxs("span",{className:"text-slate-900 text-lg",children:["₹",E.payables.toLocaleString()]})]})})]})]}),e.jsxs(Le,{className:"border-red-200 bg-red-50",children:[e.jsx(tt,{children:e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(rv,{className:"w-5 h-5 text-red-600"}),"Receivables from Dealer"]})}),e.jsxs(Me,{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Outstanding Invoices"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.outstandingInvoices.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Service Dues"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.serviceDues.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Parts Dues"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.partsDues.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Advances Given"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.advancesGiven.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Penalties"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.penalties.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Other Charges"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.otherCharges.toLocaleString()]})]}),e.jsx("div",{className:"pt-2 border-t border-red-300",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-900",children:"Total Receivables"}),e.jsxs("span",{className:"text-slate-900 text-lg",children:["₹",E.receivables.toLocaleString()]})]})})]})]}),e.jsxs(Le,{className:"border-amber-200 bg-amber-50",children:[e.jsx(tt,{children:e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(Ks,{className:"w-5 h-5 text-amber-600"}),"Deductions"]})}),e.jsx(Me,{children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Warranty Claims Pending"}),e.jsxs("span",{className:"text-slate-900 text-lg",children:["₹",l.financialData.warrantyPending.toLocaleString()]})]})})]}),e.jsxs(Le,{className:`${E.settlementType==="Payable to Dealer"?"border-red-300 bg-red-100":"border-green-300 bg-green-100"}`,children:[e.jsx(tt,{children:e.jsx(nt,{className:"text-base",children:"Net Settlement"})}),e.jsx(Me,{children:e.jsxs("div",{className:"text-center py-4",children:[e.jsxs("div",{className:"flex items-center justify-center gap-3 mb-2",children:[E.settlementType==="Payable to Dealer"?e.jsx(Po,{className:"w-6 h-6 text-red-600"}):e.jsx(Wi,{className:"w-6 h-6 text-green-600"}),e.jsx("span",{className:`text-lg ${E.settlementType==="Payable to Dealer"?"text-red-700":"text-green-700"}`,children:E.settlementType})]}),e.jsxs("div",{className:"text-3xl text-slate-900",children:["₹",E.settlementAmount.toLocaleString()]})]})})]})]})})()})]}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>f(!1),children:"Close"}),(l==null?void 0:l.status)==="Pending Finance Review"&&e.jsx(se,{className:"bg-amber-600 hover:bg-amber-700",onClick:()=>{f(!1),P(l)},children:"Review & Settle"})]})]})})]})}const Co=(...t)=>t.filter(Boolean).join(" ");function A$({applicationId:t,onBack:s}){var I,$,T,E;const[n,r]=v.useState(null),[a,l]=v.useState([]),[c,d]=v.useState("SECURITY_DEPOSIT"),[h,x]=v.useState(!0),[f,m]=v.useState(!1),[p,u]=v.useState({}),[j,g]=v.useState({verificationTransactionId:"",receivedAmount:"",receivedDate:new Date().toISOString().split("T")[0],verificationRemarks:""}),[y,N]=v.useState(!1),[S,C]=v.useState(null),w=a.find(_=>_.depositType===c);v.useEffect(()=>{R()},[t]),v.useEffect(()=>{var _,M,q;if(w)g({verificationTransactionId:w.paymentReference||"",receivedAmount:((_=w.amount)==null?void 0:_.toString())||"",receivedDate:w.verifiedAt?new Date(w.verifiedAt).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],verificationRemarks:w.remarks||""});else{const G=((M=p.SECURITY_DEPOSIT)==null?void 0:M.amount)||5e5,Z=((q=p.FIRST_FILL)==null?void 0:q.amount)||15e5;g({verificationTransactionId:"",receivedAmount:c==="SECURITY_DEPOSIT"?G.toString():Z.toString(),receivedDate:new Date().toISOString().split("T")[0],verificationRemarks:""})}},[c,w,p]);const R=async()=>{try{x(!0);const[_,M,q]=await Promise.all([ds.getApplicationById(t),ds.getSecurityDeposit(t),ds.getSystemConfigs({category:"SECURITY_DEPOSIT",format:"map"})]);r(_),l(Array.isArray(M)?M:[M].filter(Boolean)),u(q||{})}catch(_){console.error("Fetch error:",_),ee.error("Failed to load payment data")}finally{x(!1)}},P=async()=>{if(!j.verificationTransactionId||!j.receivedDate){ee.error("Please fill in all required payment details");return}try{m(!0),await ds.updateSecurityDeposit({applicationId:t,depositType:c,amount:Number(j.receivedAmount),paymentReference:j.verificationTransactionId,status:"Verified"}),ee.success(`${c==="SECURITY_DEPOSIT"?"Security Deposit":"First Fill"} verified and approved`),await R()}catch{ee.error("Failed to verify payment")}finally{m(!1)}},A=async()=>{if(!j.verificationRemarks){ee.error("Please provide remarks for rejection");return}try{m(!0),await ds.updateSecurityDeposit({applicationId:t,depositType:c,status:"Rejected",remarks:j.verificationRemarks}),ee.error(`${c==="SECURITY_DEPOSIT"?"Security Deposit":"First Fill"} rejected`),await R()}catch{ee.error("Failed to reject payment")}finally{m(!1)}};return h?e.jsx("div",{className:"flex items-center justify-center p-20",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-amber-600"})}):n?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"outline",size:"icon",onClick:s,children:e.jsx($r,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl mb-1",children:"Payment Verification"}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(se,{size:"sm",variant:c==="SECURITY_DEPOSIT"?"default":"outline",className:c==="SECURITY_DEPOSIT"?"bg-amber-600 hover:bg-amber-700":"",onClick:()=>d("SECURITY_DEPOSIT"),children:"Security Deposit"}),e.jsx(se,{size:"sm",variant:c==="FIRST_FILL"?"default":"outline",className:c==="FIRST_FILL"?"bg-amber-600 hover:bg-amber-700":"",onClick:()=>d("FIRST_FILL"),children:"First Fill"})]})]})]}),e.jsx(Le,{className:Co("border",(w==null?void 0:w.status)==="Verified"?"border-green-200 bg-green-50":(w==null?void 0:w.status)==="Rejected"?"border-red-200 bg-red-50":"border-amber-200 bg-amber-50"),children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:Co("w-12 h-12 rounded-full flex items-center justify-center",(w==null?void 0:w.status)==="Verified"?"bg-green-100":(w==null?void 0:w.status)==="Rejected"?"bg-red-100":"bg-amber-100"),children:e.jsx(oa,{className:Co("w-6 h-6",(w==null?void 0:w.status)==="Verified"?"text-green-600":(w==null?void 0:w.status)==="Rejected"?"text-red-600":"text-amber-600")})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 font-bold",children:c==="SECURITY_DEPOSIT"?"Security Deposit":"First Fill"}),e.jsx("p",{className:"text-sm text-slate-600",children:(w==null?void 0:w.status)==="Verified"?`Verified on ${Ht(w.verifiedAt)}`:(w==null?void 0:w.status)==="Rejected"?"Payment Rejected":"Awaiting Verification"})]})]}),e.jsx(Ae,{className:Co((w==null?void 0:w.status)==="Verified"?"bg-green-600":(w==null?void 0:w.status)==="Rejected"?"bg-red-600":"bg-amber-600 text-white"),children:(w==null?void 0:w.status)||"No Record"})]})})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2 text-xl",children:[e.jsx(kr,{className:"w-5 h-5 text-amber-600"}),"Applicant Information"]})}),e.jsxs(Me,{className:"grid grid-cols-2 gap-y-4 gap-x-8",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Application ID"}),e.jsx("p",{className:"text-slate-900 font-medium",children:n.applicationId||n.id})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Applicant Name"}),e.jsx("p",{className:"text-slate-900 font-medium",children:n.applicantName})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Location"}),e.jsxs("p",{className:"text-slate-900 font-medium",children:[n.city||n.preferredLocation,", ",n.state]})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Email / Phone"}),e.jsx("p",{className:"text-slate-700 text-sm",children:n.email}),e.jsx("p",{className:"text-slate-700 text-sm",children:n.phone})]})]})]}),e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2 text-xl",children:[e.jsx(mu,{className:"w-5 h-5 text-amber-600"}),"Deposit Tracking"]})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 bg-slate-50 rounded-lg border border-slate-200",children:[e.jsx(ce,{className:"text-slate-500 block mb-1",children:"Expected Amount"}),e.jsxs("p",{className:"text-2xl font-bold text-amber-900",children:["₹",(c==="SECURITY_DEPOSIT"?((I=p.SECURITY_DEPOSIT)==null?void 0:I.amount)||5e5:(($=p.FIRST_FILL)==null?void 0:$.amount)||15e5).toLocaleString()]})]}),e.jsxs("div",{className:Co("p-4 rounded-lg border",(w==null?void 0:w.status)==="Verified"?"bg-green-50 border-green-200":"bg-blue-50 border-blue-200"),children:[e.jsx(ce,{className:"text-slate-500 block mb-1",children:"Receipt Status"}),e.jsx("p",{className:Co("text-2xl font-bold",(w==null?void 0:w.status)==="Verified"?"text-green-700":"text-blue-700"),children:(w==null?void 0:w.status)||"Not Started"})]})]}),(w==null?void 0:w.paymentReference)&&e.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Payment Reference"}),e.jsx("p",{className:"text-slate-900 font-mono",children:w.paymentReference})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Verified By"}),e.jsx("p",{className:"text-slate-900",children:((T=w.verifier)==null?void 0:T.fullName)||"N/A"})]})]})]})]}),e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"flex items-center gap-2 text-xl",children:[e.jsx(fs,{className:"w-5 h-5 text-amber-600"}),"Verification Evidence"]}),e.jsx(Zt,{children:"Documents uploaded by the applicant for payment proof"})]}),e.jsx(Me,{children:((E=n.uploadedDocuments)==null?void 0:E.filter(_=>{var M,q,G,Z;return c==="SECURITY_DEPOSIT"?((M=_.documentType)==null?void 0:M.toLowerCase().includes("security"))&&((q=_.documentType)==null?void 0:q.toLowerCase().includes("deposit")):((G=_.documentType)==null?void 0:G.toLowerCase().includes("first"))&&((Z=_.documentType)==null?void 0:Z.toLowerCase().includes("fill"))}).length)>0?e.jsx("div",{className:"space-y-3",children:n.uploadedDocuments.filter(_=>{var M,q,G,Z;return c==="SECURITY_DEPOSIT"?((M=_.documentType)==null?void 0:M.toLowerCase().includes("security"))&&((q=_.documentType)==null?void 0:q.toLowerCase().includes("deposit")):((G=_.documentType)==null?void 0:G.toLowerCase().includes("first"))&&((Z=_.documentType)==null?void 0:Z.toLowerCase().includes("fill"))}).map((_,M)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-white rounded-lg border border-slate-200 hover:shadow-sm transition-shadow",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded bg-slate-100 flex items-center justify-center",children:e.jsx(fs,{className:"w-5 h-5 text-slate-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 font-medium",children:_.fileName||_.name}),e.jsxs("p",{className:"text-xs text-slate-500 uppercase",children:[_.documentType," • ",Ht(_.createdAt)]})]})]}),e.jsx(se,{variant:"ghost",size:"sm",className:"text-amber-600 hover:text-amber-700 hover:bg-amber-50",onClick:()=>{C(_),N(!0)},children:"View Receipt"})]},M))}):e.jsxs("div",{className:"text-center py-10 bg-slate-50 rounded-lg border-2 border-dashed border-slate-200",children:[e.jsx(Ks,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),e.jsx("p",{className:"text-slate-500",children:"No payment documents found in this application."})]})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(Le,{className:"border-amber-100 shadow-sm",children:[e.jsx(tt,{className:"bg-amber-50/50",children:e.jsxs(nt,{className:"flex items-center gap-2 text-lg",children:[e.jsx(bm,{className:"w-5 h-5 text-amber-600"}),"Finance Action"]})}),e.jsxs(Me,{className:"pt-6 space-y-4",children:[e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"verificationTxnId",className:"text-xs uppercase text-slate-500 font-bold tracking-wider",children:["UTR / Reference Number ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"verificationTxnId",placeholder:"Enter Bank UTR Number",disabled:(w==null?void 0:w.status)==="Verified",className:"mt-1",value:j.verificationTransactionId,onChange:_=>g({...j,verificationTransactionId:_.target.value})})]}),e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"receivedAmount",className:"text-xs uppercase text-slate-500 font-bold tracking-wider",children:["Amount Received (₹) ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"receivedAmount",type:"number",placeholder:(c==="SECURITY_DEPOSIT"?5e5:15e5).toString(),disabled:(w==null?void 0:w.status)==="Verified",className:"mt-1",value:j.receivedAmount,onChange:_=>g({...j,receivedAmount:_.target.value})})]}),e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"receivedDate",className:"text-xs uppercase text-slate-500 font-bold tracking-wider",children:["Credit Value Date ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"receivedDate",type:"date",disabled:(w==null?void 0:w.status)==="Verified",className:"mt-1",value:j.receivedDate,onChange:_=>g({...j,receivedDate:_.target.value})})]}),e.jsxs("div",{children:[e.jsx(ce,{htmlFor:"remarks",className:"text-xs uppercase text-slate-500 font-bold tracking-wider",children:"Verification Remarks"}),e.jsx(Fs,{id:"remarks",placeholder:"Any internal notes for reconciliation...",rows:3,className:"mt-1",value:j.verificationRemarks,onChange:_=>g({...j,verificationRemarks:_.target.value})})]}),e.jsxs("div",{className:"pt-4 space-y-3",children:[e.jsx(se,{className:Co("w-full transition-all duration-200",(w==null?void 0:w.status)==="Verified"?"bg-green-600 hover:bg-green-600 opacity-90":"bg-amber-600 hover:bg-amber-700"),onClick:P,disabled:f||(w==null?void 0:w.status)==="Verified",children:(w==null?void 0:w.status)==="Verified"?e.jsxs(e.Fragment,{children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"})," Verified Successfully"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"})," Mark as Verified"]})}),(w==null?void 0:w.status)!=="Verified"&&(w==null?void 0:w.status)!=="Rejected"&&e.jsxs(se,{variant:"ghost",className:"w-full text-red-600 hover:text-red-700 hover:bg-red-50",onClick:A,disabled:f,children:[e.jsx(Za,{className:"w-4 h-4 mr-2"}),"Reject / Flag Discrepancy"]})]})]})]}),e.jsxs(Le,{className:"bg-slate-900 text-white border-none shadow-xl",children:[e.jsx(tt,{children:e.jsxs(nt,{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(Js,{className:"w-4 h-4 text-amber-400"}),"Next Steps"]})}),e.jsxs(Me,{className:"text-xs text-slate-300 space-y-3",children:[e.jsx("p",{children:"Once verified, the following will occur:"}),e.jsxs("ul",{className:"list-disc pl-4 space-y-2",children:[e.jsxs("li",{children:["Applicant status will advance to ",c==="SECURITY_DEPOSIT"?"LOI Issuance":"LOA Approval"]}),e.jsx("li",{children:"Email notification will be sent to Applicant"}),e.jsxs("li",{children:["Digital ",c==="SECURITY_DEPOSIT"?"LOI":"LOA"," generation will be unlocked"]}),e.jsxs("li",{children:["This payment confirms the ",c==="SECURITY_DEPOSIT"?"Security Deposit":"First Fill"]})]})]})]})]})]}),e.jsx(Kl,{isOpen:y,onClose:()=>N(!1),document:S})]}):e.jsx("div",{className:"p-20 text-center",children:"Application not found"})}const zi=["Warranty Department","Accessories Department","Sales Department","RTO Department","Service Department","Parts Department","Finance Department","Insurance Department","Inventory Department","Marketing Department","HR Department","IT Department","Legal Department","Quality Department","Logistics Department","Customer Relations Department"],m1="[DEPARTMENT_CLAIM]",f1="[FINANCE_VALIDATED]",Qx=[{id:"calculations",label:"Verified All Department Calculations"},{id:"bank",label:"Confirmed Bank Account Details"},{id:"docs",label:"Reviewed All Supporting Documents"},{id:"sap",label:"Synced Final Dues with SAP"},{id:"noc",label:"Received All Mandatory NOCs"}];function k$({fnfId:t,onBack:s}){const[n,r]=v.useState(null),[a,l]=v.useState(!0),[c,d]=v.useState("overview"),[h,x]=v.useState([]),[f,m]=v.useState([]),[p,u]=v.useState([]),[j,g]=v.useState(null),[y,N]=v.useState([]),[S,C]=v.useState(!1),[w,R]=v.useState(null),[P,A]=v.useState([]);v.useEffect(()=>{I(),q()},[t]);const I=async()=>{var ie;try{const Q=(await Te.getSettlementDepartments()).data;Q&&Q.success&&((ie=Q.departments)==null?void 0:ie.length)>0}catch(Fe){console.error("Fetch departments error:",Fe)}},$=ie=>{if(!ie)return ie;let Fe=ie.trim();const Q=zi.find(Ee=>Ee.toLowerCase()===Fe.toLowerCase());if(Q)return Q;const Ne={sales:"Sales Department",service:"Service Department",spares:"Parts Department",parts:"Parts Department","spares / parts":"Parts Department",finance:"Finance Department",accounts:"Finance Department",warranty:"Warranty Department",marketing:"Marketing Department",hr:"HR Department",it:"IT Department",legal:"Legal Department",logistics:"Logistics Department",quality:"Quality Department",fdd:"Finance Department",apparel:"Accessories Department",accessories:"Accessories Department",dms:"IT Department",rto:"Admin Department",admin:"Admin Department","admin / dd-admin":"Admin Department"}[Fe.toLowerCase().replace(" department","")];return Ne||ie},T=(ie,Fe)=>Fe==="DepartmentClaim"||typeof ie=="string"&&(ie.startsWith(m1)||ie.includes("Clearance:")),E=ie=>(ie==null?void 0:ie.sourceType)==="FinanceValidated"&&typeof(ie==null?void 0:ie.description)=="string"&&ie.description.includes("Auto-seeded from department claim"),_=(ie,Fe)=>Fe==="FinanceValidated"||typeof ie=="string"&&ie.startsWith(f1),M=ie=>(ie||"").replace(m1,"").replace(f1,"").trim(),q=async(ie=!0)=>{var Fe,Q,pe,Ne,Ee,it,st,bt,Ue,Lt,ut,yt,kt,Ie,_t,ht,zt,rs,Yt,Os,Is,zs,en,he,Ge,at,pt,mt,Bt,Ds,as,Vs,Ls,Ts,ln,pn,hn,Ws,Qs,zn,on,Un,yr,Tr,er,tr,En;try{ie&&l(!0);const $t=(await Te.getFnFSettlementById(t)).data;if($t.success){const Ze=$t.fnf,Ut={id:Ze.id,caseNumber:Ze.settlementId||((Fe=Ze.resignation)==null?void 0:Fe.resignationId)||((Q=Ze.terminationRequest)==null?void 0:Q.requestId)||Ze.id.substring(0,8),dealerName:((Ne=(pe=Ze.outlet)==null?void 0:pe.dealer)==null?void 0:Ne.fullName)||((Ee=Ze.dealer)==null?void 0:Ee.fullName)||"N/A",dealerCode:((it=Ze.outlet)==null?void 0:it.code)||((bt=(st=Ze.dealer)==null?void 0:st.dealerCode)==null?void 0:bt.dealerCode)||"N/A",location:((Ue=Ze.outlet)==null?void 0:Ue.city)||((Lt=Ze.outlet)==null?void 0:Lt.location)||"N/A",terminationType:Ze.resignationId?"Resignation":"Termination",submittedDate:aa(Ze.createdAt),createdAt:Ze.createdAt,dueDate:Ze.settlementDate?aa(Ze.settlementDate):"TBD",status:Ze.status,dealerId:((yt=(ut=Ze.outlet)==null?void 0:ut.dealer)==null?void 0:yt.id)||Ze.dealerId,originalRequestId:((kt=Ze.resignation)==null?void 0:kt.resignationId)||((Ie=Ze.terminationRequest)==null?void 0:Ie.requestId)||((_t=Ze.terminationRequest)==null?void 0:_t.id)||"N/A",salesCode:((zt=(ht=Ze.dealer)==null?void 0:ht.dealerCode)==null?void 0:zt.salesCode)||((Is=(Os=(Yt=(rs=Ze.outlet)==null?void 0:rs.dealer)==null?void 0:Yt.dealerProfile)==null?void 0:Os.dealerCode)==null?void 0:Is.salesCode)||"N/A",serviceCode:((en=(zs=Ze.dealer)==null?void 0:zs.dealerCode)==null?void 0:en.serviceCode)||((pt=(at=(Ge=(he=Ze.outlet)==null?void 0:he.dealer)==null?void 0:Ge.dealerProfile)==null?void 0:at.dealerCode)==null?void 0:pt.serviceCode)||"N/A",gearCode:((Bt=(mt=Ze.dealer)==null?void 0:mt.dealerCode)==null?void 0:Bt.gearCode)||((Ls=(Vs=(as=(Ds=Ze.outlet)==null?void 0:Ds.dealer)==null?void 0:as.dealerProfile)==null?void 0:Vs.dealerCode)==null?void 0:Ls.gearCode)||"N/A",gmaCode:((ln=(Ts=Ze.dealer)==null?void 0:Ts.dealerCode)==null?void 0:ln.gmaCode)||((Qs=(Ws=(hn=(pn=Ze.outlet)==null?void 0:pn.dealer)==null?void 0:hn.dealerProfile)==null?void 0:Ws.dealerCode)==null?void 0:Qs.gmaCode)||"N/A",allLineItems:(Ze.lineItems||[]).filter(Tt=>Tt.isActive!==!1),departmentResponses:zi.map(Tt=>{const xs=(Ze.clearances||[]).find(wn=>$(wn.department)===Tt),Vr=(Ze.lineItems||[]).filter(wn=>wn.isActive!==!1),ta=Vr.filter(wn=>$(wn.department)===Tt&&T(wn.description,wn.sourceType)),ma=Vr.filter(wn=>$(wn.department)===Tt&&E(wn)),_r=ta.length>0?ta:ma;let sr=0,gn=0;_r.forEach(wn=>{const Da=Math.abs(parseFloat(wn.amount)||0);wn.itemType==="Payable"?sr+=Da:gn+=Da});const mn=sr-gn,Qn=Math.abs(mn)>0,fr=(xs==null?void 0:xs.status)||"Pending",pr=Qn?"Dues Pending":fr==="Cleared"?"NOC Submitted":fr,dn=mn>0?"payable":mn<0?"recovery":null;return{id:(xs==null?void 0:xs.id)||`dept-${Tt}`,departmentName:Tt,status:pr,remarks:(xs==null?void 0:xs.remarks)||"-",submittedDate:xs!=null&&xs.clearedAt?aa(xs.clearedAt):"-",amount:Math.abs(mn),duesFlow:dn,amountType:mn>0?"Payable to dealer":mn<0?"Receivable from dealer":null,supportingDocument:(xs==null?void 0:xs.supportingDocument)||null}}),documents:[{name:"Resignation Letter.pdf",size:"N/A",uploadedOn:aa(Ze.createdAt),type:"Resignation",url:"#"},...(Ze.clearances||[]).filter(Tt=>Tt.supportingDocument).map(Tt=>({name:Tt.supportingDocument.split("/").pop(),size:"N/A",uploadedOn:aa(Tt.clearedAt),type:`${Tt.department} Proof`,url:Tt.supportingDocument})),...(Ze.clearanceDocuments||[]).map(Tt=>{var xs;return{name:Tt.name||((xs=Tt.supportingDocument)==null?void 0:xs.split("/").pop())||"Document",size:"N/A",uploadedOn:aa(Tt.clearedAt||Ze.createdAt),type:"Finance Upload",url:Tt.supportingDocument}})]};r(Ut);const jt=Ze.bankDetails||((zn=Ze.dealer)==null?void 0:zn.bankDetails)||((yr=(Un=(on=Ze.outlet)==null?void 0:on.dealer)==null?void 0:Un.dealerProfile)==null?void 0:yr.bankDetails);jt&&jt.length>0?N(jt):((er=(Tr=Ze.outlet)==null?void 0:Tr.dealer)!=null&&er.id||Ze.dealerId)&&G(((En=(tr=Ze.outlet)==null?void 0:tr.dealer)==null?void 0:En.id)||Ze.dealerId);const In=[],jr=[],Pr=[],xn=(Ze.lineItems||[]).filter(Tt=>Tt.isActive!==!1);(xn.some(Tt=>_(Tt.description,Tt.sourceType))?xn.filter(Tt=>_(Tt.description,Tt.sourceType)):xn.filter(Tt=>!T(Tt.description,Tt.sourceType))).forEach(Tt=>{const xs={id:Tt.id,department:$(Tt.department),description:M(Tt.description||Tt.remarks||""),amount:Math.abs(Tt.amount)};Tt.itemType==="Payable"?In.push(xs):Tt.itemType==="Deduction"?Pr.push(xs):jr.push(xs)}),x(In),m(jr),u(Pr),qe({verificationTransactionId:Ze.transactionReference||"",settlementAmount:(Ze.settlementAmount||Ye().settlementAmount).toString(),settlementDate:Ze.settlementDate?new Date(Ze.settlementDate).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],paymentMode:Ze.paymentMode||"",bankReference:"",verificationRemarks:Ze.remarks||"",adjustments:"0"})}}catch(Xe){console.error("Fetch F&F error:",Xe),ee.error("Failed to fetch settlement details")}finally{ie&&l(!1)}},G=async ie=>{try{const Q=(await Te.getDealerBankDetails(ie)).data;Q.success&&N(Q.bankDetails||[])}catch(Fe){console.error("Fetch bank details error:",Fe)}},Z=async ie=>{ie.preventDefault();const Fe=new FormData(ie.currentTarget),Q=Object.fromEntries(Fe.entries());try{const pe=n==null?void 0:n.dealerId;(await Te.saveBankDetail(pe,{...Q,id:w==null?void 0:w.id,isPrimary:Fe.get("isPrimary")==="on"})).data.success&&(ee.success("Bank details saved"),G(pe),C(!1),R(null))}catch{ee.error("Failed to save bank details")}},W=async ie=>{if(confirm("Are you sure you want to delete this bank account?"))try{(await Te.deleteBankDetail(ie)).data.success&&(ee.success("Bank detail deleted"),G(n==null?void 0:n.dealerId))}catch{ee.error("Failed to delete bank details")}},z=ie=>{A(Fe=>Fe.includes(ie)?Fe.filter(Q=>Q!==ie):[...Fe,ie])},[F,B]=v.useState({department:"",description:"",amount:""}),[D,O]=v.useState({department:"",description:"",amount:""}),[V,K]=v.useState({department:"",description:"",amount:""}),[Y,U]=v.useState(null),[X,ne]=v.useState(null),[oe,re]=v.useState(null),[ge,ve]=v.useState({}),[Se,We]=v.useState({}),[Ce,fe]=v.useState({}),Ye=()=>{const ie=h.reduce((Ne,Ee)=>Ne+(Number(Ee.amount)||0),0),Fe=f.reduce((Ne,Ee)=>Ne+(Number(Ee.amount)||0),0),Q=p.reduce((Ne,Ee)=>Ne+(Number(Ee.amount)||0),0),pe=ie-Fe-Q;return{payables:ie,receivables:Fe,deductions:Q,netSettlement:pe,settlementAmount:Math.abs(pe),settlementType:pe>0?"Payable to Dealer":pe<0?"Receivable from Dealer":"No Settlement Required"}},be=Ye(),_e=zi.map(ie=>{const Fe=((n==null?void 0:n.departmentResponses)||[]).find(ut=>ut.departmentName===ie),Q=Number(Fe==null?void 0:Fe.amount)||0,pe=(Fe==null?void 0:Fe.amountType)||"-",Ne=h.filter(ut=>$(ut.department)===ie).reduce((ut,yt)=>ut+(Number(yt.amount)||0),0),Ee=f.filter(ut=>$(ut.department)===ie).reduce((ut,yt)=>ut+(Number(yt.amount)||0),0),it=p.filter(ut=>$(ut.department)===ie).reduce((ut,yt)=>ut+(Number(yt.amount)||0),0),st=Ne-Ee-it,bt=Math.abs(st),Ue=st>0?"Payable":st<0?"Receivable":"-",Lt=bt-Q;return{department:ie,claimAmount:Q,claimType:pe,validatedAmount:bt,validatedType:Ue,variance:Lt}}),[ke,qe]=v.useState({verificationTransactionId:"",settlementAmount:be.settlementAmount.toString(),settlementDate:new Date().toISOString().split("T")[0],paymentMode:"",bankReference:"",verificationRemarks:"",adjustments:"0"}),Ve=async()=>{var ie,Fe;if(!F.department||!F.description||!F.amount){ee.error("Please fill in all fields");return}try{const pe=(await Te.addLineItem(t,{department:F.department,description:F.description,amount:Math.abs(parseFloat(F.amount)),itemType:"Payable"})).data;pe.success&&(x([...h,{id:pe.lineItem.id,department:pe.lineItem.department,description:pe.lineItem.description,amount:Math.abs(pe.lineItem.amount)}]),B({department:"",description:"",amount:""}),ee.success("Payable item added"),q())}catch(Q){ee.error(((Fe=(ie=Q.response)==null?void 0:ie.data)==null?void 0:Fe.message)||"Failed to add payable item")}},dt=async(ie,Fe,Q)=>{ve(pe=>{const Ne=pe[ie]||h.find(Ee=>Ee.id===ie);return Ne?{...pe,[ie]:{...Ne,[Fe]:Fe==="amount"?Number(Q)||0:Q}}:pe})},xt=async ie=>{var Q,pe;const Fe=ge[ie];if(!Fe){U(null);return}x(Ne=>Ne.map(Ee=>Ee.id===ie?Fe:Ee));try{await Te.updateLineItem(ie,{department:Fe.department,description:Fe.description,amount:-Math.abs(Number(Fe.amount)||0)}),U(null),ve(Ne=>{const Ee={...Ne};return delete Ee[ie],Ee}),ee.success("Changes saved"),q(!1)}catch(Ne){ee.error(((pe=(Q=Ne.response)==null?void 0:Q.data)==null?void 0:pe.message)||"Failed to update item"),q(!1)}},ye=async ie=>{var Fe,Q;try{(await Te.deleteLineItem(ie)).data.success&&(x(h.filter(Ee=>Ee.id!==ie)),ee.info("Payable item removed"),q())}catch(pe){ee.error(((Q=(Fe=pe.response)==null?void 0:Fe.data)==null?void 0:Q.message)||"Failed to delete item")}},le=async()=>{var ie,Fe;if(!D.department||!D.description||!D.amount){ee.error("Please fill in all fields");return}try{const pe=(await Te.addLineItem(t,{department:D.department,description:D.description,amount:Math.abs(parseFloat(D.amount)),itemType:"Receivable"})).data;pe.success&&(m([...f,{id:pe.lineItem.id,department:pe.lineItem.department,description:pe.lineItem.description,amount:pe.lineItem.amount}]),O({department:"",description:"",amount:""}),ee.success("Receivable item added"),q())}catch(Q){ee.error(((Fe=(ie=Q.response)==null?void 0:ie.data)==null?void 0:Fe.message)||"Failed to add receivable item")}},Qe=async(ie,Fe,Q)=>{We(pe=>{const Ne=pe[ie]||f.find(Ee=>Ee.id===ie);return Ne?{...pe,[ie]:{...Ne,[Fe]:Fe==="amount"?Number(Q)||0:Q}}:pe})},rt=async ie=>{var Q,pe;const Fe=Se[ie];if(!Fe){ne(null);return}m(Ne=>Ne.map(Ee=>Ee.id===ie?Fe:Ee));try{await Te.updateLineItem(ie,{department:Fe.department,description:Fe.description,amount:Math.abs(Number(Fe.amount)||0)}),ne(null),We(Ne=>{const Ee={...Ne};return delete Ee[ie],Ee}),ee.success("Changes saved"),q(!1)}catch(Ne){ee.error(((pe=(Q=Ne.response)==null?void 0:Q.data)==null?void 0:pe.message)||"Failed to update item"),q(!1)}},Kt=async ie=>{var Fe,Q;try{await Te.deleteLineItem(ie),m(f.filter(pe=>pe.id!==ie)),ee.info("Receivable item removed"),q()}catch(pe){ee.error(((Q=(Fe=pe.response)==null?void 0:Fe.data)==null?void 0:Q.message)||"Failed to delete item")}},Rt=async()=>{var ie,Fe;if(!V.department||!V.description||!V.amount){ee.error("Please fill in all fields");return}try{const pe=(await Te.addLineItem(t,{department:V.department,description:V.description,amount:Math.abs(parseFloat(V.amount)),itemType:"Deduction"})).data;pe.success&&(u([...p,{id:pe.lineItem.id,department:pe.lineItem.department,description:pe.lineItem.description,amount:pe.lineItem.amount}]),K({department:"",description:"",amount:""}),ee.success("Deduction item added"),q())}catch(Q){ee.error(((Fe=(ie=Q.response)==null?void 0:ie.data)==null?void 0:Fe.message)||"Failed to add deduction item")}},Re=async(ie,Fe,Q)=>{fe(pe=>{const Ne=pe[ie]||p.find(Ee=>Ee.id===ie);return Ne?{...pe,[ie]:{...Ne,[Fe]:Fe==="amount"?Number(Q)||0:Q}}:pe})},Qt=async ie=>{var Q,pe;const Fe=Ce[ie];if(!Fe){re(null);return}u(Ne=>Ne.map(Ee=>Ee.id===ie?Fe:Ee));try{await Te.updateLineItem(ie,{department:Fe.department,description:Fe.description,amount:Math.abs(Number(Fe.amount)||0)}),re(null),fe(Ne=>{const Ee={...Ne};return delete Ee[ie],Ee}),ee.success("Changes saved"),q(!1)}catch(Ne){ee.error(((pe=(Q=Ne.response)==null?void 0:Q.data)==null?void 0:pe.message)||"Failed to update item"),q(!1)}},qt=async ie=>{try{await Te.deleteLineItem(ie),u(p.filter(Fe=>Fe.id!==ie)),ee.info("Deduction item removed"),q()}catch{ee.error("Failed to delete item")}},ws=async ie=>{var Q;const Fe=ie.target.files;if(Fe&&Fe.length>0){l(!0);try{let pe=0;for(let Ne=0;Ne{if(!ke.verificationTransactionId||!ke.settlementDate||!ke.paymentMode){ee.error("Please fill in all required settlement details");return}try{ns(!0);const ie=(be.settlementAmount||0)+parseFloat(ke.adjustments||"0");await QR.updateFnF(t,{status:"Completed",finalSettlementAmount:ie,settlementDate:ke.settlementDate,paymentMode:ke.paymentMode,transactionReference:ke.verificationTransactionId,remarks:ke.verificationRemarks||"Approved by Finance"}),ee.success(`F&F Settlement approved and completed for ${n.dealerName}`),setTimeout(()=>s(),1500)}catch(ie){console.error("Approve settlement error:",ie),ee.error(ie.message||"Failed to approve settlement")}finally{ns(!1)}},Bs=()=>{if(!ke.verificationRemarks){ee.error("Please provide remarks for rejection");return}ee.error(`F&F Settlement rejected for ${n.dealerName}`),setTimeout(()=>s(),1500)},Ft=()=>{if(!ke.verificationRemarks){ee.error("Please provide details for clarification request");return}ee.info(`Clarification request sent for ${n.dealerName}`),setTimeout(()=>s(),1500)};return a?e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-amber-600"})}):n?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"outline",size:"icon",onClick:s,children:e.jsx($r,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl mb-1",children:"F&F Settlement Review"}),e.jsxs("p",{className:"text-slate-600",children:["Full & Final Settlement for ",n.dealerName]})]})]}),e.jsx(Le,{className:"border-amber-200 bg-amber-50",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-12 shrink-0 aspect-square rounded-full bg-amber-100 flex items-center justify-center",children:e.jsx(oa,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900",children:"Settlement Pending Finance Approval"}),e.jsxs("p",{className:"text-sm text-slate-600",children:["Case: ",n.caseNumber," • Due: ",n.dueDate]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ae,{className:"bg-amber-600",children:n.status}),e.jsx(Ae,{variant:n.terminationType==="Resignation"?"default":"secondary",children:n.terminationType})]})]})})}),e.jsx(Le,{className:`${be.settlementType==="Payable to Dealer"?"border-red-300 bg-red-50":be.settlementType==="Receivable from Dealer"?"border-green-300 bg-green-50":"border-slate-300 bg-slate-50"}`,children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[be.settlementType==="Payable to Dealer"?e.jsx(Po,{className:"w-12 h-12 text-red-600"}):be.settlementType==="Receivable from Dealer"?e.jsx(Wi,{className:"w-12 h-12 text-green-600"}):e.jsx(Ys,{className:"w-12 h-12 text-slate-600"}),e.jsxs("div",{children:[e.jsx("p",{className:`text-sm ${be.settlementType==="Payable to Dealer"?"text-red-700":be.settlementType==="Receivable from Dealer"?"text-green-700":"text-slate-700"}`,children:be.settlementType}),e.jsx("p",{className:"text-3xl text-slate-900",children:be.settlementType==="No Settlement Required"?"₹0":`₹${be.settlementAmount.toLocaleString("en-IN")}`})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sm text-slate-600",children:"Net Settlement Amount"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:be.settlementType==="Payable to Dealer"?"Company will pay to dealer":be.settlementType==="Receivable from Dealer"?"Dealer must pay to company":"No payment required"})]})]})})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2 space-y-6",children:e.jsxs(Pn,{value:c,onValueChange:d,className:"w-full",children:[e.jsxs(_n,{className:"grid w-full grid-cols-5",children:[e.jsx(Wt,{value:"overview",children:"Overview"}),e.jsx(Wt,{value:"financial",children:"Financial"}),e.jsx(Wt,{value:"departments",children:"Departments"}),e.jsx(Wt,{value:"documents",children:"Documents"}),e.jsx(Wt,{value:"bank",children:"Bank Details"})]}),e.jsxs(Gt,{value:"overview",className:"space-y-4",children:[e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(kr,{className:"w-5 h-5"}),"Case Information"]})}),e.jsx(Me,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Case Number"}),e.jsx("p",{className:"text-slate-900",children:n.caseNumber})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Dealer Code"}),e.jsx("p",{className:"text-slate-900",children:n.dealerCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Dealer Name"}),e.jsx("p",{className:"text-slate-900",children:n.dealerName})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Location"}),e.jsx("p",{className:"text-slate-900",children:n.location})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Termination Type"}),e.jsx(Ae,{variant:n.terminationType==="Resignation"?"default":"secondary",children:n.terminationType})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Status"}),e.jsx(Ae,{className:"bg-amber-600",children:n.status})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Submitted Date"}),e.jsx("p",{className:"text-slate-900",children:n.submittedDate})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Due Date"}),e.jsx("p",{className:"text-slate-900",children:n.dueDate})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Request Age"}),e.jsx("p",{className:"text-slate-900",children:(()=>{const ie=new Date(n.createdAt),Q=Math.abs(new Date().getTime()-ie.getTime()),pe=Math.ceil(Q/(1e3*60*60*24));return`${pe} day${pe!==1?"s":""}`})()})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Sales Code"}),e.jsx("p",{className:"text-slate-900",children:n.salesCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Service Code"}),e.jsx("p",{className:"text-slate-900",children:n.serviceCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Gear Code"}),e.jsx("p",{className:"text-slate-900",children:n.gearCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"GMA Code"}),e.jsx("p",{className:"text-slate-900",children:n.gmaCode})]})]})})]}),e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(oa,{className:"w-5 h-5"}),"Settlement Calculation Summary"]})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center p-3 bg-green-50 rounded-lg",children:[e.jsx("span",{className:"text-slate-900",children:"Total Payables (to Dealer)"}),e.jsxs("span",{className:"text-green-700 text-lg",children:["+ ₹",be.payables.toLocaleString("en-IN")]})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-red-50 rounded-lg",children:[e.jsx("span",{className:"text-slate-900",children:"Total Receivables (from Dealer)"}),e.jsxs("span",{className:"text-red-700 text-lg",children:["- ₹",be.receivables.toLocaleString("en-IN")]})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-amber-50 rounded-lg",children:[e.jsx("span",{className:"text-slate-900",children:"Total Deductions"}),e.jsxs("span",{className:"text-amber-700 text-lg",children:["- ₹",be.deductions.toLocaleString("en-IN")]})]})]}),e.jsx("div",{className:"h-px bg-slate-300"}),e.jsx("div",{className:`p-4 rounded-lg border-2 ${be.settlementType==="Payable to Dealer"?"bg-red-100 border-red-300":be.settlementType==="Receivable from Dealer"?"bg-green-100 border-green-300":"bg-slate-100 border-slate-300"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-900",children:"Net Settlement"}),e.jsx("p",{className:`text-sm ${be.settlementType==="Payable to Dealer"?"text-red-700":be.settlementType==="Receivable from Dealer"?"text-green-700":"text-slate-700"}`,children:be.settlementType})]}),e.jsx("span",{className:"text-2xl text-slate-900",children:be.settlementType==="No Settlement Required"?"₹0":`₹${be.settlementAmount.toLocaleString("en-IN")}`})]})}),e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-blue-50 border border-amber-200 rounded-lg",children:[e.jsx(Ks,{className:"w-5 h-5 text-amber-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-900 mb-1",children:"Calculation Formula"}),e.jsxs("p",{className:"text-sm text-slate-600",children:["Net Settlement = Payables - Receivables - Deductions",e.jsx("br",{}),e.jsx("span",{className:"text-xs",children:"All amounts are editable in the Financial tab"})]})]})]})]})]})]}),e.jsxs(Gt,{value:"financial",className:"space-y-4",children:[e.jsxs(Le,{className:"border-blue-200 bg-blue-50",children:[e.jsxs(tt,{children:[e.jsx(nt,{className:"text-base",children:"Department Claim vs Finance Validation"}),e.jsx(Zt,{children:"Finance validated values are used for final settlement totals."})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Department Claim"}),e.jsx(me,{children:"Finance Validated"}),e.jsx(me,{children:"Variance"})]})}),e.jsx(Es,{children:_e.map(ie=>e.jsxs(ct,{children:[e.jsx(de,{children:ie.department}),e.jsx(de,{children:ie.claimAmount>0?`${ie.claimType} ₹${ie.claimAmount.toLocaleString("en-IN")}`:"-"}),e.jsx(de,{children:ie.validatedAmount>0?`${ie.validatedType} ₹${ie.validatedAmount.toLocaleString("en-IN")}`:"-"}),e.jsx(de,{className:ie.variance===0?"text-slate-600":ie.variance>0?"text-red-600":"text-green-600",children:ie.claimAmount===0&&ie.validatedAmount===0?"-":`₹${ie.variance.toLocaleString("en-IN")}`})]},ie.department))})]})})]}),e.jsxs(Le,{className:"border-green-200 bg-green-50",children:[e.jsx(tt,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(bm,{className:"w-5 h-5 text-green-600"}),"Payables to Dealer (Editable)"]}),e.jsx(Zt,{children:"Add or modify amounts company owes to dealer"})]})})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Description"}),e.jsx(me,{className:"text-right",children:"Amount (₹)"}),e.jsx(me,{className:"w-[100px]",children:"Actions"})]})}),e.jsx(Es,{children:h.map(ie=>{var Fe,Q,pe;return e.jsxs(ct,{children:[e.jsx(de,{children:Y===ie.id?e.jsxs(wt,{value:((Fe=ge[ie.id])==null?void 0:Fe.department)||ie.department,onValueChange:Ne=>dt(ie.id,"department",Ne),children:[e.jsx(Ct,{className:"h-8",children:e.jsx(St,{placeholder:"Department"})}),e.jsx(At,{children:zi.map(Ne=>e.jsx(Pe,{value:Ne,children:Ne},Ne))})]}):e.jsx("span",{className:"text-slate-900",children:$(ie.department)})}),e.jsx(de,{children:Y===ie.id?e.jsx(ot,{value:((Q=ge[ie.id])==null?void 0:Q.description)||ie.description,onChange:Ne=>dt(ie.id,"description",Ne.target.value),className:"h-8"}):e.jsx("span",{className:"text-slate-600",children:ie.description})}),e.jsx(de,{className:"text-right",children:Y===ie.id?e.jsx(ot,{type:"number",value:((pe=ge[ie.id])==null?void 0:pe.amount)??ie.amount,onChange:Ne=>dt(ie.id,"amount",Ne.target.value),className:"h-8 text-right"}):e.jsxs("span",{className:"text-slate-900",children:["₹",ie.amount.toLocaleString("en-IN")]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex gap-1",children:[Y===ie.id?e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>xt(ie.id),children:e.jsx(Yi,{className:"w-4 h-4"})}):e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>{U(ie.id),ve(Ne=>({...Ne,[ie.id]:{...ie}}))},children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8 text-red-600 hover:text-red-700",onClick:()=>ye(ie.id),children:e.jsx(Gn,{className:"w-4 h-4"})})]})})]},ie.id)})})]}),e.jsxs("div",{className:"border-t border-green-300 pt-4 space-y-3",children:[e.jsx("p",{className:"text-sm text-slate-700",children:"Add New Payable Item:"}),e.jsxs("div",{className:"grid grid-cols-12 gap-2",children:[e.jsxs(wt,{value:F.department,onValueChange:ie=>B({...F,department:ie}),children:[e.jsx(Ct,{className:"col-span-3",children:e.jsx(St,{placeholder:"Department"})}),e.jsx(At,{children:zi.map(ie=>e.jsx(Pe,{value:ie,children:ie},ie))})]}),e.jsx(ot,{placeholder:"Description",value:F.description,onChange:ie=>B({...F,description:ie.target.value}),className:"col-span-5"}),e.jsx(ot,{type:"number",placeholder:"Amount",value:F.amount,onChange:ie=>B({...F,amount:ie.target.value}),className:"col-span-3"}),e.jsx(se,{onClick:Ve,className:"col-span-1 bg-green-600 hover:bg-green-700",children:e.jsx(cn,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"pt-3 border-t-2 border-green-400",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-900",children:"Total Payables"}),e.jsxs("span",{className:"text-green-700 text-xl",children:["₹",be.payables.toLocaleString("en-IN")]})]})})]})]}),e.jsxs(Le,{className:"border-red-200 bg-red-50",children:[e.jsx(tt,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(rv,{className:"w-5 h-5 text-red-600"}),"Receivables from Dealer (Editable)"]}),e.jsx(Zt,{children:"Add or modify amounts dealer owes to company"})]})})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Description"}),e.jsx(me,{className:"text-right",children:"Amount (₹)"}),e.jsx(me,{className:"w-[100px]",children:"Actions"})]})}),e.jsx(Es,{children:f.map(ie=>{var Fe,Q,pe;return e.jsxs(ct,{children:[e.jsx(de,{children:X===ie.id?e.jsxs(wt,{value:((Fe=Se[ie.id])==null?void 0:Fe.department)||ie.department,onValueChange:Ne=>Qe(ie.id,"department",Ne),children:[e.jsx(Ct,{className:"h-8",children:e.jsx(St,{placeholder:"Department"})}),e.jsx(At,{children:zi.map(Ne=>e.jsx(Pe,{value:Ne,children:Ne},Ne))})]}):e.jsx("span",{className:"text-slate-900",children:$(ie.department)})}),e.jsx(de,{children:X===ie.id?e.jsx(ot,{value:((Q=Se[ie.id])==null?void 0:Q.description)||ie.description,onChange:Ne=>Qe(ie.id,"description",Ne.target.value),className:"h-8"}):e.jsx("span",{className:"text-slate-600",children:ie.description})}),e.jsx(de,{className:"text-right",children:X===ie.id?e.jsx(ot,{type:"number",value:((pe=Se[ie.id])==null?void 0:pe.amount)??ie.amount,onChange:Ne=>Qe(ie.id,"amount",Ne.target.value),className:"h-8 text-right"}):e.jsxs("span",{className:"text-slate-900",children:["₹",ie.amount.toLocaleString("en-IN")]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex gap-1",children:[X===ie.id?e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>rt(ie.id),children:e.jsx(Yi,{className:"w-4 h-4"})}):e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>{ne(ie.id),We(Ne=>({...Ne,[ie.id]:{...ie}}))},children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8 text-red-600 hover:text-red-700",onClick:()=>Kt(ie.id),children:e.jsx(Gn,{className:"w-4 h-4"})})]})})]},ie.id)})})]}),e.jsxs("div",{className:"border-t border-red-300 pt-4 space-y-3",children:[e.jsx("p",{className:"text-sm text-slate-700",children:"Add New Receivable Item:"}),e.jsxs("div",{className:"grid grid-cols-12 gap-2",children:[e.jsxs(wt,{value:D.department,onValueChange:ie=>O({...D,department:ie}),children:[e.jsx(Ct,{className:"col-span-3",children:e.jsx(St,{placeholder:"Department"})}),e.jsx(At,{children:zi.map(ie=>e.jsx(Pe,{value:ie,children:ie},ie))})]}),e.jsx(ot,{placeholder:"Description",value:D.description,onChange:ie=>O({...D,description:ie.target.value}),className:"col-span-5"}),e.jsx(ot,{type:"number",placeholder:"Amount",value:D.amount,onChange:ie=>O({...D,amount:ie.target.value}),className:"col-span-3"}),e.jsx(se,{onClick:le,className:"col-span-1 bg-red-600 hover:bg-red-700",children:e.jsx(cn,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"pt-3 border-t-2 border-red-400",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-900",children:"Total Receivables"}),e.jsxs("span",{className:"text-red-700 text-xl",children:["₹",be.receivables.toLocaleString("en-IN")]})]})})]})]}),e.jsxs(Le,{className:"border-amber-200 bg-amber-50",children:[e.jsx(tt,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(Ks,{className:"w-5 h-5 text-amber-600"}),"Deductions (Editable)"]}),e.jsx(Zt,{children:"Add or modify pending claims and deductions"})]})})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Description"}),e.jsx(me,{className:"text-right",children:"Amount (₹)"}),e.jsx(me,{className:"w-[100px]",children:"Actions"})]})}),e.jsx(Es,{children:p.map(ie=>{var Fe,Q,pe;return e.jsxs(ct,{children:[e.jsx(de,{children:oe===ie.id?e.jsxs(wt,{value:((Fe=Ce[ie.id])==null?void 0:Fe.department)||ie.department,onValueChange:Ne=>Re(ie.id,"department",Ne),children:[e.jsx(Ct,{className:"h-8",children:e.jsx(St,{placeholder:"Department"})}),e.jsx(At,{children:zi.map(Ne=>e.jsx(Pe,{value:Ne,children:Ne},Ne))})]}):e.jsx("span",{className:"text-slate-900",children:$(ie.department)})}),e.jsx(de,{children:oe===ie.id?e.jsx(ot,{value:((Q=Ce[ie.id])==null?void 0:Q.description)||ie.description,onChange:Ne=>Re(ie.id,"description",Ne.target.value),className:"h-8"}):e.jsx("span",{className:"text-slate-600",children:ie.description})}),e.jsx(de,{className:"text-right",children:oe===ie.id?e.jsx(ot,{type:"number",value:((pe=Ce[ie.id])==null?void 0:pe.amount)??ie.amount,onChange:Ne=>Re(ie.id,"amount",Ne.target.value),className:"h-8 text-right"}):e.jsxs("span",{className:"text-slate-900",children:["₹",ie.amount.toLocaleString("en-IN")]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex gap-1",children:[oe===ie.id?e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Qt(ie.id),children:e.jsx(Yi,{className:"w-4 h-4"})}):e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>{re(ie.id),fe(Ne=>({...Ne,[ie.id]:{...ie}}))},children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8 text-red-600 hover:text-red-700",onClick:()=>qt(ie.id),children:e.jsx(Gn,{className:"w-4 h-4"})})]})})]},ie.id)})})]}),e.jsxs("div",{className:"border-t border-amber-300 pt-4 space-y-3",children:[e.jsx("p",{className:"text-sm text-slate-700",children:"Add New Deduction Item:"}),e.jsxs("div",{className:"grid grid-cols-12 gap-2",children:[e.jsxs(wt,{value:V.department,onValueChange:ie=>K({...V,department:ie}),children:[e.jsx(Ct,{className:"col-span-3",children:e.jsx(St,{placeholder:"Department"})}),e.jsx(At,{children:zi.map(ie=>e.jsx(Pe,{value:ie,children:ie},ie))})]}),e.jsx(ot,{placeholder:"Description",value:V.description,onChange:ie=>K({...V,description:ie.target.value}),className:"col-span-5"}),e.jsx(ot,{type:"number",placeholder:"Amount",value:V.amount,onChange:ie=>K({...V,amount:ie.target.value}),className:"col-span-3"}),e.jsx(se,{onClick:Rt,className:"col-span-1 bg-amber-600 hover:bg-amber-700",children:e.jsx(cn,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"pt-3 border-t-2 border-amber-400",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-900",children:"Total Deductions"}),e.jsxs("span",{className:"text-amber-700 text-xl",children:["₹",be.deductions.toLocaleString("en-IN")]})]})})]})]}),e.jsxs(Le,{className:"border-2 border-blue-300 bg-blue-50",children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(Ys,{className:"w-5 h-5 text-amber-600"}),"Final Settlement Summary"]})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center p-3 bg-white rounded-lg",children:[e.jsx("span",{className:"text-slate-900",children:"Total Payables (to Dealer)"}),e.jsxs("span",{className:"text-green-700 text-lg",children:["+ ₹",be.payables.toLocaleString("en-IN")]})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-white rounded-lg",children:[e.jsx("span",{className:"text-slate-900",children:"Total Receivables (from Dealer)"}),e.jsxs("span",{className:"text-red-700 text-lg",children:["- ₹",be.receivables.toLocaleString("en-IN")]})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-white rounded-lg",children:[e.jsx("span",{className:"text-slate-900",children:"Total Deductions"}),e.jsxs("span",{className:"text-amber-700 text-lg",children:["- ₹",be.deductions.toLocaleString("en-IN")]})]})]}),e.jsx("div",{className:"h-px bg-blue-300"}),e.jsx("div",{className:`p-4 rounded-lg border-2 ${be.settlementType==="Payable to Dealer"?"bg-red-100 border-red-400":be.settlementType==="Receivable from Dealer"?"bg-green-100 border-green-400":"bg-slate-100 border-slate-400"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Net Settlement"}),e.jsx("p",{className:`text-lg ${be.settlementType==="Payable to Dealer"?"text-red-700":be.settlementType==="Receivable from Dealer"?"text-green-700":"text-slate-700"}`,children:be.settlementType})]}),e.jsx("span",{className:"text-3xl text-slate-900",children:be.settlementType==="No Settlement Required"?"₹0":`₹${be.settlementAmount.toLocaleString("en-IN")}`})]})}),e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-white border border-amber-200 rounded-lg",children:[e.jsx(Ks,{className:"w-5 h-5 text-amber-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-900 mb-1",children:"Calculation Formula"}),e.jsxs("p",{className:"text-sm text-slate-600",children:["Net Settlement = Payables - Receivables - Deductions",e.jsx("br",{}),be.netSettlement>0&&"Positive value means company pays to dealer",be.netSettlement<0&&"Negative value means dealer pays to company",be.netSettlement===0&&"Zero means no payment required from either party"]})]})]})]})]})]}),e.jsxs(Gt,{value:"departments",className:"space-y-4",children:[e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(da,{className:"w-5 h-5"}),"Department Response Progress"]}),e.jsxs(Zt,{children:[n.departmentResponses.filter(ie=>ie.status!=="Pending").length," of ",n.departmentResponses.length," departments have responded"]})]}),e.jsxs(Me,{className:"space-y-4",children:[e.jsx(ji,{value:n.departmentResponses.filter(ie=>ie.status!=="Pending").length/n.departmentResponses.length*100,className:"h-3"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"p-4 bg-green-50 rounded-lg border border-green-200",children:[e.jsx("p",{className:"text-sm text-green-700 mb-1",children:"NOC Submitted"}),e.jsx("p",{className:"text-2xl text-green-600",children:n.departmentResponses.filter(ie=>ie.status==="NOC Submitted").length})]}),e.jsxs("div",{className:"p-4 bg-red-50 rounded-lg border border-red-200",children:[e.jsx("p",{className:"text-sm text-red-700 mb-1",children:"Dues Pending"}),e.jsx("p",{className:"text-2xl text-red-600",children:n.departmentResponses.filter(ie=>ie.status==="Dues Pending").length})]}),e.jsxs("div",{className:"p-4 bg-slate-50 rounded-lg border border-slate-200",children:[e.jsx("p",{className:"text-sm text-slate-700 mb-1",children:"Awaiting Response"}),e.jsx("p",{className:"text-2xl text-slate-600",children:n.departmentResponses.filter(ie=>ie.status==="Pending").length})]})]})]})]}),e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"All Department Responses"}),e.jsx(Zt,{children:"Status of NOC and dues clearance from all 16 departments (read-only for Finance; updates are done by department stakeholders)."})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Amount Type"}),e.jsx(me,{children:"Amount"}),e.jsx(me,{children:"Submitted Date"}),e.jsx(me,{children:"Remarks"})]})}),e.jsx(Es,{children:n.departmentResponses.map(ie=>e.jsxs(ct,{className:ie.duesFlow==="recovery"?"bg-red-50/40":ie.duesFlow==="payable"?"bg-emerald-50/40":"",children:[e.jsx(de,{children:ie.departmentName}),e.jsx(de,{children:e.jsx(Ae,{className:`border ${ie.status==="NOC Submitted"?"bg-green-100 text-green-700 border-green-300":ie.status==="Dues Pending"?"bg-red-100 text-red-700 border-red-300":"bg-slate-100 text-slate-700 border-slate-300"}`,children:ie.status})}),e.jsx(de,{children:ie.amountType?e.jsx(Ae,{variant:"outline",className:ie.duesFlow==="recovery"?"bg-red-100 text-red-900 border-red-400 font-semibold":ie.duesFlow==="payable"?"bg-emerald-100 text-emerald-900 border-emerald-400 font-semibold":"bg-slate-50 text-slate-700 border-slate-200",children:ie.amountType}):"-"}),e.jsx(de,{children:ie.amount?e.jsxs("span",{className:`rounded-md px-2 py-0.5 font-semibold tabular-nums ${ie.duesFlow==="recovery"?"bg-red-100 text-red-800 ring-1 ring-red-300/70":ie.duesFlow==="payable"?"bg-emerald-100 text-emerald-800 ring-1 ring-emerald-300/70":"text-slate-700"}`,children:["₹",ie.amount.toLocaleString("en-IN")]}):"-"}),e.jsx(de,{children:ie.submittedDate||"-"}),e.jsx(de,{className:"max-w-xs truncate",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{children:ie.remarks||"-"}),ie.supportingDocument&&e.jsxs("button",{onClick:()=>g({fileName:`${ie.departmentName}_Proof`,filePath:ie.supportingDocument,documentType:"Departmental Clearance Proof"}),className:"flex items-center gap-1 text-[10px] text-amber-600 hover:underline",children:[e.jsx(qd,{className:"w-3 h-3"}),"View Proof"]})]})})]},ie.id))})]})})]}),e.jsx(Le,{className:"bg-blue-50 border-amber-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ks,{className:"w-5 h-5 text-amber-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-900 mb-1",children:"Department Response Guidelines"}),e.jsxs("ul",{className:"text-sm text-slate-700 space-y-1",children:[e.jsxs("li",{children:["• ",e.jsx("strong",{children:"NOC Submitted:"})," Department has no outstanding dues and provided clearance"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Dues Pending:"})," Department has identified amounts to be recovered or paid"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Pending:"})," Department has not yet responded to the F&F request"]})]})]})]})})})]}),e.jsxs(Gt,{value:"documents",className:"space-y-4",children:[e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-5 h-5"}),"Submitted Documents"]})}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-2",children:n.documents.map((ie,Fe)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded-lg border border-slate-200",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(fs,{className:"w-5 h-5 text-slate-400"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900",children:ie.name}),e.jsxs("p",{className:"text-sm text-slate-500",children:[ie.size," • ",ie.type," • Uploaded on ",ie.uploadedOn]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[ie.url&&ie.url!=="#"&&e.jsxs("button",{onClick:()=>g({fileName:ie.name,filePath:ie.url,documentType:ie.type}),className:"text-amber-600 hover:text-amber-700 text-[10px] font-semibold flex items-center gap-1",children:[e.jsx(qd,{className:"w-3 h-3"})," PREVIEW"]}),e.jsx(se,{variant:"outline",size:"sm",onClick:async()=>{if(ie.url&&ie.url!=="#")try{const pe=await(await fetch(ie.url)).blob(),Ne=window.URL.createObjectURL(pe),Ee=document.createElement("a");Ee.href=Ne,Ee.download=ie.name||"download",document.body.appendChild(Ee),Ee.click(),document.body.removeChild(Ee),window.URL.revokeObjectURL(Ne)}catch{const pe=document.createElement("a");pe.href=ie.url,pe.download=ie.name||"download",document.body.appendChild(pe),pe.click(),document.body.removeChild(pe)}else ee.error("Document URL not available")},children:"Download"})]})]},Fe))})})]}),e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(Dr,{className:"w-5 h-5"}),"Upload Settlement Verification Documents"]}),e.jsx(Zt,{children:"Upload bank receipts, settlement proofs, or any additional documents"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"border-2 border-dashed border-slate-300 rounded-lg p-8 text-center hover:border-amber-400 hover:bg-amber-50 transition-colors",children:[e.jsx(Dr,{className:"w-8 h-8 text-slate-400 mx-auto mb-2"}),e.jsx("p",{className:"text-slate-600 mb-2",children:"Click to upload or drag and drop"}),e.jsx("p",{className:"text-sm text-slate-500",children:"PDF, DOC, DOCX, PNG, JPG, XLSX (max 10MB)"}),e.jsx("input",{type:"file",multiple:!0,className:"hidden",id:"file-upload",onChange:ws,accept:".pdf,.doc,.docx,.png,.jpg,.jpeg,.xlsx,.xls"}),e.jsx("label",{htmlFor:"file-upload",children:e.jsx(se,{variant:"outline",className:"mt-4",asChild:!0,children:e.jsx("span",{children:"Choose Files"})})})]})})})]})]}),e.jsx(Gt,{value:"bank",className:"space-y-4",children:e.jsxs(Le,{children:[e.jsxs(tt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(Dc,{className:"w-5 h-5"}),"Dealer Bank Account Details"]}),e.jsx(Zt,{children:"Manage bank accounts for settlement transfer"})]}),e.jsxs(se,{size:"sm",className:"bg-amber-600",onClick:()=>{R(null),C(!0)},children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add Bank Account"]})]}),e.jsx(Me,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:y.length>0?y.map(ie=>e.jsxs(Le,{className:`relative ${ie.isPrimary?"border-amber-500 bg-blue-50/30":""}`,children:[ie.isPrimary&&e.jsx("div",{className:"absolute top-0 right-0 p-1 bg-amber-600 text-white text-[10px] uppercase font-bold px-2 rounded-bl",children:"Primary"}),e.jsx(Me,{className:"p-4 pt-6",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Account Holder"}),e.jsx("p",{className:"text-sm font-semibold",children:ie.accountHolderName})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Bank"}),e.jsx("p",{className:"text-xs truncate",children:ie.bankName})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-[10px] text-slate-500 uppercase font-bold",children:"IFSC"}),e.jsx("p",{className:"text-xs",children:ie.ifscCode})]})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Account Number"}),e.jsx("p",{className:"text-xs font-mono",children:ie.accountNumber})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-slate-100",children:[e.jsxs(se,{variant:"ghost",size:"sm",className:"h-7 text-[11px] text-amber-600",onClick:()=>{R(ie),C(!0)},children:[e.jsx(ur,{className:"w-3 h-3 mr-1"}),"Edit"]}),e.jsxs(se,{variant:"ghost",size:"sm",className:"h-7 text-[11px] text-red-600",onClick:()=>W(ie.id),children:[e.jsx(Gn,{className:"w-3 h-3 mr-1"}),"Delete"]})]})]})})]},ie.id)):e.jsxs("div",{className:"col-span-full py-12 text-center border-2 border-dashed rounded-lg bg-slate-50",children:[e.jsx(Dc,{className:"w-12 h-12 text-slate-300 mx-auto mb-3"}),e.jsx("p",{className:"text-slate-600 text-sm",children:"No bank details found"})]})})})]})})]})}),e.jsx("div",{className:"space-y-6",children:e.jsxs(Le,{className:"sticky top-6",children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(mu,{className:"w-5 h-5"}),"Settlement Verification"]}),e.jsx(Zt,{children:"Enter settlement transaction details"})]}),e.jsx(Me,{className:"space-y-4",children:n.status==="Completed"?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"p-4 bg-green-50 border border-green-200 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-3 text-green-700 mb-2",children:[e.jsx(Ys,{className:"w-5 h-5"}),e.jsx("span",{className:"font-semibold",children:"Settlement Completed"})]}),e.jsx("p",{className:"text-sm text-green-600",children:"This settlement has been finalized and processed."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[e.jsx("span",{className:"text-slate-500 text-sm",children:"Settlement Date"}),e.jsx("span",{className:"text-slate-900 font-medium",children:aa(ke.settlementDate)})]}),e.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[e.jsx("span",{className:"text-slate-500 text-sm",children:"Payment Mode"}),e.jsx("span",{className:"text-slate-900 font-medium",children:ke.paymentMode})]}),e.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[e.jsx("span",{className:"text-slate-500 text-sm",children:"Transaction ID"}),e.jsx("span",{className:"text-slate-900 font-medium truncate ml-4 max-w-[150px]",title:ke.verificationTransactionId,children:ke.verificationTransactionId})]}),e.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[e.jsx("span",{className:"text-slate-500 text-sm",children:"Final Amount"}),e.jsxs("span",{className:"text-slate-900 font-bold text-lg",children:["₹",parseFloat(ke.settlementAmount).toLocaleString()]})]})]}),ke.verificationRemarks&&e.jsxs("div",{className:"mt-4",children:[e.jsx(ce,{className:"text-slate-500 mb-1 block",children:"Finance Remarks"}),e.jsx("div",{className:"p-3 bg-slate-50 rounded border text-sm text-slate-700",children:ke.verificationRemarks})]}),e.jsxs(se,{variant:"outline",className:"w-full mt-4",onClick:()=>window.print(),children:[e.jsx(X5,{className:"w-4 h-4 mr-2"}),"Download Settlement Letter"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-slate-50 border border-slate-200 rounded-lg p-4 mb-4",children:[e.jsxs("p",{className:"text-sm font-bold text-slate-900 mb-3 flex items-center gap-2",children:[e.jsx(Ys,{className:"w-4 h-4 text-amber-600"}),"Compliance Checklist"]}),e.jsx("div",{className:"space-y-3",children:Qx.map(ie=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("input",{type:"checkbox",id:`check-${ie.id}`,checked:P.includes(ie.id),onChange:()=>z(ie.id),className:"w-4 h-4 mt-1 rounded border-slate-300 text-amber-600 focus:ring-amber-500"}),e.jsx("label",{htmlFor:`check-${ie.id}`,className:"text-sm text-slate-700 leading-tight",children:ie.label})]},ie.id))})]}),e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"paymentMode",children:["Payment Mode ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"paymentMode",placeholder:"e.g., NEFT, RTGS, Cheque",value:ke.paymentMode,onChange:ie=>qe({...ke,paymentMode:ie.target.value})})]}),e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"verificationTxnId",children:["Transaction ID / Reference ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"verificationTxnId",placeholder:"Enter transaction reference",value:ke.verificationTransactionId,onChange:ie=>qe({...ke,verificationTransactionId:ie.target.value})})]}),e.jsxs("div",{children:[e.jsx(ce,{htmlFor:"bankReference",children:"Bank Reference Number"}),e.jsx(ot,{id:"bankReference",placeholder:"Enter bank reference",value:ke.bankReference,onChange:ie=>qe({...ke,bankReference:ie.target.value})})]}),e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"settlementAmount",children:["Settlement Amount (₹) ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"settlementAmount",type:"number",placeholder:"Enter settlement amount",value:ke.settlementAmount,onChange:ie=>qe({...ke,settlementAmount:ie.target.value})})]}),e.jsxs("div",{children:[e.jsx(ce,{htmlFor:"adjustments",children:"Adjustments (₹)"}),e.jsx(ot,{id:"adjustments",type:"number",placeholder:"Enter any adjustments",value:ke.adjustments,onChange:ie=>{const Fe=ie.target.value,Q=be.settlementAmount+parseFloat(Fe||"0");qe({...ke,adjustments:Fe,settlementAmount:Q.toString()})}}),parseFloat(ke.adjustments)!==0&&e.jsxs("p",{className:"text-sm text-amber-600 mt-1 flex items-center gap-1",children:[e.jsx(Ks,{className:"w-3 h-3"}),"Adjusted amount: ₹",ke.settlementAmount]})]}),e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"settlementDate",children:["Settlement Date ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"settlementDate",type:"date",value:ke.settlementDate,onChange:ie=>qe({...ke,settlementDate:ie.target.value})})]}),e.jsxs("div",{children:[e.jsx(ce,{htmlFor:"verificationRemarks",children:"Verification Remarks"}),e.jsx(Fs,{id:"verificationRemarks",placeholder:"Enter any remarks or notes...",rows:4,value:ke.verificationRemarks,onChange:ie=>qe({...ke,verificationRemarks:ie.target.value})})]}),e.jsxs("div",{className:"pt-4 space-y-3 border-t",children:[e.jsxs(se,{className:"w-full bg-green-600 hover:bg-green-700",onClick:Cs,disabled:_s||P.length{C(!1),R(null)},onSubmit:Z,editingBank:w,isSubmitting:!1}),e.jsx(Kl,{isOpen:!!j,onClose:()=>g(null),document:j})]}):e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx("p",{children:"Settlement case not found"}),e.jsx(se,{onClick:s,className:"mt-4",children:"Go Back"})]})}const R$=()=>{const t=su(),s=v.useCallback(async()=>{try{t(HN(!0));const[r,a,l,c,d,h,x,f,m,p,u,j,g]=await Promise.all([Ss.getRoles().catch(()=>({success:!1})),Ss.getZones().catch(()=>({success:!1})),Ss.getPermissions().catch(()=>({success:!1})),Ss.getRegions().catch(()=>({success:!1})),Ss.getUsers().catch(()=>({success:!1})),Ss.getStates().catch(()=>({success:!1})),Ss.getEmailTemplates().catch(()=>({success:!1})),Ss.getDistricts({limit:"all"}).catch(()=>({success:!1})),Ss.getAreas({limit:"all"}).catch(()=>({success:!1})),Ss.getSlaConfigs().catch(()=>({success:!1})),Ss.getASMs().catch(()=>({success:!1})),Ss.getZonalManagers().catch(()=>({success:!1})),Ss.getDDLeads().catch(()=>({success:!1}))]),y=U=>U.success?U:U.data?U.data:U,N=y(r),S=y(a),C=y(l),w=y(c),R=y(d),P=y(h),A=y(x),I=y(f),$=y(m),T=y(p),E=y(u),_=y(j),M=y(g),q=((R==null?void 0:R.users)||(R==null?void 0:R.data)||[]).map(U=>{var ve;const X=Array.isArray(U.territoryProfile)?U.territoryProfile:[],ne=X.filter(Se=>String(Se.locationType||"").toLowerCase()==="zone").map(Se=>Se.locationName||Se.zone).filter(Boolean),oe=X.filter(Se=>String(Se.locationType||"").toLowerCase()==="region").map(Se=>Se.locationName||Se.region).filter(Boolean),re=Array.from(new Set([...U.allZones||[],...ne])),ge=Array.from(new Set([...U.allRegions||[],...oe]));return{...U,name:U.fullName||U.name,role:((ve=U.role)==null?void 0:ve.roleName)||(Array.isArray(U.allRoles)&&U.allRoles.length>0?U.allRoles[0]:"System User"),zone:re.length>0?re.join(", "):"Global",region:ge.length>0?ge.join(", "):"Unassigned",status:U.isActive!==!1?"Active":"Inactive"}}),G=((N==null?void 0:N.roles)||(N==null?void 0:N.data)||[]).map(U=>{var X;return{id:U.id,name:U.roleName,permissions:((X=U.permissions)==null?void 0:X.map(ne=>ne.permissionCode))||[],userCount:U.userCount||0}}),Z=((S==null?void 0:S.zones)||(S==null?void 0:S.data)||[]).map(U=>{var ne,oe,re,ge,ve;const X=(U.name||U.zoneName||"").toUpperCase();return{id:U.id,name:X,description:U.description||"",code:U.name?U.name.substring(0,3).toUpperCase():"ZON",regionCount:U.regionCount||0,asmCount:U.asmCount||0,regionalOfficerCount:U.regionalOfficerCount||0,zmCount:U.zmCount||0,states:U.states||[],zonalBusinessHead:{name:((ne=U.zonalBusinessHead)==null?void 0:ne.name)||((oe=U.zonalBusinessHead)==null?void 0:oe.fullName)||"Not Assigned",email:((re=U.zonalBusinessHead)==null?void 0:re.email)||"",phone:((ge=U.zonalBusinessHead)==null?void 0:ge.mobileNumber)||((ve=U.zonalBusinessHead)==null?void 0:ve.phone)||""},zonalManagers:(U.zonalManagers||[]).map(Se=>({id:Se.id,name:Se.name||Se.fullName||"Unknown",email:Se.email||"",phone:Se.phone||Se.mobileNumber||"",regions:Se.regions||[]}))}}),W=((w==null?void 0:w.regions)||(w==null?void 0:w.data)||[]).map(U=>({id:U.id,code:U.code||(U.name?U.name.substring(0,3).toUpperCase():"REG"),name:U.name||U.regionName,zoneId:U.zoneId,zoneName:U.zoneName||"Unknown",states:U.states||[],cities:U.cities||[],districts:(U.districts||[]).map(X=>({id:X.id,name:X.name,stateId:X.stateId})),asmCount:U.asmCount||0,regionalOfficerCount:U.regionalOfficerCount||0,regionalManager:U.regionalManager?{id:U.regionalManager.id,name:U.regionalManager.fullName||U.regionalManager.name,email:U.regionalManager.email,phone:U.regionalManager.mobileNumber||U.regionalManager.phone}:void 0,status:U.isActive!==!1?"Active":"Inactive"})),z=Array.isArray(E==null?void 0:E.data)?E.data:Array.isArray(E)?E:[],F=Array.isArray(_==null?void 0:_.data)?_.data:Array.isArray(_)?_:[],B=F.length>0?F:q.filter(U=>{var X;return(X=U.allRoles)==null?void 0:X.some(ne=>(ne==="ZM"||ne==="DD-ZM"||ne.includes("ZONAL MANAGER"))&&!ne.includes("HEAD"))}).map(U=>{const X=(U.territoryProfile||[]).find(re=>re.roleCode==="ZM"||re.roleCode==="DD-ZM")||{},ne=(U.territoryProfile||[]).filter(re=>(re.roleCode==="ZM"||re.roleCode==="DD-ZM")&&re.locationType==="region").map(re=>re.locationName),oe=(U.territoryProfile||[]).filter(re=>(re.roleCode==="ZM"||re.roleCode==="DD-ZM")&&re.locationType==="region").map(re=>re.locationId);return{id:U.id,name:U.fullName,zmCode:U.employeeId||"N/A",email:U.email,phone:U.mobileNumber,zoneId:X.zoneId,zoneName:X.zone||U.zone||"Not Assigned",regionNames:ne,assignedRegionIds:oe,status:U.status}}),D=((P==null?void 0:P.states)||(P==null?void 0:P.data)||[]).map(U=>({...U,stateName:U.name})),O=((I==null?void 0:I.districts)||(I==null?void 0:I.data)||[]).map(U=>({...U,districtName:U.name,stateId:U.stateId,asmId:U.asmId,ddAmId:U.ddAmId,zmId:U.zmId})),V=($.areas||$.data||[]).map(U=>({...U,areaName:U.name,districtId:U.districtId})),K=(T.data||[]).map(U=>{var X,ne;return{id:U.id,stage:U.stageCode||"Unknown",days:U.tatValue||0,enabled:U.isActive!==!1,reminders:((X=U.reminderConfig)==null?void 0:X.reminders)||[],escalations:((ne=U.escalationConfig)==null?void 0:ne.escalations)||[]}}),Y=Array.isArray(M==null?void 0:M.data)?M.data:Array.isArray(M)?M:[];t(s2({zones:Z,regionalOffices:W,asms:z,zonalManagerMappings:B,zonalManagers:F,roles:G,allStates:D,allDistricts:O,allAreas:V,availablePermissions:(C==null?void 0:C.permissions)||(C==null?void 0:C.data)||[],emailTemplates:(A==null?void 0:A.data)||[],slaConfigs:K,users:q,ddLeads:Y,loading:!1}))}catch(r){console.error("[useMasterData] Error fetching data:",r),t(BO("Could not load configuration data")),ee.error("Could not load configuration data")}finally{t(HN(!1))}},[t]),n=v.useCallback(async r=>{try{t(WN(!0));const a=await Ss.getAreas(r);a.success&&t($O({data:a.data,pagination:a.pagination}))}catch(a){console.error("[useMasterData] Error fetching areas:",a),ee.error("Could not load locations")}finally{t(WN(!1))}},[t]);return{fetchInitialData:s,fetchAreas:n}},E$=({selectedZone:t,onZoneClick:s})=>{const{zones:n}=Nn(r=>r.master);return e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:n.map(r=>e.jsxs(Le,{className:`border-2 transition-all cursor-pointer ${t===r.id?"border-amber-600 shadow-lg":"hover:border-amber-400"}`,onClick:()=>s(r.id),children:[e.jsx(tt,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Zd,{className:"w-5 h-5 text-amber-600"}),e.jsx(nt,{className:"text-lg",children:r.name.toUpperCase().endsWith("ZONE")?r.name:`${r.name} Zone`})]}),e.jsx(Ae,{variant:"outline",className:"text-xs",children:r.code})]})}),e.jsxs(Me,{className:"space-y-3 text-sm",children:[e.jsx("p",{className:"text-slate-600 text-xs leading-relaxed mb-3",children:r.description}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"States"}),e.jsx(Ae,{variant:"outline",children:r.states.length})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Regions"}),e.jsx(Ae,{className:"bg-indigo-600",children:r.regionCount})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Regional Officers"}),e.jsx(Ae,{className:"bg-purple-600",children:r.regionalOfficerCount})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"ASMs"}),e.jsx(Ae,{className:"bg-green-600",children:r.asmCount})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"ZMs"}),e.jsx(Ae,{className:"bg-blue-600",children:r.zmCount})]})]})]})]},r.id))})},D$=({selectedZone:t,onAddZone:s,onEditZone:n})=>{const{zones:r}=Nn(l=>l.master),a=r.filter(l=>t==="all"||l.id===t);return e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Zone Details"}),e.jsx(Zt,{children:"Geographical coverage and state mappings for each zone"})]}),e.jsxs(se,{onClick:s,className:"bg-amber-600 hover:bg-amber-700",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add Zone"]})]})}),e.jsx(Me,{children:e.jsx(kb,{className:"h-[400px]",children:e.jsx("div",{className:"space-y-4",children:a.map(l=>e.jsxs("div",{className:"border rounded-lg p-5 space-y-4 bg-gradient-to-br from-white to-slate-50",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-amber-500 to-amber-600 rounded-lg flex items-center justify-center shadow-md",children:e.jsx(Zd,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-slate-900",children:l.name}),e.jsx("p",{className:"text-slate-500 text-sm",children:l.code})]})]}),e.jsx("div",{className:"flex gap-2",children:e.jsx(se,{variant:"outline",size:"sm",onClick:()=>n(l),className:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",children:e.jsx(ur,{className:"w-4 h-4"})})})]}),l.description&&e.jsx("div",{className:"bg-slate-50 rounded-lg p-3",children:e.jsx("p",{className:"text-sm text-slate-600",children:l.description})}),e.jsxs("div",{children:[e.jsxs(ce,{className:"text-xs text-slate-600 mb-2 block",children:["States Covered (",l.states.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:l.states.map((c,d)=>e.jsx(Ae,{variant:"secondary",className:"text-xs border-transparent bg-secondary text-secondary-foreground",children:c},d))})]}),l.zonalBusinessHead&&e.jsxs("div",{className:"border-t pt-3",children:[e.jsx(ce,{className:"text-xs text-slate-600 mb-2 block",children:"Zonal Business Head (ZBH)"}),e.jsxs("div",{className:"bg-amber-50 border border-amber-100 rounded-lg p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vo,{className:"w-4 h-4 text-amber-600"}),e.jsx("span",{className:"text-sm font-semibold text-slate-900",children:l.zonalBusinessHead.name}),e.jsx(Ae,{className:"bg-amber-600 text-white text-[10px] ml-auto",children:"ZBH"})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-6 text-slate-600",children:[e.jsx(qr,{className:"w-3 h-3"}),e.jsx("span",{className:"text-xs",children:l.zonalBusinessHead.email})]})]})]}),l.zonalManagers&&l.zonalManagers.length>0&&e.jsxs("div",{className:"border-t pt-3",children:[e.jsxs(ce,{className:"text-xs text-slate-600 mb-2 block",children:["Zonal Managers (",l.zonalManagers.length,")"]}),e.jsx("div",{className:"space-y-2",children:l.zonalManagers.map((c,d)=>e.jsxs("div",{className:"bg-slate-50 rounded-lg p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(da,{className:"w-4 h-4 text-slate-600"}),e.jsx("span",{className:"text-sm text-slate-900",children:c.name}),e.jsxs(Ae,{variant:"outline",className:"text-xs ml-auto",children:["ZM-",d+1]})]}),c.email&&e.jsxs("div",{className:"flex items-center gap-2 ml-6",children:[e.jsx(qr,{className:"w-3 h-3 text-slate-400"}),e.jsx("span",{className:"text-xs text-slate-600",children:c.email})]}),c.phone&&e.jsx("div",{className:"flex items-center gap-2 ml-6",children:e.jsx("span",{className:"text-xs text-slate-600",children:c.phone})}),c.regions&&c.regions.length>0&&e.jsxs("div",{className:"ml-6 mt-2",children:[e.jsxs(ce,{className:"text-xs text-slate-500 mb-1 block",children:["Managed Regions (",c.regions.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:c.regions.map((h,x)=>e.jsxs(Ae,{variant:"outline",className:"text-xs bg-white text-foreground",children:[e.jsx(Zd,{className:"w-2.5 h-2.5 mr-1"}),h]},x))})]})]},d))})]})]},l.id))})})})]})},T$=({selectedZone:t,onAddRegion:s,onEditRegion:n,onDeleteRegion:r})=>{const{regionalOffices:a}=Nn(c=>c.master),l=a.filter(c=>t==="all"||c.zoneId===t);return e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Regional Offices"}),e.jsx(Zt,{children:"Manage regional offices within zones"})]}),e.jsxs(se,{onClick:s,className:"bg-amber-600 hover:bg-amber-700",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add Regional Office"]})]})}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Region Code"}),e.jsx(me,{children:"Region Name"}),e.jsx(me,{children:"Zone"}),e.jsx(me,{children:"Regional Manager"}),e.jsx(me,{children:"Districts"}),e.jsx(me,{children:"Cities"}),e.jsx(me,{children:"Regional Officers"}),e.jsx(me,{children:"ASMs"}),e.jsx(me,{children:"Status"}),e.jsx(me,{className:"text-right",children:"Actions"})]})}),e.jsx(Es,{children:l.map(c=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ml,{className:"w-4 h-4 text-indigo-600"}),e.jsx("span",{className:"font-medium",children:c.code})]})}),e.jsx(de,{className:"font-medium",children:c.name}),e.jsx(de,{children:c.zoneName}),e.jsx(de,{children:c.regionalManager?e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm",children:c.regionalManager.name}),e.jsx("span",{className:"text-xs text-slate-500",children:c.regionalManager.email})]}):e.jsx("span",{className:"text-slate-400 italic",children:"Not Assigned"})}),e.jsx(de,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(c.districts||[]).slice(0,2).map((d,h)=>e.jsx(Ae,{variant:"secondary",className:"text-xs",children:d.name||d},h)),(c.districts||[]).length>2&&e.jsxs(Ae,{variant:"secondary",className:"text-xs",children:["+",(c.districts||[]).length-2]})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[c.cities.slice(0,3).map((d,h)=>e.jsxs("span",{className:"text-xs text-slate-600",children:[d,h3&&e.jsxs("span",{className:"text-xs text-slate-500",children:["+",c.cities.length-3]})]})}),e.jsx(de,{children:e.jsx(Ae,{className:"bg-purple-600",children:c.regionalOfficerCount})}),e.jsx(de,{children:e.jsx(Ae,{className:"bg-green-600",children:c.asmCount})}),e.jsx(de,{children:e.jsx(Ae,{variant:c.status==="Active"?"default":"secondary",className:c.status==="Active"?"bg-emerald-100 text-emerald-700":"",children:c.status})}),e.jsx(de,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>n(c),children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>r(c.id,c.name),className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:e.jsx(Gn,{className:"w-4 h-4"})})]})})]},c.id))})]})})]})},P$=({selectedZone:t,onAddASM:s,onEditASM:n,onDeleteASM:r})=>{const{asms:a,zonalManagerMappings:l}=Nn(h=>h.master),c=a.filter(h=>t==="all"||h.zoneId===t),d=v.useMemo(()=>{const h={};return[...a,...l].forEach(x=>{(x.areasManaged||x.districts||[]).forEach(m=>{h[m]||(h[m]=[]),h[m].includes(x.name)||h[m].push(x.name)})}),h},[a,l]);return e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"District Development Area Managers (DD-AM)"}),e.jsx(Zt,{children:"Manage DD-AM users across districts (multi-district)"})]}),e.jsxs(se,{onClick:s,className:"bg-amber-600 hover:bg-amber-700",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add DD-AM"]})]})}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"DD-AM Code"}),e.jsx(me,{children:"Name"}),e.jsx(me,{children:"Zone"}),e.jsx(me,{children:"Region"}),e.jsx(me,{children:"Districts Managed"}),e.jsx(me,{children:"Contact"}),e.jsx(me,{children:"Status"}),e.jsx(me,{className:"text-right",children:"Actions"})]})}),e.jsx(Es,{children:c.map(h=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(vI,{className:"w-4 h-4 text-green-600"}),e.jsx("span",{className:"font-medium",children:h.asmCode||"N/A"})]})}),e.jsx(de,{children:h.name}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline",children:h.zoneName})}),e.jsx(de,{className:"text-sm text-slate-600",children:h.regionName}),e.jsx(de,{children:e.jsx("div",{className:"flex flex-wrap gap-1",children:h.areasManaged.map((x,f)=>{const m=typeof x=="string"?x:x.id,p=typeof x=="string"?x:x.name,u=(d[m]||[]).filter(g=>g!==h.name),j=u.length>0;return e.jsxs(Ae,{variant:j?"outline":"secondary",className:`text-xs ${j?"border-amber-300 bg-amber-50 text-amber-700 font-medium":""}`,title:j?`Also managed by: ${u.join(", ")}`:void 0,children:[p,j&&e.jsx(da,{className:"w-2.5 h-2.5 ml-1 inline"})]},f)})})}),e.jsx(de,{children:e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"text-slate-900",children:h.email}),e.jsx("p",{className:"text-slate-500",children:h.phone})]})}),e.jsx(de,{children:e.jsx(Ae,{variant:h.status==="Active"?"default":"secondary",className:h.status==="Active"?"bg-emerald-100 text-emerald-700":"",children:h.status})}),e.jsx(de,{className:"text-right",children:e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>n(h),children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>r(h.id,h.name),className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:e.jsx(Gn,{className:"w-4 h-4"})})]})})]},h.id))})]})})]})},_$=({selectedZone:t,onAddZM:s,onEditZM:n,onDeleteZM:r})=>{const{zonalManagers:a}=Nn(c=>c.master),l=(a||[]).filter(c=>t==="all"||c.zoneId===t||c.zones&&c.zones.includes(t));return e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Zonal Managers (DD-ZM)"}),e.jsx(Zt,{children:"Manage Zonal Managers and their region assignments"})]}),e.jsxs(se,{onClick:s,className:"bg-amber-600 hover:bg-amber-700",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add ZM"]})]})}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"ZM Code"}),e.jsx(me,{children:"Name"}),e.jsx(me,{children:"Zone"}),e.jsx(me,{children:"Regions Managed"}),e.jsx(me,{children:"Contact"}),e.jsx(me,{children:"Status"}),e.jsx(me,{className:"text-right",children:"Actions"})]})}),e.jsx(Es,{children:l.map(c=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(da,{className:"w-4 h-4 text-blue-600"}),e.jsx("span",{className:"font-medium",children:c.zmCode||c.code})]})}),e.jsx(de,{children:c.name}),e.jsx(de,{children:e.jsx("div",{className:"flex flex-wrap gap-1",children:(c.zones||[c.zoneName]).map((d,h)=>e.jsx(Ae,{variant:"outline",children:d},h))})}),e.jsx(de,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(c.regionNames||[]).slice(0,3).map((d,h)=>e.jsx(Ae,{variant:"secondary",className:"text-xs",children:d},h)),(c.regionNames||[]).length>3&&e.jsxs(Ae,{variant:"secondary",className:"text-xs",children:["+",(c.regionNames||[]).length-3]})]})}),e.jsx(de,{children:e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"text-slate-900",children:c.email}),e.jsx("p",{className:"text-slate-500",children:c.phone})]})}),e.jsx(de,{children:e.jsx(Ae,{variant:c.status==="Active"?"default":"secondary",className:c.status==="Active"?"bg-emerald-100 text-emerald-700":"",children:c.status})}),e.jsx(de,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>n(c),children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>r(c.id,c.name),className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:e.jsx(Gn,{className:"w-4 h-4"})})]})})]},c.id))})]})})]})},O$=({userAssignedData:t})=>e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsx(nt,{className:"text-xl",children:"System Users & Territory Assignments"})}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"User Details"}),e.jsx(me,{children:"Role"}),e.jsx(me,{children:"Assigned Zone"}),e.jsx(me,{children:"Assigned Region"}),e.jsx(me,{children:"Status"})]})}),e.jsx(Es,{children:t.map(s=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-slate-100 flex items-center justify-center",children:e.jsx(kr,{className:"w-4 h-4 text-slate-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:s.name}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[e.jsx(qr,{className:"w-3 h-3"}),s.email]})]})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vo,{className:"w-3 h-3 text-amber-600"}),e.jsx("span",{className:"text-sm font-medium",children:s.role})]})}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline",children:s.zone})}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline",className:"bg-indigo-50 text-indigo-700 border-indigo-200",children:s.region})}),e.jsx(de,{children:e.jsx(Ae,{variant:s.status==="Active"?"default":"secondary",className:s.status==="Active"?"bg-emerald-100 text-emerald-700":"",children:s.status})})]},s.id))})]})})]}),I$=({onAddRole:t,onEditRole:s})=>{const{roles:n}=Nn(r=>r.master);return e.jsxs(Le,{className:"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border shadow-sm",children:[e.jsx(tt,{className:"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 pt-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{children:[e.jsx(nt,{className:"leading-none text-xl font-bold",children:"Role Definitions"}),e.jsx(Zt,{className:"text-muted-foreground mt-1.5",children:"Overview of available roles and their access levels"})]}),e.jsxs(se,{onClick:t,className:"bg-amber-600 hover:bg-amber-700 h-9",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add Role"]})]})}),e.jsx(Me,{className:"px-6 [&:last-child]:pb-6",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:n.map(r=>{var a;return e.jsxs("div",{className:"border rounded-lg p-4 space-y-3 bg-gradient-to-br from-white to-slate-50 hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vo,{className:"w-5 h-5 text-amber-600"}),e.jsx("h3",{className:"text-slate-900 font-bold",children:r.name})]}),e.jsxs(Ae,{variant:"secondary",className:"border-transparent bg-secondary text-secondary-foreground text-xs font-medium",children:[r.userCount||0," users"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"items-center gap-2 font-medium text-xs text-slate-600 mb-2 block",children:"Key Permissions"}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(r.permissions||[]).slice(0,3).map((l,c)=>e.jsx(Ae,{variant:"outline",className:"border px-2 py-0.5 font-medium text-foreground text-[10px] bg-white/50",children:l.replace(/_/g," ").toLowerCase()},c)),((a=r.permissions)==null?void 0:a.length)>3&&e.jsxs(Ae,{variant:"outline",className:"text-[10px] border-slate-200",children:["+",r.permissions.length-3]})]})]}),e.jsxs(se,{variant:"outline",size:"sm",onClick:()=>s(r),className:"w-full mt-2 h-8 rounded-md gap-1.5 px-3 border bg-background text-foreground hover:bg-accent hover:text-accent-foreground transition-colors",title:"Edit Permissions",children:[e.jsx(ur,{className:"w-3 h-3 mr-1"}),"Edit Permissions"]})]},r.id)})})})]})},L$=({isOpen:t,onOpenChange:s,role:n,onSave:r})=>{const[a,l]=v.useState([]);v.useEffect(()=>{n&&l(n.permissions||[])},[n,t]);const c=h=>{l(x=>x.includes(h)?x.filter(f=>f!==h):[...x,h])};if(!n)return null;const d=[{title:"Action Permissions",color:"from-green-50 to-emerald-50 border-green-200",textColor:"text-green-900",permissions:[{id:"action:approve",label:"Approve Applications"},{id:"action:reject",label:"Reject Applications"},{id:"action:upload_docs",label:"Upload Documents"},{id:"action:request_changes",label:"Request Changes"},{id:"action:forward",label:"Forward to Others"},{id:"action:reassign",label:"Reassign Applications"},{id:"action:schedule_interview",label:"Schedule Interviews"},{id:"action:add_comments",label:"Add Comments/Notes"},{id:"action:rank_applicants",label:"Rank Applicants"},{id:"action:final_approval",label:"Final Approval"}]},{title:"View/Access Permissions",color:"from-blue-50 to-cyan-50 border-blue-200",textColor:"text-blue-900",permissions:[{id:"view:view_details",label:"Application Details"},{id:"view:view_financial",label:"Financial Information"},{id:"view:view_discussions",label:"Discussion Notes"},{id:"view:view_progress",label:"Progress Tracking"},{id:"view:view_audit",label:"Audit Logs"},{id:"view:view_documents",label:"All Documents"},{id:"view:view_personal",label:"Personal Information"},{id:"view:view_business",label:"Business Details"},{id:"view:view_reports",label:"Reports & Analytics"},{id:"view:view_history",label:"Application History"}]},{title:"Application Stage Access",color:"from-amber-50 to-orange-50 border-amber-200",textColor:"text-amber-900",permissions:[{id:"stage:initial_review",label:"Initial Review"},{id:"stage:field_verification",label:"Field Verification"},{id:"stage:level1_interview",label:"Level 1 Interview"},{id:"stage:level2_interview",label:"Level 2 Interview"},{id:"stage:ranking",label:"Ranking & Selection"},{id:"stage:legal_review",label:"Legal Review"},{id:"stage:financial_review",label:"Financial Review"},{id:"stage:final_approval",label:"Final Approval"},{id:"stage:payment",label:"Payment Verification"},{id:"stage:onboarding",label:"Onboarding"}]}];return e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"sm:max-w-lg max-w-3xl max-h-[90vh] overflow-y-auto p-0 gap-0 border-none shadow-2xl custom-scrollbar",children:[e.jsxs(ms,{className:"p-6 pb-2 space-y-2 text-left bg-white sticky top-0 z-10 border-b",children:[e.jsxs(us,{className:"text-xl font-bold tracking-tight",children:["Edit Role Permissions - ",n.name]}),e.jsxs(vs,{className:"text-slate-500 text-sm",children:["Configure default permissions for all users assigned to the ",n.name," role"]})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx("div",{className:"bg-gradient-to-br from-purple-50 to-indigo-50 rounded-xl p-5 border border-purple-100 shadow-sm",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-white rounded-xl shadow-sm flex items-center justify-center border border-purple-100",children:e.jsx(Vo,{className:"w-6 h-6 text-purple-600"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-bold text-slate-900",children:n.name}),e.jsxs("p",{className:"text-xs font-medium text-slate-500 uppercase tracking-widest",children:[n.userCount||0," users currently assigned"]})]})]}),e.jsx(Ae,{className:"bg-purple-600 hover:bg-purple-700 px-3 py-1 rounded-full text-[10px] font-bold tracking-wider uppercase",children:"Role Configuration"})]})}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("h4",{className:"text-sm font-bold text-slate-800 flex items-center gap-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-amber-500 rounded-full"}),"Configure Default Permissions"]}),e.jsx("div",{className:"space-y-4",children:d.map((h,x)=>e.jsxs("div",{className:`border rounded-xl p-5 bg-gradient-to-br ${h.color} shadow-sm transition-all hover:shadow-md`,children:[e.jsxs("h5",{className:`text-sm font-bold ${h.textColor} mb-4 flex items-center justify-between`,children:[h.title,e.jsxs("span",{className:"text-[10px] bg-white/50 px-2 py-0.5 rounded-full opacity-70 italic font-normal",children:["Section ",x+1]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-y-3 gap-x-6",children:h.permissions.map(f=>e.jsxs("div",{className:"flex items-center space-x-3 group cursor-pointer p-1 rounded-md hover:bg-white/40 transition-colors",children:[e.jsx(Rn,{id:`perm-${f.id}`,checked:a.includes(f.id),onCheckedChange:()=>c(f.id),className:"border-slate-300 data-[state=checked]:bg-purple-600 data-[state=checked]:border-purple-600"}),e.jsx("label",{htmlFor:`perm-${f.id}`,className:"text-sm font-medium text-slate-700 cursor-pointer group-hover:text-slate-900 transition-colors flex-1",children:f.label})]},f.id))})]},x))})]})]}),e.jsxs("div",{className:"flex gap-3 p-6 pt-4 border-t sticky bottom-0 bg-white/80 backdrop-blur-md z-10",children:[e.jsx(se,{variant:"ghost",onClick:()=>s(!1),className:"flex-1 h-11 font-bold text-slate-600 hover:bg-slate-100",children:"Cancel"}),e.jsxs(se,{onClick:()=>r(n.id,a),className:"flex-1 h-11 bg-purple-600 hover:bg-purple-700 font-bold text-white shadow-lg shadow-purple-200",children:[e.jsx(Yi,{className:"w-4 h-4 mr-2"}),"Save Role Permissions"]})]})]})})},M$=({isOpen:t,onOpenChange:s,onSave:n})=>{const[r,a]=v.useState(""),[l,c]=v.useState(""),[d,h]=v.useState(""),[x,f]=v.useState(!1);v.useEffect(()=>{t&&(a(""),c(""),h(""),f(!1))},[t]);const m=async()=>{if(!(!r.trim()||!l.trim())){f(!0);try{await n({roleName:r.trim(),roleCode:l.trim(),description:d.trim()||void 0}),s(!1)}finally{f(!1)}}};return e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"sm:max-w-md",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Add Role"}),e.jsx(vs,{children:"Create a new role for Master Configuration."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"role-name",children:"Role Name"}),e.jsx(ot,{id:"role-name",value:r,onChange:p=>a(p.target.value),placeholder:"e.g. Finance Admin"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"role-code",children:"Role Code"}),e.jsx(ot,{id:"role-code",value:l,onChange:p=>c(p.target.value),placeholder:"e.g. FINANCE_ADMIN"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"role-description",children:"Description"}),e.jsx(Fs,{id:"role-description",value:d,onChange:p=>h(p.target.value),placeholder:"Optional",rows:3})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(se,{variant:"outline",onClick:()=>s(!1),disabled:x,children:"Cancel"}),e.jsx(se,{onClick:m,disabled:x||!r.trim()||!l.trim(),children:x?"Saving...":"Create Role"})]})]})})},F$=({onEditTemplate:t,onDeleteTemplate:s})=>{const{emailTemplates:n}=Nn(r=>r.master);return e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs("div",{children:[e.jsx(nt,{children:"Email & Letter Templates"}),e.jsx(Zt,{children:"Templates and trigger codes come from system seed data. Edit wording and layout here; new triggers are not added from this screen."})]})}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Template Name"}),e.jsx(me,{children:"Subject"}),e.jsx(me,{children:"Trigger Code"}),e.jsx(me,{children:"Modified Date"}),e.jsx(me,{className:"text-right",children:"Actions"})]})}),e.jsxs(Es,{children:[n.map(r=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-amber-50 rounded-lg flex items-center justify-center",children:e.jsx(qr,{className:"w-4 h-4 text-amber-600"})}),e.jsx("span",{className:"font-medium text-slate-900",children:r.name||r.templateCode})]})}),e.jsx(de,{className:"text-slate-600 max-w-xs truncate",children:r.subject}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline",className:"bg-slate-50 text-[10px] font-mono",children:r.templateCode||"-"})}),e.jsx(de,{className:"text-slate-500 text-sm",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx($n,{className:"w-3.5 h-3.5"}),r.updatedAt?Ht(r.updatedAt):"-"]})}),e.jsx(de,{className:"text-right",children:e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>t(r),children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>s(r.id),className:"text-red-500 hover:text-red-600 hover:bg-red-50",children:e.jsx(Gn,{className:"w-4 h-4"})})]})})]},r.id)),n.length===0&&e.jsx(ct,{children:e.jsx(de,{colSpan:5,className:"text-center py-12",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(qr,{className:"w-8 h-8 text-slate-200"}),e.jsx("p",{className:"text-slate-400 text-sm",children:"No templates configured yet"})]})})})]})]})})]})},B$=({onAddLocation:t,onEditLocation:s,onDeleteLocation:n,onSearch:r,onPageChange:a,searchTerm:l,states:c,stateFilter:d,onStateFilterChange:h,statusFilter:x,onStatusFilterChange:f})=>{const{allAreas:m,areasPagination:p,isAreasLoading:u}=Nn(j=>j.master);return e.jsx("div",{className:"space-y-4",children:e.jsxs(Le,{children:[e.jsx(tt,{children:e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Dealership Locations"}),e.jsxs(Zt,{children:["Manage ",p.total," geographical locations and their operational status"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Zd,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx("input",{type:"text",placeholder:"Search locations...",value:l,onChange:j=>r(j.target.value),className:"pl-9 pr-4 py-2 bg-slate-50 border border-slate-200 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-amber-500 w-64 transition-all"})]}),e.jsxs(wt,{value:d,onValueChange:h,children:[e.jsx(Ct,{className:"w-48",children:e.jsx(St,{placeholder:"All States"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All States"}),c.map(j=>e.jsx(Pe,{value:j.id,children:j.name||j.stateName},j.id))]})]}),e.jsxs(wt,{value:x,onValueChange:f,children:[e.jsx(Ct,{className:"w-44",children:e.jsx(St,{placeholder:"Opportunity Filter"})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"all",children:"All Opportunities"}),e.jsx(Pe,{value:"active",children:"Opportunity: Yes"}),e.jsx(Pe,{value:"inactive",children:"Opportunity: No"})]})]}),e.jsxs(se,{onClick:t,className:"bg-amber-600 hover:bg-amber-700 whitespace-nowrap",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add Location"]})]})]})}),e.jsxs(Me,{children:[e.jsxs("div",{className:`relative ${u?"opacity-50 pointer-events-none":""}`,children:[e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"State"}),e.jsx(me,{children:"City"}),e.jsx(me,{children:"District"}),e.jsx(me,{children:"Active Period"}),e.jsx(me,{children:"Opportunity"}),e.jsx(me,{className:"text-right",children:"Actions"})]})}),e.jsx(Es,{children:m.length===0?e.jsx(ct,{children:e.jsx(de,{colSpan:6,className:"h-32 text-center text-slate-500 italic",children:l?"No locations found matching your search":"No locations available"})}):m.map(j=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Er,{className:"w-4 h-4 text-amber-600"}),e.jsx("span",{className:"font-medium",children:j.stateName||"N/A"})]})}),e.jsx(de,{className:"font-medium text-slate-900",children:j.city||"N/A"}),e.jsx(de,{className:"text-slate-600 text-sm",children:j.name}),e.jsx(de,{children:j.openFrom&&j.openTo?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-slate-600",children:"From:"}),e.jsx(Ae,{variant:"outline",className:"text-xs font-medium",children:Ht(j.openFrom)})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-slate-600",children:"To:"}),e.jsx(Ae,{variant:"outline",className:"text-xs font-medium",children:Ht(j.openTo)})]})]}):e.jsx("span",{className:"text-slate-400 italic text-sm",children:"Not Defined"})}),e.jsx(de,{children:e.jsx(Ae,{variant:j.isOpportunity?"default":"secondary",className:j.isOpportunity?"bg-green-600 hover:bg-green-700 text-white border-transparent":"",children:j.isOpportunity?"Yes":"No"})}),e.jsx(de,{className:"text-right",children:e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(se,{variant:"outline",size:"sm",onClick:()=>s(j),className:"h-8 w-8 p-0",children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{variant:"outline",size:"sm",onClick:()=>n(j.id),className:"h-8 w-8 p-0 text-red-600 hover:bg-red-50 hover:text-red-700",children:e.jsx(Gn,{className:"w-4 h-4"})})]})})]},j.id))})]}),u&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-white/10 backdrop-blur-[1px]",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-amber-600"})})]}),p.totalPages>1&&e.jsxs("div",{className:"flex items-center justify-between mt-6 pt-4 border-t border-slate-100",children:[e.jsxs("div",{className:"text-sm text-slate-500",children:["Showing ",e.jsx("span",{className:"font-medium text-slate-900",children:(p.page-1)*p.limit+1})," to ",e.jsx("span",{className:"font-medium text-slate-900",children:Math.min(p.page*p.limit,p.total)})," of ",e.jsx("span",{className:"font-medium text-slate-900",children:p.total})," results"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{variant:"outline",size:"sm",onClick:()=>a(p.page-1),disabled:p.page<=1||u,className:"h-8",children:"Previous"}),e.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,p.totalPages)},(j,g)=>{let y=p.page;return p.page<=3?y=g+1:p.page>=p.totalPages-2?y=p.totalPages-4+g:y=p.page-2+g,y<=0||y>p.totalPages?null:e.jsx(se,{variant:p.page===y?"default":"outline",size:"sm",onClick:()=>a(y),disabled:u,className:"h-8 w-8 p-0",children:y},y)})}),e.jsx(se,{variant:"outline",size:"sm",onClick:()=>a(p.page+1),disabled:p.page>=p.totalPages||u,className:"h-8",children:"Next"})]})]})]})]})})};var $$=Symbol("radix.slottable");function q$(t){const s=({children:n})=>e.jsx(e.Fragment,{children:n});return s.displayName=`${t}.Slottable`,s.__radixId=$$,s}var[wf]=ea("Tooltip",[Vl]),Sf=Vl(),pE="TooltipProvider",z$=700,Cv="tooltip.open",[U$,qb]=wf(pE),xE=t=>{const{__scopeTooltip:s,delayDuration:n=z$,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:l}=t,c=v.useRef(!0),d=v.useRef(!1),h=v.useRef(0);return v.useEffect(()=>{const x=h.current;return()=>window.clearTimeout(x)},[]),e.jsx(U$,{scope:s,isOpenDelayedRef:c,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(h.current),c.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>c.current=!0,r)},[r]),isPointerInTransitRef:d,onPointerInTransitChange:v.useCallback(x=>{d.current=x},[]),disableHoverableContent:a,children:l})};xE.displayName=pE;var tu="Tooltip",[V$,Su]=wf(tu),gE=t=>{const{__scopeTooltip:s,children:n,open:r,defaultOpen:a,onOpenChange:l,disableHoverableContent:c,delayDuration:d}=t,h=qb(tu,t.__scopeTooltip),x=Sf(s),[f,m]=v.useState(null),p=hr(),u=v.useRef(0),j=c??h.disableHoverableContent,g=d??h.delayDuration,y=v.useRef(!1),[N,S]=bi({prop:r,defaultProp:a??!1,onChange:A=>{A?(h.onOpen(),document.dispatchEvent(new CustomEvent(Cv))):h.onClose(),l==null||l(A)},caller:tu}),C=v.useMemo(()=>N?y.current?"delayed-open":"instant-open":"closed",[N]),w=v.useCallback(()=>{window.clearTimeout(u.current),u.current=0,y.current=!1,S(!0)},[S]),R=v.useCallback(()=>{window.clearTimeout(u.current),u.current=0,S(!1)},[S]),P=v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>{y.current=!0,S(!0),u.current=0},g)},[g,S]);return v.useEffect(()=>()=>{u.current&&(window.clearTimeout(u.current),u.current=0)},[]),e.jsx(sf,{...x,children:e.jsx(V$,{scope:s,contentId:p,open:N,stateAttribute:C,trigger:f,onTriggerChange:m,onTriggerEnter:v.useCallback(()=>{h.isOpenDelayedRef.current?P():w()},[h.isOpenDelayedRef,P,w]),onTriggerLeave:v.useCallback(()=>{j?R():(window.clearTimeout(u.current),u.current=0)},[R,j]),onOpen:w,onClose:R,disableHoverableContent:j,children:n})})};gE.displayName=tu;var Av="TooltipTrigger",vE=v.forwardRef((t,s)=>{const{__scopeTooltip:n,...r}=t,a=Su(Av,n),l=qb(Av,n),c=Sf(n),d=v.useRef(null),h=Ms(s,d,a.onTriggerChange),x=v.useRef(!1),f=v.useRef(!1),m=v.useCallback(()=>x.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),e.jsx(vu,{asChild:!0,...c,children:e.jsx(ps.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:h,onPointerMove:Vt(t.onPointerMove,p=>{p.pointerType!=="touch"&&!f.current&&!l.isPointerInTransitRef.current&&(a.onTriggerEnter(),f.current=!0)}),onPointerLeave:Vt(t.onPointerLeave,()=>{a.onTriggerLeave(),f.current=!1}),onPointerDown:Vt(t.onPointerDown,()=>{a.open&&a.onClose(),x.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Vt(t.onFocus,()=>{x.current||a.onOpen()}),onBlur:Vt(t.onBlur,a.onClose),onClick:Vt(t.onClick,a.onClose)})})});vE.displayName=Av;var zb="TooltipPortal",[H$,W$]=wf(zb,{forceMount:void 0}),bE=t=>{const{__scopeTooltip:s,forceMount:n,children:r,container:a}=t,l=Su(zb,s);return e.jsx(H$,{scope:s,forceMount:n,children:e.jsx(mr,{present:n||l.open,children:e.jsx(Hc,{asChild:!0,container:a,children:r})})})};bE.displayName=zb;var Oc="TooltipContent",yE=v.forwardRef((t,s)=>{const n=W$(Oc,t.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...l}=t,c=Su(Oc,t.__scopeTooltip);return e.jsx(mr,{present:r||c.open,children:c.disableHoverableContent?e.jsx(jE,{side:a,...l,ref:s}):e.jsx(G$,{side:a,...l,ref:s})})}),G$=v.forwardRef((t,s)=>{const n=Su(Oc,t.__scopeTooltip),r=qb(Oc,t.__scopeTooltip),a=v.useRef(null),l=Ms(s,a),[c,d]=v.useState(null),{trigger:h,onClose:x}=n,f=a.current,{onPointerInTransitChange:m}=r,p=v.useCallback(()=>{d(null),m(!1)},[m]),u=v.useCallback((j,g)=>{const y=j.currentTarget,N={x:j.clientX,y:j.clientY},S=Q$(N,y.getBoundingClientRect()),C=X$(N,S),w=J$(g.getBoundingClientRect()),R=tq([...C,...w]);d(R),m(!0)},[m]);return v.useEffect(()=>()=>p(),[p]),v.useEffect(()=>{if(h&&f){const j=y=>u(y,f),g=y=>u(y,h);return h.addEventListener("pointerleave",j),f.addEventListener("pointerleave",g),()=>{h.removeEventListener("pointerleave",j),f.removeEventListener("pointerleave",g)}}},[h,f,u,p]),v.useEffect(()=>{if(c){const j=g=>{const y=g.target,N={x:g.clientX,y:g.clientY},S=(h==null?void 0:h.contains(y))||(f==null?void 0:f.contains(y)),C=!eq(N,c);S?p():C&&(p(),x())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[h,f,c,x,p]),e.jsx(jE,{...t,ref:l})}),[K$,Y$]=wf(tu,{isInside:!1}),Z$=q$("TooltipContent"),jE=v.forwardRef((t,s)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:l,onPointerDownOutside:c,...d}=t,h=Su(Oc,n),x=Sf(n),{onClose:f}=h;return v.useEffect(()=>(document.addEventListener(Cv,f),()=>document.removeEventListener(Cv,f)),[f]),v.useEffect(()=>{if(h.trigger){const m=p=>{const u=p.target;u!=null&&u.contains(h.trigger)&&f()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[h.trigger,f]),e.jsx(zc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:m=>m.preventDefault(),onDismiss:f,children:e.jsxs(nf,{"data-state":h.stateAttribute,...x,...d,ref:s,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[e.jsx(Z$,{children:r}),e.jsx(K$,{scope:n,isInside:!0,children:e.jsx(cB,{id:h.contentId,role:"tooltip",children:a||r})})]})})});yE.displayName=Oc;var NE="TooltipArrow",wE=v.forwardRef((t,s)=>{const{__scopeTooltip:n,...r}=t,a=Sf(n);return Y$(NE,n).isInside?null:e.jsx(rf,{...a,...r,ref:s})});wE.displayName=NE;function Q$(t,s){const n=Math.abs(s.top-t.y),r=Math.abs(s.bottom-t.y),a=Math.abs(s.right-t.x),l=Math.abs(s.left-t.x);switch(Math.min(n,r,a,l)){case l:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function X$(t,s,n=5){const r=[];switch(s){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function J$(t){const{top:s,right:n,bottom:r,left:a}=t;return[{x:a,y:s},{x:n,y:s},{x:n,y:r},{x:a,y:r}]}function eq(t,s){const{x:n,y:r}=t;let a=!1;for(let l=0,c=s.length-1;lr!=p>r&&n<(m-x)*(r-f)/(p-f)+x&&(a=!a)}return a}function tq(t){const s=t.slice();return s.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),sq(s)}function sq(t){if(t.length<=1)return t.slice();const s=[];for(let r=0;r=2;){const l=s[s.length-1],c=s[s.length-2];if((l.x-c.x)*(a.y-c.y)>=(l.y-c.y)*(a.x-c.x))s.pop();else break}s.push(a)}s.pop();const n=[];for(let r=t.length-1;r>=0;r--){const a=t[r];for(;n.length>=2;){const l=n[n.length-1],c=n[n.length-2];if((l.x-c.x)*(a.y-c.y)>=(l.y-c.y)*(a.x-c.x))n.pop();else break}n.push(a)}return n.pop(),s.length===1&&n.length===1&&s[0].x===n[0].x&&s[0].y===n[0].y?s:s.concat(n)}var nq=xE,rq=gE,aq=vE,iq=bE,lq=yE,oq=wE;function Cf({delayDuration:t=0,...s}){return e.jsx(nq,{"data-slot":"tooltip-provider",delayDuration:t,...s})}function Ub({...t}){return e.jsx(Cf,{children:e.jsx(rq,{"data-slot":"tooltip",...t})})}function Vb({...t}){return e.jsx(aq,{"data-slot":"tooltip-trigger",...t})}function Hb({className:t,sideOffset:s=0,children:n,...r}){return e.jsx(iq,{children:e.jsxs(lq,{"data-slot":"tooltip-content",sideOffset:s,className:Pt("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...r,children:[n,e.jsx(oq,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const cq=({isOpen:t,onOpenChange:s,editingASMId:n,asmManagerId:r,setAsmManagerId:a,asmStatus:l,setAsmStatus:c,selectedASMZone:d,setSelectedASMZone:h,selectedASMRegion:x,setSelectedASMRegion:f,selectedASMStates:m,setSelectedASMStates:p,selectedASMDistricts:u,setSelectedASMDistricts:j,onSave:g,asmRoleCode:y,userAssignedData:N,districtsAssignedToOthers:S,getDistrictsForSelectedState:C})=>{const{zones:w,regionalOffices:R}=Nn(A=>A.master),P=N.filter(A=>{const I=(A.allRoles||[]).map(T=>String(T||"").toUpperCase()),$=String(A.roleCode||"").toUpperCase();return I.includes("DD-AM")||$==="DD-AM"});return gt.useEffect(()=>{if(r&&t){const A=N.find(I=>I.id===r);if(A&&A.territoryProfile){const I=A.territoryProfile.filter($=>$.roleCode===y&&$.locationType==="district").map($=>$.locationId);I.length>0&&j(I)}}},[r,y,t,N,j]),e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsxs(us,{children:[n?"Edit":"Add"," DD Area Manager"]}),e.jsx(vs,{children:"Configure DD-AM details and district assignment"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Zone"}),e.jsxs(wt,{value:d,onValueChange:A=>{h(A),f(""),p([]),j([])},children:[e.jsx(Ct,{className:"mt-2 text-slate-900",children:e.jsx(St,{placeholder:"Select zone"})}),e.jsx(At,{children:w.map(A=>e.jsx(Pe,{value:A.id,children:A.name},A.id))})]})]}),d&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Regional Office"}),e.jsxs(wt,{value:x,onValueChange:A=>{f(A),p([]),j([])},children:[e.jsx(Ct,{className:"mt-2 text-slate-900",children:e.jsx(St,{placeholder:"Select regional office"})}),e.jsx(At,{children:R.filter(A=>A.zoneId===d).map(A=>e.jsx(Pe,{value:A.id,children:A.name},A.id))})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Select DD-AM User"}),e.jsxs(wt,{value:r,onValueChange:a,children:[e.jsx(Ct,{className:"mt-2 text-slate-900",children:e.jsx(St,{placeholder:"Select DD-AM"})}),e.jsx(At,{className:"max-h-64",children:P.map(A=>e.jsxs(Pe,{value:A.id,children:[A.name," (",A.employeeId||"No ID",")"]},A.id))})]})]})]}),x&&e.jsxs("div",{children:[e.jsx(ce,{children:"States Covered"}),e.jsx("div",{className:"mt-2 border rounded-lg p-3 max-h-48 overflow-y-auto bg-slate-50",children:(()=>{const A=R.find($=>$.id===x),I=((A==null?void 0:A.states)||[]).map($=>typeof $=="string"?$:$.name);return I.length>0?e.jsx("div",{className:"space-y-2",children:I.map($=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Rn,{id:`asm-state-${$}`,checked:m.some(T=>T.toLowerCase()===$.toLowerCase()),onCheckedChange:T=>{if(T)p([...m,$]);else{p(m.filter(_=>_.toLowerCase()!==$.toLowerCase()));const E=C($);j(u.filter(_=>!E.some(M=>M.id===_)))}}}),e.jsx("label",{htmlFor:`asm-state-${$}`,className:"text-sm cursor-pointer text-slate-900",children:$})]},$))}):e.jsx("p",{className:"text-sm text-slate-500",children:"No states available for this regional office"})})()})]}),m.length>0&&e.jsxs("div",{children:[e.jsx(ce,{children:"Districts/Cities Covered"}),e.jsx("div",{className:"mt-2 border rounded-lg p-3 max-h-64 overflow-y-auto bg-slate-50",children:e.jsx(Cf,{children:m.map(A=>{const I=C(A);return I.length===0?null:e.jsxs("div",{className:"mb-4 last:mb-0",children:[e.jsx("h4",{className:"text-sm text-amber-700 mb-2 pb-1 border-b border-slate-200",children:A}),e.jsx("div",{className:"space-y-2 ml-2",children:I.map($=>e.jsx("div",{children:e.jsxs(Ub,{children:[e.jsx(Vb,{asChild:!0,children:e.jsxs("div",{className:"flex items-center space-x-2 py-0.5",children:[e.jsx(Rn,{id:`asm-district-${$.id}`,checked:u.includes($.id),disabled:!!S[$.id],onCheckedChange:T=>{j(T?[...u,$.id]:u.filter(E=>E!==$.id))}}),e.jsx("label",{htmlFor:`asm-district-${$.id}`,className:`text-sm flex items-center gap-1.5 ${S[$.id]?"text-slate-400 cursor-not-allowed":"cursor-pointer text-slate-900"}`,children:$.name})]})}),S[$.id]&&e.jsx(Hb,{children:e.jsxs("p",{children:["Already managed by: ",S[$.id].join(", ")]})})]})},$.id))})]},A)})})})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsxs(ce,{children:["DD Area Manager ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:r,onValueChange:A=>{var $;a(A);const I=N.find(T=>T.id===A);if(I){const T=(I.territoryProfile||[]).find(E=>E.roleCode===y);T!=null&&T.zoneId&&h(T.zoneId),T!=null&&T.regionId&&f(T.regionId),j((($=I.areasManaged)==null?void 0:$.filter(E=>E.roleCode===y).map(E=>E.id))||[]),p(I.stateNames||[])}},disabled:!!n,children:[e.jsx(Ct,{className:"mt-2 w-full text-slate-900",children:e.jsx(St,{placeholder:"Select DD-AM User"})}),e.jsx(At,{className:"max-h-60",children:P.length>0?P.map(A=>e.jsx(Pe,{value:A.id,children:e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx("span",{className:"font-medium text-slate-900",children:A.name}),e.jsx("span",{className:"text-xs text-slate-500",children:A.email})]})},A.id)):e.jsx("div",{className:"p-2 text-sm text-slate-500 text-center",children:"No users available"})})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Status"}),e.jsxs(wt,{value:l,onValueChange:A=>c(A),children:[e.jsx(Ct,{className:"mt-2 text-slate-900",children:e.jsx(St,{})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"active",children:"Active"}),e.jsx(Pe,{value:"inactive",children:"Inactive"})]})]})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>s(!1),children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-amber-600 hover:bg-amber-700",onClick:g,children:"Save DD-AM"})]})]})]})})};function dq(t){const s=uq(t),n=v.forwardRef((r,a)=>{const{children:l,...c}=r,d=v.Children.toArray(l),h=d.find(mq);if(h){const x=h.props.children,f=d.map(m=>m===h?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:m);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}function uq(t){const s=v.forwardRef((n,r)=>{const{children:a,...l}=n;if(v.isValidElement(a)){const c=pq(a),d=fq(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var hq=Symbol("radix.slottable");function mq(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===hq}function fq(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const h=l(...d);return a(...d),h}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function pq(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Af="Popover",[SE]=ea(Af,[Vl]),Cu=Vl(),[xq,eo]=SE(Af),CE=t=>{const{__scopePopover:s,children:n,open:r,defaultOpen:a,onOpenChange:l,modal:c=!1}=t,d=Cu(s),h=v.useRef(null),[x,f]=v.useState(!1),[m,p]=bi({prop:r,defaultProp:a??!1,onChange:l,caller:Af});return e.jsx(sf,{...d,children:e.jsx(xq,{scope:s,contentId:hr(),triggerRef:h,open:m,onOpenChange:p,onOpenToggle:v.useCallback(()=>p(u=>!u),[p]),hasCustomAnchor:x,onCustomAnchorAdd:v.useCallback(()=>f(!0),[]),onCustomAnchorRemove:v.useCallback(()=>f(!1),[]),modal:c,children:n})})};CE.displayName=Af;var AE="PopoverAnchor",gq=v.forwardRef((t,s)=>{const{__scopePopover:n,...r}=t,a=eo(AE,n),l=Cu(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:d}=a;return v.useEffect(()=>(c(),()=>d()),[c,d]),e.jsx(vu,{...l,...r,ref:s})});gq.displayName=AE;var kE="PopoverTrigger",RE=v.forwardRef((t,s)=>{const{__scopePopover:n,...r}=t,a=eo(kE,n),l=Cu(n),c=Ms(s,a.triggerRef),d=e.jsx(ps.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":_E(a.open),...r,ref:c,onClick:Vt(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?d:e.jsx(vu,{asChild:!0,...l,children:d})});RE.displayName=kE;var Wb="PopoverPortal",[vq,bq]=SE(Wb,{forceMount:void 0}),EE=t=>{const{__scopePopover:s,forceMount:n,children:r,container:a}=t,l=eo(Wb,s);return e.jsx(vq,{scope:s,forceMount:n,children:e.jsx(mr,{present:n||l.open,children:e.jsx(Hc,{asChild:!0,container:a,children:r})})})};EE.displayName=Wb;var Ic="PopoverContent",DE=v.forwardRef((t,s)=>{const n=bq(Ic,t.__scopePopover),{forceMount:r=n.forceMount,...a}=t,l=eo(Ic,t.__scopePopover);return e.jsx(mr,{present:r||l.open,children:l.modal?e.jsx(jq,{...a,ref:s}):e.jsx(Nq,{...a,ref:s})})});DE.displayName=Ic;var yq=dq("PopoverContent.RemoveScroll"),jq=v.forwardRef((t,s)=>{const n=eo(Ic,t.__scopePopover),r=v.useRef(null),a=Ms(s,r),l=v.useRef(!1);return v.useEffect(()=>{const c=r.current;if(c)return lf(c)},[]),e.jsx(yu,{as:yq,allowPinchZoom:!0,children:e.jsx(TE,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Vt(t.onCloseAutoFocus,c=>{var d;c.preventDefault(),l.current||(d=n.triggerRef.current)==null||d.focus()}),onPointerDownOutside:Vt(t.onPointerDownOutside,c=>{const d=c.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0,x=d.button===2||h;l.current=x},{checkForDefaultPrevented:!1}),onFocusOutside:Vt(t.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),Nq=v.forwardRef((t,s)=>{const n=eo(Ic,t.__scopePopover),r=v.useRef(!1),a=v.useRef(!1);return e.jsx(TE,{...t,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,d;(c=t.onCloseAutoFocus)==null||c.call(t,l),l.defaultPrevented||(r.current||(d=n.triggerRef.current)==null||d.focus(),l.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:l=>{var h,x;(h=t.onInteractOutside)==null||h.call(t,l),l.defaultPrevented||(r.current=!0,l.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=l.target;((x=n.triggerRef.current)==null?void 0:x.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&a.current&&l.preventDefault()}})}),TE=v.forwardRef((t,s)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:x,onInteractOutside:f,...m}=t,p=eo(Ic,n),u=Cu(n);return Qm(),e.jsx(xu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:l,children:e.jsx(zc,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:f,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:x,onDismiss:()=>p.onOpenChange(!1),children:e.jsx(nf,{"data-state":_E(p.open),role:"dialog",id:p.contentId,...u,...m,ref:s,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),PE="PopoverClose",wq=v.forwardRef((t,s)=>{const{__scopePopover:n,...r}=t,a=eo(PE,n);return e.jsx(ps.button,{type:"button",...r,ref:s,onClick:Vt(t.onClick,()=>a.onOpenChange(!1))})});wq.displayName=PE;var Sq="PopoverArrow",Cq=v.forwardRef((t,s)=>{const{__scopePopover:n,...r}=t,a=Cu(n);return e.jsx(rf,{...a,...r,ref:s})});Cq.displayName=Sq;function _E(t){return t?"open":"closed"}var Aq=CE,kq=RE,Rq=EE,Eq=DE;function Dq({...t}){return e.jsx(Aq,{"data-slot":"popover",...t})}function Tq({...t}){return e.jsx(kq,{"data-slot":"popover-trigger",...t})}function Pq({className:t,align:s="center",sideOffset:n=4,...r}){return e.jsx(Rq,{children:e.jsx(Eq,{"data-slot":"popover-content",align:s,sideOffset:n,className:Pt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...r})})}var p1=1,_q=.9,Oq=.8,Iq=.17,Xx=.1,Jx=.999,Lq=.9999,Mq=.99,Fq=/[\\\/_+.#"@\[\(\{&]/,Bq=/[\\\/_+.#"@\[\(\{&]/g,$q=/[\s-]/,OE=/[\s-]/g;function kv(t,s,n,r,a,l,c){if(l===s.length)return a===t.length?p1:Mq;var d=`${a},${l}`;if(c[d]!==void 0)return c[d];for(var h=r.charAt(l),x=n.indexOf(h,a),f=0,m,p,u,j;x>=0;)m=kv(t,s,n,r,x+1,l+1,c),m>f&&(x===a?m*=p1:Fq.test(t.charAt(x-1))?(m*=Oq,u=t.slice(a,x-1).match(Bq),u&&a>0&&(m*=Math.pow(Jx,u.length))):$q.test(t.charAt(x-1))?(m*=_q,j=t.slice(a,x-1).match(OE),j&&a>0&&(m*=Math.pow(Jx,j.length))):(m*=Iq,a>0&&(m*=Math.pow(Jx,x-a))),t.charAt(x)!==s.charAt(l)&&(m*=Lq)),(mm&&(m=p*Xx)),m>f&&(f=m),x=n.indexOf(h,x+1);return c[d]=f,f}function x1(t){return t.toLowerCase().replace(OE," ")}function qq(t,s,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,kv(t,s,x1(t),x1(s),0,0,{})}var Rd='[cmdk-group=""]',eg='[cmdk-group-items=""]',zq='[cmdk-group-heading=""]',IE='[cmdk-item=""]',g1=`${IE}:not([aria-disabled="true"])`,Rv="cmdk-item-select",jc="data-value",Uq=(t,s,n)=>qq(t,s,n),LE=v.createContext(void 0),Au=()=>v.useContext(LE),ME=v.createContext(void 0),Gb=()=>v.useContext(ME),FE=v.createContext(void 0),BE=v.forwardRef((t,s)=>{let n=Nc(()=>{var O,V;return{search:"",value:(V=(O=t.value)!=null?O:t.defaultValue)!=null?V:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Nc(()=>new Set),a=Nc(()=>new Map),l=Nc(()=>new Map),c=Nc(()=>new Set),d=$E(t),{label:h,children:x,value:f,onValueChange:m,filter:p,shouldFilter:u,loop:j,disablePointerSelection:g=!1,vimBindings:y=!0,...N}=t,S=hr(),C=hr(),w=hr(),R=v.useRef(null),P=ez();Uo(()=>{if(f!==void 0){let O=f.trim();n.current.value=O,A.emit()}},[f]),Uo(()=>{P(6,M)},[]);let A=v.useMemo(()=>({subscribe:O=>(c.current.add(O),()=>c.current.delete(O)),snapshot:()=>n.current,setState:(O,V,K)=>{var Y,U,X,ne;if(!Object.is(n.current[O],V)){if(n.current[O]=V,O==="search")_(),T(),P(1,E);else if(O==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let oe=document.getElementById(w);oe?oe.focus():(Y=document.getElementById(S))==null||Y.focus()}if(P(7,()=>{var oe;n.current.selectedItemId=(oe=q())==null?void 0:oe.id,A.emit()}),K||P(5,M),((U=d.current)==null?void 0:U.value)!==void 0){let oe=V??"";(ne=(X=d.current).onValueChange)==null||ne.call(X,oe);return}}A.emit()}},emit:()=>{c.current.forEach(O=>O())}}),[]),I=v.useMemo(()=>({value:(O,V,K)=>{var Y;V!==((Y=l.current.get(O))==null?void 0:Y.value)&&(l.current.set(O,{value:V,keywords:K}),n.current.filtered.items.set(O,$(V,K)),P(2,()=>{T(),A.emit()}))},item:(O,V)=>(r.current.add(O),V&&(a.current.has(V)?a.current.get(V).add(O):a.current.set(V,new Set([O]))),P(3,()=>{_(),T(),n.current.value||E(),A.emit()}),()=>{l.current.delete(O),r.current.delete(O),n.current.filtered.items.delete(O);let K=q();P(4,()=>{_(),(K==null?void 0:K.getAttribute("id"))===O&&E(),A.emit()})}),group:O=>(a.current.has(O)||a.current.set(O,new Set),()=>{l.current.delete(O),a.current.delete(O)}),filter:()=>d.current.shouldFilter,label:h||t["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:S,inputId:w,labelId:C,listInnerRef:R}),[]);function $(O,V){var K,Y;let U=(Y=(K=d.current)==null?void 0:K.filter)!=null?Y:Uq;return O?U(O,n.current.search,V):0}function T(){if(!n.current.search||d.current.shouldFilter===!1)return;let O=n.current.filtered.items,V=[];n.current.filtered.groups.forEach(Y=>{let U=a.current.get(Y),X=0;U.forEach(ne=>{let oe=O.get(ne);X=Math.max(oe,X)}),V.push([Y,X])});let K=R.current;G().sort((Y,U)=>{var X,ne;let oe=Y.getAttribute("id"),re=U.getAttribute("id");return((X=O.get(re))!=null?X:0)-((ne=O.get(oe))!=null?ne:0)}).forEach(Y=>{let U=Y.closest(eg);U?U.appendChild(Y.parentElement===U?Y:Y.closest(`${eg} > *`)):K.appendChild(Y.parentElement===K?Y:Y.closest(`${eg} > *`))}),V.sort((Y,U)=>U[1]-Y[1]).forEach(Y=>{var U;let X=(U=R.current)==null?void 0:U.querySelector(`${Rd}[${jc}="${encodeURIComponent(Y[0])}"]`);X==null||X.parentElement.appendChild(X)})}function E(){let O=G().find(K=>K.getAttribute("aria-disabled")!=="true"),V=O==null?void 0:O.getAttribute(jc);A.setState("value",V||void 0)}function _(){var O,V,K,Y;if(!n.current.search||d.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let U=0;for(let X of r.current){let ne=(V=(O=l.current.get(X))==null?void 0:O.value)!=null?V:"",oe=(Y=(K=l.current.get(X))==null?void 0:K.keywords)!=null?Y:[],re=$(ne,oe);n.current.filtered.items.set(X,re),re>0&&U++}for(let[X,ne]of a.current)for(let oe of ne)if(n.current.filtered.items.get(oe)>0){n.current.filtered.groups.add(X);break}n.current.filtered.count=U}function M(){var O,V,K;let Y=q();Y&&(((O=Y.parentElement)==null?void 0:O.firstChild)===Y&&((K=(V=Y.closest(Rd))==null?void 0:V.querySelector(zq))==null||K.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function q(){var O;return(O=R.current)==null?void 0:O.querySelector(`${IE}[aria-selected="true"]`)}function G(){var O;return Array.from(((O=R.current)==null?void 0:O.querySelectorAll(g1))||[])}function Z(O){let V=G()[O];V&&A.setState("value",V.getAttribute(jc))}function W(O){var V;let K=q(),Y=G(),U=Y.findIndex(ne=>ne===K),X=Y[U+O];(V=d.current)!=null&&V.loop&&(X=U+O<0?Y[Y.length-1]:U+O===Y.length?Y[0]:Y[U+O]),X&&A.setState("value",X.getAttribute(jc))}function z(O){let V=q(),K=V==null?void 0:V.closest(Rd),Y;for(;K&&!Y;)K=O>0?Xq(K,Rd):Jq(K,Rd),Y=K==null?void 0:K.querySelector(g1);Y?A.setState("value",Y.getAttribute(jc)):W(O)}let F=()=>Z(G().length-1),B=O=>{O.preventDefault(),O.metaKey?F():O.altKey?z(1):W(1)},D=O=>{O.preventDefault(),O.metaKey?Z(0):O.altKey?z(-1):W(-1)};return v.createElement(ps.div,{ref:s,tabIndex:-1,...N,"cmdk-root":"",onKeyDown:O=>{var V;(V=N.onKeyDown)==null||V.call(N,O);let K=O.nativeEvent.isComposing||O.keyCode===229;if(!(O.defaultPrevented||K))switch(O.key){case"n":case"j":{y&&O.ctrlKey&&B(O);break}case"ArrowDown":{B(O);break}case"p":case"k":{y&&O.ctrlKey&&D(O);break}case"ArrowUp":{D(O);break}case"Home":{O.preventDefault(),Z(0);break}case"End":{O.preventDefault(),F();break}case"Enter":{O.preventDefault();let Y=q();if(Y){let U=new Event(Rv);Y.dispatchEvent(U)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:I.inputId,id:I.labelId,style:sz},h),kf(t,O=>v.createElement(ME.Provider,{value:A},v.createElement(LE.Provider,{value:I},O))))}),Vq=v.forwardRef((t,s)=>{var n,r;let a=hr(),l=v.useRef(null),c=v.useContext(FE),d=Au(),h=$E(t),x=(r=(n=h.current)==null?void 0:n.forceMount)!=null?r:c==null?void 0:c.forceMount;Uo(()=>{if(!x)return d.item(a,c==null?void 0:c.id)},[x]);let f=qE(a,l,[t.value,t.children,l],t.keywords),m=Gb(),p=zl(P=>P.value&&P.value===f.current),u=zl(P=>x||d.filter()===!1?!0:P.search?P.filtered.items.get(a)>0:!0);v.useEffect(()=>{let P=l.current;if(!(!P||t.disabled))return P.addEventListener(Rv,j),()=>P.removeEventListener(Rv,j)},[u,t.onSelect,t.disabled]);function j(){var P,A;g(),(A=(P=h.current).onSelect)==null||A.call(P,f.current)}function g(){m.setState("value",f.current,!0)}if(!u)return null;let{disabled:y,value:N,onSelect:S,forceMount:C,keywords:w,...R}=t;return v.createElement(ps.div,{ref:Br(l,s),...R,id:a,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!p,"data-disabled":!!y,"data-selected":!!p,onPointerMove:y||d.getDisablePointerSelection()?void 0:g,onClick:y?void 0:j},t.children)}),Hq=v.forwardRef((t,s)=>{let{heading:n,children:r,forceMount:a,...l}=t,c=hr(),d=v.useRef(null),h=v.useRef(null),x=hr(),f=Au(),m=zl(u=>a||f.filter()===!1?!0:u.search?u.filtered.groups.has(c):!0);Uo(()=>f.group(c),[]),qE(c,d,[t.value,t.heading,h]);let p=v.useMemo(()=>({id:c,forceMount:a}),[a]);return v.createElement(ps.div,{ref:Br(d,s),...l,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&v.createElement("div",{ref:h,"cmdk-group-heading":"","aria-hidden":!0,id:x},n),kf(t,u=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?x:void 0},v.createElement(FE.Provider,{value:p},u))))}),Wq=v.forwardRef((t,s)=>{let{alwaysRender:n,...r}=t,a=v.useRef(null),l=zl(c=>!c.search);return!n&&!l?null:v.createElement(ps.div,{ref:Br(a,s),...r,"cmdk-separator":"",role:"separator"})}),Gq=v.forwardRef((t,s)=>{let{onValueChange:n,...r}=t,a=t.value!=null,l=Gb(),c=zl(x=>x.search),d=zl(x=>x.selectedItemId),h=Au();return v.useEffect(()=>{t.value!=null&&l.setState("search",t.value)},[t.value]),v.createElement(ps.input,{ref:s,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,"aria-activedescendant":d,id:h.inputId,type:"text",value:a?t.value:c,onChange:x=>{a||l.setState("search",x.target.value),n==null||n(x.target.value)}})}),Kq=v.forwardRef((t,s)=>{let{children:n,label:r="Suggestions",...a}=t,l=v.useRef(null),c=v.useRef(null),d=zl(x=>x.selectedItemId),h=Au();return v.useEffect(()=>{if(c.current&&l.current){let x=c.current,f=l.current,m,p=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let u=x.offsetHeight;f.style.setProperty("--cmdk-list-height",u.toFixed(1)+"px")})});return p.observe(x),()=>{cancelAnimationFrame(m),p.unobserve(x)}}},[]),v.createElement(ps.div,{ref:Br(l,s),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":r,id:h.listId},kf(t,x=>v.createElement("div",{ref:Br(c,h.listInnerRef),"cmdk-list-sizer":""},x)))}),Yq=v.forwardRef((t,s)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:l,container:c,...d}=t;return v.createElement(Pb,{open:n,onOpenChange:r},v.createElement(_b,{container:c},v.createElement(vf,{"cmdk-overlay":"",className:a}),v.createElement(bf,{"aria-label":t.label,"cmdk-dialog":"",className:l},v.createElement(BE,{ref:s,...d}))))}),Zq=v.forwardRef((t,s)=>zl(n=>n.filtered.count===0)?v.createElement(ps.div,{ref:s,...t,"cmdk-empty":"",role:"presentation"}):null),Qq=v.forwardRef((t,s)=>{let{progress:n,children:r,label:a="Loading...",...l}=t;return v.createElement(ps.div,{ref:s,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},kf(t,c=>v.createElement("div",{"aria-hidden":!0},c)))}),Kc=Object.assign(BE,{List:Kq,Item:Vq,Input:Gq,Group:Hq,Separator:Wq,Dialog:Yq,Empty:Zq,Loading:Qq});function Xq(t,s){let n=t.nextElementSibling;for(;n;){if(n.matches(s))return n;n=n.nextElementSibling}}function Jq(t,s){let n=t.previousElementSibling;for(;n;){if(n.matches(s))return n;n=n.previousElementSibling}}function $E(t){let s=v.useRef(t);return Uo(()=>{s.current=t}),s}var Uo=typeof window>"u"?v.useEffect:v.useLayoutEffect;function Nc(t){let s=v.useRef();return s.current===void 0&&(s.current=t()),s}function zl(t){let s=Gb(),n=()=>t(s.snapshot());return v.useSyncExternalStore(s.subscribe,n,n)}function qE(t,s,n,r=[]){let a=v.useRef(),l=Au();return Uo(()=>{var c;let d=(()=>{var x;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(x=f.current.textContent)==null?void 0:x.trim():a.current}})(),h=r.map(x=>x.trim());l.value(t,d,h),(c=s.current)==null||c.setAttribute(jc,d),a.current=d}),a}var ez=()=>{let[t,s]=v.useState(),n=Nc(()=>new Map);return Uo(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,a)=>{n.current.set(r,a),s({})}};function tz(t){let s=t.type;return typeof s=="function"?s(t.props):"render"in s?s.render(t.props):t}function kf({asChild:t,children:s},n){return t&&v.isValidElement(s)?v.cloneElement(tz(s),{ref:s.ref},n(s.props.children)):n(s)}var sz={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function nz({className:t,...s}){return e.jsx(Kc,{"data-slot":"command",className:Pt("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...s})}function rz({className:t,...s}){return e.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[e.jsx(Ra,{className:"size-4 shrink-0 opacity-50"}),e.jsx(Kc.Input,{"data-slot":"command-input",className:Pt("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),...s})]})}function az({className:t,...s}){return e.jsx(Kc.List,{"data-slot":"command-list",className:Pt("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...s})}function iz({...t}){return e.jsx(Kc.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t})}function lz({className:t,...s}){return e.jsx(Kc.Group,{"data-slot":"command-group",className:Pt("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),...s})}function v1({className:t,...s}){return e.jsx(Kc.Item,{"data-slot":"command-item",className:Pt("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s})}const oz=({value:t,onChange:s,asmUsers:n,className:r})=>{const[a,l]=v.useState(!1),c=n.find(d=>d.id===t);return e.jsxs(Dq,{open:a,onOpenChange:l,children:[e.jsx(Tq,{asChild:!0,children:e.jsxs(se,{variant:"outline",role:"combobox","aria-expanded":a,className:Pt("w-full min-w-0 justify-between",r),children:[e.jsx("span",{className:"truncate text-left",children:t==="__none__"?"Unassign":c?`${c.fullName} (${c.employeeId||c.email})`:"Select ASM"}),e.jsx(Y5,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Pq,{className:"w-[360px] max-w-[90vw] p-0",children:e.jsxs(nz,{children:[e.jsx(rz,{placeholder:"Search ASM by name/email/id..."}),e.jsxs(az,{className:"max-h-64 overflow-y-auto custom-scrollbar-slim",children:[e.jsx(iz,{children:"No ASM found."}),e.jsxs(lz,{children:[e.jsxs(v1,{value:"Unassign __none__",onSelect:()=>{s("__none__"),l(!1)},children:[e.jsx(Bn,{className:Pt("mr-2 h-4 w-4",t==="__none__"?"opacity-100":"opacity-0")}),"Unassign"]}),n.map(d=>e.jsxs(v1,{value:`${d.fullName} ${d.email} ${d.employeeId||""}`,onSelect:()=>{s(d.id),l(!1)},children:[e.jsx(Bn,{className:Pt("mr-2 h-4 w-4",t===d.id?"opacity-100":"opacity-0")}),d.fullName," (",d.employeeId||d.email,")"]},d.id))]})]})]})})]})},cz=()=>{const[t,s]=v.useState(!1),[n,r]=v.useState([]),[a,l]=v.useState([]),[c,d]=v.useState({}),h=async()=>{var m,p,u,j;try{s(!0);const g=await Ss.getDealerAsmMappings();g!=null&&g.success&&(r(((m=g.data)==null?void 0:m.dealers)||[]),l(((p=g.data)==null?void 0:p.asmUsers)||[]))}catch(g){ee.error(((j=(u=g==null?void 0:g.response)==null?void 0:u.data)==null?void 0:j.message)||"Failed to load dealer ASM mappings")}finally{s(!1)}};v.useEffect(()=>{h()},[]);const x=v.useMemo(()=>[...n].sort((m,p)=>{const u=String(m.status||"").toLowerCase()==="active",j=String(p.status||"").toLowerCase()==="active";return u!==j?u?-1:1:String(m.dealerName||"").localeCompare(String(p.dealerName||""))}),[n]),f=async m=>{var u,j;const p=c[m]||"";try{const g=await Ss.saveDealerAsmMapping({dealerId:m,asmUserId:p==="__none__"?null:p||null});g!=null&&g.success?(ee.success(g.message||"Dealer ASM mapping updated"),await h()):ee.error((g==null?void 0:g.message)||"Failed to save mapping")}catch(g){ee.error(((j=(u=g==null?void 0:g.response)==null?void 0:u.data)==null?void 0:j.message)||"Failed to save mapping")}};return e.jsxs(Le,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Dealer-Level ASM Assignment"}),e.jsx(Zt,{children:"Assign Sales ASM to onboarded dealers. DD-AM remains district-level in the section above."})]}),e.jsx(Me,{children:t?e.jsx("p",{className:"text-sm text-slate-500",children:"Loading mappings..."}):e.jsxs(ks,{className:"w-full",children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Dealer"}),e.jsx(me,{children:"Dealer Code"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Current ASM"}),e.jsx(me,{children:"Assign ASM"})]})}),e.jsxs(Es,{children:[x.length===0&&e.jsx(ct,{children:e.jsx(de,{colSpan:5,className:"text-center text-slate-500 py-8",children:"No dealers available for ASM mapping yet."})}),x.map(m=>{var p;return e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:m.dealerName}),e.jsx("span",{className:"text-xs text-slate-500",children:m.legalName})]})}),e.jsx(de,{children:m.dealerCode||"N/A"}),e.jsx(de,{children:e.jsx(Ae,{variant:String(m.status||"").toLowerCase()==="active"?"default":"secondary",children:m.status||"Unknown"})}),e.jsx(de,{children:m.assignedAsm?e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{children:m.assignedAsm.fullName}),e.jsx("span",{className:"text-xs text-slate-500 truncate",children:m.assignedAsm.employeeId||m.assignedAsm.email})]}):e.jsx("span",{className:"text-slate-400 text-sm",children:"Unassigned"})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx(oz,{asmUsers:a,value:c[m.dealerId]??((p=m.assignedAsm)==null?void 0:p.id)??"__none__",onChange:u=>d(j=>({...j,[m.dealerId]:u})),className:"flex-1 min-w-[180px]"}),e.jsx(se,{size:"sm",className:"shrink-0",onClick:()=>f(m.dealerId),children:"Assign"})]})})]},m.dealerId)})]})]})})]})},dz=({isOpen:t,onOpenChange:s,editingZMId:n,zmManagerId:r,setZmManagerId:a,zmStatus:l,setZmStatus:c,selectedZone:d,setSelectedZone:h,selectedRegions:x,setSelectedRegions:f,onSave:m,userAssignedData:p})=>{const{zones:u,regionalOffices:j}=Nn(N=>N.master),g=p.filter(N=>(N.allRoles||[]).some(C=>{const w=(C||"").toUpperCase();return["ZM","ZONAL MANAGER","ZBH","ZONE BUSINESS HEAD","RM","RBM","REGIONAL MANAGER"].includes(w)||w.includes("ZONAL")||w.includes("REGIONAL")})),y=j.filter(N=>N.zoneId===d);return e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"max-w-xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsxs(us,{children:[n?"Edit":"Add"," Zonal Manager"]}),e.jsx(vs,{children:"Assign Zonal Manager to Regions within a Zone"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border-b border-slate-100 pb-4",children:[e.jsxs(ce,{children:["Select Zonal Manager User ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:r,onValueChange:N=>{a(N);const S=p.find(C=>C.id===N);S&&(S.zoneId&&h(S.zoneId),S.assignedRegionIds&&f(S.assignedRegionIds))},disabled:!!n,children:[e.jsx(Ct,{className:"mt-2 w-full text-slate-900 border-slate-200",children:e.jsx(St,{placeholder:"Select ZM User"})}),e.jsx(At,{className:"max-h-60",children:g.map(N=>e.jsx(Pe,{value:N.id,children:e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx("span",{className:"font-medium text-slate-900",children:N.name}),e.jsx("span",{className:"text-xs text-slate-500",children:N.email})]})},N.id))})]})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Managed Zone ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:d,onValueChange:N=>{h(N),f([])},children:[e.jsx(Ct,{className:"mt-2",children:e.jsx(St,{placeholder:"Select zone"})}),e.jsx(At,{children:u.map(N=>e.jsx(Pe,{value:N.id,children:N.name},N.id))})]})]}),d&&e.jsxs("div",{children:[e.jsxs(ce,{className:"mb-2 block",children:["Assigned Regions ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("div",{className:"border border-slate-200 rounded-lg p-4 bg-slate-50/50 max-h-60 overflow-y-auto",children:e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[y.map(N=>e.jsxs("div",{className:"flex items-center space-x-3 p-2 rounded hover:bg-white transition-colors",children:[e.jsx(Rn,{id:`region-${N.id}`,checked:x.includes(N.id),onCheckedChange:S=>{f(S?[...x,N.id]:x.filter(C=>C!==N.id))}}),e.jsxs("label",{htmlFor:`region-${N.id}`,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer flex-1",children:[N.name,e.jsx("span",{className:"text-xs text-slate-500 block mt-1",children:N.code||"No Code"})]})]},N.id)),y.length===0&&e.jsx("p",{className:"text-sm text-slate-500 italic text-center py-4",children:"No regions found for this zone"})]})})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Status"}),e.jsxs(wt,{value:l,onValueChange:N=>c(N),children:[e.jsx(Ct,{className:"mt-2",children:e.jsx(St,{})}),e.jsxs(At,{children:[e.jsx(Pe,{value:"active",children:"Active"}),e.jsx(Pe,{value:"inactive",children:"Inactive"})]})]})]}),e.jsxs("div",{className:"flex gap-3 pt-6",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>s(!1),children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-amber-600 hover:bg-amber-700",onClick:m,children:"Save Zonal Manager"})]})]})]})})},uz=({isOpen:t,onOpenChange:s,editingZoneId:n,zoneName:r,setZoneName:a,zoneCode:l,setZoneCode:c,zoneDescription:d,setZoneDescription:h,zonalBusinessHeadId:x,setZonalBusinessHeadId:f,userAssignedData:m,onSave:p})=>{const u=(m||[]).filter(g=>{if(x!=="none"&&g.id===x)return!0;const y=(g.allRoles||[]).map(S=>String(S||"").toUpperCase()),N=String(g.roleCode||g.role||"").toUpperCase();return N==="ZBH"||N.includes("ZONAL BUSINESS HEAD")||y.some(S=>{const C=String(S||"").toUpperCase();return C==="ZBH"||C==="ZONE BUSINESS HEAD"||C==="ZONAL BUSINESS HEAD"})}),j=u.length>0?u:m||[];return gt.useEffect(()=>{},[n,t]),e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"max-w-md",children:[e.jsxs(ms,{children:[e.jsxs(us,{children:[n?"Edit":"Add"," Zone"]}),e.jsx(vs,{children:"Configure zonal details and geographical boundaries"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Zone Name"}),e.jsx(ot,{placeholder:"e.g., North Zone",className:"mt-2 text-slate-900",value:r,onChange:g=>a(g.target.value)})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Zone Code"}),e.jsx(ot,{placeholder:"e.g., NZ",className:"mt-2 text-slate-900",value:l,onChange:g=>c(g.target.value)})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Zonal Business Head"}),e.jsxs(wt,{value:x,onValueChange:f,children:[e.jsx(Ct,{className:"mt-2 w-full text-slate-900",children:e.jsx(St,{placeholder:"Select Head"})}),e.jsxs(At,{className:"max-h-60",children:[e.jsx(Pe,{value:"none",children:"None / Unassigned"}),j.map(g=>e.jsxs(Pe,{value:g.id,children:[g.name," (",g.email,")"]},g.id))]})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Description"}),e.jsx(Fs,{placeholder:"Describe the zone's coverage...",className:"mt-2 text-slate-900",rows:3,value:d,onChange:g=>h(g.target.value)})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>s(!1),children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-amber-600 hover:bg-amber-700",onClick:p,children:"Save Zone"})]})]})]})})},hz=({isOpen:t,onOpenChange:s,editingRegionId:n,regionName:r,setRegionName:a,regionDescription:l,setRegionDescription:c,selectedRegionZone:d,setSelectedRegionZone:h,regionalManagerId:x,setRegionalManagerId:f,selectedRegionStates:m,setSelectedRegionStates:p,onSave:u,userAssignedData:j})=>{const{zones:g,allStates:y,allDistricts:N,regionalOffices:S}=Nn(E=>E.master),[C,w]=gt.useState([]),R=gt.useMemo(()=>{const E={};return(S||[]).forEach(_=>{_.id!==n&&(_.districts||[]).forEach(M=>{E[M.id]=_.name})}),E},[S,n]),P=gt.useMemo(()=>{if(!d)return y;const E=new Set(N.filter(_=>_.zoneId===d||!_.zoneId||m.includes(_.id)).map(_=>_.stateId).filter(Boolean));return y.filter(_=>_.zoneId===d||E.has(_.id)||!_.zoneId)},[y,N,d,m]),A=gt.useMemo(()=>C.length===0?[]:N.filter(E=>C.includes(E.stateId)&&(!E.zoneId||E.zoneId===d||E.regionId===n)),[N,C,d,n]),I=gt.useMemo(()=>{const E={};return A.forEach(_=>{const M=y.find(G=>G.id===_.stateId),q=(M==null?void 0:M.name)||_.stateId;E[_.stateId]||(E[_.stateId]={stateName:q,districts:[]}),E[_.stateId].districts.push(_)}),Object.values(E)},[A,y]);gt.useEffect(()=>{if(!t){w([]);return}if(m.length>0){const E=Array.from(new Set(N.filter(_=>m.includes(_.id)).map(_=>_.stateId).filter(Boolean)));w(E)}},[t]);const $=E=>{h(E),w([]),p([])},T=(E,_)=>{if(_)w(M=>[...M,E]);else{w(q=>q.filter(G=>G!==E));const M=N.filter(q=>q.stateId===E).map(q=>q.id);p(m.filter(q=>!M.includes(q)))}};return e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsxs(us,{children:[n?"Edit":"Add"," Regional Office"]}),e.jsx(vs,{children:"Configure regional office details and coverage area"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Region Name"}),e.jsx(ot,{placeholder:"e.g., Delhi NCR Region",className:"mt-2 text-slate-900",value:r,onChange:E=>a(E.target.value)})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Zone"}),e.jsxs(wt,{value:d,onValueChange:$,children:[e.jsx(Ct,{className:"mt-2 text-slate-900",children:e.jsx(St,{placeholder:"Select zone"})}),e.jsx(At,{children:g.map(E=>e.jsx(Pe,{value:E.id,children:E.name},E.id))})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Regional Manager"}),e.jsxs(wt,{value:x,onValueChange:f,children:[e.jsx(Ct,{className:"mt-2 w-full text-slate-900",children:e.jsx(St,{placeholder:"Select from available users"})}),e.jsx(At,{className:"max-h-60",children:j.map(E=>e.jsxs(Pe,{value:E.id,children:[E.name||E.fullName,E.email?` — ${E.email}`:""]},E.id))})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Description"}),e.jsx(Fs,{placeholder:"Describe the region...",className:"mt-2 text-slate-900",rows:2,value:l,onChange:E=>c(E.target.value)})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"States Covered"}),!d&&e.jsx("p",{className:"text-xs text-amber-600 mt-1",children:"Select a zone first to see available states"}),e.jsx("div",{className:"mt-2 border rounded-lg p-3 max-h-40 overflow-y-auto bg-slate-50",children:P.length===0?e.jsx("p",{className:"text-xs text-slate-400 italic",children:d?"No states with available districts in this zone":"Select a zone to load states"}):e.jsx("div",{className:"space-y-2",children:P.map(E=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Rn,{id:`region-state-${E.id}`,checked:C.includes(E.id),disabled:!d,onCheckedChange:_=>T(E.id,!!_)}),e.jsx("label",{htmlFor:`region-state-${E.id}`,className:`text-sm cursor-pointer ${d?"text-slate-900":"text-slate-400"}`,children:E.name})]},E.id))})}),e.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:[C.length," ",C.length===1?"state":"states"," selected"]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Districts Covered"}),e.jsx("div",{className:"mt-2 border rounded-lg p-3 max-h-56 overflow-y-auto bg-slate-50",children:C.length===0?e.jsx("p",{className:"text-xs text-slate-400 italic",children:"Select one or more states above to see districts"}):I.length===0?e.jsx("p",{className:"text-xs text-slate-400 italic",children:"No available districts in the selected states for this zone"}):e.jsx(Cf,{children:I.map(({stateName:E,districts:_})=>e.jsxs("div",{className:"mb-4 last:mb-0",children:[e.jsx("h4",{className:"text-xs font-semibold text-amber-700 uppercase tracking-wide mb-2 pb-1 border-b border-slate-200",children:E}),e.jsx("div",{className:"space-y-2 ml-1",children:_.map(M=>{const q=R[M.id],G=M.zoneId&&M.zoneId!==d&&M.regionId!==n,Z=!!(q||G),W=q?`Already assigned to region: ${q}`:G?"Belongs to a different zone":"";return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(Ub,{children:[e.jsx(Vb,{asChild:!0,children:e.jsxs("div",{className:"flex items-center space-x-2 w-full",children:[e.jsx(Rn,{id:`region-district-${M.id}`,disabled:Z,checked:m.includes(M.id),onCheckedChange:z=>{p(z?[...m,M.id]:m.filter(F=>F!==M.id))}}),e.jsxs("label",{htmlFor:`region-district-${M.id}`,className:`text-sm flex-1 ${Z?"text-slate-400 cursor-not-allowed line-through":"text-slate-900 cursor-pointer"}`,children:[M.name,q&&e.jsxs("span",{className:"ml-2 text-xs text-red-400 font-normal no-underline",style:{textDecoration:"none"},children:["(in ",q,")"]})]})]})}),Z&&W&&e.jsx(Hb,{children:e.jsx("p",{className:"text-xs",children:W})})]})},M.id)})})]},E))})}),e.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:[m.length," ",m.length===1?"district":"districts"," selected"]})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>s(!1),children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-amber-600 hover:bg-amber-700",onClick:u,children:"Save Regional Office"})]})]})]})})};var Rf="Switch",[mz]=ea(Rf),[fz,pz]=mz(Rf),zE=v.forwardRef((t,s)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:l,required:c,disabled:d,value:h="on",onCheckedChange:x,form:f,...m}=t,[p,u]=v.useState(null),j=Ms(s,C=>u(C)),g=v.useRef(!1),y=p?f||!!p.closest("form"):!0,[N,S]=bi({prop:a,defaultProp:l??!1,onChange:x,caller:Rf});return e.jsxs(fz,{scope:n,checked:N,disabled:d,children:[e.jsx(ps.button,{type:"button",role:"switch","aria-checked":N,"aria-required":c,"data-state":WE(N),"data-disabled":d?"":void 0,disabled:d,value:h,...m,ref:j,onClick:Vt(t.onClick,C=>{S(w=>!w),y&&(g.current=C.isPropagationStopped(),g.current||C.stopPropagation())})}),y&&e.jsx(HE,{control:p,bubbles:!g.current,name:r,value:h,checked:N,required:c,disabled:d,form:f,style:{transform:"translateX(-100%)"}})]})});zE.displayName=Rf;var UE="SwitchThumb",VE=v.forwardRef((t,s)=>{const{__scopeSwitch:n,...r}=t,a=pz(UE,n);return e.jsx(ps.span,{"data-state":WE(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:s})});VE.displayName=UE;var xz="SwitchBubbleInput",HE=v.forwardRef(({__scopeSwitch:t,control:s,checked:n,bubbles:r=!0,...a},l)=>{const c=v.useRef(null),d=Ms(c,l),h=Wv(n),x=Gv(s);return v.useEffect(()=>{const f=c.current;if(!f)return;const m=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(m,"checked").set;if(h!==n&&u){const j=new Event("click",{bubbles:r});u.call(f,n),f.dispatchEvent(j)}},[h,n,r]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:d,style:{...a.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});HE.displayName=xz;function WE(t){return t?"checked":"unchecked"}var gz=zE,vz=VE;function Ef({className:t,...s}){return e.jsx(gz,{"data-slot":"switch",className:Pt("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-switch-background focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(vz,{"data-slot":"switch-thumb",className:Pt("bg-card dark:data-[state=unchecked]:bg-card-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var tg,b1;function bz(){if(b1)return tg;b1=1;function t(){this.__data__=[],this.size=0}return tg=t,tg}var sg,y1;function GE(){if(y1)return sg;y1=1;function t(s,n){return s===n||s!==s&&n!==n}return sg=t,sg}var ng,j1;function Df(){if(j1)return ng;j1=1;var t=GE();function s(n,r){for(var a=n.length;a--;)if(t(n[a][0],r))return a;return-1}return ng=s,ng}var rg,N1;function yz(){if(N1)return rg;N1=1;var t=Df(),s=Array.prototype,n=s.splice;function r(a){var l=this.__data__,c=t(l,a);if(c<0)return!1;var d=l.length-1;return c==d?l.pop():n.call(l,c,1),--this.size,!0}return rg=r,rg}var ag,w1;function jz(){if(w1)return ag;w1=1;var t=Df();function s(n){var r=this.__data__,a=t(r,n);return a<0?void 0:r[a][1]}return ag=s,ag}var ig,S1;function Nz(){if(S1)return ig;S1=1;var t=Df();function s(n){return t(this.__data__,n)>-1}return ig=s,ig}var lg,C1;function wz(){if(C1)return lg;C1=1;var t=Df();function s(n,r){var a=this.__data__,l=t(a,n);return l<0?(++this.size,a.push([n,r])):a[l][1]=r,this}return lg=s,lg}var og,A1;function Tf(){if(A1)return og;A1=1;var t=bz(),s=yz(),n=jz(),r=Nz(),a=wz();function l(c){var d=-1,h=c==null?0:c.length;for(this.clear();++du))return!1;var g=m.get(c),y=m.get(d);if(g&&y)return g==d&&y==c;var N=-1,S=!0,C=h&a?new t:void 0;for(m.set(c,d),m.set(d,c);++N-1&&r%1==0&&r-1&&n%1==0&&n<=t}return m0=s,m0}var f0,_S;function mU(){if(_S)return f0;_S=1;var t=Pf(),s=tD(),n=If(),r="[object Arguments]",a="[object Array]",l="[object Boolean]",c="[object Date]",d="[object Error]",h="[object Function]",x="[object Map]",f="[object Number]",m="[object Object]",p="[object RegExp]",u="[object Set]",j="[object String]",g="[object WeakMap]",y="[object ArrayBuffer]",N="[object DataView]",S="[object Float32Array]",C="[object Float64Array]",w="[object Int8Array]",R="[object Int16Array]",P="[object Int32Array]",A="[object Uint8Array]",I="[object Uint8ClampedArray]",$="[object Uint16Array]",T="[object Uint32Array]",E={};E[S]=E[C]=E[w]=E[R]=E[P]=E[A]=E[I]=E[$]=E[T]=!0,E[r]=E[a]=E[y]=E[l]=E[N]=E[c]=E[d]=E[h]=E[x]=E[f]=E[m]=E[p]=E[u]=E[j]=E[g]=!1;function _(M){return n(M)&&s(M.length)&&!!E[t(M)]}return f0=_,f0}var p0,OS;function fU(){if(OS)return p0;OS=1;function t(s){return function(n){return s(n)}}return p0=t,p0}var Fd={exports:{}};Fd.exports;var IS;function pU(){return IS||(IS=1,(function(t,s){var n=KE(),r=s&&!s.nodeType&&s,a=r&&!0&&t&&!t.nodeType&&t,l=a&&a.exports===r,c=l&&n.process,d=(function(){try{var h=a&&a.require&&a.require("util").types;return h||c&&c.binding&&c.binding("util")}catch{}})();t.exports=d})(Fd,Fd.exports)),Fd.exports}var x0,LS;function sD(){if(LS)return x0;LS=1;var t=mU(),s=fU(),n=pU(),r=n&&n.isTypedArray,a=r?s(r):t;return x0=a,x0}var g0,MS;function xU(){if(MS)return g0;MS=1;var t=oU(),s=dU(),n=Zb(),r=eD(),a=hU(),l=sD(),c=Object.prototype,d=c.hasOwnProperty;function h(x,f){var m=n(x),p=!m&&s(x),u=!m&&!p&&r(x),j=!m&&!p&&!u&&l(x),g=m||p||u||j,y=g?t(x.length,String):[],N=y.length;for(var S in x)(f||d.call(x,S))&&!(g&&(S=="length"||u&&(S=="offset"||S=="parent")||j&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||a(S,N)))&&y.push(S);return y}return g0=h,g0}var v0,FS;function gU(){if(FS)return v0;FS=1;var t=Object.prototype;function s(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||t;return n===a}return v0=s,v0}var b0,BS;function vU(){if(BS)return b0;BS=1;function t(s,n){return function(r){return s(n(r))}}return b0=t,b0}var y0,$S;function bU(){if($S)return y0;$S=1;var t=vU(),s=t(Object.keys,Object);return y0=s,y0}var j0,qS;function yU(){if(qS)return j0;qS=1;var t=gU(),s=bU(),n=Object.prototype,r=n.hasOwnProperty;function a(l){if(!t(l))return s(l);var c=[];for(var d in Object(l))r.call(l,d)&&d!="constructor"&&c.push(d);return c}return j0=a,j0}var N0,zS;function jU(){if(zS)return N0;zS=1;var t=ZE(),s=tD();function n(r){return r!=null&&s(r.length)&&!t(r)}return N0=n,N0}var w0,US;function NU(){if(US)return w0;US=1;var t=xU(),s=yU(),n=jU();function r(a){return n(a)?t(a):s(a)}return w0=r,w0}var S0,VS;function wU(){if(VS)return S0;VS=1;var t=rU(),s=lU(),n=NU();function r(a){return t(a,n,s)}return S0=r,S0}var C0,HS;function SU(){if(HS)return C0;HS=1;var t=wU(),s=1,n=Object.prototype,r=n.hasOwnProperty;function a(l,c,d,h,x,f){var m=d&s,p=t(l),u=p.length,j=t(c),g=j.length;if(u!=g&&!m)return!1;for(var y=u;y--;){var N=p[y];if(!(m?N in c:r.call(c,N)))return!1}var S=f.get(l),C=f.get(c);if(S&&C)return S==c&&C==l;var w=!0;f.set(l,c),f.set(c,l);for(var R=m;++yl({open:he,type:null}),children:e.jsxs(ls,{children:[e.jsxs(ms,{children:[e.jsxs(us,{children:[a.type==="approve"&&"Approve Termination Request",a.type==="withdrawal"&&"Withdraw Termination Request",a.type==="sendBack"&&"Send Back for Clarification",a.type==="revoke"&&"Revoke Termination Request",a.type==="assign"&&"Assign to User",a.type==="pushfnf"&&"Push to Full & Final Settlement"]}),e.jsx(vs,{children:a.type==="assign"?"Select a user to assign this request to":a.type==="pushfnf"?"This will move the termination case to F&F for dues clearance":"Please provide remarks for this action"})]}),e.jsx("div",{className:"space-y-4",children:a.type==="assign"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Select User"}),e.jsxs(wt,{value:m,onValueChange:x,children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"Choose a user"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"rbm",children:"RBM - Regional Business Manager"}),e.jsx(_e,{value:"zbh",children:"ZBH - Zonal Business Head"}),e.jsx(_e,{value:"dd-lead",children:"DD Lead"}),e.jsx(_e,{value:"legal",children:"Legal Team"}),e.jsx(_e,{value:"nbh",children:"NBH - National Business Head"}),e.jsx(_e,{value:"cco",children:"CCO - Chief Commercial Officer"}),e.jsx(_e,{value:"ceo",children:"CEO"})]})]})]}):a.type==="pushfnf"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Remarks (Optional)"}),e.jsx(Fs,{value:c,onChange:he=>d(he.target.value),placeholder:"Add any additional notes...",rows:3})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Remarks *"}),e.jsx(Fs,{value:c,onChange:he=>d(he.target.value),placeholder:"Enter your remarks here...",rows:4})]})}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>l({open:!1,type:null}),children:"Cancel"}),e.jsx(se,{onClick:Qe,className:a.type==="approve"?"bg-green-600 hover:bg-green-700":a.type==="withdrawal"?"bg-red-600 hover:bg-red-700":"bg-blue-600 hover:bg-blue-700",children:"Confirm"})]})]})}),e.jsx(os,{open:f.open,onOpenChange:he=>h({open:he,stageName:"",documents:[]}),children:e.jsxs(ls,{className:qb,children:[e.jsxs(ms,{children:[e.jsxs(us,{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-5 h-5 text-amber-600"}),"Documents - ",f.stageName]}),e.jsxs(vs,{children:["Documents uploaded for this stage (",f.documents.length," ",f.documents.length===1?"document":"documents",")"]})]}),e.jsx("div",{className:"max-h-96 overflow-y-auto",children:f.documents.length>0?e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Document Name"}),e.jsx(me,{children:"Type"}),e.jsx(me,{children:"Upload Date"}),e.jsx(me,{children:"Uploader"}),e.jsx(me,{children:"Action"})]})}),e.jsx(Es,{children:f.documents.map(he=>e.jsxs(ct,{children:[e.jsx(de,{children:he.name}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline",children:he.type})}),e.jsx(de,{children:he.uploadDate}),e.jsx(de,{children:he.uploader}),e.jsx(de,{children:e.jsxs(se,{size:"sm",variant:"outline",className:"text-amber-600 hover:text-amber-700",onClick:()=>{const Ke=he.path;if(!Ke)return;const at=Ke.startsWith("/uploads/")&&!Ke.startsWith("/uploads/documents/")?Ke.replace("/uploads/","/uploads/documents/"):Ke;Y({fileName:he.name||"Document",filePath:at,documentType:he.type||"Document"})},children:[e.jsx(fs,{className:"w-4 h-4 mr-1"}),"View"]})})]},he.id))})]}):e.jsx("div",{className:"text-center py-8 text-slate-500",children:"No documents uploaded for this stage yet"})}),e.jsx(rn,{children:e.jsx(se,{variant:"outline",onClick:()=>h({open:!1,stageName:"",documents:[]}),children:"Close"})})]})}),e.jsx(os,{open:S,onOpenChange:A,children:e.jsxs(ls,{className:"bg-white",children:[e.jsxs(ms,{children:[e.jsx(us,{children:fe?"Upload SCN Response":"Issue Show Cause Notice (SCN)"}),e.jsx(vs,{children:fe?"Upload the response received from the dealer regarding the SCN.":"Confirm the issuance of a formal Show Cause Notice to the dealer."})]}),e.jsxs("div",{className:"space-y-4 pt-4",children:[fe&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"SCN Response File"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("input",{type:"file",className:"hidden",id:"scn-file-upload",onChange:he=>{var Ke;return E(((Ke=he.target.files)==null?void 0:Ke[0])||null)}}),e.jsx(se,{variant:"outline",className:"w-full border-dashed",onClick:()=>{var he;return(he=document.getElementById("scn-file-upload"))==null?void 0:he.click()},children:w?w.name:"Select PDF or Image"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Remarks/Details"}),e.jsx(Fs,{placeholder:"Add any internal remarks or justification...",value:T,onChange:he=>C(he.target.value),rows:4})]}),e.jsxs(rn,{className:"gap-2 sm:gap-0",children:[e.jsx(se,{variant:"outline",onClick:()=>A(!1),disabled:L,children:"Cancel"}),e.jsx(se,{className:fe?"bg-amber-600 hover:bg-amber-700":"bg-purple-600 hover:bg-purple-700",onClick:fe?oe:ne,disabled:L||fe&&!w,children:L?"Processing...":fe?"Upload Response":"Issue SCN"})]})]})]})}),e.jsx(os,{open:_,onOpenChange:R,children:e.jsxs(ls,{className:"bg-white",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Final Termination Authorization"}),e.jsx(vs,{children:"Provide your final decision on this termination case."})]}),e.jsxs("div",{className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Final Decision"}),e.jsxs(wt,{value:P,onValueChange:he=>M(he),children:[e.jsx(Ct,{className:"mt-2 text-slate-900 border-slate-300",children:e.jsx(St,{placeholder:"Select decision"})}),e.jsxs(At,{className:"bg-white border-slate-200 shadow-xl overflow-visible z-[9999]",children:[e.jsx(_e,{value:"Approve",className:"text-amber-700 focus:bg-amber-50",children:"Confirm Termination"}),e.jsx(_e,{value:"Reject",className:"text-slate-600 focus:bg-slate-50",children:"Reject Termination"}),e.jsx(_e,{value:"Reconsider",className:"text-amber-600 focus:bg-amber-50",children:"Reconsider / Give More Time"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Authorization Remarks"}),e.jsx(Fs,{placeholder:"Provide your rationale for this decision...",value:q,onChange:he=>K(he.target.value),rows:4})]}),e.jsxs(rn,{className:"gap-2 sm:gap-0",children:[e.jsx(se,{variant:"outline",onClick:()=>R(!1),disabled:L,children:"Cancel"}),e.jsx(se,{className:"bg-indigo-600 hover:bg-indigo-700",onClick:re,disabled:L||!q,children:L?"Authorizing...":"Submit Decision"})]})]})]})}),e.jsx(os,{open:Z,onOpenChange:W,children:e.jsxs(ls,{children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Upload Termination Document"}),e.jsx(vs,{children:"Add a document and map it to a stage (optional)."})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Document Type"}),e.jsxs(wt,{value:B,onValueChange:D,children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"Select document type"})}),e.jsx(At,{children:Jx.map(he=>e.jsx(_e,{value:he,children:he},he))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"Stage (Optional)"}),e.jsxs(wt,{value:O||"none",onValueChange:he=>z(he==="none"?"":he),children:[e.jsx(Ct,{children:e.jsx(St,{placeholder:"Select stage"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"none",children:"No Stage Mapping"}),C$.map(he=>e.jsx(_e,{value:he,children:he},he))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{children:"File"}),e.jsx("input",{type:"file",onChange:he=>{var Ke;return F(((Ke=he.target.files)==null?void 0:Ke[0])||null)}})]})]}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>W(!1),disabled:L,children:"Cancel"}),e.jsx(se,{onClick:ge,disabled:L,children:L?"Uploading...":"Upload"})]})]})}),e.jsx(Gl,{isOpen:!!G,onClose:()=>Y(null),document:G})]})}const aa=t=>{if(!t)return"-";try{const s=new Date(t);return isNaN(s.getTime())?"-":s.toLocaleString("en-IN",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}catch{return"-"}},p1=t=>{if(!t)return"-";try{const s=new Date(t);return isNaN(s.getTime())?"-":s.toLocaleDateString("en-IN",{day:"2-digit",month:"short",year:"numeric"})}catch{return"-"}},bE=({isOpen:t,onClose:s,onSubmit:n,editingBank:r,isSubmitting:a})=>e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"sm:max-w-[500px]",children:[e.jsxs(ms,{children:[e.jsx(us,{children:r?"Edit Bank Details":"Add Bank Account"}),e.jsx(vs,{children:"Enter the dealer's bank information for settlement transfers."})]}),e.jsxs("form",{onSubmit:n,"data-testid":"onboarding-bank-details-form",children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"bankName",className:"text-right text-xs",children:"Bank Name"}),e.jsx("div",{className:"col-span-3",children:e.jsx(ot,{id:"bankName",name:"bankName",defaultValue:r==null?void 0:r.bankName,required:!0,placeholder:"e.g. HDFC Bank, ICICI Bank",className:"h-9","data-testid":"onboarding-bank-name-input"})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"accountHolderName",className:"text-right text-xs",children:"Holder Name"}),e.jsx("div",{className:"col-span-3",children:e.jsx(ot,{id:"accountHolderName",name:"accountHolderName",defaultValue:r==null?void 0:r.accountHolderName,required:!0,placeholder:"Full name as per bank records",className:"h-9","data-testid":"onboarding-account-holder-name-input"})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"accountNumber",className:"text-right text-xs",children:"A/C Number"}),e.jsx("div",{className:"col-span-3",children:e.jsx(ot,{id:"accountNumber",name:"accountNumber",defaultValue:r==null?void 0:r.accountNumber,required:!0,placeholder:"Enter account number",className:"h-9","data-testid":"onboarding-account-number-input"})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"ifscCode",className:"text-right text-xs",children:"IFSC Code"}),e.jsx("div",{className:"col-span-3",children:e.jsx(ot,{id:"ifscCode",name:"ifscCode",defaultValue:r==null?void 0:r.ifscCode,required:!0,placeholder:"11-character code",className:"h-9","data-testid":"onboarding-ifsc-code-input"})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"branchName",className:"text-right text-xs",children:"Branch"}),e.jsx("div",{className:"col-span-3",children:e.jsx(ot,{id:"branchName",name:"branchName",defaultValue:r==null?void 0:r.branchName,required:!0,placeholder:"Branch location",className:"h-9","data-testid":"onboarding-branch-name-input"})})]}),e.jsx("div",{className:"grid grid-cols-4 items-center gap-4",children:e.jsxs("div",{className:"flex items-center gap-2 col-start-2 col-span-3",children:[e.jsx("input",{type:"checkbox",id:"isPrimaryModal",name:"isPrimary",defaultChecked:r==null?void 0:r.isPrimary,className:"w-4 h-4 rounded border-slate-300 text-amber-600 focus:ring-amber-500","data-testid":"onboarding-is-primary-checkbox"}),e.jsx(ce,{htmlFor:"isPrimaryModal",className:"text-xs font-medium cursor-pointer",children:"Set as primary account"})]})})]}),e.jsxs(rn,{children:[e.jsx(se,{type:"button",variant:"outline",size:"sm",onClick:s,"data-testid":"onboarding-bank-details-cancel",children:"Cancel"}),e.jsxs(se,{type:"submit",disabled:a,size:"sm",className:"bg-amber-600","data-testid":"onboarding-bank-details-submit",children:[a?e.jsx(ss,{className:"w-4 h-4 animate-spin mr-2"}):null,r?"Update Account":"Save Bank Details"]})]})]})]})}),x1=["Warranty Department","Accessories Department","Sales Department","RTO Department","Service Department","Parts Department","Finance Department","Insurance Department","Inventory Department","Marketing Department","HR Department","IT Department","Legal Department","Quality Department","Logistics Department","Customer Relations Department"],E$="[DEPARTMENT_CLAIM]",D$="[FINANCE_VALIDATED]";function T$({fnfId:t,onBack:s,currentUser:n}){var ke,qe,Ve,dt,xt;const r=qn(),[a,l]=v.useState(null),[c,d]=v.useState(!0),[m,x]=v.useState("details"),[f,h]=v.useState(!1),[g,u]=v.useState(null),[j,p]=v.useState([]),[y,N]=v.useState([]),[S,A]=v.useState(!1),[w,E]=v.useState(null),[T,C]=v.useState(!1),[L,$]=v.useState(!1),[_,R]=v.useState(null),[P,M]=v.useState(!1),[q,K]=v.useState({remarks:"",amount:0,type:"Receivable"}),[Z,W]=v.useState(null);v.useEffect(()=>{z(),G()},[t]);const U=ye=>{if(!ye)return ye;let le=ye.trim();const Qe=x1.find(Rt=>Rt.toLowerCase()===le.toLowerCase());if(Qe)return Qe;const Gt={sales:"Sales Department",service:"Service Department",spares:"Parts Department",parts:"Parts Department","spares / parts":"Parts Department",finance:"Finance Department",accounts:"Finance Department",warranty:"Warranty Department",marketing:"Marketing Department",hr:"HR Department",it:"IT Department",legal:"Legal Department",logistics:"Logistics Department",quality:"Quality Department",fdd:"Finance Department",apparel:"Accessories Department",accessories:"Accessories Department",dms:"IT Department",rto:"Admin Department",admin:"Admin Department","admin / dd-admin":"Admin Department"}[le.toLowerCase().replace(" department","")];return Gt||ye},F=(ye,le)=>le==="DepartmentClaim"||typeof ye=="string"&&(ye.startsWith(E$)||ye.includes("Clearance:")),B=ye=>(ye==null?void 0:ye.sourceType)==="FinanceValidated"&&typeof(ye==null?void 0:ye.description)=="string"&&ye.description.includes("Auto-seeded from department claim"),D=(ye,le)=>le==="FinanceValidated"||typeof ye=="string"&&ye.startsWith(D$),O=ye=>ye?{ADD_LINE_ITEM:"Line Item Added",UPDATE_LINE_ITEM:"Line Item Updated",REMOVE_LINE_ITEM:"Line Item Removed",UPDATE_CLEARANCE:"Clearance Status Updated",SETTLE_CASE:"Settlement Finalized",FNF_UPDATED:"F&F Case Updated"}[ye]||ye.split("_").map(Qe=>Qe.charAt(0).toUpperCase()+Qe.slice(1).toLowerCase()).join(" "):"Action",z=async(ye=!0)=>{var le,Qe,rt,Gt,Rt,Re,Qt,qt,ws,Ps,ns,Cs,Bs,Ft,ie,Fe,Q,pe,Ne,Ee,it,st,bt,Ue,It,ut,yt,kt,Le,Pt,ht,zt,rs,Yt,Os,Ls,zs,en,he,Ke,at,pt,mt,Bt,Ds,as,Vs,Is,Ts,ln,pn,hn,Ws,Qs,zn,on,Un,yr,Tr,er,tr,En,Xe,$t;try{ye&&d(!0);const Ut=(await Te.getFnFSettlementById(t)).data;if(Ut.success){const jt=Ut.fnf,Ln=(jt.lineItems||[]).filter(Tt=>Tt.isActive!==!1),_r=Ln.some(Tt=>D(Tt.description,Tt.sourceType))?Ln.filter(Tt=>D(Tt.description,Tt.sourceType)):Ln.filter(Tt=>!F(Tt.description,Tt.sourceType)),xn={id:jt.id,caseNumber:jt.settlementId||((le=jt.resignation)==null?void 0:le.resignationId)||((Qe=jt.terminationRequest)==null?void 0:Qe.requestId)||jt.id.substring(0,8),status:jt.status,requestType:jt.resignationId?"Resignation":"Termination",dealerName:((Gt=(rt=jt.outlet)==null?void 0:rt.dealer)==null?void 0:Gt.fullName)||((Rt=jt.dealer)==null?void 0:Rt.fullName)||"N/A",dealerCode:((Re=jt.outlet)==null?void 0:Re.code)||((qt=(Qt=jt.dealer)==null?void 0:Qt.dealerCode)==null?void 0:qt.dealerCode)||"N/A",dealershipName:((ws=jt.outlet)==null?void 0:ws.name)||((Ps=jt.dealer)==null?void 0:Ps.businessName)||"N/A",location:((ns=jt.outlet)==null?void 0:ns.city)||((Cs=jt.outlet)==null?void 0:Cs.location)||"N/A",originalRequestId:((Bs=jt.resignation)==null?void 0:Bs.resignationId)||((Ft=jt.terminationRequest)==null?void 0:Ft.requestId)||((ie=jt.terminationRequest)==null?void 0:ie.id)||"N/A",submittedOn:aa(jt.createdAt),lastOperationalDateSales:(Fe=jt.resignation)!=null&&Fe.lastOperationalDateSales||(Q=jt.terminationRequest)!=null&&Q.proposedLwd?p1(((pe=jt.resignation)==null?void 0:pe.lastOperationalDateSales)||((Ne=jt.terminationRequest)==null?void 0:Ne.proposedLwd)):"N/A",lastOperationalDateServices:(Ee=jt.resignation)!=null&&Ee.lastOperationalDateServices||(it=jt.terminationRequest)!=null&&it.proposedLwd?p1(((st=jt.resignation)==null?void 0:st.lastOperationalDateServices)||((bt=jt.terminationRequest)==null?void 0:bt.proposedLwd)):"N/A",typeOfClosure:jt.resignationId?"Voluntary":"Involuntary",gst:((ut=(It=(Ue=jt.outlet)==null?void 0:Ue.dealer)==null?void 0:It.dealerProfile)==null?void 0:ut.gstNumber)||((yt=jt.dealer)==null?void 0:yt.gstNumber)||"N/A",pan:((Pt=(Le=(kt=jt.outlet)==null?void 0:kt.dealer)==null?void 0:Le.dealerProfile)==null?void 0:Pt.panNumber)||((ht=jt.dealer)==null?void 0:ht.panNumber)||"N/A",salesCode:((rs=(zt=jt.dealer)==null?void 0:zt.dealerCode)==null?void 0:rs.salesCode)||((zs=(Ls=(Os=(Yt=jt.outlet)==null?void 0:Yt.dealer)==null?void 0:Os.dealerProfile)==null?void 0:Ls.dealerCode)==null?void 0:zs.salesCode)||"N/A",serviceCode:((he=(en=jt.dealer)==null?void 0:en.dealerCode)==null?void 0:he.serviceCode)||((mt=(pt=(at=(Ke=jt.outlet)==null?void 0:Ke.dealer)==null?void 0:at.dealerProfile)==null?void 0:pt.dealerCode)==null?void 0:mt.serviceCode)||"N/A",gearCode:((Ds=(Bt=jt.dealer)==null?void 0:Bt.dealerCode)==null?void 0:Ds.gearCode)||((Ts=(Is=(Vs=(as=jt.outlet)==null?void 0:as.dealer)==null?void 0:Vs.dealerProfile)==null?void 0:Is.dealerCode)==null?void 0:Ts.gearCode)||"N/A",gmaCode:((pn=(ln=jt.dealer)==null?void 0:ln.dealerCode)==null?void 0:pn.gmaCode)||((zn=(Qs=(Ws=(hn=jt.outlet)==null?void 0:hn.dealer)==null?void 0:Ws.dealerProfile)==null?void 0:Qs.dealerCode)==null?void 0:zn.gmaCode)||"N/A",financeReportStatus:jt.status==="Finance Approval"?"In Progress":jt.status==="Completed"?"Completed":"Pending",totalPayableAmount:_r.filter(Tt=>Tt.itemType==="Payable").reduce((Tt,xs)=>Tt+(parseFloat(xs.amount)||0),0),totalRecoveryAmount:_r.filter(Tt=>Tt.itemType==="Receivable"||Tt.itemType==="Recovery").reduce((Tt,xs)=>Tt+(parseFloat(xs.amount)||0),0),totalDeductions:_r.filter(Tt=>Tt.itemType==="Deduction").reduce((Tt,xs)=>Tt+(parseFloat(xs.amount)||0),0),allLineItems:Ln,netAmount:0,departmentResponses:[]};xn.netAmount=xn.totalPayableAmount-xn.totalRecoveryAmount-xn.totalDeductions,xn.departmentResponses=["Warranty Department","Accessories Department","Sales Department","RTO Department","Service Department","Parts Department","Finance Department","Insurance Department","Inventory Department","Marketing Department","HR Department","IT Department","Legal Department","Quality Department","Logistics Department","Customer Relations Department"].map(Tt=>{const xs=(jt.clearances||[]).find(dn=>U(dn.department)===Tt),Vr=Ln.filter(dn=>U(dn.department)===Tt&&F(dn.description,dn.sourceType)),ta=Ln.filter(dn=>U(dn.department)===Tt&&B(dn)),ma=Vr.length>0?Vr:ta;let Pr=0,sr=0;ma.forEach(dn=>{const wn=Math.abs(parseFloat(dn.amount)||0);dn.itemType==="Payable"?Pr+=wn:sr+=wn});const gn=Pr-sr,mn=Math.abs(gn)>0,Qn=(xs==null?void 0:xs.status)||"Pending",fr=mn?"Dues Pending":Qn==="Cleared"?"NOC Submitted":Qn,pr=gn>0?"payable":gn<0?"recovery":null;return{id:(xs==null?void 0:xs.id)||`dept-${Tt}`,clearanceId:(xs==null?void 0:xs.id)||null,departmentName:Tt,status:fr,duesFlow:pr,amountType:gn>0?"Payable to dealer":gn<0?"Receivable from dealer":null,amount:Math.abs(gn),submittedDate:xs!=null&&xs.clearedAt?aa(xs.clearedAt):"-",remarks:(xs==null?void 0:xs.remarks)||"-",supportingDocument:(xs==null?void 0:xs.supportingDocument)||null}});const qs={...xn,documents:[...(((on=jt.resignation)==null?void 0:on.uploadedDocuments)||[]).map(Tt=>({id:`res-${Tt.id}`,name:Tt.fileName,type:"Resignation",uploadDate:aa(Tt.createdAt),status:"Verified",url:Tt.filePath})),...(jt.clearances||[]).filter(Tt=>Tt.supportingDocument).map(Tt=>({id:`clr-${Tt.id}`,name:Tt.supportingDocument.split("/").pop(),type:`${Tt.department} Proof`,uploadDate:aa(Tt.clearedAt),status:"Attached",url:Tt.supportingDocument})),...(jt.settlementDocs||[]).map(Tt=>({id:`set-${Tt.id}`,name:Tt.fileName,type:"Settlement Proof",uploadDate:aa(Tt.createdAt),status:"Finance",url:Tt.filePath}))],participants:jt.participants||[]};l(qs);const ha=jt.bankDetails||((Un=jt.dealer)==null?void 0:Un.bankDetails)||((er=(Tr=(yr=jt.outlet)==null?void 0:yr.dealer)==null?void 0:Tr.dealerProfile)==null?void 0:er.bankDetails);ha&&ha.length>0?N(ha):((En=(tr=jt.outlet)==null?void 0:tr.dealer)!=null&&En.id||jt.dealerId)&&Y((($t=(Xe=jt.outlet)==null?void 0:Xe.dealer)==null?void 0:$t.id)||jt.dealerId)}}catch(Ze){console.error("Fetch F&F details error:",Ze),ee.error("Failed to fetch settlement details")}finally{ye&&d(!1)}},G=async()=>{try{const le=(await Te.getAuditLogs("fnf",t)).data;le.success&&p(le.data||[])}catch(ye){console.error("Fetch audit logs error:",ye)}},Y=async ye=>{try{const Qe=(await Te.getDealerBankDetails(ye)).data;Qe.success&&N(Qe.bankDetails||[])}catch(le){console.error("Fetch bank details error:",le)}},V=async ye=>{var rt,Gt;ye.preventDefault();const le=new FormData(ye.currentTarget),Qe=Object.fromEntries(le.entries());try{C(!0);const Rt=((Gt=(rt=a==null?void 0:a.outlet)==null?void 0:rt.dealer)==null?void 0:Gt.id)||(a==null?void 0:a.dealerId);if(!Rt){ee.error("Dealer information missing");return}(await Te.saveBankDetail(Rt,{...Qe,id:w==null?void 0:w.id,isPrimary:le.get("isPrimary")==="on"})).data.success&&(ee.success("Bank details saved successfully"),Y(Rt),A(!1),E(null))}catch{ee.error("Failed to save bank details")}finally{C(!1)}},X=async ye=>{var le,Qe;if(confirm("Are you sure you want to delete this bank account?"))try{if((await Te.deleteBankDetail(ye)).data.success){ee.success("Bank detail deleted");const Gt=((Qe=(le=a==null?void 0:a.outlet)==null?void 0:le.dealer)==null?void 0:Qe.id)||(a==null?void 0:a.dealerId);Gt&&Y(Gt)}}catch{ee.error("Failed to delete bank detail")}};if(c)return e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-amber-600"})});if(!a)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-slate-600",children:"Case not found"}),e.jsx(se,{onClick:s,className:"mt-4",children:"Go Back"})]});const oe=(ye=>{const le=new Date(ye),rt=Math.abs(new Date().getTime()-le.getTime());return Math.ceil(rt/(1e3*60*60*24))})(a.submittedOn),re=ye=>{if(!a||!ye)return!1;const le=String((n==null?void 0:n.role)||"").toLowerCase();if(!le||ye.status!=="Pending")return!1;const rt=["Finance Approval","Completed"].includes(a.status),Gt=le.includes("super admin")||le.includes("finance")||le.includes("dd admin");if(rt&&!Gt)return!1;if(Gt)return!0;const Rt=ye.departmentName.replace(" Department","").toLowerCase();return le.includes(Rt)},ge=((a==null?void 0:a.departmentResponses)||[]).some(ye=>re(ye)),ve=async()=>{var ye;if(!(_!=null&&_.clearanceId)||!t){ee.error("Clearance record not available for this department");return}try{M(!0);const le=new FormData,Qe=Number(q.amount)>0?"Dues Pending":"NOC Submitted";le.append("status",Qe),le.append("remarks",q.remarks),le.append("amount",String(q.amount)),le.append("type",q.type),Z&&le.append("file",Z);const rt=await Te.updateFnFClearance(t,_.clearanceId,le);if(!rt.ok){ee.error(((ye=rt.data)==null?void 0:ye.message)||"Failed to update department clearance"),M(!1);return}ee.success(`Clearance updated for ${_.departmentName}`),$(!1),W(null),x("departments"),z(!1)}catch(le){console.error("Update clearance error:",le),ee.error("Failed to update department clearance")}finally{M(!1)}},Se=()=>{ee.success("Notifications sent to all 16 departments"),h(!1)},We=ye=>{switch(ye){case"New":return"bg-amber-100 text-blue-700 border-blue-300";case"In Progress":return"bg-yellow-100 text-yellow-700 border-yellow-300";case"Under Review":return"bg-orange-100 text-orange-700 border-orange-300";case"Completed":return"bg-green-100 text-green-700 border-green-300";default:return"bg-slate-100 text-slate-700 border-slate-300"}},Ce=ye=>{switch(ye){case"NOC Submitted":return"bg-green-100 text-green-700 border-green-300";case"Dues Pending":return"bg-red-100 text-red-700 border-red-300";case"Pending":return"bg-slate-100 text-slate-700 border-slate-300";default:return"bg-slate-100 text-slate-700 border-slate-300"}},fe=a.departmentResponses.filter(ye=>ye.status!=="Pending").length,Ye=a.departmentResponses.length,be=fe/Ye*100,Pe=x1.map(ye=>{const le=(a.departmentResponses||[]).find(ns=>ns.departmentName===ye),Qe=Number(le==null?void 0:le.amount)||0,rt=(le==null?void 0:le.amountType)||"-",Gt=(a.allLineItems||[]).filter(ns=>U(ns.department)===ye),Rt=Gt.filter(ns=>ns.sourceType==="FinanceValidated"&&ns.itemType==="Payable").reduce((ns,Cs)=>ns+Math.abs(parseFloat(Cs.amount)||0),0),Re=Gt.filter(ns=>ns.sourceType==="FinanceValidated"&&(ns.itemType==="Receivable"||ns.itemType==="Recovery")).reduce((ns,Cs)=>ns+Math.abs(parseFloat(Cs.amount)||0),0),Qt=Gt.filter(ns=>ns.sourceType==="FinanceValidated"&&ns.itemType==="Deduction").reduce((ns,Cs)=>ns+Math.abs(parseFloat(Cs.amount)||0),0),qt=Rt-Re-Qt,ws=Math.abs(qt),Ps=qt>0?"Payable":qt<0?"Receivable":"-";return{department:ye,claimAmount:Qe,claimType:rt,validatedAmount:ws,validatedType:Ps,variance:ws-Qe}});return e.jsxs("div",{className:"space-y-6",children:[e.jsx(Ie,{className:`border-none shadow-md bg-gradient-to-r ${(a.totalRecoveryAmount||0)>(a.totalPayableAmount||0)?"from-red-600 to-red-500":"from-green-600 to-green-500"} text-white`,children:e.jsxs(Me,{className:"p-6 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 bg-white/20 rounded-full",children:e.jsx(z2,{className:"w-6 h-6"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-white/80 text-sm font-medium",children:"Net Settlement Balance"}),e.jsxs("h2",{className:"text-3xl font-bold",children:["₹",Math.abs(a.netAmount||0).toLocaleString()]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx(Ae,{className:"bg-white/20 hover:bg-white/30 text-white border-none px-4 py-1 mb-2",children:(a.totalRecoveryAmount||0)>(a.totalPayableAmount||0)?"Receivable from Dealer":"Payable to Dealer"}),e.jsx("p",{className:"text-xs text-white/70",children:a.status==="Completed"?"Settlement Finalized":"Draft Calculation"})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"outline",size:"icon",onClick:s,children:e.jsx($r,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl",children:a.caseNumber}),e.jsx("p",{className:"text-slate-600",children:a.dealerName})]}),e.jsx(Ae,{className:We(a.status),children:a.status}),e.jsx(Ae,{className:a.requestType==="Resignation"?"bg-amber-100 text-amber-700 border-amber-300":"bg-red-100 text-red-700 border-red-300",children:a.requestType})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs(se,{variant:"outline",onClick:()=>r(`/worknotes/fnf/${t}`,{state:{applicationName:a.dealerName||"F&F Settlement",registrationNumber:a.caseNumber||"",participants:a.participants||[]}}),children:[e.jsx(zr,{className:"w-4 h-4 mr-2"}),"View Work Notes"]})})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Overall Progress"}),e.jsxs(Zt,{children:["Department responses: ",fe," / ",Ye]})]}),e.jsxs(Me,{children:[e.jsx(ji,{value:be,className:"h-3"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-sm",children:"NOC Submitted"}),e.jsx("p",{className:"text-2xl text-green-600",children:a.departmentResponses.filter(ye=>ye.status==="NOC Submitted").length})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-sm",children:"Dues Pending"}),e.jsx("p",{className:"text-2xl text-red-600",children:a.departmentResponses.filter(ye=>ye.status==="Dues Pending").length})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-sm",children:"Pending"}),e.jsx("p",{className:"text-2xl text-slate-600",children:a.departmentResponses.filter(ye=>ye.status==="Pending").length})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-sm",children:"Finance Status"}),e.jsx("p",{className:"text-lg",children:a.financeReportStatus})]})]})]})]}),e.jsxs(_n,{value:m,onValueChange:x,className:"w-full",children:[e.jsxs(Pn,{children:[e.jsx(Wt,{value:"progress",children:"Progress"}),e.jsx(Wt,{value:"details",children:"Case Details"}),e.jsx(Wt,{value:"departments",children:"Department Responses"}),e.jsx(Wt,{value:"financial",children:"Financial Summary"}),e.jsx(Wt,{value:"documents",children:"Documents"}),e.jsx(Wt,{value:"bank",children:"Bank Details"}),e.jsx(Wt,{value:"audit",children:"Audit Trail"})]}),e.jsx(Kt,{value:"progress",children:e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"F&F Settlement Progress"}),e.jsx(Zt,{children:"Track the complete journey from initiation to completion"})]}),e.jsx(Me,{children:e.jsx("div",{className:"relative",children:e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex shrink-0 flex-col items-center",children:[e.jsx("div",{className:"size-12 shrink-0 aspect-square rounded-full bg-green-100 border-2 border-green-600 flex items-center justify-center",children:e.jsx(Bn,{className:"w-6 h-6 text-green-600"})}),e.jsx("div",{className:"w-0.5 h-full bg-green-300 mt-2"})]}),e.jsxs("div",{className:"flex-1 pb-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-slate-900",children:"F&F Initiated"}),e.jsx(Ae,{className:"bg-green-600",children:"Completed"})]}),e.jsx("span",{className:"text-sm text-slate-600",children:a.submittedOn})]}),e.jsx("p",{className:"text-slate-600 text-sm mb-3",children:"Full & Final settlement process has been initiated. Case created and basic information collected."}),e.jsx(Ie,{className:"bg-green-50 border-green-200",children:e.jsx(Me,{className:"p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Case Number"}),e.jsx("p",{className:"text-slate-900",children:a.caseNumber})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Request Type"}),e.jsx("p",{className:"text-slate-900",children:a.requestType})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Dealer"}),e.jsx("p",{className:"text-slate-900",children:a.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600",children:"Location"}),e.jsx("p",{className:"text-slate-900",children:a.location})]})]})})})]})]}),e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex shrink-0 flex-col items-center",children:[e.jsx("div",{className:`size-12 shrink-0 aspect-square rounded-full flex items-center justify-center border-2 ${fe===Ye||["Finance Approval","Completed"].includes(a.status)?"bg-green-100 border-green-600":fe>0?"bg-amber-100 border-amber-600":"bg-slate-100 border-slate-300"}`,children:fe===Ye||["Finance Approval","Completed"].includes(a.status)?e.jsx(Bn,{className:"w-6 h-6 text-green-600"}):fe>0?e.jsx(da,{className:"w-6 h-6 text-amber-600"}):e.jsx(Js,{className:"w-6 h-6 text-slate-400"})}),e.jsx("div",{className:`w-0.5 h-full mt-2 ${fe===Ye||["Finance Approval","Completed"].includes(a.status)?"bg-green-300":"bg-slate-200"}`})]}),e.jsxs("div",{className:"flex-1 pb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-slate-900",children:"Department Responses Received"}),e.jsx(Ae,{className:fe===Ye||["Finance Approval","Completed"].includes(a.status)?"bg-green-600":fe>0?"bg-amber-600":"bg-slate-400",children:fe===Ye||["Finance Approval","Completed"].includes(a.status)?"Completed":fe>0?"In Progress":"Pending"})]})}),e.jsxs("p",{className:"text-slate-600 text-sm mb-3",children:["All stakeholder departments submit their NOC or dues information.",fe>0&&` (${fe}/${Ye} responses received)`]}),fe>0&&e.jsx(Ie,{className:fe===Ye||["Finance Approval","Completed"].includes(a.status)?"bg-green-50 border-green-200":"bg-blue-50 border-amber-200",children:e.jsx(Me,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-slate-600",children:"Progress"}),e.jsxs("span",{className:"text-sm",children:[fe," / ",Ye," ","departments"]})]}),e.jsx(ji,{value:be,className:"h-2"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[e.jsxs("div",{className:"text-center p-2 bg-green-100 rounded",children:[e.jsx("p",{className:"text-green-700",children:"NOC Submitted"}),e.jsx("p",{className:"text-green-900",children:a.departmentResponses.filter(ye=>ye.status==="NOC Submitted").length})]}),e.jsxs("div",{className:"text-center p-2 bg-red-100 rounded",children:[e.jsx("p",{className:"text-red-700",children:"Dues Pending"}),e.jsx("p",{className:"text-red-900",children:a.departmentResponses.filter(ye=>ye.status==="Dues Pending").length})]}),e.jsxs("div",{className:"text-center p-2 bg-slate-100 rounded",children:[e.jsx("p",{className:"text-slate-700",children:"Pending"}),e.jsx("p",{className:"text-slate-900",children:a.departmentResponses.filter(ye=>ye.status==="Pending").length})]})]})]})})})]})]}),e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex shrink-0 flex-col items-center",children:[e.jsx("div",{className:`size-12 shrink-0 aspect-square rounded-full flex items-center justify-center border-2 ${a.status==="Completed"?"bg-green-100 border-green-600":a.status==="Finance Approval"?"bg-amber-100 border-amber-600":"bg-slate-100 border-slate-300"}`,children:a.status==="Completed"?e.jsx(Bn,{className:"w-6 h-6 text-green-600"}):a.status==="Finance Approval"?e.jsx(Pd,{className:"w-6 h-6 text-amber-600"}):e.jsx(Js,{className:"w-6 h-6 text-slate-400"})}),e.jsx("div",{className:`w-0.5 h-full mt-2 ${a.status==="Completed"?"bg-green-300":"bg-slate-200"}`})]}),e.jsxs("div",{className:"flex-1 pb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-slate-900",children:"Finance Final Summary"}),e.jsx(Ae,{className:a.status==="Completed"?"bg-green-600":a.status==="Finance Approval"?"bg-amber-600":"bg-slate-400",children:a.status==="Completed"?"Completed":a.status==="Finance Approval"?"In Progress":"Pending"})]})}),e.jsx("p",{className:"text-slate-600 text-sm mb-3",children:"Finance department consolidates all department responses and prepares final settlement summary with total payable and recovery amounts."}),["Finance Approval","Completed"].includes(a.status)&&e.jsx(Ie,{className:a.status==="Completed"?"bg-green-50 border-green-200":"bg-blue-50 border-amber-200",children:e.jsx(Me,{className:"p-4",children:e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"text-center p-3 bg-green-100 rounded-lg",children:[e.jsx("p",{className:"text-xs text-green-700 mb-1",children:"Payable Amount"}),e.jsxs("p",{className:"text-green-900",children:["₹",((ke=a.totalPayableAmount)==null?void 0:ke.toLocaleString())||"0"]})]}),e.jsxs("div",{className:"text-center p-3 bg-red-100 rounded-lg",children:[e.jsx("p",{className:"text-xs text-red-700 mb-1",children:"Receivable amount"}),e.jsxs("p",{className:"text-red-900",children:["₹",((qe=a.totalRecoveryAmount)==null?void 0:qe.toLocaleString())||"0"]})]}),e.jsxs("div",{className:"text-center p-3 bg-amber-100 rounded-lg",children:[e.jsx("p",{className:"text-xs text-blue-700 mb-1",children:"Net Amount"}),e.jsxs("p",{className:(a.totalRecoveryAmount||0)>(a.totalPayableAmount||0)?"text-red-900":"text-green-900",children:["₹",Math.abs((a.totalRecoveryAmount||0)-(a.totalPayableAmount||0)).toLocaleString()]})]})]})})})]})]}),e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex shrink-0 flex-col items-center",children:[e.jsx("div",{className:`size-12 shrink-0 aspect-square rounded-full flex items-center justify-center border-2 ${a.status==="Completed"?"bg-green-100 border-green-600":a.status==="Finance Approval"?"bg-amber-100 border-amber-600":"bg-slate-100 border-slate-300"}`,children:a.status==="Completed"?e.jsx(Bn,{className:"w-6 h-6 text-green-600"}):a.status==="Finance Approval"?e.jsx(zr,{className:"w-6 h-6 text-amber-600"}):e.jsx(Js,{className:"w-6 h-6 text-slate-400"})}),e.jsx("div",{className:`w-0.5 h-full mt-2 ${a.status==="Completed"?"bg-green-300":"bg-slate-200"}`})]}),e.jsxs("div",{className:"flex-1 pb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-slate-900",children:"Financial Discussion with Dealer"}),e.jsx(Ae,{className:a.status==="Completed"?"bg-green-600":a.status==="Finance Approval"?"bg-amber-600":"bg-slate-400",children:a.status==="Completed"?"Completed":a.status==="Finance Approval"?"In Progress":"Pending"})]})}),e.jsx("p",{className:"text-slate-600 text-sm mb-3",children:"Finance team, legal team, and relevant departments discuss final settlement with the dealer. Dealer reviews and agrees to the financial terms."}),a.status==="Finance Approval"&&e.jsx(Ie,{className:"bg-orange-50 border-orange-200",children:e.jsx(Me,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Gs,{className:"w-5 h-5 text-orange-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-orange-900 mb-1",children:"Ongoing Discussions"}),e.jsx("p",{className:"text-xs text-orange-700",children:"Negotiations in progress regarding recovery/payable amounts. Finance team is working with departments and dealer to resolve discrepancies."})]})]})})})]})]}),e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsxs("div",{className:"flex shrink-0 flex-col items-center",children:[e.jsx("div",{className:`size-12 shrink-0 aspect-square rounded-full flex items-center justify-center border-2 ${a.status==="Completed"?"bg-green-100 border-green-600":"bg-slate-100 border-slate-300"}`,children:a.status==="Completed"?e.jsx(Bn,{className:"w-6 h-6 text-green-600"}):e.jsx(Js,{className:"w-6 h-6 text-slate-400"})}),e.jsx("div",{className:`w-0.5 h-full mt-2 ${a.status==="Completed"?"bg-green-300":"bg-slate-200"}`})]}),e.jsxs("div",{className:"flex-1 pb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-slate-900",children:"Full and Final Settlement"}),e.jsx(Ae,{className:a.status==="Completed"?"bg-green-600":"bg-slate-400",children:a.status==="Completed"?"Completed":"Pending"})]})}),e.jsx("p",{className:"text-slate-600 text-sm mb-3",children:"All financial settlements are processed. Payments made or recoveries completed as per agreed terms. All documentation finalized."})]})]}),e.jsxs("div",{className:"flex gap-4 items-start",children:[e.jsx("div",{className:"flex shrink-0 flex-col items-center",children:e.jsx("div",{className:`size-12 shrink-0 aspect-square rounded-full flex items-center justify-center border-2 ${a.status==="Completed"?"bg-green-100 border-green-600":"bg-slate-100 border-slate-300"}`,children:a.status==="Completed"?e.jsx(Fn,{className:"w-6 h-6 text-green-600"}):e.jsx(Js,{className:"w-6 h-6 text-slate-400"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-slate-900",children:"F&F Complete"}),e.jsx(Ae,{className:a.status==="Completed"?"bg-green-600":"bg-slate-400",children:a.status==="Completed"?"Completed":"Pending"})]}),a.status==="Completed"&&e.jsx("span",{className:"text-sm text-slate-600",children:a.settlementDate||"Oct 15, 2025"})]}),e.jsx("p",{className:"text-slate-600 text-sm mb-3",children:"Full & Final settlement process completed successfully. Case closed. All obligations fulfilled."}),a.status==="Completed"&&e.jsx(Ie,{className:"bg-gradient-to-r from-green-50 to-blue-50 border-green-300",children:e.jsx(Me,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-12 shrink-0 aspect-square rounded-full bg-green-600 flex items-center justify-center",children:e.jsx(Fn,{className:"w-7 h-7 text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-green-900",children:"Settlement Successfully Completed"}),e.jsxs("p",{className:"text-xs text-green-700 mt-1",children:["All processes completed. Case Number:"," ",a.caseNumber]})]})]})})})]})]})]})})})]})}),e.jsxs(Kt,{value:"details",className:"space-y-6",children:[e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Basic Information"})}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Case Number"}),e.jsx("p",{children:a.caseNumber})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Code"}),e.jsx("p",{children:a.dealerCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealer Name"}),e.jsx("p",{children:a.dealerName})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Dealership Name"}),e.jsx("p",{children:a.dealershipName})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Location"}),e.jsx("p",{children:a.location})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Request Type"}),e.jsx("p",{children:a.requestType})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Original Request ID"}),e.jsx("p",{children:a.originalRequestId})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Submitted On"}),e.jsx("p",{children:a.submittedOn})]})]})})]}),e.jsxs(Ie,{className:"border-amber-200 bg-blue-50/30",children:[e.jsx(tt,{children:e.jsx(nt,{className:"text-blue-900",children:"F&F Settlement Information"})}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Last Operational Date (Sales)"}),e.jsx("p",{children:a.lastOperationalDateSales})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Last Operational Date (Services)"}),e.jsx("p",{children:a.lastOperationalDateServices})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Submitted Date (F&F Start)"}),e.jsx("p",{children:a.submittedOn})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Days Elapsed since Submission"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("p",{children:[oe," days"]}),e.jsx(Ae,{variant:"outline",className:oe<30?"bg-green-100 text-green-700 border-green-300":oe<60?"bg-yellow-100 text-yellow-700 border-yellow-300":"bg-red-100 text-red-700 border-red-300",children:oe<30?"Recent":oe<60?"In Progress":"Overdue"})]})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Type of Closure"}),e.jsx("p",{children:a.typeOfClosure})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GST"}),e.jsx("p",{children:a.gst})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Sales Code"}),e.jsx("p",{children:a.salesCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Service Code"}),e.jsx("p",{children:a.serviceCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"Gear Code"}),e.jsx("p",{children:a.gearCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-600",children:"GMA Code"}),e.jsx("p",{children:a.gmaCode})]})]})})]}),a.status==="Under Review"&&e.jsxs(Ie,{className:"border-orange-200 bg-orange-50",children:[e.jsxs(tt,{children:[e.jsx(nt,{className:"text-orange-900",children:"Under Review"}),e.jsx(Zt,{className:"text-orange-700",children:"This case is under negotiation/discussion with the dealer, finance team, legal team, and relevant departments"})]}),e.jsx(Me,{children:e.jsx("p",{className:"text-sm text-orange-800",children:"Discussions ongoing regarding recovery/payable amounts. Finance team is working with departments to resolve discrepancies."})})]})]}),e.jsx(Kt,{value:"departments",children:e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsxs(nt,{children:["Department Responses (",fe," / ",Ye,")"]}),e.jsx(Zt,{children:"Status of NOC and dues from all departments"})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Amount Type"}),e.jsx(me,{children:"Amount"}),e.jsx(me,{children:"Submitted Date"}),e.jsx(me,{children:"Remarks"}),ge&&e.jsx(me,{children:"Actions"})]})}),e.jsx(Es,{children:a.departmentResponses.map(ye=>e.jsxs(ct,{children:[e.jsx(de,{children:ye.departmentName}),e.jsx(de,{children:e.jsx(Ae,{className:Ce(ye.status),children:ye.status})}),e.jsx(de,{children:ye.amountType?e.jsx(Ae,{variant:"outline",className:ye.duesFlow==="recovery"?"bg-red-100 text-red-900 border-red-400 font-semibold":"bg-emerald-100 text-emerald-900 border-emerald-400 font-semibold",children:ye.amountType}):"-"}),e.jsx(de,{children:ye.amount?e.jsxs("span",{className:`font-semibold tabular-nums ${ye.duesFlow==="recovery"?"text-red-700":"text-emerald-700"}`,children:["₹",ye.amount.toLocaleString()]}):"-"}),e.jsx(de,{children:ye.submittedDate||"-"}),e.jsx(de,{className:"max-w-xs truncate",children:ye.remarks||"-"}),ge&&e.jsx(de,{children:re(ye)?e.jsx(se,{variant:"ghost",size:"sm",className:"text-amber-600 hover:text-blue-700",onClick:()=>{R(ye),K({remarks:ye.remarks==="-"?"":ye.remarks,amount:ye.amount||0,type:ye.duesFlow==="payable"?"Payable":"Receivable"}),W(null),$(!0)},children:"Action"}):e.jsx("span",{className:"text-slate-400 text-sm",children:"-"})})]},ye.id))})]})})]})}),e.jsx(Kt,{value:"financial",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs(Ie,{className:"border-blue-200 bg-blue-50",children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Department Claim vs Finance Validation"}),e.jsx(Zt,{children:"Final settlement totals are based on finance validated values."})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Department Claim"}),e.jsx(me,{children:"Finance Validated"}),e.jsx(me,{children:"Variance"})]})}),e.jsx(Es,{children:Pe.map(ye=>e.jsxs(ct,{children:[e.jsx(de,{children:ye.department}),e.jsx(de,{children:ye.claimAmount>0?`${ye.claimType} ₹${ye.claimAmount.toLocaleString()}`:"-"}),e.jsx(de,{children:ye.validatedAmount>0?`${ye.validatedType} ₹${ye.validatedAmount.toLocaleString()}`:"-"}),e.jsx(de,{className:ye.variance===0?"text-slate-600":ye.variance>0?"text-red-600":"text-green-600",children:ye.claimAmount===0&&ye.validatedAmount===0?"-":`₹${ye.variance.toLocaleString()}`})]},ye.department))})]})})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Financial Summary"}),e.jsx(Zt,{children:"Consolidated view of all payable and receivable amounts"})]}),e.jsx(Me,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"p-6 bg-green-50 rounded-lg border border-green-200",children:[e.jsx("p",{className:"text-sm text-green-700 mb-2",children:"Total Payable Amount"}),e.jsxs("p",{className:"text-3xl text-green-600",children:["₹",((Ve=a.totalPayableAmount)==null?void 0:Ve.toLocaleString())||"0"]}),e.jsx("p",{className:"text-xs text-green-600 mt-1",children:"Amount to be paid to dealer"})]}),e.jsxs("div",{className:"p-6 bg-red-50 rounded-lg border border-red-200",children:[e.jsx("p",{className:"text-sm text-red-700 mb-2",children:"Total receivable amount"}),e.jsxs("p",{className:"text-3xl text-red-600",children:["₹",((dt=a.totalRecoveryAmount)==null?void 0:dt.toLocaleString())||"0"]}),e.jsx("p",{className:"text-xs text-red-600 mt-1",children:"Amount receivable from dealer"})]}),e.jsxs("div",{className:"p-6 bg-amber-50 rounded-lg border border-amber-200",children:[e.jsx("p",{className:"text-sm text-amber-700 mb-2",children:"Total Deductions"}),e.jsxs("p",{className:"text-3xl text-amber-600 font-bold",children:["₹",((xt=a.totalDeductions)==null?void 0:xt.toLocaleString())||"0"]}),e.jsx("p",{className:"text-xs text-amber-600 mt-1",children:"Warranty holdbacks / Policy penalties"})]}),e.jsxs("div",{className:"p-6 bg-blue-50 rounded-lg border border-blue-200",children:[e.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"Net Settlement Amount"}),e.jsxs("p",{className:`text-3xl font-extrabold ${(a.netAmount||0)<0?"text-red-600":"text-green-600"}`,children:["₹",Math.abs(a.netAmount||0).toLocaleString()]}),e.jsx("p",{className:"text-xs text-blue-600 mt-1",children:(a.netAmount||0)<0?"Receivable from dealer":"Payment to dealer"})]})]})})]}),e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Finance Report Status"})}),e.jsxs(Me,{children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Ae,{className:a.financeReportStatus==="Completed"?"bg-green-100 text-green-700 border-green-300":a.financeReportStatus==="In Progress"?"bg-yellow-100 text-yellow-700 border-yellow-300":"bg-slate-100 text-slate-700 border-slate-300",children:a.financeReportStatus}),a.financeReportStatus==="Pending"&&e.jsx("p",{className:"text-slate-600 text-sm",children:"Waiting for all department responses before finance can prepare final report"}),a.financeReportStatus==="In Progress"&&e.jsx("p",{className:"text-slate-600 text-sm",children:"Finance team is reviewing department responses and preparing final settlement report"})]}),a.financeRemarks&&e.jsxs("div",{className:"mt-4 p-4 bg-slate-50 rounded-lg",children:[e.jsx(ce,{className:"text-slate-600",children:"Finance Remarks"}),e.jsx("p",{className:"mt-1",children:a.financeRemarks})]})]})]})]})}),e.jsx(Kt,{value:"documents",children:e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Documents"}),e.jsx(Zt,{children:"All NOC documents and due statements from departments"})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Document Name"}),e.jsx(me,{children:"Type"}),e.jsx(me,{children:"Upload Date"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Actions"})]})}),e.jsx(Es,{children:a.documents.map(ye=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-4 h-4 text-slate-500"}),e.jsx("span",{children:ye.name})]})}),e.jsx(de,{children:ye.type}),e.jsx(de,{children:ye.uploadDate}),e.jsx(de,{children:e.jsx(Ae,{variant:ye.status==="Verified"?"default":"secondary",children:ye.status})}),e.jsx(de,{children:e.jsx(se,{size:"sm",variant:"outline",onClick:()=>{const le=ye.url,Qe=le.startsWith("/uploads/")&&!le.startsWith("/uploads/documents/")?le.replace("/uploads/","/uploads/documents/"):le;u({fileName:ye.name,filePath:Qe,documentType:ye.type})},children:"View"})})]},ye.id))})]})})]})}),e.jsx(Kt,{value:"bank",children:e.jsxs(Ie,{children:[e.jsxs(tt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Bank Details"}),e.jsx(Zt,{children:"Dealer bank accounts for settlement disbursement"})]}),e.jsxs(se,{onClick:()=>{E(null),A(!0)},className:"bg-amber-600",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add Account"]})]}),e.jsx(Me,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:y.length>0?y.map(ye=>e.jsxs(Ie,{className:`relative overflow-hidden ${ye.isPrimary?"border-amber-500 bg-blue-50/30":""}`,children:[ye.isPrimary&&e.jsx("div",{className:"absolute top-0 right-0 p-1 bg-amber-600 text-white text-[10px] uppercase font-bold px-2 rounded-bl",children:"Primary"}),e.jsxs(Me,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"p-2 bg-amber-100 rounded-lg",children:e.jsx(Ml,{className:"w-5 h-5 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-slate-900",children:ye.bankName}),e.jsx("p",{className:"text-xs text-slate-500",children:ye.branchName})]})]}),e.jsxs("div",{className:"space-y-3 mb-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Account Holder"}),e.jsx("p",{className:"text-sm font-medium",children:ye.accountHolderName})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Account Number"}),e.jsx("p",{className:"text-sm font-mono tracking-wider",children:ye.accountNumber.replace(/.(?=.{4})/g,"*")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold",children:"IFSC"}),e.jsx("p",{className:"text-sm font-mono",children:ye.ifscCode})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-slate-100",children:[e.jsxs(se,{variant:"ghost",size:"sm",className:"h-8 text-amber-600",onClick:()=>{E(ye),A(!0)},children:[e.jsx(iv,{className:"w-3 h-3 mr-1"}),"Edit"]}),e.jsxs(se,{variant:"ghost",size:"sm",className:"h-8 text-red-600",onClick:()=>X(ye.id),children:[e.jsx(Kn,{className:"w-3 h-3 mr-1"}),"Delete"]})]})]})]},ye.id)):e.jsxs("div",{className:"col-span-full py-12 text-center border-2 border-dashed rounded-lg bg-slate-50",children:[e.jsx(Ml,{className:"w-12 h-12 text-slate-300 mx-auto mb-3"}),e.jsx("p",{className:"text-slate-600",children:"No bank details found"}),e.jsx(se,{variant:"link",onClick:()=>A(!0),children:"Add first bank account"})]})})})]})}),e.jsx(Kt,{value:"audit",children:e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Audit Trail"}),e.jsx(Zt,{children:"Complete history of actions on this F&F case"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:j.length>0?j.map(ye=>{var le,Qe,rt,Gt,Rt,Re;return e.jsxs("div",{className:"flex gap-3 pb-4 border-b border-slate-100 last:border-0",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-slate-400 mt-2"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("p",{className:"font-semibold text-slate-900 flex items-center gap-2",children:[ye.action==="FNF_CREATED"&&e.jsx(Ae,{className:"bg-amber-600 h-2 w-2 p-0 rounded-full"}),ye.description&&!((le=ye.newData)!=null&&le.action)?ye.description:e.jsxs(e.Fragment,{children:[O(((Qe=ye.newData)==null?void 0:Qe.action)||ye.action),((rt=ye.newData)==null?void 0:rt.department)&&e.jsxs("span",{className:"text-amber-600 ml-1 font-bold",children:["- ",ye.newData.department]})]})]}),e.jsx("span",{className:"text-xs text-slate-500",children:aa(ye.createdAt||ye.timestamp)})]}),e.jsx("div",{className:"flex items-center gap-2 text-sm text-slate-600 mb-2",children:e.jsx(Ae,{variant:"outline",className:"text-[10px] uppercase",children:((Gt=ye.actor)==null?void 0:Gt.name)||ye.userName||"System"})}),(((Rt=ye.newData)==null?void 0:Rt.remarks)||ye.remarks)&&e.jsx("div",{className:"mt-2 p-3 bg-slate-50 border border-slate-200 rounded text-sm text-slate-700",children:((Re=ye.newData)==null?void 0:Re.remarks)||ye.remarks}),ye.newData&&Object.keys(ye.newData).filter(Qt=>Qt!=="remarks"&&Qt!=="status"&&Qt!=="action"&&Qt!=="department").length>0&&e.jsxs("div",{className:"mt-2 space-y-1",children:[e.jsx("p",{className:"text-[10px] text-slate-500 uppercase font-bold px-1",children:"Changes:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(ye.newData).filter(([Qt])=>Qt!=="remarks"&&Qt!=="action"&&Qt!=="department").map(([Qt,qt])=>e.jsxs("div",{className:"text-[11px] bg-slate-100 border rounded px-2 py-0.5 flex items-center gap-1",children:[e.jsxs("span",{className:"text-slate-500",children:[Qt,":"]}),e.jsx("span",{className:"text-slate-900 font-medium",children:String(qt)})]},Qt))})]})]})]},ye.id)}):e.jsx("div",{className:"text-center py-8 text-slate-500",children:e.jsx("p",{children:"No activity logs found for this case."})})})})]})})]}),e.jsx(os,{open:f,onOpenChange:h,children:e.jsxs(ls,{children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Send to All Stakeholders"}),e.jsx(vs,{children:"This will send notifications to all 16 departments to submit their NOC or dues information"})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"p-4 bg-blue-50 rounded-lg border border-amber-200",children:[e.jsx("p",{className:"text-sm text-blue-900 mb-2",children:"Notifications will be sent to:"}),e.jsxs("ul",{className:"text-sm text-blue-800 space-y-1 ml-4",children:[e.jsx("li",{children:"• All 16 departments"}),e.jsxs("li",{children:["• Case Number: ",a.caseNumber]}),e.jsxs("li",{children:["• Dealer: ",a.dealerName]}),e.jsxs("li",{children:["• Type: ",a.requestType]})]})]})}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),e.jsxs(se,{onClick:Se,className:"bg-amber-600 hover:bg-blue-700",children:[e.jsx(fu,{className:"w-4 h-4 mr-2"}),"Send Notifications"]})]})]})}),e.jsx(os,{open:L,onOpenChange:$,children:e.jsxs(ls,{className:"sm:max-w-[460px]",children:[e.jsxs(ms,{children:[e.jsxs(us,{children:["Update ",_==null?void 0:_.departmentName," Response"]}),e.jsx(vs,{children:"Provide dues/NOC response with remarks and optional supporting proof."})]}),e.jsxs("div",{className:"grid gap-4 py-2",children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"type",className:"text-right",children:"Type"}),e.jsxs("select",{id:"type",className:"col-span-3 flex h-10 w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm",value:q.type,onChange:ye=>K({...q,type:ye.target.value}),children:[e.jsx("option",{value:"Receivable",children:"Receivable (from dealer)"}),e.jsx("option",{value:"Payable",children:"Payable (to dealer)"}),e.jsx("option",{value:"Deduction",children:"Deduction"})]})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"amount",className:"text-right",children:"Amount"}),e.jsxs("div",{className:"col-span-3 relative",children:[e.jsx("span",{className:"absolute left-3 top-2.5 text-slate-500 font-medium",children:"₹"}),e.jsx("input",{id:"amount",type:"number",className:"flex h-10 w-full rounded-md border border-slate-200 bg-white pl-7 pr-3 py-2 text-sm",value:q.amount,onChange:ye=>K({...q,amount:Number(ye.target.value)})})]})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"remarks",className:"text-right",children:"Remarks"}),e.jsx("textarea",{id:"remarks",className:"col-span-3 flex min-h-[80px] w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm",placeholder:"Add response details...",value:q.remarks,onChange:ye=>K({...q,remarks:ye.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx(ce,{htmlFor:"proof",className:"text-right",children:"Proof"}),e.jsx("input",{id:"proof",type:"file",className:"col-span-3 text-sm",onChange:ye=>{var le;return W(((le=ye.target.files)==null?void 0:le[0])||null)}})]})]}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>$(!1),children:"Cancel"}),e.jsx(se,{className:"bg-amber-600 hover:bg-blue-700",onClick:ve,disabled:P,children:P?"Saving...":"Submit Response"})]})]})}),e.jsx(bE,{isOpen:S,onClose:()=>{A(!1),E(null)},onSubmit:V,editingBank:w,isSubmitting:T}),e.jsx(Gl,{isOpen:!!g,onClose:()=>u(null),document:g})]})}function _$({onViewPaymentDetails:t}={}){const[s,n]=v.useState([]),[r,a]=v.useState(!0),[l,c]=v.useState("pending");v.useEffect(()=>{d()},[]);const d=async()=>{try{a(!0);const u=await ds.getApplications();n(u.data||[])}catch(u){console.error("Fetch error:",u),ee.error("Failed to fetch applications")}finally{a(!1)}},m=u=>String(u||"").trim().toLowerCase(),x=u=>{const j=m(u);return j==="verified"||j==="paid"},f=s.flatMap(u=>{const j=u.overallStatus||u.status,p=["Payment Pending","Security Details","LOI In Progress","LOI Issued","LOA Pending","Dealer Code Generation","LOA_APPROVAL"].includes(j),y=u.securityDeposits||[];return y.length>0?y.map(N=>({id:N.id,applicationId:u.applicationId||u.id,application:u,paymentStatus:N.status,paymentType:N.depositType,amount:N.amount,createdAt:N.createdAt,verificationDate:N.verifiedAt,isVirtual:!1})):p?["Payment Pending","Security Details","LOI In Progress"].includes(j)?[{id:`virtual-${u.id}-sd`,applicationId:u.applicationId||u.id,application:u,paymentStatus:"Pending",paymentType:"SECURITY_DEPOSIT",amount:5e5,createdAt:u.updatedAt,verificationDate:null,isVirtual:!0}]:[{id:`virtual-${u.id}-ff`,applicationId:u.applicationId||u.id,application:u,paymentStatus:"Pending",paymentType:"FIRST_FILL",amount:15e5,createdAt:u.updatedAt,verificationDate:null,isVirtual:!0}]:[]}),h=f.filter(u=>l==="all"?!0:l==="pending"?!x(u.paymentStatus):l==="verified"?x(u.paymentStatus):!0),g=u=>{t&&t(u)};return r?e.jsxs("div",{className:"flex items-center justify-center p-20 text-blue-600",children:[e.jsx(Js,{className:"w-8 h-8 animate-spin mr-3"}),e.jsx("span",{children:"Loading Finance Queue..."})]}):e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between bg-white p-6 rounded-2xl border border-slate-100 shadow-sm",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-slate-900 tracking-tight mb-1",children:"Payment Verification"}),e.jsx("p",{className:"text-slate-500",children:"Review and verify dealer security deposits and first fill payments"})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs(se,{onClick:d,variant:"outline",size:"sm",className:"bg-white hover:bg-slate-50","data-testid":"onboarding-finance-queue-sync-btn",children:[e.jsx(Js,{className:"w-4 h-4 mr-2"}),"Sync Dashboard"]})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[e.jsx("div",{className:"inline-flex p-1 bg-slate-100 rounded-xl",children:e.jsxs("div",{className:"flex items-center px-4 py-2 bg-white rounded-lg text-slate-900 shadow-sm font-medium text-sm","data-testid":"onboarding-finance-queue-pending-count",children:[e.jsx(oa,{className:"w-4 h-4 mr-2 text-blue-600"}),"Pending Payments (",f.filter(u=>!x(u.paymentStatus)).length,")"]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(se,{variant:l==="pending"?"secondary":"ghost",size:"sm",onClick:()=>c("pending"),className:l==="pending"?"bg-slate-200 text-slate-900":"text-slate-500","data-testid":"onboarding-finance-queue-filter-pending",children:"Pending"}),e.jsx(se,{variant:l==="verified"?"secondary":"ghost",size:"sm",onClick:()=>c("verified"),className:l==="verified"?"bg-slate-200 text-slate-900":"text-slate-500","data-testid":"onboarding-finance-queue-filter-verified",children:"Verified"}),e.jsx(se,{variant:l==="all"?"secondary":"ghost",size:"sm",onClick:()=>c("all"),className:l==="all"?"bg-slate-200 text-slate-900":"text-slate-500","data-testid":"onboarding-finance-queue-filter-all",children:"All"})]})]}),e.jsx(Ie,{className:"border-none shadow-xl overflow-hidden rounded-2xl bg-white","data-testid":"onboarding-finance-queue-table-card",children:e.jsx(Me,{className:"p-0",children:e.jsxs(ks,{children:[e.jsx(Rs,{className:"bg-slate-50/50",children:e.jsxs(ct,{className:"border-b border-slate-100 uppercase text-[10px] tracking-wider font-bold text-slate-400",children:[e.jsx(me,{className:"py-4 pl-6","data-testid":"onboarding-finance-queue-th-details",children:"Application Details"}),e.jsx(me,{"data-testid":"onboarding-finance-queue-th-location",children:"Location"}),e.jsx(me,{"data-testid":"onboarding-finance-queue-th-stage",children:"Payment Stage"}),e.jsx(me,{"data-testid":"onboarding-finance-queue-th-status",children:"Current Status"}),e.jsx(me,{className:"text-right pr-6","data-testid":"onboarding-finance-queue-th-action",children:"Workflow Action"})]})}),e.jsx(Es,{children:h.length>0?h.map((u,j)=>{const p=u.paymentStatus||"Awaiting Payment",y=u.application||{};return e.jsxs(ct,{className:"hover:bg-blue-50/20 group transition-all","data-testid":`onboarding-finance-queue-row-${j}`,children:[e.jsx(de,{className:"py-4 pl-6",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-mono text-xs font-bold text-blue-600 mb-1","data-testid":`onboarding-finance-queue-app-id-${j}`,children:y.applicationId||y.id}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-semibold text-slate-900","data-testid":`onboarding-finance-queue-name-${j}`,children:y.applicantName})})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex flex-col text-sm","data-testid":`onboarding-finance-queue-location-${j}`,children:[e.jsx("span",{className:"text-slate-600 leading-none",children:y.city}),e.jsx("span",{className:"text-slate-400 text-xs mt-1",children:y.state})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2","data-testid":`onboarding-finance-queue-type-${j}`,children:[e.jsx(mu,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"text-sm font-medium",children:u.paymentType==="SECURITY_DEPOSIT"?"Security Deposit (₹5L)":"First Fill (₹15L)"})]})}),e.jsx(de,{children:e.jsx(Ae,{className:p==="Verified"?"bg-emerald-50 text-emerald-700 border-emerald-100 px-3 py-1 rounded-full":p==="Rejected"?"bg-rose-50 text-rose-700 border-rose-100 px-3 py-1 rounded-full":"bg-amber-50 text-amber-700 border-amber-100 px-3 py-1 rounded-full",variant:"outline","data-testid":`onboarding-finance-queue-status-${j}`,children:p})}),e.jsx(de,{className:"text-right pr-6",children:e.jsx(se,{size:"sm",variant:x(p)?"outline":"default",className:x(p)?"bg-white text-slate-600 border-slate-200":"bg-blue-600 hover:bg-blue-700 shadow-md",onClick:()=>g(u.applicationId||y.id),"data-testid":`onboarding-finance-queue-action-btn-${j}`,children:e.jsxs(e.Fragment,{children:[e.jsx(oa,{className:"w-4 h-4 mr-2"}),x(p)?"View Receipt":"Record Payment"]})})})]},u.id)}):e.jsx(ct,{children:e.jsx(de,{colSpan:5,className:"h-48 text-center text-slate-400 py-10","data-testid":"onboarding-finance-queue-empty",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 bg-slate-50 rounded-full flex items-center justify-center",children:e.jsx(Ys,{className:"w-6 h-6 text-slate-200"})}),e.jsx("p",{className:"text-sm",children:l==="verified"?"No verified payments found":l==="pending"?"No pending payments in the queue":"No onboarding payments found"})]})})})})]})})})]})}function P$({onViewFnFDetails:t}={}){const[s,n]=v.useState([]),[r,a]=v.useState(!0),[l,c]=v.useState(null),[d,m]=v.useState(!1),[x,f]=v.useState(!1),[h,g]=v.useState(""),[u,j]=v.useState(""),[p,y]=v.useState("all");v.useEffect(()=>{N()},[]);const N=async()=>{try{a(!0);const P=(await Te.getFnFSettlements()).data;P.success&&n(P.settlements||[])}catch(R){console.error("Fetch settlements error:",R),ee.error("Failed to fetch settlement cases")}finally{a(!1)}},S=R=>{var P,M,q,K,Z,W,U,F,B,D,O,z;return{id:R.id,caseId:R.settlementId||((P=R.resignation)==null?void 0:P.resignationId)||((M=R.terminationRequest)==null?void 0:M.requestId)||R.id.substring(0,8),dealerCode:((q=R.outlet)==null?void 0:q.code)||((Z=(K=R.dealer)==null?void 0:K.dealerCode)==null?void 0:Z.dealerCode)||"N/A",dealerName:((U=(W=R.outlet)==null?void 0:W.dealer)==null?void 0:U.fullName)||((F=R.dealer)==null?void 0:F.legalName)||((B=R.dealer)==null?void 0:B.businessName)||((D=R.dealer)==null?void 0:D.fullName)||"N/A",location:((O=R.outlet)==null?void 0:O.city)||((z=R.outlet)==null?void 0:z.location)||"N/A",terminationType:R.resignationId?"Resignation":"Termination",submittedDate:Ht(R.createdAt),status:R.status==="Calculated"?"Pending Finance Review":R.status==="Settled"?"Settled":R.status,financialData:{totalPayables:parseFloat(R.totalPayables)||0,totalReceivables:parseFloat(R.totalReceivables)||0,netAmount:parseFloat(R.netAmount)||0},settlementAmount:Math.abs(parseFloat(R.netAmount)||0),settlementType:parseFloat(R.netAmount)>0?"Payable to Dealer":"Receivable from Dealer",approvedDate:R.settlementDate?Ht(R.settlementDate):null}},A=s.map(S),w=A.filter(R=>p==="all"?!0:p==="pending"?R.status==="Pending Finance Review"||R.status==="Calculated"||R.status==="Initiated"||R.status==="Under Review":p==="approved"?R.status==="Settled"||R.status==="Completed":!0),E=R=>({receivables:R.totalReceivables||0,payables:R.totalPayables||0,deductions:0,netSettlement:R.netAmount||0,settlementType:(R.netAmount||0)>0?"Payable to Dealer":"Receivable from Dealer",settlementAmount:Math.abs(R.netAmount||0)}),T=R=>{t?t(R.id):(c(R),m(!0))},C=R=>{t?t(R.id):(c(R),f(!0))},L=()=>{const R=E(l.financialData);ee.success(`Settlement approved: ${R.settlementType} - ₹${R.settlementAmount.toLocaleString()}`),m(!1),g(""),j(""),c(null)},$=A.filter(R=>R.status==="Pending Finance Review"||R.status==="Calculated"||R.status==="Initiated"||R.status==="Under Review").length,_=A.filter(R=>R.status==="Settled"||R.status==="Completed").length;return r?e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-amber-600"})}):e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-slate-900 mb-2",children:"F&F Financial Settlement"}),e.jsx("p",{className:"text-slate-600",children:"Review and process full & final settlements for dealerships"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs(Ie,{children:[e.jsx(tt,{className:"pb-3",children:e.jsx(nt,{className:"text-sm text-slate-600",children:"Pending Review"})}),e.jsx(Me,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-slate-900 text-2xl",children:$}),e.jsx(F2,{className:"w-8 h-8 text-amber-600"})]})})]}),e.jsxs(Ie,{children:[e.jsx(tt,{className:"pb-3",children:e.jsx(nt,{className:"text-sm text-slate-600",children:"Approved Settlements"})}),e.jsx(Me,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-slate-900 text-2xl",children:_}),e.jsx(Ys,{className:"w-8 h-8 text-green-600"})]})})]}),e.jsxs(Ie,{children:[e.jsx(tt,{className:"pb-3",children:e.jsx(nt,{className:"text-sm text-slate-600",children:"Total Cases"})}),e.jsx(Me,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-slate-900 text-2xl",children:A.length}),e.jsx(fs,{className:"w-8 h-8 text-blue-600"})]})})]}),e.jsxs(Ie,{children:[e.jsx(tt,{className:"pb-3",children:e.jsx(nt,{className:"text-sm text-slate-600",children:"Net Financial Position"})}),e.jsxs(Me,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:`text-2xl ${A.reduce((R,P)=>R+(P.financialData.netAmount||0),0)<0?"text-green-600":"text-red-600"}`,children:["₹",Math.abs(A.reduce((R,P)=>R+(P.financialData.netAmount||0),0)).toLocaleString("en-IN")]}),e.jsx(Wi,{className:"w-8 h-8 text-purple-600"})]}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1",children:A.reduce((R,P)=>R+(P.financialData.netAmount||0),0)<0?"Net Receivable":"Net Payable"})]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(se,{variant:p==="all"?"default":"outline",onClick:()=>y("all"),className:p==="all"?"bg-amber-600 hover:bg-amber-700":"",children:["All Cases (",A.length,")"]}),e.jsxs(se,{variant:p==="pending"?"default":"outline",onClick:()=>y("pending"),className:p==="pending"?"bg-amber-600 hover:bg-amber-700":"",children:["Pending Review (",$,")"]}),e.jsxs(se,{variant:p==="approved"?"default":"outline",onClick:()=>y("approved"),className:p==="approved"?"bg-amber-600 hover:bg-amber-700":"",children:["Approved (",_,")"]})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"F&F Settlement Queue"}),e.jsx(Zt,{children:"Review financial status and calculate settlements"})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Case ID"}),e.jsx(me,{children:"Dealer Details"}),e.jsx(me,{children:"Location"}),e.jsx(me,{children:"Type"}),e.jsx(me,{children:"Submitted Date"}),e.jsx(me,{children:"Net Settlement"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Actions"})]})}),e.jsx(Es,{children:w.map(R=>{const P=E(R.financialData);return e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{children:[e.jsx("div",{className:"text-slate-900",children:R.caseId}),e.jsx("div",{className:"text-sm text-slate-500",children:R.dealerCode})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(kr,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"text-slate-900",children:R.dealerName})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Er,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"text-slate-900",children:R.location})]})}),e.jsx(de,{children:e.jsx(Ae,{variant:R.terminationType==="Resignation"?"default":"secondary",children:R.terminationType})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($n,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"text-slate-900",children:R.submittedDate})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[P.settlementType==="Payable to Dealer"?e.jsx(_o,{className:"w-4 h-4 text-red-600"}):e.jsx(Wi,{className:"w-4 h-4 text-green-600"}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-slate-900",children:["₹",P.settlementAmount.toLocaleString()]}),e.jsx("div",{className:"text-xs text-slate-500",children:P.settlementType})]})]})}),e.jsx(de,{children:e.jsx(Ae,{variant:R.status==="Settlement Approved"?"default":"secondary",className:R.status==="Settlement Approved"?"bg-green-600 text-white":"bg-amber-600 text-white",children:R.status})}),e.jsx(de,{children:e.jsxs(se,{size:"sm",variant:R.status==="Pending Finance Review"?"default":"outline",className:R.status==="Pending Finance Review"?"bg-amber-600 hover:bg-amber-700":"",onClick:()=>C(R),children:[e.jsx(fs,{className:"w-4 h-4 mr-2"}),"View Details"]})})]},R.id)})})]})})]}),e.jsx(os,{open:d,onOpenChange:m,children:e.jsxs(ls,{className:"max-w-5xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Financial Settlement Review"}),e.jsxs(vs,{children:["Review financial details and calculate final settlement for ",l==null?void 0:l.dealerName]})]}),l&&e.jsxs(_n,{defaultValue:"breakdown",className:"w-full",children:[e.jsxs(Pn,{className:"grid w-full grid-cols-3",children:[e.jsx(Wt,{value:"breakdown",children:"Financial Breakdown"}),e.jsx(Wt,{value:"calculation",children:"Settlement Calculation"}),e.jsx(Wt,{value:"summary",children:"Final Summary"})]}),e.jsxs(Kt,{value:"breakdown",className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(Ie,{className:"border-green-200 bg-green-50",children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(ym,{className:"w-5 h-5 text-green-600"}),"Payables to Dealer"]}),e.jsx(Zt,{children:"Amounts company owes to dealer"})]}),e.jsxs(Me,{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Security Deposit"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.securityDeposit.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Inventory Value"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.inventoryValue.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Equipment Value"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.equipmentValue.toLocaleString()]})]}),e.jsx("div",{className:"pt-3 border-t border-green-300",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-900",children:"Total Payables"}),e.jsxs("span",{className:"text-slate-900 text-lg",children:["₹",(l.financialData.securityDeposit+l.financialData.inventoryValue+l.financialData.equipmentValue).toLocaleString()]})]})})]})]}),e.jsxs(Ie,{className:"border-red-200 bg-red-50",children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(lv,{className:"w-5 h-5 text-red-600"}),"Receivables from Dealer"]}),e.jsx(Zt,{children:"Amounts dealer owes to company"})]}),e.jsxs(Me,{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Outstanding Invoices"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.outstandingInvoices.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Service Dues"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.serviceDues.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Parts Dues"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.partsDues.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Advances Given"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.advancesGiven.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Penalties"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.penalties.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Other Charges"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.otherCharges.toLocaleString()]})]}),e.jsx("div",{className:"pt-3 border-t border-red-300",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-900",children:"Total Receivables"}),e.jsxs("span",{className:"text-slate-900 text-lg",children:["₹",E(l.financialData).receivables.toLocaleString()]})]})})]})]})]}),e.jsxs(Ie,{className:"border-amber-200 bg-amber-50",children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(Gs,{className:"w-5 h-5 text-amber-600"}),"Deductions"]}),e.jsx(Zt,{children:"Pending claims and deductions"})]}),e.jsx(Me,{children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-600",children:"Warranty Claims Pending"}),e.jsxs("span",{className:"text-slate-900 text-lg",children:["₹",l.financialData.warrantyPending.toLocaleString()]})]})})]})]}),e.jsx(Kt,{value:"calculation",className:"space-y-4",children:e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Settlement Calculation"}),e.jsx(Zt,{children:"Step-by-step calculation of final settlement amount"})]}),e.jsx(Me,{className:"space-y-4",children:(()=>{const R=E(l.financialData);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center p-3 bg-green-50 rounded",children:[e.jsx("span",{className:"text-slate-900",children:"Total Payables (to Dealer)"}),e.jsxs("span",{className:"text-green-600 text-lg",children:["+ ₹",R.payables.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-red-50 rounded",children:[e.jsx("span",{className:"text-slate-900",children:"Total Receivables (from Dealer)"}),e.jsxs("span",{className:"text-red-600 text-lg",children:["- ₹",R.receivables.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-amber-50 rounded",children:[e.jsx("span",{className:"text-slate-900",children:"Total Deductions"}),e.jsxs("span",{className:"text-amber-600 text-lg",children:["- ₹",R.deductions.toLocaleString()]})]})]}),e.jsx("div",{className:"h-px bg-slate-300"}),e.jsxs("div",{className:`p-4 rounded-lg ${R.netSettlement>0?"bg-red-100 border-2 border-red-300":"bg-green-100 border-2 border-green-300"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-slate-900",children:"Net Settlement"}),e.jsxs("span",{className:"text-2xl text-slate-900",children:["₹",R.settlementAmount.toLocaleString()]})]}),e.jsx("div",{className:"flex items-center gap-2",children:R.settlementType==="Payable to Dealer"?e.jsxs(e.Fragment,{children:[e.jsx(_o,{className:"w-5 h-5 text-red-600"}),e.jsx("span",{className:"text-red-700",children:"Company needs to pay dealer"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Wi,{className:"w-5 h-5 text-green-600"}),e.jsx("span",{className:"text-green-700",children:"Dealer needs to pay company"})]})})]}),e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[e.jsx(Gs,{className:"w-5 h-5 text-blue-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-900 mb-1",children:"Calculation Formula"}),e.jsx("p",{className:"text-sm text-slate-600",children:"Net Settlement = Total Payables - Total Receivables - Total Deductions"}),e.jsxs("p",{className:"text-sm text-slate-600 mt-2",children:["= ₹",R.payables.toLocaleString()," - ₹",R.receivables.toLocaleString()," - ₹",R.deductions.toLocaleString()]})]})]})]})})()})]})}),e.jsxs(Kt,{value:"summary",className:"space-y-4",children:[e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Case Summary"})}),e.jsx(Me,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Case ID"}),e.jsx("p",{className:"text-slate-900",children:l.id})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Dealer Name"}),e.jsx("p",{className:"text-slate-900",children:l.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Dealer Code"}),e.jsx("p",{className:"text-slate-900",children:l.dealerCode})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Location"}),e.jsx("p",{className:"text-slate-900",children:l.location})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Termination Type"}),e.jsx("p",{className:"text-slate-900",children:l.terminationType})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Submitted Date"}),e.jsx("p",{className:"text-slate-900",children:l.submittedDate})]})]})})]}),e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{children:"Final Settlement"})}),e.jsxs(Me,{className:"space-y-4",children:[(()=>{const R=E(l.financialData);return e.jsxs("div",{className:`p-6 rounded-lg text-center ${R.settlementType==="Payable to Dealer"?"bg-red-100 border-2 border-red-300":"bg-green-100 border-2 border-green-300"}`,children:[e.jsxs("div",{className:"flex items-center justify-center gap-3 mb-3",children:[R.settlementType==="Payable to Dealer"?e.jsx(_o,{className:"w-8 h-8 text-red-600"}):e.jsx(Wi,{className:"w-8 h-8 text-green-600"}),e.jsx("span",{className:`text-lg ${R.settlementType==="Payable to Dealer"?"text-red-700":"text-green-700"}`,children:R.settlementType})]}),e.jsxs("div",{className:"text-4xl text-slate-900 mb-2",children:["₹",R.settlementAmount.toLocaleString()]}),e.jsx("p",{className:"text-slate-600",children:R.settlementType==="Payable to Dealer"?"Company will pay this amount to the dealer":"Dealer must pay this amount to the company"})]})})(),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"adjustments",children:"Adjustments (if any)"}),e.jsx(ot,{id:"adjustments",value:h,onChange:R=>g(R.target.value),placeholder:"Enter any adjustments to the settlement amount"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"finalNotes",children:"Final Notes"}),e.jsx(Fs,{id:"finalNotes",value:u,onChange:R=>j(R.target.value),placeholder:"Enter any final notes or remarks for this settlement...",rows:4})]})]})]})]})]}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>m(!1),children:"Cancel"}),e.jsxs(se,{className:"bg-green-600 hover:bg-green-700",onClick:L,children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"}),"Approve Settlement"]})]})]})}),e.jsx(os,{open:x,onOpenChange:f,children:e.jsxs(ls,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Settlement Details"}),e.jsxs(vs,{children:["Complete settlement information for ",l==null?void 0:l.dealerName]})]}),l&&e.jsxs(_n,{defaultValue:"info",className:"w-full",children:[e.jsxs(Pn,{className:"grid w-full grid-cols-2",children:[e.jsx(Wt,{value:"info",children:"Case Information"}),e.jsx(Wt,{value:"financial",children:"Financial Breakdown"})]}),e.jsx(Kt,{value:"info",className:"space-y-4 mt-4",children:e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{className:"text-base",children:"Case Details"})}),e.jsx(Me,{className:"space-y-3",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Case ID"}),e.jsx("p",{className:"text-slate-900",children:l.id})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Dealer Code"}),e.jsx("p",{className:"text-slate-900",children:l.dealerCode})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Dealer Name"}),e.jsx("p",{className:"text-slate-900",children:l.dealerName})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Location"}),e.jsx("p",{className:"text-slate-900",children:l.location})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Termination Type"}),e.jsx(Ae,{variant:l.terminationType==="Resignation"?"default":"secondary",children:l.terminationType})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Status"}),e.jsx(Ae,{variant:l.status==="Settlement Approved"?"default":"secondary",className:l.status==="Settlement Approved"?"bg-green-600 text-white":"bg-amber-600 text-white",children:l.status})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Submitted Date"}),e.jsx("p",{className:"text-slate-900",children:l.submittedDate})]}),l.approvedDate&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Approved Date"}),e.jsx("p",{className:"text-slate-900",children:l.approvedDate})]})]})})]})}),e.jsx(Kt,{value:"financial",className:"space-y-4 mt-4",children:(()=>{const R=E(l.financialData);return e.jsxs(e.Fragment,{children:[e.jsxs(Ie,{className:"border-green-200 bg-green-50",children:[e.jsx(tt,{children:e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(ym,{className:"w-5 h-5 text-green-600"}),"Payables to Dealer"]})}),e.jsxs(Me,{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Security Deposit"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.securityDeposit.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Inventory Value"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.inventoryValue.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Equipment Value"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.equipmentValue.toLocaleString()]})]}),e.jsx("div",{className:"pt-2 border-t border-green-300",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-900",children:"Total Payables"}),e.jsxs("span",{className:"text-slate-900 text-lg",children:["₹",R.payables.toLocaleString()]})]})})]})]}),e.jsxs(Ie,{className:"border-red-200 bg-red-50",children:[e.jsx(tt,{children:e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(lv,{className:"w-5 h-5 text-red-600"}),"Receivables from Dealer"]})}),e.jsxs(Me,{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Outstanding Invoices"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.outstandingInvoices.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Service Dues"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.serviceDues.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Parts Dues"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.partsDues.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Advances Given"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.advancesGiven.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Penalties"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.penalties.toLocaleString()]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Other Charges"}),e.jsxs("span",{className:"text-slate-900",children:["₹",l.financialData.otherCharges.toLocaleString()]})]}),e.jsx("div",{className:"pt-2 border-t border-red-300",children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-900",children:"Total Receivables"}),e.jsxs("span",{className:"text-slate-900 text-lg",children:["₹",R.receivables.toLocaleString()]})]})})]})]}),e.jsxs(Ie,{className:"border-amber-200 bg-amber-50",children:[e.jsx(tt,{children:e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(Gs,{className:"w-5 h-5 text-amber-600"}),"Deductions"]})}),e.jsx(Me,{children:e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-slate-600",children:"Warranty Claims Pending"}),e.jsxs("span",{className:"text-slate-900 text-lg",children:["₹",l.financialData.warrantyPending.toLocaleString()]})]})})]}),e.jsxs(Ie,{className:`${R.settlementType==="Payable to Dealer"?"border-red-300 bg-red-100":"border-green-300 bg-green-100"}`,children:[e.jsx(tt,{children:e.jsx(nt,{className:"text-base",children:"Net Settlement"})}),e.jsx(Me,{children:e.jsxs("div",{className:"text-center py-4",children:[e.jsxs("div",{className:"flex items-center justify-center gap-3 mb-2",children:[R.settlementType==="Payable to Dealer"?e.jsx(_o,{className:"w-6 h-6 text-red-600"}):e.jsx(Wi,{className:"w-6 h-6 text-green-600"}),e.jsx("span",{className:`text-lg ${R.settlementType==="Payable to Dealer"?"text-red-700":"text-green-700"}`,children:R.settlementType})]}),e.jsxs("div",{className:"text-3xl text-slate-900",children:["₹",R.settlementAmount.toLocaleString()]})]})})]})]})})()})]}),e.jsxs(rn,{children:[e.jsx(se,{variant:"outline",onClick:()=>f(!1),children:"Close"}),(l==null?void 0:l.status)==="Pending Finance Review"&&e.jsx(se,{className:"bg-amber-600 hover:bg-amber-700",onClick:()=>{f(!1),T(l)},children:"Review & Settle"})]})]})})]})}const Co=(...t)=>t.filter(Boolean).join(" ");function O$({applicationId:t,onBack:s}){var L,$,_,R;const[n,r]=v.useState(null),[a,l]=v.useState([]),[c,d]=v.useState("SECURITY_DEPOSIT"),[m,x]=v.useState(!0),[f,h]=v.useState(!1),[g,u]=v.useState({}),[j,p]=v.useState({verificationTransactionId:"",receivedAmount:"",receivedDate:new Date().toISOString().split("T")[0],verificationRemarks:""}),[y,N]=v.useState(!1),[S,A]=v.useState(null),w=a.find(P=>P.depositType===c);v.useEffect(()=>{E()},[t]),v.useEffect(()=>{var P,M,q;if(w)p({verificationTransactionId:w.paymentReference||"",receivedAmount:((P=w.amount)==null?void 0:P.toString())||"",receivedDate:w.verifiedAt?new Date(w.verifiedAt).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],verificationRemarks:w.remarks||""});else{const K=((M=g.SECURITY_DEPOSIT)==null?void 0:M.amount)||5e5,Z=((q=g.FIRST_FILL)==null?void 0:q.amount)||15e5;p({verificationTransactionId:"",receivedAmount:c==="SECURITY_DEPOSIT"?K.toString():Z.toString(),receivedDate:new Date().toISOString().split("T")[0],verificationRemarks:""})}},[c,w,g]);const E=async()=>{try{x(!0);const[P,M,q]=await Promise.all([ds.getApplicationById(t),ds.getSecurityDeposit(t),ds.getSystemConfigs({category:"SECURITY_DEPOSIT",format:"map"})]);r(P),l(Array.isArray(M)?M:[M].filter(Boolean)),u(q||{})}catch(P){console.error("Fetch error:",P),ee.error("Failed to load payment data")}finally{x(!1)}},T=async()=>{if(!j.verificationTransactionId||!j.receivedDate){ee.error("Please fill in all required payment details");return}try{h(!0),await ds.updateSecurityDeposit({applicationId:t,depositType:c,amount:Number(j.receivedAmount),paymentReference:j.verificationTransactionId,status:"Verified"}),ee.success(`${c==="SECURITY_DEPOSIT"?"Security Deposit":"First Fill"} verified and approved`),await E()}catch{ee.error("Failed to verify payment")}finally{h(!1)}},C=async()=>{if(!j.verificationRemarks){ee.error("Please provide remarks for rejection");return}try{h(!0),await ds.updateSecurityDeposit({applicationId:t,depositType:c,status:"Rejected",remarks:j.verificationRemarks}),ee.error(`${c==="SECURITY_DEPOSIT"?"Security Deposit":"First Fill"} rejected`),await E()}catch{ee.error("Failed to reject payment")}finally{h(!1)}};return m?e.jsx("div",{className:"flex items-center justify-center p-20",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-amber-600"})}):n?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"outline",size:"icon",onClick:s,children:e.jsx($r,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl mb-1",children:"Payment Verification"}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(se,{size:"sm",variant:c==="SECURITY_DEPOSIT"?"default":"outline",className:c==="SECURITY_DEPOSIT"?"bg-amber-600 hover:bg-amber-700":"",onClick:()=>d("SECURITY_DEPOSIT"),children:"Security Deposit"}),e.jsx(se,{size:"sm",variant:c==="FIRST_FILL"?"default":"outline",className:c==="FIRST_FILL"?"bg-amber-600 hover:bg-amber-700":"",onClick:()=>d("FIRST_FILL"),children:"First Fill"})]})]})]}),e.jsx(Ie,{className:Co("border",(w==null?void 0:w.status)==="Verified"?"border-green-200 bg-green-50":(w==null?void 0:w.status)==="Rejected"?"border-red-200 bg-red-50":"border-amber-200 bg-amber-50"),children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:Co("w-12 h-12 rounded-full flex items-center justify-center",(w==null?void 0:w.status)==="Verified"?"bg-green-100":(w==null?void 0:w.status)==="Rejected"?"bg-red-100":"bg-amber-100"),children:e.jsx(oa,{className:Co("w-6 h-6",(w==null?void 0:w.status)==="Verified"?"text-green-600":(w==null?void 0:w.status)==="Rejected"?"text-red-600":"text-amber-600")})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 font-bold",children:c==="SECURITY_DEPOSIT"?"Security Deposit":"First Fill"}),e.jsx("p",{className:"text-sm text-slate-600",children:(w==null?void 0:w.status)==="Verified"?`Verified on ${Ht(w.verifiedAt)}`:(w==null?void 0:w.status)==="Rejected"?"Payment Rejected":"Awaiting Verification"})]})]}),e.jsx(Ae,{className:Co((w==null?void 0:w.status)==="Verified"?"bg-green-600":(w==null?void 0:w.status)==="Rejected"?"bg-red-600":"bg-amber-600 text-white"),children:(w==null?void 0:w.status)||"No Record"})]})})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2 text-xl",children:[e.jsx(kr,{className:"w-5 h-5 text-amber-600"}),"Applicant Information"]})}),e.jsxs(Me,{className:"grid grid-cols-2 gap-y-4 gap-x-8",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Application ID"}),e.jsx("p",{className:"text-slate-900 font-medium",children:n.applicationId||n.id})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Applicant Name"}),e.jsx("p",{className:"text-slate-900 font-medium",children:n.applicantName})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Location"}),e.jsxs("p",{className:"text-slate-900 font-medium",children:[n.city||n.preferredLocation,", ",n.state]})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Email / Phone"}),e.jsx("p",{className:"text-slate-700 text-sm",children:n.email}),e.jsx("p",{className:"text-slate-700 text-sm",children:n.phone})]})]})]}),e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2 text-xl",children:[e.jsx(mu,{className:"w-5 h-5 text-amber-600"}),"Deposit Tracking"]})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 bg-slate-50 rounded-lg border border-slate-200",children:[e.jsx(ce,{className:"text-slate-500 block mb-1",children:"Expected Amount"}),e.jsxs("p",{className:"text-2xl font-bold text-amber-900",children:["₹",(c==="SECURITY_DEPOSIT"?((L=g.SECURITY_DEPOSIT)==null?void 0:L.amount)||5e5:(($=g.FIRST_FILL)==null?void 0:$.amount)||15e5).toLocaleString()]})]}),e.jsxs("div",{className:Co("p-4 rounded-lg border",(w==null?void 0:w.status)==="Verified"?"bg-green-50 border-green-200":"bg-blue-50 border-blue-200"),children:[e.jsx(ce,{className:"text-slate-500 block mb-1",children:"Receipt Status"}),e.jsx("p",{className:Co("text-2xl font-bold",(w==null?void 0:w.status)==="Verified"?"text-green-700":"text-blue-700"),children:(w==null?void 0:w.status)||"Not Started"})]})]}),(w==null?void 0:w.paymentReference)&&e.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Payment Reference"}),e.jsx("p",{className:"text-slate-900 font-mono",children:w.paymentReference})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Verified By"}),e.jsx("p",{className:"text-slate-900",children:((_=w.verifier)==null?void 0:_.fullName)||"N/A"})]})]})]})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"flex items-center gap-2 text-xl",children:[e.jsx(fs,{className:"w-5 h-5 text-amber-600"}),"Verification Evidence"]}),e.jsx(Zt,{children:"Documents uploaded by the applicant for payment proof"})]}),e.jsx(Me,{children:((R=n.uploadedDocuments)==null?void 0:R.filter(P=>{var M,q,K,Z;return c==="SECURITY_DEPOSIT"?((M=P.documentType)==null?void 0:M.toLowerCase().includes("security"))&&((q=P.documentType)==null?void 0:q.toLowerCase().includes("deposit")):((K=P.documentType)==null?void 0:K.toLowerCase().includes("first"))&&((Z=P.documentType)==null?void 0:Z.toLowerCase().includes("fill"))}).length)>0?e.jsx("div",{className:"space-y-3",children:n.uploadedDocuments.filter(P=>{var M,q,K,Z;return c==="SECURITY_DEPOSIT"?((M=P.documentType)==null?void 0:M.toLowerCase().includes("security"))&&((q=P.documentType)==null?void 0:q.toLowerCase().includes("deposit")):((K=P.documentType)==null?void 0:K.toLowerCase().includes("first"))&&((Z=P.documentType)==null?void 0:Z.toLowerCase().includes("fill"))}).map((P,M)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-white rounded-lg border border-slate-200 hover:shadow-sm transition-shadow",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded bg-slate-100 flex items-center justify-center",children:e.jsx(fs,{className:"w-5 h-5 text-slate-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900 font-medium",children:P.fileName||P.name}),e.jsxs("p",{className:"text-xs text-slate-500 uppercase",children:[P.documentType," • ",Ht(P.createdAt)]})]})]}),e.jsx(se,{variant:"ghost",size:"sm",className:"text-amber-600 hover:text-amber-700 hover:bg-amber-50",onClick:()=>{A(P),N(!0)},children:"View Receipt"})]},M))}):e.jsxs("div",{className:"text-center py-10 bg-slate-50 rounded-lg border-2 border-dashed border-slate-200",children:[e.jsx(Gs,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),e.jsx("p",{className:"text-slate-500",children:"No payment documents found in this application."})]})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(Ie,{className:"border-amber-100 shadow-sm",children:[e.jsx(tt,{className:"bg-amber-50/50",children:e.jsxs(nt,{className:"flex items-center gap-2 text-lg",children:[e.jsx(ym,{className:"w-5 h-5 text-amber-600"}),"Finance Action"]})}),e.jsxs(Me,{className:"pt-6 space-y-4",children:[e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"verificationTxnId",className:"text-xs uppercase text-slate-500 font-bold tracking-wider",children:["UTR / Reference Number ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"verificationTxnId",placeholder:"Enter Bank UTR Number",disabled:(w==null?void 0:w.status)==="Verified",className:"mt-1",value:j.verificationTransactionId,onChange:P=>p({...j,verificationTransactionId:P.target.value})})]}),e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"receivedAmount",className:"text-xs uppercase text-slate-500 font-bold tracking-wider",children:["Amount Received (₹) ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"receivedAmount",type:"number",placeholder:(c==="SECURITY_DEPOSIT"?5e5:15e5).toString(),disabled:(w==null?void 0:w.status)==="Verified",className:"mt-1",value:j.receivedAmount,onChange:P=>p({...j,receivedAmount:P.target.value})})]}),e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"receivedDate",className:"text-xs uppercase text-slate-500 font-bold tracking-wider",children:["Credit Value Date ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"receivedDate",type:"date",disabled:(w==null?void 0:w.status)==="Verified",className:"mt-1",value:j.receivedDate,onChange:P=>p({...j,receivedDate:P.target.value})})]}),e.jsxs("div",{children:[e.jsx(ce,{htmlFor:"remarks",className:"text-xs uppercase text-slate-500 font-bold tracking-wider",children:"Verification Remarks"}),e.jsx(Fs,{id:"remarks",placeholder:"Any internal notes for reconciliation...",rows:3,className:"mt-1",value:j.verificationRemarks,onChange:P=>p({...j,verificationRemarks:P.target.value})})]}),e.jsxs("div",{className:"pt-4 space-y-3",children:[e.jsx(se,{className:Co("w-full transition-all duration-200",(w==null?void 0:w.status)==="Verified"?"bg-green-600 hover:bg-green-600 opacity-90":"bg-amber-600 hover:bg-amber-700"),onClick:T,disabled:f||(w==null?void 0:w.status)==="Verified",children:(w==null?void 0:w.status)==="Verified"?e.jsxs(e.Fragment,{children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"})," Verified Successfully"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ys,{className:"w-4 h-4 mr-2"})," Mark as Verified"]})}),(w==null?void 0:w.status)!=="Verified"&&(w==null?void 0:w.status)!=="Rejected"&&e.jsxs(se,{variant:"ghost",className:"w-full text-red-600 hover:text-red-700 hover:bg-red-50",onClick:C,disabled:f,children:[e.jsx(Za,{className:"w-4 h-4 mr-2"}),"Reject / Flag Discrepancy"]})]})]})]}),e.jsxs(Ie,{className:"bg-slate-900 text-white border-none shadow-xl",children:[e.jsx(tt,{children:e.jsxs(nt,{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(Js,{className:"w-4 h-4 text-amber-400"}),"Next Steps"]})}),e.jsxs(Me,{className:"text-xs text-slate-300 space-y-3",children:[e.jsx("p",{children:"Once verified, the following will occur:"}),e.jsxs("ul",{className:"list-disc pl-4 space-y-2",children:[e.jsxs("li",{children:["Applicant status will advance to ",c==="SECURITY_DEPOSIT"?"LOI Issuance":"LOA Approval"]}),e.jsx("li",{children:"Email notification will be sent to Applicant"}),e.jsxs("li",{children:["Digital ",c==="SECURITY_DEPOSIT"?"LOI":"LOA"," generation will be unlocked"]}),e.jsxs("li",{children:["This payment confirms the ",c==="SECURITY_DEPOSIT"?"Security Deposit":"First Fill"]})]})]})]})]})]}),e.jsx(Gl,{isOpen:y,onClose:()=>N(!1),document:S})]}):e.jsx("div",{className:"p-20 text-center",children:"Application not found"})}const zi=["Warranty Department","Accessories Department","Sales Department","RTO Department","Service Department","Parts Department","Finance Department","Insurance Department","Inventory Department","Marketing Department","HR Department","IT Department","Legal Department","Quality Department","Logistics Department","Customer Relations Department"],g1="[DEPARTMENT_CLAIM]",v1="[FINANCE_VALIDATED]",eg=[{id:"calculations",label:"Verified All Department Calculations"},{id:"bank",label:"Confirmed Bank Account Details"},{id:"docs",label:"Reviewed All Supporting Documents"},{id:"sap",label:"Synced Final Dues with SAP"},{id:"noc",label:"Received All Mandatory NOCs"}];function L$({fnfId:t,onBack:s}){const[n,r]=v.useState(null),[a,l]=v.useState(!0),[c,d]=v.useState("overview"),[m,x]=v.useState([]),[f,h]=v.useState([]),[g,u]=v.useState([]),[j,p]=v.useState(null),[y,N]=v.useState([]),[S,A]=v.useState(!1),[w,E]=v.useState(null),[T,C]=v.useState([]);v.useEffect(()=>{L(),q()},[t]);const L=async()=>{var ie;try{const Q=(await Te.getSettlementDepartments()).data;Q&&Q.success&&((ie=Q.departments)==null?void 0:ie.length)>0}catch(Fe){console.error("Fetch departments error:",Fe)}},$=ie=>{if(!ie)return ie;let Fe=ie.trim();const Q=zi.find(Ee=>Ee.toLowerCase()===Fe.toLowerCase());if(Q)return Q;const Ne={sales:"Sales Department",service:"Service Department",spares:"Parts Department",parts:"Parts Department","spares / parts":"Parts Department",finance:"Finance Department",accounts:"Finance Department",warranty:"Warranty Department",marketing:"Marketing Department",hr:"HR Department",it:"IT Department",legal:"Legal Department",logistics:"Logistics Department",quality:"Quality Department",fdd:"Finance Department",apparel:"Accessories Department",accessories:"Accessories Department",dms:"IT Department",rto:"Admin Department",admin:"Admin Department","admin / dd-admin":"Admin Department"}[Fe.toLowerCase().replace(" department","")];return Ne||ie},_=(ie,Fe)=>Fe==="DepartmentClaim"||typeof ie=="string"&&(ie.startsWith(g1)||ie.includes("Clearance:")),R=ie=>(ie==null?void 0:ie.sourceType)==="FinanceValidated"&&typeof(ie==null?void 0:ie.description)=="string"&&ie.description.includes("Auto-seeded from department claim"),P=(ie,Fe)=>Fe==="FinanceValidated"||typeof ie=="string"&&ie.startsWith(v1),M=ie=>(ie||"").replace(g1,"").replace(v1,"").trim(),q=async(ie=!0)=>{var Fe,Q,pe,Ne,Ee,it,st,bt,Ue,It,ut,yt,kt,Le,Pt,ht,zt,rs,Yt,Os,Ls,zs,en,he,Ke,at,pt,mt,Bt,Ds,as,Vs,Is,Ts,ln,pn,hn,Ws,Qs,zn,on,Un,yr,Tr,er,tr,En;try{ie&&l(!0);const $t=(await Te.getFnFSettlementById(t)).data;if($t.success){const Ze=$t.fnf,Ut={id:Ze.id,caseNumber:Ze.settlementId||((Fe=Ze.resignation)==null?void 0:Fe.resignationId)||((Q=Ze.terminationRequest)==null?void 0:Q.requestId)||Ze.id.substring(0,8),dealerName:((Ne=(pe=Ze.outlet)==null?void 0:pe.dealer)==null?void 0:Ne.fullName)||((Ee=Ze.dealer)==null?void 0:Ee.fullName)||"N/A",dealerCode:((it=Ze.outlet)==null?void 0:it.code)||((bt=(st=Ze.dealer)==null?void 0:st.dealerCode)==null?void 0:bt.dealerCode)||"N/A",location:((Ue=Ze.outlet)==null?void 0:Ue.city)||((It=Ze.outlet)==null?void 0:It.location)||"N/A",terminationType:Ze.resignationId?"Resignation":"Termination",submittedDate:aa(Ze.createdAt),createdAt:Ze.createdAt,dueDate:Ze.settlementDate?aa(Ze.settlementDate):"TBD",status:Ze.status,dealerId:((yt=(ut=Ze.outlet)==null?void 0:ut.dealer)==null?void 0:yt.id)||Ze.dealerId,originalRequestId:((kt=Ze.resignation)==null?void 0:kt.resignationId)||((Le=Ze.terminationRequest)==null?void 0:Le.requestId)||((Pt=Ze.terminationRequest)==null?void 0:Pt.id)||"N/A",salesCode:((zt=(ht=Ze.dealer)==null?void 0:ht.dealerCode)==null?void 0:zt.salesCode)||((Ls=(Os=(Yt=(rs=Ze.outlet)==null?void 0:rs.dealer)==null?void 0:Yt.dealerProfile)==null?void 0:Os.dealerCode)==null?void 0:Ls.salesCode)||"N/A",serviceCode:((en=(zs=Ze.dealer)==null?void 0:zs.dealerCode)==null?void 0:en.serviceCode)||((pt=(at=(Ke=(he=Ze.outlet)==null?void 0:he.dealer)==null?void 0:Ke.dealerProfile)==null?void 0:at.dealerCode)==null?void 0:pt.serviceCode)||"N/A",gearCode:((Bt=(mt=Ze.dealer)==null?void 0:mt.dealerCode)==null?void 0:Bt.gearCode)||((Is=(Vs=(as=(Ds=Ze.outlet)==null?void 0:Ds.dealer)==null?void 0:as.dealerProfile)==null?void 0:Vs.dealerCode)==null?void 0:Is.gearCode)||"N/A",gmaCode:((ln=(Ts=Ze.dealer)==null?void 0:Ts.dealerCode)==null?void 0:ln.gmaCode)||((Qs=(Ws=(hn=(pn=Ze.outlet)==null?void 0:pn.dealer)==null?void 0:hn.dealerProfile)==null?void 0:Ws.dealerCode)==null?void 0:Qs.gmaCode)||"N/A",allLineItems:(Ze.lineItems||[]).filter(Tt=>Tt.isActive!==!1),departmentResponses:zi.map(Tt=>{const xs=(Ze.clearances||[]).find(wn=>$(wn.department)===Tt),Vr=(Ze.lineItems||[]).filter(wn=>wn.isActive!==!1),ta=Vr.filter(wn=>$(wn.department)===Tt&&_(wn.description,wn.sourceType)),ma=Vr.filter(wn=>$(wn.department)===Tt&&R(wn)),Pr=ta.length>0?ta:ma;let sr=0,gn=0;Pr.forEach(wn=>{const Da=Math.abs(parseFloat(wn.amount)||0);wn.itemType==="Payable"?sr+=Da:gn+=Da});const mn=sr-gn,Qn=Math.abs(mn)>0,fr=(xs==null?void 0:xs.status)||"Pending",pr=Qn?"Dues Pending":fr==="Cleared"?"NOC Submitted":fr,dn=mn>0?"payable":mn<0?"recovery":null;return{id:(xs==null?void 0:xs.id)||`dept-${Tt}`,departmentName:Tt,status:pr,remarks:(xs==null?void 0:xs.remarks)||"-",submittedDate:xs!=null&&xs.clearedAt?aa(xs.clearedAt):"-",amount:Math.abs(mn),duesFlow:dn,amountType:mn>0?"Payable to dealer":mn<0?"Receivable from dealer":null,supportingDocument:(xs==null?void 0:xs.supportingDocument)||null}}),documents:[{name:"Resignation Letter.pdf",size:"N/A",uploadedOn:aa(Ze.createdAt),type:"Resignation",url:"#"},...(Ze.clearances||[]).filter(Tt=>Tt.supportingDocument).map(Tt=>({name:Tt.supportingDocument.split("/").pop(),size:"N/A",uploadedOn:aa(Tt.clearedAt),type:`${Tt.department} Proof`,url:Tt.supportingDocument})),...(Ze.clearanceDocuments||[]).map(Tt=>{var xs;return{name:Tt.name||((xs=Tt.supportingDocument)==null?void 0:xs.split("/").pop())||"Document",size:"N/A",uploadedOn:aa(Tt.clearedAt||Ze.createdAt),type:"Finance Upload",url:Tt.supportingDocument}})]};r(Ut);const jt=Ze.bankDetails||((zn=Ze.dealer)==null?void 0:zn.bankDetails)||((yr=(Un=(on=Ze.outlet)==null?void 0:on.dealer)==null?void 0:Un.dealerProfile)==null?void 0:yr.bankDetails);jt&&jt.length>0?N(jt):((er=(Tr=Ze.outlet)==null?void 0:Tr.dealer)!=null&&er.id||Ze.dealerId)&&K(((En=(tr=Ze.outlet)==null?void 0:tr.dealer)==null?void 0:En.id)||Ze.dealerId);const Ln=[],jr=[],_r=[],xn=(Ze.lineItems||[]).filter(Tt=>Tt.isActive!==!1);(xn.some(Tt=>P(Tt.description,Tt.sourceType))?xn.filter(Tt=>P(Tt.description,Tt.sourceType)):xn.filter(Tt=>!_(Tt.description,Tt.sourceType))).forEach(Tt=>{const xs={id:Tt.id,department:$(Tt.department),description:M(Tt.description||Tt.remarks||""),amount:Math.abs(Tt.amount)};Tt.itemType==="Payable"?Ln.push(xs):Tt.itemType==="Deduction"?_r.push(xs):jr.push(xs)}),x(Ln),h(jr),u(_r),qe({verificationTransactionId:Ze.transactionReference||"",settlementAmount:(Ze.settlementAmount||Ye().settlementAmount).toString(),settlementDate:Ze.settlementDate?new Date(Ze.settlementDate).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],paymentMode:Ze.paymentMode||"",bankReference:"",verificationRemarks:Ze.remarks||"",adjustments:"0"})}}catch(Xe){console.error("Fetch F&F error:",Xe),ee.error("Failed to fetch settlement details")}finally{ie&&l(!1)}},K=async ie=>{try{const Q=(await Te.getDealerBankDetails(ie)).data;Q.success&&N(Q.bankDetails||[])}catch(Fe){console.error("Fetch bank details error:",Fe)}},Z=async ie=>{ie.preventDefault();const Fe=new FormData(ie.currentTarget),Q=Object.fromEntries(Fe.entries());try{const pe=n==null?void 0:n.dealerId;(await Te.saveBankDetail(pe,{...Q,id:w==null?void 0:w.id,isPrimary:Fe.get("isPrimary")==="on"})).data.success&&(ee.success("Bank details saved"),K(pe),A(!1),E(null))}catch{ee.error("Failed to save bank details")}},W=async ie=>{if(confirm("Are you sure you want to delete this bank account?"))try{(await Te.deleteBankDetail(ie)).data.success&&(ee.success("Bank detail deleted"),K(n==null?void 0:n.dealerId))}catch{ee.error("Failed to delete bank details")}},U=ie=>{C(Fe=>Fe.includes(ie)?Fe.filter(Q=>Q!==ie):[...Fe,ie])},[F,B]=v.useState({department:"",description:"",amount:""}),[D,O]=v.useState({department:"",description:"",amount:""}),[z,G]=v.useState({department:"",description:"",amount:""}),[Y,V]=v.useState(null),[X,ne]=v.useState(null),[oe,re]=v.useState(null),[ge,ve]=v.useState({}),[Se,We]=v.useState({}),[Ce,fe]=v.useState({}),Ye=()=>{const ie=m.reduce((Ne,Ee)=>Ne+(Number(Ee.amount)||0),0),Fe=f.reduce((Ne,Ee)=>Ne+(Number(Ee.amount)||0),0),Q=g.reduce((Ne,Ee)=>Ne+(Number(Ee.amount)||0),0),pe=ie-Fe-Q;return{payables:ie,receivables:Fe,deductions:Q,netSettlement:pe,settlementAmount:Math.abs(pe),settlementType:pe>0?"Payable to Dealer":pe<0?"Receivable from Dealer":"No Settlement Required"}},be=Ye(),Pe=zi.map(ie=>{const Fe=((n==null?void 0:n.departmentResponses)||[]).find(ut=>ut.departmentName===ie),Q=Number(Fe==null?void 0:Fe.amount)||0,pe=(Fe==null?void 0:Fe.amountType)||"-",Ne=m.filter(ut=>$(ut.department)===ie).reduce((ut,yt)=>ut+(Number(yt.amount)||0),0),Ee=f.filter(ut=>$(ut.department)===ie).reduce((ut,yt)=>ut+(Number(yt.amount)||0),0),it=g.filter(ut=>$(ut.department)===ie).reduce((ut,yt)=>ut+(Number(yt.amount)||0),0),st=Ne-Ee-it,bt=Math.abs(st),Ue=st>0?"Payable":st<0?"Receivable":"-",It=bt-Q;return{department:ie,claimAmount:Q,claimType:pe,validatedAmount:bt,validatedType:Ue,variance:It}}),[ke,qe]=v.useState({verificationTransactionId:"",settlementAmount:be.settlementAmount.toString(),settlementDate:new Date().toISOString().split("T")[0],paymentMode:"",bankReference:"",verificationRemarks:"",adjustments:"0"}),Ve=async()=>{var ie,Fe;if(!F.department||!F.description||!F.amount){ee.error("Please fill in all fields");return}try{const pe=(await Te.addLineItem(t,{department:F.department,description:F.description,amount:Math.abs(parseFloat(F.amount)),itemType:"Payable"})).data;pe.success&&(x([...m,{id:pe.lineItem.id,department:pe.lineItem.department,description:pe.lineItem.description,amount:Math.abs(pe.lineItem.amount)}]),B({department:"",description:"",amount:""}),ee.success("Payable item added"),q())}catch(Q){ee.error(((Fe=(ie=Q.response)==null?void 0:ie.data)==null?void 0:Fe.message)||"Failed to add payable item")}},dt=async(ie,Fe,Q)=>{ve(pe=>{const Ne=pe[ie]||m.find(Ee=>Ee.id===ie);return Ne?{...pe,[ie]:{...Ne,[Fe]:Fe==="amount"?Number(Q)||0:Q}}:pe})},xt=async ie=>{var Q,pe;const Fe=ge[ie];if(!Fe){V(null);return}x(Ne=>Ne.map(Ee=>Ee.id===ie?Fe:Ee));try{await Te.updateLineItem(ie,{department:Fe.department,description:Fe.description,amount:-Math.abs(Number(Fe.amount)||0)}),V(null),ve(Ne=>{const Ee={...Ne};return delete Ee[ie],Ee}),ee.success("Changes saved"),q(!1)}catch(Ne){ee.error(((pe=(Q=Ne.response)==null?void 0:Q.data)==null?void 0:pe.message)||"Failed to update item"),q(!1)}},ye=async ie=>{var Fe,Q;try{(await Te.deleteLineItem(ie)).data.success&&(x(m.filter(Ee=>Ee.id!==ie)),ee.info("Payable item removed"),q())}catch(pe){ee.error(((Q=(Fe=pe.response)==null?void 0:Fe.data)==null?void 0:Q.message)||"Failed to delete item")}},le=async()=>{var ie,Fe;if(!D.department||!D.description||!D.amount){ee.error("Please fill in all fields");return}try{const pe=(await Te.addLineItem(t,{department:D.department,description:D.description,amount:Math.abs(parseFloat(D.amount)),itemType:"Receivable"})).data;pe.success&&(h([...f,{id:pe.lineItem.id,department:pe.lineItem.department,description:pe.lineItem.description,amount:pe.lineItem.amount}]),O({department:"",description:"",amount:""}),ee.success("Receivable item added"),q())}catch(Q){ee.error(((Fe=(ie=Q.response)==null?void 0:ie.data)==null?void 0:Fe.message)||"Failed to add receivable item")}},Qe=async(ie,Fe,Q)=>{We(pe=>{const Ne=pe[ie]||f.find(Ee=>Ee.id===ie);return Ne?{...pe,[ie]:{...Ne,[Fe]:Fe==="amount"?Number(Q)||0:Q}}:pe})},rt=async ie=>{var Q,pe;const Fe=Se[ie];if(!Fe){ne(null);return}h(Ne=>Ne.map(Ee=>Ee.id===ie?Fe:Ee));try{await Te.updateLineItem(ie,{department:Fe.department,description:Fe.description,amount:Math.abs(Number(Fe.amount)||0)}),ne(null),We(Ne=>{const Ee={...Ne};return delete Ee[ie],Ee}),ee.success("Changes saved"),q(!1)}catch(Ne){ee.error(((pe=(Q=Ne.response)==null?void 0:Q.data)==null?void 0:pe.message)||"Failed to update item"),q(!1)}},Gt=async ie=>{var Fe,Q;try{await Te.deleteLineItem(ie),h(f.filter(pe=>pe.id!==ie)),ee.info("Receivable item removed"),q()}catch(pe){ee.error(((Q=(Fe=pe.response)==null?void 0:Fe.data)==null?void 0:Q.message)||"Failed to delete item")}},Rt=async()=>{var ie,Fe;if(!z.department||!z.description||!z.amount){ee.error("Please fill in all fields");return}try{const pe=(await Te.addLineItem(t,{department:z.department,description:z.description,amount:Math.abs(parseFloat(z.amount)),itemType:"Deduction"})).data;pe.success&&(u([...g,{id:pe.lineItem.id,department:pe.lineItem.department,description:pe.lineItem.description,amount:pe.lineItem.amount}]),G({department:"",description:"",amount:""}),ee.success("Deduction item added"),q())}catch(Q){ee.error(((Fe=(ie=Q.response)==null?void 0:ie.data)==null?void 0:Fe.message)||"Failed to add deduction item")}},Re=async(ie,Fe,Q)=>{fe(pe=>{const Ne=pe[ie]||g.find(Ee=>Ee.id===ie);return Ne?{...pe,[ie]:{...Ne,[Fe]:Fe==="amount"?Number(Q)||0:Q}}:pe})},Qt=async ie=>{var Q,pe;const Fe=Ce[ie];if(!Fe){re(null);return}u(Ne=>Ne.map(Ee=>Ee.id===ie?Fe:Ee));try{await Te.updateLineItem(ie,{department:Fe.department,description:Fe.description,amount:Math.abs(Number(Fe.amount)||0)}),re(null),fe(Ne=>{const Ee={...Ne};return delete Ee[ie],Ee}),ee.success("Changes saved"),q(!1)}catch(Ne){ee.error(((pe=(Q=Ne.response)==null?void 0:Q.data)==null?void 0:pe.message)||"Failed to update item"),q(!1)}},qt=async ie=>{try{await Te.deleteLineItem(ie),u(g.filter(Fe=>Fe.id!==ie)),ee.info("Deduction item removed"),q()}catch{ee.error("Failed to delete item")}},ws=async ie=>{var Q;const Fe=ie.target.files;if(Fe&&Fe.length>0){l(!0);try{let pe=0;for(let Ne=0;Ne{if(!ke.verificationTransactionId||!ke.settlementDate||!ke.paymentMode){ee.error("Please fill in all required settlement details");return}try{ns(!0);const ie=(be.settlementAmount||0)+parseFloat(ke.adjustments||"0");await tE.updateFnF(t,{status:"Completed",finalSettlementAmount:ie,settlementDate:ke.settlementDate,paymentMode:ke.paymentMode,transactionReference:ke.verificationTransactionId,remarks:ke.verificationRemarks||"Approved by Finance"}),ee.success(`F&F Settlement approved and completed for ${n.dealerName}`),setTimeout(()=>s(),1500)}catch(ie){console.error("Approve settlement error:",ie),ee.error(ie.message||"Failed to approve settlement")}finally{ns(!1)}},Bs=()=>{if(!ke.verificationRemarks){ee.error("Please provide remarks for rejection");return}ee.error(`F&F Settlement rejected for ${n.dealerName}`),setTimeout(()=>s(),1500)},Ft=()=>{if(!ke.verificationRemarks){ee.error("Please provide details for clarification request");return}ee.info(`Clarification request sent for ${n.dealerName}`),setTimeout(()=>s(),1500)};return a?e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(ss,{className:"w-8 h-8 animate-spin text-amber-600"})}):n?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(se,{variant:"outline",size:"icon",onClick:s,children:e.jsx($r,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl mb-1",children:"F&F Settlement Review"}),e.jsxs("p",{className:"text-slate-600",children:["Full & Final Settlement for ",n.dealerName]})]})]}),e.jsx(Ie,{className:"border-amber-200 bg-amber-50",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-12 shrink-0 aspect-square rounded-full bg-amber-100 flex items-center justify-center",children:e.jsx(oa,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900",children:"Settlement Pending Finance Approval"}),e.jsxs("p",{className:"text-sm text-slate-600",children:["Case: ",n.caseNumber," • Due: ",n.dueDate]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ae,{className:"bg-amber-600",children:n.status}),e.jsx(Ae,{variant:n.terminationType==="Resignation"?"default":"secondary",children:n.terminationType})]})]})})}),e.jsx(Ie,{className:`${be.settlementType==="Payable to Dealer"?"border-red-300 bg-red-50":be.settlementType==="Receivable from Dealer"?"border-green-300 bg-green-50":"border-slate-300 bg-slate-50"}`,children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[be.settlementType==="Payable to Dealer"?e.jsx(_o,{className:"w-12 h-12 text-red-600"}):be.settlementType==="Receivable from Dealer"?e.jsx(Wi,{className:"w-12 h-12 text-green-600"}):e.jsx(Ys,{className:"w-12 h-12 text-slate-600"}),e.jsxs("div",{children:[e.jsx("p",{className:`text-sm ${be.settlementType==="Payable to Dealer"?"text-red-700":be.settlementType==="Receivable from Dealer"?"text-green-700":"text-slate-700"}`,children:be.settlementType}),e.jsx("p",{className:"text-3xl text-slate-900",children:be.settlementType==="No Settlement Required"?"₹0":`₹${be.settlementAmount.toLocaleString("en-IN")}`})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sm text-slate-600",children:"Net Settlement Amount"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:be.settlementType==="Payable to Dealer"?"Company will pay to dealer":be.settlementType==="Receivable from Dealer"?"Dealer must pay to company":"No payment required"})]})]})})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2 space-y-6",children:e.jsxs(_n,{value:c,onValueChange:d,className:"w-full",children:[e.jsxs(Pn,{className:"grid w-full grid-cols-5",children:[e.jsx(Wt,{value:"overview",children:"Overview"}),e.jsx(Wt,{value:"financial",children:"Financial"}),e.jsx(Wt,{value:"departments",children:"Departments"}),e.jsx(Wt,{value:"documents",children:"Documents"}),e.jsx(Wt,{value:"bank",children:"Bank Details"})]}),e.jsxs(Kt,{value:"overview",className:"space-y-4",children:[e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(kr,{className:"w-5 h-5"}),"Case Information"]})}),e.jsx(Me,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Case Number"}),e.jsx("p",{className:"text-slate-900",children:n.caseNumber})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Dealer Code"}),e.jsx("p",{className:"text-slate-900",children:n.dealerCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Dealer Name"}),e.jsx("p",{className:"text-slate-900",children:n.dealerName})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Location"}),e.jsx("p",{className:"text-slate-900",children:n.location})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Termination Type"}),e.jsx(Ae,{variant:n.terminationType==="Resignation"?"default":"secondary",children:n.terminationType})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Status"}),e.jsx(Ae,{className:"bg-amber-600",children:n.status})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Submitted Date"}),e.jsx("p",{className:"text-slate-900",children:n.submittedDate})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Due Date"}),e.jsx("p",{className:"text-slate-900",children:n.dueDate})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Request Age"}),e.jsx("p",{className:"text-slate-900",children:(()=>{const ie=new Date(n.createdAt),Q=Math.abs(new Date().getTime()-ie.getTime()),pe=Math.ceil(Q/(1e3*60*60*24));return`${pe} day${pe!==1?"s":""}`})()})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Sales Code"}),e.jsx("p",{className:"text-slate-900",children:n.salesCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Service Code"}),e.jsx("p",{className:"text-slate-900",children:n.serviceCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"Gear Code"}),e.jsx("p",{className:"text-slate-900",children:n.gearCode})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-slate-500",children:"GMA Code"}),e.jsx("p",{className:"text-slate-900",children:n.gmaCode})]})]})})]}),e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(oa,{className:"w-5 h-5"}),"Settlement Calculation Summary"]})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center p-3 bg-green-50 rounded-lg",children:[e.jsx("span",{className:"text-slate-900",children:"Total Payables (to Dealer)"}),e.jsxs("span",{className:"text-green-700 text-lg",children:["+ ₹",be.payables.toLocaleString("en-IN")]})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-red-50 rounded-lg",children:[e.jsx("span",{className:"text-slate-900",children:"Total Receivables (from Dealer)"}),e.jsxs("span",{className:"text-red-700 text-lg",children:["- ₹",be.receivables.toLocaleString("en-IN")]})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-amber-50 rounded-lg",children:[e.jsx("span",{className:"text-slate-900",children:"Total Deductions"}),e.jsxs("span",{className:"text-amber-700 text-lg",children:["- ₹",be.deductions.toLocaleString("en-IN")]})]})]}),e.jsx("div",{className:"h-px bg-slate-300"}),e.jsx("div",{className:`p-4 rounded-lg border-2 ${be.settlementType==="Payable to Dealer"?"bg-red-100 border-red-300":be.settlementType==="Receivable from Dealer"?"bg-green-100 border-green-300":"bg-slate-100 border-slate-300"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-slate-900",children:"Net Settlement"}),e.jsx("p",{className:`text-sm ${be.settlementType==="Payable to Dealer"?"text-red-700":be.settlementType==="Receivable from Dealer"?"text-green-700":"text-slate-700"}`,children:be.settlementType})]}),e.jsx("span",{className:"text-2xl text-slate-900",children:be.settlementType==="No Settlement Required"?"₹0":`₹${be.settlementAmount.toLocaleString("en-IN")}`})]})}),e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-blue-50 border border-amber-200 rounded-lg",children:[e.jsx(Gs,{className:"w-5 h-5 text-amber-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-900 mb-1",children:"Calculation Formula"}),e.jsxs("p",{className:"text-sm text-slate-600",children:["Net Settlement = Payables - Receivables - Deductions",e.jsx("br",{}),e.jsx("span",{className:"text-xs",children:"All amounts are editable in the Financial tab"})]})]})]})]})]})]}),e.jsxs(Kt,{value:"financial",className:"space-y-4",children:[e.jsxs(Ie,{className:"border-blue-200 bg-blue-50",children:[e.jsxs(tt,{children:[e.jsx(nt,{className:"text-base",children:"Department Claim vs Finance Validation"}),e.jsx(Zt,{children:"Finance validated values are used for final settlement totals."})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Department Claim"}),e.jsx(me,{children:"Finance Validated"}),e.jsx(me,{children:"Variance"})]})}),e.jsx(Es,{children:Pe.map(ie=>e.jsxs(ct,{children:[e.jsx(de,{children:ie.department}),e.jsx(de,{children:ie.claimAmount>0?`${ie.claimType} ₹${ie.claimAmount.toLocaleString("en-IN")}`:"-"}),e.jsx(de,{children:ie.validatedAmount>0?`${ie.validatedType} ₹${ie.validatedAmount.toLocaleString("en-IN")}`:"-"}),e.jsx(de,{className:ie.variance===0?"text-slate-600":ie.variance>0?"text-red-600":"text-green-600",children:ie.claimAmount===0&&ie.validatedAmount===0?"-":`₹${ie.variance.toLocaleString("en-IN")}`})]},ie.department))})]})})]}),e.jsxs(Ie,{className:"border-green-200 bg-green-50",children:[e.jsx(tt,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(ym,{className:"w-5 h-5 text-green-600"}),"Payables to Dealer (Editable)"]}),e.jsx(Zt,{children:"Add or modify amounts company owes to dealer"})]})})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Description"}),e.jsx(me,{className:"text-right",children:"Amount (₹)"}),e.jsx(me,{className:"w-[100px]",children:"Actions"})]})}),e.jsx(Es,{children:m.map(ie=>{var Fe,Q,pe;return e.jsxs(ct,{children:[e.jsx(de,{children:Y===ie.id?e.jsxs(wt,{value:((Fe=ge[ie.id])==null?void 0:Fe.department)||ie.department,onValueChange:Ne=>dt(ie.id,"department",Ne),children:[e.jsx(Ct,{className:"h-8",children:e.jsx(St,{placeholder:"Department"})}),e.jsx(At,{children:zi.map(Ne=>e.jsx(_e,{value:Ne,children:Ne},Ne))})]}):e.jsx("span",{className:"text-slate-900",children:$(ie.department)})}),e.jsx(de,{children:Y===ie.id?e.jsx(ot,{value:((Q=ge[ie.id])==null?void 0:Q.description)||ie.description,onChange:Ne=>dt(ie.id,"description",Ne.target.value),className:"h-8"}):e.jsx("span",{className:"text-slate-600",children:ie.description})}),e.jsx(de,{className:"text-right",children:Y===ie.id?e.jsx(ot,{type:"number",value:((pe=ge[ie.id])==null?void 0:pe.amount)??ie.amount,onChange:Ne=>dt(ie.id,"amount",Ne.target.value),className:"h-8 text-right"}):e.jsxs("span",{className:"text-slate-900",children:["₹",ie.amount.toLocaleString("en-IN")]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex gap-1",children:[Y===ie.id?e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>xt(ie.id),children:e.jsx(Yi,{className:"w-4 h-4"})}):e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>{V(ie.id),ve(Ne=>({...Ne,[ie.id]:{...ie}}))},children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8 text-red-600 hover:text-red-700",onClick:()=>ye(ie.id),children:e.jsx(Kn,{className:"w-4 h-4"})})]})})]},ie.id)})})]}),e.jsxs("div",{className:"border-t border-green-300 pt-4 space-y-3",children:[e.jsx("p",{className:"text-sm text-slate-700",children:"Add New Payable Item:"}),e.jsxs("div",{className:"grid grid-cols-12 gap-2",children:[e.jsxs(wt,{value:F.department,onValueChange:ie=>B({...F,department:ie}),children:[e.jsx(Ct,{className:"col-span-3",children:e.jsx(St,{placeholder:"Department"})}),e.jsx(At,{children:zi.map(ie=>e.jsx(_e,{value:ie,children:ie},ie))})]}),e.jsx(ot,{placeholder:"Description",value:F.description,onChange:ie=>B({...F,description:ie.target.value}),className:"col-span-5"}),e.jsx(ot,{type:"number",placeholder:"Amount",value:F.amount,onChange:ie=>B({...F,amount:ie.target.value}),className:"col-span-3"}),e.jsx(se,{onClick:Ve,className:"col-span-1 bg-green-600 hover:bg-green-700",children:e.jsx(cn,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"pt-3 border-t-2 border-green-400",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-900",children:"Total Payables"}),e.jsxs("span",{className:"text-green-700 text-xl",children:["₹",be.payables.toLocaleString("en-IN")]})]})})]})]}),e.jsxs(Ie,{className:"border-red-200 bg-red-50",children:[e.jsx(tt,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(lv,{className:"w-5 h-5 text-red-600"}),"Receivables from Dealer (Editable)"]}),e.jsx(Zt,{children:"Add or modify amounts dealer owes to company"})]})})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Description"}),e.jsx(me,{className:"text-right",children:"Amount (₹)"}),e.jsx(me,{className:"w-[100px]",children:"Actions"})]})}),e.jsx(Es,{children:f.map(ie=>{var Fe,Q,pe;return e.jsxs(ct,{children:[e.jsx(de,{children:X===ie.id?e.jsxs(wt,{value:((Fe=Se[ie.id])==null?void 0:Fe.department)||ie.department,onValueChange:Ne=>Qe(ie.id,"department",Ne),children:[e.jsx(Ct,{className:"h-8",children:e.jsx(St,{placeholder:"Department"})}),e.jsx(At,{children:zi.map(Ne=>e.jsx(_e,{value:Ne,children:Ne},Ne))})]}):e.jsx("span",{className:"text-slate-900",children:$(ie.department)})}),e.jsx(de,{children:X===ie.id?e.jsx(ot,{value:((Q=Se[ie.id])==null?void 0:Q.description)||ie.description,onChange:Ne=>Qe(ie.id,"description",Ne.target.value),className:"h-8"}):e.jsx("span",{className:"text-slate-600",children:ie.description})}),e.jsx(de,{className:"text-right",children:X===ie.id?e.jsx(ot,{type:"number",value:((pe=Se[ie.id])==null?void 0:pe.amount)??ie.amount,onChange:Ne=>Qe(ie.id,"amount",Ne.target.value),className:"h-8 text-right"}):e.jsxs("span",{className:"text-slate-900",children:["₹",ie.amount.toLocaleString("en-IN")]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex gap-1",children:[X===ie.id?e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>rt(ie.id),children:e.jsx(Yi,{className:"w-4 h-4"})}):e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>{ne(ie.id),We(Ne=>({...Ne,[ie.id]:{...ie}}))},children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8 text-red-600 hover:text-red-700",onClick:()=>Gt(ie.id),children:e.jsx(Kn,{className:"w-4 h-4"})})]})})]},ie.id)})})]}),e.jsxs("div",{className:"border-t border-red-300 pt-4 space-y-3",children:[e.jsx("p",{className:"text-sm text-slate-700",children:"Add New Receivable Item:"}),e.jsxs("div",{className:"grid grid-cols-12 gap-2",children:[e.jsxs(wt,{value:D.department,onValueChange:ie=>O({...D,department:ie}),children:[e.jsx(Ct,{className:"col-span-3",children:e.jsx(St,{placeholder:"Department"})}),e.jsx(At,{children:zi.map(ie=>e.jsx(_e,{value:ie,children:ie},ie))})]}),e.jsx(ot,{placeholder:"Description",value:D.description,onChange:ie=>O({...D,description:ie.target.value}),className:"col-span-5"}),e.jsx(ot,{type:"number",placeholder:"Amount",value:D.amount,onChange:ie=>O({...D,amount:ie.target.value}),className:"col-span-3"}),e.jsx(se,{onClick:le,className:"col-span-1 bg-red-600 hover:bg-red-700",children:e.jsx(cn,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"pt-3 border-t-2 border-red-400",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-900",children:"Total Receivables"}),e.jsxs("span",{className:"text-red-700 text-xl",children:["₹",be.receivables.toLocaleString("en-IN")]})]})})]})]}),e.jsxs(Ie,{className:"border-amber-200 bg-amber-50",children:[e.jsx(tt,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsxs(nt,{className:"text-base flex items-center gap-2",children:[e.jsx(Gs,{className:"w-5 h-5 text-amber-600"}),"Deductions (Editable)"]}),e.jsx(Zt,{children:"Add or modify pending claims and deductions"})]})})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Description"}),e.jsx(me,{className:"text-right",children:"Amount (₹)"}),e.jsx(me,{className:"w-[100px]",children:"Actions"})]})}),e.jsx(Es,{children:g.map(ie=>{var Fe,Q,pe;return e.jsxs(ct,{children:[e.jsx(de,{children:oe===ie.id?e.jsxs(wt,{value:((Fe=Ce[ie.id])==null?void 0:Fe.department)||ie.department,onValueChange:Ne=>Re(ie.id,"department",Ne),children:[e.jsx(Ct,{className:"h-8",children:e.jsx(St,{placeholder:"Department"})}),e.jsx(At,{children:zi.map(Ne=>e.jsx(_e,{value:Ne,children:Ne},Ne))})]}):e.jsx("span",{className:"text-slate-900",children:$(ie.department)})}),e.jsx(de,{children:oe===ie.id?e.jsx(ot,{value:((Q=Ce[ie.id])==null?void 0:Q.description)||ie.description,onChange:Ne=>Re(ie.id,"description",Ne.target.value),className:"h-8"}):e.jsx("span",{className:"text-slate-600",children:ie.description})}),e.jsx(de,{className:"text-right",children:oe===ie.id?e.jsx(ot,{type:"number",value:((pe=Ce[ie.id])==null?void 0:pe.amount)??ie.amount,onChange:Ne=>Re(ie.id,"amount",Ne.target.value),className:"h-8 text-right"}):e.jsxs("span",{className:"text-slate-900",children:["₹",ie.amount.toLocaleString("en-IN")]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex gap-1",children:[oe===ie.id?e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Qt(ie.id),children:e.jsx(Yi,{className:"w-4 h-4"})}):e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>{re(ie.id),fe(Ne=>({...Ne,[ie.id]:{...ie}}))},children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8 text-red-600 hover:text-red-700",onClick:()=>qt(ie.id),children:e.jsx(Kn,{className:"w-4 h-4"})})]})})]},ie.id)})})]}),e.jsxs("div",{className:"border-t border-amber-300 pt-4 space-y-3",children:[e.jsx("p",{className:"text-sm text-slate-700",children:"Add New Deduction Item:"}),e.jsxs("div",{className:"grid grid-cols-12 gap-2",children:[e.jsxs(wt,{value:z.department,onValueChange:ie=>G({...z,department:ie}),children:[e.jsx(Ct,{className:"col-span-3",children:e.jsx(St,{placeholder:"Department"})}),e.jsx(At,{children:zi.map(ie=>e.jsx(_e,{value:ie,children:ie},ie))})]}),e.jsx(ot,{placeholder:"Description",value:z.description,onChange:ie=>G({...z,description:ie.target.value}),className:"col-span-5"}),e.jsx(ot,{type:"number",placeholder:"Amount",value:z.amount,onChange:ie=>G({...z,amount:ie.target.value}),className:"col-span-3"}),e.jsx(se,{onClick:Rt,className:"col-span-1 bg-amber-600 hover:bg-amber-700",children:e.jsx(cn,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"pt-3 border-t-2 border-amber-400",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-900",children:"Total Deductions"}),e.jsxs("span",{className:"text-amber-700 text-xl",children:["₹",be.deductions.toLocaleString("en-IN")]})]})})]})]}),e.jsxs(Ie,{className:"border-2 border-blue-300 bg-blue-50",children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(Ys,{className:"w-5 h-5 text-amber-600"}),"Final Settlement Summary"]})}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center p-3 bg-white rounded-lg",children:[e.jsx("span",{className:"text-slate-900",children:"Total Payables (to Dealer)"}),e.jsxs("span",{className:"text-green-700 text-lg",children:["+ ₹",be.payables.toLocaleString("en-IN")]})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-white rounded-lg",children:[e.jsx("span",{className:"text-slate-900",children:"Total Receivables (from Dealer)"}),e.jsxs("span",{className:"text-red-700 text-lg",children:["- ₹",be.receivables.toLocaleString("en-IN")]})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-white rounded-lg",children:[e.jsx("span",{className:"text-slate-900",children:"Total Deductions"}),e.jsxs("span",{className:"text-amber-700 text-lg",children:["- ₹",be.deductions.toLocaleString("en-IN")]})]})]}),e.jsx("div",{className:"h-px bg-blue-300"}),e.jsx("div",{className:`p-4 rounded-lg border-2 ${be.settlementType==="Payable to Dealer"?"bg-red-100 border-red-400":be.settlementType==="Receivable from Dealer"?"bg-green-100 border-green-400":"bg-slate-100 border-slate-400"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Net Settlement"}),e.jsx("p",{className:`text-lg ${be.settlementType==="Payable to Dealer"?"text-red-700":be.settlementType==="Receivable from Dealer"?"text-green-700":"text-slate-700"}`,children:be.settlementType})]}),e.jsx("span",{className:"text-3xl text-slate-900",children:be.settlementType==="No Settlement Required"?"₹0":`₹${be.settlementAmount.toLocaleString("en-IN")}`})]})}),e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-white border border-amber-200 rounded-lg",children:[e.jsx(Gs,{className:"w-5 h-5 text-amber-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-900 mb-1",children:"Calculation Formula"}),e.jsxs("p",{className:"text-sm text-slate-600",children:["Net Settlement = Payables - Receivables - Deductions",e.jsx("br",{}),be.netSettlement>0&&"Positive value means company pays to dealer",be.netSettlement<0&&"Negative value means dealer pays to company",be.netSettlement===0&&"Zero means no payment required from either party"]})]})]})]})]})]}),e.jsxs(Kt,{value:"departments",className:"space-y-4",children:[e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(da,{className:"w-5 h-5"}),"Department Response Progress"]}),e.jsxs(Zt,{children:[n.departmentResponses.filter(ie=>ie.status!=="Pending").length," of ",n.departmentResponses.length," departments have responded"]})]}),e.jsxs(Me,{className:"space-y-4",children:[e.jsx(ji,{value:n.departmentResponses.filter(ie=>ie.status!=="Pending").length/n.departmentResponses.length*100,className:"h-3"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"p-4 bg-green-50 rounded-lg border border-green-200",children:[e.jsx("p",{className:"text-sm text-green-700 mb-1",children:"NOC Submitted"}),e.jsx("p",{className:"text-2xl text-green-600",children:n.departmentResponses.filter(ie=>ie.status==="NOC Submitted").length})]}),e.jsxs("div",{className:"p-4 bg-red-50 rounded-lg border border-red-200",children:[e.jsx("p",{className:"text-sm text-red-700 mb-1",children:"Dues Pending"}),e.jsx("p",{className:"text-2xl text-red-600",children:n.departmentResponses.filter(ie=>ie.status==="Dues Pending").length})]}),e.jsxs("div",{className:"p-4 bg-slate-50 rounded-lg border border-slate-200",children:[e.jsx("p",{className:"text-sm text-slate-700 mb-1",children:"Awaiting Response"}),e.jsx("p",{className:"text-2xl text-slate-600",children:n.departmentResponses.filter(ie=>ie.status==="Pending").length})]})]})]})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"All Department Responses"}),e.jsx(Zt,{children:"Status of NOC and dues clearance from all 16 departments (read-only for Finance; updates are done by department stakeholders)."})]}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Department"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Amount Type"}),e.jsx(me,{children:"Amount"}),e.jsx(me,{children:"Submitted Date"}),e.jsx(me,{children:"Remarks"})]})}),e.jsx(Es,{children:n.departmentResponses.map(ie=>e.jsxs(ct,{className:ie.duesFlow==="recovery"?"bg-red-50/40":ie.duesFlow==="payable"?"bg-emerald-50/40":"",children:[e.jsx(de,{children:ie.departmentName}),e.jsx(de,{children:e.jsx(Ae,{className:`border ${ie.status==="NOC Submitted"?"bg-green-100 text-green-700 border-green-300":ie.status==="Dues Pending"?"bg-red-100 text-red-700 border-red-300":"bg-slate-100 text-slate-700 border-slate-300"}`,children:ie.status})}),e.jsx(de,{children:ie.amountType?e.jsx(Ae,{variant:"outline",className:ie.duesFlow==="recovery"?"bg-red-100 text-red-900 border-red-400 font-semibold":ie.duesFlow==="payable"?"bg-emerald-100 text-emerald-900 border-emerald-400 font-semibold":"bg-slate-50 text-slate-700 border-slate-200",children:ie.amountType}):"-"}),e.jsx(de,{children:ie.amount?e.jsxs("span",{className:`rounded-md px-2 py-0.5 font-semibold tabular-nums ${ie.duesFlow==="recovery"?"bg-red-100 text-red-800 ring-1 ring-red-300/70":ie.duesFlow==="payable"?"bg-emerald-100 text-emerald-800 ring-1 ring-emerald-300/70":"text-slate-700"}`,children:["₹",ie.amount.toLocaleString("en-IN")]}):"-"}),e.jsx(de,{children:ie.submittedDate||"-"}),e.jsx(de,{className:"max-w-xs truncate",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{children:ie.remarks||"-"}),ie.supportingDocument&&e.jsxs("button",{onClick:()=>p({fileName:`${ie.departmentName}_Proof`,filePath:ie.supportingDocument,documentType:"Departmental Clearance Proof"}),className:"flex items-center gap-1 text-[10px] text-amber-600 hover:underline",children:[e.jsx(qd,{className:"w-3 h-3"}),"View Proof"]})]})})]},ie.id))})]})})]}),e.jsx(Ie,{className:"bg-blue-50 border-amber-200",children:e.jsx(Me,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Gs,{className:"w-5 h-5 text-amber-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-900 mb-1",children:"Department Response Guidelines"}),e.jsxs("ul",{className:"text-sm text-slate-700 space-y-1",children:[e.jsxs("li",{children:["• ",e.jsx("strong",{children:"NOC Submitted:"})," Department has no outstanding dues and provided clearance"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Dues Pending:"})," Department has identified amounts to be recovered or paid"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Pending:"})," Department has not yet responded to the F&F request"]})]})]})]})})})]}),e.jsxs(Kt,{value:"documents",className:"space-y-4",children:[e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-5 h-5"}),"Submitted Documents"]})}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-2",children:n.documents.map((ie,Fe)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded-lg border border-slate-200",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(fs,{className:"w-5 h-5 text-slate-400"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-900",children:ie.name}),e.jsxs("p",{className:"text-sm text-slate-500",children:[ie.size," • ",ie.type," • Uploaded on ",ie.uploadedOn]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[ie.url&&ie.url!=="#"&&e.jsxs("button",{onClick:()=>p({fileName:ie.name,filePath:ie.url,documentType:ie.type}),className:"text-amber-600 hover:text-amber-700 text-[10px] font-semibold flex items-center gap-1",children:[e.jsx(qd,{className:"w-3 h-3"})," PREVIEW"]}),e.jsx(se,{variant:"outline",size:"sm",onClick:async()=>{if(ie.url&&ie.url!=="#")try{const pe=await(await fetch(ie.url)).blob(),Ne=window.URL.createObjectURL(pe),Ee=document.createElement("a");Ee.href=Ne,Ee.download=ie.name||"download",document.body.appendChild(Ee),Ee.click(),document.body.removeChild(Ee),window.URL.revokeObjectURL(Ne)}catch{const pe=document.createElement("a");pe.href=ie.url,pe.download=ie.name||"download",document.body.appendChild(pe),pe.click(),document.body.removeChild(pe)}else ee.error("Document URL not available")},children:"Download"})]})]},Fe))})})]}),e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(Dr,{className:"w-5 h-5"}),"Upload Settlement Verification Documents"]}),e.jsx(Zt,{children:"Upload bank receipts, settlement proofs, or any additional documents"})]}),e.jsx(Me,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"border-2 border-dashed border-slate-300 rounded-lg p-8 text-center hover:border-amber-400 hover:bg-amber-50 transition-colors",children:[e.jsx(Dr,{className:"w-8 h-8 text-slate-400 mx-auto mb-2"}),e.jsx("p",{className:"text-slate-600 mb-2",children:"Click to upload or drag and drop"}),e.jsx("p",{className:"text-sm text-slate-500",children:"PDF, DOC, DOCX, PNG, JPG, XLSX (max 10MB)"}),e.jsx("input",{type:"file",multiple:!0,className:"hidden",id:"file-upload",onChange:ws,accept:".pdf,.doc,.docx,.png,.jpg,.jpeg,.xlsx,.xls"}),e.jsx("label",{htmlFor:"file-upload",children:e.jsx(se,{variant:"outline",className:"mt-4",asChild:!0,children:e.jsx("span",{children:"Choose Files"})})})]})})})]})]}),e.jsx(Kt,{value:"bank",className:"space-y-4",children:e.jsxs(Ie,{children:[e.jsxs(tt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(Dc,{className:"w-5 h-5"}),"Dealer Bank Account Details"]}),e.jsx(Zt,{children:"Manage bank accounts for settlement transfer"})]}),e.jsxs(se,{size:"sm",className:"bg-amber-600",onClick:()=>{E(null),A(!0)},children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add Bank Account"]})]}),e.jsx(Me,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:y.length>0?y.map(ie=>e.jsxs(Ie,{className:`relative ${ie.isPrimary?"border-amber-500 bg-blue-50/30":""}`,children:[ie.isPrimary&&e.jsx("div",{className:"absolute top-0 right-0 p-1 bg-amber-600 text-white text-[10px] uppercase font-bold px-2 rounded-bl",children:"Primary"}),e.jsx(Me,{className:"p-4 pt-6",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Account Holder"}),e.jsx("p",{className:"text-sm font-semibold",children:ie.accountHolderName})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Bank"}),e.jsx("p",{className:"text-xs truncate",children:ie.bankName})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-[10px] text-slate-500 uppercase font-bold",children:"IFSC"}),e.jsx("p",{className:"text-xs",children:ie.ifscCode})]})]}),e.jsxs("div",{children:[e.jsx(ce,{className:"text-[10px] text-slate-500 uppercase font-bold",children:"Account Number"}),e.jsx("p",{className:"text-xs font-mono",children:ie.accountNumber})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-slate-100",children:[e.jsxs(se,{variant:"ghost",size:"sm",className:"h-7 text-[11px] text-amber-600",onClick:()=>{E(ie),A(!0)},children:[e.jsx(ur,{className:"w-3 h-3 mr-1"}),"Edit"]}),e.jsxs(se,{variant:"ghost",size:"sm",className:"h-7 text-[11px] text-red-600",onClick:()=>W(ie.id),children:[e.jsx(Kn,{className:"w-3 h-3 mr-1"}),"Delete"]})]})]})})]},ie.id)):e.jsxs("div",{className:"col-span-full py-12 text-center border-2 border-dashed rounded-lg bg-slate-50",children:[e.jsx(Dc,{className:"w-12 h-12 text-slate-300 mx-auto mb-3"}),e.jsx("p",{className:"text-slate-600 text-sm",children:"No bank details found"})]})})})]})})]})}),e.jsx("div",{className:"space-y-6",children:e.jsxs(Ie,{className:"sticky top-6",children:[e.jsxs(tt,{children:[e.jsxs(nt,{className:"flex items-center gap-2",children:[e.jsx(mu,{className:"w-5 h-5"}),"Settlement Verification"]}),e.jsx(Zt,{children:"Enter settlement transaction details"})]}),e.jsx(Me,{className:"space-y-4",children:n.status==="Completed"?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"p-4 bg-green-50 border border-green-200 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-3 text-green-700 mb-2",children:[e.jsx(Ys,{className:"w-5 h-5"}),e.jsx("span",{className:"font-semibold",children:"Settlement Completed"})]}),e.jsx("p",{className:"text-sm text-green-600",children:"This settlement has been finalized and processed."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[e.jsx("span",{className:"text-slate-500 text-sm",children:"Settlement Date"}),e.jsx("span",{className:"text-slate-900 font-medium",children:aa(ke.settlementDate)})]}),e.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[e.jsx("span",{className:"text-slate-500 text-sm",children:"Payment Mode"}),e.jsx("span",{className:"text-slate-900 font-medium",children:ke.paymentMode})]}),e.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[e.jsx("span",{className:"text-slate-500 text-sm",children:"Transaction ID"}),e.jsx("span",{className:"text-slate-900 font-medium truncate ml-4 max-w-[150px]",title:ke.verificationTransactionId,children:ke.verificationTransactionId})]}),e.jsxs("div",{className:"flex justify-between items-center py-2 border-b",children:[e.jsx("span",{className:"text-slate-500 text-sm",children:"Final Amount"}),e.jsxs("span",{className:"text-slate-900 font-bold text-lg",children:["₹",parseFloat(ke.settlementAmount).toLocaleString()]})]})]}),ke.verificationRemarks&&e.jsxs("div",{className:"mt-4",children:[e.jsx(ce,{className:"text-slate-500 mb-1 block",children:"Finance Remarks"}),e.jsx("div",{className:"p-3 bg-slate-50 rounded border text-sm text-slate-700",children:ke.verificationRemarks})]}),e.jsxs(se,{variant:"outline",className:"w-full mt-4",onClick:()=>window.print(),children:[e.jsx(nL,{className:"w-4 h-4 mr-2"}),"Download Settlement Letter"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-slate-50 border border-slate-200 rounded-lg p-4 mb-4",children:[e.jsxs("p",{className:"text-sm font-bold text-slate-900 mb-3 flex items-center gap-2",children:[e.jsx(Ys,{className:"w-4 h-4 text-amber-600"}),"Compliance Checklist"]}),e.jsx("div",{className:"space-y-3",children:eg.map(ie=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("input",{type:"checkbox",id:`check-${ie.id}`,checked:T.includes(ie.id),onChange:()=>U(ie.id),className:"w-4 h-4 mt-1 rounded border-slate-300 text-amber-600 focus:ring-amber-500"}),e.jsx("label",{htmlFor:`check-${ie.id}`,className:"text-sm text-slate-700 leading-tight",children:ie.label})]},ie.id))})]}),e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"paymentMode",children:["Payment Mode ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"paymentMode",placeholder:"e.g., NEFT, RTGS, Cheque",value:ke.paymentMode,onChange:ie=>qe({...ke,paymentMode:ie.target.value})})]}),e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"verificationTxnId",children:["Transaction ID / Reference ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"verificationTxnId",placeholder:"Enter transaction reference",value:ke.verificationTransactionId,onChange:ie=>qe({...ke,verificationTransactionId:ie.target.value})})]}),e.jsxs("div",{children:[e.jsx(ce,{htmlFor:"bankReference",children:"Bank Reference Number"}),e.jsx(ot,{id:"bankReference",placeholder:"Enter bank reference",value:ke.bankReference,onChange:ie=>qe({...ke,bankReference:ie.target.value})})]}),e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"settlementAmount",children:["Settlement Amount (₹) ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"settlementAmount",type:"number",placeholder:"Enter settlement amount",value:ke.settlementAmount,onChange:ie=>qe({...ke,settlementAmount:ie.target.value})})]}),e.jsxs("div",{children:[e.jsx(ce,{htmlFor:"adjustments",children:"Adjustments (₹)"}),e.jsx(ot,{id:"adjustments",type:"number",placeholder:"Enter any adjustments",value:ke.adjustments,onChange:ie=>{const Fe=ie.target.value,Q=be.settlementAmount+parseFloat(Fe||"0");qe({...ke,adjustments:Fe,settlementAmount:Q.toString()})}}),parseFloat(ke.adjustments)!==0&&e.jsxs("p",{className:"text-sm text-amber-600 mt-1 flex items-center gap-1",children:[e.jsx(Gs,{className:"w-3 h-3"}),"Adjusted amount: ₹",ke.settlementAmount]})]}),e.jsxs("div",{children:[e.jsxs(ce,{htmlFor:"settlementDate",children:["Settlement Date ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ot,{id:"settlementDate",type:"date",value:ke.settlementDate,onChange:ie=>qe({...ke,settlementDate:ie.target.value})})]}),e.jsxs("div",{children:[e.jsx(ce,{htmlFor:"verificationRemarks",children:"Verification Remarks"}),e.jsx(Fs,{id:"verificationRemarks",placeholder:"Enter any remarks or notes...",rows:4,value:ke.verificationRemarks,onChange:ie=>qe({...ke,verificationRemarks:ie.target.value})})]}),e.jsxs("div",{className:"pt-4 space-y-3 border-t",children:[e.jsxs(se,{className:"w-full bg-green-600 hover:bg-green-700",onClick:Cs,disabled:Ps||T.length{A(!1),E(null)},onSubmit:Z,editingBank:w,isSubmitting:!1}),e.jsx(Gl,{isOpen:!!j,onClose:()=>p(null),document:j})]}):e.jsxs("div",{className:"text-center py-12 text-slate-500",children:[e.jsx("p",{children:"Settlement case not found"}),e.jsx(se,{onClick:s,className:"mt-4",children:"Go Back"})]})}const I$=()=>{const t=su(),s=v.useCallback(async()=>{try{t(GN(!0));const[r,a,l,c,d,m,x,f,h,g,u,j,p]=await Promise.all([Ss.getRoles().catch(()=>({success:!1})),Ss.getZones().catch(()=>({success:!1})),Ss.getPermissions().catch(()=>({success:!1})),Ss.getRegions().catch(()=>({success:!1})),Ss.getUsers().catch(()=>({success:!1})),Ss.getStates().catch(()=>({success:!1})),Ss.getEmailTemplates().catch(()=>({success:!1})),Ss.getDistricts({limit:"all"}).catch(()=>({success:!1})),Ss.getAreas({limit:"all"}).catch(()=>({success:!1})),Ss.getSlaConfigs().catch(()=>({success:!1})),Ss.getASMs().catch(()=>({success:!1})),Ss.getZonalManagers().catch(()=>({success:!1})),Ss.getDDLeads().catch(()=>({success:!1}))]),y=V=>V.success?V:V.data?V.data:V,N=y(r),S=y(a),A=y(l),w=y(c),E=y(d),T=y(m),C=y(x),L=y(f),$=y(h),_=y(g),R=y(u),P=y(j),M=y(p),q=((E==null?void 0:E.users)||(E==null?void 0:E.data)||[]).map(V=>{var ve;const X=Array.isArray(V.territoryProfile)?V.territoryProfile:[],ne=X.filter(Se=>String(Se.locationType||"").toLowerCase()==="zone").map(Se=>Se.locationName||Se.zone).filter(Boolean),oe=X.filter(Se=>String(Se.locationType||"").toLowerCase()==="region").map(Se=>Se.locationName||Se.region).filter(Boolean),re=Array.from(new Set([...V.allZones||[],...ne])),ge=Array.from(new Set([...V.allRegions||[],...oe]));return{...V,name:V.fullName||V.name,role:((ve=V.role)==null?void 0:ve.roleName)||(Array.isArray(V.allRoles)&&V.allRoles.length>0?V.allRoles[0]:"System User"),zone:re.length>0?re.join(", "):"Global",region:ge.length>0?ge.join(", "):"Unassigned",status:V.isActive!==!1?"Active":"Inactive"}}),K=((N==null?void 0:N.roles)||(N==null?void 0:N.data)||[]).map(V=>{var X;return{id:V.id,name:V.roleName,permissions:((X=V.permissions)==null?void 0:X.map(ne=>ne.permissionCode))||[],userCount:V.userCount||0}}),Z=((S==null?void 0:S.zones)||(S==null?void 0:S.data)||[]).map(V=>{var ne,oe,re,ge,ve;const X=(V.name||V.zoneName||"").toUpperCase();return{id:V.id,name:X,description:V.description||"",code:V.name?V.name.substring(0,3).toUpperCase():"ZON",regionCount:V.regionCount||0,asmCount:V.asmCount||0,regionalOfficerCount:V.regionalOfficerCount||0,zmCount:V.zmCount||0,states:V.states||[],zonalBusinessHead:{name:((ne=V.zonalBusinessHead)==null?void 0:ne.name)||((oe=V.zonalBusinessHead)==null?void 0:oe.fullName)||"Not Assigned",email:((re=V.zonalBusinessHead)==null?void 0:re.email)||"",phone:((ge=V.zonalBusinessHead)==null?void 0:ge.mobileNumber)||((ve=V.zonalBusinessHead)==null?void 0:ve.phone)||""},zonalManagers:(V.zonalManagers||[]).map(Se=>({id:Se.id,name:Se.name||Se.fullName||"Unknown",email:Se.email||"",phone:Se.phone||Se.mobileNumber||"",regions:Se.regions||[]}))}}),W=((w==null?void 0:w.regions)||(w==null?void 0:w.data)||[]).map(V=>({id:V.id,code:V.code||(V.name?V.name.substring(0,3).toUpperCase():"REG"),name:V.name||V.regionName,zoneId:V.zoneId,zoneName:V.zoneName||"Unknown",states:V.states||[],cities:V.cities||[],districts:(V.districts||[]).map(X=>({id:X.id,name:X.name,stateId:X.stateId})),asmCount:V.asmCount||0,regionalOfficerCount:V.regionalOfficerCount||0,regionalManager:V.regionalManager?{id:V.regionalManager.id,name:V.regionalManager.fullName||V.regionalManager.name,email:V.regionalManager.email,phone:V.regionalManager.mobileNumber||V.regionalManager.phone}:void 0,status:V.isActive!==!1?"Active":"Inactive"})),U=Array.isArray(R==null?void 0:R.data)?R.data:Array.isArray(R)?R:[],F=Array.isArray(P==null?void 0:P.data)?P.data:Array.isArray(P)?P:[],B=F.length>0?F:q.filter(V=>{var X;return(X=V.allRoles)==null?void 0:X.some(ne=>(ne==="ZM"||ne==="DD-ZM"||ne.includes("ZONAL MANAGER"))&&!ne.includes("HEAD"))}).map(V=>{const X=(V.territoryProfile||[]).find(re=>re.roleCode==="ZM"||re.roleCode==="DD-ZM")||{},ne=(V.territoryProfile||[]).filter(re=>(re.roleCode==="ZM"||re.roleCode==="DD-ZM")&&re.locationType==="region").map(re=>re.locationName),oe=(V.territoryProfile||[]).filter(re=>(re.roleCode==="ZM"||re.roleCode==="DD-ZM")&&re.locationType==="region").map(re=>re.locationId);return{id:V.id,name:V.fullName,zmCode:V.employeeId||"N/A",email:V.email,phone:V.mobileNumber,zoneId:X.zoneId,zoneName:X.zone||V.zone||"Not Assigned",regionNames:ne,assignedRegionIds:oe,status:V.status}}),D=((T==null?void 0:T.states)||(T==null?void 0:T.data)||[]).map(V=>({...V,stateName:V.name})),O=((L==null?void 0:L.districts)||(L==null?void 0:L.data)||[]).map(V=>({...V,districtName:V.name,stateId:V.stateId,asmId:V.asmId,ddAmId:V.ddAmId,zmId:V.zmId})),z=($.areas||$.data||[]).map(V=>({...V,areaName:V.name,districtId:V.districtId})),G=(_.data||[]).map(V=>{var X,ne;return{id:V.id,stage:V.stageCode||"Unknown",days:V.tatValue||0,enabled:V.isActive!==!1,reminders:((X=V.reminderConfig)==null?void 0:X.reminders)||[],escalations:((ne=V.escalationConfig)==null?void 0:ne.escalations)||[]}}),Y=Array.isArray(M==null?void 0:M.data)?M.data:Array.isArray(M)?M:[];t(i2({zones:Z,regionalOffices:W,asms:U,zonalManagerMappings:B,zonalManagers:F,roles:K,allStates:D,allDistricts:O,allAreas:z,availablePermissions:(A==null?void 0:A.permissions)||(A==null?void 0:A.data)||[],emailTemplates:(C==null?void 0:C.data)||[],slaConfigs:G,users:q,ddLeads:Y,loading:!1}))}catch(r){console.error("[useMasterData] Error fetching data:",r),t(V4("Could not load configuration data")),ee.error("Could not load configuration data")}finally{t(GN(!1))}},[t]),n=v.useCallback(async r=>{try{t(YN(!0));const a=await Ss.getAreas(r);a.success&&t(H4({data:a.data,pagination:a.pagination}))}catch(a){console.error("[useMasterData] Error fetching areas:",a),ee.error("Could not load locations")}finally{t(YN(!1))}},[t]);return{fetchInitialData:s,fetchAreas:n}},M$=({selectedZone:t,onZoneClick:s})=>{const{zones:n}=Nn(r=>r.master);return e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:n.map(r=>e.jsxs(Ie,{className:`border-2 transition-all cursor-pointer ${t===r.id?"border-amber-600 shadow-lg":"hover:border-amber-400"}`,onClick:()=>s(r.id),children:[e.jsx(tt,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Zd,{className:"w-5 h-5 text-amber-600"}),e.jsx(nt,{className:"text-lg",children:r.name.toUpperCase().endsWith("ZONE")?r.name:`${r.name} Zone`})]}),e.jsx(Ae,{variant:"outline",className:"text-xs",children:r.code})]})}),e.jsxs(Me,{className:"space-y-3 text-sm",children:[e.jsx("p",{className:"text-slate-600 text-xs leading-relaxed mb-3",children:r.description}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"States"}),e.jsx(Ae,{variant:"outline",children:r.states.length})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Regions"}),e.jsx(Ae,{className:"bg-indigo-600",children:r.regionCount})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"Regional Officers"}),e.jsx(Ae,{className:"bg-purple-600",children:r.regionalOfficerCount})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"ASMs"}),e.jsx(Ae,{className:"bg-green-600",children:r.asmCount})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-500",children:"ZMs"}),e.jsx(Ae,{className:"bg-blue-600",children:r.zmCount})]})]})]})]},r.id))})},F$=({selectedZone:t,onAddZone:s,onEditZone:n})=>{const{zones:r}=Nn(l=>l.master),a=r.filter(l=>t==="all"||l.id===t);return e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Zone Details"}),e.jsx(Zt,{children:"Geographical coverage and state mappings for each zone"})]}),e.jsxs(se,{onClick:s,className:"bg-amber-600 hover:bg-amber-700",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add Zone"]})]})}),e.jsx(Me,{children:e.jsx(Db,{className:"h-[400px]",children:e.jsx("div",{className:"space-y-4",children:a.map(l=>e.jsxs("div",{className:"border rounded-lg p-5 space-y-4 bg-gradient-to-br from-white to-slate-50",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-amber-500 to-amber-600 rounded-lg flex items-center justify-center shadow-md",children:e.jsx(Zd,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-slate-900",children:l.name}),e.jsx("p",{className:"text-slate-500 text-sm",children:l.code})]})]}),e.jsx("div",{className:"flex gap-2",children:e.jsx(se,{variant:"outline",size:"sm",onClick:()=>n(l),className:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",children:e.jsx(ur,{className:"w-4 h-4"})})})]}),l.description&&e.jsx("div",{className:"bg-slate-50 rounded-lg p-3",children:e.jsx("p",{className:"text-sm text-slate-600",children:l.description})}),e.jsxs("div",{children:[e.jsxs(ce,{className:"text-xs text-slate-600 mb-2 block",children:["States Covered (",l.states.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:l.states.map((c,d)=>e.jsx(Ae,{variant:"secondary",className:"text-xs border-transparent bg-secondary text-secondary-foreground",children:c},d))})]}),l.zonalBusinessHead&&e.jsxs("div",{className:"border-t pt-3",children:[e.jsx(ce,{className:"text-xs text-slate-600 mb-2 block",children:"Zonal Business Head (ZBH)"}),e.jsxs("div",{className:"bg-amber-50 border border-amber-100 rounded-lg p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vo,{className:"w-4 h-4 text-amber-600"}),e.jsx("span",{className:"text-sm font-semibold text-slate-900",children:l.zonalBusinessHead.name}),e.jsx(Ae,{className:"bg-amber-600 text-white text-[10px] ml-auto",children:"ZBH"})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-6 text-slate-600",children:[e.jsx(qr,{className:"w-3 h-3"}),e.jsx("span",{className:"text-xs",children:l.zonalBusinessHead.email})]})]})]}),l.zonalManagers&&l.zonalManagers.length>0&&e.jsxs("div",{className:"border-t pt-3",children:[e.jsxs(ce,{className:"text-xs text-slate-600 mb-2 block",children:["Zonal Managers (",l.zonalManagers.length,")"]}),e.jsx("div",{className:"space-y-2",children:l.zonalManagers.map((c,d)=>e.jsxs("div",{className:"bg-slate-50 rounded-lg p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(da,{className:"w-4 h-4 text-slate-600"}),e.jsx("span",{className:"text-sm text-slate-900",children:c.name}),e.jsxs(Ae,{variant:"outline",className:"text-xs ml-auto",children:["ZM-",d+1]})]}),c.email&&e.jsxs("div",{className:"flex items-center gap-2 ml-6",children:[e.jsx(qr,{className:"w-3 h-3 text-slate-400"}),e.jsx("span",{className:"text-xs text-slate-600",children:c.email})]}),c.phone&&e.jsx("div",{className:"flex items-center gap-2 ml-6",children:e.jsx("span",{className:"text-xs text-slate-600",children:c.phone})}),c.regions&&c.regions.length>0&&e.jsxs("div",{className:"ml-6 mt-2",children:[e.jsxs(ce,{className:"text-xs text-slate-500 mb-1 block",children:["Managed Regions (",c.regions.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:c.regions.map((m,x)=>e.jsxs(Ae,{variant:"outline",className:"text-xs bg-white text-foreground",children:[e.jsx(Zd,{className:"w-2.5 h-2.5 mr-1"}),m]},x))})]})]},d))})]})]},l.id))})})})]})},B$=({selectedZone:t,onAddRegion:s,onEditRegion:n,onDeleteRegion:r})=>{const{regionalOffices:a}=Nn(c=>c.master),l=a.filter(c=>t==="all"||c.zoneId===t);return e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Regional Offices"}),e.jsx(Zt,{children:"Manage regional offices within zones"})]}),e.jsxs(se,{onClick:s,className:"bg-amber-600 hover:bg-amber-700",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add Regional Office"]})]})}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Region Code"}),e.jsx(me,{children:"Region Name"}),e.jsx(me,{children:"Zone"}),e.jsx(me,{children:"Regional Manager"}),e.jsx(me,{children:"Districts"}),e.jsx(me,{children:"Cities"}),e.jsx(me,{children:"Regional Officers"}),e.jsx(me,{children:"ASMs"}),e.jsx(me,{children:"Status"}),e.jsx(me,{className:"text-right",children:"Actions"})]})}),e.jsx(Es,{children:l.map(c=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ml,{className:"w-4 h-4 text-indigo-600"}),e.jsx("span",{className:"font-medium",children:c.code})]})}),e.jsx(de,{className:"font-medium",children:c.name}),e.jsx(de,{children:c.zoneName}),e.jsx(de,{children:c.regionalManager?e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm",children:c.regionalManager.name}),e.jsx("span",{className:"text-xs text-slate-500",children:c.regionalManager.email})]}):e.jsx("span",{className:"text-slate-400 italic",children:"Not Assigned"})}),e.jsx(de,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(c.districts||[]).slice(0,2).map((d,m)=>e.jsx(Ae,{variant:"secondary",className:"text-xs",children:d.name||d},m)),(c.districts||[]).length>2&&e.jsxs(Ae,{variant:"secondary",className:"text-xs",children:["+",(c.districts||[]).length-2]})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[c.cities.slice(0,3).map((d,m)=>e.jsxs("span",{className:"text-xs text-slate-600",children:[d,m3&&e.jsxs("span",{className:"text-xs text-slate-500",children:["+",c.cities.length-3]})]})}),e.jsx(de,{children:e.jsx(Ae,{className:"bg-purple-600",children:c.regionalOfficerCount})}),e.jsx(de,{children:e.jsx(Ae,{className:"bg-green-600",children:c.asmCount})}),e.jsx(de,{children:e.jsx(Ae,{variant:c.status==="Active"?"default":"secondary",className:c.status==="Active"?"bg-emerald-100 text-emerald-700":"",children:c.status})}),e.jsx(de,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>n(c),children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>r(c.id,c.name),className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:e.jsx(Kn,{className:"w-4 h-4"})})]})})]},c.id))})]})})]})},$$=({selectedZone:t,onAddASM:s,onEditASM:n,onDeleteASM:r})=>{const{asms:a,zonalManagerMappings:l}=Nn(m=>m.master),c=a.filter(m=>t==="all"||m.zoneId===t),d=v.useMemo(()=>{const m={};return[...a,...l].forEach(x=>{(x.areasManaged||x.districts||[]).forEach(h=>{m[h]||(m[h]=[]),m[h].includes(x.name)||m[h].push(x.name)})}),m},[a,l]);return e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"District Development Area Managers (DD-AM)"}),e.jsx(Zt,{children:"Manage DD-AM users across districts (multi-district)"})]}),e.jsxs(se,{onClick:s,className:"bg-amber-600 hover:bg-amber-700",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add DD-AM"]})]})}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"DD-AM Code"}),e.jsx(me,{children:"Name"}),e.jsx(me,{children:"Zone"}),e.jsx(me,{children:"Region"}),e.jsx(me,{children:"Districts Managed"}),e.jsx(me,{children:"Contact"}),e.jsx(me,{children:"Status"}),e.jsx(me,{className:"text-right",children:"Actions"})]})}),e.jsx(Es,{children:c.map(m=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wL,{className:"w-4 h-4 text-green-600"}),e.jsx("span",{className:"font-medium",children:m.asmCode||"N/A"})]})}),e.jsx(de,{children:m.name}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline",children:m.zoneName})}),e.jsx(de,{className:"text-sm text-slate-600",children:m.regionName}),e.jsx(de,{children:e.jsx("div",{className:"flex flex-wrap gap-1",children:m.areasManaged.map((x,f)=>{const h=typeof x=="string"?x:x.id,g=typeof x=="string"?x:x.name,u=(d[h]||[]).filter(p=>p!==m.name),j=u.length>0;return e.jsxs(Ae,{variant:j?"outline":"secondary",className:`text-xs ${j?"border-amber-300 bg-amber-50 text-amber-700 font-medium":""}`,title:j?`Also managed by: ${u.join(", ")}`:void 0,children:[g,j&&e.jsx(da,{className:"w-2.5 h-2.5 ml-1 inline"})]},f)})})}),e.jsx(de,{children:e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"text-slate-900",children:m.email}),e.jsx("p",{className:"text-slate-500",children:m.phone})]})}),e.jsx(de,{children:e.jsx(Ae,{variant:m.status==="Active"?"default":"secondary",className:m.status==="Active"?"bg-emerald-100 text-emerald-700":"",children:m.status})}),e.jsx(de,{className:"text-right",children:e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>n(m),children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>r(m.id,m.name),className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:e.jsx(Kn,{className:"w-4 h-4"})})]})})]},m.id))})]})})]})},q$=({selectedZone:t,onAddZM:s,onEditZM:n,onDeleteZM:r})=>{const{zonalManagers:a}=Nn(c=>c.master),l=(a||[]).filter(c=>t==="all"||c.zoneId===t||c.zones&&c.zones.includes(t));return e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Zonal Managers (DD-ZM)"}),e.jsx(Zt,{children:"Manage Zonal Managers and their region assignments"})]}),e.jsxs(se,{onClick:s,className:"bg-amber-600 hover:bg-amber-700",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add ZM"]})]})}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"ZM Code"}),e.jsx(me,{children:"Name"}),e.jsx(me,{children:"Zone"}),e.jsx(me,{children:"Regions Managed"}),e.jsx(me,{children:"Contact"}),e.jsx(me,{children:"Status"}),e.jsx(me,{className:"text-right",children:"Actions"})]})}),e.jsx(Es,{children:l.map(c=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(da,{className:"w-4 h-4 text-blue-600"}),e.jsx("span",{className:"font-medium",children:c.zmCode||c.code})]})}),e.jsx(de,{children:c.name}),e.jsx(de,{children:e.jsx("div",{className:"flex flex-wrap gap-1",children:(c.zones||[c.zoneName]).map((d,m)=>e.jsx(Ae,{variant:"outline",children:d},m))})}),e.jsx(de,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(c.regionNames||[]).slice(0,3).map((d,m)=>e.jsx(Ae,{variant:"secondary",className:"text-xs",children:d},m)),(c.regionNames||[]).length>3&&e.jsxs(Ae,{variant:"secondary",className:"text-xs",children:["+",(c.regionNames||[]).length-3]})]})}),e.jsx(de,{children:e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"text-slate-900",children:c.email}),e.jsx("p",{className:"text-slate-500",children:c.phone})]})}),e.jsx(de,{children:e.jsx(Ae,{variant:c.status==="Active"?"default":"secondary",className:c.status==="Active"?"bg-emerald-100 text-emerald-700":"",children:c.status})}),e.jsx(de,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>n(c),children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>r(c.id,c.name),className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:e.jsx(Kn,{className:"w-4 h-4"})})]})})]},c.id))})]})})]})},z$=({userAssignedData:t})=>e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsx(nt,{className:"text-xl",children:"System Users & Territory Assignments"})}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"User Details"}),e.jsx(me,{children:"Role"}),e.jsx(me,{children:"Assigned Zone"}),e.jsx(me,{children:"Assigned Region"}),e.jsx(me,{children:"Status"})]})}),e.jsx(Es,{children:t.map(s=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-slate-100 flex items-center justify-center",children:e.jsx(kr,{className:"w-4 h-4 text-slate-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:s.name}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[e.jsx(qr,{className:"w-3 h-3"}),s.email]})]})]})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vo,{className:"w-3 h-3 text-amber-600"}),e.jsx("span",{className:"text-sm font-medium",children:s.role})]})}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline",children:s.zone})}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline",className:"bg-indigo-50 text-indigo-700 border-indigo-200",children:s.region})}),e.jsx(de,{children:e.jsx(Ae,{variant:s.status==="Active"?"default":"secondary",className:s.status==="Active"?"bg-emerald-100 text-emerald-700":"",children:s.status})})]},s.id))})]})})]}),U$=({onAddRole:t,onEditRole:s})=>{const{roles:n}=Nn(r=>r.master);return e.jsxs(Ie,{className:"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border shadow-sm",children:[e.jsx(tt,{className:"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 pt-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{children:[e.jsx(nt,{className:"leading-none text-xl font-bold",children:"Role Definitions"}),e.jsx(Zt,{className:"text-muted-foreground mt-1.5",children:"Overview of available roles and their access levels"})]}),e.jsxs(se,{onClick:t,className:"bg-amber-600 hover:bg-amber-700 h-9",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add Role"]})]})}),e.jsx(Me,{className:"px-6 [&:last-child]:pb-6",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:n.map(r=>{var a;return e.jsxs("div",{className:"border rounded-lg p-4 space-y-3 bg-gradient-to-br from-white to-slate-50 hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vo,{className:"w-5 h-5 text-amber-600"}),e.jsx("h3",{className:"text-slate-900 font-bold",children:r.name})]}),e.jsxs(Ae,{variant:"secondary",className:"border-transparent bg-secondary text-secondary-foreground text-xs font-medium",children:[r.userCount||0," users"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"items-center gap-2 font-medium text-xs text-slate-600 mb-2 block",children:"Key Permissions"}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(r.permissions||[]).slice(0,3).map((l,c)=>e.jsx(Ae,{variant:"outline",className:"border px-2 py-0.5 font-medium text-foreground text-[10px] bg-white/50",children:l.replace(/_/g," ").toLowerCase()},c)),((a=r.permissions)==null?void 0:a.length)>3&&e.jsxs(Ae,{variant:"outline",className:"text-[10px] border-slate-200",children:["+",r.permissions.length-3]})]})]}),e.jsxs(se,{variant:"outline",size:"sm",onClick:()=>s(r),className:"w-full mt-2 h-8 rounded-md gap-1.5 px-3 border bg-background text-foreground hover:bg-accent hover:text-accent-foreground transition-colors",title:"Edit Permissions",children:[e.jsx(ur,{className:"w-3 h-3 mr-1"}),"Edit Permissions"]})]},r.id)})})})]})},V$=({isOpen:t,onOpenChange:s,role:n,onSave:r})=>{const[a,l]=v.useState([]);v.useEffect(()=>{n&&l(n.permissions||[])},[n,t]);const c=m=>{l(x=>x.includes(m)?x.filter(f=>f!==m):[...x,m])};if(!n)return null;const d=[{title:"Action Permissions",color:"from-green-50 to-emerald-50 border-green-200",textColor:"text-green-900",permissions:[{id:"action:approve",label:"Approve Applications"},{id:"action:reject",label:"Reject Applications"},{id:"action:upload_docs",label:"Upload Documents"},{id:"action:request_changes",label:"Request Changes"},{id:"action:forward",label:"Forward to Others"},{id:"action:reassign",label:"Reassign Applications"},{id:"action:schedule_interview",label:"Schedule Interviews"},{id:"action:add_comments",label:"Add Comments/Notes"},{id:"action:rank_applicants",label:"Rank Applicants"},{id:"action:final_approval",label:"Final Approval"}]},{title:"View/Access Permissions",color:"from-blue-50 to-cyan-50 border-blue-200",textColor:"text-blue-900",permissions:[{id:"view:view_details",label:"Application Details"},{id:"view:view_financial",label:"Financial Information"},{id:"view:view_discussions",label:"Discussion Notes"},{id:"view:view_progress",label:"Progress Tracking"},{id:"view:view_audit",label:"Audit Logs"},{id:"view:view_documents",label:"All Documents"},{id:"view:view_personal",label:"Personal Information"},{id:"view:view_business",label:"Business Details"},{id:"view:view_reports",label:"Reports & Analytics"},{id:"view:view_history",label:"Application History"}]},{title:"Application Stage Access",color:"from-amber-50 to-orange-50 border-amber-200",textColor:"text-amber-900",permissions:[{id:"stage:initial_review",label:"Initial Review"},{id:"stage:field_verification",label:"Field Verification"},{id:"stage:level1_interview",label:"Level 1 Interview"},{id:"stage:level2_interview",label:"Level 2 Interview"},{id:"stage:ranking",label:"Ranking & Selection"},{id:"stage:legal_review",label:"Legal Review"},{id:"stage:financial_review",label:"Financial Review"},{id:"stage:final_approval",label:"Final Approval"},{id:"stage:payment",label:"Payment Verification"},{id:"stage:onboarding",label:"Onboarding"}]}];return e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"sm:max-w-lg max-w-3xl max-h-[90vh] overflow-y-auto p-0 gap-0 border-none shadow-2xl custom-scrollbar",children:[e.jsxs(ms,{className:"p-6 pb-2 space-y-2 text-left bg-white sticky top-0 z-10 border-b",children:[e.jsxs(us,{className:"text-xl font-bold tracking-tight",children:["Edit Role Permissions - ",n.name]}),e.jsxs(vs,{className:"text-slate-500 text-sm",children:["Configure default permissions for all users assigned to the ",n.name," role"]})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx("div",{className:"bg-gradient-to-br from-purple-50 to-indigo-50 rounded-xl p-5 border border-purple-100 shadow-sm",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-white rounded-xl shadow-sm flex items-center justify-center border border-purple-100",children:e.jsx(Vo,{className:"w-6 h-6 text-purple-600"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-bold text-slate-900",children:n.name}),e.jsxs("p",{className:"text-xs font-medium text-slate-500 uppercase tracking-widest",children:[n.userCount||0," users currently assigned"]})]})]}),e.jsx(Ae,{className:"bg-purple-600 hover:bg-purple-700 px-3 py-1 rounded-full text-[10px] font-bold tracking-wider uppercase",children:"Role Configuration"})]})}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("h4",{className:"text-sm font-bold text-slate-800 flex items-center gap-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 bg-amber-500 rounded-full"}),"Configure Default Permissions"]}),e.jsx("div",{className:"space-y-4",children:d.map((m,x)=>e.jsxs("div",{className:`border rounded-xl p-5 bg-gradient-to-br ${m.color} shadow-sm transition-all hover:shadow-md`,children:[e.jsxs("h5",{className:`text-sm font-bold ${m.textColor} mb-4 flex items-center justify-between`,children:[m.title,e.jsxs("span",{className:"text-[10px] bg-white/50 px-2 py-0.5 rounded-full opacity-70 italic font-normal",children:["Section ",x+1]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-y-3 gap-x-6",children:m.permissions.map(f=>e.jsxs("div",{className:"flex items-center space-x-3 group cursor-pointer p-1 rounded-md hover:bg-white/40 transition-colors",children:[e.jsx(Rn,{id:`perm-${f.id}`,checked:a.includes(f.id),onCheckedChange:()=>c(f.id),className:"border-slate-300 data-[state=checked]:bg-purple-600 data-[state=checked]:border-purple-600"}),e.jsx("label",{htmlFor:`perm-${f.id}`,className:"text-sm font-medium text-slate-700 cursor-pointer group-hover:text-slate-900 transition-colors flex-1",children:f.label})]},f.id))})]},x))})]})]}),e.jsxs("div",{className:"flex gap-3 p-6 pt-4 border-t sticky bottom-0 bg-white/80 backdrop-blur-md z-10",children:[e.jsx(se,{variant:"ghost",onClick:()=>s(!1),className:"flex-1 h-11 font-bold text-slate-600 hover:bg-slate-100",children:"Cancel"}),e.jsxs(se,{onClick:()=>r(n.id,a),className:"flex-1 h-11 bg-purple-600 hover:bg-purple-700 font-bold text-white shadow-lg shadow-purple-200",children:[e.jsx(Yi,{className:"w-4 h-4 mr-2"}),"Save Role Permissions"]})]})]})})},H$=({isOpen:t,onOpenChange:s,onSave:n})=>{const[r,a]=v.useState(""),[l,c]=v.useState(""),[d,m]=v.useState(""),[x,f]=v.useState(!1);v.useEffect(()=>{t&&(a(""),c(""),m(""),f(!1))},[t]);const h=async()=>{if(!(!r.trim()||!l.trim())){f(!0);try{await n({roleName:r.trim(),roleCode:l.trim(),description:d.trim()||void 0}),s(!1)}finally{f(!1)}}};return e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"sm:max-w-md",children:[e.jsxs(ms,{children:[e.jsx(us,{children:"Add Role"}),e.jsx(vs,{children:"Create a new role for Master Configuration."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"role-name",children:"Role Name"}),e.jsx(ot,{id:"role-name",value:r,onChange:g=>a(g.target.value),placeholder:"e.g. Finance Admin"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"role-code",children:"Role Code"}),e.jsx(ot,{id:"role-code",value:l,onChange:g=>c(g.target.value),placeholder:"e.g. FINANCE_ADMIN"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"role-description",children:"Description"}),e.jsx(Fs,{id:"role-description",value:d,onChange:g=>m(g.target.value),placeholder:"Optional",rows:3})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(se,{variant:"outline",onClick:()=>s(!1),disabled:x,children:"Cancel"}),e.jsx(se,{onClick:h,disabled:x||!r.trim()||!l.trim(),children:x?"Saving...":"Create Role"})]})]})})},W$=({onEditTemplate:t,onDeleteTemplate:s})=>{const{emailTemplates:n}=Nn(r=>r.master);return e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs("div",{children:[e.jsx(nt,{children:"Email & Letter Templates"}),e.jsx(Zt,{children:"Templates and trigger codes come from system seed data. Edit wording and layout here; new triggers are not added from this screen."})]})}),e.jsx(Me,{children:e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Template Name"}),e.jsx(me,{children:"Subject"}),e.jsx(me,{children:"Trigger Code"}),e.jsx(me,{children:"Modified Date"}),e.jsx(me,{className:"text-right",children:"Actions"})]})}),e.jsxs(Es,{children:[n.map(r=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-amber-50 rounded-lg flex items-center justify-center",children:e.jsx(qr,{className:"w-4 h-4 text-amber-600"})}),e.jsx("span",{className:"font-medium text-slate-900",children:r.name||r.templateCode})]})}),e.jsx(de,{className:"text-slate-600 max-w-xs truncate",children:r.subject}),e.jsx(de,{children:e.jsx(Ae,{variant:"outline",className:"bg-slate-50 text-[10px] font-mono",children:r.templateCode||"-"})}),e.jsx(de,{className:"text-slate-500 text-sm",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx($n,{className:"w-3.5 h-3.5"}),r.updatedAt?Ht(r.updatedAt):"-"]})}),e.jsx(de,{className:"text-right",children:e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>t(r),children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{variant:"ghost",size:"sm",onClick:()=>s(r.id),className:"text-red-500 hover:text-red-600 hover:bg-red-50",children:e.jsx(Kn,{className:"w-4 h-4"})})]})})]},r.id)),n.length===0&&e.jsx(ct,{children:e.jsx(de,{colSpan:5,className:"text-center py-12",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(qr,{className:"w-8 h-8 text-slate-200"}),e.jsx("p",{className:"text-slate-400 text-sm",children:"No templates configured yet"})]})})})]})]})})]})},K$=({onAddLocation:t,onEditLocation:s,onDeleteLocation:n,onSearch:r,onPageChange:a,searchTerm:l,states:c,stateFilter:d,onStateFilterChange:m,statusFilter:x,onStatusFilterChange:f})=>{const{allAreas:h,areasPagination:g,isAreasLoading:u}=Nn(j=>j.master);return e.jsx("div",{className:"space-y-4",children:e.jsxs(Ie,{children:[e.jsx(tt,{children:e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(nt,{children:"Dealership Locations"}),e.jsxs(Zt,{children:["Manage ",g.total," geographical locations and their operational status"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Zd,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx("input",{type:"text",placeholder:"Search locations...",value:l,onChange:j=>r(j.target.value),className:"pl-9 pr-4 py-2 bg-slate-50 border border-slate-200 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-amber-500 w-64 transition-all"})]}),e.jsxs(wt,{value:d,onValueChange:m,children:[e.jsx(Ct,{className:"w-48",children:e.jsx(St,{placeholder:"All States"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All States"}),c.map(j=>e.jsx(_e,{value:j.id,children:j.name||j.stateName},j.id))]})]}),e.jsxs(wt,{value:x,onValueChange:f,children:[e.jsx(Ct,{className:"w-44",children:e.jsx(St,{placeholder:"Opportunity Filter"})}),e.jsxs(At,{children:[e.jsx(_e,{value:"all",children:"All Opportunities"}),e.jsx(_e,{value:"active",children:"Opportunity: Yes"}),e.jsx(_e,{value:"inactive",children:"Opportunity: No"})]})]}),e.jsxs(se,{onClick:t,className:"bg-amber-600 hover:bg-amber-700 whitespace-nowrap",children:[e.jsx(cn,{className:"w-4 h-4 mr-2"}),"Add Location"]})]})]})}),e.jsxs(Me,{children:[e.jsxs("div",{className:`relative ${u?"opacity-50 pointer-events-none":""}`,children:[e.jsxs(ks,{children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"State"}),e.jsx(me,{children:"City"}),e.jsx(me,{children:"District"}),e.jsx(me,{children:"Active Period"}),e.jsx(me,{children:"Opportunity"}),e.jsx(me,{className:"text-right",children:"Actions"})]})}),e.jsx(Es,{children:h.length===0?e.jsx(ct,{children:e.jsx(de,{colSpan:6,className:"h-32 text-center text-slate-500 italic",children:l?"No locations found matching your search":"No locations available"})}):h.map(j=>e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Er,{className:"w-4 h-4 text-amber-600"}),e.jsx("span",{className:"font-medium",children:j.stateName||"N/A"})]})}),e.jsx(de,{className:"font-medium text-slate-900",children:j.city||"N/A"}),e.jsx(de,{className:"text-slate-600 text-sm",children:j.name}),e.jsx(de,{children:j.openFrom&&j.openTo?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-slate-600",children:"From:"}),e.jsx(Ae,{variant:"outline",className:"text-xs font-medium",children:Ht(j.openFrom)})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-slate-600",children:"To:"}),e.jsx(Ae,{variant:"outline",className:"text-xs font-medium",children:Ht(j.openTo)})]})]}):e.jsx("span",{className:"text-slate-400 italic text-sm",children:"Not Defined"})}),e.jsx(de,{children:e.jsx(Ae,{variant:j.isOpportunity?"default":"secondary",className:j.isOpportunity?"bg-green-600 hover:bg-green-700 text-white border-transparent":"",children:j.isOpportunity?"Yes":"No"})}),e.jsx(de,{className:"text-right",children:e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(se,{variant:"outline",size:"sm",onClick:()=>s(j),className:"h-8 w-8 p-0",children:e.jsx(ur,{className:"w-4 h-4"})}),e.jsx(se,{variant:"outline",size:"sm",onClick:()=>n(j.id),className:"h-8 w-8 p-0 text-red-600 hover:bg-red-50 hover:text-red-700",children:e.jsx(Kn,{className:"w-4 h-4"})})]})})]},j.id))})]}),u&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-white/10 backdrop-blur-[1px]",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-amber-600"})})]}),g.totalPages>1&&e.jsxs("div",{className:"flex items-center justify-between mt-6 pt-4 border-t border-slate-100",children:[e.jsxs("div",{className:"text-sm text-slate-500",children:["Showing ",e.jsx("span",{className:"font-medium text-slate-900",children:(g.page-1)*g.limit+1})," to ",e.jsx("span",{className:"font-medium text-slate-900",children:Math.min(g.page*g.limit,g.total)})," of ",e.jsx("span",{className:"font-medium text-slate-900",children:g.total})," results"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{variant:"outline",size:"sm",onClick:()=>a(g.page-1),disabled:g.page<=1||u,className:"h-8",children:"Previous"}),e.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,g.totalPages)},(j,p)=>{let y=g.page;return g.page<=3?y=p+1:g.page>=g.totalPages-2?y=g.totalPages-4+p:y=g.page-2+p,y<=0||y>g.totalPages?null:e.jsx(se,{variant:g.page===y?"default":"outline",size:"sm",onClick:()=>a(y),disabled:u,className:"h-8 w-8 p-0",children:y},y)})}),e.jsx(se,{variant:"outline",size:"sm",onClick:()=>a(g.page+1),disabled:g.page>=g.totalPages||u,className:"h-8",children:"Next"})]})]})]})]})})};var G$=Symbol("radix.slottable");function Y$(t){const s=({children:n})=>e.jsx(e.Fragment,{children:n});return s.displayName=`${t}.Slottable`,s.__radixId=G$,s}var[Cf]=ea("Tooltip",[Vl]),Af=Vl(),yE="TooltipProvider",Z$=700,Rv="tooltip.open",[Q$,Vb]=Cf(yE),jE=t=>{const{__scopeTooltip:s,delayDuration:n=Z$,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:l}=t,c=v.useRef(!0),d=v.useRef(!1),m=v.useRef(0);return v.useEffect(()=>{const x=m.current;return()=>window.clearTimeout(x)},[]),e.jsx(Q$,{scope:s,isOpenDelayedRef:c,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(m.current),c.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>c.current=!0,r)},[r]),isPointerInTransitRef:d,onPointerInTransitChange:v.useCallback(x=>{d.current=x},[]),disableHoverableContent:a,children:l})};jE.displayName=yE;var tu="Tooltip",[X$,Su]=Cf(tu),NE=t=>{const{__scopeTooltip:s,children:n,open:r,defaultOpen:a,onOpenChange:l,disableHoverableContent:c,delayDuration:d}=t,m=Vb(tu,t.__scopeTooltip),x=Af(s),[f,h]=v.useState(null),g=hr(),u=v.useRef(0),j=c??m.disableHoverableContent,p=d??m.delayDuration,y=v.useRef(!1),[N,S]=bi({prop:r,defaultProp:a??!1,onChange:C=>{C?(m.onOpen(),document.dispatchEvent(new CustomEvent(Rv))):m.onClose(),l==null||l(C)},caller:tu}),A=v.useMemo(()=>N?y.current?"delayed-open":"instant-open":"closed",[N]),w=v.useCallback(()=>{window.clearTimeout(u.current),u.current=0,y.current=!1,S(!0)},[S]),E=v.useCallback(()=>{window.clearTimeout(u.current),u.current=0,S(!1)},[S]),T=v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>{y.current=!0,S(!0),u.current=0},p)},[p,S]);return v.useEffect(()=>()=>{u.current&&(window.clearTimeout(u.current),u.current=0)},[]),e.jsx(rf,{...x,children:e.jsx(X$,{scope:s,contentId:g,open:N,stateAttribute:A,trigger:f,onTriggerChange:h,onTriggerEnter:v.useCallback(()=>{m.isOpenDelayedRef.current?T():w()},[m.isOpenDelayedRef,T,w]),onTriggerLeave:v.useCallback(()=>{j?E():(window.clearTimeout(u.current),u.current=0)},[E,j]),onOpen:w,onClose:E,disableHoverableContent:j,children:n})})};NE.displayName=tu;var Ev="TooltipTrigger",wE=v.forwardRef((t,s)=>{const{__scopeTooltip:n,...r}=t,a=Su(Ev,n),l=Vb(Ev,n),c=Af(n),d=v.useRef(null),m=Ms(s,d,a.onTriggerChange),x=v.useRef(!1),f=v.useRef(!1),h=v.useCallback(()=>x.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),e.jsx(vu,{asChild:!0,...c,children:e.jsx(ps.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:m,onPointerMove:Vt(t.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!l.isPointerInTransitRef.current&&(a.onTriggerEnter(),f.current=!0)}),onPointerLeave:Vt(t.onPointerLeave,()=>{a.onTriggerLeave(),f.current=!1}),onPointerDown:Vt(t.onPointerDown,()=>{a.open&&a.onClose(),x.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Vt(t.onFocus,()=>{x.current||a.onOpen()}),onBlur:Vt(t.onBlur,a.onClose),onClick:Vt(t.onClick,a.onClose)})})});wE.displayName=Ev;var Hb="TooltipPortal",[J$,eq]=Cf(Hb,{forceMount:void 0}),SE=t=>{const{__scopeTooltip:s,forceMount:n,children:r,container:a}=t,l=Su(Hb,s);return e.jsx(J$,{scope:s,forceMount:n,children:e.jsx(mr,{present:n||l.open,children:e.jsx(Hc,{asChild:!0,container:a,children:r})})})};SE.displayName=Hb;var Oc="TooltipContent",CE=v.forwardRef((t,s)=>{const n=eq(Oc,t.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...l}=t,c=Su(Oc,t.__scopeTooltip);return e.jsx(mr,{present:r||c.open,children:c.disableHoverableContent?e.jsx(AE,{side:a,...l,ref:s}):e.jsx(tq,{side:a,...l,ref:s})})}),tq=v.forwardRef((t,s)=>{const n=Su(Oc,t.__scopeTooltip),r=Vb(Oc,t.__scopeTooltip),a=v.useRef(null),l=Ms(s,a),[c,d]=v.useState(null),{trigger:m,onClose:x}=n,f=a.current,{onPointerInTransitChange:h}=r,g=v.useCallback(()=>{d(null),h(!1)},[h]),u=v.useCallback((j,p)=>{const y=j.currentTarget,N={x:j.clientX,y:j.clientY},S=aq(N,y.getBoundingClientRect()),A=iq(N,S),w=lq(p.getBoundingClientRect()),E=cq([...A,...w]);d(E),h(!0)},[h]);return v.useEffect(()=>()=>g(),[g]),v.useEffect(()=>{if(m&&f){const j=y=>u(y,f),p=y=>u(y,m);return m.addEventListener("pointerleave",j),f.addEventListener("pointerleave",p),()=>{m.removeEventListener("pointerleave",j),f.removeEventListener("pointerleave",p)}}},[m,f,u,g]),v.useEffect(()=>{if(c){const j=p=>{const y=p.target,N={x:p.clientX,y:p.clientY},S=(m==null?void 0:m.contains(y))||(f==null?void 0:f.contains(y)),A=!oq(N,c);S?g():A&&(g(),x())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[m,f,c,x,g]),e.jsx(AE,{...t,ref:l})}),[sq,nq]=Cf(tu,{isInside:!1}),rq=Y$("TooltipContent"),AE=v.forwardRef((t,s)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:l,onPointerDownOutside:c,...d}=t,m=Su(Oc,n),x=Af(n),{onClose:f}=m;return v.useEffect(()=>(document.addEventListener(Rv,f),()=>document.removeEventListener(Rv,f)),[f]),v.useEffect(()=>{if(m.trigger){const h=g=>{const u=g.target;u!=null&&u.contains(m.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[m.trigger,f]),e.jsx(zc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:e.jsxs(af,{"data-state":m.stateAttribute,...x,...d,ref:s,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[e.jsx(rq,{children:r}),e.jsx(sq,{scope:n,isInside:!0,children:e.jsx(fB,{id:m.contentId,role:"tooltip",children:a||r})})]})})});CE.displayName=Oc;var kE="TooltipArrow",RE=v.forwardRef((t,s)=>{const{__scopeTooltip:n,...r}=t,a=Af(n);return nq(kE,n).isInside?null:e.jsx(lf,{...a,...r,ref:s})});RE.displayName=kE;function aq(t,s){const n=Math.abs(s.top-t.y),r=Math.abs(s.bottom-t.y),a=Math.abs(s.right-t.x),l=Math.abs(s.left-t.x);switch(Math.min(n,r,a,l)){case l:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function iq(t,s,n=5){const r=[];switch(s){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function lq(t){const{top:s,right:n,bottom:r,left:a}=t;return[{x:a,y:s},{x:n,y:s},{x:n,y:r},{x:a,y:r}]}function oq(t,s){const{x:n,y:r}=t;let a=!1;for(let l=0,c=s.length-1;lr!=g>r&&n<(h-x)*(r-f)/(g-f)+x&&(a=!a)}return a}function cq(t){const s=t.slice();return s.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),dq(s)}function dq(t){if(t.length<=1)return t.slice();const s=[];for(let r=0;r=2;){const l=s[s.length-1],c=s[s.length-2];if((l.x-c.x)*(a.y-c.y)>=(l.y-c.y)*(a.x-c.x))s.pop();else break}s.push(a)}s.pop();const n=[];for(let r=t.length-1;r>=0;r--){const a=t[r];for(;n.length>=2;){const l=n[n.length-1],c=n[n.length-2];if((l.x-c.x)*(a.y-c.y)>=(l.y-c.y)*(a.x-c.x))n.pop();else break}n.push(a)}return n.pop(),s.length===1&&n.length===1&&s[0].x===n[0].x&&s[0].y===n[0].y?s:s.concat(n)}var uq=jE,hq=NE,mq=wE,fq=SE,pq=CE,xq=RE;function kf({delayDuration:t=0,...s}){return e.jsx(uq,{"data-slot":"tooltip-provider",delayDuration:t,...s})}function Wb({...t}){return e.jsx(kf,{children:e.jsx(hq,{"data-slot":"tooltip",...t})})}function Kb({...t}){return e.jsx(mq,{"data-slot":"tooltip-trigger",...t})}function Gb({className:t,sideOffset:s=0,children:n,...r}){return e.jsx(fq,{children:e.jsxs(pq,{"data-slot":"tooltip-content",sideOffset:s,className:_t("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...r,children:[n,e.jsx(xq,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const gq=({isOpen:t,onOpenChange:s,editingASMId:n,asmManagerId:r,setAsmManagerId:a,asmStatus:l,setAsmStatus:c,selectedASMZone:d,setSelectedASMZone:m,selectedASMRegion:x,setSelectedASMRegion:f,selectedASMStates:h,setSelectedASMStates:g,selectedASMDistricts:u,setSelectedASMDistricts:j,onSave:p,asmRoleCode:y,userAssignedData:N,districtsAssignedToOthers:S,getDistrictsForSelectedState:A})=>{const{zones:w,regionalOffices:E}=Nn(C=>C.master),T=N.filter(C=>{const L=(C.allRoles||[]).map(_=>String(_||"").toUpperCase()),$=String(C.roleCode||"").toUpperCase();return L.includes("DD-AM")||$==="DD-AM"});return gt.useEffect(()=>{if(r&&t){const C=N.find(L=>L.id===r);if(C&&C.territoryProfile){const L=C.territoryProfile.filter($=>$.roleCode===y&&$.locationType==="district").map($=>$.locationId);L.length>0&&j(L)}}},[r,y,t,N,j]),e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsxs(us,{children:[n?"Edit":"Add"," DD Area Manager"]}),e.jsx(vs,{children:"Configure DD-AM details and district assignment"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Zone"}),e.jsxs(wt,{value:d,onValueChange:C=>{m(C),f(""),g([]),j([])},children:[e.jsx(Ct,{className:"mt-2 text-slate-900",children:e.jsx(St,{placeholder:"Select zone"})}),e.jsx(At,{children:w.map(C=>e.jsx(_e,{value:C.id,children:C.name},C.id))})]})]}),d&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Regional Office"}),e.jsxs(wt,{value:x,onValueChange:C=>{f(C),g([]),j([])},children:[e.jsx(Ct,{className:"mt-2 text-slate-900",children:e.jsx(St,{placeholder:"Select regional office"})}),e.jsx(At,{children:E.filter(C=>C.zoneId===d).map(C=>e.jsx(_e,{value:C.id,children:C.name},C.id))})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Select DD-AM User"}),e.jsxs(wt,{value:r,onValueChange:a,children:[e.jsx(Ct,{className:"mt-2 text-slate-900",children:e.jsx(St,{placeholder:"Select DD-AM"})}),e.jsx(At,{className:"max-h-64",children:T.map(C=>e.jsxs(_e,{value:C.id,children:[C.name," (",C.employeeId||"No ID",")"]},C.id))})]})]})]}),x&&e.jsxs("div",{children:[e.jsx(ce,{children:"States Covered"}),e.jsx("div",{className:"mt-2 border rounded-lg p-3 max-h-48 overflow-y-auto bg-slate-50",children:(()=>{const C=E.find($=>$.id===x),L=((C==null?void 0:C.states)||[]).map($=>typeof $=="string"?$:$.name);return L.length>0?e.jsx("div",{className:"space-y-2",children:L.map($=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Rn,{id:`asm-state-${$}`,checked:h.some(_=>_.toLowerCase()===$.toLowerCase()),onCheckedChange:_=>{if(_)g([...h,$]);else{g(h.filter(P=>P.toLowerCase()!==$.toLowerCase()));const R=A($);j(u.filter(P=>!R.some(M=>M.id===P)))}}}),e.jsx("label",{htmlFor:`asm-state-${$}`,className:"text-sm cursor-pointer text-slate-900",children:$})]},$))}):e.jsx("p",{className:"text-sm text-slate-500",children:"No states available for this regional office"})})()})]}),h.length>0&&e.jsxs("div",{children:[e.jsx(ce,{children:"Districts/Cities Covered"}),e.jsx("div",{className:"mt-2 border rounded-lg p-3 max-h-64 overflow-y-auto bg-slate-50",children:e.jsx(kf,{children:h.map(C=>{const L=A(C);return L.length===0?null:e.jsxs("div",{className:"mb-4 last:mb-0",children:[e.jsx("h4",{className:"text-sm text-amber-700 mb-2 pb-1 border-b border-slate-200",children:C}),e.jsx("div",{className:"space-y-2 ml-2",children:L.map($=>e.jsx("div",{children:e.jsxs(Wb,{children:[e.jsx(Kb,{asChild:!0,children:e.jsxs("div",{className:"flex items-center space-x-2 py-0.5",children:[e.jsx(Rn,{id:`asm-district-${$.id}`,checked:u.includes($.id),disabled:!!S[$.id],onCheckedChange:_=>{j(_?[...u,$.id]:u.filter(R=>R!==$.id))}}),e.jsx("label",{htmlFor:`asm-district-${$.id}`,className:`text-sm flex items-center gap-1.5 ${S[$.id]?"text-slate-400 cursor-not-allowed":"cursor-pointer text-slate-900"}`,children:$.name})]})}),S[$.id]&&e.jsx(Gb,{children:e.jsxs("p",{children:["Already managed by: ",S[$.id].join(", ")]})})]})},$.id))})]},C)})})})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsxs(ce,{children:["DD Area Manager ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:r,onValueChange:C=>{var $;a(C);const L=N.find(_=>_.id===C);if(L){const _=(L.territoryProfile||[]).find(R=>R.roleCode===y);_!=null&&_.zoneId&&m(_.zoneId),_!=null&&_.regionId&&f(_.regionId),j((($=L.areasManaged)==null?void 0:$.filter(R=>R.roleCode===y).map(R=>R.id))||[]),g(L.stateNames||[])}},disabled:!!n,children:[e.jsx(Ct,{className:"mt-2 w-full text-slate-900",children:e.jsx(St,{placeholder:"Select DD-AM User"})}),e.jsx(At,{className:"max-h-60",children:T.length>0?T.map(C=>e.jsx(_e,{value:C.id,children:e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx("span",{className:"font-medium text-slate-900",children:C.name}),e.jsx("span",{className:"text-xs text-slate-500",children:C.email})]})},C.id)):e.jsx("div",{className:"p-2 text-sm text-slate-500 text-center",children:"No users available"})})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Status"}),e.jsxs(wt,{value:l,onValueChange:C=>c(C),children:[e.jsx(Ct,{className:"mt-2 text-slate-900",children:e.jsx(St,{})}),e.jsxs(At,{children:[e.jsx(_e,{value:"active",children:"Active"}),e.jsx(_e,{value:"inactive",children:"Inactive"})]})]})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>s(!1),children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-amber-600 hover:bg-amber-700",onClick:p,children:"Save DD-AM"})]})]})]})})};function vq(t){const s=bq(t),n=v.forwardRef((r,a)=>{const{children:l,...c}=r,d=v.Children.toArray(l),m=d.find(jq);if(m){const x=m.props.children,f=d.map(h=>h===m?v.Children.count(x)>1?v.Children.only(null):v.isValidElement(x)?x.props.children:null:h);return e.jsx(s,{...c,ref:a,children:v.isValidElement(x)?v.cloneElement(x,void 0,f):null})}return e.jsx(s,{...c,ref:a,children:l})});return n.displayName=`${t}.Slot`,n}function bq(t){const s=v.forwardRef((n,r)=>{const{children:a,...l}=n;if(v.isValidElement(a)){const c=wq(a),d=Nq(l,a.props);return a.type!==v.Fragment&&(d.ref=r?Br(r,c):c),v.cloneElement(a,d)}return v.Children.count(a)>1?v.Children.only(null):null});return s.displayName=`${t}.SlotClone`,s}var yq=Symbol("radix.slottable");function jq(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===yq}function Nq(t,s){const n={...s};for(const r in s){const a=t[r],l=s[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const m=l(...d);return a(...d),m}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...t,...n}}function wq(t){var r,a;let s=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?t.ref:(s=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Rf="Popover",[EE]=ea(Rf,[Vl]),Cu=Vl(),[Sq,eo]=EE(Rf),DE=t=>{const{__scopePopover:s,children:n,open:r,defaultOpen:a,onOpenChange:l,modal:c=!1}=t,d=Cu(s),m=v.useRef(null),[x,f]=v.useState(!1),[h,g]=bi({prop:r,defaultProp:a??!1,onChange:l,caller:Rf});return e.jsx(rf,{...d,children:e.jsx(Sq,{scope:s,contentId:hr(),triggerRef:m,open:h,onOpenChange:g,onOpenToggle:v.useCallback(()=>g(u=>!u),[g]),hasCustomAnchor:x,onCustomAnchorAdd:v.useCallback(()=>f(!0),[]),onCustomAnchorRemove:v.useCallback(()=>f(!1),[]),modal:c,children:n})})};DE.displayName=Rf;var TE="PopoverAnchor",Cq=v.forwardRef((t,s)=>{const{__scopePopover:n,...r}=t,a=eo(TE,n),l=Cu(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:d}=a;return v.useEffect(()=>(c(),()=>d()),[c,d]),e.jsx(vu,{...l,...r,ref:s})});Cq.displayName=TE;var _E="PopoverTrigger",PE=v.forwardRef((t,s)=>{const{__scopePopover:n,...r}=t,a=eo(_E,n),l=Cu(n),c=Ms(s,a.triggerRef),d=e.jsx(ps.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":FE(a.open),...r,ref:c,onClick:Vt(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?d:e.jsx(vu,{asChild:!0,...l,children:d})});PE.displayName=_E;var Yb="PopoverPortal",[Aq,kq]=EE(Yb,{forceMount:void 0}),OE=t=>{const{__scopePopover:s,forceMount:n,children:r,container:a}=t,l=eo(Yb,s);return e.jsx(Aq,{scope:s,forceMount:n,children:e.jsx(mr,{present:n||l.open,children:e.jsx(Hc,{asChild:!0,container:a,children:r})})})};OE.displayName=Yb;var Lc="PopoverContent",LE=v.forwardRef((t,s)=>{const n=kq(Lc,t.__scopePopover),{forceMount:r=n.forceMount,...a}=t,l=eo(Lc,t.__scopePopover);return e.jsx(mr,{present:r||l.open,children:l.modal?e.jsx(Eq,{...a,ref:s}):e.jsx(Dq,{...a,ref:s})})});LE.displayName=Lc;var Rq=vq("PopoverContent.RemoveScroll"),Eq=v.forwardRef((t,s)=>{const n=eo(Lc,t.__scopePopover),r=v.useRef(null),a=Ms(s,r),l=v.useRef(!1);return v.useEffect(()=>{const c=r.current;if(c)return cf(c)},[]),e.jsx(yu,{as:Rq,allowPinchZoom:!0,children:e.jsx(IE,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Vt(t.onCloseAutoFocus,c=>{var d;c.preventDefault(),l.current||(d=n.triggerRef.current)==null||d.focus()}),onPointerDownOutside:Vt(t.onPointerDownOutside,c=>{const d=c.detail.originalEvent,m=d.button===0&&d.ctrlKey===!0,x=d.button===2||m;l.current=x},{checkForDefaultPrevented:!1}),onFocusOutside:Vt(t.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),Dq=v.forwardRef((t,s)=>{const n=eo(Lc,t.__scopePopover),r=v.useRef(!1),a=v.useRef(!1);return e.jsx(IE,{...t,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,d;(c=t.onCloseAutoFocus)==null||c.call(t,l),l.defaultPrevented||(r.current||(d=n.triggerRef.current)==null||d.focus(),l.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:l=>{var m,x;(m=t.onInteractOutside)==null||m.call(t,l),l.defaultPrevented||(r.current=!0,l.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=l.target;((x=n.triggerRef.current)==null?void 0:x.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&a.current&&l.preventDefault()}})}),IE=v.forwardRef((t,s)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:x,onInteractOutside:f,...h}=t,g=eo(Lc,n),u=Cu(n);return Jm(),e.jsx(xu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:l,children:e.jsx(zc,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:f,onEscapeKeyDown:d,onPointerDownOutside:m,onFocusOutside:x,onDismiss:()=>g.onOpenChange(!1),children:e.jsx(af,{"data-state":FE(g.open),role:"dialog",id:g.contentId,...u,...h,ref:s,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ME="PopoverClose",Tq=v.forwardRef((t,s)=>{const{__scopePopover:n,...r}=t,a=eo(ME,n);return e.jsx(ps.button,{type:"button",...r,ref:s,onClick:Vt(t.onClick,()=>a.onOpenChange(!1))})});Tq.displayName=ME;var _q="PopoverArrow",Pq=v.forwardRef((t,s)=>{const{__scopePopover:n,...r}=t,a=Cu(n);return e.jsx(lf,{...a,...r,ref:s})});Pq.displayName=_q;function FE(t){return t?"open":"closed"}var Oq=DE,Lq=PE,Iq=OE,Mq=LE;function Fq({...t}){return e.jsx(Oq,{"data-slot":"popover",...t})}function Bq({...t}){return e.jsx(Lq,{"data-slot":"popover-trigger",...t})}function $q({className:t,align:s="center",sideOffset:n=4,...r}){return e.jsx(Iq,{children:e.jsx(Mq,{"data-slot":"popover-content",align:s,sideOffset:n,className:_t("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...r})})}var b1=1,qq=.9,zq=.8,Uq=.17,tg=.1,sg=.999,Vq=.9999,Hq=.99,Wq=/[\\\/_+.#"@\[\(\{&]/,Kq=/[\\\/_+.#"@\[\(\{&]/g,Gq=/[\s-]/,BE=/[\s-]/g;function Dv(t,s,n,r,a,l,c){if(l===s.length)return a===t.length?b1:Hq;var d=`${a},${l}`;if(c[d]!==void 0)return c[d];for(var m=r.charAt(l),x=n.indexOf(m,a),f=0,h,g,u,j;x>=0;)h=Dv(t,s,n,r,x+1,l+1,c),h>f&&(x===a?h*=b1:Wq.test(t.charAt(x-1))?(h*=zq,u=t.slice(a,x-1).match(Kq),u&&a>0&&(h*=Math.pow(sg,u.length))):Gq.test(t.charAt(x-1))?(h*=qq,j=t.slice(a,x-1).match(BE),j&&a>0&&(h*=Math.pow(sg,j.length))):(h*=Uq,a>0&&(h*=Math.pow(sg,x-a))),t.charAt(x)!==s.charAt(l)&&(h*=Vq)),(hh&&(h=g*tg)),h>f&&(f=h),x=n.indexOf(m,x+1);return c[d]=f,f}function y1(t){return t.toLowerCase().replace(BE," ")}function Yq(t,s,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,Dv(t,s,y1(t),y1(s),0,0,{})}var Rd='[cmdk-group=""]',ng='[cmdk-group-items=""]',Zq='[cmdk-group-heading=""]',$E='[cmdk-item=""]',j1=`${$E}:not([aria-disabled="true"])`,Tv="cmdk-item-select",jc="data-value",Qq=(t,s,n)=>Yq(t,s,n),qE=v.createContext(void 0),Au=()=>v.useContext(qE),zE=v.createContext(void 0),Zb=()=>v.useContext(zE),UE=v.createContext(void 0),VE=v.forwardRef((t,s)=>{let n=Nc(()=>{var O,z;return{search:"",value:(z=(O=t.value)!=null?O:t.defaultValue)!=null?z:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Nc(()=>new Set),a=Nc(()=>new Map),l=Nc(()=>new Map),c=Nc(()=>new Set),d=HE(t),{label:m,children:x,value:f,onValueChange:h,filter:g,shouldFilter:u,loop:j,disablePointerSelection:p=!1,vimBindings:y=!0,...N}=t,S=hr(),A=hr(),w=hr(),E=v.useRef(null),T=oz();Uo(()=>{if(f!==void 0){let O=f.trim();n.current.value=O,C.emit()}},[f]),Uo(()=>{T(6,M)},[]);let C=v.useMemo(()=>({subscribe:O=>(c.current.add(O),()=>c.current.delete(O)),snapshot:()=>n.current,setState:(O,z,G)=>{var Y,V,X,ne;if(!Object.is(n.current[O],z)){if(n.current[O]=z,O==="search")P(),_(),T(1,R);else if(O==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let oe=document.getElementById(w);oe?oe.focus():(Y=document.getElementById(S))==null||Y.focus()}if(T(7,()=>{var oe;n.current.selectedItemId=(oe=q())==null?void 0:oe.id,C.emit()}),G||T(5,M),((V=d.current)==null?void 0:V.value)!==void 0){let oe=z??"";(ne=(X=d.current).onValueChange)==null||ne.call(X,oe);return}}C.emit()}},emit:()=>{c.current.forEach(O=>O())}}),[]),L=v.useMemo(()=>({value:(O,z,G)=>{var Y;z!==((Y=l.current.get(O))==null?void 0:Y.value)&&(l.current.set(O,{value:z,keywords:G}),n.current.filtered.items.set(O,$(z,G)),T(2,()=>{_(),C.emit()}))},item:(O,z)=>(r.current.add(O),z&&(a.current.has(z)?a.current.get(z).add(O):a.current.set(z,new Set([O]))),T(3,()=>{P(),_(),n.current.value||R(),C.emit()}),()=>{l.current.delete(O),r.current.delete(O),n.current.filtered.items.delete(O);let G=q();T(4,()=>{P(),(G==null?void 0:G.getAttribute("id"))===O&&R(),C.emit()})}),group:O=>(a.current.has(O)||a.current.set(O,new Set),()=>{l.current.delete(O),a.current.delete(O)}),filter:()=>d.current.shouldFilter,label:m||t["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:S,inputId:w,labelId:A,listInnerRef:E}),[]);function $(O,z){var G,Y;let V=(Y=(G=d.current)==null?void 0:G.filter)!=null?Y:Qq;return O?V(O,n.current.search,z):0}function _(){if(!n.current.search||d.current.shouldFilter===!1)return;let O=n.current.filtered.items,z=[];n.current.filtered.groups.forEach(Y=>{let V=a.current.get(Y),X=0;V.forEach(ne=>{let oe=O.get(ne);X=Math.max(oe,X)}),z.push([Y,X])});let G=E.current;K().sort((Y,V)=>{var X,ne;let oe=Y.getAttribute("id"),re=V.getAttribute("id");return((X=O.get(re))!=null?X:0)-((ne=O.get(oe))!=null?ne:0)}).forEach(Y=>{let V=Y.closest(ng);V?V.appendChild(Y.parentElement===V?Y:Y.closest(`${ng} > *`)):G.appendChild(Y.parentElement===G?Y:Y.closest(`${ng} > *`))}),z.sort((Y,V)=>V[1]-Y[1]).forEach(Y=>{var V;let X=(V=E.current)==null?void 0:V.querySelector(`${Rd}[${jc}="${encodeURIComponent(Y[0])}"]`);X==null||X.parentElement.appendChild(X)})}function R(){let O=K().find(G=>G.getAttribute("aria-disabled")!=="true"),z=O==null?void 0:O.getAttribute(jc);C.setState("value",z||void 0)}function P(){var O,z,G,Y;if(!n.current.search||d.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let V=0;for(let X of r.current){let ne=(z=(O=l.current.get(X))==null?void 0:O.value)!=null?z:"",oe=(Y=(G=l.current.get(X))==null?void 0:G.keywords)!=null?Y:[],re=$(ne,oe);n.current.filtered.items.set(X,re),re>0&&V++}for(let[X,ne]of a.current)for(let oe of ne)if(n.current.filtered.items.get(oe)>0){n.current.filtered.groups.add(X);break}n.current.filtered.count=V}function M(){var O,z,G;let Y=q();Y&&(((O=Y.parentElement)==null?void 0:O.firstChild)===Y&&((G=(z=Y.closest(Rd))==null?void 0:z.querySelector(Zq))==null||G.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function q(){var O;return(O=E.current)==null?void 0:O.querySelector(`${$E}[aria-selected="true"]`)}function K(){var O;return Array.from(((O=E.current)==null?void 0:O.querySelectorAll(j1))||[])}function Z(O){let z=K()[O];z&&C.setState("value",z.getAttribute(jc))}function W(O){var z;let G=q(),Y=K(),V=Y.findIndex(ne=>ne===G),X=Y[V+O];(z=d.current)!=null&&z.loop&&(X=V+O<0?Y[Y.length-1]:V+O===Y.length?Y[0]:Y[V+O]),X&&C.setState("value",X.getAttribute(jc))}function U(O){let z=q(),G=z==null?void 0:z.closest(Rd),Y;for(;G&&!Y;)G=O>0?iz(G,Rd):lz(G,Rd),Y=G==null?void 0:G.querySelector(j1);Y?C.setState("value",Y.getAttribute(jc)):W(O)}let F=()=>Z(K().length-1),B=O=>{O.preventDefault(),O.metaKey?F():O.altKey?U(1):W(1)},D=O=>{O.preventDefault(),O.metaKey?Z(0):O.altKey?U(-1):W(-1)};return v.createElement(ps.div,{ref:s,tabIndex:-1,...N,"cmdk-root":"",onKeyDown:O=>{var z;(z=N.onKeyDown)==null||z.call(N,O);let G=O.nativeEvent.isComposing||O.keyCode===229;if(!(O.defaultPrevented||G))switch(O.key){case"n":case"j":{y&&O.ctrlKey&&B(O);break}case"ArrowDown":{B(O);break}case"p":case"k":{y&&O.ctrlKey&&D(O);break}case"ArrowUp":{D(O);break}case"Home":{O.preventDefault(),Z(0);break}case"End":{O.preventDefault(),F();break}case"Enter":{O.preventDefault();let Y=q();if(Y){let V=new Event(Tv);Y.dispatchEvent(V)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:L.inputId,id:L.labelId,style:dz},m),Ef(t,O=>v.createElement(zE.Provider,{value:C},v.createElement(qE.Provider,{value:L},O))))}),Xq=v.forwardRef((t,s)=>{var n,r;let a=hr(),l=v.useRef(null),c=v.useContext(UE),d=Au(),m=HE(t),x=(r=(n=m.current)==null?void 0:n.forceMount)!=null?r:c==null?void 0:c.forceMount;Uo(()=>{if(!x)return d.item(a,c==null?void 0:c.id)},[x]);let f=WE(a,l,[t.value,t.children,l],t.keywords),h=Zb(),g=zl(T=>T.value&&T.value===f.current),u=zl(T=>x||d.filter()===!1?!0:T.search?T.filtered.items.get(a)>0:!0);v.useEffect(()=>{let T=l.current;if(!(!T||t.disabled))return T.addEventListener(Tv,j),()=>T.removeEventListener(Tv,j)},[u,t.onSelect,t.disabled]);function j(){var T,C;p(),(C=(T=m.current).onSelect)==null||C.call(T,f.current)}function p(){h.setState("value",f.current,!0)}if(!u)return null;let{disabled:y,value:N,onSelect:S,forceMount:A,keywords:w,...E}=t;return v.createElement(ps.div,{ref:Br(l,s),...E,id:a,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!g,"data-disabled":!!y,"data-selected":!!g,onPointerMove:y||d.getDisablePointerSelection()?void 0:p,onClick:y?void 0:j},t.children)}),Jq=v.forwardRef((t,s)=>{let{heading:n,children:r,forceMount:a,...l}=t,c=hr(),d=v.useRef(null),m=v.useRef(null),x=hr(),f=Au(),h=zl(u=>a||f.filter()===!1?!0:u.search?u.filtered.groups.has(c):!0);Uo(()=>f.group(c),[]),WE(c,d,[t.value,t.heading,m]);let g=v.useMemo(()=>({id:c,forceMount:a}),[a]);return v.createElement(ps.div,{ref:Br(d,s),...l,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},n&&v.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:x},n),Ef(t,u=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?x:void 0},v.createElement(UE.Provider,{value:g},u))))}),ez=v.forwardRef((t,s)=>{let{alwaysRender:n,...r}=t,a=v.useRef(null),l=zl(c=>!c.search);return!n&&!l?null:v.createElement(ps.div,{ref:Br(a,s),...r,"cmdk-separator":"",role:"separator"})}),tz=v.forwardRef((t,s)=>{let{onValueChange:n,...r}=t,a=t.value!=null,l=Zb(),c=zl(x=>x.search),d=zl(x=>x.selectedItemId),m=Au();return v.useEffect(()=>{t.value!=null&&l.setState("search",t.value)},[t.value]),v.createElement(ps.input,{ref:s,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":d,id:m.inputId,type:"text",value:a?t.value:c,onChange:x=>{a||l.setState("search",x.target.value),n==null||n(x.target.value)}})}),sz=v.forwardRef((t,s)=>{let{children:n,label:r="Suggestions",...a}=t,l=v.useRef(null),c=v.useRef(null),d=zl(x=>x.selectedItemId),m=Au();return v.useEffect(()=>{if(c.current&&l.current){let x=c.current,f=l.current,h,g=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let u=x.offsetHeight;f.style.setProperty("--cmdk-list-height",u.toFixed(1)+"px")})});return g.observe(x),()=>{cancelAnimationFrame(h),g.unobserve(x)}}},[]),v.createElement(ps.div,{ref:Br(l,s),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":r,id:m.listId},Ef(t,x=>v.createElement("div",{ref:Br(c,m.listInnerRef),"cmdk-list-sizer":""},x)))}),nz=v.forwardRef((t,s)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:l,container:c,...d}=t;return v.createElement(Lb,{open:n,onOpenChange:r},v.createElement(Ib,{container:c},v.createElement(yf,{"cmdk-overlay":"",className:a}),v.createElement(jf,{"aria-label":t.label,"cmdk-dialog":"",className:l},v.createElement(VE,{ref:s,...d}))))}),rz=v.forwardRef((t,s)=>zl(n=>n.filtered.count===0)?v.createElement(ps.div,{ref:s,...t,"cmdk-empty":"",role:"presentation"}):null),az=v.forwardRef((t,s)=>{let{progress:n,children:r,label:a="Loading...",...l}=t;return v.createElement(ps.div,{ref:s,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Ef(t,c=>v.createElement("div",{"aria-hidden":!0},c)))}),Gc=Object.assign(VE,{List:sz,Item:Xq,Input:tz,Group:Jq,Separator:ez,Dialog:nz,Empty:rz,Loading:az});function iz(t,s){let n=t.nextElementSibling;for(;n;){if(n.matches(s))return n;n=n.nextElementSibling}}function lz(t,s){let n=t.previousElementSibling;for(;n;){if(n.matches(s))return n;n=n.previousElementSibling}}function HE(t){let s=v.useRef(t);return Uo(()=>{s.current=t}),s}var Uo=typeof window>"u"?v.useEffect:v.useLayoutEffect;function Nc(t){let s=v.useRef();return s.current===void 0&&(s.current=t()),s}function zl(t){let s=Zb(),n=()=>t(s.snapshot());return v.useSyncExternalStore(s.subscribe,n,n)}function WE(t,s,n,r=[]){let a=v.useRef(),l=Au();return Uo(()=>{var c;let d=(()=>{var x;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(x=f.current.textContent)==null?void 0:x.trim():a.current}})(),m=r.map(x=>x.trim());l.value(t,d,m),(c=s.current)==null||c.setAttribute(jc,d),a.current=d}),a}var oz=()=>{let[t,s]=v.useState(),n=Nc(()=>new Map);return Uo(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,a)=>{n.current.set(r,a),s({})}};function cz(t){let s=t.type;return typeof s=="function"?s(t.props):"render"in s?s.render(t.props):t}function Ef({asChild:t,children:s},n){return t&&v.isValidElement(s)?v.cloneElement(cz(s),{ref:s.ref},n(s.props.children)):n(s)}var dz={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function uz({className:t,...s}){return e.jsx(Gc,{"data-slot":"command",className:_t("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...s})}function hz({className:t,...s}){return e.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[e.jsx(Ra,{className:"size-4 shrink-0 opacity-50"}),e.jsx(Gc.Input,{"data-slot":"command-input",className:_t("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),...s})]})}function mz({className:t,...s}){return e.jsx(Gc.List,{"data-slot":"command-list",className:_t("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...s})}function fz({...t}){return e.jsx(Gc.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t})}function pz({className:t,...s}){return e.jsx(Gc.Group,{"data-slot":"command-group",className:_t("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),...s})}function N1({className:t,...s}){return e.jsx(Gc.Item,{"data-slot":"command-item",className:_t("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s})}const xz=({value:t,onChange:s,asmUsers:n,className:r})=>{const[a,l]=v.useState(!1),c=n.find(d=>d.id===t);return e.jsxs(Fq,{open:a,onOpenChange:l,children:[e.jsx(Bq,{asChild:!0,children:e.jsxs(se,{variant:"outline",role:"combobox","aria-expanded":a,className:_t("w-full min-w-0 justify-between",r),children:[e.jsx("span",{className:"truncate text-left",children:t==="__none__"?"Unassign":c?`${c.fullName} (${c.employeeId||c.email})`:"Select ASM"}),e.jsx(eL,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx($q,{className:"w-[360px] max-w-[90vw] p-0",children:e.jsxs(uz,{children:[e.jsx(hz,{placeholder:"Search ASM by name/email/id..."}),e.jsxs(mz,{className:"max-h-64 overflow-y-auto custom-scrollbar-slim",children:[e.jsx(fz,{children:"No ASM found."}),e.jsxs(pz,{children:[e.jsxs(N1,{value:"Unassign __none__",onSelect:()=>{s("__none__"),l(!1)},children:[e.jsx(Bn,{className:_t("mr-2 h-4 w-4",t==="__none__"?"opacity-100":"opacity-0")}),"Unassign"]}),n.map(d=>e.jsxs(N1,{value:`${d.fullName} ${d.email} ${d.employeeId||""}`,onSelect:()=>{s(d.id),l(!1)},children:[e.jsx(Bn,{className:_t("mr-2 h-4 w-4",t===d.id?"opacity-100":"opacity-0")}),d.fullName," (",d.employeeId||d.email,")"]},d.id))]})]})]})})]})},gz=()=>{const[t,s]=v.useState(!1),[n,r]=v.useState([]),[a,l]=v.useState([]),[c,d]=v.useState({}),m=async()=>{var h,g,u,j;try{s(!0);const p=await Ss.getDealerAsmMappings();p!=null&&p.success&&(r(((h=p.data)==null?void 0:h.dealers)||[]),l(((g=p.data)==null?void 0:g.asmUsers)||[]))}catch(p){ee.error(((j=(u=p==null?void 0:p.response)==null?void 0:u.data)==null?void 0:j.message)||"Failed to load dealer ASM mappings")}finally{s(!1)}};v.useEffect(()=>{m()},[]);const x=v.useMemo(()=>[...n].sort((h,g)=>{const u=String(h.status||"").toLowerCase()==="active",j=String(g.status||"").toLowerCase()==="active";return u!==j?u?-1:1:String(h.dealerName||"").localeCompare(String(g.dealerName||""))}),[n]),f=async h=>{var u,j;const g=c[h]||"";try{const p=await Ss.saveDealerAsmMapping({dealerId:h,asmUserId:g==="__none__"?null:g||null});p!=null&&p.success?(ee.success(p.message||"Dealer ASM mapping updated"),await m()):ee.error((p==null?void 0:p.message)||"Failed to save mapping")}catch(p){ee.error(((j=(u=p==null?void 0:p.response)==null?void 0:u.data)==null?void 0:j.message)||"Failed to save mapping")}};return e.jsxs(Ie,{children:[e.jsxs(tt,{children:[e.jsx(nt,{children:"Dealer-Level ASM Assignment"}),e.jsx(Zt,{children:"Assign Sales ASM to onboarded dealers. DD-AM remains district-level in the section above."})]}),e.jsx(Me,{children:t?e.jsx("p",{className:"text-sm text-slate-500",children:"Loading mappings..."}):e.jsxs(ks,{className:"w-full",children:[e.jsx(Rs,{children:e.jsxs(ct,{children:[e.jsx(me,{children:"Dealer"}),e.jsx(me,{children:"Dealer Code"}),e.jsx(me,{children:"Status"}),e.jsx(me,{children:"Current ASM"}),e.jsx(me,{children:"Assign ASM"})]})}),e.jsxs(Es,{children:[x.length===0&&e.jsx(ct,{children:e.jsx(de,{colSpan:5,className:"text-center text-slate-500 py-8",children:"No dealers available for ASM mapping yet."})}),x.map(h=>{var g;return e.jsxs(ct,{children:[e.jsx(de,{children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:h.dealerName}),e.jsx("span",{className:"text-xs text-slate-500",children:h.legalName})]})}),e.jsx(de,{children:h.dealerCode||"N/A"}),e.jsx(de,{children:e.jsx(Ae,{variant:String(h.status||"").toLowerCase()==="active"?"default":"secondary",children:h.status||"Unknown"})}),e.jsx(de,{children:h.assignedAsm?e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{children:h.assignedAsm.fullName}),e.jsx("span",{className:"text-xs text-slate-500 truncate",children:h.assignedAsm.employeeId||h.assignedAsm.email})]}):e.jsx("span",{className:"text-slate-400 text-sm",children:"Unassigned"})}),e.jsx(de,{children:e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx(xz,{asmUsers:a,value:c[h.dealerId]??((g=h.assignedAsm)==null?void 0:g.id)??"__none__",onChange:u=>d(j=>({...j,[h.dealerId]:u})),className:"flex-1 min-w-[180px]"}),e.jsx(se,{size:"sm",className:"shrink-0",onClick:()=>f(h.dealerId),children:"Assign"})]})})]},h.dealerId)})]})]})})]})},vz=({isOpen:t,onOpenChange:s,editingZMId:n,zmManagerId:r,setZmManagerId:a,zmStatus:l,setZmStatus:c,selectedZone:d,setSelectedZone:m,selectedRegions:x,setSelectedRegions:f,onSave:h,userAssignedData:g})=>{const{zones:u,regionalOffices:j}=Nn(N=>N.master),p=g.filter(N=>(N.allRoles||[]).some(A=>{const w=(A||"").toUpperCase();return["ZM","ZONAL MANAGER","ZBH","ZONE BUSINESS HEAD","RM","RBM","REGIONAL MANAGER"].includes(w)||w.includes("ZONAL")||w.includes("REGIONAL")})),y=j.filter(N=>N.zoneId===d);return e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"max-w-xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsxs(us,{children:[n?"Edit":"Add"," Zonal Manager"]}),e.jsx(vs,{children:"Assign Zonal Manager to Regions within a Zone"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border-b border-slate-100 pb-4",children:[e.jsxs(ce,{children:["Select Zonal Manager User ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:r,onValueChange:N=>{a(N);const S=g.find(A=>A.id===N);S&&(S.zoneId&&m(S.zoneId),S.assignedRegionIds&&f(S.assignedRegionIds))},disabled:!!n,children:[e.jsx(Ct,{className:"mt-2 w-full text-slate-900 border-slate-200",children:e.jsx(St,{placeholder:"Select ZM User"})}),e.jsx(At,{className:"max-h-60",children:p.map(N=>e.jsx(_e,{value:N.id,children:e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx("span",{className:"font-medium text-slate-900",children:N.name}),e.jsx("span",{className:"text-xs text-slate-500",children:N.email})]})},N.id))})]})]}),e.jsxs("div",{children:[e.jsxs(ce,{children:["Managed Zone ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(wt,{value:d,onValueChange:N=>{m(N),f([])},children:[e.jsx(Ct,{className:"mt-2",children:e.jsx(St,{placeholder:"Select zone"})}),e.jsx(At,{children:u.map(N=>e.jsx(_e,{value:N.id,children:N.name},N.id))})]})]}),d&&e.jsxs("div",{children:[e.jsxs(ce,{className:"mb-2 block",children:["Assigned Regions ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("div",{className:"border border-slate-200 rounded-lg p-4 bg-slate-50/50 max-h-60 overflow-y-auto",children:e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[y.map(N=>e.jsxs("div",{className:"flex items-center space-x-3 p-2 rounded hover:bg-white transition-colors",children:[e.jsx(Rn,{id:`region-${N.id}`,checked:x.includes(N.id),onCheckedChange:S=>{f(S?[...x,N.id]:x.filter(A=>A!==N.id))}}),e.jsxs("label",{htmlFor:`region-${N.id}`,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer flex-1",children:[N.name,e.jsx("span",{className:"text-xs text-slate-500 block mt-1",children:N.code||"No Code"})]})]},N.id)),y.length===0&&e.jsx("p",{className:"text-sm text-slate-500 italic text-center py-4",children:"No regions found for this zone"})]})})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Status"}),e.jsxs(wt,{value:l,onValueChange:N=>c(N),children:[e.jsx(Ct,{className:"mt-2",children:e.jsx(St,{})}),e.jsxs(At,{children:[e.jsx(_e,{value:"active",children:"Active"}),e.jsx(_e,{value:"inactive",children:"Inactive"})]})]})]}),e.jsxs("div",{className:"flex gap-3 pt-6",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>s(!1),children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-amber-600 hover:bg-amber-700",onClick:h,children:"Save Zonal Manager"})]})]})]})})},bz=({isOpen:t,onOpenChange:s,editingZoneId:n,zoneName:r,setZoneName:a,zoneCode:l,setZoneCode:c,zoneDescription:d,setZoneDescription:m,zonalBusinessHeadId:x,setZonalBusinessHeadId:f,userAssignedData:h,onSave:g})=>{const u=(h||[]).filter(p=>{if(x!=="none"&&p.id===x)return!0;const y=(p.allRoles||[]).map(S=>String(S||"").toUpperCase()),N=String(p.roleCode||p.role||"").toUpperCase();return N==="ZBH"||N.includes("ZONAL BUSINESS HEAD")||y.some(S=>{const A=String(S||"").toUpperCase();return A==="ZBH"||A==="ZONE BUSINESS HEAD"||A==="ZONAL BUSINESS HEAD"})}),j=u.length>0?u:h||[];return gt.useEffect(()=>{},[n,t]),e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"max-w-md",children:[e.jsxs(ms,{children:[e.jsxs(us,{children:[n?"Edit":"Add"," Zone"]}),e.jsx(vs,{children:"Configure zonal details and geographical boundaries"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Zone Name"}),e.jsx(ot,{placeholder:"e.g., North Zone",className:"mt-2 text-slate-900",value:r,onChange:p=>a(p.target.value)})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Zone Code"}),e.jsx(ot,{placeholder:"e.g., NZ",className:"mt-2 text-slate-900",value:l,onChange:p=>c(p.target.value)})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Zonal Business Head"}),e.jsxs(wt,{value:x,onValueChange:f,children:[e.jsx(Ct,{className:"mt-2 w-full text-slate-900",children:e.jsx(St,{placeholder:"Select Head"})}),e.jsxs(At,{className:"max-h-60",children:[e.jsx(_e,{value:"none",children:"None / Unassigned"}),j.map(p=>e.jsxs(_e,{value:p.id,children:[p.name," (",p.email,")"]},p.id))]})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Description"}),e.jsx(Fs,{placeholder:"Describe the zone's coverage...",className:"mt-2 text-slate-900",rows:3,value:d,onChange:p=>m(p.target.value)})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>s(!1),children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-amber-600 hover:bg-amber-700",onClick:g,children:"Save Zone"})]})]})]})})},yz=({isOpen:t,onOpenChange:s,editingRegionId:n,regionName:r,setRegionName:a,regionDescription:l,setRegionDescription:c,selectedRegionZone:d,setSelectedRegionZone:m,regionalManagerId:x,setRegionalManagerId:f,selectedRegionStates:h,setSelectedRegionStates:g,onSave:u,userAssignedData:j})=>{const{zones:p,allStates:y,allDistricts:N,regionalOffices:S}=Nn(R=>R.master),[A,w]=gt.useState([]),E=gt.useMemo(()=>{const R={};return(S||[]).forEach(P=>{P.id!==n&&(P.districts||[]).forEach(M=>{R[M.id]=P.name})}),R},[S,n]),T=gt.useMemo(()=>{if(!d)return y;const R=new Set(N.filter(P=>P.zoneId===d||!P.zoneId||h.includes(P.id)).map(P=>P.stateId).filter(Boolean));return y.filter(P=>P.zoneId===d||R.has(P.id)||!P.zoneId)},[y,N,d,h]),C=gt.useMemo(()=>A.length===0?[]:N.filter(R=>A.includes(R.stateId)&&(!R.zoneId||R.zoneId===d||R.regionId===n)),[N,A,d,n]),L=gt.useMemo(()=>{const R={};return C.forEach(P=>{const M=y.find(K=>K.id===P.stateId),q=(M==null?void 0:M.name)||P.stateId;R[P.stateId]||(R[P.stateId]={stateName:q,districts:[]}),R[P.stateId].districts.push(P)}),Object.values(R)},[C,y]);gt.useEffect(()=>{if(!t){w([]);return}if(h.length>0){const R=Array.from(new Set(N.filter(P=>h.includes(P.id)).map(P=>P.stateId).filter(Boolean)));w(R)}},[t]);const $=R=>{m(R),w([]),g([])},_=(R,P)=>{if(P)w(M=>[...M,R]);else{w(q=>q.filter(K=>K!==R));const M=N.filter(q=>q.stateId===R).map(q=>q.id);g(h.filter(q=>!M.includes(q)))}};return e.jsx(os,{open:t,onOpenChange:s,children:e.jsxs(ls,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(ms,{children:[e.jsxs(us,{children:[n?"Edit":"Add"," Regional Office"]}),e.jsx(vs,{children:"Configure regional office details and coverage area"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ce,{children:"Region Name"}),e.jsx(ot,{placeholder:"e.g., Delhi NCR Region",className:"mt-2 text-slate-900",value:r,onChange:R=>a(R.target.value)})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Zone"}),e.jsxs(wt,{value:d,onValueChange:$,children:[e.jsx(Ct,{className:"mt-2 text-slate-900",children:e.jsx(St,{placeholder:"Select zone"})}),e.jsx(At,{children:p.map(R=>e.jsx(_e,{value:R.id,children:R.name},R.id))})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Regional Manager"}),e.jsxs(wt,{value:x,onValueChange:f,children:[e.jsx(Ct,{className:"mt-2 w-full text-slate-900",children:e.jsx(St,{placeholder:"Select from available users"})}),e.jsx(At,{className:"max-h-60",children:j.map(R=>e.jsxs(_e,{value:R.id,children:[R.name||R.fullName,R.email?` — ${R.email}`:""]},R.id))})]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Description"}),e.jsx(Fs,{placeholder:"Describe the region...",className:"mt-2 text-slate-900",rows:2,value:l,onChange:R=>c(R.target.value)})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"States Covered"}),!d&&e.jsx("p",{className:"text-xs text-amber-600 mt-1",children:"Select a zone first to see available states"}),e.jsx("div",{className:"mt-2 border rounded-lg p-3 max-h-40 overflow-y-auto bg-slate-50",children:T.length===0?e.jsx("p",{className:"text-xs text-slate-400 italic",children:d?"No states with available districts in this zone":"Select a zone to load states"}):e.jsx("div",{className:"space-y-2",children:T.map(R=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Rn,{id:`region-state-${R.id}`,checked:A.includes(R.id),disabled:!d,onCheckedChange:P=>_(R.id,!!P)}),e.jsx("label",{htmlFor:`region-state-${R.id}`,className:`text-sm cursor-pointer ${d?"text-slate-900":"text-slate-400"}`,children:R.name})]},R.id))})}),e.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:[A.length," ",A.length===1?"state":"states"," selected"]})]}),e.jsxs("div",{children:[e.jsx(ce,{children:"Districts Covered"}),e.jsx("div",{className:"mt-2 border rounded-lg p-3 max-h-56 overflow-y-auto bg-slate-50",children:A.length===0?e.jsx("p",{className:"text-xs text-slate-400 italic",children:"Select one or more states above to see districts"}):L.length===0?e.jsx("p",{className:"text-xs text-slate-400 italic",children:"No available districts in the selected states for this zone"}):e.jsx(kf,{children:L.map(({stateName:R,districts:P})=>e.jsxs("div",{className:"mb-4 last:mb-0",children:[e.jsx("h4",{className:"text-xs font-semibold text-amber-700 uppercase tracking-wide mb-2 pb-1 border-b border-slate-200",children:R}),e.jsx("div",{className:"space-y-2 ml-1",children:P.map(M=>{const q=E[M.id],K=M.zoneId&&M.zoneId!==d&&M.regionId!==n,Z=!!(q||K),W=q?`Already assigned to region: ${q}`:K?"Belongs to a different zone":"";return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(Wb,{children:[e.jsx(Kb,{asChild:!0,children:e.jsxs("div",{className:"flex items-center space-x-2 w-full",children:[e.jsx(Rn,{id:`region-district-${M.id}`,disabled:Z,checked:h.includes(M.id),onCheckedChange:U=>{g(U?[...h,M.id]:h.filter(F=>F!==M.id))}}),e.jsxs("label",{htmlFor:`region-district-${M.id}`,className:`text-sm flex-1 ${Z?"text-slate-400 cursor-not-allowed line-through":"text-slate-900 cursor-pointer"}`,children:[M.name,q&&e.jsxs("span",{className:"ml-2 text-xs text-red-400 font-normal no-underline",style:{textDecoration:"none"},children:["(in ",q,")"]})]})]})}),Z&&W&&e.jsx(Gb,{children:e.jsx("p",{className:"text-xs",children:W})})]})},M.id)})})]},R))})}),e.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:[h.length," ",h.length===1?"district":"districts"," selected"]})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx(se,{variant:"outline",className:"flex-1",onClick:()=>s(!1),children:"Cancel"}),e.jsx(se,{className:"flex-1 bg-amber-600 hover:bg-amber-700",onClick:u,children:"Save Regional Office"})]})]})]})})};var Df="Switch",[jz]=ea(Df),[Nz,wz]=jz(Df),KE=v.forwardRef((t,s)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:l,required:c,disabled:d,value:m="on",onCheckedChange:x,form:f,...h}=t,[g,u]=v.useState(null),j=Ms(s,A=>u(A)),p=v.useRef(!1),y=g?f||!!g.closest("form"):!0,[N,S]=bi({prop:a,defaultProp:l??!1,onChange:x,caller:Df});return e.jsxs(Nz,{scope:n,checked:N,disabled:d,children:[e.jsx(ps.button,{type:"button",role:"switch","aria-checked":N,"aria-required":c,"data-state":QE(N),"data-disabled":d?"":void 0,disabled:d,value:m,...h,ref:j,onClick:Vt(t.onClick,A=>{S(w=>!w),y&&(p.current=A.isPropagationStopped(),p.current||A.stopPropagation())})}),y&&e.jsx(ZE,{control:g,bubbles:!p.current,name:r,value:m,checked:N,required:c,disabled:d,form:f,style:{transform:"translateX(-100%)"}})]})});KE.displayName=Df;var GE="SwitchThumb",YE=v.forwardRef((t,s)=>{const{__scopeSwitch:n,...r}=t,a=wz(GE,n);return e.jsx(ps.span,{"data-state":QE(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:s})});YE.displayName=GE;var Sz="SwitchBubbleInput",ZE=v.forwardRef(({__scopeSwitch:t,control:s,checked:n,bubbles:r=!0,...a},l)=>{const c=v.useRef(null),d=Ms(c,l),m=Yv(n),x=Zv(s);return v.useEffect(()=>{const f=c.current;if(!f)return;const h=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(h,"checked").set;if(m!==n&&u){const j=new Event("click",{bubbles:r});u.call(f,n),f.dispatchEvent(j)}},[m,n,r]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:d,style:{...a.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});ZE.displayName=Sz;function QE(t){return t?"checked":"unchecked"}var Cz=KE,Az=YE;function Tf({className:t,...s}){return e.jsx(Cz,{"data-slot":"switch",className:_t("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-switch-background focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(Az,{"data-slot":"switch-thumb",className:_t("bg-card dark:data-[state=unchecked]:bg-card-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var rg,w1;function kz(){if(w1)return rg;w1=1;function t(){this.__data__=[],this.size=0}return rg=t,rg}var ag,S1;function XE(){if(S1)return ag;S1=1;function t(s,n){return s===n||s!==s&&n!==n}return ag=t,ag}var ig,C1;function _f(){if(C1)return ig;C1=1;var t=XE();function s(n,r){for(var a=n.length;a--;)if(t(n[a][0],r))return a;return-1}return ig=s,ig}var lg,A1;function Rz(){if(A1)return lg;A1=1;var t=_f(),s=Array.prototype,n=s.splice;function r(a){var l=this.__data__,c=t(l,a);if(c<0)return!1;var d=l.length-1;return c==d?l.pop():n.call(l,c,1),--this.size,!0}return lg=r,lg}var og,k1;function Ez(){if(k1)return og;k1=1;var t=_f();function s(n){var r=this.__data__,a=t(r,n);return a<0?void 0:r[a][1]}return og=s,og}var cg,R1;function Dz(){if(R1)return cg;R1=1;var t=_f();function s(n){return t(this.__data__,n)>-1}return cg=s,cg}var dg,E1;function Tz(){if(E1)return dg;E1=1;var t=_f();function s(n,r){var a=this.__data__,l=t(a,n);return l<0?(++this.size,a.push([n,r])):a[l][1]=r,this}return dg=s,dg}var ug,D1;function Pf(){if(D1)return ug;D1=1;var t=kz(),s=Rz(),n=Ez(),r=Dz(),a=Tz();function l(c){var d=-1,m=c==null?0:c.length;for(this.clear();++du))return!1;var p=h.get(c),y=h.get(d);if(p&&y)return p==d&&y==c;var N=-1,S=!0,A=m&a?new t:void 0;for(h.set(c,d),h.set(d,c);++N-1&&r%1==0&&r-1&&n%1==0&&n<=t}return x0=s,x0}var g0,MS;function jU(){if(MS)return g0;MS=1;var t=Of(),s=iD(),n=Mf(),r="[object Arguments]",a="[object Array]",l="[object Boolean]",c="[object Date]",d="[object Error]",m="[object Function]",x="[object Map]",f="[object Number]",h="[object Object]",g="[object RegExp]",u="[object Set]",j="[object String]",p="[object WeakMap]",y="[object ArrayBuffer]",N="[object DataView]",S="[object Float32Array]",A="[object Float64Array]",w="[object Int8Array]",E="[object Int16Array]",T="[object Int32Array]",C="[object Uint8Array]",L="[object Uint8ClampedArray]",$="[object Uint16Array]",_="[object Uint32Array]",R={};R[S]=R[A]=R[w]=R[E]=R[T]=R[C]=R[L]=R[$]=R[_]=!0,R[r]=R[a]=R[y]=R[l]=R[N]=R[c]=R[d]=R[m]=R[x]=R[f]=R[h]=R[g]=R[u]=R[j]=R[p]=!1;function P(M){return n(M)&&s(M.length)&&!!R[t(M)]}return g0=P,g0}var v0,FS;function NU(){if(FS)return v0;FS=1;function t(s){return function(n){return s(n)}}return v0=t,v0}var Fd={exports:{}};Fd.exports;var BS;function wU(){return BS||(BS=1,(function(t,s){var n=JE(),r=s&&!s.nodeType&&s,a=r&&!0&&t&&!t.nodeType&&t,l=a&&a.exports===r,c=l&&n.process,d=(function(){try{var m=a&&a.require&&a.require("util").types;return m||c&&c.binding&&c.binding("util")}catch{}})();t.exports=d})(Fd,Fd.exports)),Fd.exports}var b0,$S;function lD(){if($S)return b0;$S=1;var t=jU(),s=NU(),n=wU(),r=n&&n.isTypedArray,a=r?s(r):t;return b0=a,b0}var y0,qS;function SU(){if(qS)return y0;qS=1;var t=xU(),s=vU(),n=Jb(),r=aD(),a=yU(),l=lD(),c=Object.prototype,d=c.hasOwnProperty;function m(x,f){var h=n(x),g=!h&&s(x),u=!h&&!g&&r(x),j=!h&&!g&&!u&&l(x),p=h||g||u||j,y=p?t(x.length,String):[],N=y.length;for(var S in x)(f||d.call(x,S))&&!(p&&(S=="length"||u&&(S=="offset"||S=="parent")||j&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||a(S,N)))&&y.push(S);return y}return y0=m,y0}var j0,zS;function CU(){if(zS)return j0;zS=1;var t=Object.prototype;function s(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||t;return n===a}return j0=s,j0}var N0,US;function AU(){if(US)return N0;US=1;function t(s,n){return function(r){return s(n(r))}}return N0=t,N0}var w0,VS;function kU(){if(VS)return w0;VS=1;var t=AU(),s=t(Object.keys,Object);return w0=s,w0}var S0,HS;function RU(){if(HS)return S0;HS=1;var t=CU(),s=kU(),n=Object.prototype,r=n.hasOwnProperty;function a(l){if(!t(l))return s(l);var c=[];for(var d in Object(l))r.call(l,d)&&d!="constructor"&&c.push(d);return c}return S0=a,S0}var C0,WS;function EU(){if(WS)return C0;WS=1;var t=tD(),s=iD();function n(r){return r!=null&&s(r.length)&&!t(r)}return C0=n,C0}var A0,KS;function DU(){if(KS)return A0;KS=1;var t=SU(),s=RU(),n=EU();function r(a){return n(a)?t(a):s(a)}return A0=r,A0}var k0,GS;function TU(){if(GS)return k0;GS=1;var t=hU(),s=pU(),n=DU();function r(a){return t(a,n,s)}return k0=r,k0}var R0,YS;function _U(){if(YS)return R0;YS=1;var t=TU(),s=1,n=Object.prototype,r=n.hasOwnProperty;function a(l,c,d,m,x,f){var h=d&s,g=t(l),u=g.length,j=t(c),p=j.length;if(u!=p&&!h)return!1;for(var y=u;y--;){var N=g[y];if(!(h?N in c:r.call(c,N)))return!1}var S=f.get(l),A=f.get(c);if(S&&A)return S==c&&A==l;var w=!0;f.set(l,c),f.set(c,l);for(var E=h;++y1)return y.map(function(w){return g(w)});var S=y[0];if(typeof S.blotName!="string"&&typeof S.attrName!="string")throw new c("Invalid definition");if(S.blotName==="abstract")throw new c("Cannot register abstract class");if(f[S.blotName||S.attrName]=S,typeof S.keyName=="string")d[S.keyName]=S;else if(S.className!=null&&(h[S.className]=S),S.tagName!=null){Array.isArray(S.tagName)?S.tagName=S.tagName.map(function(w){return w.toUpperCase()}):S.tagName=S.tagName.toUpperCase();var C=Array.isArray(S.tagName)?S.tagName:[S.tagName];C.forEach(function(w){(x[w]==null||S.className==null)&&(x[w]=S)})}return S}r.register=g}),(function(n,r,a){var l=a(51),c=a(11),d=a(3),h=a(20),x="\0",f=function(m){Array.isArray(m)?this.ops=m:m!=null&&Array.isArray(m.ops)?this.ops=m.ops:this.ops=[]};f.prototype.insert=function(m,p){var u={};return m.length===0?this:(u.insert=m,p!=null&&typeof p=="object"&&Object.keys(p).length>0&&(u.attributes=p),this.push(u))},f.prototype.delete=function(m){return m<=0?this:this.push({delete:m})},f.prototype.retain=function(m,p){if(m<=0)return this;var u={retain:m};return p!=null&&typeof p=="object"&&Object.keys(p).length>0&&(u.attributes=p),this.push(u)},f.prototype.push=function(m){var p=this.ops.length,u=this.ops[p-1];if(m=d(!0,{},m),typeof u=="object"){if(typeof m.delete=="number"&&typeof u.delete=="number")return this.ops[p-1]={delete:u.delete+m.delete},this;if(typeof u.delete=="number"&&m.insert!=null&&(p-=1,u=this.ops[p-1],typeof u!="object"))return this.ops.unshift(m),this;if(c(m.attributes,u.attributes)){if(typeof m.insert=="string"&&typeof u.insert=="string")return this.ops[p-1]={insert:u.insert+m.insert},typeof m.attributes=="object"&&(this.ops[p-1].attributes=m.attributes),this;if(typeof m.retain=="number"&&typeof u.retain=="number")return this.ops[p-1]={retain:u.retain+m.retain},typeof m.attributes=="object"&&(this.ops[p-1].attributes=m.attributes),this}}return p===this.ops.length?this.ops.push(m):this.ops.splice(p,0,m),this},f.prototype.chop=function(){var m=this.ops[this.ops.length-1];return m&&m.retain&&!m.attributes&&this.ops.pop(),this},f.prototype.filter=function(m){return this.ops.filter(m)},f.prototype.forEach=function(m){this.ops.forEach(m)},f.prototype.map=function(m){return this.ops.map(m)},f.prototype.partition=function(m){var p=[],u=[];return this.forEach(function(j){var g=m(j)?p:u;g.push(j)}),[p,u]},f.prototype.reduce=function(m,p){return this.ops.reduce(m,p)},f.prototype.changeLength=function(){return this.reduce(function(m,p){return p.insert?m+h.length(p):p.delete?m-p.delete:m},0)},f.prototype.length=function(){return this.reduce(function(m,p){return m+h.length(p)},0)},f.prototype.slice=function(m,p){m=m||0,typeof p!="number"&&(p=1/0);for(var u=[],j=h.iterator(this.ops),g=0;g0&&u.next(g.retain-y)}for(var N=new f(j);p.hasNext()||u.hasNext();)if(u.peekType()==="insert")N.push(u.next());else if(p.peekType()==="delete")N.push(p.next());else{var S=Math.min(p.peekLength(),u.peekLength()),C=p.next(S),w=u.next(S);if(typeof w.retain=="number"){var R={};typeof C.retain=="number"?R.retain=S:R.insert=C.insert;var P=h.attributes.compose(C.attributes,w.attributes,typeof C.retain=="number");if(P&&(R.attributes=P),N.push(R),!u.hasNext()&&c(N.ops[N.ops.length-1],R)){var A=new f(p.rest());return N.concat(A).chop()}}else typeof w.delete=="number"&&typeof C.retain=="number"&&N.push(w)}return N.chop()},f.prototype.concat=function(m){var p=new f(this.ops.slice());return m.ops.length>0&&(p.push(m.ops[0]),p.ops=p.ops.concat(m.ops.slice(1))),p},f.prototype.diff=function(m,p){if(this.ops===m.ops)return new f;var u=[this,m].map(function(S){return S.map(function(C){if(C.insert!=null)return typeof C.insert=="string"?C.insert:x;var w=S===m?"on":"with";throw new Error("diff() called "+w+" non-document")}).join("")}),j=new f,g=l(u[0],u[1],p),y=h.iterator(this.ops),N=h.iterator(m.ops);return g.forEach(function(S){for(var C=S[1].length;C>0;){var w=0;switch(S[0]){case l.INSERT:w=Math.min(N.peekLength(),C),j.push(N.next(w));break;case l.DELETE:w=Math.min(C,y.peekLength()),y.next(w),j.delete(w);break;case l.EQUAL:w=Math.min(y.peekLength(),N.peekLength(),C);var R=y.next(w),P=N.next(w);c(R.insert,P.insert)?j.retain(w,h.attributes.diff(R.attributes,P.attributes)):j.push(P).delete(w);break}C-=w}}),j.chop()},f.prototype.eachLine=function(m,p){p=p||` -`;for(var u=h.iterator(this.ops),j=new f,g=0;u.hasNext();){if(u.peekType()!=="insert")return;var y=u.peek(),N=h.length(y)-u.peekLength(),S=typeof y.insert=="string"?y.insert.indexOf(p,N)-N:-1;if(S<0)j.push(u.next());else if(S>0)j.push(u.next(S));else{if(m(j,u.next(1).attributes||{},g)===!1)return;g+=1,j=new f}}j.length()>0&&m(j,{},g)},f.prototype.transform=function(m,p){if(p=!!p,typeof m=="number")return this.transformPosition(m,p);for(var u=h.iterator(this.ops),j=h.iterator(m.ops),g=new f;u.hasNext()||j.hasNext();)if(u.peekType()==="insert"&&(p||j.peekType()!=="insert"))g.retain(h.length(u.next()));else if(j.peekType()==="insert")g.push(j.next());else{var y=Math.min(u.peekLength(),j.peekLength()),N=u.next(y),S=j.next(y);if(N.delete)continue;S.delete?g.push(S):g.retain(y,h.attributes.transform(N.attributes,S.attributes,p))}return g.chop()},f.prototype.transformPosition=function(m,p){p=!!p;for(var u=h.iterator(this.ops),j=0;u.hasNext()&&j<=m;){var g=u.peekLength(),y=u.peekType();if(u.next(),y==="delete"){m-=Math.min(g,m-j);continue}else y==="insert"&&(j"u"||a.call(u,y)},f=function(u,j){c&&j.name==="__proto__"?c(u,j.name,{enumerable:!0,configurable:!0,value:j.newValue,writable:!0}):u[j.name]=j.newValue},m=function(u,j){if(j==="__proto__")if(a.call(u,j)){if(d)return d(u,j).value}else return;return u[j]};n.exports=function p(){var u,j,g,y,N,S,C=arguments[0],w=1,R=arguments.length,P=!1;for(typeof C=="boolean"&&(P=C,C=arguments[1]||{},w=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});w0&&(q1&&arguments[1]!==void 0?arguments[1]:!1;if(G&&(q===0||q>=this.length()-A)){var Z=this.clone();return q===0?(this.parent.insertBefore(Z,this),this):(this.parent.insertBefore(Z,this.next),Z)}else{var W=c(_.prototype.__proto__||Object.getPrototypeOf(_.prototype),"split",this).call(this,q,G);return this.cache={},W}}}]),_})(p.default.Block);$.blotName="block",$.tagName="P",$.defaultChild="break",$.allowedChildren=[y.default,p.default.Embed,S.default];function T(E){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return E==null||(typeof E.formats=="function"&&(_=(0,h.default)(_,E.formats())),E.parent==null||E.parent.blotName=="scroll"||E.parent.statics.scope!==E.statics.scope)?_:T(E.parent,_)}r.bubbleFormats=T,r.BlockEmbed=I,r.default=$}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.overload=r.expandConfig=void 0;var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(F){return typeof F}:function(F){return F&&typeof Symbol=="function"&&F.constructor===Symbol&&F!==Symbol.prototype?"symbol":typeof F},c=(function(){function F(B,D){var O=[],V=!0,K=!1,Y=void 0;try{for(var U=B[Symbol.iterator](),X;!(V=(X=U.next()).done)&&(O.push(X.value),!(D&&O.length===D));V=!0);}catch(ne){K=!0,Y=ne}finally{try{!V&&U.return&&U.return()}finally{if(K)throw Y}}return O}return function(B,D){if(Array.isArray(B))return B;if(Symbol.iterator in Object(B))return F(B,D);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=(function(){function F(B,D){for(var O=0;O2&&arguments[2]!==void 0?arguments[2]:!1;if(typeof D!="string"){var Y=D.attrName||D.blotName;typeof Y=="string"?this.register("formats/"+Y,D,O):Object.keys(D).forEach(function(U){V.register(U,D[U],O)})}else this.imports[D]!=null&&!K&&M.warn("Overwriting "+D+" with",O),this.imports[D]=O,(D.startsWith("blots/")||D.startsWith("formats/"))&&O.blotName!=="abstract"?N.default.register(O):D.startsWith("modules")&&typeof O.register=="function"&&O.register()}}]);function F(B){var D=this,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(_(this,F),this.options=G(B,O),this.container=this.options.container,this.container==null)return M.error("Invalid Quill container",B);this.options.debug&&F.debug(this.options.debug);var V=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new u.default,this.scroll=N.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new m.default(this.scroll),this.selection=new C.default(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.theme.init(),this.emitter.on(u.default.events.EDITOR_CHANGE,function(Y){Y===u.default.events.TEXT_CHANGE&&D.root.classList.toggle("ql-blank",D.editor.isBlank())}),this.emitter.on(u.default.events.SCROLL_UPDATE,function(Y,U){var X=D.selection.lastRange,ne=X&&X.length===0?X.index:void 0;Z.call(D,function(){return D.editor.update(null,U,ne)},Y)});var K=this.clipboard.convert(`
`+V+"


");this.setContents(K),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return d(F,[{key:"addContainer",value:function(D){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof D=="string"){var V=D;D=document.createElement("div"),D.classList.add(V)}return this.container.insertBefore(D,O),D}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(D,O,V){var K=this,Y=W(D,O,V),U=c(Y,4);return D=U[0],O=U[1],V=U[3],Z.call(this,function(){return K.editor.deleteText(D,O)},V,D,-1*O)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.scroll.enable(D),this.container.classList.toggle("ql-disabled",!D)}},{key:"focus",value:function(){var D=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=D,this.scrollIntoView()}},{key:"format",value:function(D,O){var V=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:u.default.sources.API;return Z.call(this,function(){var Y=V.getSelection(!0),U=new x.default;if(Y==null)return U;if(N.default.query(D,N.default.Scope.BLOCK))U=V.editor.formatLine(Y.index,Y.length,E({},D,O));else{if(Y.length===0)return V.selection.format(D,O),U;U=V.editor.formatText(Y.index,Y.length,E({},D,O))}return V.setSelection(Y,u.default.sources.SILENT),U},K)}},{key:"formatLine",value:function(D,O,V,K,Y){var U=this,X=void 0,ne=W(D,O,V,K,Y),oe=c(ne,4);return D=oe[0],O=oe[1],X=oe[2],Y=oe[3],Z.call(this,function(){return U.editor.formatLine(D,O,X)},Y,D,0)}},{key:"formatText",value:function(D,O,V,K,Y){var U=this,X=void 0,ne=W(D,O,V,K,Y),oe=c(ne,4);return D=oe[0],O=oe[1],X=oe[2],Y=oe[3],Z.call(this,function(){return U.editor.formatText(D,O,X)},Y,D,0)}},{key:"getBounds",value:function(D){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,V=void 0;typeof D=="number"?V=this.selection.getBounds(D,O):V=this.selection.getBounds(D.index,D.length);var K=this.container.getBoundingClientRect();return{bottom:V.bottom-K.top,height:V.height,left:V.left-K.left,right:V.right-K.left,top:V.top-K.top,width:V.width}}},{key:"getContents",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-D,V=W(D,O),K=c(V,2);return D=K[0],O=K[1],this.editor.getContents(D,O)}},{key:"getFormat",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.getSelection(!0),O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof D=="number"?this.editor.getFormat(D,O):this.editor.getFormat(D.index,D.length)}},{key:"getIndex",value:function(D){return D.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(D){return this.scroll.leaf(D)}},{key:"getLine",value:function(D){return this.scroll.line(D)}},{key:"getLines",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE;return typeof D!="number"?this.scroll.lines(D.index,D.length):this.scroll.lines(D,O)}},{key:"getModule",value:function(D){return this.theme.modules[D]}},{key:"getSelection",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return D&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-D,V=W(D,O),K=c(V,2);return D=K[0],O=K[1],this.editor.getText(D,O)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(D,O,V){var K=this,Y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:F.sources.API;return Z.call(this,function(){return K.editor.insertEmbed(D,O,V)},Y,D)}},{key:"insertText",value:function(D,O,V,K,Y){var U=this,X=void 0,ne=W(D,0,V,K,Y),oe=c(ne,4);return D=oe[0],X=oe[2],Y=oe[3],Z.call(this,function(){return U.editor.insertText(D,O,X)},Y,D,O.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(D,O,V){this.clipboard.dangerouslyPasteHTML(D,O,V)}},{key:"removeFormat",value:function(D,O,V){var K=this,Y=W(D,O,V),U=c(Y,4);return D=U[0],O=U[1],V=U[3],Z.call(this,function(){return K.editor.removeFormat(D,O)},V,D)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(D){var O=this,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u.default.sources.API;return Z.call(this,function(){D=new x.default(D);var K=O.getLength(),Y=O.editor.deleteText(0,K),U=O.editor.applyDelta(D),X=U.ops[U.ops.length-1];X!=null&&typeof X.insert=="string"&&X.insert[X.insert.length-1]===` -`&&(O.editor.deleteText(O.getLength()-1,1),U.delete(1));var ne=Y.compose(U);return ne},V)}},{key:"setSelection",value:function(D,O,V){if(D==null)this.selection.setRange(null,O||F.sources.API);else{var K=W(D,O,V),Y=c(K,4);D=Y[0],O=Y[1],V=Y[3],this.selection.setRange(new S.Range(D,O),V),V!==u.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(D){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u.default.sources.API,V=new x.default().insert(D);return this.setContents(V,O)}},{key:"update",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:u.default.sources.USER,O=this.scroll.update(D);return this.selection.update(D),O}},{key:"updateContents",value:function(D){var O=this,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u.default.sources.API;return Z.call(this,function(){return D=new x.default(D),O.editor.applyDelta(D,V)},V,!0)}}]),F})();q.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},q.events=u.default.events,q.sources=u.default.sources,q.version="1.3.7",q.imports={delta:x.default,parchment:N.default,"core/module":g.default,"core/theme":$.default};function G(F,B){if(B=(0,R.default)(!0,{container:F,modules:{clipboard:!0,keyboard:!0,history:!0}},B),!B.theme||B.theme===q.DEFAULTS.theme)B.theme=$.default;else if(B.theme=q.import("themes/"+B.theme),B.theme==null)throw new Error("Invalid theme "+B.theme+". Did you register it?");var D=(0,R.default)(!0,{},B.theme.DEFAULTS);[D,B].forEach(function(K){K.modules=K.modules||{},Object.keys(K.modules).forEach(function(Y){K.modules[Y]===!0&&(K.modules[Y]={})})});var O=Object.keys(D.modules).concat(Object.keys(B.modules)),V=O.reduce(function(K,Y){var U=q.import("modules/"+Y);return U==null?M.error("Cannot load "+Y+" module. Are you sure you registered it?"):K[Y]=U.DEFAULTS||{},K},{});return B.modules!=null&&B.modules.toolbar&&B.modules.toolbar.constructor!==Object&&(B.modules.toolbar={container:B.modules.toolbar}),B=(0,R.default)(!0,{},q.DEFAULTS,{modules:V},D,B),["bounds","container","scrollingContainer"].forEach(function(K){typeof B[K]=="string"&&(B[K]=document.querySelector(B[K]))}),B.modules=Object.keys(B.modules).reduce(function(K,Y){return B.modules[Y]&&(K[Y]=B.modules[Y]),K},{}),B}function Z(F,B,D,O){if(this.options.strict&&!this.isEnabled()&&B===u.default.sources.USER)return new x.default;var V=D==null?null:this.getSelection(),K=this.editor.delta,Y=F();if(V!=null&&(D===!0&&(D=V.index),O==null?V=z(V,Y,B):O!==0&&(V=z(V,D,O,B)),this.setSelection(V,u.default.sources.SILENT)),Y.length()>0){var U,X=[u.default.events.TEXT_CHANGE,Y,K,B];if((U=this.emitter).emit.apply(U,[u.default.events.EDITOR_CHANGE].concat(X)),B!==u.default.sources.SILENT){var ne;(ne=this.emitter).emit.apply(ne,X)}}return Y}function W(F,B,D,O,V){var K={};return typeof F.index=="number"&&typeof F.length=="number"?typeof B!="number"?(V=O,O=D,D=B,B=F.length,F=F.index):(B=F.length,F=F.index):typeof B!="number"&&(V=O,O=D,D=B,B=0),(typeof D>"u"?"undefined":l(D))==="object"?(K=D,V=O):typeof D=="string"&&(O!=null?K[D]=O:V=D),V=V||u.default.sources.API,[F,B,K,V]}function z(F,B,D,O){if(F==null)return null;var V=void 0,K=void 0;if(B instanceof x.default){var Y=[F.index,F.index+F.length].map(function(oe){return B.transformPosition(oe,O!==u.default.sources.USER)}),U=c(Y,2);V=U[0],K=U[1]}else{var X=[F.index,F.index+F.length].map(function(oe){return oe=0?oe+D:Math.max(B,oe+D)}),ne=c(X,2);V=ne[0],K=ne[1]}return new S.Range(V,K-V)}r.expandConfig=G,r.overload=W,r.default=q}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function y(N,S){for(var C=0;C0){var w=this.parent.isolate(this.offset(),this.length());this.moveChildren(w),w.wrap(this)}}}],[{key:"compare",value:function(C,w){var R=N.order.indexOf(C),P=N.order.indexOf(w);return R>=0||P>=0?R-P:C===w?0:C1?P-1:0),I=1;I1&&arguments[1]!==void 0?arguments[1]:{};l(this,d),this.quill=h,this.options=x};c.DEFAULTS={},r.default=c}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=["error","warn","log","info"],c="warn";function d(x){if(l.indexOf(x)<=l.indexOf(c)){for(var f,m=arguments.length,p=Array(m>1?m-1:0),u=1;u0&&typeof p[0]!="number")}function m(p,u,j){var g,y;if(x(p)||x(u)||p.prototype!==u.prototype)return!1;if(d(p))return d(u)?(p=l.call(p),u=l.call(u),h(p,u,j)):!1;if(f(p)){if(!f(u)||p.length!==u.length)return!1;for(g=0;g=0;g--)if(N[g]!=S[g])return!1;for(g=N.length-1;g>=0;g--)if(y=N[g],!h(p[y],u[y],j))return!1;return typeof p==typeof u}}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=a(1),c=(function(){function d(h,x,f){f===void 0&&(f={}),this.attrName=h,this.keyName=x;var m=l.Scope.TYPE&l.Scope.ATTRIBUTE;f.scope!=null?this.scope=f.scope&l.Scope.LEVEL|m:this.scope=l.Scope.ATTRIBUTE,f.whitelist!=null&&(this.whitelist=f.whitelist)}return d.keys=function(h){return[].map.call(h.attributes,function(x){return x.name})},d.prototype.add=function(h,x){return this.canAdd(h,x)?(h.setAttribute(this.keyName,x),!0):!1},d.prototype.canAdd=function(h,x){var f=l.query(h,l.Scope.BLOT&(this.scope|l.Scope.TYPE));return f==null?!1:this.whitelist==null?!0:typeof x=="string"?this.whitelist.indexOf(x.replace(/["']/g,""))>-1:this.whitelist.indexOf(x)>-1},d.prototype.remove=function(h){h.removeAttribute(this.keyName)},d.prototype.value=function(h){var x=h.getAttribute(this.keyName);return this.canAdd(h,x)&&x?x:""},d})();r.default=c}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.Code=void 0;var l=(function(){function I($,T){var E=[],_=!0,M=!1,q=void 0;try{for(var G=$[Symbol.iterator](),Z;!(_=(Z=G.next()).done)&&(E.push(Z.value),!(T&&E.length===T));_=!0);}catch(W){M=!0,q=W}finally{try{!_&&G.return&&G.return()}finally{if(M)throw q}}return E}return function($,T){if(Array.isArray($))return $;if(Symbol.iterator in Object($))return I($,T);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),c=(function(){function I($,T){for(var E=0;E1)return y.map(function(w){return p(w)});var S=y[0];if(typeof S.blotName!="string"&&typeof S.attrName!="string")throw new c("Invalid definition");if(S.blotName==="abstract")throw new c("Cannot register abstract class");if(f[S.blotName||S.attrName]=S,typeof S.keyName=="string")d[S.keyName]=S;else if(S.className!=null&&(m[S.className]=S),S.tagName!=null){Array.isArray(S.tagName)?S.tagName=S.tagName.map(function(w){return w.toUpperCase()}):S.tagName=S.tagName.toUpperCase();var A=Array.isArray(S.tagName)?S.tagName:[S.tagName];A.forEach(function(w){(x[w]==null||S.className==null)&&(x[w]=S)})}return S}r.register=p}),(function(n,r,a){var l=a(51),c=a(11),d=a(3),m=a(20),x="\0",f=function(h){Array.isArray(h)?this.ops=h:h!=null&&Array.isArray(h.ops)?this.ops=h.ops:this.ops=[]};f.prototype.insert=function(h,g){var u={};return h.length===0?this:(u.insert=h,g!=null&&typeof g=="object"&&Object.keys(g).length>0&&(u.attributes=g),this.push(u))},f.prototype.delete=function(h){return h<=0?this:this.push({delete:h})},f.prototype.retain=function(h,g){if(h<=0)return this;var u={retain:h};return g!=null&&typeof g=="object"&&Object.keys(g).length>0&&(u.attributes=g),this.push(u)},f.prototype.push=function(h){var g=this.ops.length,u=this.ops[g-1];if(h=d(!0,{},h),typeof u=="object"){if(typeof h.delete=="number"&&typeof u.delete=="number")return this.ops[g-1]={delete:u.delete+h.delete},this;if(typeof u.delete=="number"&&h.insert!=null&&(g-=1,u=this.ops[g-1],typeof u!="object"))return this.ops.unshift(h),this;if(c(h.attributes,u.attributes)){if(typeof h.insert=="string"&&typeof u.insert=="string")return this.ops[g-1]={insert:u.insert+h.insert},typeof h.attributes=="object"&&(this.ops[g-1].attributes=h.attributes),this;if(typeof h.retain=="number"&&typeof u.retain=="number")return this.ops[g-1]={retain:u.retain+h.retain},typeof h.attributes=="object"&&(this.ops[g-1].attributes=h.attributes),this}}return g===this.ops.length?this.ops.push(h):this.ops.splice(g,0,h),this},f.prototype.chop=function(){var h=this.ops[this.ops.length-1];return h&&h.retain&&!h.attributes&&this.ops.pop(),this},f.prototype.filter=function(h){return this.ops.filter(h)},f.prototype.forEach=function(h){this.ops.forEach(h)},f.prototype.map=function(h){return this.ops.map(h)},f.prototype.partition=function(h){var g=[],u=[];return this.forEach(function(j){var p=h(j)?g:u;p.push(j)}),[g,u]},f.prototype.reduce=function(h,g){return this.ops.reduce(h,g)},f.prototype.changeLength=function(){return this.reduce(function(h,g){return g.insert?h+m.length(g):g.delete?h-g.delete:h},0)},f.prototype.length=function(){return this.reduce(function(h,g){return h+m.length(g)},0)},f.prototype.slice=function(h,g){h=h||0,typeof g!="number"&&(g=1/0);for(var u=[],j=m.iterator(this.ops),p=0;p0&&u.next(p.retain-y)}for(var N=new f(j);g.hasNext()||u.hasNext();)if(u.peekType()==="insert")N.push(u.next());else if(g.peekType()==="delete")N.push(g.next());else{var S=Math.min(g.peekLength(),u.peekLength()),A=g.next(S),w=u.next(S);if(typeof w.retain=="number"){var E={};typeof A.retain=="number"?E.retain=S:E.insert=A.insert;var T=m.attributes.compose(A.attributes,w.attributes,typeof A.retain=="number");if(T&&(E.attributes=T),N.push(E),!u.hasNext()&&c(N.ops[N.ops.length-1],E)){var C=new f(g.rest());return N.concat(C).chop()}}else typeof w.delete=="number"&&typeof A.retain=="number"&&N.push(w)}return N.chop()},f.prototype.concat=function(h){var g=new f(this.ops.slice());return h.ops.length>0&&(g.push(h.ops[0]),g.ops=g.ops.concat(h.ops.slice(1))),g},f.prototype.diff=function(h,g){if(this.ops===h.ops)return new f;var u=[this,h].map(function(S){return S.map(function(A){if(A.insert!=null)return typeof A.insert=="string"?A.insert:x;var w=S===h?"on":"with";throw new Error("diff() called "+w+" non-document")}).join("")}),j=new f,p=l(u[0],u[1],g),y=m.iterator(this.ops),N=m.iterator(h.ops);return p.forEach(function(S){for(var A=S[1].length;A>0;){var w=0;switch(S[0]){case l.INSERT:w=Math.min(N.peekLength(),A),j.push(N.next(w));break;case l.DELETE:w=Math.min(A,y.peekLength()),y.next(w),j.delete(w);break;case l.EQUAL:w=Math.min(y.peekLength(),N.peekLength(),A);var E=y.next(w),T=N.next(w);c(E.insert,T.insert)?j.retain(w,m.attributes.diff(E.attributes,T.attributes)):j.push(T).delete(w);break}A-=w}}),j.chop()},f.prototype.eachLine=function(h,g){g=g||` +`;for(var u=m.iterator(this.ops),j=new f,p=0;u.hasNext();){if(u.peekType()!=="insert")return;var y=u.peek(),N=m.length(y)-u.peekLength(),S=typeof y.insert=="string"?y.insert.indexOf(g,N)-N:-1;if(S<0)j.push(u.next());else if(S>0)j.push(u.next(S));else{if(h(j,u.next(1).attributes||{},p)===!1)return;p+=1,j=new f}}j.length()>0&&h(j,{},p)},f.prototype.transform=function(h,g){if(g=!!g,typeof h=="number")return this.transformPosition(h,g);for(var u=m.iterator(this.ops),j=m.iterator(h.ops),p=new f;u.hasNext()||j.hasNext();)if(u.peekType()==="insert"&&(g||j.peekType()!=="insert"))p.retain(m.length(u.next()));else if(j.peekType()==="insert")p.push(j.next());else{var y=Math.min(u.peekLength(),j.peekLength()),N=u.next(y),S=j.next(y);if(N.delete)continue;S.delete?p.push(S):p.retain(y,m.attributes.transform(N.attributes,S.attributes,g))}return p.chop()},f.prototype.transformPosition=function(h,g){g=!!g;for(var u=m.iterator(this.ops),j=0;u.hasNext()&&j<=h;){var p=u.peekLength(),y=u.peekType();if(u.next(),y==="delete"){h-=Math.min(p,h-j);continue}else y==="insert"&&(j"u"||a.call(u,y)},f=function(u,j){c&&j.name==="__proto__"?c(u,j.name,{enumerable:!0,configurable:!0,value:j.newValue,writable:!0}):u[j.name]=j.newValue},h=function(u,j){if(j==="__proto__")if(a.call(u,j)){if(d)return d(u,j).value}else return;return u[j]};n.exports=function g(){var u,j,p,y,N,S,A=arguments[0],w=1,E=arguments.length,T=!1;for(typeof A=="boolean"&&(T=A,A=arguments[1]||{},w=2),(A==null||typeof A!="object"&&typeof A!="function")&&(A={});w0&&(q1&&arguments[1]!==void 0?arguments[1]:!1;if(K&&(q===0||q>=this.length()-C)){var Z=this.clone();return q===0?(this.parent.insertBefore(Z,this),this):(this.parent.insertBefore(Z,this.next),Z)}else{var W=c(P.prototype.__proto__||Object.getPrototypeOf(P.prototype),"split",this).call(this,q,K);return this.cache={},W}}}]),P})(g.default.Block);$.blotName="block",$.tagName="P",$.defaultChild="break",$.allowedChildren=[y.default,g.default.Embed,S.default];function _(R){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return R==null||(typeof R.formats=="function"&&(P=(0,m.default)(P,R.formats())),R.parent==null||R.parent.blotName=="scroll"||R.parent.statics.scope!==R.statics.scope)?P:_(R.parent,P)}r.bubbleFormats=_,r.BlockEmbed=L,r.default=$}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.overload=r.expandConfig=void 0;var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(F){return typeof F}:function(F){return F&&typeof Symbol=="function"&&F.constructor===Symbol&&F!==Symbol.prototype?"symbol":typeof F},c=(function(){function F(B,D){var O=[],z=!0,G=!1,Y=void 0;try{for(var V=B[Symbol.iterator](),X;!(z=(X=V.next()).done)&&(O.push(X.value),!(D&&O.length===D));z=!0);}catch(ne){G=!0,Y=ne}finally{try{!z&&V.return&&V.return()}finally{if(G)throw Y}}return O}return function(B,D){if(Array.isArray(B))return B;if(Symbol.iterator in Object(B))return F(B,D);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=(function(){function F(B,D){for(var O=0;O2&&arguments[2]!==void 0?arguments[2]:!1;if(typeof D!="string"){var Y=D.attrName||D.blotName;typeof Y=="string"?this.register("formats/"+Y,D,O):Object.keys(D).forEach(function(V){z.register(V,D[V],O)})}else this.imports[D]!=null&&!G&&M.warn("Overwriting "+D+" with",O),this.imports[D]=O,(D.startsWith("blots/")||D.startsWith("formats/"))&&O.blotName!=="abstract"?N.default.register(O):D.startsWith("modules")&&typeof O.register=="function"&&O.register()}}]);function F(B){var D=this,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(P(this,F),this.options=K(B,O),this.container=this.options.container,this.container==null)return M.error("Invalid Quill container",B);this.options.debug&&F.debug(this.options.debug);var z=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new u.default,this.scroll=N.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new h.default(this.scroll),this.selection=new A.default(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.theme.init(),this.emitter.on(u.default.events.EDITOR_CHANGE,function(Y){Y===u.default.events.TEXT_CHANGE&&D.root.classList.toggle("ql-blank",D.editor.isBlank())}),this.emitter.on(u.default.events.SCROLL_UPDATE,function(Y,V){var X=D.selection.lastRange,ne=X&&X.length===0?X.index:void 0;Z.call(D,function(){return D.editor.update(null,V,ne)},Y)});var G=this.clipboard.convert(`
`+z+"


");this.setContents(G),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return d(F,[{key:"addContainer",value:function(D){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof D=="string"){var z=D;D=document.createElement("div"),D.classList.add(z)}return this.container.insertBefore(D,O),D}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(D,O,z){var G=this,Y=W(D,O,z),V=c(Y,4);return D=V[0],O=V[1],z=V[3],Z.call(this,function(){return G.editor.deleteText(D,O)},z,D,-1*O)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.scroll.enable(D),this.container.classList.toggle("ql-disabled",!D)}},{key:"focus",value:function(){var D=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=D,this.scrollIntoView()}},{key:"format",value:function(D,O){var z=this,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:u.default.sources.API;return Z.call(this,function(){var Y=z.getSelection(!0),V=new x.default;if(Y==null)return V;if(N.default.query(D,N.default.Scope.BLOCK))V=z.editor.formatLine(Y.index,Y.length,R({},D,O));else{if(Y.length===0)return z.selection.format(D,O),V;V=z.editor.formatText(Y.index,Y.length,R({},D,O))}return z.setSelection(Y,u.default.sources.SILENT),V},G)}},{key:"formatLine",value:function(D,O,z,G,Y){var V=this,X=void 0,ne=W(D,O,z,G,Y),oe=c(ne,4);return D=oe[0],O=oe[1],X=oe[2],Y=oe[3],Z.call(this,function(){return V.editor.formatLine(D,O,X)},Y,D,0)}},{key:"formatText",value:function(D,O,z,G,Y){var V=this,X=void 0,ne=W(D,O,z,G,Y),oe=c(ne,4);return D=oe[0],O=oe[1],X=oe[2],Y=oe[3],Z.call(this,function(){return V.editor.formatText(D,O,X)},Y,D,0)}},{key:"getBounds",value:function(D){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,z=void 0;typeof D=="number"?z=this.selection.getBounds(D,O):z=this.selection.getBounds(D.index,D.length);var G=this.container.getBoundingClientRect();return{bottom:z.bottom-G.top,height:z.height,left:z.left-G.left,right:z.right-G.left,top:z.top-G.top,width:z.width}}},{key:"getContents",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-D,z=W(D,O),G=c(z,2);return D=G[0],O=G[1],this.editor.getContents(D,O)}},{key:"getFormat",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.getSelection(!0),O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof D=="number"?this.editor.getFormat(D,O):this.editor.getFormat(D.index,D.length)}},{key:"getIndex",value:function(D){return D.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(D){return this.scroll.leaf(D)}},{key:"getLine",value:function(D){return this.scroll.line(D)}},{key:"getLines",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE;return typeof D!="number"?this.scroll.lines(D.index,D.length):this.scroll.lines(D,O)}},{key:"getModule",value:function(D){return this.theme.modules[D]}},{key:"getSelection",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return D&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-D,z=W(D,O),G=c(z,2);return D=G[0],O=G[1],this.editor.getText(D,O)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(D,O,z){var G=this,Y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:F.sources.API;return Z.call(this,function(){return G.editor.insertEmbed(D,O,z)},Y,D)}},{key:"insertText",value:function(D,O,z,G,Y){var V=this,X=void 0,ne=W(D,0,z,G,Y),oe=c(ne,4);return D=oe[0],X=oe[2],Y=oe[3],Z.call(this,function(){return V.editor.insertText(D,O,X)},Y,D,O.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(D,O,z){this.clipboard.dangerouslyPasteHTML(D,O,z)}},{key:"removeFormat",value:function(D,O,z){var G=this,Y=W(D,O,z),V=c(Y,4);return D=V[0],O=V[1],z=V[3],Z.call(this,function(){return G.editor.removeFormat(D,O)},z,D)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(D){var O=this,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u.default.sources.API;return Z.call(this,function(){D=new x.default(D);var G=O.getLength(),Y=O.editor.deleteText(0,G),V=O.editor.applyDelta(D),X=V.ops[V.ops.length-1];X!=null&&typeof X.insert=="string"&&X.insert[X.insert.length-1]===` +`&&(O.editor.deleteText(O.getLength()-1,1),V.delete(1));var ne=Y.compose(V);return ne},z)}},{key:"setSelection",value:function(D,O,z){if(D==null)this.selection.setRange(null,O||F.sources.API);else{var G=W(D,O,z),Y=c(G,4);D=Y[0],O=Y[1],z=Y[3],this.selection.setRange(new S.Range(D,O),z),z!==u.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(D){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u.default.sources.API,z=new x.default().insert(D);return this.setContents(z,O)}},{key:"update",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:u.default.sources.USER,O=this.scroll.update(D);return this.selection.update(D),O}},{key:"updateContents",value:function(D){var O=this,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u.default.sources.API;return Z.call(this,function(){return D=new x.default(D),O.editor.applyDelta(D,z)},z,!0)}}]),F})();q.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},q.events=u.default.events,q.sources=u.default.sources,q.version="1.3.7",q.imports={delta:x.default,parchment:N.default,"core/module":p.default,"core/theme":$.default};function K(F,B){if(B=(0,E.default)(!0,{container:F,modules:{clipboard:!0,keyboard:!0,history:!0}},B),!B.theme||B.theme===q.DEFAULTS.theme)B.theme=$.default;else if(B.theme=q.import("themes/"+B.theme),B.theme==null)throw new Error("Invalid theme "+B.theme+". Did you register it?");var D=(0,E.default)(!0,{},B.theme.DEFAULTS);[D,B].forEach(function(G){G.modules=G.modules||{},Object.keys(G.modules).forEach(function(Y){G.modules[Y]===!0&&(G.modules[Y]={})})});var O=Object.keys(D.modules).concat(Object.keys(B.modules)),z=O.reduce(function(G,Y){var V=q.import("modules/"+Y);return V==null?M.error("Cannot load "+Y+" module. Are you sure you registered it?"):G[Y]=V.DEFAULTS||{},G},{});return B.modules!=null&&B.modules.toolbar&&B.modules.toolbar.constructor!==Object&&(B.modules.toolbar={container:B.modules.toolbar}),B=(0,E.default)(!0,{},q.DEFAULTS,{modules:z},D,B),["bounds","container","scrollingContainer"].forEach(function(G){typeof B[G]=="string"&&(B[G]=document.querySelector(B[G]))}),B.modules=Object.keys(B.modules).reduce(function(G,Y){return B.modules[Y]&&(G[Y]=B.modules[Y]),G},{}),B}function Z(F,B,D,O){if(this.options.strict&&!this.isEnabled()&&B===u.default.sources.USER)return new x.default;var z=D==null?null:this.getSelection(),G=this.editor.delta,Y=F();if(z!=null&&(D===!0&&(D=z.index),O==null?z=U(z,Y,B):O!==0&&(z=U(z,D,O,B)),this.setSelection(z,u.default.sources.SILENT)),Y.length()>0){var V,X=[u.default.events.TEXT_CHANGE,Y,G,B];if((V=this.emitter).emit.apply(V,[u.default.events.EDITOR_CHANGE].concat(X)),B!==u.default.sources.SILENT){var ne;(ne=this.emitter).emit.apply(ne,X)}}return Y}function W(F,B,D,O,z){var G={};return typeof F.index=="number"&&typeof F.length=="number"?typeof B!="number"?(z=O,O=D,D=B,B=F.length,F=F.index):(B=F.length,F=F.index):typeof B!="number"&&(z=O,O=D,D=B,B=0),(typeof D>"u"?"undefined":l(D))==="object"?(G=D,z=O):typeof D=="string"&&(O!=null?G[D]=O:z=D),z=z||u.default.sources.API,[F,B,G,z]}function U(F,B,D,O){if(F==null)return null;var z=void 0,G=void 0;if(B instanceof x.default){var Y=[F.index,F.index+F.length].map(function(oe){return B.transformPosition(oe,O!==u.default.sources.USER)}),V=c(Y,2);z=V[0],G=V[1]}else{var X=[F.index,F.index+F.length].map(function(oe){return oe=0?oe+D:Math.max(B,oe+D)}),ne=c(X,2);z=ne[0],G=ne[1]}return new S.Range(z,G-z)}r.expandConfig=K,r.overload=W,r.default=q}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function y(N,S){for(var A=0;A0){var w=this.parent.isolate(this.offset(),this.length());this.moveChildren(w),w.wrap(this)}}}],[{key:"compare",value:function(A,w){var E=N.order.indexOf(A),T=N.order.indexOf(w);return E>=0||T>=0?E-T:A===w?0:A1?T-1:0),L=1;L1&&arguments[1]!==void 0?arguments[1]:{};l(this,d),this.quill=m,this.options=x};c.DEFAULTS={},r.default=c}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=["error","warn","log","info"],c="warn";function d(x){if(l.indexOf(x)<=l.indexOf(c)){for(var f,h=arguments.length,g=Array(h>1?h-1:0),u=1;u0&&typeof g[0]!="number")}function h(g,u,j){var p,y;if(x(g)||x(u)||g.prototype!==u.prototype)return!1;if(d(g))return d(u)?(g=l.call(g),u=l.call(u),m(g,u,j)):!1;if(f(g)){if(!f(u)||g.length!==u.length)return!1;for(p=0;p=0;p--)if(N[p]!=S[p])return!1;for(p=N.length-1;p>=0;p--)if(y=N[p],!m(g[y],u[y],j))return!1;return typeof g==typeof u}}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=a(1),c=(function(){function d(m,x,f){f===void 0&&(f={}),this.attrName=m,this.keyName=x;var h=l.Scope.TYPE&l.Scope.ATTRIBUTE;f.scope!=null?this.scope=f.scope&l.Scope.LEVEL|h:this.scope=l.Scope.ATTRIBUTE,f.whitelist!=null&&(this.whitelist=f.whitelist)}return d.keys=function(m){return[].map.call(m.attributes,function(x){return x.name})},d.prototype.add=function(m,x){return this.canAdd(m,x)?(m.setAttribute(this.keyName,x),!0):!1},d.prototype.canAdd=function(m,x){var f=l.query(m,l.Scope.BLOT&(this.scope|l.Scope.TYPE));return f==null?!1:this.whitelist==null?!0:typeof x=="string"?this.whitelist.indexOf(x.replace(/["']/g,""))>-1:this.whitelist.indexOf(x)>-1},d.prototype.remove=function(m){m.removeAttribute(this.keyName)},d.prototype.value=function(m){var x=m.getAttribute(this.keyName);return this.canAdd(m,x)&&x?x:""},d})();r.default=c}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.Code=void 0;var l=(function(){function L($,_){var R=[],P=!0,M=!1,q=void 0;try{for(var K=$[Symbol.iterator](),Z;!(P=(Z=K.next()).done)&&(R.push(Z.value),!(_&&R.length===_));P=!0);}catch(W){M=!0,q=W}finally{try{!P&&K.return&&K.return()}finally{if(M)throw q}}return R}return function($,_){if(Array.isArray($))return $;if(Symbol.iterator in Object($))return L($,_);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),c=(function(){function L($,_){for(var R=0;R<_.length;R++){var P=_[R];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty($,P.key,P)}}return function($,_,R){return _&&L($.prototype,_),R&&L($,R),$}})(),d=function L($,_,R){$===null&&($=Function.prototype);var P=Object.getOwnPropertyDescriptor($,_);if(P===void 0){var M=Object.getPrototypeOf($);return M===null?void 0:L(M,_,R)}else{if("value"in P)return P.value;var q=P.get;return q===void 0?void 0:q.call(R)}},m=a(2),x=S(m),f=a(0),h=S(f),g=a(4),u=S(g),j=a(6),p=S(j),y=a(7),N=S(y);function S(L){return L&&L.__esModule?L:{default:L}}function A(L,$){if(!(L instanceof $))throw new TypeError("Cannot call a class as a function")}function w(L,$){if(!L)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return $&&(typeof $=="object"||typeof $=="function")?$:L}function E(L,$){if(typeof $!="function"&&$!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof $);L.prototype=Object.create($&&$.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),$&&(Object.setPrototypeOf?Object.setPrototypeOf(L,$):L.__proto__=$)}var T=(function(L){E($,L);function $(){return A(this,$),w(this,($.__proto__||Object.getPrototypeOf($)).apply(this,arguments))}return $})(p.default);T.blotName="code",T.tagName="CODE";var C=(function(L){E($,L);function $(){return A(this,$),w(this,($.__proto__||Object.getPrototypeOf($)).apply(this,arguments))}return c($,[{key:"delta",value:function(){var R=this,P=this.domNode.textContent;return P.endsWith(` +`)&&(P=P.slice(0,-1)),P.split(` `).reduce(function(M,q){return M.insert(q).insert(` -`,E.formats())},new x.default)}},{key:"format",value:function(E,_){if(!(E===this.statics.blotName&&_)){var M=this.descendant(N.default,this.length()-1),q=l(M,1),G=q[0];G!=null&&G.deleteAt(G.length()-1,1),d($.prototype.__proto__||Object.getPrototypeOf($.prototype),"format",this).call(this,E,_)}}},{key:"formatAt",value:function(E,_,M,q){if(_!==0&&!(m.default.query(M,m.default.Scope.BLOCK)==null||M===this.statics.blotName&&q===this.statics.formats(this.domNode))){var G=this.newlineIndex(E);if(!(G<0||G>=E+_)){var Z=this.newlineIndex(E,!0)+1,W=G-Z+1,z=this.isolate(Z,W),F=z.next;z.format(M,q),F instanceof $&&F.formatAt(0,E-Z+_-W,M,q)}}}},{key:"insertAt",value:function(E,_,M){if(M==null){var q=this.descendant(N.default,E),G=l(q,2),Z=G[0],W=G[1];Z.insertAt(W,_)}}},{key:"length",value:function(){var E=this.domNode.textContent.length;return this.domNode.textContent.endsWith(` -`)?E:E+1}},{key:"newlineIndex",value:function(E){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(_)return this.domNode.textContent.slice(0,E).lastIndexOf(` -`);var M=this.domNode.textContent.slice(E).indexOf(` -`);return M>-1?E+M:-1}},{key:"optimize",value:function(E){this.domNode.textContent.endsWith(` -`)||this.appendChild(m.default.create("text",` -`)),d($.prototype.__proto__||Object.getPrototypeOf($.prototype),"optimize",this).call(this,E);var _=this.next;_!=null&&_.prev===this&&_.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===_.statics.formats(_.domNode)&&(_.optimize(E),_.moveChildren(this),_.remove())}},{key:"replace",value:function(E){d($.prototype.__proto__||Object.getPrototypeOf($.prototype),"replace",this).call(this,E),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(_){var M=m.default.find(_);M==null?_.parentNode.removeChild(_):M instanceof m.default.Embed?M.remove():M.unwrap()})}}],[{key:"create",value:function(E){var _=d($.__proto__||Object.getPrototypeOf($),"create",this).call(this,E);return _.setAttribute("spellcheck",!1),_}},{key:"formats",value:function(){return!0}}]),$})(u.default);A.blotName="code-block",A.tagName="PRE",A.TAB=" ",r.Code=P,r.default=A}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(F){return typeof F}:function(F){return F&&typeof Symbol=="function"&&F.constructor===Symbol&&F!==Symbol.prototype?"symbol":typeof F},c=(function(){function F(B,D){var O=[],V=!0,K=!1,Y=void 0;try{for(var U=B[Symbol.iterator](),X;!(V=(X=U.next()).done)&&(O.push(X.value),!(D&&O.length===D));V=!0);}catch(ne){K=!0,Y=ne}finally{try{!V&&U.return&&U.return()}finally{if(K)throw Y}}return O}return function(B,D){if(Array.isArray(B))return B;if(Symbol.iterator in Object(B))return F(B,D);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=(function(){function F(B,D){for(var O=0;O=K&&!oe.endsWith(` -`)&&(V=!0),O.scroll.insertAt(Y,oe);var re=O.scroll.line(Y),ge=c(re,2),ve=ge[0],Se=ge[1],We=(0,E.default)({},(0,S.bubbleFormats)(ve));if(ve instanceof C.default){var Ce=ve.descendant(u.default.Leaf,Se),fe=c(Ce,1),Ye=fe[0];We=(0,E.default)(We,(0,S.bubbleFormats)(Ye))}ne=m.default.attributes.diff(We,ne)||{}}else if(l(U.insert)==="object"){var be=Object.keys(U.insert)[0];if(be==null)return Y;O.scroll.insertAt(Y,be,U.insert[be])}K+=X}return Object.keys(ne).forEach(function(_e){O.scroll.formatAt(Y,X,_e,ne[_e])}),Y+X},0),D.reduce(function(Y,U){return typeof U.delete=="number"?(O.scroll.deleteAt(Y,U.delete),Y):Y+(U.retain||U.insert.length||1)},0),this.scroll.batchEnd(),this.update(D)}},{key:"deleteText",value:function(D,O){return this.scroll.deleteAt(D,O),this.update(new x.default().retain(D).delete(O))}},{key:"formatLine",value:function(D,O){var V=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.scroll.update(),Object.keys(K).forEach(function(Y){if(!(V.scroll.whitelist!=null&&!V.scroll.whitelist[Y])){var U=V.scroll.lines(D,Math.max(O,1)),X=O;U.forEach(function(ne){var oe=ne.length();if(!(ne instanceof g.default))ne.format(Y,K[Y]);else{var re=D-ne.offset(V.scroll),ge=ne.newlineIndex(re+X)-re+1;ne.formatAt(re,ge,Y,K[Y])}X-=oe})}}),this.scroll.optimize(),this.update(new x.default().retain(D).retain(O,(0,A.default)(K)))}},{key:"formatText",value:function(D,O){var V=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Object.keys(K).forEach(function(Y){V.scroll.formatAt(D,O,Y,K[Y])}),this.update(new x.default().retain(D).retain(O,(0,A.default)(K)))}},{key:"getContents",value:function(D,O){return this.delta.slice(D,D+O)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(D,O){return D.concat(O.delta())},new x.default)}},{key:"getFormat",value:function(D){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,V=[],K=[];O===0?this.scroll.path(D).forEach(function(U){var X=c(U,1),ne=X[0];ne instanceof C.default?V.push(ne):ne instanceof u.default.Leaf&&K.push(ne)}):(V=this.scroll.lines(D,O),K=this.scroll.descendants(u.default.Leaf,D,O));var Y=[V,K].map(function(U){if(U.length===0)return{};for(var X=(0,S.bubbleFormats)(U.shift());Object.keys(X).length>0;){var ne=U.shift();if(ne==null)return X;X=W((0,S.bubbleFormats)(ne),X)}return X});return E.default.apply(E.default,Y)}},{key:"getText",value:function(D,O){return this.getContents(D,O).filter(function(V){return typeof V.insert=="string"}).map(function(V){return V.insert}).join("")}},{key:"insertEmbed",value:function(D,O,V){return this.scroll.insertAt(D,O,V),this.update(new x.default().retain(D).insert(M({},O,V)))}},{key:"insertText",value:function(D,O){var V=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return O=O.replace(/\r\n/g,` +`,R.formats())},new x.default)}},{key:"format",value:function(R,P){if(!(R===this.statics.blotName&&P)){var M=this.descendant(N.default,this.length()-1),q=l(M,1),K=q[0];K!=null&&K.deleteAt(K.length()-1,1),d($.prototype.__proto__||Object.getPrototypeOf($.prototype),"format",this).call(this,R,P)}}},{key:"formatAt",value:function(R,P,M,q){if(P!==0&&!(h.default.query(M,h.default.Scope.BLOCK)==null||M===this.statics.blotName&&q===this.statics.formats(this.domNode))){var K=this.newlineIndex(R);if(!(K<0||K>=R+P)){var Z=this.newlineIndex(R,!0)+1,W=K-Z+1,U=this.isolate(Z,W),F=U.next;U.format(M,q),F instanceof $&&F.formatAt(0,R-Z+P-W,M,q)}}}},{key:"insertAt",value:function(R,P,M){if(M==null){var q=this.descendant(N.default,R),K=l(q,2),Z=K[0],W=K[1];Z.insertAt(W,P)}}},{key:"length",value:function(){var R=this.domNode.textContent.length;return this.domNode.textContent.endsWith(` +`)?R:R+1}},{key:"newlineIndex",value:function(R){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(P)return this.domNode.textContent.slice(0,R).lastIndexOf(` +`);var M=this.domNode.textContent.slice(R).indexOf(` +`);return M>-1?R+M:-1}},{key:"optimize",value:function(R){this.domNode.textContent.endsWith(` +`)||this.appendChild(h.default.create("text",` +`)),d($.prototype.__proto__||Object.getPrototypeOf($.prototype),"optimize",this).call(this,R);var P=this.next;P!=null&&P.prev===this&&P.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===P.statics.formats(P.domNode)&&(P.optimize(R),P.moveChildren(this),P.remove())}},{key:"replace",value:function(R){d($.prototype.__proto__||Object.getPrototypeOf($.prototype),"replace",this).call(this,R),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(P){var M=h.default.find(P);M==null?P.parentNode.removeChild(P):M instanceof h.default.Embed?M.remove():M.unwrap()})}}],[{key:"create",value:function(R){var P=d($.__proto__||Object.getPrototypeOf($),"create",this).call(this,R);return P.setAttribute("spellcheck",!1),P}},{key:"formats",value:function(){return!0}}]),$})(u.default);C.blotName="code-block",C.tagName="PRE",C.TAB=" ",r.Code=T,r.default=C}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(F){return typeof F}:function(F){return F&&typeof Symbol=="function"&&F.constructor===Symbol&&F!==Symbol.prototype?"symbol":typeof F},c=(function(){function F(B,D){var O=[],z=!0,G=!1,Y=void 0;try{for(var V=B[Symbol.iterator](),X;!(z=(X=V.next()).done)&&(O.push(X.value),!(D&&O.length===D));z=!0);}catch(ne){G=!0,Y=ne}finally{try{!z&&V.return&&V.return()}finally{if(G)throw Y}}return O}return function(B,D){if(Array.isArray(B))return B;if(Symbol.iterator in Object(B))return F(B,D);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=(function(){function F(B,D){for(var O=0;O=G&&!oe.endsWith(` +`)&&(z=!0),O.scroll.insertAt(Y,oe);var re=O.scroll.line(Y),ge=c(re,2),ve=ge[0],Se=ge[1],We=(0,R.default)({},(0,S.bubbleFormats)(ve));if(ve instanceof A.default){var Ce=ve.descendant(u.default.Leaf,Se),fe=c(Ce,1),Ye=fe[0];We=(0,R.default)(We,(0,S.bubbleFormats)(Ye))}ne=h.default.attributes.diff(We,ne)||{}}else if(l(V.insert)==="object"){var be=Object.keys(V.insert)[0];if(be==null)return Y;O.scroll.insertAt(Y,be,V.insert[be])}G+=X}return Object.keys(ne).forEach(function(Pe){O.scroll.formatAt(Y,X,Pe,ne[Pe])}),Y+X},0),D.reduce(function(Y,V){return typeof V.delete=="number"?(O.scroll.deleteAt(Y,V.delete),Y):Y+(V.retain||V.insert.length||1)},0),this.scroll.batchEnd(),this.update(D)}},{key:"deleteText",value:function(D,O){return this.scroll.deleteAt(D,O),this.update(new x.default().retain(D).delete(O))}},{key:"formatLine",value:function(D,O){var z=this,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.scroll.update(),Object.keys(G).forEach(function(Y){if(!(z.scroll.whitelist!=null&&!z.scroll.whitelist[Y])){var V=z.scroll.lines(D,Math.max(O,1)),X=O;V.forEach(function(ne){var oe=ne.length();if(!(ne instanceof p.default))ne.format(Y,G[Y]);else{var re=D-ne.offset(z.scroll),ge=ne.newlineIndex(re+X)-re+1;ne.formatAt(re,ge,Y,G[Y])}X-=oe})}}),this.scroll.optimize(),this.update(new x.default().retain(D).retain(O,(0,C.default)(G)))}},{key:"formatText",value:function(D,O){var z=this,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Object.keys(G).forEach(function(Y){z.scroll.formatAt(D,O,Y,G[Y])}),this.update(new x.default().retain(D).retain(O,(0,C.default)(G)))}},{key:"getContents",value:function(D,O){return this.delta.slice(D,D+O)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(D,O){return D.concat(O.delta())},new x.default)}},{key:"getFormat",value:function(D){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,z=[],G=[];O===0?this.scroll.path(D).forEach(function(V){var X=c(V,1),ne=X[0];ne instanceof A.default?z.push(ne):ne instanceof u.default.Leaf&&G.push(ne)}):(z=this.scroll.lines(D,O),G=this.scroll.descendants(u.default.Leaf,D,O));var Y=[z,G].map(function(V){if(V.length===0)return{};for(var X=(0,S.bubbleFormats)(V.shift());Object.keys(X).length>0;){var ne=V.shift();if(ne==null)return X;X=W((0,S.bubbleFormats)(ne),X)}return X});return R.default.apply(R.default,Y)}},{key:"getText",value:function(D,O){return this.getContents(D,O).filter(function(z){return typeof z.insert=="string"}).map(function(z){return z.insert}).join("")}},{key:"insertEmbed",value:function(D,O,z){return this.scroll.insertAt(D,O,z),this.update(new x.default().retain(D).insert(M({},O,z)))}},{key:"insertText",value:function(D,O){var z=this,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return O=O.replace(/\r\n/g,` `).replace(/\r/g,` -`),this.scroll.insertAt(D,O),Object.keys(K).forEach(function(Y){V.scroll.formatAt(D,O.length,Y,K[Y])}),this.update(new x.default().retain(D).insert(O,(0,A.default)(K)))}},{key:"isBlank",value:function(){if(this.scroll.children.length==0)return!0;if(this.scroll.children.length>1)return!1;var D=this.scroll.children.head;return D.statics.blotName!==C.default.blotName||D.children.length>1?!1:D.children.head instanceof R.default}},{key:"removeFormat",value:function(D,O){var V=this.getText(D,O),K=this.scroll.line(D+O),Y=c(K,2),U=Y[0],X=Y[1],ne=0,oe=new x.default;U!=null&&(U instanceof g.default?ne=U.newlineIndex(X)-X+1:ne=U.length()-X,oe=U.delta().slice(X,X+ne-1).insert(` -`));var re=this.getContents(D,O+ne),ge=re.diff(new x.default().insert(V).concat(oe)),ve=new x.default().retain(D).concat(ge);return this.applyDelta(ve)}},{key:"update",value:function(D){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],V=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,K=this.delta;if(O.length===1&&O[0].type==="characterData"&&O[0].target.data.match(G)&&u.default.find(O[0].target)){var Y=u.default.find(O[0].target),U=(0,S.bubbleFormats)(Y),X=Y.offset(this.scroll),ne=O[0].oldValue.replace(N.default.CONTENTS,""),oe=new x.default().insert(ne),re=new x.default().insert(Y.value()),ge=new x.default().retain(X).concat(oe.diff(re,V));D=ge.reduce(function(ve,Se){return Se.insert?ve.insert(Se.insert,U):ve.push(Se)},new x.default),this.delta=K.compose(D)}else this.delta=this.getDelta(),(!D||!(0,$.default)(K.compose(D),this.delta))&&(D=K.diff(this.delta,V));return D}}]),F})();function W(F,B){return Object.keys(B).reduce(function(D,O){return F[O]==null||(B[O]===F[O]?D[O]=B[O]:Array.isArray(B[O])?B[O].indexOf(F[O])<0&&(D[O]=B[O].concat([F[O]])):D[O]=[B[O],F[O]]),D},{})}function z(F){return F.reduce(function(B,D){if(D.insert===1){var O=(0,A.default)(D.attributes);return delete O.image,B.insert({image:D.attributes.image},O)}if(D.attributes!=null&&(D.attributes.list===!0||D.attributes.bullet===!0)&&(D=(0,A.default)(D),D.attributes.list?D.attributes.list="ordered":(D.attributes.list="bullet",delete D.attributes.bullet)),typeof D.insert=="string"){var V=D.insert.replace(/\r\n/g,` +`),this.scroll.insertAt(D,O),Object.keys(G).forEach(function(Y){z.scroll.formatAt(D,O.length,Y,G[Y])}),this.update(new x.default().retain(D).insert(O,(0,C.default)(G)))}},{key:"isBlank",value:function(){if(this.scroll.children.length==0)return!0;if(this.scroll.children.length>1)return!1;var D=this.scroll.children.head;return D.statics.blotName!==A.default.blotName||D.children.length>1?!1:D.children.head instanceof E.default}},{key:"removeFormat",value:function(D,O){var z=this.getText(D,O),G=this.scroll.line(D+O),Y=c(G,2),V=Y[0],X=Y[1],ne=0,oe=new x.default;V!=null&&(V instanceof p.default?ne=V.newlineIndex(X)-X+1:ne=V.length()-X,oe=V.delta().slice(X,X+ne-1).insert(` +`));var re=this.getContents(D,O+ne),ge=re.diff(new x.default().insert(z).concat(oe)),ve=new x.default().retain(D).concat(ge);return this.applyDelta(ve)}},{key:"update",value:function(D){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,G=this.delta;if(O.length===1&&O[0].type==="characterData"&&O[0].target.data.match(K)&&u.default.find(O[0].target)){var Y=u.default.find(O[0].target),V=(0,S.bubbleFormats)(Y),X=Y.offset(this.scroll),ne=O[0].oldValue.replace(N.default.CONTENTS,""),oe=new x.default().insert(ne),re=new x.default().insert(Y.value()),ge=new x.default().retain(X).concat(oe.diff(re,z));D=ge.reduce(function(ve,Se){return Se.insert?ve.insert(Se.insert,V):ve.push(Se)},new x.default),this.delta=G.compose(D)}else this.delta=this.getDelta(),(!D||!(0,$.default)(G.compose(D),this.delta))&&(D=G.diff(this.delta,z));return D}}]),F})();function W(F,B){return Object.keys(B).reduce(function(D,O){return F[O]==null||(B[O]===F[O]?D[O]=B[O]:Array.isArray(B[O])?B[O].indexOf(F[O])<0&&(D[O]=B[O].concat([F[O]])):D[O]=[B[O],F[O]]),D},{})}function U(F){return F.reduce(function(B,D){if(D.insert===1){var O=(0,C.default)(D.attributes);return delete O.image,B.insert({image:D.attributes.image},O)}if(D.attributes!=null&&(D.attributes.list===!0||D.attributes.bullet===!0)&&(D=(0,C.default)(D),D.attributes.list?D.attributes.list="ordered":(D.attributes.list="bullet",delete D.attributes.bullet)),typeof D.insert=="string"){var z=D.insert.replace(/\r\n/g,` `).replace(/\r/g,` -`);return B.insert(V,D.attributes)}return B.push(D)},new x.default)}r.default=Z}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.Range=void 0;var l=(function(){function I($,T){var E=[],_=!0,M=!1,q=void 0;try{for(var G=$[Symbol.iterator](),Z;!(_=(Z=G.next()).done)&&(E.push(Z.value),!(T&&E.length===T));_=!0);}catch(W){M=!0,q=W}finally{try{!_&&G.return&&G.return()}finally{if(M)throw q}}return E}return function($,T){if(Array.isArray($))return $;if(Symbol.iterator in Object($))return I($,T);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),c=(function(){function I($,T){for(var E=0;E1&&arguments[1]!==void 0?arguments[1]:0;C(this,I),this.index=$,this.length=T},P=(function(){function I($,T){var E=this;C(this,I),this.emitter=T,this.scroll=$,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=h.default.create("cursor",this),this.lastRange=this.savedRange=new R(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,function(){E.mouseDown||setTimeout(E.update.bind(E,j.default.sources.USER),1)}),this.emitter.on(j.default.events.EDITOR_CHANGE,function(_,M){_===j.default.events.TEXT_CHANGE&&M.length()>0&&E.update(j.default.sources.SILENT)}),this.emitter.on(j.default.events.SCROLL_BEFORE_UPDATE,function(){if(E.hasFocus()){var _=E.getNativeRange();_!=null&&_.start.node!==E.cursor.textNode&&E.emitter.once(j.default.events.SCROLL_UPDATE,function(){try{E.setNativeRange(_.start.node,_.start.offset,_.end.node,_.end.offset)}catch{}})}}),this.emitter.on(j.default.events.SCROLL_OPTIMIZE,function(_,M){if(M.range){var q=M.range,G=q.startNode,Z=q.startOffset,W=q.endNode,z=q.endOffset;E.setNativeRange(G,Z,W,z)}}),this.update(j.default.sources.SILENT)}return c(I,[{key:"handleComposition",value:function(){var T=this;this.root.addEventListener("compositionstart",function(){T.composing=!0}),this.root.addEventListener("compositionend",function(){if(T.composing=!1,T.cursor.parent){var E=T.cursor.restore();if(!E)return;setTimeout(function(){T.setNativeRange(E.startNode,E.startOffset,E.endNode,E.endOffset)},1)}})}},{key:"handleDragging",value:function(){var T=this;this.emitter.listenDOM("mousedown",document.body,function(){T.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){T.mouseDown=!1,T.update(j.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(T,E){if(!(this.scroll.whitelist!=null&&!this.scroll.whitelist[T])){this.scroll.update();var _=this.getNativeRange();if(!(_==null||!_.native.collapsed||h.default.query(T,h.default.Scope.BLOCK))){if(_.start.node!==this.cursor.textNode){var M=h.default.find(_.start.node,!1);if(M==null)return;if(M instanceof h.default.Leaf){var q=M.split(_.start.offset);M.parent.insertBefore(this.cursor,q)}else M.insertBefore(this.cursor,_.start.node);this.cursor.attach()}this.cursor.format(T,E),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(T){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,_=this.scroll.length();T=Math.min(T,_-1),E=Math.min(T+E,_-1)-T;var M=void 0,q=this.scroll.leaf(T),G=l(q,2),Z=G[0],W=G[1];if(Z==null)return null;var z=Z.position(W,!0),F=l(z,2);M=F[0],W=F[1];var B=document.createRange();if(E>0){B.setStart(M,W);var D=this.scroll.leaf(T+E),O=l(D,2);if(Z=O[0],W=O[1],Z==null)return null;var V=Z.position(W,!0),K=l(V,2);return M=K[0],W=K[1],B.setEnd(M,W),B.getBoundingClientRect()}else{var Y="left",U=void 0;return M instanceof Text?(W0&&(Y="right")),{bottom:U.top+U.height,height:U.height,left:U[Y],right:U[Y],top:U.top,width:0}}}},{key:"getNativeRange",value:function(){var T=document.getSelection();if(T==null||T.rangeCount<=0)return null;var E=T.getRangeAt(0);if(E==null)return null;var _=this.normalizeNative(E);return w.info("getNativeRange",_),_}},{key:"getRange",value:function(){var T=this.getNativeRange();if(T==null)return[null,null];var E=this.normalizedToRange(T);return[E,T]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(T){var E=this,_=[[T.start.node,T.start.offset]];T.native.collapsed||_.push([T.end.node,T.end.offset]);var M=_.map(function(Z){var W=l(Z,2),z=W[0],F=W[1],B=h.default.find(z,!0),D=B.offset(E.scroll);return F===0?D:B instanceof h.default.Container?D+B.length():D+B.index(z,F)}),q=Math.min(Math.max.apply(Math,S(M)),this.scroll.length()-1),G=Math.min.apply(Math,[q].concat(S(M)));return new R(G,q-G)}},{key:"normalizeNative",value:function(T){if(!A(this.root,T.startContainer)||!T.collapsed&&!A(this.root,T.endContainer))return null;var E={start:{node:T.startContainer,offset:T.startOffset},end:{node:T.endContainer,offset:T.endOffset},native:T};return[E.start,E.end].forEach(function(_){for(var M=_.node,q=_.offset;!(M instanceof Text)&&M.childNodes.length>0;)if(M.childNodes.length>q)M=M.childNodes[q],q=0;else if(M.childNodes.length===q)M=M.lastChild,q=M instanceof Text?M.data.length:M.childNodes.length+1;else break;_.node=M,_.offset=q}),E}},{key:"rangeToNative",value:function(T){var E=this,_=T.collapsed?[T.index]:[T.index,T.index+T.length],M=[],q=this.scroll.length();return _.forEach(function(G,Z){G=Math.min(q-1,G);var W=void 0,z=E.scroll.leaf(G),F=l(z,2),B=F[0],D=F[1],O=B.position(D,Z!==0),V=l(O,2);W=V[0],D=V[1],M.push(W,D)}),M.length<2&&(M=M.concat(M)),M}},{key:"scrollIntoView",value:function(T){var E=this.lastRange;if(E!=null){var _=this.getBounds(E.index,E.length);if(_!=null){var M=this.scroll.length()-1,q=this.scroll.line(Math.min(E.index,M)),G=l(q,1),Z=G[0],W=Z;if(E.length>0){var z=this.scroll.line(Math.min(E.index+E.length,M)),F=l(z,1);W=F[0]}if(!(Z==null||W==null)){var B=T.getBoundingClientRect();_.topB.bottom&&(T.scrollTop+=_.bottom-B.bottom)}}}}},{key:"setNativeRange",value:function(T,E){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:T,M=arguments.length>3&&arguments[3]!==void 0?arguments[3]:E,q=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(w.info("setNativeRange",T,E,_,M),!(T!=null&&(this.root.parentNode==null||T.parentNode==null||_.parentNode==null))){var G=document.getSelection();if(G!=null)if(T!=null){this.hasFocus()||this.root.focus();var Z=(this.getNativeRange()||{}).native;if(Z==null||q||T!==Z.startContainer||E!==Z.startOffset||_!==Z.endContainer||M!==Z.endOffset){T.tagName=="BR"&&(E=[].indexOf.call(T.parentNode.childNodes,T),T=T.parentNode),_.tagName=="BR"&&(M=[].indexOf.call(_.parentNode.childNodes,_),_=_.parentNode);var W=document.createRange();W.setStart(T,E),W.setEnd(_,M),G.removeAllRanges(),G.addRange(W)}}else G.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(T){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:j.default.sources.API;if(typeof E=="string"&&(_=E,E=!1),w.info("setRange",T),T!=null){var M=this.rangeToNative(T);this.setNativeRange.apply(this,S(M).concat([E]))}else this.setNativeRange(null);this.update(_)}},{key:"update",value:function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j.default.sources.USER,E=this.lastRange,_=this.getRange(),M=l(_,2),q=M[0],G=M[1];if(this.lastRange=q,this.lastRange!=null&&(this.savedRange=this.lastRange),!(0,p.default)(E,this.lastRange)){var Z;!this.composing&&G!=null&&G.native.collapsed&&G.start.node!==this.cursor.textNode&&this.cursor.restore();var W=[j.default.events.SELECTION_CHANGE,(0,f.default)(this.lastRange),(0,f.default)(E),T];if((Z=this.emitter).emit.apply(Z,[j.default.events.EDITOR_CHANGE].concat(W)),T!==j.default.sources.SILENT){var z;(z=this.emitter).emit.apply(z,W)}}}}]),I})();function A(I,$){try{$.parentNode}catch{return!1}return $ instanceof Text&&($=$.parentNode),I.contains($)}r.Range=R,r.default=P}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function j(g,y){for(var N=0;N0&&(u+=1),[this.parent.domNode,u]},f.prototype.value=function(){var m;return m={},m[this.statics.blotName]=this.statics.value(this.domNode)||!0,m},f.scope=d.Scope.INLINE_BLOT,f})(c.default);r.default=h}),(function(n,r,a){var l=a(11),c=a(3),d={attributes:{compose:function(x,f,m){typeof x!="object"&&(x={}),typeof f!="object"&&(f={});var p=c(!0,{},f);m||(p=Object.keys(p).reduce(function(j,g){return p[g]!=null&&(j[g]=p[g]),j},{}));for(var u in x)x[u]!==void 0&&f[u]===void 0&&(p[u]=x[u]);return Object.keys(p).length>0?p:void 0},diff:function(x,f){typeof x!="object"&&(x={}),typeof f!="object"&&(f={});var m=Object.keys(x).concat(Object.keys(f)).reduce(function(p,u){return l(x[u],f[u])||(p[u]=f[u]===void 0?null:f[u]),p},{});return Object.keys(m).length>0?m:void 0},transform:function(x,f,m){if(typeof x!="object")return f;if(typeof f=="object"){if(!m)return f;var p=Object.keys(f).reduce(function(u,j){return x[j]===void 0&&(u[j]=f[j]),u},{});return Object.keys(p).length>0?p:void 0}}},iterator:function(x){return new h(x)},length:function(x){return typeof x.delete=="number"?x.delete:typeof x.retain=="number"?x.retain:typeof x.insert=="string"?x.insert.length:1}};function h(x){this.ops=x,this.index=0,this.offset=0}h.prototype.hasNext=function(){return this.peekLength()<1/0},h.prototype.next=function(x){x||(x=1/0);var f=this.ops[this.index];if(f){var m=this.offset,p=d.length(f);if(x>=p-m?(x=p-m,this.index+=1,this.offset=0):this.offset+=x,typeof f.delete=="number")return{delete:x};var u={};return f.attributes&&(u.attributes=f.attributes),typeof f.retain=="number"?u.retain=x:typeof f.insert=="string"?u.insert=f.insert.substr(m,x):u.insert=f.insert,u}else return{retain:1/0}},h.prototype.peek=function(){return this.ops[this.index]},h.prototype.peekLength=function(){return this.ops[this.index]?d.length(this.ops[this.index])-this.offset:1/0},h.prototype.peekType=function(){return this.ops[this.index]?typeof this.ops[this.index].delete=="number"?"delete":typeof this.ops[this.index].retain=="number"?"retain":"insert":"retain"},h.prototype.rest=function(){if(this.hasNext()){if(this.offset===0)return this.ops.slice(this.index);var x=this.offset,f=this.index,m=this.next(),p=this.ops.slice(this.index);return this.offset=x,this.index=f,[m].concat(p)}else return[]},n.exports=d}),(function(n,r){var a=(function(){function l(g,y){return y!=null&&g instanceof y}var c;try{c=Map}catch{c=function(){}}var d;try{d=Set}catch{d=function(){}}var h;try{h=Promise}catch{h=function(){}}function x(g,y,N,S,C){typeof y=="object"&&(N=y.depth,S=y.prototype,C=y.includeNonEnumerable,y=y.circular);var w=[],R=[],P=typeof Buffer<"u";typeof y>"u"&&(y=!0),typeof N>"u"&&(N=1/0);function A(I,$){if(I===null)return null;if($===0)return I;var T,E;if(typeof I!="object")return I;if(l(I,c))T=new c;else if(l(I,d))T=new d;else if(l(I,h))T=new h(function(B,D){I.then(function(O){B(A(O,$-1))},function(O){D(A(O,$-1))})});else if(x.__isArray(I))T=[];else if(x.__isRegExp(I))T=new RegExp(I.source,j(I)),I.lastIndex&&(T.lastIndex=I.lastIndex);else if(x.__isDate(I))T=new Date(I.getTime());else{if(P&&Buffer.isBuffer(I))return Buffer.allocUnsafe?T=Buffer.allocUnsafe(I.length):T=new Buffer(I.length),I.copy(T),T;l(I,Error)?T=Object.create(I):typeof S>"u"?(E=Object.getPrototypeOf(I),T=Object.create(E)):(T=Object.create(S),E=S)}if(y){var _=w.indexOf(I);if(_!=-1)return R[_];w.push(I),R.push(T)}l(I,c)&&I.forEach(function(B,D){var O=A(D,$-1),V=A(B,$-1);T.set(O,V)}),l(I,d)&&I.forEach(function(B){var D=A(B,$-1);T.add(D)});for(var M in I){var q;E&&(q=Object.getOwnPropertyDescriptor(E,M)),!(q&&q.set==null)&&(T[M]=A(I[M],$-1))}if(Object.getOwnPropertySymbols)for(var G=Object.getOwnPropertySymbols(I),M=0;M0){if(W instanceof p.BlockEmbed||D instanceof p.BlockEmbed){this.optimize();return}if(W instanceof N.default){var O=W.newlineIndex(W.length(),!0);if(O>-1&&(W=W.split(O+1),W===D)){this.optimize();return}}else if(D instanceof N.default){var V=D.newlineIndex(0);V>-1&&D.split(V+1)}var K=D.children.head instanceof g.default?null:D.children.head;W.moveChildren(D,K),W.remove()}this.optimize()}},{key:"enable",value:function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.domNode.setAttribute("contenteditable",M)}},{key:"formatAt",value:function(M,q,G,Z){this.whitelist!=null&&!this.whitelist[G]||(d(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"formatAt",this).call(this,M,q,G,Z),this.optimize())}},{key:"insertAt",value:function(M,q,G){if(!(G!=null&&this.whitelist!=null&&!this.whitelist[q])){if(M>=this.length())if(G==null||x.default.query(q,x.default.Scope.BLOCK)==null){var Z=x.default.create(this.statics.defaultChild);this.appendChild(Z),G==null&&q.endsWith(` -`)&&(q=q.slice(0,-1)),Z.insertAt(0,q,G)}else{var W=x.default.create(q,G);this.appendChild(W)}else d(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"insertAt",this).call(this,M,q,G);this.optimize()}}},{key:"insertBefore",value:function(M,q){if(M.statics.scope===x.default.Scope.INLINE_BLOT){var G=x.default.create(this.statics.defaultChild);G.appendChild(M),M=G}d(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"insertBefore",this).call(this,M,q)}},{key:"leaf",value:function(M){return this.path(M).pop()||[null,-1]}},{key:"line",value:function(M){return M===this.length()?this.line(M-1):this.descendant(I,M)}},{key:"lines",value:function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE,G=function Z(W,z,F){var B=[],D=F;return W.children.forEachAt(z,F,function(O,V,K){I(O)?B.push(O):O instanceof x.default.Container&&(B=B.concat(Z(O,V,D))),D-=K}),B};return G(this,M,q)}},{key:"optimize",value:function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.batch!==!0&&(d(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"optimize",this).call(this,M,q),M.length>0&&this.emitter.emit(m.default.events.SCROLL_OPTIMIZE,M,q))}},{key:"path",value:function(M){return d(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"path",this).call(this,M).slice(1)}},{key:"update",value:function(M){if(this.batch!==!0){var q=m.default.sources.USER;typeof M=="string"&&(q=M),Array.isArray(M)||(M=this.observer.takeRecords()),M.length>0&&this.emitter.emit(m.default.events.SCROLL_BEFORE_UPDATE,q,M),d(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"update",this).call(this,M.concat([])),M.length>0&&this.emitter.emit(m.default.events.SCROLL_UPDATE,q,M)}}}]),E})(x.default.Scroll);$.blotName="scroll",$.className="ql-editor",$.tagName="DIV",$.defaultChild="block",$.allowedChildren=[u.default,p.BlockEmbed,C.default],r.default=$}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.SHORTKEY=r.default=void 0;var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},c=(function(){function U(X,ne){var oe=[],re=!0,ge=!1,ve=void 0;try{for(var Se=X[Symbol.iterator](),We;!(re=(We=Se.next()).done)&&(oe.push(We.value),!(ne&&oe.length===ne));re=!0);}catch(Ce){ge=!0,ve=Ce}finally{try{!re&&Se.return&&Se.return()}finally{if(ge)throw ve}}return oe}return function(X,ne){if(Array.isArray(X))return X;if(Symbol.iterator in Object(X))return U(X,ne);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=(function(){function U(X,ne){for(var oe=0;oe1&&arguments[1]!==void 0?arguments[1]:{},ge=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ve=Y(oe);if(ve==null||ve.key==null)return G.warn("Attempted to add invalid keyboard binding",ve);typeof re=="function"&&(re={handler:re}),typeof ge=="function"&&(ge={handler:ge}),ve=(0,u.default)(ve,re,ge),this.bindings[ve.key]=this.bindings[ve.key]||[],this.bindings[ve.key].push(ve)}},{key:"listen",value:function(){var oe=this;this.quill.root.addEventListener("keydown",function(re){if(!re.defaultPrevented){var ge=re.which||re.keyCode,ve=(oe.bindings[ge]||[]).filter(function(Rt){return X.match(re,Rt)});if(ve.length!==0){var Se=oe.quill.getSelection();if(!(Se==null||!oe.quill.hasFocus())){var We=oe.quill.getLine(Se.index),Ce=c(We,2),fe=Ce[0],Ye=Ce[1],be=oe.quill.getLeaf(Se.index),_e=c(be,2),ke=_e[0],qe=_e[1],Ve=Se.length===0?[ke,qe]:oe.quill.getLeaf(Se.index+Se.length),dt=c(Ve,2),xt=dt[0],ye=dt[1],le=ke instanceof C.default.Text?ke.value().slice(0,qe):"",Qe=xt instanceof C.default.Text?xt.value().slice(ye):"",rt={collapsed:Se.length===0,empty:Se.length===0&&fe.length()<=1,format:oe.quill.getFormat(Se),offset:Ye,prefix:le,suffix:Qe},Kt=ve.some(function(Rt){if(Rt.collapsed!=null&&Rt.collapsed!==rt.collapsed||Rt.empty!=null&&Rt.empty!==rt.empty||Rt.offset!=null&&Rt.offset!==rt.offset)return!1;if(Array.isArray(Rt.format)){if(Rt.format.every(function(Re){return rt.format[Re]==null}))return!1}else if(l(Rt.format)==="object"&&!Object.keys(Rt.format).every(function(Re){return Rt.format[Re]===!0?rt.format[Re]!=null:Rt.format[Re]===!1?rt.format[Re]==null:(0,m.default)(Rt.format[Re],rt.format[Re])}))return!1;return Rt.prefix!=null&&!Rt.prefix.test(rt.prefix)||Rt.suffix!=null&&!Rt.suffix.test(rt.suffix)?!1:Rt.handler.call(oe,Se,rt)!==!0});Kt&&re.preventDefault()}}}})}}]),X})($.default);W.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},W.DEFAULTS={bindings:{bold:K("bold"),italic:K("italic"),underline:K("underline"),indent:{key:W.keys.TAB,format:["blockquote","indent","list"],handler:function(X,ne){if(ne.collapsed&&ne.offset!==0)return!0;this.quill.format("indent","+1",R.default.sources.USER)}},outdent:{key:W.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(X,ne){if(ne.collapsed&&ne.offset!==0)return!0;this.quill.format("indent","-1",R.default.sources.USER)}},"outdent backspace":{key:W.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(X,ne){ne.format.indent!=null?this.quill.format("indent","-1",R.default.sources.USER):ne.format.list!=null&&this.quill.format("list",!1,R.default.sources.USER)}},"indent code-block":V(!0),"outdent code-block":V(!1),"remove tab":{key:W.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(X){this.quill.deleteText(X.index-1,1,R.default.sources.USER)}},tab:{key:W.keys.TAB,handler:function(X){this.quill.history.cutoff();var ne=new g.default().retain(X.index).delete(X.length).insert(" ");this.quill.updateContents(ne,R.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(X.index+1,R.default.sources.SILENT)}},"list empty enter":{key:W.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(X,ne){this.quill.format("list",!1,R.default.sources.USER),ne.format.indent&&this.quill.format("indent",!1,R.default.sources.USER)}},"checklist enter":{key:W.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(X){var ne=this.quill.getLine(X.index),oe=c(ne,2),re=oe[0],ge=oe[1],ve=(0,u.default)({},re.formats(),{list:"checked"}),Se=new g.default().retain(X.index).insert(` -`,ve).retain(re.length()-ge-1).retain(1,{list:"unchecked"});this.quill.updateContents(Se,R.default.sources.USER),this.quill.setSelection(X.index+1,R.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:W.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(X,ne){var oe=this.quill.getLine(X.index),re=c(oe,2),ge=re[0],ve=re[1],Se=new g.default().retain(X.index).insert(` -`,ne.format).retain(ge.length()-ve-1).retain(1,{header:null});this.quill.updateContents(Se,R.default.sources.USER),this.quill.setSelection(X.index+1,R.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(X,ne){var oe=ne.prefix.length,re=this.quill.getLine(X.index),ge=c(re,2),ve=ge[0],Se=ge[1];if(Se>oe)return!0;var We=void 0;switch(ne.prefix.trim()){case"[]":case"[ ]":We="unchecked";break;case"[x]":We="checked";break;case"-":case"*":We="bullet";break;default:We="ordered"}this.quill.insertText(X.index," ",R.default.sources.USER),this.quill.history.cutoff();var Ce=new g.default().retain(X.index-Se).delete(oe+1).retain(ve.length()-2-Se).retain(1,{list:We});this.quill.updateContents(Ce,R.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(X.index-oe,R.default.sources.SILENT)}},"code exit":{key:W.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(X){var ne=this.quill.getLine(X.index),oe=c(ne,2),re=oe[0],ge=oe[1],ve=new g.default().retain(X.index+re.length()-ge-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(ve,R.default.sources.USER)}},"embed left":z(W.keys.LEFT,!1),"embed left shift":z(W.keys.LEFT,!0),"embed right":z(W.keys.RIGHT,!1),"embed right shift":z(W.keys.RIGHT,!0)}};function z(U,X){var ne,oe=U===W.keys.LEFT?"prefix":"suffix";return ne={key:U,shiftKey:X,altKey:null},E(ne,oe,/^$/),E(ne,"handler",function(ge){var ve=ge.index;U===W.keys.RIGHT&&(ve+=ge.length+1);var Se=this.quill.getLeaf(ve),We=c(Se,1),Ce=We[0];return Ce instanceof C.default.Embed?(U===W.keys.LEFT?X?this.quill.setSelection(ge.index-1,ge.length+1,R.default.sources.USER):this.quill.setSelection(ge.index-1,R.default.sources.USER):X?this.quill.setSelection(ge.index,ge.length+1,R.default.sources.USER):this.quill.setSelection(ge.index+ge.length+1,R.default.sources.USER),!1):!0}),ne}function F(U,X){if(!(U.index===0||this.quill.getLength()<=1)){var ne=this.quill.getLine(U.index),oe=c(ne,1),re=oe[0],ge={};if(X.offset===0){var ve=this.quill.getLine(U.index-1),Se=c(ve,1),We=Se[0];if(We!=null&&We.length()>1){var Ce=re.formats(),fe=this.quill.getFormat(U.index-1,1);ge=N.default.attributes.diff(Ce,fe)||{}}}var Ye=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(X.prefix)?2:1;this.quill.deleteText(U.index-Ye,Ye,R.default.sources.USER),Object.keys(ge).length>0&&this.quill.formatLine(U.index-Ye,Ye,ge,R.default.sources.USER),this.quill.focus()}}function B(U,X){var ne=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(X.suffix)?2:1;if(!(U.index>=this.quill.getLength()-ne)){var oe={},re=0,ge=this.quill.getLine(U.index),ve=c(ge,1),Se=ve[0];if(X.offset>=Se.length()-1){var We=this.quill.getLine(U.index+1),Ce=c(We,1),fe=Ce[0];if(fe){var Ye=Se.formats(),be=this.quill.getFormat(U.index,1);oe=N.default.attributes.diff(Ye,be)||{},re=fe.length()}}this.quill.deleteText(U.index,ne,R.default.sources.USER),Object.keys(oe).length>0&&this.quill.formatLine(U.index+re-1,ne,oe,R.default.sources.USER)}}function D(U){var X=this.quill.getLines(U),ne={};if(X.length>1){var oe=X[0].formats(),re=X[X.length-1].formats();ne=N.default.attributes.diff(re,oe)||{}}this.quill.deleteText(U,R.default.sources.USER),Object.keys(ne).length>0&&this.quill.formatLine(U.index,1,ne,R.default.sources.USER),this.quill.setSelection(U.index,R.default.sources.SILENT),this.quill.focus()}function O(U,X){var ne=this;U.length>0&&this.quill.scroll.deleteAt(U.index,U.length);var oe=Object.keys(X.format).reduce(function(re,ge){return C.default.query(ge,C.default.Scope.BLOCK)&&!Array.isArray(X.format[ge])&&(re[ge]=X.format[ge]),re},{});this.quill.insertText(U.index,` -`,oe,R.default.sources.USER),this.quill.setSelection(U.index+1,R.default.sources.SILENT),this.quill.focus(),Object.keys(X.format).forEach(function(re){oe[re]==null&&(Array.isArray(X.format[re])||re!=="link"&&ne.quill.format(re,X.format[re],R.default.sources.USER))})}function V(U){return{key:W.keys.TAB,shiftKey:!U,format:{"code-block":!0},handler:function(ne){var oe=C.default.query("code-block"),re=ne.index,ge=ne.length,ve=this.quill.scroll.descendant(oe,re),Se=c(ve,2),We=Se[0],Ce=Se[1];if(We!=null){var fe=this.quill.getIndex(We),Ye=We.newlineIndex(Ce,!0)+1,be=We.newlineIndex(fe+Ce+ge),_e=We.domNode.textContent.slice(Ye,be).split(` -`);Ce=0,_e.forEach(function(ke,qe){U?(We.insertAt(Ye+Ce,oe.TAB),Ce+=oe.TAB.length,qe===0?re+=oe.TAB.length:ge+=oe.TAB.length):ke.startsWith(oe.TAB)&&(We.deleteAt(Ye+Ce,oe.TAB.length),Ce-=oe.TAB.length,qe===0?re-=oe.TAB.length:ge-=oe.TAB.length),Ce+=ke.length+1}),this.quill.update(R.default.sources.USER),this.quill.setSelection(re,ge,R.default.sources.SILENT)}}}}function K(U){return{key:U[0].toUpperCase(),shortKey:!0,handler:function(ne,oe){this.quill.format(U,!oe.format[U],R.default.sources.USER)}}}function Y(U){if(typeof U=="string"||typeof U=="number")return Y({key:U});if((typeof U>"u"?"undefined":l(U))==="object"&&(U=(0,x.default)(U,!1)),typeof U.key=="string")if(W.keys[U.key.toUpperCase()]!=null)U.key=W.keys[U.key.toUpperCase()];else if(U.key.length===1)U.key=U.key.toUpperCase().charCodeAt(0);else return null;return U.shortKey&&(U[Z]=U.shortKey,delete U.shortKey),U}r.default=W,r.SHORTKEY=Z}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function N(S,C){var w=[],R=!0,P=!1,A=void 0;try{for(var I=S[Symbol.iterator](),$;!(R=($=I.next()).done)&&(w.push($.value),!(C&&w.length===C));R=!0);}catch(T){P=!0,A=T}finally{try{!R&&I.return&&I.return()}finally{if(P)throw A}}return w}return function(S,C){if(Array.isArray(S))return S;if(Symbol.iterator in Object(S))return N(S,C);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),c=function N(S,C,w){S===null&&(S=Function.prototype);var R=Object.getOwnPropertyDescriptor(S,C);if(R===void 0){var P=Object.getPrototypeOf(S);return P===null?void 0:N(P,C,w)}else{if("value"in R)return R.value;var A=R.get;return A===void 0?void 0:A.call(w)}},d=(function(){function N(S,C){for(var w=0;w-1}r.default=u,r.sanitize=j}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},c=(function(){function y(N,S){for(var C=0;C1&&arguments[1]!==void 0?arguments[1]:!1,w=this.container.querySelector(".ql-selected");if(S!==w&&(w!=null&&w.classList.remove("ql-selected"),S!=null&&(S.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(S.parentNode.children,S),S.hasAttribute("data-value")?this.label.setAttribute("data-value",S.getAttribute("data-value")):this.label.removeAttribute("data-value"),S.hasAttribute("data-label")?this.label.setAttribute("data-label",S.getAttribute("data-label")):this.label.removeAttribute("data-label"),C))){if(typeof Event=="function")this.select.dispatchEvent(new Event("change"));else if((typeof Event>"u"?"undefined":l(Event))==="object"){var R=document.createEvent("Event");R.initEvent("change",!0,!0),this.select.dispatchEvent(R)}this.close()}}},{key:"update",value:function(){var S=void 0;if(this.select.selectedIndex>-1){var C=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];S=this.select.options[this.select.selectedIndex],this.selectItem(C)}else this.selectItem(null);var w=S!=null&&S!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",w)}}]),y})();r.default=g}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=a(0),c=G(l),d=a(5),h=G(d),x=a(4),f=G(x),m=a(16),p=G(m),u=a(25),j=G(u),g=a(24),y=G(g),N=a(35),S=G(N),C=a(6),w=G(C),R=a(22),P=G(R),A=a(7),I=G(A),$=a(55),T=G($),E=a(42),_=G(E),M=a(23),q=G(M);function G(Z){return Z&&Z.__esModule?Z:{default:Z}}h.default.register({"blots/block":f.default,"blots/block/embed":x.BlockEmbed,"blots/break":p.default,"blots/container":j.default,"blots/cursor":y.default,"blots/embed":S.default,"blots/inline":w.default,"blots/scroll":P.default,"blots/text":I.default,"modules/clipboard":T.default,"modules/history":_.default,"modules/keyboard":q.default}),c.default.register(f.default,p.default,y.default,w.default,P.default,I.default),r.default=h.default}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=a(1),c=(function(){function d(h){this.domNode=h,this.domNode[l.DATA_KEY]={blot:this}}return Object.defineProperty(d.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),d.create=function(h){if(this.tagName==null)throw new l.ParchmentError("Blot definition missing tagName");var x;return Array.isArray(this.tagName)?(typeof h=="string"&&(h=h.toUpperCase(),parseInt(h).toString()===h&&(h=parseInt(h))),typeof h=="number"?x=document.createElement(this.tagName[h-1]):this.tagName.indexOf(h)>-1?x=document.createElement(h):x=document.createElement(this.tagName[0])):x=document.createElement(this.tagName),this.className&&x.classList.add(this.className),x},d.prototype.attach=function(){this.parent!=null&&(this.scroll=this.parent.scroll)},d.prototype.clone=function(){var h=this.domNode.cloneNode(!1);return l.create(h)},d.prototype.detach=function(){this.parent!=null&&this.parent.removeChild(this),delete this.domNode[l.DATA_KEY]},d.prototype.deleteAt=function(h,x){var f=this.isolate(h,x);f.remove()},d.prototype.formatAt=function(h,x,f,m){var p=this.isolate(h,x);if(l.query(f,l.Scope.BLOT)!=null&&m)p.wrap(f,m);else if(l.query(f,l.Scope.ATTRIBUTE)!=null){var u=l.create(this.statics.scope);p.wrap(u),u.format(f,m)}},d.prototype.insertAt=function(h,x,f){var m=f==null?l.create("text",x):l.create(x,f),p=this.split(h);this.parent.insertBefore(m,p)},d.prototype.insertInto=function(h,x){x===void 0&&(x=null),this.parent!=null&&this.parent.children.remove(this);var f=null;h.children.insertBefore(this,x),x!=null&&(f=x.domNode),(this.domNode.parentNode!=h.domNode||this.domNode.nextSibling!=f)&&h.domNode.insertBefore(this.domNode,f),this.parent=h,this.attach()},d.prototype.isolate=function(h,x){var f=this.split(h);return f.split(x),f},d.prototype.length=function(){return 1},d.prototype.offset=function(h){return h===void 0&&(h=this.parent),this.parent==null||this==h?0:this.parent.children.offset(this)+this.parent.offset(h)},d.prototype.optimize=function(h){this.domNode[l.DATA_KEY]!=null&&delete this.domNode[l.DATA_KEY].mutations},d.prototype.remove=function(){this.domNode.parentNode!=null&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},d.prototype.replace=function(h){h.parent!=null&&(h.parent.insertBefore(this,h.next),h.remove())},d.prototype.replaceWith=function(h,x){var f=typeof h=="string"?l.create(h,x):h;return f.replace(this),f},d.prototype.split=function(h,x){return h===0?this:this.next},d.prototype.update=function(h,x){},d.prototype.wrap=function(h,x){var f=typeof h=="string"?l.create(h,x):h;return this.parent!=null&&this.parent.insertBefore(f,this.next),f.appendChild(this),f},d.blotName="abstract",d})();r.default=c}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=a(12),c=a(32),d=a(33),h=a(1),x=(function(){function f(m){this.attributes={},this.domNode=m,this.build()}return f.prototype.attribute=function(m,p){p?m.add(this.domNode,p)&&(m.value(this.domNode)!=null?this.attributes[m.attrName]=m:delete this.attributes[m.attrName]):(m.remove(this.domNode),delete this.attributes[m.attrName])},f.prototype.build=function(){var m=this;this.attributes={};var p=l.default.keys(this.domNode),u=c.default.keys(this.domNode),j=d.default.keys(this.domNode);p.concat(u).concat(j).forEach(function(g){var y=h.query(g,h.Scope.ATTRIBUTE);y instanceof l.default&&(m.attributes[y.attrName]=y)})},f.prototype.copy=function(m){var p=this;Object.keys(this.attributes).forEach(function(u){var j=p.attributes[u].value(p.domNode);m.format(u,j)})},f.prototype.move=function(m){var p=this;this.copy(m),Object.keys(this.attributes).forEach(function(u){p.attributes[u].remove(p.domNode)}),this.attributes={}},f.prototype.values=function(){var m=this;return Object.keys(this.attributes).reduce(function(p,u){return p[u]=m.attributes[u].value(m.domNode),p},{})},f})();r.default=x}),(function(n,r,a){var l=this&&this.__extends||(function(){var x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,m){f.__proto__=m}||function(f,m){for(var p in m)m.hasOwnProperty(p)&&(f[p]=m[p])};return function(f,m){x(f,m);function p(){this.constructor=f}f.prototype=m===null?Object.create(m):(p.prototype=m.prototype,new p)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(12);function d(x,f){var m=x.getAttribute("class")||"";return m.split(/\s+/).filter(function(p){return p.indexOf(f+"-")===0})}var h=(function(x){l(f,x);function f(){return x!==null&&x.apply(this,arguments)||this}return f.keys=function(m){return(m.getAttribute("class")||"").split(/\s+/).map(function(p){return p.split("-").slice(0,-1).join("-")})},f.prototype.add=function(m,p){return this.canAdd(m,p)?(this.remove(m),m.classList.add(this.keyName+"-"+p),!0):!1},f.prototype.remove=function(m){var p=d(m,this.keyName);p.forEach(function(u){m.classList.remove(u)}),m.classList.length===0&&m.removeAttribute("class")},f.prototype.value=function(m){var p=d(m,this.keyName)[0]||"",u=p.slice(this.keyName.length+1);return this.canAdd(m,u)?u:""},f})(c.default);r.default=h}),(function(n,r,a){var l=this&&this.__extends||(function(){var x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,m){f.__proto__=m}||function(f,m){for(var p in m)m.hasOwnProperty(p)&&(f[p]=m[p])};return function(f,m){x(f,m);function p(){this.constructor=f}f.prototype=m===null?Object.create(m):(p.prototype=m.prototype,new p)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(12);function d(x){var f=x.split("-"),m=f.slice(1).map(function(p){return p[0].toUpperCase()+p.slice(1)}).join("");return f[0]+m}var h=(function(x){l(f,x);function f(){return x!==null&&x.apply(this,arguments)||this}return f.keys=function(m){return(m.getAttribute("style")||"").split(";").map(function(p){var u=p.split(":");return u[0].trim()})},f.prototype.add=function(m,p){return this.canAdd(m,p)?(m.style[d(this.keyName)]=p,!0):!1},f.prototype.remove=function(m){m.style[d(this.keyName)]="",m.getAttribute("style")||m.removeAttribute("style")},f.prototype.value=function(m){var p=m.style[d(this.keyName)];return this.canAdd(m,p)?p:""},f})(c.default);r.default=h}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function h(x,f){for(var m=0;m$&&this.stack.undo.length>0){var T=this.stack.undo.pop();I=I.compose(T.undo),P=T.redo.compose(P)}else this.lastRecorded=$;this.stack.undo.push({redo:P,undo:I}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(P){this.stack.undo.forEach(function(A){A.undo=P.transform(A.undo,!0),A.redo=P.transform(A.redo,!0)}),this.stack.redo.forEach(function(A){A.undo=P.transform(A.undo,!0),A.redo=P.transform(A.redo,!0)})}},{key:"undo",value:function(){this.change("undo","redo")}}]),w})(m.default);y.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1};function N(C){var w=C.ops[C.ops.length-1];return w==null?!1:w.insert!=null?typeof w.insert=="string"&&w.insert.endsWith(` -`):w.attributes!=null?Object.keys(w.attributes).some(function(R){return d.default.query(R,d.default.Scope.BLOCK)!=null}):!1}function S(C){var w=C.reduce(function(P,A){return P+=A.delete||0,P},0),R=C.length()-w;return N(C)&&(R-=1),R}r.default=y,r.getLastChangeIndex=S}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.BaseTooltip=void 0;var l=(function(){function O(V,K){for(var Y=0;Y0&&arguments[0]!==void 0?arguments[0]:"link",U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),U!=null?this.textbox.value=U:Y!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+Y)||""),this.root.setAttribute("data-mode",Y)}},{key:"restoreFocus",value:function(){var Y=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=Y}},{key:"save",value:function(){var Y=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":{var U=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",Y,p.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",Y,p.default.sources.USER)),this.quill.root.scrollTop=U;break}case"video":Y=B(Y);case"formula":{if(!Y)break;var X=this.quill.getSelection(!0);if(X!=null){var ne=X.index+X.length;this.quill.insertEmbed(ne,this.root.getAttribute("data-mode"),Y,p.default.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(ne+1," ",p.default.sources.USER),this.quill.setSelection(ne+2,p.default.sources.USER)}break}}this.textbox.value="",this.hide()}}]),V})(I.default);function B(O){var V=O.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||O.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return V?(V[1]||"https")+"://www.youtube.com/embed/"+V[2]+"?showinfo=0":(V=O.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(V[1]||"https")+"://player.vimeo.com/video/"+V[2]+"/":O}function D(O,V){var K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;V.forEach(function(Y){var U=document.createElement("option");Y===K?U.setAttribute("selected","selected"):U.setAttribute("value",Y),O.appendChild(U)})}r.BaseTooltip=F,r.default=z}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function c(){this.head=this.tail=null,this.length=0}return c.prototype.append=function(){for(var d=[],h=0;h1&&this.append.apply(this,d.slice(1))},c.prototype.contains=function(d){for(var h,x=this.iterator();h=x();)if(h===d)return!0;return!1},c.prototype.insertBefore=function(d,h){d&&(d.next=h,h!=null?(d.prev=h.prev,h.prev!=null&&(h.prev.next=d),h.prev=d,h===this.head&&(this.head=d)):this.tail!=null?(this.tail.next=d,d.prev=this.tail,this.tail=d):(d.prev=null,this.head=this.tail=d),this.length+=1)},c.prototype.offset=function(d){for(var h=0,x=this.head;x!=null;){if(x===d)return h;h+=x.length(),x=x.next}return-1},c.prototype.remove=function(d){this.contains(d)&&(d.prev!=null&&(d.prev.next=d.next),d.next!=null&&(d.next.prev=d.prev),d===this.head&&(this.head=d.next),d===this.tail&&(this.tail=d.prev),this.length-=1)},c.prototype.iterator=function(d){return d===void 0&&(d=this.head),function(){var h=d;return d!=null&&(d=d.next),h}},c.prototype.find=function(d,h){h===void 0&&(h=!1);for(var x,f=this.iterator();x=f();){var m=x.length();if(dj?x(u,d-j,Math.min(h,j+y-d)):x(u,0,Math.min(y,d+h-j)),j+=y}},c.prototype.map=function(d){return this.reduce(function(h,x){return h.push(d(x)),h},[])},c.prototype.reduce=function(d,h){for(var x,f=this.iterator();x=f();)h=d(h,x);return h},c})();r.default=l}),(function(n,r,a){var l=this&&this.__extends||(function(){var m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,u){p.__proto__=u}||function(p,u){for(var j in u)u.hasOwnProperty(j)&&(p[j]=u[j])};return function(p,u){m(p,u);function j(){this.constructor=p}p.prototype=u===null?Object.create(u):(j.prototype=u.prototype,new j)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(17),d=a(1),h={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},x=100,f=(function(m){l(p,m);function p(u){var j=m.call(this,u)||this;return j.scroll=j,j.observer=new MutationObserver(function(g){j.update(g)}),j.observer.observe(j.domNode,h),j.attach(),j}return p.prototype.detach=function(){m.prototype.detach.call(this),this.observer.disconnect()},p.prototype.deleteAt=function(u,j){this.update(),u===0&&j===this.length()?this.children.forEach(function(g){g.remove()}):m.prototype.deleteAt.call(this,u,j)},p.prototype.formatAt=function(u,j,g,y){this.update(),m.prototype.formatAt.call(this,u,j,g,y)},p.prototype.insertAt=function(u,j,g){this.update(),m.prototype.insertAt.call(this,u,j,g)},p.prototype.optimize=function(u,j){var g=this;u===void 0&&(u=[]),j===void 0&&(j={}),m.prototype.optimize.call(this,j);for(var y=[].slice.call(this.observer.takeRecords());y.length>0;)u.push(y.pop());for(var N=function(R,P){P===void 0&&(P=!0),!(R==null||R===g)&&R.domNode.parentNode!=null&&(R.domNode[d.DATA_KEY].mutations==null&&(R.domNode[d.DATA_KEY].mutations=[]),P&&N(R.parent))},S=function(R){R.domNode[d.DATA_KEY]==null||R.domNode[d.DATA_KEY].mutations==null||(R instanceof c.default&&R.children.forEach(S),R.optimize(j))},C=u,w=0;C.length>0;w+=1){if(w>=x)throw new Error("[Parchment] Maximum optimize iterations reached");for(C.forEach(function(R){var P=d.find(R.target,!0);P!=null&&(P.domNode===R.target&&(R.type==="childList"?(N(d.find(R.previousSibling,!1)),[].forEach.call(R.addedNodes,function(A){var I=d.find(A,!1);N(I,!1),I instanceof c.default&&I.children.forEach(function($){N($,!1)})})):R.type==="attributes"&&N(P.prev)),N(P))}),this.children.forEach(S),C=[].slice.call(this.observer.takeRecords()),y=C.slice();y.length>0;)u.push(y.pop())}},p.prototype.update=function(u,j){var g=this;j===void 0&&(j={}),u=u||this.observer.takeRecords(),u.map(function(y){var N=d.find(y.target,!0);return N==null?null:N.domNode[d.DATA_KEY].mutations==null?(N.domNode[d.DATA_KEY].mutations=[y],N):(N.domNode[d.DATA_KEY].mutations.push(y),null)}).forEach(function(y){y==null||y===g||y.domNode[d.DATA_KEY]==null||y.update(y.domNode[d.DATA_KEY].mutations||[],j)}),this.domNode[d.DATA_KEY].mutations!=null&&m.prototype.update.call(this,this.domNode[d.DATA_KEY].mutations,j),this.optimize(u,j)},p.blotName="scroll",p.defaultChild="block",p.scope=d.Scope.BLOCK_BLOT,p.tagName="DIV",p})(c.default);r.default=f}),(function(n,r,a){var l=this&&this.__extends||(function(){var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,p){m.__proto__=p}||function(m,p){for(var u in p)p.hasOwnProperty(u)&&(m[u]=p[u])};return function(m,p){f(m,p);function u(){this.constructor=m}m.prototype=p===null?Object.create(p):(u.prototype=p.prototype,new u)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(18),d=a(1);function h(f,m){if(Object.keys(f).length!==Object.keys(m).length)return!1;for(var p in f)if(f[p]!==m[p])return!1;return!0}var x=(function(f){l(m,f);function m(){return f!==null&&f.apply(this,arguments)||this}return m.formats=function(p){if(p.tagName!==m.tagName)return f.formats.call(this,p)},m.prototype.format=function(p,u){var j=this;p===this.statics.blotName&&!u?(this.children.forEach(function(g){g instanceof c.default||(g=g.wrap(m.blotName,!0)),j.attributes.copy(g)}),this.unwrap()):f.prototype.format.call(this,p,u)},m.prototype.formatAt=function(p,u,j,g){if(this.formats()[j]!=null||d.query(j,d.Scope.ATTRIBUTE)){var y=this.isolate(p,u);y.format(j,g)}else f.prototype.formatAt.call(this,p,u,j,g)},m.prototype.optimize=function(p){f.prototype.optimize.call(this,p);var u=this.formats();if(Object.keys(u).length===0)return this.unwrap();var j=this.next;j instanceof m&&j.prev===this&&h(u,j.formats())&&(j.moveChildren(this),j.remove())},m.blotName="inline",m.scope=d.Scope.INLINE_BLOT,m.tagName="SPAN",m})(c.default);r.default=x}),(function(n,r,a){var l=this&&this.__extends||(function(){var x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,m){f.__proto__=m}||function(f,m){for(var p in m)m.hasOwnProperty(p)&&(f[p]=m[p])};return function(f,m){x(f,m);function p(){this.constructor=f}f.prototype=m===null?Object.create(m):(p.prototype=m.prototype,new p)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(18),d=a(1),h=(function(x){l(f,x);function f(){return x!==null&&x.apply(this,arguments)||this}return f.formats=function(m){var p=d.query(f.blotName).tagName;if(m.tagName!==p)return x.formats.call(this,m)},f.prototype.format=function(m,p){d.query(m,d.Scope.BLOCK)!=null&&(m===this.statics.blotName&&!p?this.replaceWith(f.blotName):x.prototype.format.call(this,m,p))},f.prototype.formatAt=function(m,p,u,j){d.query(u,d.Scope.BLOCK)!=null?this.format(u,j):x.prototype.formatAt.call(this,m,p,u,j)},f.prototype.insertAt=function(m,p,u){if(u==null||d.query(p,d.Scope.INLINE)!=null)x.prototype.insertAt.call(this,m,p,u);else{var j=this.split(m),g=d.create(p,u);j.parent.insertBefore(g,j)}},f.prototype.update=function(m,p){navigator.userAgent.match(/Trident/)?this.build():x.prototype.update.call(this,m,p)},f.blotName="block",f.scope=d.Scope.BLOCK_BLOT,f.tagName="P",f})(c.default);r.default=h}),(function(n,r,a){var l=this&&this.__extends||(function(){var h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,f){x.__proto__=f}||function(x,f){for(var m in f)f.hasOwnProperty(m)&&(x[m]=f[m])};return function(x,f){h(x,f);function m(){this.constructor=x}x.prototype=f===null?Object.create(f):(m.prototype=f.prototype,new m)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(19),d=(function(h){l(x,h);function x(){return h!==null&&h.apply(this,arguments)||this}return x.formats=function(f){},x.prototype.format=function(f,m){h.prototype.formatAt.call(this,0,this.length(),f,m)},x.prototype.formatAt=function(f,m,p,u){f===0&&m===this.length()?this.format(p,u):h.prototype.formatAt.call(this,f,m,p,u)},x.prototype.formats=function(){return this.statics.formats(this.domNode)},x})(c.default);r.default=d}),(function(n,r,a){var l=this&&this.__extends||(function(){var x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,m){f.__proto__=m}||function(f,m){for(var p in m)m.hasOwnProperty(p)&&(f[p]=m[p])};return function(f,m){x(f,m);function p(){this.constructor=f}f.prototype=m===null?Object.create(m):(p.prototype=m.prototype,new p)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(19),d=a(1),h=(function(x){l(f,x);function f(m){var p=x.call(this,m)||this;return p.text=p.statics.value(p.domNode),p}return f.create=function(m){return document.createTextNode(m)},f.value=function(m){var p=m.data;return p.normalize&&(p=p.normalize()),p},f.prototype.deleteAt=function(m,p){this.domNode.data=this.text=this.text.slice(0,m)+this.text.slice(m+p)},f.prototype.index=function(m,p){return this.domNode===m?p:-1},f.prototype.insertAt=function(m,p,u){u==null?(this.text=this.text.slice(0,m)+p+this.text.slice(m),this.domNode.data=this.text):x.prototype.insertAt.call(this,m,p,u)},f.prototype.length=function(){return this.text.length},f.prototype.optimize=function(m){x.prototype.optimize.call(this,m),this.text=this.statics.value(this.domNode),this.text.length===0?this.remove():this.next instanceof f&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},f.prototype.position=function(m,p){return[this.domNode,m]},f.prototype.split=function(m,p){if(p===void 0&&(p=!1),!p){if(m===0)return this;if(m===this.length())return this.next}var u=d.create(this.domNode.splitText(m));return this.parent.insertBefore(u,this.next),this.text=this.statics.value(this.domNode),u},f.prototype.update=function(m,p){var u=this;m.some(function(j){return j.type==="characterData"&&j.target===u.domNode})&&(this.text=this.statics.value(this.domNode))},f.prototype.value=function(){return this.text},f.blotName="text",f.scope=d.Scope.INLINE_BLOT,f})(c.default);r.default=h}),(function(n,r,a){var l=document.createElement("div");if(l.classList.toggle("test-class",!1),l.classList.contains("test-class")){var c=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(d,h){return arguments.length>1&&!this.contains(d)==!h?h:c.call(this,d)}}String.prototype.startsWith||(String.prototype.startsWith=function(d,h){return h=h||0,this.substr(h,d.length)===d}),String.prototype.endsWith||(String.prototype.endsWith=function(d,h){var x=this.toString();(typeof h!="number"||!isFinite(h)||Math.floor(h)!==h||h>x.length)&&(h=x.length),h-=d.length;var f=x.indexOf(d,h);return f!==-1&&f===h}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(h){if(this===null)throw new TypeError("Array.prototype.find called on null or undefined");if(typeof h!="function")throw new TypeError("predicate must be a function");for(var x=Object(this),f=x.length>>>0,m=arguments[1],p,u=0;uR.length?w:R,I=w.length>R.length?R:w,$=A.indexOf(I);if($!=-1)return P=[[l,A.substring(0,$)],[c,I],[l,A.substring($+I.length)]],w.length>R.length&&(P[0][0]=P[2][0]=a),P;if(I.length==1)return[[a,w],[l,R]];var T=u(w,R);if(T){var E=T[0],_=T[1],M=T[2],q=T[3],G=T[4],Z=d(E,M),W=d(_,q);return Z.concat([[c,G]],W)}return x(w,R)}function x(w,R){for(var P=w.length,A=R.length,I=Math.ceil((P+A)/2),$=I,T=2*I,E=new Array(T),_=new Array(T),M=0;MP)W+=2;else if(K>A)Z+=2;else if(G){var Y=$+q-D;if(Y>=0&&Y=U)return f(w,R,V,K)}}}for(var X=-B+z;X<=B-F;X+=2){var Y=$+X,U;X==-B||X!=B&&_[Y-1]<_[Y+1]?U=_[Y+1]:U=_[Y-1]+1;for(var ne=U-X;UP)F+=2;else if(ne>A)z+=2;else if(!G){var O=$+q-X;if(O>=0&&O=U)return f(w,R,V,K)}}}}return[[a,w],[l,R]]}function f(w,R,P,A){var I=w.substring(0,P),$=R.substring(0,A),T=w.substring(P),E=R.substring(A),_=d(I,$),M=d(T,E);return _.concat(M)}function m(w,R){if(!w||!R||w.charAt(0)!=R.charAt(0))return 0;for(var P=0,A=Math.min(w.length,R.length),I=A,$=0;PR.length?w:R,A=w.length>R.length?R:w;if(P.length<4||A.length*2=W.length?[V,K,Y,U,O]:null}var $=I(P,A,Math.ceil(P.length/4)),T=I(P,A,Math.ceil(P.length/2)),E;if(!$&&!T)return null;T?$?E=$[4].length>T[4].length?$:T:E=T:E=$;var _,M,q,G;w.length>R.length?(_=E[0],M=E[1],q=E[2],G=E[3]):(q=E[0],G=E[1],_=E[2],M=E[3]);var Z=E[4];return[_,M,q,G,Z]}function j(w){w.push([c,""]);for(var R=0,P=0,A=0,I="",$="",T;R1?(P!==0&&A!==0&&(T=m($,I),T!==0&&(R-P-A>0&&w[R-P-A-1][0]==c?w[R-P-A-1][1]+=$.substring(0,T):(w.splice(0,0,[c,$.substring(0,T)]),R++),$=$.substring(T),I=I.substring(T)),T=p($,I),T!==0&&(w[R][1]=$.substring($.length-T)+w[R][1],$=$.substring(0,$.length-T),I=I.substring(0,I.length-T))),P===0?w.splice(R-A,P+A,[l,$]):A===0?w.splice(R-P,P+A,[a,I]):w.splice(R-P-A,P+A,[a,I],[l,$]),R=R-P-A+(P?1:0)+(A?1:0)+1):R!==0&&w[R-1][0]==c?(w[R-1][1]+=w[R][1],w.splice(R,1)):R++,A=0,P=0,I="",$="";break}w[w.length-1][1]===""&&w.pop();var E=!1;for(R=1;R0&&A.splice(I+2,0,[T[0],E]),C(A,I,3)}else return w}function S(w){for(var R=!1,P=function(T){return T.charCodeAt(0)>=56320&&T.charCodeAt(0)<=57343},A=function(T){return T.charCodeAt(T.length-1)>=55296&&T.charCodeAt(T.length-1)<=56319},I=2;I0&&$.push(w[I]);return $}function C(w,R,P){for(var A=R+P-1;A>=0&&A>=R-1;A--)if(A+1\r?\n +\<"),this.convert();var Ve=this.quill.getFormat(this.quill.selection.savedRange.index);if(Ve[A.default.blotName]){var dt=this.container.innerText;return this.container.innerHTML="",new m.default().insert(dt,M({},A.default.blotName,Ve[A.default.blotName]))}var xt=this.prepareMatching(),ye=c(xt,2),le=ye[0],Qe=ye[1],rt=X(this.container,le,Qe);return Y(rt,` -`)&&rt.ops[rt.ops.length-1].attributes==null&&(rt=rt.compose(new m.default().retain(rt.length()-1).delete(1))),W.log("convert",this.container.innerHTML,rt),this.container.innerHTML="",rt}},{key:"dangerouslyPasteHTML",value:function(qe,Ve){var dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:g.default.sources.API;if(typeof qe=="string")this.quill.setContents(this.convert(qe),Ve),this.quill.setSelection(0,g.default.sources.SILENT);else{var xt=this.convert(Ve);this.quill.updateContents(new m.default().retain(qe).concat(xt),dt),this.quill.setSelection(qe+xt.length(),g.default.sources.SILENT)}}},{key:"onPaste",value:function(qe){var Ve=this;if(!(qe.defaultPrevented||!this.quill.isEnabled())){var dt=this.quill.getSelection(),xt=new m.default().retain(dt.index),ye=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(g.default.sources.SILENT),setTimeout(function(){xt=xt.concat(Ve.convert()).delete(dt.length),Ve.quill.updateContents(xt,g.default.sources.USER),Ve.quill.setSelection(xt.length()-dt.length,g.default.sources.SILENT),Ve.quill.scrollingContainer.scrollTop=ye,Ve.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var qe=this,Ve=[],dt=[];return this.matchers.forEach(function(xt){var ye=c(xt,2),le=ye[0],Qe=ye[1];switch(le){case Node.TEXT_NODE:dt.push(Qe);break;case Node.ELEMENT_NODE:Ve.push(Qe);break;default:[].forEach.call(qe.container.querySelectorAll(le),function(rt){rt[z]=rt[z]||[],rt[z].push(Qe)});break}}),[Ve,dt]}}]),_e})(C.default);O.DEFAULTS={matchers:[],matchVisual:!0};function V(be,_e,ke){return(typeof _e>"u"?"undefined":l(_e))==="object"?Object.keys(_e).reduce(function(qe,Ve){return V(qe,Ve,_e[Ve])},be):be.reduce(function(qe,Ve){return Ve.attributes&&Ve.attributes[_e]?qe.push(Ve):qe.insert(Ve.insert,(0,x.default)({},M({},_e,ke),Ve.attributes))},new m.default)}function K(be){if(be.nodeType!==Node.ELEMENT_NODE)return{};var _e="__ql-computed-style";return be[_e]||(be[_e]=window.getComputedStyle(be))}function Y(be,_e){for(var ke="",qe=be.ops.length-1;qe>=0&&ke.length<_e.length;--qe){var Ve=be.ops[qe];if(typeof Ve.insert!="string")break;ke=Ve.insert+ke}return ke.slice(-1*_e.length)===_e}function U(be){if(be.childNodes.length===0)return!1;var _e=K(be);return["block","list-item"].indexOf(_e.display)>-1}function X(be,_e,ke){return be.nodeType===be.TEXT_NODE?ke.reduce(function(qe,Ve){return Ve(be,qe)},new m.default):be.nodeType===be.ELEMENT_NODE?[].reduce.call(be.childNodes||[],function(qe,Ve){var dt=X(Ve,_e,ke);return Ve.nodeType===be.ELEMENT_NODE&&(dt=_e.reduce(function(xt,ye){return ye(Ve,xt)},dt),dt=(Ve[z]||[]).reduce(function(xt,ye){return ye(Ve,xt)},dt)),qe.concat(dt)},new m.default):new m.default}function ne(be,_e,ke){return V(ke,be,!0)}function oe(be,_e){var ke=u.default.Attributor.Attribute.keys(be),qe=u.default.Attributor.Class.keys(be),Ve=u.default.Attributor.Style.keys(be),dt={};return ke.concat(qe).concat(Ve).forEach(function(xt){var ye=u.default.query(xt,u.default.Scope.ATTRIBUTE);ye!=null&&(dt[ye.attrName]=ye.value(be),dt[ye.attrName])||(ye=B[xt],ye!=null&&(ye.attrName===xt||ye.keyName===xt)&&(dt[ye.attrName]=ye.value(be)||void 0),ye=D[xt],ye!=null&&(ye.attrName===xt||ye.keyName===xt)&&(ye=D[xt],dt[ye.attrName]=ye.value(be)||void 0))}),Object.keys(dt).length>0&&(_e=V(_e,dt)),_e}function re(be,_e){var ke=u.default.query(be);if(ke==null)return _e;if(ke.prototype instanceof u.default.Embed){var qe={},Ve=ke.value(be);Ve!=null&&(qe[ke.blotName]=Ve,_e=new m.default().insert(qe,ke.formats(be)))}else typeof ke.formats=="function"&&(_e=V(_e,ke.blotName,ke.formats(be)));return _e}function ge(be,_e){return Y(_e,` -`)||_e.insert(` -`),_e}function ve(){return new m.default}function Se(be,_e){var ke=u.default.query(be);if(ke==null||ke.blotName!=="list-item"||!Y(_e,` -`))return _e;for(var qe=-1,Ve=be.parentNode;!Ve.classList.contains("ql-clipboard");)(u.default.query(Ve)||{}).blotName==="list"&&(qe+=1),Ve=Ve.parentNode;return qe<=0?_e:_e.compose(new m.default().retain(_e.length()-1).retain(1,{indent:qe}))}function We(be,_e){return Y(_e,` -`)||(U(be)||_e.length()>0&&be.nextSibling&&U(be.nextSibling))&&_e.insert(` -`),_e}function Ce(be,_e){if(U(be)&&be.nextElementSibling!=null&&!Y(_e,` +`);return B.insert(z,D.attributes)}return B.push(D)},new x.default)}r.default=Z}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.Range=void 0;var l=(function(){function L($,_){var R=[],P=!0,M=!1,q=void 0;try{for(var K=$[Symbol.iterator](),Z;!(P=(Z=K.next()).done)&&(R.push(Z.value),!(_&&R.length===_));P=!0);}catch(W){M=!0,q=W}finally{try{!P&&K.return&&K.return()}finally{if(M)throw q}}return R}return function($,_){if(Array.isArray($))return $;if(Symbol.iterator in Object($))return L($,_);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),c=(function(){function L($,_){for(var R=0;R<_.length;R++){var P=_[R];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty($,P.key,P)}}return function($,_,R){return _&&L($.prototype,_),R&&L($,R),$}})(),d=a(0),m=N(d),x=a(21),f=N(x),h=a(11),g=N(h),u=a(8),j=N(u),p=a(10),y=N(p);function N(L){return L&&L.__esModule?L:{default:L}}function S(L){if(Array.isArray(L)){for(var $=0,_=Array(L.length);$1&&arguments[1]!==void 0?arguments[1]:0;A(this,L),this.index=$,this.length=_},T=(function(){function L($,_){var R=this;A(this,L),this.emitter=_,this.scroll=$,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=m.default.create("cursor",this),this.lastRange=this.savedRange=new E(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,function(){R.mouseDown||setTimeout(R.update.bind(R,j.default.sources.USER),1)}),this.emitter.on(j.default.events.EDITOR_CHANGE,function(P,M){P===j.default.events.TEXT_CHANGE&&M.length()>0&&R.update(j.default.sources.SILENT)}),this.emitter.on(j.default.events.SCROLL_BEFORE_UPDATE,function(){if(R.hasFocus()){var P=R.getNativeRange();P!=null&&P.start.node!==R.cursor.textNode&&R.emitter.once(j.default.events.SCROLL_UPDATE,function(){try{R.setNativeRange(P.start.node,P.start.offset,P.end.node,P.end.offset)}catch{}})}}),this.emitter.on(j.default.events.SCROLL_OPTIMIZE,function(P,M){if(M.range){var q=M.range,K=q.startNode,Z=q.startOffset,W=q.endNode,U=q.endOffset;R.setNativeRange(K,Z,W,U)}}),this.update(j.default.sources.SILENT)}return c(L,[{key:"handleComposition",value:function(){var _=this;this.root.addEventListener("compositionstart",function(){_.composing=!0}),this.root.addEventListener("compositionend",function(){if(_.composing=!1,_.cursor.parent){var R=_.cursor.restore();if(!R)return;setTimeout(function(){_.setNativeRange(R.startNode,R.startOffset,R.endNode,R.endOffset)},1)}})}},{key:"handleDragging",value:function(){var _=this;this.emitter.listenDOM("mousedown",document.body,function(){_.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){_.mouseDown=!1,_.update(j.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(_,R){if(!(this.scroll.whitelist!=null&&!this.scroll.whitelist[_])){this.scroll.update();var P=this.getNativeRange();if(!(P==null||!P.native.collapsed||m.default.query(_,m.default.Scope.BLOCK))){if(P.start.node!==this.cursor.textNode){var M=m.default.find(P.start.node,!1);if(M==null)return;if(M instanceof m.default.Leaf){var q=M.split(P.start.offset);M.parent.insertBefore(this.cursor,q)}else M.insertBefore(this.cursor,P.start.node);this.cursor.attach()}this.cursor.format(_,R),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(_){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,P=this.scroll.length();_=Math.min(_,P-1),R=Math.min(_+R,P-1)-_;var M=void 0,q=this.scroll.leaf(_),K=l(q,2),Z=K[0],W=K[1];if(Z==null)return null;var U=Z.position(W,!0),F=l(U,2);M=F[0],W=F[1];var B=document.createRange();if(R>0){B.setStart(M,W);var D=this.scroll.leaf(_+R),O=l(D,2);if(Z=O[0],W=O[1],Z==null)return null;var z=Z.position(W,!0),G=l(z,2);return M=G[0],W=G[1],B.setEnd(M,W),B.getBoundingClientRect()}else{var Y="left",V=void 0;return M instanceof Text?(W0&&(Y="right")),{bottom:V.top+V.height,height:V.height,left:V[Y],right:V[Y],top:V.top,width:0}}}},{key:"getNativeRange",value:function(){var _=document.getSelection();if(_==null||_.rangeCount<=0)return null;var R=_.getRangeAt(0);if(R==null)return null;var P=this.normalizeNative(R);return w.info("getNativeRange",P),P}},{key:"getRange",value:function(){var _=this.getNativeRange();if(_==null)return[null,null];var R=this.normalizedToRange(_);return[R,_]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(_){var R=this,P=[[_.start.node,_.start.offset]];_.native.collapsed||P.push([_.end.node,_.end.offset]);var M=P.map(function(Z){var W=l(Z,2),U=W[0],F=W[1],B=m.default.find(U,!0),D=B.offset(R.scroll);return F===0?D:B instanceof m.default.Container?D+B.length():D+B.index(U,F)}),q=Math.min(Math.max.apply(Math,S(M)),this.scroll.length()-1),K=Math.min.apply(Math,[q].concat(S(M)));return new E(K,q-K)}},{key:"normalizeNative",value:function(_){if(!C(this.root,_.startContainer)||!_.collapsed&&!C(this.root,_.endContainer))return null;var R={start:{node:_.startContainer,offset:_.startOffset},end:{node:_.endContainer,offset:_.endOffset},native:_};return[R.start,R.end].forEach(function(P){for(var M=P.node,q=P.offset;!(M instanceof Text)&&M.childNodes.length>0;)if(M.childNodes.length>q)M=M.childNodes[q],q=0;else if(M.childNodes.length===q)M=M.lastChild,q=M instanceof Text?M.data.length:M.childNodes.length+1;else break;P.node=M,P.offset=q}),R}},{key:"rangeToNative",value:function(_){var R=this,P=_.collapsed?[_.index]:[_.index,_.index+_.length],M=[],q=this.scroll.length();return P.forEach(function(K,Z){K=Math.min(q-1,K);var W=void 0,U=R.scroll.leaf(K),F=l(U,2),B=F[0],D=F[1],O=B.position(D,Z!==0),z=l(O,2);W=z[0],D=z[1],M.push(W,D)}),M.length<2&&(M=M.concat(M)),M}},{key:"scrollIntoView",value:function(_){var R=this.lastRange;if(R!=null){var P=this.getBounds(R.index,R.length);if(P!=null){var M=this.scroll.length()-1,q=this.scroll.line(Math.min(R.index,M)),K=l(q,1),Z=K[0],W=Z;if(R.length>0){var U=this.scroll.line(Math.min(R.index+R.length,M)),F=l(U,1);W=F[0]}if(!(Z==null||W==null)){var B=_.getBoundingClientRect();P.topB.bottom&&(_.scrollTop+=P.bottom-B.bottom)}}}}},{key:"setNativeRange",value:function(_,R){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_,M=arguments.length>3&&arguments[3]!==void 0?arguments[3]:R,q=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(w.info("setNativeRange",_,R,P,M),!(_!=null&&(this.root.parentNode==null||_.parentNode==null||P.parentNode==null))){var K=document.getSelection();if(K!=null)if(_!=null){this.hasFocus()||this.root.focus();var Z=(this.getNativeRange()||{}).native;if(Z==null||q||_!==Z.startContainer||R!==Z.startOffset||P!==Z.endContainer||M!==Z.endOffset){_.tagName=="BR"&&(R=[].indexOf.call(_.parentNode.childNodes,_),_=_.parentNode),P.tagName=="BR"&&(M=[].indexOf.call(P.parentNode.childNodes,P),P=P.parentNode);var W=document.createRange();W.setStart(_,R),W.setEnd(P,M),K.removeAllRanges(),K.addRange(W)}}else K.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(_){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:j.default.sources.API;if(typeof R=="string"&&(P=R,R=!1),w.info("setRange",_),_!=null){var M=this.rangeToNative(_);this.setNativeRange.apply(this,S(M).concat([R]))}else this.setNativeRange(null);this.update(P)}},{key:"update",value:function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j.default.sources.USER,R=this.lastRange,P=this.getRange(),M=l(P,2),q=M[0],K=M[1];if(this.lastRange=q,this.lastRange!=null&&(this.savedRange=this.lastRange),!(0,g.default)(R,this.lastRange)){var Z;!this.composing&&K!=null&&K.native.collapsed&&K.start.node!==this.cursor.textNode&&this.cursor.restore();var W=[j.default.events.SELECTION_CHANGE,(0,f.default)(this.lastRange),(0,f.default)(R),_];if((Z=this.emitter).emit.apply(Z,[j.default.events.EDITOR_CHANGE].concat(W)),_!==j.default.sources.SILENT){var U;(U=this.emitter).emit.apply(U,W)}}}}]),L})();function C(L,$){try{$.parentNode}catch{return!1}return $ instanceof Text&&($=$.parentNode),L.contains($)}r.Range=E,r.default=T}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function j(p,y){for(var N=0;N0&&(u+=1),[this.parent.domNode,u]},f.prototype.value=function(){var h;return h={},h[this.statics.blotName]=this.statics.value(this.domNode)||!0,h},f.scope=d.Scope.INLINE_BLOT,f})(c.default);r.default=m}),(function(n,r,a){var l=a(11),c=a(3),d={attributes:{compose:function(x,f,h){typeof x!="object"&&(x={}),typeof f!="object"&&(f={});var g=c(!0,{},f);h||(g=Object.keys(g).reduce(function(j,p){return g[p]!=null&&(j[p]=g[p]),j},{}));for(var u in x)x[u]!==void 0&&f[u]===void 0&&(g[u]=x[u]);return Object.keys(g).length>0?g:void 0},diff:function(x,f){typeof x!="object"&&(x={}),typeof f!="object"&&(f={});var h=Object.keys(x).concat(Object.keys(f)).reduce(function(g,u){return l(x[u],f[u])||(g[u]=f[u]===void 0?null:f[u]),g},{});return Object.keys(h).length>0?h:void 0},transform:function(x,f,h){if(typeof x!="object")return f;if(typeof f=="object"){if(!h)return f;var g=Object.keys(f).reduce(function(u,j){return x[j]===void 0&&(u[j]=f[j]),u},{});return Object.keys(g).length>0?g:void 0}}},iterator:function(x){return new m(x)},length:function(x){return typeof x.delete=="number"?x.delete:typeof x.retain=="number"?x.retain:typeof x.insert=="string"?x.insert.length:1}};function m(x){this.ops=x,this.index=0,this.offset=0}m.prototype.hasNext=function(){return this.peekLength()<1/0},m.prototype.next=function(x){x||(x=1/0);var f=this.ops[this.index];if(f){var h=this.offset,g=d.length(f);if(x>=g-h?(x=g-h,this.index+=1,this.offset=0):this.offset+=x,typeof f.delete=="number")return{delete:x};var u={};return f.attributes&&(u.attributes=f.attributes),typeof f.retain=="number"?u.retain=x:typeof f.insert=="string"?u.insert=f.insert.substr(h,x):u.insert=f.insert,u}else return{retain:1/0}},m.prototype.peek=function(){return this.ops[this.index]},m.prototype.peekLength=function(){return this.ops[this.index]?d.length(this.ops[this.index])-this.offset:1/0},m.prototype.peekType=function(){return this.ops[this.index]?typeof this.ops[this.index].delete=="number"?"delete":typeof this.ops[this.index].retain=="number"?"retain":"insert":"retain"},m.prototype.rest=function(){if(this.hasNext()){if(this.offset===0)return this.ops.slice(this.index);var x=this.offset,f=this.index,h=this.next(),g=this.ops.slice(this.index);return this.offset=x,this.index=f,[h].concat(g)}else return[]},n.exports=d}),(function(n,r){var a=(function(){function l(p,y){return y!=null&&p instanceof y}var c;try{c=Map}catch{c=function(){}}var d;try{d=Set}catch{d=function(){}}var m;try{m=Promise}catch{m=function(){}}function x(p,y,N,S,A){typeof y=="object"&&(N=y.depth,S=y.prototype,A=y.includeNonEnumerable,y=y.circular);var w=[],E=[],T=typeof Buffer<"u";typeof y>"u"&&(y=!0),typeof N>"u"&&(N=1/0);function C(L,$){if(L===null)return null;if($===0)return L;var _,R;if(typeof L!="object")return L;if(l(L,c))_=new c;else if(l(L,d))_=new d;else if(l(L,m))_=new m(function(B,D){L.then(function(O){B(C(O,$-1))},function(O){D(C(O,$-1))})});else if(x.__isArray(L))_=[];else if(x.__isRegExp(L))_=new RegExp(L.source,j(L)),L.lastIndex&&(_.lastIndex=L.lastIndex);else if(x.__isDate(L))_=new Date(L.getTime());else{if(T&&Buffer.isBuffer(L))return Buffer.allocUnsafe?_=Buffer.allocUnsafe(L.length):_=new Buffer(L.length),L.copy(_),_;l(L,Error)?_=Object.create(L):typeof S>"u"?(R=Object.getPrototypeOf(L),_=Object.create(R)):(_=Object.create(S),R=S)}if(y){var P=w.indexOf(L);if(P!=-1)return E[P];w.push(L),E.push(_)}l(L,c)&&L.forEach(function(B,D){var O=C(D,$-1),z=C(B,$-1);_.set(O,z)}),l(L,d)&&L.forEach(function(B){var D=C(B,$-1);_.add(D)});for(var M in L){var q;R&&(q=Object.getOwnPropertyDescriptor(R,M)),!(q&&q.set==null)&&(_[M]=C(L[M],$-1))}if(Object.getOwnPropertySymbols)for(var K=Object.getOwnPropertySymbols(L),M=0;M0){if(W instanceof g.BlockEmbed||D instanceof g.BlockEmbed){this.optimize();return}if(W instanceof N.default){var O=W.newlineIndex(W.length(),!0);if(O>-1&&(W=W.split(O+1),W===D)){this.optimize();return}}else if(D instanceof N.default){var z=D.newlineIndex(0);z>-1&&D.split(z+1)}var G=D.children.head instanceof p.default?null:D.children.head;W.moveChildren(D,G),W.remove()}this.optimize()}},{key:"enable",value:function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.domNode.setAttribute("contenteditable",M)}},{key:"formatAt",value:function(M,q,K,Z){this.whitelist!=null&&!this.whitelist[K]||(d(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"formatAt",this).call(this,M,q,K,Z),this.optimize())}},{key:"insertAt",value:function(M,q,K){if(!(K!=null&&this.whitelist!=null&&!this.whitelist[q])){if(M>=this.length())if(K==null||x.default.query(q,x.default.Scope.BLOCK)==null){var Z=x.default.create(this.statics.defaultChild);this.appendChild(Z),K==null&&q.endsWith(` +`)&&(q=q.slice(0,-1)),Z.insertAt(0,q,K)}else{var W=x.default.create(q,K);this.appendChild(W)}else d(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"insertAt",this).call(this,M,q,K);this.optimize()}}},{key:"insertBefore",value:function(M,q){if(M.statics.scope===x.default.Scope.INLINE_BLOT){var K=x.default.create(this.statics.defaultChild);K.appendChild(M),M=K}d(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"insertBefore",this).call(this,M,q)}},{key:"leaf",value:function(M){return this.path(M).pop()||[null,-1]}},{key:"line",value:function(M){return M===this.length()?this.line(M-1):this.descendant(L,M)}},{key:"lines",value:function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE,K=function Z(W,U,F){var B=[],D=F;return W.children.forEachAt(U,F,function(O,z,G){L(O)?B.push(O):O instanceof x.default.Container&&(B=B.concat(Z(O,z,D))),D-=G}),B};return K(this,M,q)}},{key:"optimize",value:function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.batch!==!0&&(d(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"optimize",this).call(this,M,q),M.length>0&&this.emitter.emit(h.default.events.SCROLL_OPTIMIZE,M,q))}},{key:"path",value:function(M){return d(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"path",this).call(this,M).slice(1)}},{key:"update",value:function(M){if(this.batch!==!0){var q=h.default.sources.USER;typeof M=="string"&&(q=M),Array.isArray(M)||(M=this.observer.takeRecords()),M.length>0&&this.emitter.emit(h.default.events.SCROLL_BEFORE_UPDATE,q,M),d(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"update",this).call(this,M.concat([])),M.length>0&&this.emitter.emit(h.default.events.SCROLL_UPDATE,q,M)}}}]),R})(x.default.Scroll);$.blotName="scroll",$.className="ql-editor",$.tagName="DIV",$.defaultChild="block",$.allowedChildren=[u.default,g.BlockEmbed,A.default],r.default=$}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.SHORTKEY=r.default=void 0;var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(V){return typeof V}:function(V){return V&&typeof Symbol=="function"&&V.constructor===Symbol&&V!==Symbol.prototype?"symbol":typeof V},c=(function(){function V(X,ne){var oe=[],re=!0,ge=!1,ve=void 0;try{for(var Se=X[Symbol.iterator](),We;!(re=(We=Se.next()).done)&&(oe.push(We.value),!(ne&&oe.length===ne));re=!0);}catch(Ce){ge=!0,ve=Ce}finally{try{!re&&Se.return&&Se.return()}finally{if(ge)throw ve}}return oe}return function(X,ne){if(Array.isArray(X))return X;if(Symbol.iterator in Object(X))return V(X,ne);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=(function(){function V(X,ne){for(var oe=0;oe1&&arguments[1]!==void 0?arguments[1]:{},ge=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ve=Y(oe);if(ve==null||ve.key==null)return K.warn("Attempted to add invalid keyboard binding",ve);typeof re=="function"&&(re={handler:re}),typeof ge=="function"&&(ge={handler:ge}),ve=(0,u.default)(ve,re,ge),this.bindings[ve.key]=this.bindings[ve.key]||[],this.bindings[ve.key].push(ve)}},{key:"listen",value:function(){var oe=this;this.quill.root.addEventListener("keydown",function(re){if(!re.defaultPrevented){var ge=re.which||re.keyCode,ve=(oe.bindings[ge]||[]).filter(function(Rt){return X.match(re,Rt)});if(ve.length!==0){var Se=oe.quill.getSelection();if(!(Se==null||!oe.quill.hasFocus())){var We=oe.quill.getLine(Se.index),Ce=c(We,2),fe=Ce[0],Ye=Ce[1],be=oe.quill.getLeaf(Se.index),Pe=c(be,2),ke=Pe[0],qe=Pe[1],Ve=Se.length===0?[ke,qe]:oe.quill.getLeaf(Se.index+Se.length),dt=c(Ve,2),xt=dt[0],ye=dt[1],le=ke instanceof A.default.Text?ke.value().slice(0,qe):"",Qe=xt instanceof A.default.Text?xt.value().slice(ye):"",rt={collapsed:Se.length===0,empty:Se.length===0&&fe.length()<=1,format:oe.quill.getFormat(Se),offset:Ye,prefix:le,suffix:Qe},Gt=ve.some(function(Rt){if(Rt.collapsed!=null&&Rt.collapsed!==rt.collapsed||Rt.empty!=null&&Rt.empty!==rt.empty||Rt.offset!=null&&Rt.offset!==rt.offset)return!1;if(Array.isArray(Rt.format)){if(Rt.format.every(function(Re){return rt.format[Re]==null}))return!1}else if(l(Rt.format)==="object"&&!Object.keys(Rt.format).every(function(Re){return Rt.format[Re]===!0?rt.format[Re]!=null:Rt.format[Re]===!1?rt.format[Re]==null:(0,h.default)(Rt.format[Re],rt.format[Re])}))return!1;return Rt.prefix!=null&&!Rt.prefix.test(rt.prefix)||Rt.suffix!=null&&!Rt.suffix.test(rt.suffix)?!1:Rt.handler.call(oe,Se,rt)!==!0});Gt&&re.preventDefault()}}}})}}]),X})($.default);W.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},W.DEFAULTS={bindings:{bold:G("bold"),italic:G("italic"),underline:G("underline"),indent:{key:W.keys.TAB,format:["blockquote","indent","list"],handler:function(X,ne){if(ne.collapsed&&ne.offset!==0)return!0;this.quill.format("indent","+1",E.default.sources.USER)}},outdent:{key:W.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(X,ne){if(ne.collapsed&&ne.offset!==0)return!0;this.quill.format("indent","-1",E.default.sources.USER)}},"outdent backspace":{key:W.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(X,ne){ne.format.indent!=null?this.quill.format("indent","-1",E.default.sources.USER):ne.format.list!=null&&this.quill.format("list",!1,E.default.sources.USER)}},"indent code-block":z(!0),"outdent code-block":z(!1),"remove tab":{key:W.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(X){this.quill.deleteText(X.index-1,1,E.default.sources.USER)}},tab:{key:W.keys.TAB,handler:function(X){this.quill.history.cutoff();var ne=new p.default().retain(X.index).delete(X.length).insert(" ");this.quill.updateContents(ne,E.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(X.index+1,E.default.sources.SILENT)}},"list empty enter":{key:W.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(X,ne){this.quill.format("list",!1,E.default.sources.USER),ne.format.indent&&this.quill.format("indent",!1,E.default.sources.USER)}},"checklist enter":{key:W.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(X){var ne=this.quill.getLine(X.index),oe=c(ne,2),re=oe[0],ge=oe[1],ve=(0,u.default)({},re.formats(),{list:"checked"}),Se=new p.default().retain(X.index).insert(` +`,ve).retain(re.length()-ge-1).retain(1,{list:"unchecked"});this.quill.updateContents(Se,E.default.sources.USER),this.quill.setSelection(X.index+1,E.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:W.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(X,ne){var oe=this.quill.getLine(X.index),re=c(oe,2),ge=re[0],ve=re[1],Se=new p.default().retain(X.index).insert(` +`,ne.format).retain(ge.length()-ve-1).retain(1,{header:null});this.quill.updateContents(Se,E.default.sources.USER),this.quill.setSelection(X.index+1,E.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(X,ne){var oe=ne.prefix.length,re=this.quill.getLine(X.index),ge=c(re,2),ve=ge[0],Se=ge[1];if(Se>oe)return!0;var We=void 0;switch(ne.prefix.trim()){case"[]":case"[ ]":We="unchecked";break;case"[x]":We="checked";break;case"-":case"*":We="bullet";break;default:We="ordered"}this.quill.insertText(X.index," ",E.default.sources.USER),this.quill.history.cutoff();var Ce=new p.default().retain(X.index-Se).delete(oe+1).retain(ve.length()-2-Se).retain(1,{list:We});this.quill.updateContents(Ce,E.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(X.index-oe,E.default.sources.SILENT)}},"code exit":{key:W.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(X){var ne=this.quill.getLine(X.index),oe=c(ne,2),re=oe[0],ge=oe[1],ve=new p.default().retain(X.index+re.length()-ge-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(ve,E.default.sources.USER)}},"embed left":U(W.keys.LEFT,!1),"embed left shift":U(W.keys.LEFT,!0),"embed right":U(W.keys.RIGHT,!1),"embed right shift":U(W.keys.RIGHT,!0)}};function U(V,X){var ne,oe=V===W.keys.LEFT?"prefix":"suffix";return ne={key:V,shiftKey:X,altKey:null},R(ne,oe,/^$/),R(ne,"handler",function(ge){var ve=ge.index;V===W.keys.RIGHT&&(ve+=ge.length+1);var Se=this.quill.getLeaf(ve),We=c(Se,1),Ce=We[0];return Ce instanceof A.default.Embed?(V===W.keys.LEFT?X?this.quill.setSelection(ge.index-1,ge.length+1,E.default.sources.USER):this.quill.setSelection(ge.index-1,E.default.sources.USER):X?this.quill.setSelection(ge.index,ge.length+1,E.default.sources.USER):this.quill.setSelection(ge.index+ge.length+1,E.default.sources.USER),!1):!0}),ne}function F(V,X){if(!(V.index===0||this.quill.getLength()<=1)){var ne=this.quill.getLine(V.index),oe=c(ne,1),re=oe[0],ge={};if(X.offset===0){var ve=this.quill.getLine(V.index-1),Se=c(ve,1),We=Se[0];if(We!=null&&We.length()>1){var Ce=re.formats(),fe=this.quill.getFormat(V.index-1,1);ge=N.default.attributes.diff(Ce,fe)||{}}}var Ye=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(X.prefix)?2:1;this.quill.deleteText(V.index-Ye,Ye,E.default.sources.USER),Object.keys(ge).length>0&&this.quill.formatLine(V.index-Ye,Ye,ge,E.default.sources.USER),this.quill.focus()}}function B(V,X){var ne=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(X.suffix)?2:1;if(!(V.index>=this.quill.getLength()-ne)){var oe={},re=0,ge=this.quill.getLine(V.index),ve=c(ge,1),Se=ve[0];if(X.offset>=Se.length()-1){var We=this.quill.getLine(V.index+1),Ce=c(We,1),fe=Ce[0];if(fe){var Ye=Se.formats(),be=this.quill.getFormat(V.index,1);oe=N.default.attributes.diff(Ye,be)||{},re=fe.length()}}this.quill.deleteText(V.index,ne,E.default.sources.USER),Object.keys(oe).length>0&&this.quill.formatLine(V.index+re-1,ne,oe,E.default.sources.USER)}}function D(V){var X=this.quill.getLines(V),ne={};if(X.length>1){var oe=X[0].formats(),re=X[X.length-1].formats();ne=N.default.attributes.diff(re,oe)||{}}this.quill.deleteText(V,E.default.sources.USER),Object.keys(ne).length>0&&this.quill.formatLine(V.index,1,ne,E.default.sources.USER),this.quill.setSelection(V.index,E.default.sources.SILENT),this.quill.focus()}function O(V,X){var ne=this;V.length>0&&this.quill.scroll.deleteAt(V.index,V.length);var oe=Object.keys(X.format).reduce(function(re,ge){return A.default.query(ge,A.default.Scope.BLOCK)&&!Array.isArray(X.format[ge])&&(re[ge]=X.format[ge]),re},{});this.quill.insertText(V.index,` +`,oe,E.default.sources.USER),this.quill.setSelection(V.index+1,E.default.sources.SILENT),this.quill.focus(),Object.keys(X.format).forEach(function(re){oe[re]==null&&(Array.isArray(X.format[re])||re!=="link"&&ne.quill.format(re,X.format[re],E.default.sources.USER))})}function z(V){return{key:W.keys.TAB,shiftKey:!V,format:{"code-block":!0},handler:function(ne){var oe=A.default.query("code-block"),re=ne.index,ge=ne.length,ve=this.quill.scroll.descendant(oe,re),Se=c(ve,2),We=Se[0],Ce=Se[1];if(We!=null){var fe=this.quill.getIndex(We),Ye=We.newlineIndex(Ce,!0)+1,be=We.newlineIndex(fe+Ce+ge),Pe=We.domNode.textContent.slice(Ye,be).split(` +`);Ce=0,Pe.forEach(function(ke,qe){V?(We.insertAt(Ye+Ce,oe.TAB),Ce+=oe.TAB.length,qe===0?re+=oe.TAB.length:ge+=oe.TAB.length):ke.startsWith(oe.TAB)&&(We.deleteAt(Ye+Ce,oe.TAB.length),Ce-=oe.TAB.length,qe===0?re-=oe.TAB.length:ge-=oe.TAB.length),Ce+=ke.length+1}),this.quill.update(E.default.sources.USER),this.quill.setSelection(re,ge,E.default.sources.SILENT)}}}}function G(V){return{key:V[0].toUpperCase(),shortKey:!0,handler:function(ne,oe){this.quill.format(V,!oe.format[V],E.default.sources.USER)}}}function Y(V){if(typeof V=="string"||typeof V=="number")return Y({key:V});if((typeof V>"u"?"undefined":l(V))==="object"&&(V=(0,x.default)(V,!1)),typeof V.key=="string")if(W.keys[V.key.toUpperCase()]!=null)V.key=W.keys[V.key.toUpperCase()];else if(V.key.length===1)V.key=V.key.toUpperCase().charCodeAt(0);else return null;return V.shortKey&&(V[Z]=V.shortKey,delete V.shortKey),V}r.default=W,r.SHORTKEY=Z}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function N(S,A){var w=[],E=!0,T=!1,C=void 0;try{for(var L=S[Symbol.iterator](),$;!(E=($=L.next()).done)&&(w.push($.value),!(A&&w.length===A));E=!0);}catch(_){T=!0,C=_}finally{try{!E&&L.return&&L.return()}finally{if(T)throw C}}return w}return function(S,A){if(Array.isArray(S))return S;if(Symbol.iterator in Object(S))return N(S,A);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),c=function N(S,A,w){S===null&&(S=Function.prototype);var E=Object.getOwnPropertyDescriptor(S,A);if(E===void 0){var T=Object.getPrototypeOf(S);return T===null?void 0:N(T,A,w)}else{if("value"in E)return E.value;var C=E.get;return C===void 0?void 0:C.call(w)}},d=(function(){function N(S,A){for(var w=0;w-1}r.default=u,r.sanitize=j}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},c=(function(){function y(N,S){for(var A=0;A1&&arguments[1]!==void 0?arguments[1]:!1,w=this.container.querySelector(".ql-selected");if(S!==w&&(w!=null&&w.classList.remove("ql-selected"),S!=null&&(S.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(S.parentNode.children,S),S.hasAttribute("data-value")?this.label.setAttribute("data-value",S.getAttribute("data-value")):this.label.removeAttribute("data-value"),S.hasAttribute("data-label")?this.label.setAttribute("data-label",S.getAttribute("data-label")):this.label.removeAttribute("data-label"),A))){if(typeof Event=="function")this.select.dispatchEvent(new Event("change"));else if((typeof Event>"u"?"undefined":l(Event))==="object"){var E=document.createEvent("Event");E.initEvent("change",!0,!0),this.select.dispatchEvent(E)}this.close()}}},{key:"update",value:function(){var S=void 0;if(this.select.selectedIndex>-1){var A=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];S=this.select.options[this.select.selectedIndex],this.selectItem(A)}else this.selectItem(null);var w=S!=null&&S!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",w)}}]),y})();r.default=p}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=a(0),c=K(l),d=a(5),m=K(d),x=a(4),f=K(x),h=a(16),g=K(h),u=a(25),j=K(u),p=a(24),y=K(p),N=a(35),S=K(N),A=a(6),w=K(A),E=a(22),T=K(E),C=a(7),L=K(C),$=a(55),_=K($),R=a(42),P=K(R),M=a(23),q=K(M);function K(Z){return Z&&Z.__esModule?Z:{default:Z}}m.default.register({"blots/block":f.default,"blots/block/embed":x.BlockEmbed,"blots/break":g.default,"blots/container":j.default,"blots/cursor":y.default,"blots/embed":S.default,"blots/inline":w.default,"blots/scroll":T.default,"blots/text":L.default,"modules/clipboard":_.default,"modules/history":P.default,"modules/keyboard":q.default}),c.default.register(f.default,g.default,y.default,w.default,T.default,L.default),r.default=m.default}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=a(1),c=(function(){function d(m){this.domNode=m,this.domNode[l.DATA_KEY]={blot:this}}return Object.defineProperty(d.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),d.create=function(m){if(this.tagName==null)throw new l.ParchmentError("Blot definition missing tagName");var x;return Array.isArray(this.tagName)?(typeof m=="string"&&(m=m.toUpperCase(),parseInt(m).toString()===m&&(m=parseInt(m))),typeof m=="number"?x=document.createElement(this.tagName[m-1]):this.tagName.indexOf(m)>-1?x=document.createElement(m):x=document.createElement(this.tagName[0])):x=document.createElement(this.tagName),this.className&&x.classList.add(this.className),x},d.prototype.attach=function(){this.parent!=null&&(this.scroll=this.parent.scroll)},d.prototype.clone=function(){var m=this.domNode.cloneNode(!1);return l.create(m)},d.prototype.detach=function(){this.parent!=null&&this.parent.removeChild(this),delete this.domNode[l.DATA_KEY]},d.prototype.deleteAt=function(m,x){var f=this.isolate(m,x);f.remove()},d.prototype.formatAt=function(m,x,f,h){var g=this.isolate(m,x);if(l.query(f,l.Scope.BLOT)!=null&&h)g.wrap(f,h);else if(l.query(f,l.Scope.ATTRIBUTE)!=null){var u=l.create(this.statics.scope);g.wrap(u),u.format(f,h)}},d.prototype.insertAt=function(m,x,f){var h=f==null?l.create("text",x):l.create(x,f),g=this.split(m);this.parent.insertBefore(h,g)},d.prototype.insertInto=function(m,x){x===void 0&&(x=null),this.parent!=null&&this.parent.children.remove(this);var f=null;m.children.insertBefore(this,x),x!=null&&(f=x.domNode),(this.domNode.parentNode!=m.domNode||this.domNode.nextSibling!=f)&&m.domNode.insertBefore(this.domNode,f),this.parent=m,this.attach()},d.prototype.isolate=function(m,x){var f=this.split(m);return f.split(x),f},d.prototype.length=function(){return 1},d.prototype.offset=function(m){return m===void 0&&(m=this.parent),this.parent==null||this==m?0:this.parent.children.offset(this)+this.parent.offset(m)},d.prototype.optimize=function(m){this.domNode[l.DATA_KEY]!=null&&delete this.domNode[l.DATA_KEY].mutations},d.prototype.remove=function(){this.domNode.parentNode!=null&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},d.prototype.replace=function(m){m.parent!=null&&(m.parent.insertBefore(this,m.next),m.remove())},d.prototype.replaceWith=function(m,x){var f=typeof m=="string"?l.create(m,x):m;return f.replace(this),f},d.prototype.split=function(m,x){return m===0?this:this.next},d.prototype.update=function(m,x){},d.prototype.wrap=function(m,x){var f=typeof m=="string"?l.create(m,x):m;return this.parent!=null&&this.parent.insertBefore(f,this.next),f.appendChild(this),f},d.blotName="abstract",d})();r.default=c}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=a(12),c=a(32),d=a(33),m=a(1),x=(function(){function f(h){this.attributes={},this.domNode=h,this.build()}return f.prototype.attribute=function(h,g){g?h.add(this.domNode,g)&&(h.value(this.domNode)!=null?this.attributes[h.attrName]=h:delete this.attributes[h.attrName]):(h.remove(this.domNode),delete this.attributes[h.attrName])},f.prototype.build=function(){var h=this;this.attributes={};var g=l.default.keys(this.domNode),u=c.default.keys(this.domNode),j=d.default.keys(this.domNode);g.concat(u).concat(j).forEach(function(p){var y=m.query(p,m.Scope.ATTRIBUTE);y instanceof l.default&&(h.attributes[y.attrName]=y)})},f.prototype.copy=function(h){var g=this;Object.keys(this.attributes).forEach(function(u){var j=g.attributes[u].value(g.domNode);h.format(u,j)})},f.prototype.move=function(h){var g=this;this.copy(h),Object.keys(this.attributes).forEach(function(u){g.attributes[u].remove(g.domNode)}),this.attributes={}},f.prototype.values=function(){var h=this;return Object.keys(this.attributes).reduce(function(g,u){return g[u]=h.attributes[u].value(h.domNode),g},{})},f})();r.default=x}),(function(n,r,a){var l=this&&this.__extends||(function(){var x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,h){f.__proto__=h}||function(f,h){for(var g in h)h.hasOwnProperty(g)&&(f[g]=h[g])};return function(f,h){x(f,h);function g(){this.constructor=f}f.prototype=h===null?Object.create(h):(g.prototype=h.prototype,new g)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(12);function d(x,f){var h=x.getAttribute("class")||"";return h.split(/\s+/).filter(function(g){return g.indexOf(f+"-")===0})}var m=(function(x){l(f,x);function f(){return x!==null&&x.apply(this,arguments)||this}return f.keys=function(h){return(h.getAttribute("class")||"").split(/\s+/).map(function(g){return g.split("-").slice(0,-1).join("-")})},f.prototype.add=function(h,g){return this.canAdd(h,g)?(this.remove(h),h.classList.add(this.keyName+"-"+g),!0):!1},f.prototype.remove=function(h){var g=d(h,this.keyName);g.forEach(function(u){h.classList.remove(u)}),h.classList.length===0&&h.removeAttribute("class")},f.prototype.value=function(h){var g=d(h,this.keyName)[0]||"",u=g.slice(this.keyName.length+1);return this.canAdd(h,u)?u:""},f})(c.default);r.default=m}),(function(n,r,a){var l=this&&this.__extends||(function(){var x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,h){f.__proto__=h}||function(f,h){for(var g in h)h.hasOwnProperty(g)&&(f[g]=h[g])};return function(f,h){x(f,h);function g(){this.constructor=f}f.prototype=h===null?Object.create(h):(g.prototype=h.prototype,new g)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(12);function d(x){var f=x.split("-"),h=f.slice(1).map(function(g){return g[0].toUpperCase()+g.slice(1)}).join("");return f[0]+h}var m=(function(x){l(f,x);function f(){return x!==null&&x.apply(this,arguments)||this}return f.keys=function(h){return(h.getAttribute("style")||"").split(";").map(function(g){var u=g.split(":");return u[0].trim()})},f.prototype.add=function(h,g){return this.canAdd(h,g)?(h.style[d(this.keyName)]=g,!0):!1},f.prototype.remove=function(h){h.style[d(this.keyName)]="",h.getAttribute("style")||h.removeAttribute("style")},f.prototype.value=function(h){var g=h.style[d(this.keyName)];return this.canAdd(h,g)?g:""},f})(c.default);r.default=m}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function m(x,f){for(var h=0;h$&&this.stack.undo.length>0){var _=this.stack.undo.pop();L=L.compose(_.undo),T=_.redo.compose(T)}else this.lastRecorded=$;this.stack.undo.push({redo:T,undo:L}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(T){this.stack.undo.forEach(function(C){C.undo=T.transform(C.undo,!0),C.redo=T.transform(C.redo,!0)}),this.stack.redo.forEach(function(C){C.undo=T.transform(C.undo,!0),C.redo=T.transform(C.redo,!0)})}},{key:"undo",value:function(){this.change("undo","redo")}}]),w})(h.default);y.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1};function N(A){var w=A.ops[A.ops.length-1];return w==null?!1:w.insert!=null?typeof w.insert=="string"&&w.insert.endsWith(` +`):w.attributes!=null?Object.keys(w.attributes).some(function(E){return d.default.query(E,d.default.Scope.BLOCK)!=null}):!1}function S(A){var w=A.reduce(function(T,C){return T+=C.delete||0,T},0),E=A.length()-w;return N(A)&&(E-=1),E}r.default=y,r.getLastChangeIndex=S}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.BaseTooltip=void 0;var l=(function(){function O(z,G){for(var Y=0;Y0&&arguments[0]!==void 0?arguments[0]:"link",V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),V!=null?this.textbox.value=V:Y!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+Y)||""),this.root.setAttribute("data-mode",Y)}},{key:"restoreFocus",value:function(){var Y=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=Y}},{key:"save",value:function(){var Y=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":{var V=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",Y,g.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",Y,g.default.sources.USER)),this.quill.root.scrollTop=V;break}case"video":Y=B(Y);case"formula":{if(!Y)break;var X=this.quill.getSelection(!0);if(X!=null){var ne=X.index+X.length;this.quill.insertEmbed(ne,this.root.getAttribute("data-mode"),Y,g.default.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(ne+1," ",g.default.sources.USER),this.quill.setSelection(ne+2,g.default.sources.USER)}break}}this.textbox.value="",this.hide()}}]),z})(L.default);function B(O){var z=O.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||O.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return z?(z[1]||"https")+"://www.youtube.com/embed/"+z[2]+"?showinfo=0":(z=O.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(z[1]||"https")+"://player.vimeo.com/video/"+z[2]+"/":O}function D(O,z){var G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;z.forEach(function(Y){var V=document.createElement("option");Y===G?V.setAttribute("selected","selected"):V.setAttribute("value",Y),O.appendChild(V)})}r.BaseTooltip=F,r.default=U}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function c(){this.head=this.tail=null,this.length=0}return c.prototype.append=function(){for(var d=[],m=0;m1&&this.append.apply(this,d.slice(1))},c.prototype.contains=function(d){for(var m,x=this.iterator();m=x();)if(m===d)return!0;return!1},c.prototype.insertBefore=function(d,m){d&&(d.next=m,m!=null?(d.prev=m.prev,m.prev!=null&&(m.prev.next=d),m.prev=d,m===this.head&&(this.head=d)):this.tail!=null?(this.tail.next=d,d.prev=this.tail,this.tail=d):(d.prev=null,this.head=this.tail=d),this.length+=1)},c.prototype.offset=function(d){for(var m=0,x=this.head;x!=null;){if(x===d)return m;m+=x.length(),x=x.next}return-1},c.prototype.remove=function(d){this.contains(d)&&(d.prev!=null&&(d.prev.next=d.next),d.next!=null&&(d.next.prev=d.prev),d===this.head&&(this.head=d.next),d===this.tail&&(this.tail=d.prev),this.length-=1)},c.prototype.iterator=function(d){return d===void 0&&(d=this.head),function(){var m=d;return d!=null&&(d=d.next),m}},c.prototype.find=function(d,m){m===void 0&&(m=!1);for(var x,f=this.iterator();x=f();){var h=x.length();if(dj?x(u,d-j,Math.min(m,j+y-d)):x(u,0,Math.min(y,d+m-j)),j+=y}},c.prototype.map=function(d){return this.reduce(function(m,x){return m.push(d(x)),m},[])},c.prototype.reduce=function(d,m){for(var x,f=this.iterator();x=f();)m=d(m,x);return m},c})();r.default=l}),(function(n,r,a){var l=this&&this.__extends||(function(){var h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,u){g.__proto__=u}||function(g,u){for(var j in u)u.hasOwnProperty(j)&&(g[j]=u[j])};return function(g,u){h(g,u);function j(){this.constructor=g}g.prototype=u===null?Object.create(u):(j.prototype=u.prototype,new j)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(17),d=a(1),m={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},x=100,f=(function(h){l(g,h);function g(u){var j=h.call(this,u)||this;return j.scroll=j,j.observer=new MutationObserver(function(p){j.update(p)}),j.observer.observe(j.domNode,m),j.attach(),j}return g.prototype.detach=function(){h.prototype.detach.call(this),this.observer.disconnect()},g.prototype.deleteAt=function(u,j){this.update(),u===0&&j===this.length()?this.children.forEach(function(p){p.remove()}):h.prototype.deleteAt.call(this,u,j)},g.prototype.formatAt=function(u,j,p,y){this.update(),h.prototype.formatAt.call(this,u,j,p,y)},g.prototype.insertAt=function(u,j,p){this.update(),h.prototype.insertAt.call(this,u,j,p)},g.prototype.optimize=function(u,j){var p=this;u===void 0&&(u=[]),j===void 0&&(j={}),h.prototype.optimize.call(this,j);for(var y=[].slice.call(this.observer.takeRecords());y.length>0;)u.push(y.pop());for(var N=function(E,T){T===void 0&&(T=!0),!(E==null||E===p)&&E.domNode.parentNode!=null&&(E.domNode[d.DATA_KEY].mutations==null&&(E.domNode[d.DATA_KEY].mutations=[]),T&&N(E.parent))},S=function(E){E.domNode[d.DATA_KEY]==null||E.domNode[d.DATA_KEY].mutations==null||(E instanceof c.default&&E.children.forEach(S),E.optimize(j))},A=u,w=0;A.length>0;w+=1){if(w>=x)throw new Error("[Parchment] Maximum optimize iterations reached");for(A.forEach(function(E){var T=d.find(E.target,!0);T!=null&&(T.domNode===E.target&&(E.type==="childList"?(N(d.find(E.previousSibling,!1)),[].forEach.call(E.addedNodes,function(C){var L=d.find(C,!1);N(L,!1),L instanceof c.default&&L.children.forEach(function($){N($,!1)})})):E.type==="attributes"&&N(T.prev)),N(T))}),this.children.forEach(S),A=[].slice.call(this.observer.takeRecords()),y=A.slice();y.length>0;)u.push(y.pop())}},g.prototype.update=function(u,j){var p=this;j===void 0&&(j={}),u=u||this.observer.takeRecords(),u.map(function(y){var N=d.find(y.target,!0);return N==null?null:N.domNode[d.DATA_KEY].mutations==null?(N.domNode[d.DATA_KEY].mutations=[y],N):(N.domNode[d.DATA_KEY].mutations.push(y),null)}).forEach(function(y){y==null||y===p||y.domNode[d.DATA_KEY]==null||y.update(y.domNode[d.DATA_KEY].mutations||[],j)}),this.domNode[d.DATA_KEY].mutations!=null&&h.prototype.update.call(this,this.domNode[d.DATA_KEY].mutations,j),this.optimize(u,j)},g.blotName="scroll",g.defaultChild="block",g.scope=d.Scope.BLOCK_BLOT,g.tagName="DIV",g})(c.default);r.default=f}),(function(n,r,a){var l=this&&this.__extends||(function(){var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,g){h.__proto__=g}||function(h,g){for(var u in g)g.hasOwnProperty(u)&&(h[u]=g[u])};return function(h,g){f(h,g);function u(){this.constructor=h}h.prototype=g===null?Object.create(g):(u.prototype=g.prototype,new u)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(18),d=a(1);function m(f,h){if(Object.keys(f).length!==Object.keys(h).length)return!1;for(var g in f)if(f[g]!==h[g])return!1;return!0}var x=(function(f){l(h,f);function h(){return f!==null&&f.apply(this,arguments)||this}return h.formats=function(g){if(g.tagName!==h.tagName)return f.formats.call(this,g)},h.prototype.format=function(g,u){var j=this;g===this.statics.blotName&&!u?(this.children.forEach(function(p){p instanceof c.default||(p=p.wrap(h.blotName,!0)),j.attributes.copy(p)}),this.unwrap()):f.prototype.format.call(this,g,u)},h.prototype.formatAt=function(g,u,j,p){if(this.formats()[j]!=null||d.query(j,d.Scope.ATTRIBUTE)){var y=this.isolate(g,u);y.format(j,p)}else f.prototype.formatAt.call(this,g,u,j,p)},h.prototype.optimize=function(g){f.prototype.optimize.call(this,g);var u=this.formats();if(Object.keys(u).length===0)return this.unwrap();var j=this.next;j instanceof h&&j.prev===this&&m(u,j.formats())&&(j.moveChildren(this),j.remove())},h.blotName="inline",h.scope=d.Scope.INLINE_BLOT,h.tagName="SPAN",h})(c.default);r.default=x}),(function(n,r,a){var l=this&&this.__extends||(function(){var x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,h){f.__proto__=h}||function(f,h){for(var g in h)h.hasOwnProperty(g)&&(f[g]=h[g])};return function(f,h){x(f,h);function g(){this.constructor=f}f.prototype=h===null?Object.create(h):(g.prototype=h.prototype,new g)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(18),d=a(1),m=(function(x){l(f,x);function f(){return x!==null&&x.apply(this,arguments)||this}return f.formats=function(h){var g=d.query(f.blotName).tagName;if(h.tagName!==g)return x.formats.call(this,h)},f.prototype.format=function(h,g){d.query(h,d.Scope.BLOCK)!=null&&(h===this.statics.blotName&&!g?this.replaceWith(f.blotName):x.prototype.format.call(this,h,g))},f.prototype.formatAt=function(h,g,u,j){d.query(u,d.Scope.BLOCK)!=null?this.format(u,j):x.prototype.formatAt.call(this,h,g,u,j)},f.prototype.insertAt=function(h,g,u){if(u==null||d.query(g,d.Scope.INLINE)!=null)x.prototype.insertAt.call(this,h,g,u);else{var j=this.split(h),p=d.create(g,u);j.parent.insertBefore(p,j)}},f.prototype.update=function(h,g){navigator.userAgent.match(/Trident/)?this.build():x.prototype.update.call(this,h,g)},f.blotName="block",f.scope=d.Scope.BLOCK_BLOT,f.tagName="P",f})(c.default);r.default=m}),(function(n,r,a){var l=this&&this.__extends||(function(){var m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,f){x.__proto__=f}||function(x,f){for(var h in f)f.hasOwnProperty(h)&&(x[h]=f[h])};return function(x,f){m(x,f);function h(){this.constructor=x}x.prototype=f===null?Object.create(f):(h.prototype=f.prototype,new h)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(19),d=(function(m){l(x,m);function x(){return m!==null&&m.apply(this,arguments)||this}return x.formats=function(f){},x.prototype.format=function(f,h){m.prototype.formatAt.call(this,0,this.length(),f,h)},x.prototype.formatAt=function(f,h,g,u){f===0&&h===this.length()?this.format(g,u):m.prototype.formatAt.call(this,f,h,g,u)},x.prototype.formats=function(){return this.statics.formats(this.domNode)},x})(c.default);r.default=d}),(function(n,r,a){var l=this&&this.__extends||(function(){var x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,h){f.__proto__=h}||function(f,h){for(var g in h)h.hasOwnProperty(g)&&(f[g]=h[g])};return function(f,h){x(f,h);function g(){this.constructor=f}f.prototype=h===null?Object.create(h):(g.prototype=h.prototype,new g)}})();Object.defineProperty(r,"__esModule",{value:!0});var c=a(19),d=a(1),m=(function(x){l(f,x);function f(h){var g=x.call(this,h)||this;return g.text=g.statics.value(g.domNode),g}return f.create=function(h){return document.createTextNode(h)},f.value=function(h){var g=h.data;return g.normalize&&(g=g.normalize()),g},f.prototype.deleteAt=function(h,g){this.domNode.data=this.text=this.text.slice(0,h)+this.text.slice(h+g)},f.prototype.index=function(h,g){return this.domNode===h?g:-1},f.prototype.insertAt=function(h,g,u){u==null?(this.text=this.text.slice(0,h)+g+this.text.slice(h),this.domNode.data=this.text):x.prototype.insertAt.call(this,h,g,u)},f.prototype.length=function(){return this.text.length},f.prototype.optimize=function(h){x.prototype.optimize.call(this,h),this.text=this.statics.value(this.domNode),this.text.length===0?this.remove():this.next instanceof f&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},f.prototype.position=function(h,g){return[this.domNode,h]},f.prototype.split=function(h,g){if(g===void 0&&(g=!1),!g){if(h===0)return this;if(h===this.length())return this.next}var u=d.create(this.domNode.splitText(h));return this.parent.insertBefore(u,this.next),this.text=this.statics.value(this.domNode),u},f.prototype.update=function(h,g){var u=this;h.some(function(j){return j.type==="characterData"&&j.target===u.domNode})&&(this.text=this.statics.value(this.domNode))},f.prototype.value=function(){return this.text},f.blotName="text",f.scope=d.Scope.INLINE_BLOT,f})(c.default);r.default=m}),(function(n,r,a){var l=document.createElement("div");if(l.classList.toggle("test-class",!1),l.classList.contains("test-class")){var c=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(d,m){return arguments.length>1&&!this.contains(d)==!m?m:c.call(this,d)}}String.prototype.startsWith||(String.prototype.startsWith=function(d,m){return m=m||0,this.substr(m,d.length)===d}),String.prototype.endsWith||(String.prototype.endsWith=function(d,m){var x=this.toString();(typeof m!="number"||!isFinite(m)||Math.floor(m)!==m||m>x.length)&&(m=x.length),m-=d.length;var f=x.indexOf(d,m);return f!==-1&&f===m}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(m){if(this===null)throw new TypeError("Array.prototype.find called on null or undefined");if(typeof m!="function")throw new TypeError("predicate must be a function");for(var x=Object(this),f=x.length>>>0,h=arguments[1],g,u=0;uE.length?w:E,L=w.length>E.length?E:w,$=C.indexOf(L);if($!=-1)return T=[[l,C.substring(0,$)],[c,L],[l,C.substring($+L.length)]],w.length>E.length&&(T[0][0]=T[2][0]=a),T;if(L.length==1)return[[a,w],[l,E]];var _=u(w,E);if(_){var R=_[0],P=_[1],M=_[2],q=_[3],K=_[4],Z=d(R,M),W=d(P,q);return Z.concat([[c,K]],W)}return x(w,E)}function x(w,E){for(var T=w.length,C=E.length,L=Math.ceil((T+C)/2),$=L,_=2*L,R=new Array(_),P=new Array(_),M=0;M<_;M++)R[M]=-1,P[M]=-1;R[$+1]=0,P[$+1]=0;for(var q=T-C,K=q%2!=0,Z=0,W=0,U=0,F=0,B=0;BT)W+=2;else if(G>C)Z+=2;else if(K){var Y=$+q-D;if(Y>=0&&Y<_&&P[Y]!=-1){var V=T-P[Y];if(z>=V)return f(w,E,z,G)}}}for(var X=-B+U;X<=B-F;X+=2){var Y=$+X,V;X==-B||X!=B&&P[Y-1]T)F+=2;else if(ne>C)U+=2;else if(!K){var O=$+q-X;if(O>=0&&O<_&&R[O]!=-1){var z=R[O],G=$+z-O;if(V=T-V,z>=V)return f(w,E,z,G)}}}}return[[a,w],[l,E]]}function f(w,E,T,C){var L=w.substring(0,T),$=E.substring(0,C),_=w.substring(T),R=E.substring(C),P=d(L,$),M=d(_,R);return P.concat(M)}function h(w,E){if(!w||!E||w.charAt(0)!=E.charAt(0))return 0;for(var T=0,C=Math.min(w.length,E.length),L=C,$=0;TE.length?w:E,C=w.length>E.length?E:w;if(T.length<4||C.length*2=W.length?[z,G,Y,V,O]:null}var $=L(T,C,Math.ceil(T.length/4)),_=L(T,C,Math.ceil(T.length/2)),R;if(!$&&!_)return null;_?$?R=$[4].length>_[4].length?$:_:R=_:R=$;var P,M,q,K;w.length>E.length?(P=R[0],M=R[1],q=R[2],K=R[3]):(q=R[0],K=R[1],P=R[2],M=R[3]);var Z=R[4];return[P,M,q,K,Z]}function j(w){w.push([c,""]);for(var E=0,T=0,C=0,L="",$="",_;E1?(T!==0&&C!==0&&(_=h($,L),_!==0&&(E-T-C>0&&w[E-T-C-1][0]==c?w[E-T-C-1][1]+=$.substring(0,_):(w.splice(0,0,[c,$.substring(0,_)]),E++),$=$.substring(_),L=L.substring(_)),_=g($,L),_!==0&&(w[E][1]=$.substring($.length-_)+w[E][1],$=$.substring(0,$.length-_),L=L.substring(0,L.length-_))),T===0?w.splice(E-C,T+C,[l,$]):C===0?w.splice(E-T,T+C,[a,L]):w.splice(E-T-C,T+C,[a,L],[l,$]),E=E-T-C+(T?1:0)+(C?1:0)+1):E!==0&&w[E-1][0]==c?(w[E-1][1]+=w[E][1],w.splice(E,1)):E++,C=0,T=0,L="",$="";break}w[w.length-1][1]===""&&w.pop();var R=!1;for(E=1;E0&&C.splice(L+2,0,[_[0],R]),A(C,L,3)}else return w}function S(w){for(var E=!1,T=function(_){return _.charCodeAt(0)>=56320&&_.charCodeAt(0)<=57343},C=function(_){return _.charCodeAt(_.length-1)>=55296&&_.charCodeAt(_.length-1)<=56319},L=2;L0&&$.push(w[L]);return $}function A(w,E,T){for(var C=E+T-1;C>=0&&C>=E-1;C--)if(C+1\r?\n +\<"),this.convert();var Ve=this.quill.getFormat(this.quill.selection.savedRange.index);if(Ve[C.default.blotName]){var dt=this.container.innerText;return this.container.innerHTML="",new h.default().insert(dt,M({},C.default.blotName,Ve[C.default.blotName]))}var xt=this.prepareMatching(),ye=c(xt,2),le=ye[0],Qe=ye[1],rt=X(this.container,le,Qe);return Y(rt,` +`)&&rt.ops[rt.ops.length-1].attributes==null&&(rt=rt.compose(new h.default().retain(rt.length()-1).delete(1))),W.log("convert",this.container.innerHTML,rt),this.container.innerHTML="",rt}},{key:"dangerouslyPasteHTML",value:function(qe,Ve){var dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:p.default.sources.API;if(typeof qe=="string")this.quill.setContents(this.convert(qe),Ve),this.quill.setSelection(0,p.default.sources.SILENT);else{var xt=this.convert(Ve);this.quill.updateContents(new h.default().retain(qe).concat(xt),dt),this.quill.setSelection(qe+xt.length(),p.default.sources.SILENT)}}},{key:"onPaste",value:function(qe){var Ve=this;if(!(qe.defaultPrevented||!this.quill.isEnabled())){var dt=this.quill.getSelection(),xt=new h.default().retain(dt.index),ye=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(p.default.sources.SILENT),setTimeout(function(){xt=xt.concat(Ve.convert()).delete(dt.length),Ve.quill.updateContents(xt,p.default.sources.USER),Ve.quill.setSelection(xt.length()-dt.length,p.default.sources.SILENT),Ve.quill.scrollingContainer.scrollTop=ye,Ve.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var qe=this,Ve=[],dt=[];return this.matchers.forEach(function(xt){var ye=c(xt,2),le=ye[0],Qe=ye[1];switch(le){case Node.TEXT_NODE:dt.push(Qe);break;case Node.ELEMENT_NODE:Ve.push(Qe);break;default:[].forEach.call(qe.container.querySelectorAll(le),function(rt){rt[U]=rt[U]||[],rt[U].push(Qe)});break}}),[Ve,dt]}}]),Pe})(A.default);O.DEFAULTS={matchers:[],matchVisual:!0};function z(be,Pe,ke){return(typeof Pe>"u"?"undefined":l(Pe))==="object"?Object.keys(Pe).reduce(function(qe,Ve){return z(qe,Ve,Pe[Ve])},be):be.reduce(function(qe,Ve){return Ve.attributes&&Ve.attributes[Pe]?qe.push(Ve):qe.insert(Ve.insert,(0,x.default)({},M({},Pe,ke),Ve.attributes))},new h.default)}function G(be){if(be.nodeType!==Node.ELEMENT_NODE)return{};var Pe="__ql-computed-style";return be[Pe]||(be[Pe]=window.getComputedStyle(be))}function Y(be,Pe){for(var ke="",qe=be.ops.length-1;qe>=0&&ke.length-1}function X(be,Pe,ke){return be.nodeType===be.TEXT_NODE?ke.reduce(function(qe,Ve){return Ve(be,qe)},new h.default):be.nodeType===be.ELEMENT_NODE?[].reduce.call(be.childNodes||[],function(qe,Ve){var dt=X(Ve,Pe,ke);return Ve.nodeType===be.ELEMENT_NODE&&(dt=Pe.reduce(function(xt,ye){return ye(Ve,xt)},dt),dt=(Ve[U]||[]).reduce(function(xt,ye){return ye(Ve,xt)},dt)),qe.concat(dt)},new h.default):new h.default}function ne(be,Pe,ke){return z(ke,be,!0)}function oe(be,Pe){var ke=u.default.Attributor.Attribute.keys(be),qe=u.default.Attributor.Class.keys(be),Ve=u.default.Attributor.Style.keys(be),dt={};return ke.concat(qe).concat(Ve).forEach(function(xt){var ye=u.default.query(xt,u.default.Scope.ATTRIBUTE);ye!=null&&(dt[ye.attrName]=ye.value(be),dt[ye.attrName])||(ye=B[xt],ye!=null&&(ye.attrName===xt||ye.keyName===xt)&&(dt[ye.attrName]=ye.value(be)||void 0),ye=D[xt],ye!=null&&(ye.attrName===xt||ye.keyName===xt)&&(ye=D[xt],dt[ye.attrName]=ye.value(be)||void 0))}),Object.keys(dt).length>0&&(Pe=z(Pe,dt)),Pe}function re(be,Pe){var ke=u.default.query(be);if(ke==null)return Pe;if(ke.prototype instanceof u.default.Embed){var qe={},Ve=ke.value(be);Ve!=null&&(qe[ke.blotName]=Ve,Pe=new h.default().insert(qe,ke.formats(be)))}else typeof ke.formats=="function"&&(Pe=z(Pe,ke.blotName,ke.formats(be)));return Pe}function ge(be,Pe){return Y(Pe,` +`)||Pe.insert(` +`),Pe}function ve(){return new h.default}function Se(be,Pe){var ke=u.default.query(be);if(ke==null||ke.blotName!=="list-item"||!Y(Pe,` +`))return Pe;for(var qe=-1,Ve=be.parentNode;!Ve.classList.contains("ql-clipboard");)(u.default.query(Ve)||{}).blotName==="list"&&(qe+=1),Ve=Ve.parentNode;return qe<=0?Pe:Pe.compose(new h.default().retain(Pe.length()-1).retain(1,{indent:qe}))}function We(be,Pe){return Y(Pe,` +`)||(V(be)||Pe.length()>0&&be.nextSibling&&V(be.nextSibling))&&Pe.insert(` +`),Pe}function Ce(be,Pe){if(V(be)&&be.nextElementSibling!=null&&!Y(Pe,` -`)){var ke=be.offsetHeight+parseFloat(K(be).marginTop)+parseFloat(K(be).marginBottom);be.nextElementSibling.offsetTop>be.offsetTop+ke*1.5&&_e.insert(` -`)}return _e}function fe(be,_e){var ke={},qe=be.style||{};return qe.fontStyle&&K(be).fontStyle==="italic"&&(ke.italic=!0),qe.fontWeight&&(K(be).fontWeight.startsWith("bold")||parseInt(K(be).fontWeight)>=700)&&(ke.bold=!0),Object.keys(ke).length>0&&(_e=V(_e,ke)),parseFloat(qe.textIndent||0)>0&&(_e=new m.default().insert(" ").concat(_e)),_e}function Ye(be,_e){var ke=be.data;if(be.parentNode.tagName==="O:P")return _e.insert(ke.trim());if(ke.trim().length===0&&be.parentNode.classList.contains("ql-clipboard"))return _e;if(!K(be.parentNode).whiteSpace.startsWith("pre")){var qe=function(dt,xt){return xt=xt.replace(/[^\u00a0]/g,""),xt.length<1&&dt?" ":xt};ke=ke.replace(/\r\n/g," ").replace(/\n/g," "),ke=ke.replace(/\s\s+/g,qe.bind(qe,!0)),(be.previousSibling==null&&U(be.parentNode)||be.previousSibling!=null&&U(be.previousSibling))&&(ke=ke.replace(/^\s+/,qe.bind(qe,!1))),(be.nextSibling==null&&U(be.parentNode)||be.nextSibling!=null&&U(be.nextSibling))&&(ke=ke.replace(/\s+$/,qe.bind(qe,!1)))}return _e.insert(ke)}r.default=O,r.matchAttributor=oe,r.matchBlot=re,r.matchNewline=We,r.matchSpacing=Ce,r.matchText=Ye}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function j(g,y){for(var N=0;N '}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function j(g,y){for(var N=0;Nu.right&&(g=u.right-j.right,this.root.style.left=m+g+"px"),j.leftu.bottom){var y=j.bottom-j.top,N=f.bottom-f.top+y;this.root.style.top=p-N+"px",this.root.classList.add("ql-flip")}return g}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),h})();r.default=d}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function T(E,_){var M=[],q=!0,G=!1,Z=void 0;try{for(var W=E[Symbol.iterator](),z;!(q=(z=W.next()).done)&&(M.push(z.value),!(_&&M.length===_));q=!0);}catch(F){G=!0,Z=F}finally{try{!q&&W.return&&W.return()}finally{if(G)throw Z}}return M}return function(E,_){if(Array.isArray(E))return E;if(Symbol.iterator in Object(E))return T(E,_);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),c=function T(E,_,M){E===null&&(E=Function.prototype);var q=Object.getOwnPropertyDescriptor(E,_);if(q===void 0){var G=Object.getPrototypeOf(E);return G===null?void 0:T(G,_,M)}else{if("value"in q)return q.value;var Z=q.get;return Z===void 0?void 0:Z.call(M)}},d=(function(){function T(E,_){for(var M=0;M<_.length;M++){var q=_[M];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(E,q.key,q)}}return function(E,_,M){return _&&T(E.prototype,_),M&&T(E,M),E}})(),h=a(3),x=C(h),f=a(8),m=C(f),p=a(43),u=C(p),j=a(27),g=C(j),y=a(15),N=a(41),S=C(N);function C(T){return T&&T.__esModule?T:{default:T}}function w(T,E){if(!(T instanceof E))throw new TypeError("Cannot call a class as a function")}function R(T,E){if(!T)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E&&(typeof E=="object"||typeof E=="function")?E:T}function P(T,E){if(typeof E!="function"&&E!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof E);T.prototype=Object.create(E&&E.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),E&&(Object.setPrototypeOf?Object.setPrototypeOf(T,E):T.__proto__=E)}var A=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]],I=(function(T){P(E,T);function E(_,M){w(this,E),M.modules.toolbar!=null&&M.modules.toolbar.container==null&&(M.modules.toolbar.container=A);var q=R(this,(E.__proto__||Object.getPrototypeOf(E)).call(this,_,M));return q.quill.container.classList.add("ql-snow"),q}return d(E,[{key:"extendToolbar",value:function(M){M.container.classList.add("ql-snow"),this.buildButtons([].slice.call(M.container.querySelectorAll("button")),S.default),this.buildPickers([].slice.call(M.container.querySelectorAll("select")),S.default),this.tooltip=new $(this.quill,this.options.bounds),M.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"K",shortKey:!0},function(q,G){M.handlers.link.call(M,!G.format.link)})}}]),E})(u.default);I.DEFAULTS=(0,x.default)(!0,{},u.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(E){if(E){var _=this.quill.getSelection();if(_==null||_.length==0)return;var M=this.quill.getText(_);/^\S+@\S+\.\S+$/.test(M)&&M.indexOf("mailto:")!==0&&(M="mailto:"+M);var q=this.quill.theme.tooltip;q.edit("link",M)}else this.quill.format("link",!1)}}}}});var $=(function(T){P(E,T);function E(_,M){w(this,E);var q=R(this,(E.__proto__||Object.getPrototypeOf(E)).call(this,_,M));return q.preview=q.root.querySelector("a.ql-preview"),q}return d(E,[{key:"listen",value:function(){var M=this;c(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"listen",this).call(this),this.root.querySelector("a.ql-action").addEventListener("click",function(q){M.root.classList.contains("ql-editing")?M.save():M.edit("link",M.preview.textContent),q.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",function(q){if(M.linkRange!=null){var G=M.linkRange;M.restoreFocus(),M.quill.formatText(G,"link",!1,m.default.sources.USER),delete M.linkRange}q.preventDefault(),M.hide()}),this.quill.on(m.default.events.SELECTION_CHANGE,function(q,G,Z){if(q!=null){if(q.length===0&&Z===m.default.sources.USER){var W=M.quill.scroll.descendant(g.default,q.index),z=l(W,2),F=z[0],B=z[1];if(F!=null){M.linkRange=new y.Range(q.index-B,F.length());var D=g.default.formats(F.domNode);M.preview.textContent=D,M.preview.setAttribute("href",D),M.show(),M.position(M.quill.getBounds(M.linkRange));return}}else delete M.linkRange;M.hide()}})}},{key:"show",value:function(){c(E.prototype.__proto__||Object.getPrototypeOf(E.prototype),"show",this).call(this),this.root.removeAttribute("data-mode")}}]),E})(p.BaseTooltip);$.TEMPLATE=['','','',''].join(""),r.default=I}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=a(29),c=Ve(l),d=a(36),h=a(38),x=a(64),f=a(65),m=Ve(f),p=a(66),u=Ve(p),j=a(67),g=Ve(j),y=a(37),N=a(26),S=a(39),C=a(40),w=a(56),R=Ve(w),P=a(68),A=Ve(P),I=a(27),$=Ve(I),T=a(69),E=Ve(T),_=a(70),M=Ve(_),q=a(71),G=Ve(q),Z=a(72),W=Ve(Z),z=a(73),F=Ve(z),B=a(13),D=Ve(B),O=a(74),V=Ve(O),K=a(75),Y=Ve(K),U=a(57),X=Ve(U),ne=a(41),oe=Ve(ne),re=a(28),ge=Ve(re),ve=a(59),Se=Ve(ve),We=a(60),Ce=Ve(We),fe=a(61),Ye=Ve(fe),be=a(108),_e=Ve(be),ke=a(62),qe=Ve(ke);function Ve(dt){return dt&&dt.__esModule?dt:{default:dt}}c.default.register({"attributors/attribute/direction":h.DirectionAttribute,"attributors/class/align":d.AlignClass,"attributors/class/background":y.BackgroundClass,"attributors/class/color":N.ColorClass,"attributors/class/direction":h.DirectionClass,"attributors/class/font":S.FontClass,"attributors/class/size":C.SizeClass,"attributors/style/align":d.AlignStyle,"attributors/style/background":y.BackgroundStyle,"attributors/style/color":N.ColorStyle,"attributors/style/direction":h.DirectionStyle,"attributors/style/font":S.FontStyle,"attributors/style/size":C.SizeStyle},!0),c.default.register({"formats/align":d.AlignClass,"formats/direction":h.DirectionClass,"formats/indent":x.IndentClass,"formats/background":y.BackgroundStyle,"formats/color":N.ColorStyle,"formats/font":S.FontClass,"formats/size":C.SizeClass,"formats/blockquote":m.default,"formats/code-block":D.default,"formats/header":u.default,"formats/list":g.default,"formats/bold":R.default,"formats/code":B.Code,"formats/italic":A.default,"formats/link":$.default,"formats/script":E.default,"formats/strike":M.default,"formats/underline":G.default,"formats/image":W.default,"formats/video":F.default,"formats/list/item":j.ListItem,"modules/formula":V.default,"modules/syntax":Y.default,"modules/toolbar":X.default,"themes/bubble":_e.default,"themes/snow":qe.default,"ui/icons":oe.default,"ui/picker":ge.default,"ui/icon-picker":Ce.default,"ui/color-picker":Se.default,"ui/tooltip":Ye.default},!0),r.default=c.default}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.IndentClass=void 0;var l=(function(){function g(y,N){for(var S=0;S0&&this.children.tail.format(A,I)}},{key:"formats",value:function(){return j({},this.statics.blotName,this.statics.formats(this.domNode))}},{key:"insertBefore",value:function(A,I){if(A instanceof S)c(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"insertBefore",this).call(this,A,I);else{var $=I==null?this.length():I.offset(this),T=this.split($);T.parent.insertBefore(A,T)}}},{key:"optimize",value:function(A){c(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"optimize",this).call(this,A);var I=this.next;I!=null&&I.prev===this&&I.statics.blotName===this.statics.blotName&&I.domNode.tagName===this.domNode.tagName&&I.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(I.moveChildren(this),I.remove())}},{key:"replace",value:function(A){if(A.statics.blotName!==this.statics.blotName){var I=h.default.create(this.statics.defaultChild);A.moveChildren(I),this.appendChild(I)}c(R.prototype.__proto__||Object.getPrototypeOf(R.prototype),"replace",this).call(this,A)}}]),R})(p.default);C.blotName="list",C.scope=h.default.Scope.BLOCK_BLOT,C.tagName=["OL","UL"],C.defaultChild="list-item",C.allowedChildren=[S],r.ListItem=S,r.default=C}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=a(56),c=d(l);function d(p){return p&&p.__esModule?p:{default:p}}function h(p,u){if(!(p instanceof u))throw new TypeError("Cannot call a class as a function")}function x(p,u){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u&&(typeof u=="object"||typeof u=="function")?u:p}function f(p,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof u);p.prototype=Object.create(u&&u.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),u&&(Object.setPrototypeOf?Object.setPrototypeOf(p,u):p.__proto__=u)}var m=(function(p){f(u,p);function u(){return h(this,u),x(this,(u.__proto__||Object.getPrototypeOf(u)).apply(this,arguments))}return u})(c.default);m.blotName="italic",m.tagName=["EM","I"],r.default=m}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function j(g,y){for(var N=0;N-1?w?this.domNode.setAttribute(C,w):this.domNode.removeAttribute(C):c(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"format",this).call(this,C,w)}}],[{key:"create",value:function(C){var w=c(N.__proto__||Object.getPrototypeOf(N),"create",this).call(this,C);return typeof C=="string"&&w.setAttribute("src",this.sanitize(C)),w}},{key:"formats",value:function(C){return j.reduce(function(w,R){return C.hasAttribute(R)&&(w[R]=C.getAttribute(R)),w},{})}},{key:"match",value:function(C){return/\.(jpe?g|gif|png)$/.test(C)||/^data:image\/.+;base64/.test(C)}},{key:"sanitize",value:function(C){return(0,x.sanitize)(C,["http","https","data"])?C:"//:0"}},{key:"value",value:function(C){return C.getAttribute("src")}}]),N})(h.default.Embed);g.blotName="image",g.tagName="IMG",r.default=g}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=(function(){function y(N,S){for(var C=0;C-1?w?this.domNode.setAttribute(C,w):this.domNode.removeAttribute(C):c(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"format",this).call(this,C,w)}}],[{key:"create",value:function(C){var w=c(N.__proto__||Object.getPrototypeOf(N),"create",this).call(this,C);return w.setAttribute("frameborder","0"),w.setAttribute("allowfullscreen",!0),w.setAttribute("src",this.sanitize(C)),w}},{key:"formats",value:function(C){return j.reduce(function(w,R){return C.hasAttribute(R)&&(w[R]=C.getAttribute(R)),w},{})}},{key:"sanitize",value:function(C){return x.default.sanitize(C)}},{key:"value",value:function(C){return C.getAttribute("src")}}]),N})(d.BlockEmbed);g.blotName="video",g.className="ql-video",g.tagName="IFRAME",r.default=g}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.FormulaBlot=void 0;var l=(function(){function C(w,R){for(var P=0;P0||this.cachedText==null)&&(this.domNode.innerHTML=$(T),this.domNode.normalize(),this.attach()),this.cachedText=T)}}]),A})(j.default);C.className="ql-syntax";var w=new h.default.Attributor.Class("token","hljs",{scope:h.default.Scope.INLINE}),R=(function(P){S(A,P),l(A,null,[{key:"register",value:function(){f.default.register(w,!0),f.default.register(C,!0)}}]);function A(I,$){y(this,A);var T=N(this,(A.__proto__||Object.getPrototypeOf(A)).call(this,I,$));if(typeof T.options.highlight!="function")throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var E=null;return T.quill.on(f.default.events.SCROLL_OPTIMIZE,function(){clearTimeout(E),E=setTimeout(function(){T.highlight(),E=null},T.options.interval)}),T.highlight(),T}return l(A,[{key:"highlight",value:function(){var $=this;if(!this.quill.selection.composing){this.quill.update(f.default.sources.USER);var T=this.quill.getSelection();this.quill.scroll.descendants(C).forEach(function(E){E.highlight($.options.highlight)}),this.quill.update(f.default.sources.SILENT),T!=null&&this.quill.setSelection(T,f.default.sources.SILENT)}}}]),A})(p.default);R.DEFAULTS={highlight:(function(){return window.hljs==null?null:function(P){var A=window.hljs.highlightAuto(P);return A.value}})(),interval:1e3},r.CodeBlock=C,r.CodeToken=w,r.default=R}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r){n.exports=' '}),(function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.BubbleTooltip=void 0;var l=function A(I,$,T){I===null&&(I=Function.prototype);var E=Object.getOwnPropertyDescriptor(I,$);if(E===void 0){var _=Object.getPrototypeOf(I);return _===null?void 0:A(_,$,T)}else{if("value"in E)return E.value;var M=E.get;return M===void 0?void 0:M.call(T)}},c=(function(){function A(I,$){for(var T=0;T<$.length;T++){var E=$[T];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(I,E.key,E)}}return function(I,$,T){return $&&A(I.prototype,$),T&&A(I,T),I}})(),d=a(3),h=y(d),x=a(8),f=y(x),m=a(43),p=y(m),u=a(15),j=a(41),g=y(j);function y(A){return A&&A.__esModule?A:{default:A}}function N(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function S(A,I){if(!A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:A}function C(A,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);A.prototype=Object.create(I&&I.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(A,I):A.__proto__=I)}var w=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]],R=(function(A){C(I,A);function I($,T){N(this,I),T.modules.toolbar!=null&&T.modules.toolbar.container==null&&(T.modules.toolbar.container=w);var E=S(this,(I.__proto__||Object.getPrototypeOf(I)).call(this,$,T));return E.quill.container.classList.add("ql-bubble"),E}return c(I,[{key:"extendToolbar",value:function(T){this.tooltip=new P(this.quill,this.options.bounds),this.tooltip.root.appendChild(T.container),this.buildButtons([].slice.call(T.container.querySelectorAll("button")),g.default),this.buildPickers([].slice.call(T.container.querySelectorAll("select")),g.default)}}]),I})(p.default);R.DEFAULTS=(0,h.default)(!0,{},p.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(I){I?this.quill.theme.tooltip.edit():this.quill.format("link",!1)}}}}});var P=(function(A){C(I,A);function I($,T){N(this,I);var E=S(this,(I.__proto__||Object.getPrototypeOf(I)).call(this,$,T));return E.quill.on(f.default.events.EDITOR_CHANGE,function(_,M,q,G){if(_===f.default.events.SELECTION_CHANGE)if(M!=null&&M.length>0&&G===f.default.sources.USER){E.show(),E.root.style.left="0px",E.root.style.width="",E.root.style.width=E.root.offsetWidth+"px";var Z=E.quill.getLines(M.index,M.length);if(Z.length===1)E.position(E.quill.getBounds(M));else{var W=Z[Z.length-1],z=E.quill.getIndex(W),F=Math.min(W.length()-1,M.index+M.length-z),B=E.quill.getBounds(new u.Range(z,F));E.position(B)}}else document.activeElement!==E.textbox&&E.quill.hasFocus()&&E.hide()}),E}return c(I,[{key:"listen",value:function(){var T=this;l(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",function(){T.root.classList.remove("ql-editing")}),this.quill.on(f.default.events.SCROLL_OPTIMIZE,function(){setTimeout(function(){if(!T.root.classList.contains("ql-hidden")){var E=T.quill.getSelection();E!=null&&T.position(T.quill.getBounds(E))}},1)})}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(T){var E=l(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"position",this).call(this,T),_=this.root.querySelector(".ql-tooltip-arrow");if(_.style.marginLeft="",E===0)return E;_.style.marginLeft=-1*E-_.offsetWidth/2+"px"}}]),I})(m.BaseTooltip);P.TEMPLATE=['','
','','',"
"].join(""),r.BubbleTooltip=P,r.default=R}),(function(n,r,a){n.exports=a(63)})]).default})})(im)),im.exports}var Ha,tC;function IU(){if(tC)return Ha;tC=1;var t=Ha&&Ha.__extends||(function(){var f=function(m,p){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,j){u.__proto__=j}||function(u,j){for(var g in j)j.hasOwnProperty(g)&&(u[g]=j[g])},f(m,p)};return function(m,p){f(m,p);function u(){this.constructor=m}m.prototype=p===null?Object.create(p):(u.prototype=p.prototype,new u)}})(),s=Ha&&Ha.__assign||function(){return s=Object.assign||function(f){for(var m,p=1,u=arguments.length;p1)throw new Error("The Quill editing area can only be composed of a single React element.");if(a.default.Children.count(p.children)){var j=a.default.Children.only(p.children);if(((u=j)===null||u===void 0?void 0:u.type)==="textarea")throw new Error("Quill does not support editing on a