diff --git a/.github/.env b/.github/.env new file mode 100644 index 0000000..4666faf --- /dev/null +++ b/.github/.env @@ -0,0 +1,3 @@ +VITE_API_URL=http://localhost:8080 +VITE_CONTENT_API_URL=http://localhost:8082/api +VITE_INFO_SERVER_API_URL=http://localhost:8081/api diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..b63a08d --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1 @@ +## ๐Ÿšง ์ž‘์—… ๋‚ด์šฉ \ No newline at end of file diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..126b211 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,71 @@ +name: Deploy FE to AWS + +on: + push: + branches: + - dev + # workflow_dispatch: + + + +permissions: + # oidc ์ธ์ฆ์šฉ + id-token: write + # ์ฒดํฌ์•„์›ƒ์šฉ + contents: read + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Install dependencies + run: npm install + + - name: Create .env file + run: | + echo "${{ secrets.env }}" >> .env + + - name: Build + run: npm run build + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: build-artifact + path: ./dist + + deploy: + name: Deploy to AWS + needs: build + runs-on: ubuntu-latest + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: build-artifact + path: . + + - name: Upload to S3 + run: | + aws s3 sync . s3://${{ secrets.S3_BUCKET_NAME }} --delete + + - name: Invalidate Cloudfront cache + # Cloudfront cache ๋ฌดํšจํ™” -> ์ฆ‰์‹œ ์ตœ์‹  ๋ฒ„์ „ ๋ณผ ์ˆ˜ ์žˆ๊ฒŒ ํ•จ + run: | + aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" diff --git a/.gitignore b/.gitignore index 693f51b..44eb75e 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,48 @@ psd thumb sketch -# End of https://www.toptal.com/developers/gitignore/api/react \ No newline at end of file + +# End of https://www.toptal.com/developers/gitignore/api/react + +dist + +# Created by https://www.toptal.com/developers/gitignore/api/terraform +# Edit at https://www.toptal.com/developers/gitignore?templates=terraform + +### Terraform ### +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log +crash.*.log + +# Exclude all .tfvars files, which are likely to contain sensitive data, such as +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject +# to change depending on the environment. +*.tfvars +*.tfvars.json + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc + +# End of https://www.toptal.com/developers/gitignore/api/terraform \ No newline at end of file diff --git a/dist/assets/index-BhnV90tO.css b/dist/assets/index-BhnV90tO.css deleted file mode 100644 index e94540d..0000000 --- a/dist/assets/index-BhnV90tO.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;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";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}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;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 222.2 47.4% 11.2%;--primary-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 222.2 84% 4.9%;--radius: .5rem}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-auto{pointer-events:auto}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.right-2{right:.5rem}.top-0{top:0}.top-2{top:.5rem}.z-\[100\]{z-index:100}.mx-auto{margin-left:auto;margin-right:auto}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.mr-2{margin-right:.5rem}.mr-4{margin-right:1rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.aspect-square{aspect-ratio:1 / 1}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1px\]{height:1px}.h-full{height:100%}.max-h-screen{max-height:100vh}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-\[1px\]{width:1px}.w-full{width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-md{max-width:28rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-destructive{border-color:hsl(var(--destructive))}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.bg-background{background-color:hsl(var(--background))}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity))}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-primary{background-color:hsl(var(--primary))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-50{--tw-gradient-from: #eff6ff var(--tw-gradient-from-position);--tw-gradient-from-position: ;--tw-gradient-to: rgb(239 246 255 / 0) var(--tw-gradient-from-position);--tw-gradient-to-position: ;--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-from-position: ;--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-from-position);--tw-gradient-to-position: ;--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-indigo-100{--tw-gradient-to: #e0e7ff var(--tw-gradient-to-position);--tw-gradient-to-position: }.to-purple-600{--tw-gradient-to: #9333ea var(--tw-gradient-to-position);--tw-gradient-to-position: }.fill-current{fill:currentColor}.p-1{padding:.25rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-12{padding-left:3rem;padding-right:3rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.text-left{text-align:left}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-6xl{font-size:3.75rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.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)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:underline:hover{text-decoration-line:underline}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:focus-visible\:ring-destructive:focus-visible{--tw-ring-color: hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus-visible\:ring-red-400:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity))}.group.destructive .group-\[\.destructive\]\:focus-visible\:ring-offset-red-600:focus-visible{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}@media (min-width: 640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:flex-col{flex-direction:column}}@media (min-width: 768px){.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}} diff --git a/dist/assets/index-C2MZhA2F.js b/dist/assets/index-C2MZhA2F.js deleted file mode 100644 index da8ff30..0000000 --- a/dist/assets/index-C2MZhA2F.js +++ /dev/null @@ -1,103 +0,0 @@ -function Xh(o,s){for(var i=0;iu[c]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))u(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&u(h)}).observe(document,{childList:!0,subtree:!0});function i(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function u(c){if(c.ep)return;c.ep=!0;const f=i(c);fetch(c.href,f)}})();function ua(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Us={exports:{}},fe={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var xd;function Jh(){if(xd)return fe;xd=1;var o=Symbol.for("react.element"),s=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),h=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),x=Symbol.iterator;function I(C){return C===null||typeof C!="object"?null:(C=x&&C[x]||C["@@iterator"],typeof C=="function"?C:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,T={};function N(C,L,Z){this.props=C,this.context=L,this.refs=T,this.updater=Z||z}N.prototype.isReactComponent={},N.prototype.setState=function(C,L){if(typeof C!="object"&&typeof C!="function"&&C!=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,C,L,"setState")},N.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function U(){}U.prototype=N.prototype;function V(C,L,Z){this.props=C,this.context=L,this.refs=T,this.updater=Z||z}var j=V.prototype=new U;j.constructor=V,b(j,N.prototype),j.isPureReactComponent=!0;var G=Array.isArray,ie=Object.prototype.hasOwnProperty,se={current:null},oe={key:!0,ref:!0,__self:!0,__source:!0};function $(C,L,Z){var te,pe={},he=null,ue=null;if(L!=null)for(te in L.ref!==void 0&&(ue=L.ref),L.key!==void 0&&(he=""+L.key),L)ie.call(L,te)&&!oe.hasOwnProperty(te)&&(pe[te]=L[te]);var ge=arguments.length-2;if(ge===1)pe.children=Z;else if(1>>1,L=O[C];if(0>>1;Cc(pe,W))hec(ue,pe)?(O[C]=ue,O[he]=W,C=he):(O[C]=pe,O[te]=W,C=te);else if(hec(ue,W))O[C]=ue,O[he]=W,C=he;else break e}}return ee}function c(O,ee){var W=O.sortIndex-ee.sortIndex;return W!==0?W:O.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;o.unstable_now=function(){return f.now()}}else{var h=Date,w=h.now();o.unstable_now=function(){return h.now()-w}}var g=[],y=[],k=1,x=null,I=3,z=!1,b=!1,T=!1,N=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,V=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(O){for(var ee=i(y);ee!==null;){if(ee.callback===null)u(y);else if(ee.startTime<=O)u(y),ee.sortIndex=ee.expirationTime,s(g,ee);else break;ee=i(y)}}function G(O){if(T=!1,j(O),!b)if(i(g)!==null)b=!0,ce(ie);else{var ee=i(y);ee!==null&&me(G,ee.startTime-O)}}function ie(O,ee){b=!1,T&&(T=!1,U($),$=-1),z=!0;var W=I;try{for(j(ee),x=i(g);x!==null&&(!(x.expirationTime>ee)||O&&!Le());){var C=x.callback;if(typeof C=="function"){x.callback=null,I=x.priorityLevel;var L=C(x.expirationTime<=ee);ee=o.unstable_now(),typeof L=="function"?x.callback=L:x===i(g)&&u(g),j(ee)}else u(g);x=i(g)}if(x!==null)var Z=!0;else{var te=i(y);te!==null&&me(G,te.startTime-ee),Z=!1}return Z}finally{x=null,I=W,z=!1}}var se=!1,oe=null,$=-1,we=5,Te=-1;function Le(){return!(o.unstable_now()-TeO||125C?(O.sortIndex=W,s(y,O),i(g)===null&&O===i(y)&&(T?(U($),$=-1):T=!0,me(G,W-C))):(O.sortIndex=L,s(g,O),b||z||(b=!0,ce(ie))),O},o.unstable_shouldYield=Le,o.unstable_wrapCallback=function(O){var ee=I;return function(){var W=I;I=ee;try{return O.apply(this,arguments)}finally{I=W}}}}(Bs)),Bs}var Cd;function qh(){return Cd||(Cd=1,Vs.exports=Zh()),Vs.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Nd;function ev(){if(Nd)return at;Nd=1;var o=ca(),s=qh();function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),g=Object.prototype.hasOwnProperty,y=/^[: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]*$/,k={},x={};function I(e){return g.call(x,e)?!0:g.call(k,e)?!1:y.test(e)?x[e]=!0:(k[e]=!0,!1)}function z(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function b(e,t,n,r){if(t===null||typeof t>"u"||z(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function T(e,t,n,r,l,a,d){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=d}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){N[e]=new T(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];N[t]=new T(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){N[e]=new T(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){N[e]=new T(e,2,!1,e,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(e){N[e]=new T(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){N[e]=new T(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){N[e]=new T(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){N[e]=new T(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){N[e]=new T(e,5,!1,e.toLowerCase(),null,!1,!1)});var U=/[\-:]([a-z])/g;function V(e){return e[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(e){var t=e.replace(U,V);N[t]=new T(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(U,V);N[t]=new T(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(U,V);N[t]=new T(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){N[e]=new T(e,1,!1,e.toLowerCase(),null,!1,!1)}),N.xlinkHref=new T("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){N[e]=new T(e,1,!1,e.toLowerCase(),null,!0,!0)});function j(e,t,n,r){var l=N.hasOwnProperty(t)?N[t]:null;(l!==null?l.type!==0:r||!(2v||l[d]!==a[v]){var E=` -`+l[d].replace(" at new "," at ");return e.displayName&&E.includes("")&&(E=E.replace("",e.displayName)),E}while(1<=d&&0<=v);break}}}finally{Z=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?L(e):""}function pe(e){switch(e.tag){case 5:return L(e.type);case 16:return L("Lazy");case 13:return L("Suspense");case 19:return L("SuspenseList");case 0:case 2:case 15:return e=te(e.type,!1),e;case 11:return e=te(e.type.render,!1),e;case 1:return e=te(e.type,!0),e;default:return""}}function he(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case oe:return"Fragment";case se:return"Portal";case we:return"Profiler";case $:return"StrictMode";case De:return"Suspense";case le:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Le:return(e.displayName||"Context")+".Consumer";case Te:return(e._context.displayName||"Context")+".Provider";case Me:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ee:return t=e.displayName||null,t!==null?t:he(e.type)||"Memo";case ce:t=e._payload,e=e._init;try{return he(e(t))}catch{}}return null}function ue(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return he(t);case 8:return t===$?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ge(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function xe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function We(e){var t=xe(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(d){r=""+d,a.call(this,d)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(d){r=""+d},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Kt(e){e._valueTracker||(e._valueTracker=We(e))}function wn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=xe(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function wo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Kl(e,t){var n=t.checked;return W({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ra(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ge(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function _a(e,t){t=t.checked,t!=null&&j(e,"checked",t,!1)}function Ql(e,t){_a(e,t);var n=ge(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Yl(e,t.type,n):t.hasOwnProperty("defaultValue")&&Yl(e,t.type,ge(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ia(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Yl(e,t,n){(t!=="number"||wo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Cr=Array.isArray;function Hn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Eo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Nr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Pr={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},em=["Webkit","ms","Moz","O"];Object.keys(Pr).forEach(function(e){em.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Pr[t]=Pr[e]})});function Da(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Pr.hasOwnProperty(e)&&Pr[e]?(""+t).trim():t+"px"}function ba(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Da(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var tm=W({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 Zl(e,t){if(t){if(tm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function ql(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 ei=null;function ti(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ni=null,Gn=null,Kn=null;function Fa(e){if(e=Qr(e)){if(typeof ni!="function")throw Error(i(280));var t=e.stateNode;t&&(t=Bo(t),ni(e.stateNode,e.type,t))}}function ja(e){Gn?Kn?Kn.push(e):Kn=[e]:Gn=e}function Ua(){if(Gn){var e=Gn,t=Kn;if(Kn=Gn=null,Fa(e),t)for(e=0;e>>=0,e===0?32:31-(fm(e)/pm|0)|0}var No=64,Po=4194304;function Ir(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function To(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,a=e.pingedLanes,d=n&268435455;if(d!==0){var v=d&~l;v!==0?r=Ir(v):(a&=d,a!==0&&(r=Ir(a)))}else d=n&~l,d!==0?r=Ir(d):a!==0&&(r=Ir(a));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,a=t&-t,l>=a||l===16&&(a&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Or(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Et(t),e[t]=n}function gm(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=jr),mu=" ",hu=!1;function vu(e,t){switch(e){case"keyup":return Hm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xn=!1;function Km(e,t){switch(e){case"compositionend":return gu(t);case"keypress":return t.which!==32?null:(hu=!0,mu);case"textInput":return e=t.data,e===mu&&hu?null:e;default:return null}}function Qm(e,t){if(Xn)return e==="compositionend"||!Ei&&vu(e,t)?(e=au(),Lo=mi=Zt=null,Xn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Cu(n)}}function Pu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Pu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tu(){for(var e=window,t=wo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=wo(e.document)}return t}function ki(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function rh(e){var t=Tu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Pu(n.ownerDocument.documentElement,n)){if(r!==null&&ki(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,a=Math.min(r.start,l);r=r.end===void 0?a:Math.min(r.end,l),!e.extend&&a>r&&(l=r,r=a,a=l),l=Nu(n,a);var d=Nu(n,r);l&&d&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==d.node||e.focusOffset!==d.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(d.node,d.offset)):(t.setEnd(d.node,d.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Jn=null,Ci=null,Br=null,Ni=!1;function Ru(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ni||Jn==null||Jn!==wo(r)||(r=Jn,"selectionStart"in r&&ki(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Br&&Vr(Br,r)||(Br=r,r=Uo(Ci,"onSelect"),0nr||(e.current=bi[nr],bi[nr]=null,nr--)}function ke(e,t){nr++,bi[nr]=e.current,e.current=t}var nn={},Je=tn(nn),rt=tn(!1),Sn=nn;function rr(e,t){var n=e.type.contextTypes;if(!n)return nn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},a;for(a in n)l[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function ot(e){return e=e.childContextTypes,e!=null}function Wo(){Ne(rt),Ne(Je)}function Bu(e,t,n){if(Je.current!==nn)throw Error(i(168));ke(Je,t),ke(rt,n)}function Wu(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(i(108,ue(e)||"Unknown",l));return W({},n,r)}function Ho(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||nn,Sn=Je.current,ke(Je,e),ke(rt,rt.current),!0}function Hu(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=Wu(e,t,Sn),r.__reactInternalMemoizedMergedChildContext=e,Ne(rt),Ne(Je),ke(Je,e)):Ne(rt),ke(rt,n)}var At=null,Go=!1,Fi=!1;function Gu(e){At===null?At=[e]:At.push(e)}function hh(e){Go=!0,Gu(e)}function rn(){if(!Fi&&At!==null){Fi=!0;var e=0,t=Se;try{var n=At;for(Se=1;e>=d,l-=d,zt=1<<32-Et(t)+l|n<ae?(Ke=re,re=null):Ke=re.sibling;var ye=M(P,re,R[ae],F);if(ye===null){re===null&&(re=Ke);break}e&&re&&ye.alternate===null&&t(P,re),S=a(ye,S,ae),ne===null?q=ye:ne.sibling=ye,ne=ye,re=Ke}if(ae===R.length)return n(P,re),Re&&Cn(P,ae),q;if(re===null){for(;aeae?(Ke=re,re=null):Ke=re.sibling;var pn=M(P,re,ye.value,F);if(pn===null){re===null&&(re=Ke);break}e&&re&&pn.alternate===null&&t(P,re),S=a(pn,S,ae),ne===null?q=pn:ne.sibling=pn,ne=pn,re=Ke}if(ye.done)return n(P,re),Re&&Cn(P,ae),q;if(re===null){for(;!ye.done;ae++,ye=R.next())ye=D(P,ye.value,F),ye!==null&&(S=a(ye,S,ae),ne===null?q=ye:ne.sibling=ye,ne=ye);return Re&&Cn(P,ae),q}for(re=r(P,re);!ye.done;ae++,ye=R.next())ye=H(re,P,ae,ye.value,F),ye!==null&&(e&&ye.alternate!==null&&re.delete(ye.key===null?ae:ye.key),S=a(ye,S,ae),ne===null?q=ye:ne.sibling=ye,ne=ye);return e&&re.forEach(function(Yh){return t(P,Yh)}),Re&&Cn(P,ae),q}function Fe(P,S,R,F){if(typeof R=="object"&&R!==null&&R.type===oe&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case ie:e:{for(var q=R.key,ne=S;ne!==null;){if(ne.key===q){if(q=R.type,q===oe){if(ne.tag===7){n(P,ne.sibling),S=l(ne,R.props.children),S.return=P,P=S;break e}}else if(ne.elementType===q||typeof q=="object"&&q!==null&&q.$$typeof===ce&&Zu(q)===ne.type){n(P,ne.sibling),S=l(ne,R.props),S.ref=Yr(P,ne,R),S.return=P,P=S;break e}n(P,ne);break}else t(P,ne);ne=ne.sibling}R.type===oe?(S=Ln(R.props.children,P.mode,F,R.key),S.return=P,P=S):(F=El(R.type,R.key,R.props,null,P.mode,F),F.ref=Yr(P,S,R),F.return=P,P=F)}return d(P);case se:e:{for(ne=R.key;S!==null;){if(S.key===ne)if(S.tag===4&&S.stateNode.containerInfo===R.containerInfo&&S.stateNode.implementation===R.implementation){n(P,S.sibling),S=l(S,R.children||[]),S.return=P,P=S;break e}else{n(P,S);break}else t(P,S);S=S.sibling}S=zs(R,P.mode,F),S.return=P,P=S}return d(P);case ce:return ne=R._init,Fe(P,S,ne(R._payload),F)}if(Cr(R))return Q(P,S,R,F);if(ee(R))return J(P,S,R,F);Xo(P,R)}return typeof R=="string"&&R!==""||typeof R=="number"?(R=""+R,S!==null&&S.tag===6?(n(P,S.sibling),S=l(S,R),S.return=P,P=S):(n(P,S),S=As(R,P.mode,F),S.return=P,P=S),d(P)):n(P,S)}return Fe}var sr=qu(!0),ec=qu(!1),Jo=tn(null),Zo=null,ar=null,Wi=null;function Hi(){Wi=ar=Zo=null}function Gi(e){var t=Jo.current;Ne(Jo),e._currentValue=t}function Ki(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ur(e,t){Zo=e,Wi=ar=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(lt=!0),e.firstContext=null)}function ht(e){var t=e._currentValue;if(Wi!==e)if(e={context:e,memoizedValue:t,next:null},ar===null){if(Zo===null)throw Error(i(308));ar=e,Zo.dependencies={lanes:0,firstContext:e}}else ar=ar.next=e;return t}var Nn=null;function Qi(e){Nn===null?Nn=[e]:Nn.push(e)}function tc(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Qi(t)):(n.next=l.next,l.next=n),t.interleaved=n,bt(e,r)}function bt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var on=!1;function Yi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function nc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ft(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ln(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(ve&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,bt(e,n)}return l=r.interleaved,l===null?(t.next=t,Qi(r)):(t.next=l.next,l.next=t),r.interleaved=t,bt(e,n)}function qo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ui(e,n)}}function rc(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var d={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?l=a=d:a=a.next=d,n=n.next}while(n!==null);a===null?l=a=t:a=a.next=t}else l=a=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function el(e,t,n,r){var l=e.updateQueue;on=!1;var a=l.firstBaseUpdate,d=l.lastBaseUpdate,v=l.shared.pending;if(v!==null){l.shared.pending=null;var E=v,_=E.next;E.next=null,d===null?a=_:d.next=_,d=E;var A=e.alternate;A!==null&&(A=A.updateQueue,v=A.lastBaseUpdate,v!==d&&(v===null?A.firstBaseUpdate=_:v.next=_,A.lastBaseUpdate=E))}if(a!==null){var D=l.baseState;d=0,A=_=E=null,v=a;do{var M=v.lane,H=v.eventTime;if((r&M)===M){A!==null&&(A=A.next={eventTime:H,lane:0,tag:v.tag,payload:v.payload,callback:v.callback,next:null});e:{var Q=e,J=v;switch(M=t,H=n,J.tag){case 1:if(Q=J.payload,typeof Q=="function"){D=Q.call(H,D,M);break e}D=Q;break e;case 3:Q.flags=Q.flags&-65537|128;case 0:if(Q=J.payload,M=typeof Q=="function"?Q.call(H,D,M):Q,M==null)break e;D=W({},D,M);break e;case 2:on=!0}}v.callback!==null&&v.lane!==0&&(e.flags|=64,M=l.effects,M===null?l.effects=[v]:M.push(v))}else H={eventTime:H,lane:M,tag:v.tag,payload:v.payload,callback:v.callback,next:null},A===null?(_=A=H,E=D):A=A.next=H,d|=M;if(v=v.next,v===null){if(v=l.shared.pending,v===null)break;M=v,v=M.next,M.next=null,l.lastBaseUpdate=M,l.shared.pending=null}}while(!0);if(A===null&&(E=D),l.baseState=E,l.firstBaseUpdate=_,l.lastBaseUpdate=A,t=l.shared.interleaved,t!==null){l=t;do d|=l.lane,l=l.next;while(l!==t)}else a===null&&(l.shared.lanes=0);Rn|=d,e.lanes=d,e.memoizedState=D}}function oc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=es.transition;es.transition={};try{e(!1),t()}finally{Se=n,es.transition=r}}function kc(){return vt().memoizedState}function wh(e,t,n){var r=cn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Cc(e))Nc(t,n);else if(n=tc(e,t,n,r),n!==null){var l=nt();Pt(n,e,r,l),Pc(n,t,r)}}function Eh(e,t,n){var r=cn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Cc(e))Nc(t,l);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var d=t.lastRenderedState,v=a(d,n);if(l.hasEagerState=!0,l.eagerState=v,xt(v,d)){var E=t.interleaved;E===null?(l.next=l,Qi(t)):(l.next=E.next,E.next=l),t.interleaved=l;return}}catch{}finally{}n=tc(e,t,l,r),n!==null&&(l=nt(),Pt(n,e,r,l),Pc(n,t,r))}}function Cc(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function Nc(e,t){qr=rl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Pc(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ui(e,n)}}var il={readContext:ht,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useInsertionEffect:Ze,useLayoutEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useMutableSource:Ze,useSyncExternalStore:Ze,useId:Ze,unstable_isNewReconciler:!1},xh={readContext:ht,useCallback:function(e,t){return Ot().memoizedState=[e,t===void 0?null:t],e},useContext:ht,useEffect:hc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ol(4194308,4,yc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ol(4194308,4,e,t)},useInsertionEffect:function(e,t){return ol(4,2,e,t)},useMemo:function(e,t){var n=Ot();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ot();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=wh.bind(null,Oe,e),[r.memoizedState,e]},useRef:function(e){var t=Ot();return e={current:e},t.memoizedState=e},useState:pc,useDebugValue:ss,useDeferredValue:function(e){return Ot().memoizedState=e},useTransition:function(){var e=pc(!1),t=e[0];return e=yh.bind(null,e[1]),Ot().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Oe,l=Ot();if(Re){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ge===null)throw Error(i(349));(Tn&30)!==0||ac(r,t,n)}l.memoizedState=n;var a={value:n,getSnapshot:t};return l.queue=a,hc(cc.bind(null,r,a,e),[e]),r.flags|=2048,no(9,uc.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=Ot(),t=Ge.identifierPrefix;if(Re){var n=Dt,r=zt;n=(r&~(1<<32-Et(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=eo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=d.createElement(n,{is:r.is}):(e=d.createElement(n),n==="select"&&(d=e,r.multiple?d.multiple=!0:r.size&&(d.size=r.size))):e=d.createElementNS(e,n),e[_t]=t,e[Kr]=r,Gc(e,t,!1,!1),t.stateNode=e;e:{switch(d=ql(n,r),n){case"dialog":Ce("cancel",e),Ce("close",e),l=r;break;case"iframe":case"object":case"embed":Ce("load",e),l=r;break;case"video":case"audio":for(l=0;lmr&&(t.flags|=128,r=!0,ro(a,!1),t.lanes=4194304)}else{if(!r)if(e=tl(d),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ro(a,!0),a.tail===null&&a.tailMode==="hidden"&&!d.alternate&&!Re)return qe(t),null}else 2*be()-a.renderingStartTime>mr&&n!==1073741824&&(t.flags|=128,r=!0,ro(a,!1),t.lanes=4194304);a.isBackwards?(d.sibling=t.child,t.child=d):(n=a.last,n!==null?n.sibling=d:t.child=d,a.last=d)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=be(),t.sibling=null,n=Ie.current,ke(Ie,r?n&1|2:n&1),t):(qe(t),null);case 22:case 23:return Os(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(ft&1073741824)!==0&&(qe(t),t.subtreeFlags&6&&(t.flags|=8192)):qe(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function _h(e,t){switch(Ui(t),t.tag){case 1:return ot(t.type)&&Wo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return cr(),Ne(rt),Ne(Je),qi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ji(t),null;case 13:if(Ne(Ie),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ir()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ne(Ie),null;case 4:return cr(),null;case 10:return Gi(t.type._context),null;case 22:case 23:return Os(),null;case 24:return null;default:return null}}var cl=!1,et=!1,Ih=typeof WeakSet=="function"?WeakSet:Set,K=null;function fr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ae(e,t,r)}else n.current=null}function ws(e,t,n){try{n()}catch(r){Ae(e,t,r)}}var Yc=!1;function Oh(e,t){if(Oi=Io,e=Tu(),ki(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var d=0,v=-1,E=-1,_=0,A=0,D=e,M=null;t:for(;;){for(var H;D!==n||l!==0&&D.nodeType!==3||(v=d+l),D!==a||r!==0&&D.nodeType!==3||(E=d+r),D.nodeType===3&&(d+=D.nodeValue.length),(H=D.firstChild)!==null;)M=D,D=H;for(;;){if(D===e)break t;if(M===n&&++_===l&&(v=d),M===a&&++A===r&&(E=d),(H=D.nextSibling)!==null)break;D=M,M=D.parentNode}D=H}n=v===-1||E===-1?null:{start:v,end:E}}else n=null}n=n||{start:0,end:0}}else n=null;for(Li={focusedElem:e,selectionRange:n},Io=!1,K=t;K!==null;)if(t=K,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var Q=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(Q!==null){var J=Q.memoizedProps,Fe=Q.memoizedState,P=t.stateNode,S=P.getSnapshotBeforeUpdate(t.elementType===t.type?J:kt(t.type,J),Fe);P.__reactInternalSnapshotBeforeUpdate=S}break;case 3:var R=t.stateNode.containerInfo;R.nodeType===1?R.textContent="":R.nodeType===9&&R.documentElement&&R.removeChild(R.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(F){Ae(t,t.return,F)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return Q=Yc,Yc=!1,Q}function oo(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var a=l.destroy;l.destroy=void 0,a!==void 0&&ws(t,n,a)}l=l.next}while(l!==r)}}function dl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Es(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Xc(e){var t=e.alternate;t!==null&&(e.alternate=null,Xc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[_t],delete t[Kr],delete t[Di],delete t[ph],delete t[mh])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Jc(e){return e.tag===5||e.tag===3||e.tag===4}function Zc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Jc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function xs(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Vo));else if(r!==4&&(e=e.child,e!==null))for(xs(e,t,n),e=e.sibling;e!==null;)xs(e,t,n),e=e.sibling}function Ss(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ss(e,t,n),e=e.sibling;e!==null;)Ss(e,t,n),e=e.sibling}var Ye=null,Ct=!1;function sn(e,t,n){for(n=n.child;n!==null;)qc(e,t,n),n=n.sibling}function qc(e,t,n){if(Rt&&typeof Rt.onCommitFiberUnmount=="function")try{Rt.onCommitFiberUnmount(Co,n)}catch{}switch(n.tag){case 5:et||fr(n,t);case 6:var r=Ye,l=Ct;Ye=null,sn(e,t,n),Ye=r,Ct=l,Ye!==null&&(Ct?(e=Ye,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ye.removeChild(n.stateNode));break;case 18:Ye!==null&&(Ct?(e=Ye,n=n.stateNode,e.nodeType===8?zi(e.parentNode,n):e.nodeType===1&&zi(e,n),Dr(e)):zi(Ye,n.stateNode));break;case 4:r=Ye,l=Ct,Ye=n.stateNode.containerInfo,Ct=!0,sn(e,t,n),Ye=r,Ct=l;break;case 0:case 11:case 14:case 15:if(!et&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var a=l,d=a.destroy;a=a.tag,d!==void 0&&((a&2)!==0||(a&4)!==0)&&ws(n,t,d),l=l.next}while(l!==r)}sn(e,t,n);break;case 1:if(!et&&(fr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(v){Ae(n,t,v)}sn(e,t,n);break;case 21:sn(e,t,n);break;case 22:n.mode&1?(et=(r=et)||n.memoizedState!==null,sn(e,t,n),et=r):sn(e,t,n);break;default:sn(e,t,n)}}function ed(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ih),t.forEach(function(r){var l=Uh.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Nt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=d),r&=~a}if(r=l,r=be()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Mh(r/1960))-r,10e?16:e,un===null)var r=!1;else{if(e=un,un=null,vl=0,(ve&6)!==0)throw Error(i(331));var l=ve;for(ve|=4,K=e.current;K!==null;){var a=K,d=a.child;if((K.flags&16)!==0){var v=a.deletions;if(v!==null){for(var E=0;Ebe()-Ns?In(e,0):Cs|=n),st(e,t)}function pd(e,t){t===0&&((e.mode&1)===0?t=1:(t=Po,Po<<=1,(Po&130023424)===0&&(Po=4194304)));var n=nt();e=bt(e,t),e!==null&&(Or(e,t,n),st(e,n))}function jh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),pd(e,n)}function Uh(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(i(314))}r!==null&&r.delete(t),pd(e,n)}var md;md=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||rt.current)lt=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return lt=!1,Th(e,t,n);lt=(e.flags&131072)!==0}else lt=!1,Re&&(t.flags&1048576)!==0&&Ku(t,Qo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ul(e,t),e=t.pendingProps;var l=rr(t,Je.current);ur(t,n),l=ns(null,t,r,e,l,n);var a=rs();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ot(r)?(a=!0,Ho(t)):a=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Yi(t),l.updater=sl,t.stateNode=l,l._reactInternals=t,us(t,r,e,n),t=ps(null,t,r,!0,a,n)):(t.tag=0,Re&&a&&ji(t),tt(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ul(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Vh(r),e=kt(r,e),l){case 0:t=fs(null,t,r,e,n);break e;case 1:t=Uc(null,t,r,e,n);break e;case 11:t=zc(null,t,r,e,n);break e;case 14:t=Dc(null,t,r,kt(r.type,e),n);break e}throw Error(i(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:kt(r,l),fs(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:kt(r,l),Uc(e,t,r,l,n);case 3:e:{if($c(t),e===null)throw Error(i(387));r=t.pendingProps,a=t.memoizedState,l=a.element,nc(e,t),el(t,r,null,n);var d=t.memoizedState;if(r=d.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:d.cache,pendingSuspenseBoundaries:d.pendingSuspenseBoundaries,transitions:d.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){l=dr(Error(i(423)),t),t=Vc(e,t,r,n,l);break e}else if(r!==l){l=dr(Error(i(424)),t),t=Vc(e,t,r,n,l);break e}else for(dt=en(t.stateNode.containerInfo.firstChild),ct=t,Re=!0,St=null,n=ec(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ir(),r===l){t=jt(e,t,n);break e}tt(e,t,r,n)}t=t.child}return t;case 5:return lc(t),e===null&&Vi(t),r=t.type,l=t.pendingProps,a=e!==null?e.memoizedProps:null,d=l.children,Mi(r,l)?d=null:a!==null&&Mi(r,a)&&(t.flags|=32),jc(e,t),tt(e,t,d,n),t.child;case 6:return e===null&&Vi(t),null;case 13:return Bc(e,t,n);case 4:return Xi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=sr(t,null,r,n):tt(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:kt(r,l),zc(e,t,r,l,n);case 7:return tt(e,t,t.pendingProps,n),t.child;case 8:return tt(e,t,t.pendingProps.children,n),t.child;case 12:return tt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,a=t.memoizedProps,d=l.value,ke(Jo,r._currentValue),r._currentValue=d,a!==null)if(xt(a.value,d)){if(a.children===l.children&&!rt.current){t=jt(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var v=a.dependencies;if(v!==null){d=a.child;for(var E=v.firstContext;E!==null;){if(E.context===r){if(a.tag===1){E=Ft(-1,n&-n),E.tag=2;var _=a.updateQueue;if(_!==null){_=_.shared;var A=_.pending;A===null?E.next=E:(E.next=A.next,A.next=E),_.pending=E}}a.lanes|=n,E=a.alternate,E!==null&&(E.lanes|=n),Ki(a.return,n,t),v.lanes|=n;break}E=E.next}}else if(a.tag===10)d=a.type===t.type?null:a.child;else if(a.tag===18){if(d=a.return,d===null)throw Error(i(341));d.lanes|=n,v=d.alternate,v!==null&&(v.lanes|=n),Ki(d,n,t),d=a.sibling}else d=a.child;if(d!==null)d.return=a;else for(d=a;d!==null;){if(d===t){d=null;break}if(a=d.sibling,a!==null){a.return=d.return,d=a;break}d=d.return}a=d}tt(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,ur(t,n),l=ht(l),r=r(l),t.flags|=1,tt(e,t,r,n),t.child;case 14:return r=t.type,l=kt(r,t.pendingProps),l=kt(r.type,l),Dc(e,t,r,l,n);case 15:return bc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:kt(r,l),ul(e,t),t.tag=1,ot(r)?(e=!0,Ho(t)):e=!1,ur(t,n),Rc(t,r,l),us(t,r,l,n),ps(null,t,r,!0,e,n);case 19:return Hc(e,t,n);case 22:return Fc(e,t,n)}throw Error(i(156,t.tag))};function hd(e,t){return Qa(e,t)}function $h(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yt(e,t,n,r){return new $h(e,t,n,r)}function Ms(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vh(e){if(typeof e=="function")return Ms(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Me)return 11;if(e===Ee)return 14}return 2}function fn(e,t){var n=e.alternate;return n===null?(n=yt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function El(e,t,n,r,l,a){var d=2;if(r=e,typeof e=="function")Ms(e)&&(d=1);else if(typeof e=="string")d=5;else e:switch(e){case oe:return Ln(n.children,l,a,t);case $:d=8,l|=8;break;case we:return e=yt(12,n,t,l|2),e.elementType=we,e.lanes=a,e;case De:return e=yt(13,n,t,l),e.elementType=De,e.lanes=a,e;case le:return e=yt(19,n,t,l),e.elementType=le,e.lanes=a,e;case me:return xl(n,l,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Te:d=10;break e;case Le:d=9;break e;case Me:d=11;break e;case Ee:d=14;break e;case ce:d=16,r=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=yt(d,n,t,l),t.elementType=e,t.type=r,t.lanes=a,t}function Ln(e,t,n,r){return e=yt(7,e,r,t),e.lanes=n,e}function xl(e,t,n,r){return e=yt(22,e,r,t),e.elementType=me,e.lanes=n,e.stateNode={isHidden:!1},e}function As(e,t,n){return e=yt(6,e,null,t),e.lanes=n,e}function zs(e,t,n){return t=yt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Bh(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ai(0),this.expirationTimes=ai(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ai(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ds(e,t,n,r,l,a,d,v,E){return e=new Bh(e,t,n,v,E),t===1?(t=1,a===!0&&(t|=8)):t=0,a=yt(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yi(a),e}function Wh(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(s){console.error(s)}}return o(),$s.exports=ev(),$s.exports}var Td;function tv(){if(Td)return Rl;Td=1;var o=ef();return Rl.createRoot=o.createRoot,Rl.hydrateRoot=o.hydrateRoot,Rl}var nv=tv();const rv=ua(nv);var fa=ef();const ov=ua(fa);/** - * @remix-run/router v1.23.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function po(){return po=Object.assign?Object.assign.bind():function(o){for(var s=1;s"u")throw new Error(s)}function tf(o,s){if(!o){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function iv(){return Math.random().toString(36).substr(2,8)}function _d(o,s){return{usr:o.state,key:o.key,idx:s}}function Zs(o,s,i,u){return i===void 0&&(i=null),po({pathname:typeof o=="string"?o:o.pathname,search:"",hash:""},typeof s=="string"?yr(s):s,{state:i,key:s&&s.key||u||iv()})}function Dl(o){let{pathname:s="/",search:i="",hash:u=""}=o;return i&&i!=="?"&&(s+=i.charAt(0)==="?"?i:"?"+i),u&&u!=="#"&&(s+=u.charAt(0)==="#"?u:"#"+u),s}function yr(o){let s={};if(o){let i=o.indexOf("#");i>=0&&(s.hash=o.substr(i),o=o.substr(0,i));let u=o.indexOf("?");u>=0&&(s.search=o.substr(u),o=o.substr(0,u)),o&&(s.pathname=o)}return s}function sv(o,s,i,u){u===void 0&&(u={});let{window:c=document.defaultView,v5Compat:f=!1}=u,h=c.history,w=vn.Pop,g=null,y=k();y==null&&(y=0,h.replaceState(po({},h.state,{idx:y}),""));function k(){return(h.state||{idx:null}).idx}function x(){w=vn.Pop;let N=k(),U=N==null?null:N-y;y=N,g&&g({action:w,location:T.location,delta:U})}function I(N,U){w=vn.Push;let V=Zs(T.location,N,U);y=k()+1;let j=_d(V,y),G=T.createHref(V);try{h.pushState(j,"",G)}catch(ie){if(ie instanceof DOMException&&ie.name==="DataCloneError")throw ie;c.location.assign(G)}f&&g&&g({action:w,location:T.location,delta:1})}function z(N,U){w=vn.Replace;let V=Zs(T.location,N,U);y=k();let j=_d(V,y),G=T.createHref(V);h.replaceState(j,"",G),f&&g&&g({action:w,location:T.location,delta:0})}function b(N){let U=c.location.origin!=="null"?c.location.origin:c.location.href,V=typeof N=="string"?N:Dl(N);return V=V.replace(/ $/,"%20"),Ue(U,"No window.location.(origin|href) available to create URL for href: "+V),new URL(V,U)}let T={get action(){return w},get location(){return o(c,h)},listen(N){if(g)throw new Error("A history only accepts one active listener");return c.addEventListener(Rd,x),g=N,()=>{c.removeEventListener(Rd,x),g=null}},createHref(N){return s(c,N)},createURL:b,encodeLocation(N){let U=b(N);return{pathname:U.pathname,search:U.search,hash:U.hash}},push:I,replace:z,go(N){return h.go(N)}};return T}var Id;(function(o){o.data="data",o.deferred="deferred",o.redirect="redirect",o.error="error"})(Id||(Id={}));function av(o,s,i){return i===void 0&&(i="/"),uv(o,s,i)}function uv(o,s,i,u){let c=typeof s=="string"?yr(s):s,f=pa(c.pathname||"/",i);if(f==null)return null;let h=nf(o);cv(h);let w=null;for(let g=0;w==null&&g{let g={relativePath:w===void 0?f.path||"":w,caseSensitive:f.caseSensitive===!0,childrenIndex:h,route:f};g.relativePath.startsWith("/")&&(Ue(g.relativePath.startsWith(u),'Absolute route path "'+g.relativePath+'" nested under path '+('"'+u+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),g.relativePath=g.relativePath.slice(u.length));let y=gn([u,g.relativePath]),k=i.concat(g);f.children&&f.children.length>0&&(Ue(f.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+y+'".')),nf(f.children,s,k,y)),!(f.path==null&&!f.index)&&s.push({path:y,score:gv(y,f.index),routesMeta:k})};return o.forEach((f,h)=>{var w;if(f.path===""||!((w=f.path)!=null&&w.includes("?")))c(f,h);else for(let g of rf(f.path))c(f,h,g)}),s}function rf(o){let s=o.split("/");if(s.length===0)return[];let[i,...u]=s,c=i.endsWith("?"),f=i.replace(/\?$/,"");if(u.length===0)return c?[f,""]:[f];let h=rf(u.join("/")),w=[];return w.push(...h.map(g=>g===""?f:[f,g].join("/"))),c&&w.push(...h),w.map(g=>o.startsWith("/")&&g===""?"/":g)}function cv(o){o.sort((s,i)=>s.score!==i.score?i.score-s.score:yv(s.routesMeta.map(u=>u.childrenIndex),i.routesMeta.map(u=>u.childrenIndex)))}const dv=/^:[\w-]+$/,fv=3,pv=2,mv=1,hv=10,vv=-2,Od=o=>o==="*";function gv(o,s){let i=o.split("/"),u=i.length;return i.some(Od)&&(u+=vv),s&&(u+=pv),i.filter(c=>!Od(c)).reduce((c,f)=>c+(dv.test(f)?fv:f===""?mv:hv),u)}function yv(o,s){return o.length===s.length&&o.slice(0,-1).every((u,c)=>u===s[c])?o[o.length-1]-s[s.length-1]:0}function wv(o,s,i){let{routesMeta:u}=o,c={},f="/",h=[];for(let w=0;w{let{paramName:I,isOptional:z}=k;if(I==="*"){let T=w[x]||"";h=f.slice(0,f.length-T.length).replace(/(.)\/+$/,"$1")}const b=w[x];return z&&!b?y[I]=void 0:y[I]=(b||"").replace(/%2F/g,"/"),y},{}),pathname:f,pathnameBase:h,pattern:o}}function xv(o,s,i){s===void 0&&(s=!1),i===void 0&&(i=!0),tf(o==="*"||!o.endsWith("*")||o.endsWith("/*"),'Route path "'+o+'" will be treated as if it were '+('"'+o.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+o.replace(/\*$/,"/*")+'".'));let u=[],c="^"+o.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,w,g)=>(u.push({paramName:w,isOptional:g!=null}),g?"/?([^\\/]+)?":"/([^\\/]+)"));return o.endsWith("*")?(u.push({paramName:"*"}),c+=o==="*"||o==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?c+="\\/*$":o!==""&&o!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),u]}function Sv(o){try{return o.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return tf(!1,'The URL path "'+o+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+s+").")),o}}function pa(o,s){if(s==="/")return o;if(!o.toLowerCase().startsWith(s.toLowerCase()))return null;let i=s.endsWith("/")?s.length-1:s.length,u=o.charAt(i);return u&&u!=="/"?null:o.slice(i)||"/"}function kv(o,s){s===void 0&&(s="/");let{pathname:i,search:u="",hash:c=""}=typeof o=="string"?yr(o):o;return{pathname:i?i.startsWith("/")?i:Cv(i,s):s,search:Tv(u),hash:Rv(c)}}function Cv(o,s){let i=s.replace(/\/+$/,"").split("/");return o.split("/").forEach(c=>{c===".."?i.length>1&&i.pop():c!=="."&&i.push(c)}),i.length>1?i.join("/"):"/"}function Ws(o,s,i,u){return"Cannot include a '"+o+"' character in a manually specified "+("`to."+s+"` field ["+JSON.stringify(u)+"]. Please separate it out to the ")+("`to."+i+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Nv(o){return o.filter((s,i)=>i===0||s.route.path&&s.route.path.length>0)}function of(o,s){let i=Nv(o);return s?i.map((u,c)=>c===i.length-1?u.pathname:u.pathnameBase):i.map(u=>u.pathnameBase)}function lf(o,s,i,u){u===void 0&&(u=!1);let c;typeof o=="string"?c=yr(o):(c=po({},o),Ue(!c.pathname||!c.pathname.includes("?"),Ws("?","pathname","search",c)),Ue(!c.pathname||!c.pathname.includes("#"),Ws("#","pathname","hash",c)),Ue(!c.search||!c.search.includes("#"),Ws("#","search","hash",c)));let f=o===""||c.pathname==="",h=f?"/":c.pathname,w;if(h==null)w=i;else{let x=s.length-1;if(!u&&h.startsWith("..")){let I=h.split("/");for(;I[0]==="..";)I.shift(),x-=1;c.pathname=I.join("/")}w=x>=0?s[x]:"/"}let g=kv(c,w),y=h&&h!=="/"&&h.endsWith("/"),k=(f||h===".")&&i.endsWith("/");return!g.pathname.endsWith("/")&&(y||k)&&(g.pathname+="/"),g}const gn=o=>o.join("/").replace(/\/\/+/g,"/"),Pv=o=>o.replace(/\/+$/,"").replace(/^\/*/,"/"),Tv=o=>!o||o==="?"?"":o.startsWith("?")?o:"?"+o,Rv=o=>!o||o==="#"?"":o.startsWith("#")?o:"#"+o;function _v(o){return o!=null&&typeof o.status=="number"&&typeof o.statusText=="string"&&typeof o.internal=="boolean"&&"data"in o}const sf=["post","put","patch","delete"];new Set(sf);const Iv=["get",...sf];new Set(Iv);/** - * React Router v6.30.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function mo(){return mo=Object.assign?Object.assign.bind():function(o){for(var s=1;s{w.current=!0}),p.useCallback(function(y,k){if(k===void 0&&(k={}),!w.current)return;if(typeof y=="number"){u.go(y);return}let x=lf(y,JSON.parse(h),f,k.relative==="path");o==null&&s!=="/"&&(x.pathname=x.pathname==="/"?s:gn([s,x.pathname])),(k.replace?u.replace:u.push)(x,k.state,k)},[s,u,h,f,o])}function cf(o,s){let{relative:i}=s===void 0?{}:s,{future:u}=p.useContext($n),{matches:c}=p.useContext(Vn),{pathname:f}=Ul(),h=JSON.stringify(of(c,u.v7_relativeSplatPath));return p.useMemo(()=>lf(o,JSON.parse(h),f,i==="path"),[o,h,f,i])}function Av(o,s){return zv(o,s)}function zv(o,s,i,u){vo()||Ue(!1);let{navigator:c}=p.useContext($n),{matches:f}=p.useContext(Vn),h=f[f.length-1],w=h?h.params:{};h&&h.pathname;let g=h?h.pathnameBase:"/";h&&h.route;let y=Ul(),k;if(s){var x;let N=typeof s=="string"?yr(s):s;g==="/"||(x=N.pathname)!=null&&x.startsWith(g)||Ue(!1),k=N}else k=y;let I=k.pathname||"/",z=I;if(g!=="/"){let N=g.replace(/^\//,"").split("/");z="/"+I.replace(/^\//,"").split("/").slice(N.length).join("/")}let b=av(o,{pathname:z}),T=Uv(b&&b.map(N=>Object.assign({},N,{params:Object.assign({},w,N.params),pathname:gn([g,c.encodeLocation?c.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?g:gn([g,c.encodeLocation?c.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),f,i,u);return s&&T?p.createElement(jl.Provider,{value:{location:mo({pathname:"/",search:"",hash:"",state:null,key:"default"},k),navigationType:vn.Pop}},T):T}function Dv(){let o=Wv(),s=_v(o)?o.status+" "+o.statusText:o instanceof Error?o.message:JSON.stringify(o),i=o instanceof Error?o.stack:null,c={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},s),i?p.createElement("pre",{style:c},i):null,null)}const bv=p.createElement(Dv,null);class Fv extends p.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,i){return i.location!==s.location||i.revalidation!=="idle"&&s.revalidation==="idle"?{error:s.error,location:s.location,revalidation:s.revalidation}:{error:s.error!==void 0?s.error:i.error,location:i.location,revalidation:s.revalidation||i.revalidation}}componentDidCatch(s,i){console.error("React Router caught the following error during render",s,i)}render(){return this.state.error!==void 0?p.createElement(Vn.Provider,{value:this.props.routeContext},p.createElement(af.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function jv(o){let{routeContext:s,match:i,children:u}=o,c=p.useContext(ma);return c&&c.static&&c.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=i.route.id),p.createElement(Vn.Provider,{value:s},u)}function Uv(o,s,i,u){var c;if(s===void 0&&(s=[]),i===void 0&&(i=null),u===void 0&&(u=null),o==null){var f;if(!i)return null;if(i.errors)o=i.matches;else if((f=u)!=null&&f.v7_partialHydration&&s.length===0&&!i.initialized&&i.matches.length>0)o=i.matches;else return null}let h=o,w=(c=i)==null?void 0:c.errors;if(w!=null){let k=h.findIndex(x=>x.route.id&&w?.[x.route.id]!==void 0);k>=0||Ue(!1),h=h.slice(0,Math.min(h.length,k+1))}let g=!1,y=-1;if(i&&u&&u.v7_partialHydration)for(let k=0;k=0?h=h.slice(0,y+1):h=[h[0]];break}}}return h.reduceRight((k,x,I)=>{let z,b=!1,T=null,N=null;i&&(z=w&&x.route.id?w[x.route.id]:void 0,T=x.route.errorElement||bv,g&&(y<0&&I===0?(Gv("route-fallback"),b=!0,N=null):y===I&&(b=!0,N=x.route.hydrateFallbackElement||null)));let U=s.concat(h.slice(0,I+1)),V=()=>{let j;return z?j=T:b?j=N:x.route.Component?j=p.createElement(x.route.Component,null):x.route.element?j=x.route.element:j=k,p.createElement(jv,{match:x,routeContext:{outlet:k,matches:U,isDataRoute:i!=null},children:j})};return i&&(x.route.ErrorBoundary||x.route.errorElement||I===0)?p.createElement(Fv,{location:i.location,revalidation:i.revalidation,component:T,error:z,children:V(),routeContext:{outlet:null,matches:U,isDataRoute:!0}}):V()},null)}var df=function(o){return o.UseBlocker="useBlocker",o.UseRevalidator="useRevalidator",o.UseNavigateStable="useNavigate",o}(df||{}),ff=function(o){return o.UseBlocker="useBlocker",o.UseLoaderData="useLoaderData",o.UseActionData="useActionData",o.UseRouteError="useRouteError",o.UseNavigation="useNavigation",o.UseRouteLoaderData="useRouteLoaderData",o.UseMatches="useMatches",o.UseRevalidator="useRevalidator",o.UseNavigateStable="useNavigate",o.UseRouteId="useRouteId",o}(ff||{});function $v(o){let s=p.useContext(ma);return s||Ue(!1),s}function Vv(o){let s=p.useContext(Ov);return s||Ue(!1),s}function Bv(o){let s=p.useContext(Vn);return s||Ue(!1),s}function pf(o){let s=Bv(),i=s.matches[s.matches.length-1];return i.route.id||Ue(!1),i.route.id}function Wv(){var o;let s=p.useContext(af),i=Vv(),u=pf();return s!==void 0?s:(o=i.errors)==null?void 0:o[u]}function Hv(){let{router:o}=$v(df.UseNavigateStable),s=pf(ff.UseNavigateStable),i=p.useRef(!1);return uf(()=>{i.current=!0}),p.useCallback(function(c,f){f===void 0&&(f={}),i.current&&(typeof c=="number"?o.navigate(c):o.navigate(c,mo({fromRouteId:s},f)))},[o,s])}const Ld={};function Gv(o,s,i){Ld[o]||(Ld[o]=!0)}function Kv(o,s){o?.v7_startTransition,o?.v7_relativeSplatPath}function zn(o){Ue(!1)}function Qv(o){let{basename:s="/",children:i=null,location:u,navigationType:c=vn.Pop,navigator:f,static:h=!1,future:w}=o;vo()&&Ue(!1);let g=s.replace(/^\/*/,"/"),y=p.useMemo(()=>({basename:g,navigator:f,static:h,future:mo({v7_relativeSplatPath:!1},w)}),[g,w,f,h]);typeof u=="string"&&(u=yr(u));let{pathname:k="/",search:x="",hash:I="",state:z=null,key:b="default"}=u,T=p.useMemo(()=>{let N=pa(k,g);return N==null?null:{location:{pathname:N,search:x,hash:I,state:z,key:b},navigationType:c}},[g,k,x,I,z,b,c]);return T==null?null:p.createElement($n.Provider,{value:y},p.createElement(jl.Provider,{children:i,value:T}))}function Yv(o){let{children:s,location:i}=o;return Av(qs(s),i)}new Promise(()=>{});function qs(o,s){s===void 0&&(s=[]);let i=[];return p.Children.forEach(o,(u,c)=>{if(!p.isValidElement(u))return;let f=[...s,c];if(u.type===p.Fragment){i.push.apply(i,qs(u.props.children,f));return}u.type!==zn&&Ue(!1),!u.props.index||!u.props.children||Ue(!1);let h={id:u.props.id||f.join("-"),caseSensitive:u.props.caseSensitive,element:u.props.element,Component:u.props.Component,index:u.props.index,path:u.props.path,loader:u.props.loader,action:u.props.action,errorElement:u.props.errorElement,ErrorBoundary:u.props.ErrorBoundary,hasErrorBoundary:u.props.ErrorBoundary!=null||u.props.errorElement!=null,shouldRevalidate:u.props.shouldRevalidate,handle:u.props.handle,lazy:u.props.lazy};u.props.children&&(h.children=qs(u.props.children,f)),i.push(h)}),i}/** - * React Router DOM v6.30.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function ea(){return ea=Object.assign?Object.assign.bind():function(o){for(var s=1;s=0)&&(i[c]=o[c]);return i}function Jv(o){return!!(o.metaKey||o.altKey||o.ctrlKey||o.shiftKey)}function Zv(o,s){return o.button===0&&(!s||s==="_self")&&!Jv(o)}const qv=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],eg="6";try{window.__reactRouterVersion=eg}catch{}const tg="startTransition",Md=da[tg];function ng(o){let{basename:s,children:i,future:u,window:c}=o,f=p.useRef();f.current==null&&(f.current=lv({window:c,v5Compat:!0}));let h=f.current,[w,g]=p.useState({action:h.action,location:h.location}),{v7_startTransition:y}=u||{},k=p.useCallback(x=>{y&&Md?Md(()=>g(x)):g(x)},[g,y]);return p.useLayoutEffect(()=>h.listen(k),[h,k]),p.useEffect(()=>Kv(u),[u]),p.createElement(Qv,{basename:s,children:i,location:w.location,navigationType:w.action,navigator:h,future:u})}const rg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",og=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Dn=p.forwardRef(function(s,i){let{onClick:u,relative:c,reloadDocument:f,replace:h,state:w,target:g,to:y,preventScrollReset:k,viewTransition:x}=s,I=Xv(s,qv),{basename:z}=p.useContext($n),b,T=!1;if(typeof y=="string"&&og.test(y)&&(b=y,rg))try{let j=new URL(window.location.href),G=y.startsWith("//")?new URL(j.protocol+y):new URL(y),ie=pa(G.pathname,z);G.origin===j.origin&&ie!=null?y=ie+G.search+G.hash:T=!0}catch{}let N=Lv(y,{relative:c}),U=lg(y,{replace:h,state:w,target:g,preventScrollReset:k,relative:c,viewTransition:x});function V(j){u&&u(j),j.defaultPrevented||U(j)}return p.createElement("a",ea({},I,{href:b||N,onClick:T||f?u:V,ref:i,target:g}))});var Ad;(function(o){o.UseScrollRestoration="useScrollRestoration",o.UseSubmit="useSubmit",o.UseSubmitFetcher="useSubmitFetcher",o.UseFetcher="useFetcher",o.useViewTransitionState="useViewTransitionState"})(Ad||(Ad={}));var zd;(function(o){o.UseFetcher="useFetcher",o.UseFetchers="useFetchers",o.UseScrollRestoration="useScrollRestoration"})(zd||(zd={}));function lg(o,s){let{target:i,replace:u,state:c,preventScrollReset:f,relative:h,viewTransition:w}=s===void 0?{}:s,g=Bn(),y=Ul(),k=cf(o,{relative:h});return p.useCallback(x=>{if(Zv(x,i)){x.preventDefault();let I=u!==void 0?u:Dl(y)===Dl(k);g(o,{replace:I,state:c,preventScrollReset:f,relative:h,viewTransition:w})}},[y,g,k,u,c,i,o,f,h,w])}const ig=[{id:"1",name:"๊น€ํ…Œ์ŠคํŠธ",email:"test@example.com",password:"password123"},{id:"2",name:"์ด๊ฐœ๋ฐœ",email:"dev@example.com",password:"dev123"}],sg=[{id:"1",personality:"์™ธํ–ฅ์  ๋ฆฌ๋”ํ˜•",score:4.2,completedAt:"2024-01-15T10:30:00Z",answers:{}},{id:"2",personality:"๊ท ํ˜•์žกํžŒ ๋ถ„์„ํ˜•",score:3.8,completedAt:"2024-01-10T14:20:00Z",answers:{}}],Dd={"์™ธํ–ฅ์  ๋ฆฌ๋”ํ˜•":{movies:[{title:"์–ด๋ฒค์ ธ์Šค: ์—”๋“œ๊ฒŒ์ž„",description:"์˜์›…๋“ค์˜ ๋งˆ์ง€๋ง‰ ์ „ํˆฌ"},{title:"์ธํ„ฐ์Šคํ…”๋ผ",description:"์šฐ์ฃผ๋ฅผ ํ–ฅํ•œ ์ธ๋ฅ˜์˜ ๋„์ „"},{title:"๋‹คํฌ ๋‚˜์ดํŠธ",description:"์ •์˜์™€ ์•…์˜ ๋Œ€๊ฒฐ"},{title:"์ธ์…‰์…˜",description:"๊ฟˆ ์†์˜ ๊ฟˆ"},{title:"๋งค๋“œ ๋งฅ์Šค: ๋ถ„๋…ธ์˜ ๋„๋กœ",description:"ํฌ์ŠคํŠธ ์•„ํฌ์นผ๋ฆฝ์Šค ์•ก์…˜"}],books:[{title:"๋ฆฌ๋”์‹ญ์˜ ์ •์„",author:"์กด ๋งฅ์Šค์›ฐ",description:"๋ฆฌ๋”์‹ญ ๊ฐœ๋ฐœ ๊ฐ€์ด๋“œ"},{title:"์„ฑ๊ณตํ•˜๋Š” ์‚ฌ๋žŒ๋“ค์˜ 7๊ฐ€์ง€ ์Šต๊ด€",author:"์Šคํ‹ฐ๋ธ ์ฝ”๋น„",description:"์„ฑ๊ณต์„ ์œ„ํ•œ ์Šต๊ด€๋“ค"},{title:"์ƒ๊ฐ์— ๊ด€ํ•œ ์ƒ๊ฐ",author:"๋‹ค๋‹ˆ์—˜ ์นด๋„ˆ๋จผ",description:"์ธ๊ฐ„์˜ ์‚ฌ๊ณ  ๊ณผ์ • ๋ถ„์„"},{title:"๋„›์ง€",author:"๋ฆฌ์ฒ˜๋“œ ํƒˆ๋Ÿฌ",description:"์„ ํƒ ์„ค๊ณ„์˜ ํž˜"},{title:"๋ฆฐ ์Šคํƒ€ํŠธ์—…",author:"์—๋ฆญ ๋ฆฌ์Šค",description:"ํ˜์‹ ์  ์ฐฝ์—… ๋ฐฉ๋ฒ•๋ก "}],music:[{name:"Imagine Dragons",genre:"์–ผํ„ฐ๋„ˆํ‹ฐ๋ธŒ ๋ก",description:"์—๋„ˆ์ง€ ๋„˜์น˜๋Š” ๋ก ๋ฐด๋“œ"},{name:"OneRepublic",genre:"ํŒ ๋ก",description:"๊ฐ์„ฑ์ ์ธ ํŒ ๋ก"},{name:"Maroon 5",genre:"ํŒ",description:"์บ์น˜ํ•œ ํŒ ์Œ์•…"},{name:"Coldplay",genre:"์–ผํ„ฐ๋„ˆํ‹ฐ๋ธŒ ๋ก",description:"๋ชฝํ™˜์ ์ธ ๋ก ์‚ฌ์šด๋“œ"},{name:"The Chainsmokers",genre:"EDM",description:"๋Œ„์Šค ์ผ๋ ‰ํŠธ๋กœ๋‹‰"}]},"๊ท ํ˜•์žกํžŒ ๋ถ„์„ํ˜•":{movies:[{title:"์‡ผ์ƒํฌ ํƒˆ์ถœ",description:"ํฌ๋ง์— ๊ด€ํ•œ ์ด์•ผ๊ธฐ"},{title:"ํฌ๋ ˆ์ŠคํŠธ ๊ฒ€ํ”„",description:"์ธ์ƒ์˜ ์—ฌ์ •"},{title:"๊ตฟ ์œŒ ํ—ŒํŒ…",description:"์žฌ๋Šฅ๊ณผ ์„ฑ์žฅ"},{title:"์–ด๋ฐ”์›ƒ ํƒ€์ž„",description:"์‹œ๊ฐ„๊ณผ ์‚ฌ๋ž‘"},{title:"๋ผ๋ผ๋žœ๋“œ",description:"๊ฟˆ๊ณผ ํ˜„์‹ค"}],books:[{title:"์‚ฌํ”ผ์—”์Šค",author:"์œ ๋ฐœ ํ•˜๋ผ๋ฆฌ",description:"์ธ๋ฅ˜์˜ ์—ญ์‚ฌ"},{title:"์ด, ๊ท , ์‡ ",author:"์žฌ๋ ˆ๋“œ ๋‹ค์ด์•„๋ชฌ๋“œ",description:"๋ฌธ๋ช…์˜ ๋ฐœ์ „"},{title:"ํŒฉํŠธํ’€๋‹ˆ์Šค",author:"ํ•œ์Šค ๋กœ์Šฌ๋ง",description:"๋ฐ์ดํ„ฐ๋กœ ๋ณด๋Š” ์„ธ์ƒ"},{title:"์ฝ”์Šค๋ชจ์Šค",author:"์นผ ์„ธ์ด๊ฑด",description:"์šฐ์ฃผ์— ๋Œ€ํ•œ ํƒ๊ตฌ"},{title:"์ •์˜๋ž€ ๋ฌด์—‡์ธ๊ฐ€",author:"๋งˆ์ดํด ์ƒŒ๋ธ",description:"๋„๋• ์ฒ ํ•™"}],music:[{name:"Ed Sheeran",genre:"ํŒ",description:"๊ฐ์„ฑ์ ์ธ ์‹ฑ์–ด์†ก๋ผ์ดํ„ฐ"},{name:"John Mayer",genre:"๋ธ”๋ฃจ์Šค ๋ก",description:"๊ธฐํƒ€ ์—ฐ์ฃผ์˜ ๋Œ€๊ฐ€"},{name:"Adele",genre:"์†Œ์šธ",description:"๊ฐ•๋ ฅํ•œ ๋ณด์ปฌ"},{name:"Sam Smith",genre:"ํŒ",description:"๊ฐ์„ฑ์ ์ธ ๋ฐœ๋ผ๋“œ"},{name:"Billie Eilish",genre:"์–ผํ„ฐ๋„ˆํ‹ฐ๋ธŒ ํŒ",description:"๋…ํŠนํ•œ ์Œ์•… ์Šคํƒ€์ผ"}]},"์‹ ์ค‘ํ•œ ์‚ฌ์ƒ‰ํ˜•":{movies:[{title:"๊ธฐ์ƒ์ถฉ",description:"์‚ฌํšŒ์  ๋ฉ”์‹œ์ง€๊ฐ€ ๋‹ด๊ธด ์ž‘ํ’ˆ"},{title:"์˜ฌ๋“œ๋ณด์ด",description:"๋ณต์ˆ˜์™€ ์šด๋ ฅ"},{title:"๋ฒ„๋“œ๋งจ",description:"์˜ˆ์ˆ ๊ฐ€์˜ ๊ณ ๋‡Œ"},{title:"๋ฌธ๋ผ์ดํŠธ",description:"์ •์ฒด์„ฑ์— ๋Œ€ํ•œ ํƒ๊ตฌ"},{title:"๋…ธ๋งˆ๋“œ๋žœ๋“œ",description:"ํ˜„๋Œ€ ์‚ฌํšŒ์˜ ๊ณ ๋…"}],books:[{title:"1984",author:"์กฐ์ง€ ์˜ค์›ฐ",description:"๋””์Šคํ† ํ”ผ์•„ ์†Œ์„ค"},{title:"๋ฉ‹์ง„ ์‹ ์„ธ๊ณ„",author:"์˜ฌ๋”์Šค ํ—‰์Šฌ๋ฆฌ",description:"๋ฏธ๋ž˜ ์‚ฌํšŒ ๋น„ํŒ"},{title:"์นด๋ผ๋งˆ์กฐํ”„ ๊ฐ€์˜ ํ˜•์ œ๋“ค",author:"๋„์Šคํ† ์˜ˆํ”„์Šคํ‚ค",description:"์ธ๊ฐ„ ๋ณธ์„ฑ ํƒ๊ตฌ"},{title:"๋ฐฑ๋…„์˜ ๊ณ ๋…",author:"๊ฐ€๋ธŒ๋ฆฌ์—˜ ๊ฐ€๋ฅด์‹œ์•„ ๋งˆ๋ฅด์ผ€์Šค",description:"๋งˆ์ˆ ์  ๋ฆฌ์–ผ๋ฆฌ์ฆ˜"},{title:"๋ฐ๋ฏธ์•ˆ",author:"ํ—ค๋ฅด๋งŒ ํ—ค์„ธ",description:"์„ฑ์žฅ๊ณผ ์ž์•„ ๋ฐœ๊ฒฌ"}],music:[{name:"Radiohead",genre:"์–ผํ„ฐ๋„ˆํ‹ฐ๋ธŒ ๋ก",description:"์‹คํ—˜์ ์ธ ๋ก ์Œ์•…"},{name:"Bon Iver",genre:"์ธ๋”” ํฌํฌ",description:"๋ชฝํ™˜์ ์ธ ํฌํฌ"},{name:"Sufjan Stevens",genre:"์ธ๋”” ํฌํฌ",description:"์„œ์ •์ ์ธ ์Œ์•…"},{name:"The National",genre:"์ธ๋”” ๋ก",description:"์šฐ์šธํ•œ ๊ฐ์„ฑ์˜ ๋ก"},{name:"Arcade Fire",genre:"์ธ๋”” ๋ก",description:"์›…์žฅํ•œ ์ธ๋”” ๋ก"}]}},ag="http://localhost:8080/api",hn=async(o,s={})=>{const i=`${ag}${o}`,u={credentials:"include",headers:{"Content-Type":"application/json",...s.headers},...s};try{const c=await fetch(i,u);if(!c.ok){const f=await c.json().catch(()=>({message:c.statusText}));throw new Error(`HTTP error! status: ${c.status}, message: ${f.message||"Unknown error"}`)}return await c.json()}catch(c){throw console.error("API request failed:",c),c}},_l={login:async(o,s)=>hn("/auth/login",{method:"POST",body:JSON.stringify({email:o,password:s})}),register:async(o,s,i)=>hn("/auth/register",{method:"POST",body:JSON.stringify({name:o,email:s,password:i})}),logout:async()=>hn("/auth/logout",{method:"POST"}),getCurrentUser:async()=>hn("/auth/me"),validateToken:async()=>hn("/auth/validate")},ho={saveTestResult:async o=>{try{return await hn("/test/save",{method:"POST",body:JSON.stringify(o)})}catch{console.log("Backend API not available, saving to localStorage (dev mode)...");const i=JSON.parse(localStorage.getItem("dev-test-history")||"[]"),u={id:Date.now().toString(),...o,completedAt:o.completedAt||new Date().toISOString()};return i.unshift(u),localStorage.setItem("dev-test-history",JSON.stringify(i)),{success:!0,result:u}}},getTestHistory:async()=>{try{return await hn("/test/history")}catch{return console.log("Backend API not available, using localStorage (dev mode)..."),JSON.parse(localStorage.getItem("dev-test-history")||"[]")}},getRecommendations:async o=>{try{return await hn(`/recommendations/${o}`)}catch{return console.log("Backend API not available, using mock data (dev mode)..."),Dd[o]||Dd["๊ท ํ˜•์žกํžŒ ๋ถ„์„ํ˜•"]}}},ug=o=>{if(typeof document>"u")return null;const i=`; ${document.cookie}`.split(`; ${o}=`);return i.length===2?i.pop().split(";").shift():null},cg=o=>{typeof document>"u"||(document.cookie=`${o}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;SameSite=Lax`)},mf=p.createContext(void 0);function dg({children:o}){const[s,i]=p.useState(null),[u,c]=p.useState(!0);p.useEffect(()=>{f()},[]);const f=async()=>{try{if(ug("auth-token")){const k=await _l.getCurrentUser();i(k)}}catch{console.log("Backend API not available, checking local storage for dev user...");const k=localStorage.getItem("dev-user");k&&i(JSON.parse(k))}finally{c(!1)}},h=async(y,k)=>{try{const x=await _l.login(y,k);if(x.success)return i(x.user),!0}catch{console.log("Backend API not available, trying test accounts...");const I=ig.find(z=>z.email===y&&z.password===k);if(I){const z={id:I.id,name:I.name,email:I.email,personality:"์™ธํ–ฅ์  ๋ฆฌ๋”ํ˜•"};return i(z),localStorage.setItem("dev-user",JSON.stringify(z)),localStorage.setItem("dev-test-history",JSON.stringify(sg)),!0}}return!1},w=async(y,k,x)=>{try{const I=await _l.register(y,k,x);if(I.success)return i(I.user),!0}catch{console.log("Backend API not available, creating test account...");const z={id:Date.now().toString(),name:y,email:k,personality:null};return i(z),localStorage.setItem("dev-user",JSON.stringify(z)),!0}return!1},g=async()=>{try{await _l.logout()}catch(y){console.error("Logout failed:",y)}finally{i(null),cg("auth-token"),localStorage.removeItem("dev-user"),localStorage.removeItem("dev-test-history")}};return m.createElement(mf.Provider,{value:{user:s,login:h,register:w,logout:g,isLoading:u,checkAuthStatus:f}},o)}function wr(){const o=p.useContext(mf);if(o===void 0)throw new Error("useAuth must be used within an AuthProvider");return o}function hf(o){var s,i,u="";if(typeof o=="string"||typeof o=="number")u+=o;else if(typeof o=="object")if(Array.isArray(o)){var c=o.length;for(s=0;stypeof o=="boolean"?`${o}`:o===0?"0":o,Fd=vf,ha=(o,s)=>i=>{var u;if(s?.variants==null)return Fd(o,i?.class,i?.className);const{variants:c,defaultVariants:f}=s,h=Object.keys(c).map(y=>{const k=i?.[y],x=f?.[y];if(k===null)return null;const I=bd(k)||bd(x);return c[y][I]}),w=i&&Object.entries(i).reduce((y,k)=>{let[x,I]=k;return I===void 0||(y[x]=I),y},{}),g=s==null||(u=s.compoundVariants)===null||u===void 0?void 0:u.reduce((y,k)=>{let{class:x,className:I,...z}=k;return Object.entries(z).every(b=>{let[T,N]=b;return Array.isArray(N)?N.includes({...f,...w}[T]):{...f,...w}[T]===N})?[...y,x,I]:y},[]);return Fd(o,h,g,i?.class,i?.className)};/** - * @license lucide-react v0.525.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fg=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),pg=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(s,i,u)=>u?u.toUpperCase():i.toLowerCase()),jd=o=>{const s=pg(o);return s.charAt(0).toUpperCase()+s.slice(1)},gf=(...o)=>o.filter((s,i,u)=>!!s&&s.trim()!==""&&u.indexOf(s)===i).join(" ").trim(),mg=o=>{for(const s in o)if(s.startsWith("aria-")||s==="role"||s==="title")return!0};/** - * @license lucide-react v0.525.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var hg={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.525.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vg=p.forwardRef(({color:o="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:u,className:c="",children:f,iconNode:h,...w},g)=>p.createElement("svg",{ref:g,...hg,width:s,height:s,stroke:o,strokeWidth:u?Number(i)*24/Number(s):i,className:gf("lucide",c),...!f&&!mg(w)&&{"aria-hidden":"true"},...w},[...h.map(([y,k])=>p.createElement(y,k)),...Array.isArray(f)?f:[f]]));/** - * @license lucide-react v0.525.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yf=(o,s)=>{const i=p.forwardRef(({className:u,...c},f)=>p.createElement(vg,{ref:f,iconNode:s,className:gf(`lucide-${fg(jd(o))}`,`lucide-${o}`,u),...c}));return i.displayName=jd(o),i};/** - * @license lucide-react v0.525.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],yg=yf("circle",gg);/** - * @license lucide-react v0.525.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wg=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Eg=yf("x",wg);function Pe(o,s,{checkForDefaultPrevented:i=!0}={}){return function(c){if(o?.(c),i===!1||!c.defaultPrevented)return s?.(c)}}function Ud(o,s){if(typeof o=="function")return o(s);o!=null&&(o.current=s)}function wf(...o){return s=>{let i=!1;const u=o.map(c=>{const f=Ud(c,s);return!i&&typeof f=="function"&&(i=!0),f});if(i)return()=>{for(let c=0;c{const{scope:I,children:z,...b}=x,T=I?.[o]?.[g]||w,N=p.useMemo(()=>b,Object.values(b));return B.jsx(T.Provider,{value:N,children:z})};y.displayName=f+"Provider";function k(x,I){const z=I?.[o]?.[g]||w,b=p.useContext(z);if(b)return b;if(h!==void 0)return h;throw new Error(`\`${x}\` must be used within \`${f}\``)}return[y,k]}const c=()=>{const f=i.map(h=>p.createContext(h));return function(w){const g=w?.[o]||f;return p.useMemo(()=>({[`__scope${o}`]:{...w,[o]:g}}),[w,g])}};return c.scopeName=o,[u,kg(c,...s)]}function kg(...o){const s=o[0];if(o.length===1)return s;const i=()=>{const u=o.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(f){const h=u.reduce((w,{useScope:g,scopeName:y})=>{const x=g(f)[`__scope${y}`];return{...w,...x}},{});return p.useMemo(()=>({[`__scope${s.scopeName}`]:h}),[h])}};return i.scopeName=s.scopeName,i}function bl(o){const s=Ng(o),i=p.forwardRef((u,c)=>{const{children:f,...h}=u,w=p.Children.toArray(f),g=w.find(Tg);if(g){const y=g.props.children,k=w.map(x=>x===g?p.Children.count(y)>1?p.Children.only(null):p.isValidElement(y)?y.props.children:null:x);return B.jsx(s,{...h,ref:c,children:p.isValidElement(y)?p.cloneElement(y,void 0,k):null})}return B.jsx(s,{...h,ref:c,children:f})});return i.displayName=`${o}.Slot`,i}var Cg=bl("Slot");function Ng(o){const s=p.forwardRef((i,u)=>{const{children:c,...f}=i;if(p.isValidElement(c)){const h=_g(c),w=Rg(f,c.props);return c.type!==p.Fragment&&(w.ref=u?wf(u,h):h),p.cloneElement(c,w)}return p.Children.count(c)>1?p.Children.only(null):null});return s.displayName=`${o}.SlotClone`,s}var Pg=Symbol("radix.slottable");function Tg(o){return p.isValidElement(o)&&typeof o.type=="function"&&"__radixId"in o.type&&o.type.__radixId===Pg}function Rg(o,s){const i={...s};for(const u in s){const c=o[u],f=s[u];/^on[A-Z]/.test(u)?c&&f?i[u]=(...w)=>{const g=f(...w);return c(...w),g}:c&&(i[u]=c):u==="style"?i[u]={...c,...f}:u==="className"&&(i[u]=[c,f].filter(Boolean).join(" "))}return{...o,...i}}function _g(o){let s=Object.getOwnPropertyDescriptor(o.props,"ref")?.get,i=s&&"isReactWarning"in s&&s.isReactWarning;return i?o.ref:(s=Object.getOwnPropertyDescriptor(o,"ref")?.get,i=s&&"isReactWarning"in s&&s.isReactWarning,i?o.props.ref:o.props.ref||o.ref)}function Ef(o){const s=o+"CollectionProvider",[i,u]=Wn(s),[c,f]=i(s,{collectionRef:{current:null},itemMap:new Map}),h=T=>{const{scope:N,children:U}=T,V=m.useRef(null),j=m.useRef(new Map).current;return B.jsx(c,{scope:N,itemMap:j,collectionRef:V,children:U})};h.displayName=s;const w=o+"CollectionSlot",g=bl(w),y=m.forwardRef((T,N)=>{const{scope:U,children:V}=T,j=f(w,U),G=Tt(N,j.collectionRef);return B.jsx(g,{ref:G,children:V})});y.displayName=w;const k=o+"CollectionItemSlot",x="data-radix-collection-item",I=bl(k),z=m.forwardRef((T,N)=>{const{scope:U,children:V,...j}=T,G=m.useRef(null),ie=Tt(N,G),se=f(k,U);return m.useEffect(()=>(se.itemMap.set(G,{ref:G,...j}),()=>void se.itemMap.delete(G))),B.jsx(I,{[x]:"",ref:ie,children:V})});z.displayName=k;function b(T){const N=f(o+"CollectionConsumer",T);return m.useCallback(()=>{const V=N.collectionRef.current;if(!V)return[];const j=Array.from(V.querySelectorAll(`[${x}]`));return Array.from(N.itemMap.values()).sort((se,oe)=>j.indexOf(se.ref.current)-j.indexOf(oe.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:h,Slot:y,ItemSlot:z},b,u]}var Ig=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_e=Ig.reduce((o,s)=>{const i=bl(`Primitive.${s}`),u=p.forwardRef((c,f)=>{const{asChild:h,...w}=c,g=h?i:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),B.jsx(g,{...w,ref:f})});return u.displayName=`Primitive.${s}`,{...o,[s]:u}},{});function xf(o,s){o&&fa.flushSync(()=>o.dispatchEvent(s))}function yn(o){const s=p.useRef(o);return p.useEffect(()=>{s.current=o}),p.useMemo(()=>(...i)=>s.current?.(...i),[])}function Og(o,s=globalThis?.document){const i=yn(o);p.useEffect(()=>{const u=c=>{c.key==="Escape"&&i(c)};return s.addEventListener("keydown",u,{capture:!0}),()=>s.removeEventListener("keydown",u,{capture:!0})},[i,s])}var Lg="DismissableLayer",ta="dismissableLayer.update",Mg="dismissableLayer.pointerDownOutside",Ag="dismissableLayer.focusOutside",Bd,Sf=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kf=p.forwardRef((o,s)=>{const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onInteractOutside:h,onDismiss:w,...g}=o,y=p.useContext(Sf),[k,x]=p.useState(null),I=k?.ownerDocument??globalThis?.document,[,z]=p.useState({}),b=Tt(s,oe=>x(oe)),T=Array.from(y.layers),[N]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),U=T.indexOf(N),V=k?T.indexOf(k):-1,j=y.layersWithOutsidePointerEventsDisabled.size>0,G=V>=U,ie=Dg(oe=>{const $=oe.target,we=[...y.branches].some(Te=>Te.contains($));!G||we||(c?.(oe),h?.(oe),oe.defaultPrevented||w?.())},I),se=bg(oe=>{const $=oe.target;[...y.branches].some(Te=>Te.contains($))||(f?.(oe),h?.(oe),oe.defaultPrevented||w?.())},I);return Og(oe=>{V===y.layers.size-1&&(u?.(oe),!oe.defaultPrevented&&w&&(oe.preventDefault(),w()))},I),p.useEffect(()=>{if(k)return i&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(Bd=I.body.style.pointerEvents,I.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(k)),y.layers.add(k),Wd(),()=>{i&&y.layersWithOutsidePointerEventsDisabled.size===1&&(I.body.style.pointerEvents=Bd)}},[k,I,i,y]),p.useEffect(()=>()=>{k&&(y.layers.delete(k),y.layersWithOutsidePointerEventsDisabled.delete(k),Wd())},[k,y]),p.useEffect(()=>{const oe=()=>z({});return document.addEventListener(ta,oe),()=>document.removeEventListener(ta,oe)},[]),B.jsx(_e.div,{...g,ref:b,style:{pointerEvents:j?G?"auto":"none":void 0,...o.style},onFocusCapture:Pe(o.onFocusCapture,se.onFocusCapture),onBlurCapture:Pe(o.onBlurCapture,se.onBlurCapture),onPointerDownCapture:Pe(o.onPointerDownCapture,ie.onPointerDownCapture)})});kf.displayName=Lg;var zg="DismissableLayerBranch",Cf=p.forwardRef((o,s)=>{const i=p.useContext(Sf),u=p.useRef(null),c=Tt(s,u);return p.useEffect(()=>{const f=u.current;if(f)return i.branches.add(f),()=>{i.branches.delete(f)}},[i.branches]),B.jsx(_e.div,{...o,ref:c})});Cf.displayName=zg;function Dg(o,s=globalThis?.document){const i=yn(o),u=p.useRef(!1),c=p.useRef(()=>{});return p.useEffect(()=>{const f=w=>{if(w.target&&!u.current){let g=function(){Nf(Mg,i,y,{discrete:!0})};const y={originalEvent:w};w.pointerType==="touch"?(s.removeEventListener("click",c.current),c.current=g,s.addEventListener("click",c.current,{once:!0})):g()}else s.removeEventListener("click",c.current);u.current=!1},h=window.setTimeout(()=>{s.addEventListener("pointerdown",f)},0);return()=>{window.clearTimeout(h),s.removeEventListener("pointerdown",f),s.removeEventListener("click",c.current)}},[s,i]),{onPointerDownCapture:()=>u.current=!0}}function bg(o,s=globalThis?.document){const i=yn(o),u=p.useRef(!1);return p.useEffect(()=>{const c=f=>{f.target&&!u.current&&Nf(Ag,i,{originalEvent:f},{discrete:!1})};return s.addEventListener("focusin",c),()=>s.removeEventListener("focusin",c)},[s,i]),{onFocusCapture:()=>u.current=!0,onBlurCapture:()=>u.current=!1}}function Wd(){const o=new CustomEvent(ta);document.dispatchEvent(o)}function Nf(o,s,i,{discrete:u}){const c=i.originalEvent.target,f=new CustomEvent(o,{bubbles:!1,cancelable:!0,detail:i});s&&c.addEventListener(o,s,{once:!0}),u?xf(c,f):c.dispatchEvent(f)}var Fg=kf,jg=Cf,Un=globalThis?.document?p.useLayoutEffect:()=>{},Ug="Portal",Pf=p.forwardRef((o,s)=>{const{container:i,...u}=o,[c,f]=p.useState(!1);Un(()=>f(!0),[]);const h=i||c&&globalThis?.document?.body;return h?ov.createPortal(B.jsx(_e.div,{...u,ref:s}),h):null});Pf.displayName=Ug;function $g(o,s){return p.useReducer((i,u)=>s[i][u]??i,o)}var $l=o=>{const{present:s,children:i}=o,u=Vg(s),c=typeof i=="function"?i({present:u.isPresent}):p.Children.only(i),f=Tt(u.ref,Bg(c));return typeof i=="function"||u.isPresent?p.cloneElement(c,{ref:f}):null};$l.displayName="Presence";function Vg(o){const[s,i]=p.useState(),u=p.useRef(null),c=p.useRef(o),f=p.useRef("none"),h=o?"mounted":"unmounted",[w,g]=$g(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const y=Il(u.current);f.current=w==="mounted"?y:"none"},[w]),Un(()=>{const y=u.current,k=c.current;if(k!==o){const I=f.current,z=Il(y);o?g("MOUNT"):z==="none"||y?.display==="none"?g("UNMOUNT"):g(k&&I!==z?"ANIMATION_OUT":"UNMOUNT"),c.current=o}},[o,g]),Un(()=>{if(s){let y;const k=s.ownerDocument.defaultView??window,x=z=>{const T=Il(u.current).includes(z.animationName);if(z.target===s&&T&&(g("ANIMATION_END"),!c.current)){const N=s.style.animationFillMode;s.style.animationFillMode="forwards",y=k.setTimeout(()=>{s.style.animationFillMode==="forwards"&&(s.style.animationFillMode=N)})}},I=z=>{z.target===s&&(f.current=Il(u.current))};return s.addEventListener("animationstart",I),s.addEventListener("animationcancel",x),s.addEventListener("animationend",x),()=>{k.clearTimeout(y),s.removeEventListener("animationstart",I),s.removeEventListener("animationcancel",x),s.removeEventListener("animationend",x)}}else g("ANIMATION_END")},[s,g]),{isPresent:["mounted","unmountSuspended"].includes(w),ref:p.useCallback(y=>{u.current=y?getComputedStyle(y):null,i(y)},[])}}function Il(o){return o?.animationName||"none"}function Bg(o){let s=Object.getOwnPropertyDescriptor(o.props,"ref")?.get,i=s&&"isReactWarning"in s&&s.isReactWarning;return i?o.ref:(s=Object.getOwnPropertyDescriptor(o,"ref")?.get,i=s&&"isReactWarning"in s&&s.isReactWarning,i?o.props.ref:o.props.ref||o.ref)}var Wg=da[" useInsertionEffect ".trim().toString()]||Un;function Vl({prop:o,defaultProp:s,onChange:i=()=>{},caller:u}){const[c,f,h]=Hg({defaultProp:s,onChange:i}),w=o!==void 0,g=w?o:c;{const k=p.useRef(o!==void 0);p.useEffect(()=>{const x=k.current;x!==w&&console.warn(`${u} is changing from ${x?"controlled":"uncontrolled"} to ${w?"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.`),k.current=w},[w,u])}const y=p.useCallback(k=>{if(w){const x=Gg(k)?k(o):k;x!==o&&h.current?.(x)}else f(k)},[w,o,f,h]);return[g,y]}function Hg({defaultProp:o,onChange:s}){const[i,u]=p.useState(o),c=p.useRef(i),f=p.useRef(s);return Wg(()=>{f.current=s},[s]),p.useEffect(()=>{c.current!==i&&(f.current?.(i),c.current=i)},[i,c]),[i,u,f]}function Gg(o){return typeof o=="function"}var Kg=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"}),Qg="VisuallyHidden",va=p.forwardRef((o,s)=>B.jsx(_e.span,{...o,ref:s,style:{...Kg,...o.style}}));va.displayName=Qg;var ga="ToastProvider",[ya,Yg,Xg]=Ef("Toast"),[Tf,Z0]=Wn("Toast",[Xg]),[Jg,Bl]=Tf(ga),Rf=o=>{const{__scopeToast:s,label:i="Notification",duration:u=5e3,swipeDirection:c="right",swipeThreshold:f=50,children:h}=o,[w,g]=p.useState(null),[y,k]=p.useState(0),x=p.useRef(!1),I=p.useRef(!1);return i.trim()||console.error(`Invalid prop \`label\` supplied to \`${ga}\`. Expected non-empty \`string\`.`),B.jsx(ya.Provider,{scope:s,children:B.jsx(Jg,{scope:s,label:i,duration:u,swipeDirection:c,swipeThreshold:f,toastCount:y,viewport:w,onViewportChange:g,onToastAdd:p.useCallback(()=>k(z=>z+1),[]),onToastRemove:p.useCallback(()=>k(z=>z-1),[]),isFocusedToastEscapeKeyDownRef:x,isClosePausedRef:I,children:h})})};Rf.displayName=ga;var _f="ToastViewport",Zg=["F8"],na="toast.viewportPause",ra="toast.viewportResume",If=p.forwardRef((o,s)=>{const{__scopeToast:i,hotkey:u=Zg,label:c="Notifications ({hotkey})",...f}=o,h=Bl(_f,i),w=Yg(i),g=p.useRef(null),y=p.useRef(null),k=p.useRef(null),x=p.useRef(null),I=Tt(s,x,h.onViewportChange),z=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=h.toastCount>0;p.useEffect(()=>{const N=U=>{u.length!==0&&u.every(j=>U[j]||U.code===j)&&x.current?.focus()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[u]),p.useEffect(()=>{const N=g.current,U=x.current;if(b&&N&&U){const V=()=>{if(!h.isClosePausedRef.current){const se=new CustomEvent(na);U.dispatchEvent(se),h.isClosePausedRef.current=!0}},j=()=>{if(h.isClosePausedRef.current){const se=new CustomEvent(ra);U.dispatchEvent(se),h.isClosePausedRef.current=!1}},G=se=>{!N.contains(se.relatedTarget)&&j()},ie=()=>{N.contains(document.activeElement)||j()};return N.addEventListener("focusin",V),N.addEventListener("focusout",G),N.addEventListener("pointermove",V),N.addEventListener("pointerleave",ie),window.addEventListener("blur",V),window.addEventListener("focus",j),()=>{N.removeEventListener("focusin",V),N.removeEventListener("focusout",G),N.removeEventListener("pointermove",V),N.removeEventListener("pointerleave",ie),window.removeEventListener("blur",V),window.removeEventListener("focus",j)}}},[b,h.isClosePausedRef]);const T=p.useCallback(({tabbingDirection:N})=>{const V=w().map(j=>{const G=j.ref.current,ie=[G,...dy(G)];return N==="forwards"?ie:ie.reverse()});return(N==="forwards"?V.reverse():V).flat()},[w]);return p.useEffect(()=>{const N=x.current;if(N){const U=V=>{const j=V.altKey||V.ctrlKey||V.metaKey;if(V.key==="Tab"&&!j){const ie=document.activeElement,se=V.shiftKey;if(V.target===N&&se){y.current?.focus();return}const we=T({tabbingDirection:se?"backwards":"forwards"}),Te=we.findIndex(Le=>Le===ie);Gs(we.slice(Te+1))?V.preventDefault():se?y.current?.focus():k.current?.focus()}};return N.addEventListener("keydown",U),()=>N.removeEventListener("keydown",U)}},[w,T]),B.jsxs(jg,{ref:g,role:"region","aria-label":c.replace("{hotkey}",z),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&B.jsx(oa,{ref:y,onFocusFromOutsideViewport:()=>{const N=T({tabbingDirection:"forwards"});Gs(N)}}),B.jsx(ya.Slot,{scope:i,children:B.jsx(_e.ol,{tabIndex:-1,...f,ref:I})}),b&&B.jsx(oa,{ref:k,onFocusFromOutsideViewport:()=>{const N=T({tabbingDirection:"backwards"});Gs(N)}})]})});If.displayName=_f;var Of="ToastFocusProxy",oa=p.forwardRef((o,s)=>{const{__scopeToast:i,onFocusFromOutsideViewport:u,...c}=o,f=Bl(Of,i);return B.jsx(va,{"aria-hidden":!0,tabIndex:0,...c,ref:s,style:{position:"fixed"},onFocus:h=>{const w=h.relatedTarget;!f.viewport?.contains(w)&&u()}})});oa.displayName=Of;var go="Toast",qg="toast.swipeStart",ey="toast.swipeMove",ty="toast.swipeCancel",ny="toast.swipeEnd",Lf=p.forwardRef((o,s)=>{const{forceMount:i,open:u,defaultOpen:c,onOpenChange:f,...h}=o,[w,g]=Vl({prop:u,defaultProp:c??!0,onChange:f,caller:go});return B.jsx($l,{present:i||w,children:B.jsx(ly,{open:w,...h,ref:s,onClose:()=>g(!1),onPause:yn(o.onPause),onResume:yn(o.onResume),onSwipeStart:Pe(o.onSwipeStart,y=>{y.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Pe(o.onSwipeMove,y=>{const{x:k,y:x}=y.detail.delta;y.currentTarget.setAttribute("data-swipe","move"),y.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${k}px`),y.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${x}px`)}),onSwipeCancel:Pe(o.onSwipeCancel,y=>{y.currentTarget.setAttribute("data-swipe","cancel"),y.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),y.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),y.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),y.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Pe(o.onSwipeEnd,y=>{const{x:k,y:x}=y.detail.delta;y.currentTarget.setAttribute("data-swipe","end"),y.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),y.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),y.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${k}px`),y.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${x}px`),g(!1)})})})});Lf.displayName=go;var[ry,oy]=Tf(go,{onClose(){}}),ly=p.forwardRef((o,s)=>{const{__scopeToast:i,type:u="foreground",duration:c,open:f,onClose:h,onEscapeKeyDown:w,onPause:g,onResume:y,onSwipeStart:k,onSwipeMove:x,onSwipeCancel:I,onSwipeEnd:z,...b}=o,T=Bl(go,i),[N,U]=p.useState(null),V=Tt(s,le=>U(le)),j=p.useRef(null),G=p.useRef(null),ie=c||T.duration,se=p.useRef(0),oe=p.useRef(ie),$=p.useRef(0),{onToastAdd:we,onToastRemove:Te}=T,Le=yn(()=>{N?.contains(document.activeElement)&&T.viewport?.focus(),h()}),Me=p.useCallback(le=>{!le||le===1/0||(window.clearTimeout($.current),se.current=new Date().getTime(),$.current=window.setTimeout(Le,le))},[Le]);p.useEffect(()=>{const le=T.viewport;if(le){const Ee=()=>{Me(oe.current),y?.()},ce=()=>{const me=new Date().getTime()-se.current;oe.current=oe.current-me,window.clearTimeout($.current),g?.()};return le.addEventListener(na,ce),le.addEventListener(ra,Ee),()=>{le.removeEventListener(na,ce),le.removeEventListener(ra,Ee)}}},[T.viewport,ie,g,y,Me]),p.useEffect(()=>{f&&!T.isClosePausedRef.current&&Me(ie)},[f,ie,T.isClosePausedRef,Me]),p.useEffect(()=>(we(),()=>Te()),[we,Te]);const De=p.useMemo(()=>N?jf(N):null,[N]);return T.viewport?B.jsxs(B.Fragment,{children:[De&&B.jsx(iy,{__scopeToast:i,role:"status","aria-live":u==="foreground"?"assertive":"polite","aria-atomic":!0,children:De}),B.jsx(ry,{scope:i,onClose:Le,children:fa.createPortal(B.jsx(ya.ItemSlot,{scope:i,children:B.jsx(Fg,{asChild:!0,onEscapeKeyDown:Pe(w,()=>{T.isFocusedToastEscapeKeyDownRef.current||Le(),T.isFocusedToastEscapeKeyDownRef.current=!1}),children:B.jsx(_e.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":f?"open":"closed","data-swipe-direction":T.swipeDirection,...b,ref:V,style:{userSelect:"none",touchAction:"none",...o.style},onKeyDown:Pe(o.onKeyDown,le=>{le.key==="Escape"&&(w?.(le.nativeEvent),le.nativeEvent.defaultPrevented||(T.isFocusedToastEscapeKeyDownRef.current=!0,Le()))}),onPointerDown:Pe(o.onPointerDown,le=>{le.button===0&&(j.current={x:le.clientX,y:le.clientY})}),onPointerMove:Pe(o.onPointerMove,le=>{if(!j.current)return;const Ee=le.clientX-j.current.x,ce=le.clientY-j.current.y,me=!!G.current,O=["left","right"].includes(T.swipeDirection),ee=["left","up"].includes(T.swipeDirection)?Math.min:Math.max,W=O?ee(0,Ee):0,C=O?0:ee(0,ce),L=le.pointerType==="touch"?10:2,Z={x:W,y:C},te={originalEvent:le,delta:Z};me?(G.current=Z,Ol(ey,x,te,{discrete:!1})):Hd(Z,T.swipeDirection,L)?(G.current=Z,Ol(qg,k,te,{discrete:!1}),le.target.setPointerCapture(le.pointerId)):(Math.abs(Ee)>L||Math.abs(ce)>L)&&(j.current=null)}),onPointerUp:Pe(o.onPointerUp,le=>{const Ee=G.current,ce=le.target;if(ce.hasPointerCapture(le.pointerId)&&ce.releasePointerCapture(le.pointerId),G.current=null,j.current=null,Ee){const me=le.currentTarget,O={originalEvent:le,delta:Ee};Hd(Ee,T.swipeDirection,T.swipeThreshold)?Ol(ny,z,O,{discrete:!0}):Ol(ty,I,O,{discrete:!0}),me.addEventListener("click",ee=>ee.preventDefault(),{once:!0})}})})})}),T.viewport)})]}):null}),iy=o=>{const{__scopeToast:s,children:i,...u}=o,c=Bl(go,s),[f,h]=p.useState(!1),[w,g]=p.useState(!1);return uy(()=>h(!0)),p.useEffect(()=>{const y=window.setTimeout(()=>g(!0),1e3);return()=>window.clearTimeout(y)},[]),w?null:B.jsx(Pf,{asChild:!0,children:B.jsx(va,{...u,children:f&&B.jsxs(B.Fragment,{children:[c.label," ",i]})})})},sy="ToastTitle",Mf=p.forwardRef((o,s)=>{const{__scopeToast:i,...u}=o;return B.jsx(_e.div,{...u,ref:s})});Mf.displayName=sy;var ay="ToastDescription",Af=p.forwardRef((o,s)=>{const{__scopeToast:i,...u}=o;return B.jsx(_e.div,{...u,ref:s})});Af.displayName=ay;var zf="ToastAction",Df=p.forwardRef((o,s)=>{const{altText:i,...u}=o;return i.trim()?B.jsx(Ff,{altText:i,asChild:!0,children:B.jsx(wa,{...u,ref:s})}):(console.error(`Invalid prop \`altText\` supplied to \`${zf}\`. Expected non-empty \`string\`.`),null)});Df.displayName=zf;var bf="ToastClose",wa=p.forwardRef((o,s)=>{const{__scopeToast:i,...u}=o,c=oy(bf,i);return B.jsx(Ff,{asChild:!0,children:B.jsx(_e.button,{type:"button",...u,ref:s,onClick:Pe(o.onClick,c.onClose)})})});wa.displayName=bf;var Ff=p.forwardRef((o,s)=>{const{__scopeToast:i,altText:u,...c}=o;return B.jsx(_e.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":u||void 0,...c,ref:s})});function jf(o){const s=[];return Array.from(o.childNodes).forEach(u=>{if(u.nodeType===u.TEXT_NODE&&u.textContent&&s.push(u.textContent),cy(u)){const c=u.ariaHidden||u.hidden||u.style.display==="none",f=u.dataset.radixToastAnnounceExclude==="";if(!c)if(f){const h=u.dataset.radixToastAnnounceAlt;h&&s.push(h)}else s.push(...jf(u))}}),s}function Ol(o,s,i,{discrete:u}){const c=i.originalEvent.currentTarget,f=new CustomEvent(o,{bubbles:!0,cancelable:!0,detail:i});s&&c.addEventListener(o,s,{once:!0}),u?xf(c,f):c.dispatchEvent(f)}var Hd=(o,s,i=0)=>{const u=Math.abs(o.x),c=Math.abs(o.y),f=u>c;return s==="left"||s==="right"?f&&u>i:!f&&c>i};function uy(o=()=>{}){const s=yn(o);Un(()=>{let i=0,u=0;return i=window.requestAnimationFrame(()=>u=window.requestAnimationFrame(s)),()=>{window.cancelAnimationFrame(i),window.cancelAnimationFrame(u)}},[s])}function cy(o){return o.nodeType===o.ELEMENT_NODE}function dy(o){const s=[],i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:u=>{const c=u.tagName==="INPUT"&&u.type==="hidden";return u.disabled||u.hidden||c?NodeFilter.FILTER_SKIP:u.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)s.push(i.currentNode);return s}function Gs(o){const s=document.activeElement;return o.some(i=>i===s?!0:(i.focus(),document.activeElement!==s))}var fy=Rf,Uf=If,$f=Lf,Vf=Mf,Bf=Af,Wf=Df,Hf=wa;const py=1,my=1e6,Vt={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Ks=0;function hy(){return Ks=(Ks+1)%Number.MAX_VALUE,Ks.toString()}const Qs=new Map,Gd=o=>{if(Qs.has(o))return;const s=setTimeout(()=>{Qs.delete(o),fo({type:Vt.REMOVE_TOAST,toastId:o})},my);Qs.set(o,s)},vy=(o,s)=>{switch(s.type){case Vt.ADD_TOAST:return{...o,toasts:[s.toast,...o.toasts].slice(0,py)};case Vt.UPDATE_TOAST:return{...o,toasts:o.toasts.map(i=>i.id===s.toast.id?{...i,...s.toast}:i)};case Vt.DISMISS_TOAST:{const{toastId:i}=s;return i?Gd(i):o.toasts.forEach(u=>{Gd(u.id)}),{...o,toasts:o.toasts.map(u=>u.id===i||i===void 0?{...u,open:!1}:u)}}case Vt.REMOVE_TOAST:return s.toastId===void 0?{...o,toasts:[]}:{...o,toasts:o.toasts.filter(i=>i.id!==s.toastId)}}},Al=[];let zl={toasts:[]};function fo(o){zl=vy(zl,o),Al.forEach(s=>{s(zl)})}function gy({...o}){const s=hy(),i=c=>fo({type:Vt.UPDATE_TOAST,toast:{...c,id:s}}),u=()=>fo({type:Vt.DISMISS_TOAST,toastId:s});return fo({type:Vt.ADD_TOAST,toast:{...o,id:s,open:!0,onOpenChange:c=>{c||u()}}}),{id:s,dismiss:u,update:i}}function Er(){const[o,s]=p.useState(zl);return p.useEffect(()=>(Al.push(s),()=>{const i=Al.indexOf(s);i>-1&&Al.splice(i,1)}),[o]),{...o,toast:gy,dismiss:i=>fo({type:Vt.DISMISS_TOAST,toastId:i})}}const Ea="-",yy=o=>{const s=Ey(o),{conflictingClassGroups:i,conflictingClassGroupModifiers:u}=o;return{getClassGroupId:h=>{const w=h.split(Ea);return w[0]===""&&w.length!==1&&w.shift(),Gf(w,s)||wy(h)},getConflictingClassGroupIds:(h,w)=>{const g=i[h]||[];return w&&u[h]?[...g,...u[h]]:g}}},Gf=(o,s)=>{if(o.length===0)return s.classGroupId;const i=o[0],u=s.nextPart.get(i),c=u?Gf(o.slice(1),u):void 0;if(c)return c;if(s.validators.length===0)return;const f=o.join(Ea);return s.validators.find(({validator:h})=>h(f))?.classGroupId},Kd=/^\[(.+)\]$/,wy=o=>{if(Kd.test(o)){const s=Kd.exec(o)[1],i=s?.substring(0,s.indexOf(":"));if(i)return"arbitrary.."+i}},Ey=o=>{const{theme:s,classGroups:i}=o,u={nextPart:new Map,validators:[]};for(const c in i)la(i[c],u,c,s);return u},la=(o,s,i,u)=>{o.forEach(c=>{if(typeof c=="string"){const f=c===""?s:Qd(s,c);f.classGroupId=i;return}if(typeof c=="function"){if(xy(c)){la(c(u),s,i,u);return}s.validators.push({validator:c,classGroupId:i});return}Object.entries(c).forEach(([f,h])=>{la(h,Qd(s,f),i,u)})})},Qd=(o,s)=>{let i=o;return s.split(Ea).forEach(u=>{i.nextPart.has(u)||i.nextPart.set(u,{nextPart:new Map,validators:[]}),i=i.nextPart.get(u)}),i},xy=o=>o.isThemeGetter,Sy=o=>{if(o<1)return{get:()=>{},set:()=>{}};let s=0,i=new Map,u=new Map;const c=(f,h)=>{i.set(f,h),s++,s>o&&(s=0,u=i,i=new Map)};return{get(f){let h=i.get(f);if(h!==void 0)return h;if((h=u.get(f))!==void 0)return c(f,h),h},set(f,h){i.has(f)?i.set(f,h):c(f,h)}}},ia="!",sa=":",ky=sa.length,Cy=o=>{const{prefix:s,experimentalParseClassName:i}=o;let u=c=>{const f=[];let h=0,w=0,g=0,y;for(let b=0;bg?y-g:void 0;return{modifiers:f,hasImportantModifier:I,baseClassName:x,maybePostfixModifierPosition:z}};if(s){const c=s+sa,f=u;u=h=>h.startsWith(c)?f(h.substring(c.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:h,maybePostfixModifierPosition:void 0}}if(i){const c=u;u=f=>i({className:f,parseClassName:c})}return u},Ny=o=>o.endsWith(ia)?o.substring(0,o.length-1):o.startsWith(ia)?o.substring(1):o,Py=o=>{const s=Object.fromEntries(o.orderSensitiveModifiers.map(u=>[u,!0]));return u=>{if(u.length<=1)return u;const c=[];let f=[];return u.forEach(h=>{h[0]==="["||s[h]?(c.push(...f.sort(),h),f=[]):f.push(h)}),c.push(...f.sort()),c}},Ty=o=>({cache:Sy(o.cacheSize),parseClassName:Cy(o),sortModifiers:Py(o),...yy(o)}),Ry=/\s+/,_y=(o,s)=>{const{parseClassName:i,getClassGroupId:u,getConflictingClassGroupIds:c,sortModifiers:f}=s,h=[],w=o.trim().split(Ry);let g="";for(let y=w.length-1;y>=0;y-=1){const k=w[y],{isExternal:x,modifiers:I,hasImportantModifier:z,baseClassName:b,maybePostfixModifierPosition:T}=i(k);if(x){g=k+(g.length>0?" "+g:g);continue}let N=!!T,U=u(N?b.substring(0,T):b);if(!U){if(!N){g=k+(g.length>0?" "+g:g);continue}if(U=u(b),!U){g=k+(g.length>0?" "+g:g);continue}N=!1}const V=f(I).join(":"),j=z?V+ia:V,G=j+U;if(h.includes(G))continue;h.push(G);const ie=c(U,N);for(let se=0;se0?" "+g:g)}return g};function Iy(){let o=0,s,i,u="";for(;o{if(typeof o=="string")return o;let s,i="";for(let u=0;ux(k),o());return i=Ty(y),u=i.cache.get,c=i.cache.set,f=w,w(g)}function w(g){const y=u(g);if(y)return y;const k=_y(g,i);return c(g,k),k}return function(){return f(Iy.apply(null,arguments))}}const Be=o=>{const s=i=>i[o]||[];return s.isThemeGetter=!0,s},Qf=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Yf=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ly=/^\d+\/\d+$/,My=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ay=/\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$/,zy=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Dy=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,by=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vr=o=>Ly.test(o),de=o=>!!o&&!Number.isNaN(Number(o)),mn=o=>!!o&&Number.isInteger(Number(o)),Ys=o=>o.endsWith("%")&&de(o.slice(0,-1)),$t=o=>My.test(o),Fy=()=>!0,jy=o=>Ay.test(o)&&!zy.test(o),Xf=()=>!1,Uy=o=>Dy.test(o),$y=o=>by.test(o),Vy=o=>!Y(o)&&!X(o),By=o=>xr(o,qf,Xf),Y=o=>Qf.test(o),Mn=o=>xr(o,ep,jy),Xs=o=>xr(o,Qy,de),Yd=o=>xr(o,Jf,Xf),Wy=o=>xr(o,Zf,$y),Ll=o=>xr(o,tp,Uy),X=o=>Yf.test(o),co=o=>Sr(o,ep),Hy=o=>Sr(o,Yy),Xd=o=>Sr(o,Jf),Gy=o=>Sr(o,qf),Ky=o=>Sr(o,Zf),Ml=o=>Sr(o,tp,!0),xr=(o,s,i)=>{const u=Qf.exec(o);return u?u[1]?s(u[1]):i(u[2]):!1},Sr=(o,s,i=!1)=>{const u=Yf.exec(o);return u?u[1]?s(u[1]):i:!1},Jf=o=>o==="position"||o==="percentage",Zf=o=>o==="image"||o==="url",qf=o=>o==="length"||o==="size"||o==="bg-size",ep=o=>o==="length",Qy=o=>o==="number",Yy=o=>o==="family-name",tp=o=>o==="shadow",Xy=()=>{const o=Be("color"),s=Be("font"),i=Be("text"),u=Be("font-weight"),c=Be("tracking"),f=Be("leading"),h=Be("breakpoint"),w=Be("container"),g=Be("spacing"),y=Be("radius"),k=Be("shadow"),x=Be("inset-shadow"),I=Be("text-shadow"),z=Be("drop-shadow"),b=Be("blur"),T=Be("perspective"),N=Be("aspect"),U=Be("ease"),V=Be("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],ie=()=>[...G(),X,Y],se=()=>["auto","hidden","clip","visible","scroll"],oe=()=>["auto","contain","none"],$=()=>[X,Y,g],we=()=>[vr,"full","auto",...$()],Te=()=>[mn,"none","subgrid",X,Y],Le=()=>["auto",{span:["full",mn,X,Y]},mn,X,Y],Me=()=>[mn,"auto",X,Y],De=()=>["auto","min","max","fr",X,Y],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Ee=()=>["start","end","center","stretch","center-safe","end-safe"],ce=()=>["auto",...$()],me=()=>[vr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...$()],O=()=>[o,X,Y],ee=()=>[...G(),Xd,Yd,{position:[X,Y]}],W=()=>["no-repeat",{repeat:["","x","y","space","round"]}],C=()=>["auto","cover","contain",Gy,By,{size:[X,Y]}],L=()=>[Ys,co,Mn],Z=()=>["","none","full",y,X,Y],te=()=>["",de,co,Mn],pe=()=>["solid","dashed","dotted","double"],he=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[de,Ys,Xd,Yd],ge=()=>["","none",b,X,Y],xe=()=>["none",de,X,Y],We=()=>["none",de,X,Y],Kt=()=>[de,X,Y],wn=()=>[vr,"full",...$()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[$t],breakpoint:[$t],color:[Fy],container:[$t],"drop-shadow":[$t],ease:["in","out","in-out"],font:[Vy],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[$t],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[$t],shadow:[$t],spacing:["px",de],text:[$t],"text-shadow":[$t],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",vr,Y,X,N]}],container:["container"],columns:[{columns:[de,Y,X,w]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"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"],sr:["sr-only","not-sr-only"],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:ie()}],overflow:[{overflow:se()}],"overflow-x":[{"overflow-x":se()}],"overflow-y":[{"overflow-y":se()}],overscroll:[{overscroll:oe()}],"overscroll-x":[{"overscroll-x":oe()}],"overscroll-y":[{"overscroll-y":oe()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:we()}],"inset-x":[{"inset-x":we()}],"inset-y":[{"inset-y":we()}],start:[{start:we()}],end:[{end:we()}],top:[{top:we()}],right:[{right:we()}],bottom:[{bottom:we()}],left:[{left:we()}],visibility:["visible","invisible","collapse"],z:[{z:[mn,"auto",X,Y]}],basis:[{basis:[vr,"full","auto",w,...$()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[de,vr,"auto","initial","none",Y]}],grow:[{grow:["",de,X,Y]}],shrink:[{shrink:["",de,X,Y]}],order:[{order:[mn,"first","last","none",X,Y]}],"grid-cols":[{"grid-cols":Te()}],"col-start-end":[{col:Le()}],"col-start":[{"col-start":Me()}],"col-end":[{"col-end":Me()}],"grid-rows":[{"grid-rows":Te()}],"row-start-end":[{row:Le()}],"row-start":[{"row-start":Me()}],"row-end":[{"row-end":Me()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":De()}],"auto-rows":[{"auto-rows":De()}],gap:[{gap:$()}],"gap-x":[{"gap-x":$()}],"gap-y":[{"gap-y":$()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...Ee(),"normal"]}],"justify-self":[{"justify-self":["auto",...Ee()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...Ee(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Ee(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...Ee(),"baseline"]}],"place-self":[{"place-self":["auto",...Ee()]}],p:[{p:$()}],px:[{px:$()}],py:[{py:$()}],ps:[{ps:$()}],pe:[{pe:$()}],pt:[{pt:$()}],pr:[{pr:$()}],pb:[{pb:$()}],pl:[{pl:$()}],m:[{m:ce()}],mx:[{mx:ce()}],my:[{my:ce()}],ms:[{ms:ce()}],me:[{me:ce()}],mt:[{mt:ce()}],mr:[{mr:ce()}],mb:[{mb:ce()}],ml:[{ml:ce()}],"space-x":[{"space-x":$()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":$()}],"space-y-reverse":["space-y-reverse"],size:[{size:me()}],w:[{w:[w,"screen",...me()]}],"min-w":[{"min-w":[w,"screen","none",...me()]}],"max-w":[{"max-w":[w,"screen","none","prose",{screen:[h]},...me()]}],h:[{h:["screen","lh",...me()]}],"min-h":[{"min-h":["screen","lh","none",...me()]}],"max-h":[{"max-h":["screen","lh",...me()]}],"font-size":[{text:["base",i,co,Mn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[u,X,Xs]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ys,Y]}],"font-family":[{font:[Hy,Y,s]}],"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:[c,X,Y]}],"line-clamp":[{"line-clamp":[de,"none",X,Xs]}],leading:[{leading:[f,...$()]}],"list-image":[{"list-image":["none",X,Y]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",X,Y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...pe(),"wavy"]}],"text-decoration-thickness":[{decoration:[de,"from-font","auto",X,Mn]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[de,"auto",X,Y]}],"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",X,Y]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",X,Y]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:W()}],"bg-size":[{bg:C()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},mn,X,Y],radial:["",X,Y],conic:[mn,X,Y]},Ky,Wy]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...pe(),"hidden","none"]}],"divide-style":[{divide:[...pe(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...pe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[de,X,Y]}],"outline-w":[{outline:["",de,co,Mn]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",k,Ml,Ll]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",x,Ml,Ll]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[de,Mn]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",I,Ml,Ll]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[de,X,Y]}],"mix-blend":[{"mix-blend":[...he(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":he()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[de]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[X,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":G()}],"mask-image-conic-pos":[{"mask-conic":[de]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:W()}],"mask-size":[{mask:C()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",X,Y]}],filter:[{filter:["","none",X,Y]}],blur:[{blur:ge()}],brightness:[{brightness:[de,X,Y]}],contrast:[{contrast:[de,X,Y]}],"drop-shadow":[{"drop-shadow":["","none",z,Ml,Ll]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",de,X,Y]}],"hue-rotate":[{"hue-rotate":[de,X,Y]}],invert:[{invert:["",de,X,Y]}],saturate:[{saturate:[de,X,Y]}],sepia:[{sepia:["",de,X,Y]}],"backdrop-filter":[{"backdrop-filter":["","none",X,Y]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[de,X,Y]}],"backdrop-contrast":[{"backdrop-contrast":[de,X,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":["",de,X,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[de,X,Y]}],"backdrop-invert":[{"backdrop-invert":["",de,X,Y]}],"backdrop-opacity":[{"backdrop-opacity":[de,X,Y]}],"backdrop-saturate":[{"backdrop-saturate":[de,X,Y]}],"backdrop-sepia":[{"backdrop-sepia":["",de,X,Y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":$()}],"border-spacing-x":[{"border-spacing-x":$()}],"border-spacing-y":[{"border-spacing-y":$()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",X,Y]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[de,"initial",X,Y]}],ease:[{ease:["linear","initial",U,X,Y]}],delay:[{delay:[de,X,Y]}],animate:[{animate:["none",V,X,Y]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[T,X,Y]}],"perspective-origin":[{"perspective-origin":ie()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:We()}],"scale-x":[{"scale-x":We()}],"scale-y":[{"scale-y":We()}],"scale-z":[{"scale-z":We()}],"scale-3d":["scale-3d"],skew:[{skew:Kt()}],"skew-x":[{"skew-x":Kt()}],"skew-y":[{"skew-y":Kt()}],transform:[{transform:[X,Y,"","none","gpu","cpu"]}],"transform-origin":[{origin:ie()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:wn()}],"translate-x":[{"translate-x":wn()}],"translate-y":[{"translate-y":wn()}],"translate-z":[{"translate-z":wn()}],"translate-none":["translate-none"],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",X,Y]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],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",X,Y]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[de,co,Mn,Xs]}],stroke:[{stroke:["none",...O()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Jy=Oy(Xy);function ze(...o){return Jy(vf(o))}const Zy=fy,np=p.forwardRef(({className:o,...s},i)=>p.createElement(Uf,{ref:i,className:ze("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",o),...s}));np.displayName=Uf.displayName;const qy=ha("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full data-[state=closed]:slide-out-to-right-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),rp=p.forwardRef(({className:o,variant:s,...i},u)=>p.createElement($f,{ref:u,className:ze(qy({variant:s}),o),...i}));rp.displayName=$f.displayName;const e0=p.forwardRef(({className:o,...s},i)=>p.createElement(Wf,{ref:i,className:ze("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus-visible:ring-destructive",o),...s}));e0.displayName=Wf.displayName;const op=p.forwardRef(({className:o,...s},i)=>p.createElement(Hf,{ref:i,className:ze("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus-visible:ring-red-400 group-[.destructive]:focus-visible:ring-offset-red-600",o),"toast-close":"",...s},p.createElement(Eg,{className:"h-4 w-4"})));op.displayName=Hf.displayName;const lp=p.forwardRef(({className:o,...s},i)=>p.createElement(Vf,{ref:i,className:ze("text-sm font-semibold",o),...s}));lp.displayName=Vf.displayName;const ip=p.forwardRef(({className:o,...s},i)=>p.createElement(Bf,{ref:i,className:ze("text-sm opacity-90",o),...s}));ip.displayName=Bf.displayName;function t0(){const{toasts:o}=Er();return m.createElement(Zy,null,o.map(({id:s,title:i,description:u,action:c,...f})=>m.createElement(rp,{key:s,...f},m.createElement("div",{className:"grid gap-1"},i&&m.createElement(lp,null,i),u&&m.createElement(ip,null,u)),c,m.createElement(op,null))),m.createElement(np,null))}const n0=ha("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Qe=p.forwardRef(({className:o,variant:s,size:i,asChild:u=!1,...c},f)=>{const h=u?Cg:"button";return p.createElement(h,{className:ze(n0({variant:s,size:i,className:o})),ref:f,...c})});Qe.displayName="Button";function kr(){const{user:o,logout:s}=wr(),i=Bn(),u=()=>{s(),i("/")};return m.createElement("header",{className:"border-b bg-white"},m.createElement("div",{className:"container mx-auto px-4 py-4 flex justify-between items-center"},m.createElement(Dn,{to:"/",className:"text-2xl font-bold text-primary"},"์„ฑํ–ฅ ํ…Œ์ŠคํŠธ"),m.createElement("div",{className:"flex items-center gap-4"},o?m.createElement(m.Fragment,null,m.createElement("span",{className:"text-sm text-muted-foreground"},"์•ˆ๋…•ํ•˜์„ธ์š”, ",o.name,"๋‹˜"),m.createElement(Dn,{to:"/mypage"},m.createElement(Qe,{variant:"outline",size:"sm"},"๋งˆ์ดํŽ˜์ด์ง€")),m.createElement(Qe,{variant:"outline",size:"sm",onClick:u},"๋กœ๊ทธ์•„์›ƒ")):m.createElement(m.Fragment,null,m.createElement(Dn,{to:"/login"},m.createElement(Qe,{variant:"outline",size:"sm"},"๋กœ๊ทธ์ธ")),m.createElement(Dn,{to:"/register"},m.createElement(Qe,{size:"sm"},"ํšŒ์›๊ฐ€์ž…"))))))}function r0(){return m.createElement("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100"},m.createElement(kr,null),m.createElement("main",{className:"container mx-auto px-4 py-16"},m.createElement("div",{className:"text-center max-w-4xl mx-auto"},m.createElement("h1",{className:"text-5xl font-bold text-gray-900 mb-6"},"๋‚˜๋งŒ์˜ ์„ฑํ–ฅ์„ ๋ฐœ๊ฒฌํ•˜์„ธ์š”"),m.createElement("p",{className:"text-xl text-gray-600 mb-8 leading-relaxed"},"๊ฐ„๋‹จํ•œ ํ…Œ์ŠคํŠธ๋ฅผ ํ†ตํ•ด ๋‹น์‹ ์˜ ์„ฑํ–ฅ์„ ์•Œ์•„๋ณด๊ณ ,",m.createElement("br",null),"๋งž์ถคํ˜• ์˜ํ™”, ์ฑ…, ์Œ์•…์„ ์ถ”์ฒœ๋ฐ›์•„๋ณด์„ธ์š”."),m.createElement("div",{className:"bg-white rounded-lg shadow-lg p-8 mb-12"},m.createElement("h2",{className:"text-2xl font-semibold mb-4"},"ํ…Œ์ŠคํŠธ ์†Œ๊ฐœ"),m.createElement("div",{className:"grid md:grid-cols-3 gap-6 text-left"},m.createElement("div",{className:"flex flex-col items-center"},m.createElement("div",{className:"w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4"},m.createElement("span",{className:"text-2xl"},"๐Ÿ“")),m.createElement("h3",{className:"font-semibold mb-2"},"๊ฐ„๋‹จํ•œ ์„ค๋ฌธ"),m.createElement("p",{className:"text-sm text-gray-600"},"20๊ฐœ์˜ ์งˆ๋ฌธ์œผ๋กœ ๊ตฌ์„ฑ๋œ ๊ฐ„๋‹จํ•œ ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ")),m.createElement("div",{className:"flex flex-col items-center"},m.createElement("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4"},m.createElement("span",{className:"text-2xl"},"๐ŸŽฏ")),m.createElement("h3",{className:"font-semibold mb-2"},"์ •ํ™•ํ•œ ๋ถ„์„"),m.createElement("p",{className:"text-sm text-gray-600"},"๊ณผํ•™์  ๊ทผ๊ฑฐ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ํ•œ ์„ฑํ–ฅ ๋ถ„์„")),m.createElement("div",{className:"flex flex-col items-center"},m.createElement("div",{className:"w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mb-4"},m.createElement("span",{className:"text-2xl"},"๐ŸŽ")),m.createElement("h3",{className:"font-semibold mb-2"},"๋งž์ถค ์ถ”์ฒœ"),m.createElement("p",{className:"text-sm text-gray-600"},"๋‹น์‹ ์˜ ์„ฑํ–ฅ์— ๋งž๋Š” ์ปจํ…์ธ  ์ถ”์ฒœ"))))),m.createElement("div",{className:"text-center"},m.createElement(Dn,{to:"/test"},m.createElement(Qe,{size:"lg",className:"px-12 py-4 text-lg"},"ํ…Œ์ŠคํŠธํ•˜๋Ÿฌ๊ฐ€๊ธฐ")))))}const Bt=p.forwardRef(({className:o,...s},i)=>p.createElement("div",{ref:i,className:ze("rounded-xl border bg-card text-card-foreground shadow",o),...s}));Bt.displayName="Card";const Wt=p.forwardRef(({className:o,...s},i)=>p.createElement("div",{ref:i,className:ze("flex flex-col space-y-1.5 p-6",o),...s}));Wt.displayName="CardHeader";const Ht=p.forwardRef(({className:o,...s},i)=>p.createElement("h3",{ref:i,className:ze("font-semibold leading-none tracking-tight",o),...s}));Ht.displayName="CardTitle";const o0=p.forwardRef(({className:o,...s},i)=>p.createElement("p",{ref:i,className:ze("text-sm text-muted-foreground",o),...s}));o0.displayName="CardDescription";const Gt=p.forwardRef(({className:o,...s},i)=>p.createElement("div",{ref:i,className:ze("p-6 pt-0",o),...s}));Gt.displayName="CardContent";const l0=p.forwardRef(({className:o,...s},i)=>p.createElement("div",{ref:i,className:ze("flex items-center p-6 pt-0",o),...s}));l0.displayName="CardFooter";var i0=da[" useId ".trim().toString()]||(()=>{}),s0=0;function sp(o){const[s,i]=p.useState(i0());return Un(()=>{i(u=>u??String(s0++))},[o]),s?`radix-${s}`:""}var a0=p.createContext(void 0);function xa(o){const s=p.useContext(a0);return o||s||"ltr"}var Js="rovingFocusGroup.onEntryFocus",u0={bubbles:!1,cancelable:!0},yo="RovingFocusGroup",[aa,ap,c0]=Ef(yo),[d0,Wl]=Wn(yo,[c0]),[f0,p0]=d0(yo),up=p.forwardRef((o,s)=>B.jsx(aa.Provider,{scope:o.__scopeRovingFocusGroup,children:B.jsx(aa.Slot,{scope:o.__scopeRovingFocusGroup,children:B.jsx(m0,{...o,ref:s})})}));up.displayName=yo;var m0=p.forwardRef((o,s)=>{const{__scopeRovingFocusGroup:i,orientation:u,loop:c=!1,dir:f,currentTabStopId:h,defaultCurrentTabStopId:w,onCurrentTabStopIdChange:g,onEntryFocus:y,preventScrollOnEntryFocus:k=!1,...x}=o,I=p.useRef(null),z=Tt(s,I),b=xa(f),[T,N]=Vl({prop:h,defaultProp:w??null,onChange:g,caller:yo}),[U,V]=p.useState(!1),j=yn(y),G=ap(i),ie=p.useRef(!1),[se,oe]=p.useState(0);return p.useEffect(()=>{const $=I.current;if($)return $.addEventListener(Js,j),()=>$.removeEventListener(Js,j)},[j]),B.jsx(f0,{scope:i,orientation:u,dir:b,loop:c,currentTabStopId:T,onItemFocus:p.useCallback($=>N($),[N]),onItemShiftTab:p.useCallback(()=>V(!0),[]),onFocusableItemAdd:p.useCallback(()=>oe($=>$+1),[]),onFocusableItemRemove:p.useCallback(()=>oe($=>$-1),[]),children:B.jsx(_e.div,{tabIndex:U||se===0?-1:0,"data-orientation":u,...x,ref:z,style:{outline:"none",...o.style},onMouseDown:Pe(o.onMouseDown,()=>{ie.current=!0}),onFocus:Pe(o.onFocus,$=>{const we=!ie.current;if($.target===$.currentTarget&&we&&!U){const Te=new CustomEvent(Js,u0);if($.currentTarget.dispatchEvent(Te),!Te.defaultPrevented){const Le=G().filter(ce=>ce.focusable),Me=Le.find(ce=>ce.active),De=Le.find(ce=>ce.id===T),Ee=[Me,De,...Le].filter(Boolean).map(ce=>ce.ref.current);fp(Ee,k)}}ie.current=!1}),onBlur:Pe(o.onBlur,()=>V(!1))})})}),cp="RovingFocusGroupItem",dp=p.forwardRef((o,s)=>{const{__scopeRovingFocusGroup:i,focusable:u=!0,active:c=!1,tabStopId:f,children:h,...w}=o,g=sp(),y=f||g,k=p0(cp,i),x=k.currentTabStopId===y,I=ap(i),{onFocusableItemAdd:z,onFocusableItemRemove:b,currentTabStopId:T}=k;return p.useEffect(()=>{if(u)return z(),()=>b()},[u,z,b]),B.jsx(aa.ItemSlot,{scope:i,id:y,focusable:u,active:c,children:B.jsx(_e.span,{tabIndex:x?0:-1,"data-orientation":k.orientation,...w,ref:s,onMouseDown:Pe(o.onMouseDown,N=>{u?k.onItemFocus(y):N.preventDefault()}),onFocus:Pe(o.onFocus,()=>k.onItemFocus(y)),onKeyDown:Pe(o.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){k.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const U=g0(N,k.orientation,k.dir);if(U!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let j=I().filter(G=>G.focusable).map(G=>G.ref.current);if(U==="last")j.reverse();else if(U==="prev"||U==="next"){U==="prev"&&j.reverse();const G=j.indexOf(N.currentTarget);j=k.loop?y0(j,G+1):j.slice(G+1)}setTimeout(()=>fp(j))}}),children:typeof h=="function"?h({isCurrentTabStop:x,hasTabStop:T!=null}):h})})});dp.displayName=cp;var h0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function v0(o,s){return s!=="rtl"?o:o==="ArrowLeft"?"ArrowRight":o==="ArrowRight"?"ArrowLeft":o}function g0(o,s,i){const u=v0(o.key,i);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(u))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(u)))return h0[u]}function fp(o,s=!1){const i=document.activeElement;for(const u of o)if(u===i||(u.focus({preventScroll:s}),document.activeElement!==i))return}function y0(o,s){return o.map((i,u)=>o[(s+u)%o.length])}var pp=up,mp=dp;function w0(o){const[s,i]=p.useState(void 0);return Un(()=>{if(o){i({width:o.offsetWidth,height:o.offsetHeight});const u=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const f=c[0];let h,w;if("borderBoxSize"in f){const g=f.borderBoxSize,y=Array.isArray(g)?g[0]:g;h=y.inlineSize,w=y.blockSize}else h=o.offsetWidth,w=o.offsetHeight;i({width:h,height:w})});return u.observe(o,{box:"border-box"}),()=>u.unobserve(o)}else i(void 0)},[o]),s}function E0(o){const s=p.useRef({value:o,previous:o});return p.useMemo(()=>(s.current.value!==o&&(s.current.previous=s.current.value,s.current.value=o),s.current.previous),[o])}var Sa="Radio",[x0,hp]=Wn(Sa),[S0,k0]=x0(Sa),vp=p.forwardRef((o,s)=>{const{__scopeRadio:i,name:u,checked:c=!1,required:f,disabled:h,value:w="on",onCheck:g,form:y,...k}=o,[x,I]=p.useState(null),z=Tt(s,N=>I(N)),b=p.useRef(!1),T=x?y||!!x.closest("form"):!0;return B.jsxs(S0,{scope:i,checked:c,disabled:h,children:[B.jsx(_e.button,{type:"button",role:"radio","aria-checked":c,"data-state":Ep(c),"data-disabled":h?"":void 0,disabled:h,value:w,...k,ref:z,onClick:Pe(o.onClick,N=>{c||g?.(),T&&(b.current=N.isPropagationStopped(),b.current||N.stopPropagation())})}),T&&B.jsx(wp,{control:x,bubbles:!b.current,name:u,value:w,checked:c,required:f,disabled:h,form:y,style:{transform:"translateX(-100%)"}})]})});vp.displayName=Sa;var gp="RadioIndicator",yp=p.forwardRef((o,s)=>{const{__scopeRadio:i,forceMount:u,...c}=o,f=k0(gp,i);return B.jsx($l,{present:u||f.checked,children:B.jsx(_e.span,{"data-state":Ep(f.checked),"data-disabled":f.disabled?"":void 0,...c,ref:s})})});yp.displayName=gp;var C0="RadioBubbleInput",wp=p.forwardRef(({__scopeRadio:o,control:s,checked:i,bubbles:u=!0,...c},f)=>{const h=p.useRef(null),w=Tt(h,f),g=E0(i),y=w0(s);return p.useEffect(()=>{const k=h.current;if(!k)return;const x=window.HTMLInputElement.prototype,z=Object.getOwnPropertyDescriptor(x,"checked").set;if(g!==i&&z){const b=new Event("click",{bubbles:u});z.call(k,i),k.dispatchEvent(b)}},[g,i,u]),B.jsx(_e.input,{type:"radio","aria-hidden":!0,defaultChecked:i,...c,tabIndex:-1,ref:w,style:{...c.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});wp.displayName=C0;function Ep(o){return o?"checked":"unchecked"}var N0=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Hl="RadioGroup",[P0,q0]=Wn(Hl,[Wl,hp]),xp=Wl(),Sp=hp(),[T0,R0]=P0(Hl),kp=p.forwardRef((o,s)=>{const{__scopeRadioGroup:i,name:u,defaultValue:c,value:f,required:h=!1,disabled:w=!1,orientation:g,dir:y,loop:k=!0,onValueChange:x,...I}=o,z=xp(i),b=xa(y),[T,N]=Vl({prop:f,defaultProp:c??null,onChange:x,caller:Hl});return B.jsx(T0,{scope:i,name:u,required:h,disabled:w,value:T,onValueChange:N,children:B.jsx(pp,{asChild:!0,...z,orientation:g,dir:b,loop:k,children:B.jsx(_e.div,{role:"radiogroup","aria-required":h,"aria-orientation":g,"data-disabled":w?"":void 0,dir:b,...I,ref:s})})})});kp.displayName=Hl;var Cp="RadioGroupItem",Np=p.forwardRef((o,s)=>{const{__scopeRadioGroup:i,disabled:u,...c}=o,f=R0(Cp,i),h=f.disabled||u,w=xp(i),g=Sp(i),y=p.useRef(null),k=Tt(s,y),x=f.value===c.value,I=p.useRef(!1);return p.useEffect(()=>{const z=T=>{N0.includes(T.key)&&(I.current=!0)},b=()=>I.current=!1;return document.addEventListener("keydown",z),document.addEventListener("keyup",b),()=>{document.removeEventListener("keydown",z),document.removeEventListener("keyup",b)}},[]),B.jsx(mp,{asChild:!0,...w,focusable:!h,active:x,children:B.jsx(vp,{disabled:h,required:f.required,checked:x,...g,...c,name:f.name,ref:k,onCheck:()=>f.onValueChange(c.value),onKeyDown:Pe(z=>{z.key==="Enter"&&z.preventDefault()}),onFocus:Pe(c.onFocus,()=>{I.current&&y.current?.click()})})})});Np.displayName=Cp;var _0="RadioGroupIndicator",Pp=p.forwardRef((o,s)=>{const{__scopeRadioGroup:i,...u}=o,c=Sp(i);return B.jsx(yp,{...c,...u,ref:s})});Pp.displayName=_0;var Tp=kp,Rp=Np,I0=Pp;const _p=p.forwardRef(({className:o,...s},i)=>p.createElement(Tp,{className:ze("grid gap-2",o),...s,ref:i}));_p.displayName=Tp.displayName;const gr=p.forwardRef(({className:o,...s},i)=>p.createElement(Rp,{ref:i,className:ze("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",o),...s},p.createElement(I0,{className:"flex items-center justify-center"},p.createElement(yg,{className:"h-2.5 w-2.5 fill-current text-current"}))));gr.displayName=Rp.displayName;var O0="Label",Ip=p.forwardRef((o,s)=>B.jsx(_e.label,{...o,ref:s,onMouseDown:i=>{i.target.closest("button, input, select, textarea")||(o.onMouseDown?.(i),!i.defaultPrevented&&i.detail>1&&i.preventDefault())}}));Ip.displayName=O0;var Op=Ip;const L0=ha("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),wt=p.forwardRef(({className:o,...s},i)=>p.createElement(Op,{ref:i,className:ze(L0(),o),...s}));wt.displayName=Op.displayName;var ka="Progress",Ca=100,[M0,ew]=Wn(ka),[A0,z0]=M0(ka),Lp=p.forwardRef((o,s)=>{const{__scopeProgress:i,value:u=null,max:c,getValueLabel:f=D0,...h}=o;(c||c===0)&&!Jd(c)&&console.error(b0(`${c}`,"Progress"));const w=Jd(c)?c:Ca;u!==null&&!Zd(u,w)&&console.error(F0(`${u}`,"Progress"));const g=Zd(u,w)?u:null,y=Fl(g)?f(g,w):void 0;return B.jsx(A0,{scope:i,value:g,max:w,children:B.jsx(_e.div,{"aria-valuemax":w,"aria-valuemin":0,"aria-valuenow":Fl(g)?g:void 0,"aria-valuetext":y,role:"progressbar","data-state":zp(g,w),"data-value":g??void 0,"data-max":w,...h,ref:s})})});Lp.displayName=ka;var Mp="ProgressIndicator",Ap=p.forwardRef((o,s)=>{const{__scopeProgress:i,...u}=o,c=z0(Mp,i);return B.jsx(_e.div,{"data-state":zp(c.value,c.max),"data-value":c.value??void 0,"data-max":c.max,...u,ref:s})});Ap.displayName=Mp;function D0(o,s){return`${Math.round(o/s*100)}%`}function zp(o,s){return o==null?"indeterminate":o===s?"complete":"loading"}function Fl(o){return typeof o=="number"}function Jd(o){return Fl(o)&&!isNaN(o)&&o>0}function Zd(o,s){return Fl(o)&&!isNaN(o)&&o<=s&&o>=0}function b0(o,s){return`Invalid prop \`max\` of value \`${o}\` supplied to \`${s}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ca}\`.`}function F0(o,s){return`Invalid prop \`value\` of value \`${o}\` supplied to \`${s}\`. The \`value\` prop must be: - - a positive number - - less than the value passed to \`max\` (or ${Ca} if no \`max\` prop is set) - - \`null\` or \`undefined\` if the progress is indeterminate. - -Defaulting to \`null\`.`}var Dp=Lp,j0=Ap;const bp=p.forwardRef(({className:o,value:s,...i},u)=>p.createElement(Dp,{ref:u,className:ze("relative h-4 w-full overflow-hidden rounded-full bg-secondary",o),...i},p.createElement(j0,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(s||0)}%)`}})));bp.displayName=Dp.displayName;const An=["๋‚˜๋Š” ์ƒˆ๋กœ์šด ์‚ฌ๋žŒ๋“ค๊ณผ ๋งŒ๋‚˜๋Š” ๊ฒƒ์„ ์ข‹์•„ํ•œ๋‹ค","๋‚˜๋Š” ๊ณ„ํš์„ ์„ธ์šฐ๊ณ  ๊ทธ๋Œ€๋กœ ์‹คํ–‰ํ•˜๋Š” ๊ฒƒ์„ ์„ ํ˜ธํ•œ๋‹ค","๋‚˜๋Š” ๊ฐ์ •๋ณด๋‹ค๋Š” ๋…ผ๋ฆฌ์ ์œผ๋กœ ํŒ๋‹จํ•˜๋Š” ํŽธ์ด๋‹ค","๋‚˜๋Š” ๋งˆ๊ฐ์ผ์ด ๋‹ค๊ฐ€์™€์•ผ ์ผ์„ ์‹œ์ž‘ํ•˜๋Š” ํŽธ์ด๋‹ค","๋‚˜๋Š” ํŒŒํ‹ฐ๋‚˜ ๋ชจ์ž„์—์„œ ์—๋„ˆ์ง€๋ฅผ ์–ป๋Š”๋‹ค","๋‚˜๋Š” ์„ธ๋ถ€์‚ฌํ•ญ๋ณด๋‹ค๋Š” ํฐ ๊ทธ๋ฆผ์„ ๋ณด๋Š” ๊ฒƒ์„ ์ข‹์•„ํ•œ๋‹ค","๋‚˜๋Š” ๋‹ค๋ฅธ ์‚ฌ๋žŒ์˜ ๊ฐ์ •์„ ์ž˜ ์ดํ•ดํ•œ๋‹ค","๋‚˜๋Š” ์ฆ‰ํฅ์ ์ธ ๊ฒฐ์ •์„ ๋‚ด๋ฆฌ๋Š” ๊ฒƒ์„ ์ข‹์•„ํ•œ๋‹ค","๋‚˜๋Š” ํ˜ผ์ž ์žˆ๋Š” ์‹œ๊ฐ„์ด ํ•„์š”ํ•˜๋‹ค","๋‚˜๋Š” ์‹ค์šฉ์ ์ด๊ณ  ํ˜„์‹ค์ ์ธ ํ•ด๊ฒฐ์ฑ…์„ ์„ ํ˜ธํ•œ๋‹ค","๋‚˜๋Š” ๊ฐˆ๋“ฑ ์ƒํ™ฉ์„ ํ”ผํ•˜๋ ค๊ณ  ํ•œ๋‹ค","๋‚˜๋Š” ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ์ผ์„ ๋™์‹œ์— ์ฒ˜๋ฆฌํ•˜๋Š” ๊ฒƒ์„ ์ข‹์•„ํ•œ๋‹ค","๋‚˜๋Š” ์‚ฌ๊ต์ ์ด๊ณ  ์™ธํ–ฅ์ ์ด๋‹ค","๋‚˜๋Š” ๋ฏธ๋ž˜์˜ ๊ฐ€๋Šฅ์„ฑ์— ๋Œ€ํ•ด ์ƒ๊ฐํ•˜๋Š” ๊ฒƒ์„ ์ข‹์•„ํ•œ๋‹ค","๋‚˜๋Š” ๊ฐ๊ด€์ ์ด๊ณ  ๋ถ„์„์ ์œผ๋กœ ์‚ฌ๊ณ ํ•œ๋‹ค","๋‚˜๋Š” ๊ตฌ์กฐํ™”๋˜๊ณ  ์กฐ์ง์ ์ธ ํ™˜๊ฒฝ์„ ์„ ํ˜ธํ•œ๋‹ค","๋‚˜๋Š” ํŒ€์›Œํฌ๋ณด๋‹ค๋Š” ๊ฐœ์ธ ์ž‘์—…์„ ์„ ํ˜ธํ•œ๋‹ค","๋‚˜๋Š” ์ „ํ†ต์ ์ธ ๋ฐฉ๋ฒ•๋ณด๋‹ค๋Š” ์ƒˆ๋กœ์šด ๋ฐฉ๋ฒ•์„ ์‹œ๋„ํ•œ๋‹ค","๋‚˜๋Š” ๊ฒฐ์ •์„ ๋‚ด๋ฆด ๋•Œ ๋‹ค๋ฅธ ์‚ฌ๋žŒ์˜ ์˜๊ฒฌ์„ ๊ณ ๋ คํ•œ๋‹ค","๋‚˜๋Š” ์œตํ†ต์„ฑ ์žˆ๊ณ  ์ ์‘๋ ฅ์ด ์ข‹๋‹ค"];function U0(){const{user:o,isLoading:s}=wr(),i=Bn(),[u,c]=p.useState({}),[f,h]=p.useState(0),[w,g]=p.useState(!1),{toast:y}=Er();if(p.useEffect(()=>{!s&&!o&&i("/login")},[o,s,i]),s)return m.createElement("div",{className:"flex justify-center items-center min-h-screen"},"๋กœ๋”ฉ ์ค‘...");if(!o)return null;const k=(U,V)=>{c(j=>({...j,[U]:Number.parseInt(V)}))},x=()=>{fU+1)},I=()=>{f>0&&h(U=>U-1)},z=async()=>{g(!0);try{const V=Object.values(u).reduce((ie,se)=>ie+se,0)/An.length;let j="";V>=4?j="์™ธํ–ฅ์  ๋ฆฌ๋”ํ˜•":V>=3?j="๊ท ํ˜•์žกํžŒ ๋ถ„์„ํ˜•":j="์‹ ์ค‘ํ•œ ์‚ฌ์ƒ‰ํ˜•";const G={personality:j,score:V,answers:u,completedAt:new Date().toISOString()};await ho.saveTestResult(G),i("/result"),y({title:"ํ…Œ์ŠคํŠธ ์™„๋ฃŒ",description:"๊ฒฐ๊ณผ๋ฅผ ํ™•์ธํ•ด๋ณด์„ธ์š”!"})}catch(U){console.error("Test submission failed:",U),y({title:"์˜ค๋ฅ˜",description:"ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ์ €์žฅ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.",variant:"destructive"})}finally{g(!1)}},b=(f+1)/An.length*100,T=u[f]!==void 0,N=An.every((U,V)=>u[V]!==void 0);return m.createElement("div",{className:"min-h-screen bg-gray-50"},m.createElement(kr,null),m.createElement("main",{className:"container mx-auto px-4 py-8"},m.createElement("div",{className:"max-w-2xl mx-auto"},m.createElement("div",{className:"mb-8"},m.createElement("div",{className:"flex justify-between items-center mb-4"},m.createElement("h1",{className:"text-2xl font-bold"},"์„ฑํ–ฅ ํ…Œ์ŠคํŠธ"),m.createElement("span",{className:"text-sm text-muted-foreground"},f+1," / ",An.length)),m.createElement(bp,{value:b,className:"w-full"})),m.createElement(Bt,null,m.createElement(Wt,null,m.createElement(Ht,{className:"text-lg"},An[f])),m.createElement(Gt,null,m.createElement(_p,{value:u[f]?.toString()||"",onValueChange:U=>k(f,U)},m.createElement("div",{className:"flex items-center space-x-2"},m.createElement(gr,{value:"5",id:"5"}),m.createElement(wt,{htmlFor:"5"},"๋งค์šฐ ๊ทธ๋ ‡๋‹ค (5์ )")),m.createElement("div",{className:"flex items-center space-x-2"},m.createElement(gr,{value:"4",id:"4"}),m.createElement(wt,{htmlFor:"4"},"๊ทธ๋ ‡๋‹ค (4์ )")),m.createElement("div",{className:"flex items-center space-x-2"},m.createElement(gr,{value:"3",id:"3"}),m.createElement(wt,{htmlFor:"3"},"๋ณดํ†ต์ด๋‹ค (3์ )")),m.createElement("div",{className:"flex items-center space-x-2"},m.createElement(gr,{value:"2",id:"2"}),m.createElement(wt,{htmlFor:"2"},"์•„๋‹ˆ๋‹ค (2์ )")),m.createElement("div",{className:"flex items-center space-x-2"},m.createElement(gr,{value:"1",id:"1"}),m.createElement(wt,{htmlFor:"1"},"๋งค์šฐ ์•„๋‹ˆ๋‹ค (1์ )"))))),m.createElement("div",{className:"flex justify-between mt-8"},m.createElement(Qe,{variant:"outline",onClick:I,disabled:f===0},"์ด์ „"),f===An.length-1?m.createElement(Qe,{onClick:z,disabled:!N||w},w?"๊ฒฐ๊ณผ ์ €์žฅ ์ค‘...":"๊ฒฐ๊ณผ ํ™•์ธํ•˜๊ธฐ"):m.createElement(Qe,{onClick:x,disabled:!T},"๋‹ค์Œ")))))}var Gl="Tabs",[$0,tw]=Wn(Gl,[Wl]),Fp=Wl(),[V0,Na]=$0(Gl),jp=p.forwardRef((o,s)=>{const{__scopeTabs:i,value:u,onValueChange:c,defaultValue:f,orientation:h="horizontal",dir:w,activationMode:g="automatic",...y}=o,k=xa(w),[x,I]=Vl({prop:u,onChange:c,defaultProp:f??"",caller:Gl});return B.jsx(V0,{scope:i,baseId:sp(),value:x,onValueChange:I,orientation:h,dir:k,activationMode:g,children:B.jsx(_e.div,{dir:k,"data-orientation":h,...y,ref:s})})});jp.displayName=Gl;var Up="TabsList",$p=p.forwardRef((o,s)=>{const{__scopeTabs:i,loop:u=!0,...c}=o,f=Na(Up,i),h=Fp(i);return B.jsx(pp,{asChild:!0,...h,orientation:f.orientation,dir:f.dir,loop:u,children:B.jsx(_e.div,{role:"tablist","aria-orientation":f.orientation,...c,ref:s})})});$p.displayName=Up;var Vp="TabsTrigger",Bp=p.forwardRef((o,s)=>{const{__scopeTabs:i,value:u,disabled:c=!1,...f}=o,h=Na(Vp,i),w=Fp(i),g=Gp(h.baseId,u),y=Kp(h.baseId,u),k=u===h.value;return B.jsx(mp,{asChild:!0,...w,focusable:!c,active:k,children:B.jsx(_e.button,{type:"button",role:"tab","aria-selected":k,"aria-controls":y,"data-state":k?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:g,...f,ref:s,onMouseDown:Pe(o.onMouseDown,x=>{!c&&x.button===0&&x.ctrlKey===!1?h.onValueChange(u):x.preventDefault()}),onKeyDown:Pe(o.onKeyDown,x=>{[" ","Enter"].includes(x.key)&&h.onValueChange(u)}),onFocus:Pe(o.onFocus,()=>{const x=h.activationMode!=="manual";!k&&!c&&x&&h.onValueChange(u)})})})});Bp.displayName=Vp;var Wp="TabsContent",Hp=p.forwardRef((o,s)=>{const{__scopeTabs:i,value:u,forceMount:c,children:f,...h}=o,w=Na(Wp,i),g=Gp(w.baseId,u),y=Kp(w.baseId,u),k=u===w.value,x=p.useRef(k);return p.useEffect(()=>{const I=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(I)},[]),B.jsx($l,{present:c||k,children:({present:I})=>B.jsx(_e.div,{"data-state":k?"active":"inactive","data-orientation":w.orientation,role:"tabpanel","aria-labelledby":g,hidden:!I,id:y,tabIndex:0,...h,ref:s,style:{...o.style,animationDuration:x.current?"0s":void 0},children:I&&f})})});Hp.displayName=Wp;function Gp(o,s){return`${o}-trigger-${s}`}function Kp(o,s){return`${o}-content-${s}`}var B0=jp,Qp=$p,Yp=Bp,Xp=Hp;const Jp=B0,Pa=p.forwardRef(({className:o,...s},i)=>p.createElement(Qp,{ref:i,className:ze("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",o),...s}));Pa.displayName=Qp.displayName;const Fn=p.forwardRef(({className:o,...s},i)=>p.createElement(Yp,{ref:i,className:ze("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",o),...s}));Fn.displayName=Yp.displayName;const jn=p.forwardRef(({className:o,...s},i)=>p.createElement(Xp,{ref:i,className:ze("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",o),...s}));jn.displayName=Xp.displayName;function W0(){const{user:o,isLoading:s}=wr(),i=Bn(),[u,c]=p.useState(null),[f,h]=p.useState(null),[w,g]=p.useState(!0),{toast:y}=Er();p.useEffect(()=>{if(!s&&!o){i("/login");return}o&&k()},[o,s,i]);const k=async()=>{try{const x=await ho.getTestHistory();if(x.length===0){i("/test");return}const I=x[0];c(I);const z=await ho.getRecommendations(I.personality);h(z)}catch(x){console.error("Failed to fetch test result:",x),y({title:"์˜ค๋ฅ˜",description:"ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.",variant:"destructive"}),i("/test")}finally{g(!1)}};return s||w?m.createElement("div",{className:"flex justify-center items-center min-h-screen"},"๋กœ๋”ฉ ์ค‘..."):!o||!u||!f?null:m.createElement("div",{className:"min-h-screen bg-gray-50"},m.createElement(kr,null),m.createElement("main",{className:"container mx-auto px-4 py-8"},m.createElement("div",{className:"max-w-4xl mx-auto"},m.createElement("div",{className:"h-96 mb-8"},m.createElement(Bt,{className:"bg-gradient-to-r from-blue-500 to-purple-600 text-white h-full"},m.createElement(Wt,{className:"text-center"},m.createElement(Ht,{className:"text-3xl mb-4"},"ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ"),m.createElement("div",{className:"text-6xl mb-4"},"๐ŸŽฏ"),m.createElement("h2",{className:"text-4xl font-bold mb-4"},u.personality),m.createElement("p",{className:"text-xl opacity-90"},"ํ‰๊ท  ์ ์ˆ˜: ",u.score.toFixed(1),"์ ")),m.createElement(Gt,{className:"text-center"},m.createElement("p",{className:"text-lg opacity-90 mb-6"},u.personality==="์™ธํ–ฅ์  ๋ฆฌ๋”ํ˜•"&&"๋‹น์‹ ์€ ์‚ฌ๊ต์ ์ด๊ณ  ๋ฆฌ๋”์‹ญ์ด ๋›ฐ์–ด๋‚œ ์„ฑํ–ฅ์ž…๋‹ˆ๋‹ค. ์ƒˆ๋กœ์šด ๋„์ „์„ ์ฆ๊ธฐ๊ณ  ํŒ€์„ ์ด๋„๋Š” ๊ฒƒ์„ ์ข‹์•„ํ•ฉ๋‹ˆ๋‹ค.",u.personality==="๊ท ํ˜•์žกํžŒ ๋ถ„์„ํ˜•"&&"๋‹น์‹ ์€ ๋…ผ๋ฆฌ์ ์ด๋ฉด์„œ๋„ ๊ฐ์ •์  ๊ท ํ˜•์„ ์ž˜ ๋งž์ถ”๋Š” ์„ฑํ–ฅ์ž…๋‹ˆ๋‹ค. ์‹ ์ค‘ํ•˜๊ฒŒ ํŒ๋‹จํ•˜๊ณ  ํ•ฉ๋ฆฌ์ ์ธ ๊ฒฐ์ •์„ ๋‚ด๋ฆฝ๋‹ˆ๋‹ค.",u.personality==="์‹ ์ค‘ํ•œ ์‚ฌ์ƒ‰ํ˜•"&&"๋‹น์‹ ์€ ๊นŠ์ด ์žˆ๊ฒŒ ์ƒ๊ฐํ•˜๊ณ  ์‹ ์ค‘ํ•œ ์„ฑํ–ฅ์ž…๋‹ˆ๋‹ค. ํ˜ผ์ž๋งŒ์˜ ์‹œ๊ฐ„์„ ์†Œ์ค‘ํžˆ ์—ฌ๊ธฐ๊ณ  ๋‚ด๋ฉด์˜ ์„ฑ์ฐฐ์„ ์ค‘์š”ํ•˜๊ฒŒ ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.")))),m.createElement(Bt,null,m.createElement(Wt,null,m.createElement(Ht,{className:"text-2xl text-center"},"๋งž์ถค ์ถ”์ฒœ ์ปจํ…์ธ ")),m.createElement(Gt,null,m.createElement(Jp,{defaultValue:"movies",className:"w-full"},m.createElement(Pa,{className:"grid w-full grid-cols-3"},m.createElement(Fn,{value:"movies"},"๐ŸŽฌ ์˜ํ™”"),m.createElement(Fn,{value:"books"},"๐Ÿ“š ์ฑ…"),m.createElement(Fn,{value:"music"},"๐ŸŽต ์Œ์•…")),m.createElement(jn,{value:"movies",className:"mt-6"},m.createElement("div",{className:"grid gap-4"},f.movies?.map((x,I)=>m.createElement("div",{key:I,className:"p-4 bg-gray-100 rounded-lg"},m.createElement("h3",{className:"font-semibold"},x.title),x.description&&m.createElement("p",{className:"text-sm text-gray-600 mt-1"},x.description))))),m.createElement(jn,{value:"books",className:"mt-6"},m.createElement("div",{className:"grid gap-4"},f.books?.map((x,I)=>m.createElement("div",{key:I,className:"p-4 bg-gray-100 rounded-lg"},m.createElement("h3",{className:"font-semibold"},x.title),x.author&&m.createElement("p",{className:"text-sm text-gray-600 mt-1"},"์ €์ž: ",x.author),x.description&&m.createElement("p",{className:"text-sm text-gray-600 mt-1"},x.description))))),m.createElement(jn,{value:"music",className:"mt-6"},m.createElement("div",{className:"grid gap-4"},f.music?.map((x,I)=>m.createElement("div",{key:I,className:"p-4 bg-gray-100 rounded-lg"},m.createElement("h3",{className:"font-semibold"},x.name),x.genre&&m.createElement("p",{className:"text-sm text-gray-600 mt-1"},"์žฅ๋ฅด: ",x.genre),x.description&&m.createElement("p",{className:"text-sm text-gray-600 mt-1"},x.description)))))))),m.createElement("div",{className:"text-center mt-8"},m.createElement(Qe,{onClick:()=>i("/test"),className:"mr-4"},"๋‹ค์‹œ ํ…Œ์ŠคํŠธํ•˜๊ธฐ"),m.createElement(Qe,{variant:"outline",onClick:()=>i("/")},"ํ™ˆ์œผ๋กœ ๋Œ์•„๊ฐ€๊ธฐ")))))}function H0(){const{user:o,isLoading:s}=wr(),i=Bn(),[u,c]=p.useState([]),[f,h]=p.useState(null),[w,g]=p.useState(null),[y,k]=p.useState(!0),{toast:x}=Er();p.useEffect(()=>{if(!s&&!o){i("/login");return}o&&I()},[o,s,i]);const I=async()=>{try{const T=await ho.getTestHistory();c(T)}catch(T){console.error("Failed to fetch test history:",T),x({title:"์˜ค๋ฅ˜",description:"ํ…Œ์ŠคํŠธ ํžˆ์Šคํ† ๋ฆฌ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.",variant:"destructive"})}finally{k(!1)}},z=async T=>{try{h(T);const N=await ho.getRecommendations(T.personality);g(N)}catch(N){console.error("Failed to fetch recommendations:",N),x({title:"์˜ค๋ฅ˜",description:"์ถ”์ฒœ ์ปจํ…์ธ ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.",variant:"destructive"})}};if(s||y)return m.createElement("div",{className:"flex justify-center items-center min-h-screen"},"๋กœ๋”ฉ ์ค‘...");if(!o)return null;const b=T=>new Date(T).toLocaleString("ko-KR",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return m.createElement("div",{className:"min-h-screen bg-gray-50"},m.createElement(kr,null),m.createElement("main",{className:"container mx-auto px-4 py-8"},m.createElement("div",{className:"max-w-4xl mx-auto"},m.createElement("h1",{className:"text-3xl font-bold mb-8"},"๋งˆ์ดํŽ˜์ด์ง€"),m.createElement(Bt,{className:"mb-8"},m.createElement(Wt,null,m.createElement(Ht,null,"๋‚ด ์ •๋ณด")),m.createElement(Gt,null,m.createElement("div",{className:"grid md:grid-cols-2 gap-6"},m.createElement("div",null,m.createElement("h3",{className:"font-semibold text-gray-700 mb-2"},"์ด๋ฆ„"),m.createElement("p",{className:"text-lg"},o.name)),m.createElement("div",null,m.createElement("h3",{className:"font-semibold text-gray-700 mb-2"},"๋‚ด ์„ฑํ–ฅ"),m.createElement("p",{className:"text-lg"},u.length>0?u[0].personality:"ํ…Œ์ŠคํŠธ๋ฅผ ์™„๋ฃŒํ•ด์ฃผ์„ธ์š”"))))),m.createElement(Bt,null,m.createElement(Wt,null,m.createElement(Ht,null,"์ถ”์ฒœ๋ฐ›์€ ์ปจํ…์ธ  ํžˆ์Šคํ† ๋ฆฌ")),m.createElement(Gt,null,u.length===0?m.createElement("div",{className:"text-center py-8"},m.createElement("p",{className:"text-gray-500 mb-4"},"์•„์ง ํ…Œ์ŠคํŠธ๋ฅผ ์™„๋ฃŒํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค."),m.createElement(Qe,{onClick:()=>i("/test")},"ํ…Œ์ŠคํŠธํ•˜๋Ÿฌ ๊ฐ€๊ธฐ")," "):m.createElement("div",{className:"space-y-4"},u.map((T,N)=>m.createElement("div",{key:N,className:"p-4 border rounded-lg cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>z(T)},m.createElement("div",{className:"flex justify-between items-center"},m.createElement("div",null,m.createElement("p",{className:"font-semibold"},T.personality),m.createElement("p",{className:"text-sm text-gray-500"},b(T.completedAt)),m.createElement("p",{className:"text-sm text-gray-600"},"์ ์ˆ˜: ",T.score.toFixed(1),"์ ")),m.createElement(Qe,{variant:"outline",size:"sm"},"์ƒ์„ธ๋ณด๊ธฐ"))))))),f&&w&&m.createElement(Bt,{className:"mt-8"},m.createElement(Wt,null,m.createElement(Ht,null,f.personality," - ",b(f.completedAt))),m.createElement(Gt,null,m.createElement(Jp,{defaultValue:"movies",className:"w-full"},m.createElement(Pa,{className:"grid w-full grid-cols-3"},m.createElement(Fn,{value:"movies"},"๐ŸŽฌ ์˜ํ™”"),m.createElement(Fn,{value:"books"},"๐Ÿ“š ์ฑ…"),m.createElement(Fn,{value:"music"},"๐ŸŽต ์Œ์•…")),m.createElement(jn,{value:"movies",className:"mt-6"},m.createElement("div",{className:"grid gap-3"},w.movies?.map((T,N)=>m.createElement("div",{key:N,className:"p-3 bg-gray-100 rounded"},m.createElement("h4",{className:"font-semibold"},T.title),T.description&&m.createElement("p",{className:"text-sm text-gray-600 mt-1"},T.description))))),m.createElement(jn,{value:"books",className:"mt-6"},m.createElement("div",{className:"grid gap-3"},w.books?.map((T,N)=>m.createElement("div",{key:N,className:"p-3 bg-gray-100 rounded"},m.createElement("h4",{className:"font-semibold"},T.title),T.author&&m.createElement("p",{className:"text-sm text-gray-600 mt-1"},"์ €์ž: ",T.author),T.description&&m.createElement("p",{className:"text-sm text-gray-600 mt-1"},T.description))))),m.createElement(jn,{value:"music",className:"mt-6"},m.createElement("div",{className:"grid gap-3"},w.music?.map((T,N)=>m.createElement("div",{key:N,className:"p-3 bg-gray-100 rounded"},m.createElement("h4",{className:"font-semibold"},T.name),T.genre&&m.createElement("p",{className:"text-sm text-gray-600 mt-1"},"์žฅ๋ฅด: ",T.genre),T.description&&m.createElement("p",{className:"text-sm text-gray-600 mt-1"},T.description)))))),m.createElement("div",{className:"mt-6"},m.createElement(Qe,{variant:"outline",onClick:()=>h(null)},"๋‹ซ๊ธฐ")))))))}const bn=p.forwardRef(({className:o,type:s,...i},u)=>p.createElement("input",{type:s,className:ze("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",o),ref:u,...i}));bn.displayName="Input";var G0="Separator",qd="horizontal",K0=["horizontal","vertical"],Zp=p.forwardRef((o,s)=>{const{decorative:i,orientation:u=qd,...c}=o,f=Q0(u)?u:qd,w=i?{role:"none"}:{"aria-orientation":f==="vertical"?f:void 0,role:"separator"};return B.jsx(_e.div,{"data-orientation":f,...w,...c,ref:s})});Zp.displayName=G0;function Q0(o){return K0.includes(o)}var qp=Zp;const Ta=p.forwardRef(({className:o,orientation:s="horizontal",decorative:i=!0,...u},c)=>p.createElement(qp,{ref:c,decorative:i,orientation:s,className:ze("shrink-0 bg-border",s==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",o),...u}));Ta.displayName=qp.displayName;function Y0(){const[o,s]=p.useState(""),[i,u]=p.useState(""),[c,f]=p.useState(!1),{login:h}=wr(),w=Bn(),{toast:g}=Er(),y=async x=>{x.preventDefault(),f(!0);try{await h(o,i)?(g({title:"๋กœ๊ทธ์ธ ์„ฑ๊ณต",description:"ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค!"}),w("/")):g({title:"๋กœ๊ทธ์ธ ์‹คํŒจ",description:"์ด๋ฉ”์ผ ๋˜๋Š” ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ํ™•์ธํ•ด์ฃผ์„ธ์š”.",variant:"destructive"})}catch{g({title:"์˜ค๋ฅ˜",description:"๋กœ๊ทธ์ธ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.",variant:"destructive"})}finally{f(!1)}},k=()=>{window.location.href="http://localhost:8080/api/auth/google"};return m.createElement("div",{className:"min-h-screen bg-gray-50"},m.createElement(kr,null),m.createElement("main",{className:"container mx-auto px-4 py-16"},m.createElement("div",{className:"max-w-md mx-auto"},m.createElement(Bt,null,m.createElement(Wt,{className:"text-center"},m.createElement(Ht,{className:"text-2xl"},"๋กœ๊ทธ์ธ"),m.createElement("p",{className:"text-muted-foreground"},"๊ณ„์ •์— ๋กœ๊ทธ์ธํ•˜์—ฌ ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ๋ฅผ ์‹œ์ž‘ํ•˜์„ธ์š”")),m.createElement(Gt,{className:"space-y-6"},m.createElement("form",{onSubmit:y,className:"space-y-4"},m.createElement("div",{className:"space-y-2"},m.createElement(wt,{htmlFor:"email"},"์ด๋ฉ”์ผ"),m.createElement(bn,{id:"email",type:"email",placeholder:"example@email.com",value:o,onChange:x=>s(x.target.value),required:!0})),m.createElement("div",{className:"space-y-2"},m.createElement(wt,{htmlFor:"password"},"๋น„๋ฐ€๋ฒˆํ˜ธ"),m.createElement(bn,{id:"password",type:"password",placeholder:"๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”",value:i,onChange:x=>u(x.target.value),required:!0})),m.createElement(Qe,{type:"submit",className:"w-full",disabled:c},c?"๋กœ๊ทธ์ธ ์ค‘...":"๋กœ๊ทธ์ธ")),m.createElement(Ta,null),m.createElement(Qe,{variant:"outline",className:"w-full bg-transparent",onClick:k},m.createElement("svg",{className:"w-5 h-5 mr-2",viewBox:"0 0 24 24"},m.createElement("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),m.createElement("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),m.createElement("path",{fill:"currentColor",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),m.createElement("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})),"๊ตฌ๊ธ€๋กœ ๋กœ๊ทธ์ธ"),m.createElement("div",{className:"text-center"},m.createElement("p",{className:"text-sm text-muted-foreground"},"๊ณ„์ •์ด ์—†์œผ์‹ ๊ฐ€์š”?"," ",m.createElement(Dn,{to:"/register",className:"text-primary hover:underline"},"ํšŒ์›๊ฐ€์ž…"))),m.createElement("div",{className:"text-center text-sm bg-blue-50 p-4 rounded-lg"},m.createElement("p",{className:"font-semibold text-blue-800 mb-2"},"๐Ÿงช ํ…Œ์ŠคํŠธ ๊ณ„์ •"),m.createElement("div",{className:"space-y-1 text-blue-700"},m.createElement("p",null,m.createElement("strong",null,"๊ณ„์ • 1:")," test@example.com / password123"),m.createElement("p",null,m.createElement("strong",null,"๊ณ„์ • 2:")," dev@example.com / dev123")),m.createElement("p",{className:"text-xs text-blue-600 mt-2"},"* ๋ฐฑ์—”๋“œ ์„œ๋ฒ„๊ฐ€ ์—†์–ด๋„ ํ…Œ์ŠคํŠธ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค")))))))}function X0(){const[o,s]=p.useState(""),[i,u]=p.useState(""),[c,f]=p.useState(""),[h,w]=p.useState(""),[g,y]=p.useState(!1),{register:k}=wr(),x=Bn(),{toast:I}=Er(),z=async T=>{if(T.preventDefault(),c!==h){I({title:"๋น„๋ฐ€๋ฒˆํ˜ธ ๋ถˆ์ผ์น˜",description:"๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ์ผ์น˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.",variant:"destructive"});return}if(c.length<6){I({title:"๋น„๋ฐ€๋ฒˆํ˜ธ ์˜ค๋ฅ˜",description:"๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” 6์ž ์ด์ƒ์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.",variant:"destructive"});return}y(!0);try{await k(o,i,c)?(I({title:"ํšŒ์›๊ฐ€์ž… ์„ฑ๊ณต",description:"ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค! ๋กœ๊ทธ์ธ๋˜์—ˆ์Šต๋‹ˆ๋‹ค."}),x("/")):I({title:"ํšŒ์›๊ฐ€์ž… ์‹คํŒจ",description:"ํšŒ์›๊ฐ€์ž… ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.",variant:"destructive"})}catch{I({title:"์˜ค๋ฅ˜",description:"ํšŒ์›๊ฐ€์ž… ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.",variant:"destructive"})}finally{y(!1)}},b=()=>{window.location.href="http://localhost:8080/api/auth/google"};return m.createElement("div",{className:"min-h-screen bg-gray-50"},m.createElement(kr,null),m.createElement("main",{className:"container mx-auto px-4 py-16"},m.createElement("div",{className:"max-w-md mx-auto"},m.createElement(Bt,null,m.createElement(Wt,{className:"text-center"},m.createElement(Ht,{className:"text-2xl"},"ํšŒ์›๊ฐ€์ž…"),m.createElement("p",{className:"text-muted-foreground"},"์ƒˆ ๊ณ„์ •์„ ๋งŒ๋“ค์–ด ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ๋ฅผ ์‹œ์ž‘ํ•˜์„ธ์š”")),m.createElement(Gt,{className:"space-y-6"},m.createElement("form",{onSubmit:z,className:"space-y-4"},m.createElement("div",{className:"space-y-2"},m.createElement(wt,{htmlFor:"name"},"์ด๋ฆ„"),m.createElement(bn,{id:"name",type:"text",placeholder:"ํ™๊ธธ๋™",value:o,onChange:T=>s(T.target.value),required:!0})),m.createElement("div",{className:"space-y-2"},m.createElement(wt,{htmlFor:"email"},"์ด๋ฉ”์ผ"),m.createElement(bn,{id:"email",type:"email",placeholder:"example@email.com",value:i,onChange:T=>u(T.target.value),required:!0})),m.createElement("div",{className:"space-y-2"},m.createElement(wt,{htmlFor:"password"},"๋น„๋ฐ€๋ฒˆํ˜ธ"),m.createElement(bn,{id:"password",type:"password",placeholder:"๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š” (6์ž ์ด์ƒ)",value:c,onChange:T=>f(T.target.value),required:!0,minLength:6})),m.createElement("div",{className:"space-y-2"},m.createElement(wt,{htmlFor:"confirmPassword"},"๋น„๋ฐ€๋ฒˆํ˜ธ ํ™•์ธ"),m.createElement(bn,{id:"confirmPassword",type:"password",placeholder:"๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๋‹ค์‹œ ์ž…๋ ฅํ•˜์„ธ์š”",value:h,onChange:T=>w(T.target.value),required:!0})),m.createElement(Qe,{type:"submit",className:"w-full",disabled:g},g?"ํšŒ์›๊ฐ€์ž… ์ค‘...":"ํšŒ์›๊ฐ€์ž…")),m.createElement(Ta,null),m.createElement(Qe,{variant:"outline",className:"w-full bg-transparent",onClick:b},m.createElement("svg",{className:"w-5 h-5 mr-2",viewBox:"0 0 24 24"},m.createElement("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),m.createElement("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),m.createElement("path",{fill:"currentColor",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),m.createElement("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})),"๊ตฌ๊ธ€๋กœ ํšŒ์›๊ฐ€์ž…"),m.createElement("div",{className:"text-center"},m.createElement("p",{className:"text-sm text-muted-foreground"},"์ด๋ฏธ ๊ณ„์ •์ด ์žˆ์œผ์‹ ๊ฐ€์š”?"," ",m.createElement(Dn,{to:"/login",className:"text-primary hover:underline"},"๋กœ๊ทธ์ธ"))))))))}function J0(){return m.createElement(ng,null,m.createElement(dg,null,m.createElement(Yv,null,m.createElement(zn,{path:"/",element:m.createElement(r0,null)}),m.createElement(zn,{path:"/test",element:m.createElement(U0,null)}),m.createElement(zn,{path:"/result",element:m.createElement(W0,null)}),m.createElement(zn,{path:"/mypage",element:m.createElement(H0,null)}),m.createElement(zn,{path:"/login",element:m.createElement(Y0,null)}),m.createElement(zn,{path:"/register",element:m.createElement(X0,null)})),m.createElement(t0,null)))}rv.createRoot(document.getElementById("root")).render(m.createElement(m.StrictMode,null,m.createElement(J0,null))); -//# sourceMappingURL=index-C2MZhA2F.js.map diff --git a/dist/assets/index-C2MZhA2F.js.map b/dist/assets/index-C2MZhA2F.js.map deleted file mode 100644 index d80f9af..0000000 --- a/dist/assets/index-C2MZhA2F.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index-C2MZhA2F.js","sources":["../../node_modules/react/cjs/react.production.min.js","../../node_modules/react/index.js","../../node_modules/scheduler/cjs/scheduler.production.min.js","../../node_modules/scheduler/index.js","../../node_modules/react-dom/cjs/react-dom.production.min.js","../../node_modules/react-dom/index.js","../../node_modules/react-dom/client.js","../../node_modules/@remix-run/router/dist/router.js","../../node_modules/react-router/dist/index.js","../../node_modules/react-router-dom/dist/index.js","../../src/lib/mock-data.js","../../src/lib/api.js","../../src/lib/cookie-utils.js","../../src/components/auth-provider.jsx","../../node_modules/clsx/dist/clsx.mjs","../../node_modules/class-variance-authority/dist/index.mjs","../../node_modules/lucide-react/dist/esm/shared/src/utils.js","../../node_modules/lucide-react/dist/esm/defaultAttributes.js","../../node_modules/lucide-react/dist/esm/Icon.js","../../node_modules/lucide-react/dist/esm/createLucideIcon.js","../../node_modules/lucide-react/dist/esm/icons/circle.js","../../node_modules/lucide-react/dist/esm/icons/x.js","../../node_modules/@radix-ui/primitive/dist/index.mjs","../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../node_modules/react/jsx-runtime.js","../../node_modules/@radix-ui/react-context/dist/index.mjs","../../node_modules/@radix-ui/react-slot/dist/index.mjs","../../node_modules/@radix-ui/react-collection/dist/index.mjs","../../node_modules/@radix-ui/react-primitive/dist/index.mjs","../../node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs","../../node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs","../../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs","../../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs","../../node_modules/@radix-ui/react-portal/dist/index.mjs","../../node_modules/@radix-ui/react-presence/dist/index.mjs","../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs","../../node_modules/@radix-ui/react-visually-hidden/dist/index.mjs","../../node_modules/@radix-ui/react-toast/dist/index.mjs","../../src/hooks/use-toast.js","../../node_modules/tailwind-merge/dist/bundle-mjs.mjs","../../src/lib/utils.js","../../src/components/ui/toast.jsx","../../src/components/ui/toaster.jsx","../../src/components/ui/button.jsx","../../src/components/header.jsx","../../src/pages/HomePage.jsx","../../src/components/ui/card.jsx","../../node_modules/@radix-ui/react-id/dist/index.mjs","../../node_modules/@radix-ui/react-direction/dist/index.mjs","../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs","../../node_modules/@radix-ui/react-use-size/dist/index.mjs","../../node_modules/@radix-ui/react-use-previous/dist/index.mjs","../../node_modules/@radix-ui/react-radio-group/dist/index.mjs","../../src/components/ui/radio-group.jsx","../../node_modules/@radix-ui/react-label/dist/index.mjs","../../src/components/ui/label.jsx","../../node_modules/@radix-ui/react-progress/dist/index.mjs","../../src/components/ui/progress.jsx","../../src/pages/TestPage.jsx","../../node_modules/@radix-ui/react-tabs/dist/index.mjs","../../src/components/ui/tabs.jsx","../../src/pages/ResultPage.jsx","../../src/pages/MyPage.jsx","../../src/components/ui/input.jsx","../../node_modules/@radix-ui/react-separator/dist/index.mjs","../../src/components/ui/separator.jsx","../../src/pages/LoginPage.jsx","../../src/pages/RegisterPage.jsx","../../src/App.jsx","../../src/main.jsx"],"sourcesContent":["/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)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,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1>>1,e=a[d];if(0>>1;dg(C,c))ng(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(ng(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","/**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n/*\n Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n'use strict';var aa=require(\"react\"),ca=require(\"scheduler\");function p(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return!1}function v(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var z={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){z[a]=new v(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];z[b]=new v(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){z[a]=new v(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){z[a]=new v(a,2,!1,a,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(a){z[a]=new v(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){z[a]=new v(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){z[a]=new v(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){z[a]=new v(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){z[a]=new v(a,5,!1,a.toLowerCase(),null,!1,!1)});var ra=/[\\-:]([a-z])/g;function sa(a){return a[1].toUpperCase()}\n\"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(a){var b=a.replace(ra,\nsa);z[b]=new v(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!1,!1)});\nz.xlinkHref=new v(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction ta(a,b,c,d){var e=z.hasOwnProperty(b)?z[b]:null;if(null!==e?0!==e.type:d||!(2h||e[g]!==f[h]){var k=\"\\n\"+e[g].replace(\" at new \",\" at \");a.displayName&&k.includes(\"\")&&(k=k.replace(\"\",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{Na=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Ma(a):\"\"}\nfunction Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma(\"Lazy\");case 13:return Ma(\"Suspense\");case 19:return Ma(\"SuspenseList\");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return\"\"}}\nfunction Qa(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ya:return\"Fragment\";case wa:return\"Portal\";case Aa:return\"Profiler\";case za:return\"StrictMode\";case Ea:return\"Suspense\";case Fa:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case Ca:return(a.displayName||\"Context\")+\".Consumer\";case Ba:return(a._context.displayName||\"Context\")+\".Provider\";case Da:var b=a.render;a=a.displayName;a||(a=b.displayName||\nb.name||\"\",a=\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");return a;case Ga:return b=a.displayName||null,null!==b?b:Qa(a.type)||\"Memo\";case Ha:b=a._payload;a=a._init;try{return Qa(a(b))}catch(c){}}return null}\nfunction Ra(a){var b=a.type;switch(a.tag){case 24:return\"Cache\";case 9:return(b.displayName||\"Context\")+\".Consumer\";case 10:return(b._context.displayName||\"Context\")+\".Provider\";case 18:return\"DehydratedFragment\";case 11:return a=b.render,a=a.displayName||a.name||\"\",b.displayName||(\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");case 7:return\"Fragment\";case 5:return b;case 4:return\"Portal\";case 3:return\"Root\";case 6:return\"Text\";case 16:return Qa(b);case 8:return b===za?\"StrictMode\":\"Mode\";case 22:return\"Offscreen\";\ncase 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(\"function\"===typeof b)return b.displayName||b.name||null;if(\"string\"===typeof b)return b}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"string\":case \"undefined\":return a;case \"object\":return a;default:return\"\"}}\nfunction Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return A({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function ab(a,b){b=b.checked;null!=b&&ta(a,\"checked\",b,!1)}\nfunction bb(a,b){ab(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?cb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&cb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction db(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction cb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}var eb=Array.isArray;\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e\"+b.valueOf().toString()+\"\";for(b=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction ob(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}\nvar pb={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,\nzoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(pb).forEach(function(a){qb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);pb[b]=pb[a]})});function rb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||pb.hasOwnProperty(a)&&pb[a]?(\"\"+b).trim():b+\"px\"}\nfunction sb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=rb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e}}var tb=A({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});\nfunction ub(a,b){if(b){if(tb[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(p(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(p(60));if(\"object\"!==typeof b.dangerouslySetInnerHTML||!(\"__html\"in b.dangerouslySetInnerHTML))throw Error(p(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(p(62));}}\nfunction vb(a,b){if(-1===a.indexOf(\"-\"))return\"string\"===typeof b.is;switch(a){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 wb=null;function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(p(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;a>>=0;return 0===a?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304;\nfunction tc(a){switch(a&-a){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 a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;\ndefault:return a}}function uc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=tc(h):(f&=g,0!==f&&(d=tc(f)))}else g=c&~e,0!==g?d=tc(g):0!==f&&(d=tc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0c;c++)b.push(a);return b}\nfunction Ac(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-oc(b);a[b]=c}function Bc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return-1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return!0;default:return!1}}function he(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return\"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Je(c)}}function Le(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Le(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Me(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=Xa(a.document)}return b}function Ne(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nfunction Oe(a){var b=Me(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&c&&c.ownerDocument&&Le(c.ownerDocument.documentElement,c)){if(null!==d&&Ne(c))if(b=d.start,a=d.end,void 0===a&&(a=b),\"selectionStart\"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);else if(a=(b=c.ownerDocument||document)&&b.defaultView||window,a.getSelection){a=a.getSelection();var e=c.textContent.length,f=Math.min(d.start,e);d=void 0===d.end?f:Math.min(d.end,e);!a.extend&&f>d&&(e=d,d=f,f=e);e=Ke(c,f);var g=Ke(c,\nd);e&&g&&(1!==a.rangeCount||a.anchorNode!==e.node||a.anchorOffset!==e.offset||a.focusNode!==g.node||a.focusOffset!==g.offset)&&(b=b.createRange(),b.setStart(e.node,e.offset),a.removeAllRanges(),f>d?(a.addRange(b),a.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),a.addRange(b)))}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});\"function\"===typeof c.focus&&c.focus();for(c=0;c=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Ne(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Ie(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Tf||(a.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(a,b){Tf++;Sf[Tf]=a.current;a.current=b}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(a,b){var c=a.type.contextTypes;if(!c)return Vf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}\nfunction Zf(a){a=a.childContextTypes;return null!==a&&void 0!==a}function $f(){E(Wf);E(H)}function ag(a,b,c){if(H.current!==Vf)throw Error(p(168));G(H,b);G(Wf,c)}function bg(a,b,c){var d=a.stateNode;b=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(p(108,Ra(a)||\"Unknown\",e));return A({},c,d)}\nfunction cg(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf;Xf=H.current;G(H,a);G(Wf,Wf.current);return!0}function dg(a,b,c){var d=a.stateNode;if(!d)throw Error(p(169));c?(a=bg(a,b,Xf),d.__reactInternalMemoizedMergedChildContext=a,E(Wf),E(H),G(H,a)):E(Wf);G(Wf,c)}var eg=null,fg=!1,gg=!1;function hg(a){null===eg?eg=[a]:eg.push(a)}function ig(a){fg=!0;hg(a)}\nfunction jg(){if(!gg&&null!==eg){gg=!0;var a=0,b=C;try{var c=eg;for(C=1;a>=g;e-=g;rg=1<<32-oc(b)+e|c<w?(x=u,u=null):x=u.sibling;var n=r(e,u,h[w],k);if(null===n){null===u&&(u=x);break}a&&u&&null===n.alternate&&b(e,u);g=f(n,g,w);null===m?l=n:m.sibling=n;m=n;u=x}if(w===h.length)return c(e,u),I&&tg(e,w),l;if(null===u){for(;ww?(x=m,m=null):x=m.sibling;var t=r(e,m,n.value,k);if(null===t){null===m&&(m=x);break}a&&m&&null===t.alternate&&b(e,m);g=f(t,g,w);null===u?l=t:u.sibling=t;u=t;m=x}if(n.done)return c(e,\nm),I&&tg(e,w),l;if(null===m){for(;!n.done;w++,n=h.next())n=q(e,n.value,k),null!==n&&(g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);I&&tg(e,w);return l}for(m=d(e,m);!n.done;w++,n=h.next())n=y(m,e,w,n.value,k),null!==n&&(a&&null!==n.alternate&&m.delete(null===n.key?w:n.key),g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);a&&m.forEach(function(a){return b(e,a)});I&&tg(e,w);return l}function J(a,d,f,h){\"object\"===typeof f&&null!==f&&f.type===ya&&null===f.key&&(f=f.props.children);if(\"object\"===typeof f&&null!==f){switch(f.$$typeof){case va:a:{for(var k=\nf.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ya){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||\"object\"===typeof k&&null!==k&&k.$$typeof===Ha&&Ng(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=Lg(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling}f.type===ya?(d=Tg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Rg(f.type,f.key,f.props,null,a.mode,h),h.ref=Lg(a,d,f),h.return=a,a=h)}return g(a);case wa:a:{for(l=f.key;null!==\nd;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=Sg(f,a.mode,h);d.return=a;a=d}return g(a);case Ha:return l=f._init,J(a,d,l(f._payload),h)}if(eb(f))return n(a,d,f,h);if(Ka(f))return t(a,d,f,h);Mg(a,f)}return\"string\"===typeof f&&\"\"!==f||\"number\"===typeof f?(f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):\n(c(a,d),d=Qg(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return J}var Ug=Og(!0),Vg=Og(!1),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null}function ah(a){var b=Wg.current;E(Wg);a._currentValue=b}function bh(a,b,c){for(;null!==a;){var d=a.alternate;(a.childLanes&b)!==b?(a.childLanes|=b,null!==d&&(d.childLanes|=b)):null!==d&&(d.childLanes&b)!==b&&(d.childLanes|=b);if(a===c)break;a=a.return}}\nfunction ch(a,b){Xg=a;Zg=Yg=null;a=a.dependencies;null!==a&&null!==a.firstContext&&(0!==(a.lanes&b)&&(dh=!0),a.firstContext=null)}function eh(a){var b=a._currentValue;if(Zg!==a)if(a={context:a,memoizedValue:b,next:null},null===Yg){if(null===Xg)throw Error(p(308));Yg=a;Xg.dependencies={lanes:0,firstContext:a}}else Yg=Yg.next=a;return b}var fh=null;function gh(a){null===fh?fh=[a]:fh.push(a)}\nfunction hh(a,b,c,d){var e=b.interleaved;null===e?(c.next=c,gh(b)):(c.next=e.next,e.next=c);b.interleaved=c;return ih(a,d)}function ih(a,b){a.lanes|=b;var c=a.alternate;null!==c&&(c.lanes|=b);c=a;for(a=a.return;null!==a;)a.childLanes|=b,c=a.alternate,null!==c&&(c.childLanes|=b),c=a,a=a.return;return 3===c.tag?c.stateNode:null}var jh=!1;function kh(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}\nfunction lh(a,b){a=a.updateQueue;b.updateQueue===a&&(b.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function mh(a,b){return{eventTime:a,lane:b,tag:0,payload:null,callback:null,next:null}}\nfunction nh(a,b,c){var d=a.updateQueue;if(null===d)return null;d=d.shared;if(0!==(K&2)){var e=d.pending;null===e?b.next=b:(b.next=e.next,e.next=b);d.pending=b;return ih(a,c)}e=d.interleaved;null===e?(b.next=b,gh(d)):(b.next=e.next,e.next=b);d.interleaved=b;return ih(a,c)}function oh(a,b,c){b=b.updateQueue;if(null!==b&&(b=b.shared,0!==(c&4194240))){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c)}}\nfunction ph(a,b){var c=a.updateQueue,d=a.alternate;if(null!==d&&(d=d.updateQueue,c===d)){var e=null,f=null;c=c.firstBaseUpdate;if(null!==c){do{var g={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};null===f?e=f=g:f=f.next=g;c=c.next}while(null!==c);null===f?e=f=b:f=f.next=b}else e=f=b;c={baseState:d.baseState,firstBaseUpdate:e,lastBaseUpdate:f,shared:d.shared,effects:d.effects};a.updateQueue=c;return}a=c.lastBaseUpdate;null===a?c.firstBaseUpdate=b:a.next=\nb;c.lastBaseUpdate=b}\nfunction qh(a,b,c,d){var e=a.updateQueue;jh=!1;var f=e.firstBaseUpdate,g=e.lastBaseUpdate,h=e.shared.pending;if(null!==h){e.shared.pending=null;var k=h,l=k.next;k.next=null;null===g?f=l:g.next=l;g=k;var m=a.alternate;null!==m&&(m=m.updateQueue,h=m.lastBaseUpdate,h!==g&&(null===h?m.firstBaseUpdate=l:h.next=l,m.lastBaseUpdate=k))}if(null!==f){var q=e.baseState;g=0;m=l=k=null;h=f;do{var r=h.lane,y=h.eventTime;if((d&r)===r){null!==m&&(m=m.next={eventTime:y,lane:0,tag:h.tag,payload:h.payload,callback:h.callback,\nnext:null});a:{var n=a,t=h;r=b;y=c;switch(t.tag){case 1:n=t.payload;if(\"function\"===typeof n){q=n.call(y,q,r);break a}q=n;break a;case 3:n.flags=n.flags&-65537|128;case 0:n=t.payload;r=\"function\"===typeof n?n.call(y,q,r):n;if(null===r||void 0===r)break a;q=A({},q,r);break a;case 2:jh=!0}}null!==h.callback&&0!==h.lane&&(a.flags|=64,r=e.effects,null===r?e.effects=[h]:r.push(h))}else y={eventTime:y,lane:r,tag:h.tag,payload:h.payload,callback:h.callback,next:null},null===m?(l=m=y,k=q):m=m.next=y,g|=r;\nh=h.next;if(null===h)if(h=e.shared.pending,null===h)break;else r=h,h=r.next,r.next=null,e.lastBaseUpdate=r,e.shared.pending=null}while(1);null===m&&(k=q);e.baseState=k;e.firstBaseUpdate=l;e.lastBaseUpdate=m;b=e.shared.interleaved;if(null!==b){e=b;do g|=e.lane,e=e.next;while(e!==b)}else null===f&&(e.shared.lanes=0);rh|=g;a.lanes=g;a.memoizedState=q}}\nfunction sh(a,b,c){a=b.effects;b.effects=null;if(null!==a)for(b=0;bc?c:4;a(!0);var d=Gh.transition;Gh.transition={};try{a(!1),b()}finally{C=c,Gh.transition=d}}function wi(){return Uh().memoizedState}\nfunction xi(a,b,c){var d=yi(a);c={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(zi(a))Ai(b,c);else if(c=hh(a,b,c,d),null!==c){var e=R();gi(c,a,d,e);Bi(c,b,d)}}\nfunction ii(a,b,c){var d=yi(a),e={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(zi(a))Ai(b,e);else{var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(He(h,g)){var k=b.interleaved;null===k?(e.next=e,gh(b)):(e.next=k.next,k.next=e);b.interleaved=e;return}}catch(l){}finally{}c=hh(a,b,e,d);null!==c&&(e=R(),gi(c,a,d,e),Bi(c,b,d))}}\nfunction zi(a){var b=a.alternate;return a===M||null!==b&&b===M}function Ai(a,b){Jh=Ih=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b}function Bi(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c)}}\nvar Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(a,b){Th().memoizedState=[a,void 0===b?null:b];return a},useContext:eh,useEffect:mi,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ki(4194308,\n4,pi.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ki(4194308,4,a,b)},useInsertionEffect:function(a,b){return ki(4,2,a,b)},useMemo:function(a,b){var c=Th();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=Th();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=xi.bind(null,M,a);return[d.memoizedState,a]},useRef:function(a){var b=\nTh();a={current:a};return b.memoizedState=a},useState:hi,useDebugValue:ri,useDeferredValue:function(a){return Th().memoizedState=a},useTransition:function(){var a=hi(!1),b=a[0];a=vi.bind(null,a[1]);Th().memoizedState=a;return[b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=M,e=Th();if(I){if(void 0===c)throw Error(p(407));c=c()}else{c=b();if(null===Q)throw Error(p(349));0!==(Hh&30)||di(d,b,c)}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;mi(ai.bind(null,d,\nf,a),[a]);d.flags|=2048;bi(9,ci.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=Th(),b=Q.identifierPrefix;if(I){var c=sg;var d=rg;c=(d&~(1<<32-oc(d)-1)).toString(32)+c;b=\":\"+b+\"R\"+c;c=Kh++;0\\x3c/script>\",a=a.removeChild(a.firstChild)):\n\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[Of]=b;a[Pf]=d;zj(a,b,!1,!1);b.stateNode=a;a:{g=vb(c,d);switch(c){case \"dialog\":D(\"cancel\",a);D(\"close\",a);e=d;break;case \"iframe\":case \"object\":case \"embed\":D(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eGj&&(b.flags|=128,d=!0,Dj(f,!1),b.lanes=4194304)}else{if(!d)if(a=Ch(g),null!==a){if(b.flags|=128,d=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Dj(f,!0),null===f.tail&&\"hidden\"===f.tailMode&&!g.alternate&&!I)return S(b),null}else 2*B()-f.renderingStartTime>Gj&&1073741824!==c&&(b.flags|=128,d=!0,Dj(f,!1),b.lanes=4194304);f.isBackwards?(g.sibling=b.child,b.child=g):(c=f.last,null!==c?c.sibling=g:b.child=g,f.last=g)}if(null!==f.tail)return b=f.tail,f.rendering=\nb,f.tail=b.sibling,f.renderingStartTime=B(),b.sibling=null,c=L.current,G(L,d?c&1|2:c&1),b;S(b);return null;case 22:case 23:return Hj(),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(fj&1073741824)&&(S(b),b.subtreeFlags&6&&(b.flags|=8192)):S(b),null;case 24:return null;case 25:return null}throw Error(p(156,b.tag));}\nfunction Ij(a,b){wg(b);switch(b.tag){case 1:return Zf(b.type)&&$f(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return zh(),E(Wf),E(H),Eh(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return Bh(b),null;case 13:E(L);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(p(340));Ig()}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return E(L),null;case 4:return zh(),null;case 10:return ah(b.type._context),null;case 22:case 23:return Hj(),\nnull;case 24:return null;default:return null}}var Jj=!1,U=!1,Kj=\"function\"===typeof WeakSet?WeakSet:Set,V=null;function Lj(a,b){var c=a.ref;if(null!==c)if(\"function\"===typeof c)try{c(null)}catch(d){W(a,b,d)}else c.current=null}function Mj(a,b,c){try{c()}catch(d){W(a,b,d)}}var Nj=!1;\nfunction Oj(a,b){Cf=dd;a=Me();if(Ne(a)){if(\"selectionStart\"in a)var c={start:a.selectionStart,end:a.selectionEnd};else a:{c=(c=a.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&0!==d.rangeCount){c=d.anchorNode;var e=d.anchorOffset,f=d.focusNode;d=d.focusOffset;try{c.nodeType,f.nodeType}catch(F){c=null;break a}var g=0,h=-1,k=-1,l=0,m=0,q=a,r=null;b:for(;;){for(var y;;){q!==c||0!==e&&3!==q.nodeType||(h=g+e);q!==f||0!==d&&3!==q.nodeType||(k=g+d);3===q.nodeType&&(g+=\nq.nodeValue.length);if(null===(y=q.firstChild))break;r=q;q=y}for(;;){if(q===a)break b;r===c&&++l===e&&(h=g);r===f&&++m===d&&(k=g);if(null!==(y=q.nextSibling))break;q=r;r=q.parentNode}q=y}c=-1===h||-1===k?null:{start:h,end:k}}else c=null}c=c||{start:0,end:0}}else c=null;Df={focusedElem:a,selectionRange:c};dd=!1;for(V=b;null!==V;)if(b=V,a=b.child,0!==(b.subtreeFlags&1028)&&null!==a)a.return=b,V=a;else for(;null!==V;){b=V;try{var n=b.alternate;if(0!==(b.flags&1024))switch(b.tag){case 0:case 11:case 15:break;\ncase 1:if(null!==n){var t=n.memoizedProps,J=n.memoizedState,x=b.stateNode,w=x.getSnapshotBeforeUpdate(b.elementType===b.type?t:Ci(b.type,t),J);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var u=b.stateNode.containerInfo;1===u.nodeType?u.textContent=\"\":9===u.nodeType&&u.documentElement&&u.removeChild(u.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163));}}catch(F){W(b,b.return,F)}a=b.sibling;if(null!==a){a.return=b.return;V=a;break}V=b.return}n=Nj;Nj=!1;return n}\nfunction Pj(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Mj(b,c,f)}e=e.next}while(e!==d)}}function Qj(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d()}c=c.next}while(c!==b)}}function Rj(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=c;break;default:a=c}\"function\"===typeof b?b(a):b.current=a}}\nfunction Sj(a){var b=a.alternate;null!==b&&(a.alternate=null,Sj(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&(delete b[Of],delete b[Pf],delete b[of],delete b[Qf],delete b[Rf]));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null}function Tj(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction Uj(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Tj(a.return))return null;a=a.return}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}\nfunction Vj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=Bf));else if(4!==d&&(a=a.child,null!==a))for(Vj(a,b,c),a=a.sibling;null!==a;)Vj(a,b,c),a=a.sibling}\nfunction Wj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(Wj(a,b,c),a=a.sibling;null!==a;)Wj(a,b,c),a=a.sibling}var X=null,Xj=!1;function Yj(a,b,c){for(c=c.child;null!==c;)Zj(a,b,c),c=c.sibling}\nfunction Zj(a,b,c){if(lc&&\"function\"===typeof lc.onCommitFiberUnmount)try{lc.onCommitFiberUnmount(kc,c)}catch(h){}switch(c.tag){case 5:U||Lj(c,b);case 6:var d=X,e=Xj;X=null;Yj(a,b,c);X=d;Xj=e;null!==X&&(Xj?(a=X,c=c.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):X.removeChild(c.stateNode));break;case 18:null!==X&&(Xj?(a=X,c=c.stateNode,8===a.nodeType?Kf(a.parentNode,c):1===a.nodeType&&Kf(a,c),bd(a)):Kf(X,c.stateNode));break;case 4:d=X;e=Xj;X=c.stateNode.containerInfo;Xj=!0;\nYj(a,b,c);X=d;Xj=e;break;case 0:case 11:case 14:case 15:if(!U&&(d=c.updateQueue,null!==d&&(d=d.lastEffect,null!==d))){e=d=d.next;do{var f=e,g=f.destroy;f=f.tag;void 0!==g&&(0!==(f&2)?Mj(c,b,g):0!==(f&4)&&Mj(c,b,g));e=e.next}while(e!==d)}Yj(a,b,c);break;case 1:if(!U&&(Lj(c,b),d=c.stateNode,\"function\"===typeof d.componentWillUnmount))try{d.props=c.memoizedProps,d.state=c.memoizedState,d.componentWillUnmount()}catch(h){W(c,b,h)}Yj(a,b,c);break;case 21:Yj(a,b,c);break;case 22:c.mode&1?(U=(d=U)||null!==\nc.memoizedState,Yj(a,b,c),U=d):Yj(a,b,c);break;default:Yj(a,b,c)}}function ak(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Kj);b.forEach(function(b){var d=bk.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}\nfunction ck(a,b){var c=b.deletions;if(null!==c)for(var d=0;de&&(e=g);d&=~f}d=e;d=B()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*lk(d/1960))-d;if(10a?16:a;if(null===wk)var d=!1;else{a=wk;wk=null;xk=0;if(0!==(K&6))throw Error(p(331));var e=K;K|=4;for(V=a.current;null!==V;){var f=V,g=f.child;if(0!==(V.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;kB()-fk?Kk(a,0):rk|=c);Dk(a,b)}function Yk(a,b){0===b&&(0===(a.mode&1)?b=1:(b=sc,sc<<=1,0===(sc&130023424)&&(sc=4194304)));var c=R();a=ih(a,b);null!==a&&(Ac(a,b,c),Dk(a,c))}function uj(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Yk(a,c)}\nfunction bk(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(p(314));}null!==d&&d.delete(b);Yk(a,c)}var Vk;\nVk=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||Wf.current)dh=!0;else{if(0===(a.lanes&c)&&0===(b.flags&128))return dh=!1,yj(a,b,c);dh=0!==(a.flags&131072)?!0:!1}else dh=!1,I&&0!==(b.flags&1048576)&&ug(b,ng,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;ij(a,b);a=b.pendingProps;var e=Yf(b,H.current);ch(b,c);e=Nh(null,b,d,a,e,c);var f=Sh();b.flags|=1;\"object\"===typeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof?(b.tag=1,b.memoizedState=null,b.updateQueue=\nnull,Zf(d)?(f=!0,cg(b)):f=!1,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,kh(b),e.updater=Ei,b.stateNode=e,e._reactInternals=b,Ii(b,d,a,c),b=jj(null,b,d,!0,f,c)):(b.tag=0,I&&f&&vg(b),Xi(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{ij(a,b);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=Zk(d);a=Ci(d,a);switch(e){case 0:b=cj(null,b,d,a,c);break a;case 1:b=hj(null,b,d,a,c);break a;case 11:b=Yi(null,b,d,a,c);break a;case 14:b=$i(null,b,d,Ci(d.type,a),c);break a}throw Error(p(306,\nd,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),cj(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),hj(a,b,d,e,c);case 3:a:{kj(b);if(null===a)throw Error(p(387));d=b.pendingProps;f=b.memoizedState;e=f.element;lh(a,b);qh(b,d,null,c);var g=b.memoizedState;d=g.element;if(f.isDehydrated)if(f={element:d,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},b.updateQueue.baseState=\nf,b.memoizedState=f,b.flags&256){e=Ji(Error(p(423)),b);b=lj(a,b,d,c,e);break a}else if(d!==e){e=Ji(Error(p(424)),b);b=lj(a,b,d,c,e);break a}else for(yg=Lf(b.stateNode.containerInfo.firstChild),xg=b,I=!0,zg=null,c=Vg(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{Ig();if(d===e){b=Zi(a,b,c);break a}Xi(a,b,d,c)}b=b.child}return b;case 5:return Ah(b),null===a&&Eg(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,Ef(d,e)?g=null:null!==f&&Ef(d,f)&&(b.flags|=32),\ngj(a,b),Xi(a,b,g,c),b.child;case 6:return null===a&&Eg(b),null;case 13:return oj(a,b,c);case 4:return yh(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Ug(b,null,d,c):Xi(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),Yi(a,b,d,e,c);case 7:return Xi(a,b,b.pendingProps,c),b.child;case 8:return Xi(a,b,b.pendingProps.children,c),b.child;case 12:return Xi(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;f=b.memoizedProps;\ng=e.value;G(Wg,d._currentValue);d._currentValue=g;if(null!==f)if(He(f.value,g)){if(f.children===e.children&&!Wf.current){b=Zi(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=mh(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=c);bh(f.return,\nc,b);h.lanes|=c;break}k=k.next}}else if(10===f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(p(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);bh(g,c,b);g=f.sibling}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return}f=g}Xi(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,d=b.pendingProps.children,ch(b,c),e=eh(e),d=d(e),b.flags|=1,Xi(a,b,d,c),\nb.child;case 14:return d=b.type,e=Ci(d,b.pendingProps),e=Ci(d.type,e),$i(a,b,d,e,c);case 15:return bj(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),ij(a,b),b.tag=1,Zf(d)?(a=!0,cg(b)):a=!1,ch(b,c),Gi(b,d,e),Ii(b,d,e,c),jj(null,b,d,!0,a,c);case 19:return xj(a,b,c);case 22:return dj(a,b,c)}throw Error(p(156,b.tag));};function Fk(a,b){return ac(a,b)}\nfunction $k(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null}function Bg(a,b,c,d){return new $k(a,b,c,d)}function aj(a){a=a.prototype;return!(!a||!a.isReactComponent)}\nfunction Zk(a){if(\"function\"===typeof a)return aj(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===Da)return 11;if(a===Ga)return 14}return 2}\nfunction Pg(a,b){var c=a.alternate;null===c?(c=Bg(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};\nc.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}\nfunction Rg(a,b,c,d,e,f){var g=2;d=a;if(\"function\"===typeof a)aj(a)&&(g=1);else if(\"string\"===typeof a)g=5;else a:switch(a){case ya:return Tg(c.children,e,f,b);case za:g=8;e|=8;break;case Aa:return a=Bg(12,c,b,e|2),a.elementType=Aa,a.lanes=f,a;case Ea:return a=Bg(13,c,b,e),a.elementType=Ea,a.lanes=f,a;case Fa:return a=Bg(19,c,b,e),a.elementType=Fa,a.lanes=f,a;case Ia:return pj(c,e,f,b);default:if(\"object\"===typeof a&&null!==a)switch(a.$$typeof){case Ba:g=10;break a;case Ca:g=9;break a;case Da:g=11;\nbreak a;case Ga:g=14;break a;case Ha:g=16;d=null;break a}throw Error(p(130,null==a?a:typeof a,\"\"));}b=Bg(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Tg(a,b,c,d){a=Bg(7,a,d,b);a.lanes=c;return a}function pj(a,b,c,d){a=Bg(22,a,d,b);a.elementType=Ia;a.lanes=c;a.stateNode={isHidden:!1};return a}function Qg(a,b,c){a=Bg(6,a,null,b);a.lanes=c;return a}\nfunction Sg(a,b,c){b=Bg(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}\nfunction al(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=zc(0);this.expirationTimes=zc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=zc(0);this.identifierPrefix=d;this.onRecoverableError=e;this.mutableSourceEagerHydrationData=\nnull}function bl(a,b,c,d,e,f,g,h,k){a=new al(a,b,c,h,k);1===b?(b=1,!0===f&&(b|=8)):b=0;f=Bg(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null};kh(f);return a}function cl(a,b,c){var d=3 createMemoryLocation(entry, typeof entry === \"string\" ? null : entry.state, index === 0 ? \"default\" : undefined));\n let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);\n let action = Action.Pop;\n let listener = null;\n function clampIndex(n) {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n function getCurrentLocation() {\n return entries[index];\n }\n function createMemoryLocation(to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = createLocation(entries ? getCurrentLocation().pathname : \"/\", to, state, key);\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in memory history: \" + JSON.stringify(to));\n return location;\n }\n function createHref(to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n let history = {\n get index() {\n return index;\n },\n get action() {\n return action;\n },\n get location() {\n return getCurrentLocation();\n },\n createHref,\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\n encodeLocation(to) {\n let path = typeof to === \"string\" ? parsePath(to) : to;\n return {\n pathname: path.pathname || \"\",\n search: path.search || \"\",\n hash: path.hash || \"\"\n };\n },\n push(to, state) {\n action = Action.Push;\n let nextLocation = createMemoryLocation(to, state);\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 1\n });\n }\n },\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 0\n });\n }\n },\n go(delta) {\n action = Action.Pop;\n let nextIndex = clampIndex(index + delta);\n let nextLocation = entries[nextIndex];\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: nextLocation,\n delta\n });\n }\n },\n listen(fn) {\n listener = fn;\n return () => {\n listener = null;\n };\n }\n };\n return history;\n}\n/**\n * Browser history stores the location in regular URLs. This is the standard for\n * most web apps, but it requires some configuration on the server to ensure you\n * serve the same app at multiple URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n */\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createBrowserLocation(window, globalHistory) {\n let {\n pathname,\n search,\n hash\n } = window.location;\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createBrowserHref(window, to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);\n}\n/**\n * Hash history stores the location in window.location.hash. This makes it ideal\n * for situations where you don't want to send the location to the server for\n * some reason, either because you do cannot configure it or the URL space is\n * reserved for something else.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n */\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createHashLocation(window, globalHistory) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = parsePath(window.location.hash.substr(1));\n // Hash URL should always have a leading / just like window.location.pathname\n // does, so if an app ends up at a route like /#something then we add a\n // leading slash so all of our path-matching behaves the same as if it would\n // in a browser router. This is particularly important when there exists a\n // root splat route () since that matches internally against\n // \"/*\" and we'd expect /#something to 404 in a hash router app.\n if (!pathname.startsWith(\"/\") && !pathname.startsWith(\".\")) {\n pathname = \"/\" + pathname;\n }\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createHashHref(window, to) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n if (base && base.getAttribute(\"href\")) {\n let url = window.location.href;\n let hashIndex = url.indexOf(\"#\");\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n return href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n }\n function validateHashLocation(location, to) {\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\");\n }\n return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);\n}\nfunction invariant(value, message) {\n if (value === false || value === null || typeof value === \"undefined\") {\n throw new Error(message);\n }\n}\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience, so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\n * For browser-based histories, we combine the state and key into an object\n */\nfunction getHistoryState(location, index) {\n return {\n usr: location.state,\n key: location.key,\n idx: index\n };\n}\n/**\n * Creates a Location object with a unique key from the given Path\n */\nfunction createLocation(current, to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = _extends({\n pathname: typeof current === \"string\" ? current : current.pathname,\n search: \"\",\n hash: \"\"\n }, typeof to === \"string\" ? parsePath(to) : to, {\n state,\n // TODO: This could be cleaned up. push/replace should probably just take\n // full Locations now and avoid the need to run through this flow at all\n // But that's a pretty big refactor to the current test suite so going to\n // keep as is for the time being and just let any incoming keys take precedence\n key: to && to.key || key || createKey()\n });\n return location;\n}\n/**\n * Creates a string URL path from the given pathname, search, and hash components.\n */\nfunction createPath(_ref) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = _ref;\n if (search && search !== \"?\") pathname += search.charAt(0) === \"?\" ? search : \"?\" + search;\n if (hash && hash !== \"#\") pathname += hash.charAt(0) === \"#\" ? hash : \"#\" + hash;\n return pathname;\n}\n/**\n * Parses a string URL path into its separate pathname, search, and hash components.\n */\nfunction parsePath(path) {\n let parsedPath = {};\n if (path) {\n let hashIndex = path.indexOf(\"#\");\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n let searchIndex = path.indexOf(\"?\");\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n if (path) {\n parsedPath.pathname = path;\n }\n }\n return parsedPath;\n}\nfunction getUrlBasedHistory(getLocation, createHref, validateLocation, options) {\n if (options === void 0) {\n options = {};\n }\n let {\n window = document.defaultView,\n v5Compat = false\n } = options;\n let globalHistory = window.history;\n let action = Action.Pop;\n let listener = null;\n let index = getIndex();\n // Index should only be null when we initialize. If not, it's because the\n // user called history.pushState or history.replaceState directly, in which\n // case we should log a warning as it will result in bugs.\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), \"\");\n }\n function getIndex() {\n let state = globalHistory.state || {\n idx: null\n };\n return state.idx;\n }\n function handlePop() {\n action = Action.Pop;\n let nextIndex = getIndex();\n let delta = nextIndex == null ? null : nextIndex - index;\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: history.location,\n delta\n });\n }\n }\n function push(to, state) {\n action = Action.Push;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex() + 1;\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n // try...catch because iOS limits us to 100 pushState calls :/\n try {\n globalHistory.pushState(historyState, \"\", url);\n } catch (error) {\n // If the exception is because `state` can't be serialized, let that throw\n // outwards just like a replace call would so the dev knows the cause\n // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps\n // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal\n if (error instanceof DOMException && error.name === \"DataCloneError\") {\n throw error;\n }\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 1\n });\n }\n }\n function replace(to, state) {\n action = Action.Replace;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex();\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n globalHistory.replaceState(historyState, \"\", url);\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 0\n });\n }\n }\n function createURL(to) {\n // window.location.origin is \"null\" (the literal string value) in Firefox\n // under certain conditions, notably when serving from a local HTML file\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297\n let base = window.location.origin !== \"null\" ? window.location.origin : window.location.href;\n let href = typeof to === \"string\" ? to : createPath(to);\n // Treating this as a full URL will strip any trailing spaces so we need to\n // pre-encode them since they might be part of a matching splat param from\n // an ancestor route\n href = href.replace(/ $/, \"%20\");\n invariant(base, \"No window.location.(origin|href) available to create URL for href: \" + href);\n return new URL(href, base);\n }\n let history = {\n get action() {\n return action;\n },\n get location() {\n return getLocation(window, globalHistory);\n },\n listen(fn) {\n if (listener) {\n throw new Error(\"A history only accepts one active listener\");\n }\n window.addEventListener(PopStateEventType, handlePop);\n listener = fn;\n return () => {\n window.removeEventListener(PopStateEventType, handlePop);\n listener = null;\n };\n },\n createHref(to) {\n return createHref(window, to);\n },\n createURL,\n encodeLocation(to) {\n // Encode a Location the same way window.location would\n let url = createURL(to);\n return {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash\n };\n },\n push,\n replace,\n go(n) {\n return globalHistory.go(n);\n }\n };\n return history;\n}\n//#endregion\n\nvar ResultType;\n(function (ResultType) {\n ResultType[\"data\"] = \"data\";\n ResultType[\"deferred\"] = \"deferred\";\n ResultType[\"redirect\"] = \"redirect\";\n ResultType[\"error\"] = \"error\";\n})(ResultType || (ResultType = {}));\nconst immutableRouteKeys = new Set([\"lazy\", \"caseSensitive\", \"path\", \"id\", \"index\", \"children\"]);\nfunction isIndexRoute(route) {\n return route.index === true;\n}\n// Walk the route tree generating unique IDs where necessary, so we are working\n// solely with AgnosticDataRouteObject's within the Router\nfunction convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath, manifest) {\n if (parentPath === void 0) {\n parentPath = [];\n }\n if (manifest === void 0) {\n manifest = {};\n }\n return routes.map((route, index) => {\n let treePath = [...parentPath, String(index)];\n let id = typeof route.id === \"string\" ? route.id : treePath.join(\"-\");\n invariant(route.index !== true || !route.children, \"Cannot specify children on an index route\");\n invariant(!manifest[id], \"Found a route id collision on id \\\"\" + id + \"\\\". Route \" + \"id's must be globally unique within Data Router usages\");\n if (isIndexRoute(route)) {\n let indexRoute = _extends({}, route, mapRouteProperties(route), {\n id\n });\n manifest[id] = indexRoute;\n return indexRoute;\n } else {\n let pathOrLayoutRoute = _extends({}, route, mapRouteProperties(route), {\n id,\n children: undefined\n });\n manifest[id] = pathOrLayoutRoute;\n if (route.children) {\n pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest);\n }\n return pathOrLayoutRoute;\n }\n });\n}\n/**\n * Matches the given routes to a location and returns the match data.\n *\n * @see https://reactrouter.com/v6/utils/match-routes\n */\nfunction matchRoutes(routes, locationArg, basename) {\n if (basename === void 0) {\n basename = \"/\";\n }\n return matchRoutesImpl(routes, locationArg, basename, false);\n}\nfunction matchRoutesImpl(routes, locationArg, basename, allowPartial) {\n let location = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n let pathname = stripBasename(location.pathname || \"/\", basename);\n if (pathname == null) {\n return null;\n }\n let branches = flattenRoutes(routes);\n rankRouteBranches(branches);\n let matches = null;\n for (let i = 0; matches == null && i < branches.length; ++i) {\n // Incoming pathnames are generally encoded from either window.location\n // or from router.navigate, but we want to match against the unencoded\n // paths in the route definitions. Memory router locations won't be\n // encoded here but there also shouldn't be anything to decode so this\n // should be a safe operation. This avoids needing matchRoutes to be\n // history-aware.\n let decoded = decodePath(pathname);\n matches = matchRouteBranch(branches[i], decoded, allowPartial);\n }\n return matches;\n}\nfunction convertRouteMatchToUiMatch(match, loaderData) {\n let {\n route,\n pathname,\n params\n } = match;\n return {\n id: route.id,\n pathname,\n params,\n data: loaderData[route.id],\n handle: route.handle\n };\n}\nfunction flattenRoutes(routes, branches, parentsMeta, parentPath) {\n if (branches === void 0) {\n branches = [];\n }\n if (parentsMeta === void 0) {\n parentsMeta = [];\n }\n if (parentPath === void 0) {\n parentPath = \"\";\n }\n let flattenRoute = (route, index, relativePath) => {\n let meta = {\n relativePath: relativePath === undefined ? route.path || \"\" : relativePath,\n caseSensitive: route.caseSensitive === true,\n childrenIndex: index,\n route\n };\n if (meta.relativePath.startsWith(\"/\")) {\n invariant(meta.relativePath.startsWith(parentPath), \"Absolute route path \\\"\" + meta.relativePath + \"\\\" nested under path \" + (\"\\\"\" + parentPath + \"\\\" is not valid. An absolute child route path \") + \"must start with the combined path of all its parent routes.\");\n meta.relativePath = meta.relativePath.slice(parentPath.length);\n }\n let path = joinPaths([parentPath, meta.relativePath]);\n let routesMeta = parentsMeta.concat(meta);\n // Add the children before adding this route to the array, so we traverse the\n // route tree depth-first and child routes appear before their parents in\n // the \"flattened\" version.\n if (route.children && route.children.length > 0) {\n invariant(\n // Our types know better, but runtime JS may not!\n // @ts-expect-error\n route.index !== true, \"Index routes must not have child routes. Please remove \" + (\"all child routes from route path \\\"\" + path + \"\\\".\"));\n flattenRoutes(route.children, branches, routesMeta, path);\n }\n // Routes without a path shouldn't ever match by themselves unless they are\n // index routes, so don't add them to the list of possible branches.\n if (route.path == null && !route.index) {\n return;\n }\n branches.push({\n path,\n score: computeScore(path, route.index),\n routesMeta\n });\n };\n routes.forEach((route, index) => {\n var _route$path;\n // coarse-grain check for optional params\n if (route.path === \"\" || !((_route$path = route.path) != null && _route$path.includes(\"?\"))) {\n flattenRoute(route, index);\n } else {\n for (let exploded of explodeOptionalSegments(route.path)) {\n flattenRoute(route, index, exploded);\n }\n }\n });\n return branches;\n}\n/**\n * Computes all combinations of optional path segments for a given path,\n * excluding combinations that are ambiguous and of lower priority.\n *\n * For example, `/one/:two?/three/:four?/:five?` explodes to:\n * - `/one/three`\n * - `/one/:two/three`\n * - `/one/three/:four`\n * - `/one/three/:five`\n * - `/one/:two/three/:four`\n * - `/one/:two/three/:five`\n * - `/one/three/:four/:five`\n * - `/one/:two/three/:four/:five`\n */\nfunction explodeOptionalSegments(path) {\n let segments = path.split(\"/\");\n if (segments.length === 0) return [];\n let [first, ...rest] = segments;\n // Optional path segments are denoted by a trailing `?`\n let isOptional = first.endsWith(\"?\");\n // Compute the corresponding required segment: `foo?` -> `foo`\n let required = first.replace(/\\?$/, \"\");\n if (rest.length === 0) {\n // Intepret empty string as omitting an optional segment\n // `[\"one\", \"\", \"three\"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three`\n return isOptional ? [required, \"\"] : [required];\n }\n let restExploded = explodeOptionalSegments(rest.join(\"/\"));\n let result = [];\n // All child paths with the prefix. Do this for all children before the\n // optional version for all children, so we get consistent ordering where the\n // parent optional aspect is preferred as required. Otherwise, we can get\n // child sections interspersed where deeper optional segments are higher than\n // parent optional segments, where for example, /:two would explode _earlier_\n // then /:one. By always including the parent as required _for all children_\n // first, we avoid this issue\n result.push(...restExploded.map(subpath => subpath === \"\" ? required : [required, subpath].join(\"/\")));\n // Then, if this is an optional value, add all child versions without\n if (isOptional) {\n result.push(...restExploded);\n }\n // for absolute paths, ensure `/` instead of empty segment\n return result.map(exploded => path.startsWith(\"/\") && exploded === \"\" ? \"/\" : exploded);\n}\nfunction rankRouteBranches(branches) {\n branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first\n : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));\n}\nconst paramRe = /^:[\\w-]+$/;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\nconst isSplat = s => s === \"*\";\nfunction computeScore(path, index) {\n let segments = path.split(\"/\");\n let initialScore = segments.length;\n if (segments.some(isSplat)) {\n initialScore += splatPenalty;\n }\n if (index) {\n initialScore += indexRouteValue;\n }\n return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === \"\" ? emptySegmentValue : staticSegmentValue), initialScore);\n}\nfunction compareIndexes(a, b) {\n let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);\n return siblings ?\n // If two routes are siblings, we should try to match the earlier sibling\n // first. This allows people to have fine-grained control over the matching\n // behavior by simply putting routes with identical paths in the order they\n // want them tried.\n a[a.length - 1] - b[b.length - 1] :\n // Otherwise, it doesn't really make sense to rank non-siblings by index,\n // so they sort equally.\n 0;\n}\nfunction matchRouteBranch(branch, pathname, allowPartial) {\n if (allowPartial === void 0) {\n allowPartial = false;\n }\n let {\n routesMeta\n } = branch;\n let matchedParams = {};\n let matchedPathname = \"/\";\n let matches = [];\n for (let i = 0; i < routesMeta.length; ++i) {\n let meta = routesMeta[i];\n let end = i === routesMeta.length - 1;\n let remainingPathname = matchedPathname === \"/\" ? pathname : pathname.slice(matchedPathname.length) || \"/\";\n let match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end\n }, remainingPathname);\n let route = meta.route;\n if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {\n match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end: false\n }, remainingPathname);\n }\n if (!match) {\n return null;\n }\n Object.assign(matchedParams, match.params);\n matches.push({\n // TODO: Can this as be avoided?\n params: matchedParams,\n pathname: joinPaths([matchedPathname, match.pathname]),\n pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),\n route\n });\n if (match.pathnameBase !== \"/\") {\n matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n }\n }\n return matches;\n}\n/**\n * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/v6/utils/generate-path\n */\nfunction generatePath(originalPath, params) {\n if (params === void 0) {\n params = {};\n }\n let path = originalPath;\n if (path.endsWith(\"*\") && path !== \"*\" && !path.endsWith(\"/*\")) {\n warning(false, \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n path = path.replace(/\\*$/, \"/*\");\n }\n // ensure `/` is added at the beginning if the path is absolute\n const prefix = path.startsWith(\"/\") ? \"/\" : \"\";\n const stringify = p => p == null ? \"\" : typeof p === \"string\" ? p : String(p);\n const segments = path.split(/\\/+/).map((segment, index, array) => {\n const isLastSegment = index === array.length - 1;\n // only apply the splat if it's the last segment\n if (isLastSegment && segment === \"*\") {\n const star = \"*\";\n // Apply the splat\n return stringify(params[star]);\n }\n const keyMatch = segment.match(/^:([\\w-]+)(\\??)$/);\n if (keyMatch) {\n const [, key, optional] = keyMatch;\n let param = params[key];\n invariant(optional === \"?\" || param != null, \"Missing \\\":\" + key + \"\\\" param\");\n return stringify(param);\n }\n // Remove any optional markers from optional static segments\n return segment.replace(/\\?$/g, \"\");\n })\n // Remove empty segments\n .filter(segment => !!segment);\n return prefix + segments.join(\"/\");\n}\n/**\n * Performs pattern matching on a URL pathname and returns information about\n * the match.\n *\n * @see https://reactrouter.com/v6/utils/match-path\n */\nfunction matchPath(pattern, pathname) {\n if (typeof pattern === \"string\") {\n pattern = {\n path: pattern,\n caseSensitive: false,\n end: true\n };\n }\n let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);\n let match = pathname.match(matcher);\n if (!match) return null;\n let matchedPathname = match[0];\n let pathnameBase = matchedPathname.replace(/(.)\\/+$/, \"$1\");\n let captureGroups = match.slice(1);\n let params = compiledParams.reduce((memo, _ref, index) => {\n let {\n paramName,\n isOptional\n } = _ref;\n // We need to compute the pathnameBase here using the raw splat value\n // instead of using params[\"*\"] later because it will be decoded then\n if (paramName === \"*\") {\n let splatValue = captureGroups[index] || \"\";\n pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\\/+$/, \"$1\");\n }\n const value = captureGroups[index];\n if (isOptional && !value) {\n memo[paramName] = undefined;\n } else {\n memo[paramName] = (value || \"\").replace(/%2F/g, \"/\");\n }\n return memo;\n }, {});\n return {\n params,\n pathname: matchedPathname,\n pathnameBase,\n pattern\n };\n}\nfunction compilePath(path, caseSensitive, end) {\n if (caseSensitive === void 0) {\n caseSensitive = false;\n }\n if (end === void 0) {\n end = true;\n }\n warning(path === \"*\" || !path.endsWith(\"*\") || path.endsWith(\"/*\"), \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n let params = [];\n let regexpSource = \"^\" + path.replace(/\\/*\\*?$/, \"\") // Ignore trailing / and /*, we'll handle it below\n .replace(/^\\/*/, \"/\") // Make sure it has a leading /\n .replace(/[\\\\.*+^${}|()[\\]]/g, \"\\\\$&\") // Escape special regex chars\n .replace(/\\/:([\\w-]+)(\\?)?/g, (_, paramName, isOptional) => {\n params.push({\n paramName,\n isOptional: isOptional != null\n });\n return isOptional ? \"/?([^\\\\/]+)?\" : \"/([^\\\\/]+)\";\n });\n if (path.endsWith(\"*\")) {\n params.push({\n paramName: \"*\"\n });\n regexpSource += path === \"*\" || path === \"/*\" ? \"(.*)$\" // Already matched the initial /, just match the rest\n : \"(?:\\\\/(.+)|\\\\/*)$\"; // Don't include the / in params[\"*\"]\n } else if (end) {\n // When matching to the end, ignore trailing slashes\n regexpSource += \"\\\\/*$\";\n } else if (path !== \"\" && path !== \"/\") {\n // If our path is non-empty and contains anything beyond an initial slash,\n // then we have _some_ form of path in our regex, so we should expect to\n // match only if we find the end of this path segment. Look for an optional\n // non-captured trailing slash (to match a portion of the URL) or the end\n // of the path (if we've matched to the end). We used to do this with a\n // word boundary but that gives false positives on routes like\n // /user-preferences since `-` counts as a word boundary.\n regexpSource += \"(?:(?=\\\\/|$))\";\n } else ;\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n return [matcher, params];\n}\nfunction decodePath(value) {\n try {\n return value.split(\"/\").map(v => decodeURIComponent(v).replace(/\\//g, \"%2F\")).join(\"/\");\n } catch (error) {\n warning(false, \"The URL path \\\"\" + value + \"\\\" could not be decoded because it is is a \" + \"malformed URL segment. This is probably due to a bad percent \" + (\"encoding (\" + error + \").\"));\n return value;\n }\n}\n/**\n * @private\n */\nfunction stripBasename(pathname, basename) {\n if (basename === \"/\") return pathname;\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\n }\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n let startIndex = basename.endsWith(\"/\") ? basename.length - 1 : basename.length;\n let nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n return pathname.slice(startIndex) || \"/\";\n}\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/v6/utils/resolve-path\n */\nfunction resolvePath(to, fromPathname) {\n if (fromPathname === void 0) {\n fromPathname = \"/\";\n }\n let {\n pathname: toPathname,\n search = \"\",\n hash = \"\"\n } = typeof to === \"string\" ? parsePath(to) : to;\n let pathname = toPathname ? toPathname.startsWith(\"/\") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;\n return {\n pathname,\n search: normalizeSearch(search),\n hash: normalizeHash(hash)\n };\n}\nfunction resolvePathname(relativePath, fromPathname) {\n let segments = fromPathname.replace(/\\/+$/, \"\").split(\"/\");\n let relativeSegments = relativePath.split(\"/\");\n relativeSegments.forEach(segment => {\n if (segment === \"..\") {\n // Keep the root \"\" segment so the pathname starts at /\n if (segments.length > 1) segments.pop();\n } else if (segment !== \".\") {\n segments.push(segment);\n }\n });\n return segments.length > 1 ? segments.join(\"/\") : \"/\";\n}\nfunction getInvalidPathError(char, field, dest, path) {\n return \"Cannot include a '\" + char + \"' character in a manually specified \" + (\"`to.\" + field + \"` field [\" + JSON.stringify(path) + \"]. Please separate it out to the \") + (\"`to.\" + dest + \"` field. Alternatively you may provide the full path as \") + \"a string in and the router will parse it for you.\";\n}\n/**\n * @private\n *\n * When processing relative navigation we want to ignore ancestor routes that\n * do not contribute to the path, such that index/pathless layout routes don't\n * interfere.\n *\n * For example, when moving a route element into an index route and/or a\n * pathless layout route, relative link behavior contained within should stay\n * the same. Both of the following examples should link back to the root:\n *\n * \n * \n * \n *\n * \n * \n * }> // <-- Does not contribute\n * // <-- Does not contribute\n * \n * \n */\nfunction getPathContributingMatches(matches) {\n return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);\n}\n// Return the array of pathnames for the current route matches - used to\n// generate the routePathnames input for resolveTo()\nfunction getResolveToMatches(matches, v7_relativeSplatPath) {\n let pathMatches = getPathContributingMatches(matches);\n // When v7_relativeSplatPath is enabled, use the full pathname for the leaf\n // match so we include splat values for \".\" links. See:\n // https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329\n if (v7_relativeSplatPath) {\n return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);\n }\n return pathMatches.map(match => match.pathnameBase);\n}\n/**\n * @private\n */\nfunction resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {\n if (isPathRelative === void 0) {\n isPathRelative = false;\n }\n let to;\n if (typeof toArg === \"string\") {\n to = parsePath(toArg);\n } else {\n to = _extends({}, toArg);\n invariant(!to.pathname || !to.pathname.includes(\"?\"), getInvalidPathError(\"?\", \"pathname\", \"search\", to));\n invariant(!to.pathname || !to.pathname.includes(\"#\"), getInvalidPathError(\"#\", \"pathname\", \"hash\", to));\n invariant(!to.search || !to.search.includes(\"#\"), getInvalidPathError(\"#\", \"search\", \"hash\", to));\n }\n let isEmptyPath = toArg === \"\" || to.pathname === \"\";\n let toPathname = isEmptyPath ? \"/\" : to.pathname;\n let from;\n // Routing is relative to the current pathname if explicitly requested.\n //\n // If a pathname is explicitly provided in `to`, it should be relative to the\n // route context. This is explained in `Note on `` values` in our\n // migration guide from v5 as a means of disambiguation between `to` values\n // that begin with `/` and those that do not. However, this is problematic for\n // `to` values that do not provide a pathname. `to` can simply be a search or\n // hash string, in which case we should assume that the navigation is relative\n // to the current location's pathname and *not* the route pathname.\n if (toPathname == null) {\n from = locationPathname;\n } else {\n let routePathnameIndex = routePathnames.length - 1;\n // With relative=\"route\" (the default), each leading .. segment means\n // \"go up one route\" instead of \"go up one URL segment\". This is a key\n // difference from how works and a major reason we call this a\n // \"to\" value instead of a \"href\".\n if (!isPathRelative && toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\");\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n routePathnameIndex -= 1;\n }\n to.pathname = toSegments.join(\"/\");\n }\n from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n }\n let path = resolvePath(to, from);\n // Ensure the pathname has a trailing slash if the original \"to\" had one\n let hasExplicitTrailingSlash = toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\");\n // Or if this was a link to the current path which has a trailing slash\n let hasCurrentTrailingSlash = (isEmptyPath || toPathname === \".\") && locationPathname.endsWith(\"/\");\n if (!path.pathname.endsWith(\"/\") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {\n path.pathname += \"/\";\n }\n return path;\n}\n/**\n * @private\n */\nfunction getToPathname(to) {\n // Empty strings should be treated the same as / paths\n return to === \"\" || to.pathname === \"\" ? \"/\" : typeof to === \"string\" ? parsePath(to).pathname : to.pathname;\n}\n/**\n * @private\n */\nconst joinPaths = paths => paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\n/**\n * @private\n */\nconst normalizePathname = pathname => pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n/**\n * @private\n */\nconst normalizeSearch = search => !search || search === \"?\" ? \"\" : search.startsWith(\"?\") ? search : \"?\" + search;\n/**\n * @private\n */\nconst normalizeHash = hash => !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\n/**\n * This is a shortcut for creating `application/json` responses. Converts `data`\n * to JSON and sets the `Content-Type` header.\n *\n * @deprecated The `json` method is deprecated in favor of returning raw objects.\n * This method will be removed in v7.\n */\nconst json = function json(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n let headers = new Headers(responseInit.headers);\n if (!headers.has(\"Content-Type\")) {\n headers.set(\"Content-Type\", \"application/json; charset=utf-8\");\n }\n return new Response(JSON.stringify(data), _extends({}, responseInit, {\n headers\n }));\n};\nclass DataWithResponseInit {\n constructor(data, init) {\n this.type = \"DataWithResponseInit\";\n this.data = data;\n this.init = init || null;\n }\n}\n/**\n * Create \"responses\" that contain `status`/`headers` without forcing\n * serialization into an actual `Response` - used by Remix single fetch\n */\nfunction data(data, init) {\n return new DataWithResponseInit(data, typeof init === \"number\" ? {\n status: init\n } : init);\n}\nclass AbortedDeferredError extends Error {}\nclass DeferredData {\n constructor(data, responseInit) {\n this.pendingKeysSet = new Set();\n this.subscribers = new Set();\n this.deferredKeys = [];\n invariant(data && typeof data === \"object\" && !Array.isArray(data), \"defer() only accepts plain objects\");\n // Set up an AbortController + Promise we can race against to exit early\n // cancellation\n let reject;\n this.abortPromise = new Promise((_, r) => reject = r);\n this.controller = new AbortController();\n let onAbort = () => reject(new AbortedDeferredError(\"Deferred data aborted\"));\n this.unlistenAbortSignal = () => this.controller.signal.removeEventListener(\"abort\", onAbort);\n this.controller.signal.addEventListener(\"abort\", onAbort);\n this.data = Object.entries(data).reduce((acc, _ref2) => {\n let [key, value] = _ref2;\n return Object.assign(acc, {\n [key]: this.trackPromise(key, value)\n });\n }, {});\n if (this.done) {\n // All incoming values were resolved\n this.unlistenAbortSignal();\n }\n this.init = responseInit;\n }\n trackPromise(key, value) {\n if (!(value instanceof Promise)) {\n return value;\n }\n this.deferredKeys.push(key);\n this.pendingKeysSet.add(key);\n // We store a little wrapper promise that will be extended with\n // _data/_error props upon resolve/reject\n let promise = Promise.race([value, this.abortPromise]).then(data => this.onSettle(promise, key, undefined, data), error => this.onSettle(promise, key, error));\n // Register rejection listeners to avoid uncaught promise rejections on\n // errors or aborted deferred values\n promise.catch(() => {});\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n return promise;\n }\n onSettle(promise, key, error, data) {\n if (this.controller.signal.aborted && error instanceof AbortedDeferredError) {\n this.unlistenAbortSignal();\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n return Promise.reject(error);\n }\n this.pendingKeysSet.delete(key);\n if (this.done) {\n // Nothing left to abort!\n this.unlistenAbortSignal();\n }\n // If the promise was resolved/rejected with undefined, we'll throw an error as you\n // should always resolve with a value or null\n if (error === undefined && data === undefined) {\n let undefinedError = new Error(\"Deferred data for key \\\"\" + key + \"\\\" resolved/rejected with `undefined`, \" + \"you must resolve/reject with a value or `null`.\");\n Object.defineProperty(promise, \"_error\", {\n get: () => undefinedError\n });\n this.emit(false, key);\n return Promise.reject(undefinedError);\n }\n if (data === undefined) {\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n this.emit(false, key);\n return Promise.reject(error);\n }\n Object.defineProperty(promise, \"_data\", {\n get: () => data\n });\n this.emit(false, key);\n return data;\n }\n emit(aborted, settledKey) {\n this.subscribers.forEach(subscriber => subscriber(aborted, settledKey));\n }\n subscribe(fn) {\n this.subscribers.add(fn);\n return () => this.subscribers.delete(fn);\n }\n cancel() {\n this.controller.abort();\n this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k));\n this.emit(true);\n }\n async resolveData(signal) {\n let aborted = false;\n if (!this.done) {\n let onAbort = () => this.cancel();\n signal.addEventListener(\"abort\", onAbort);\n aborted = await new Promise(resolve => {\n this.subscribe(aborted => {\n signal.removeEventListener(\"abort\", onAbort);\n if (aborted || this.done) {\n resolve(aborted);\n }\n });\n });\n }\n return aborted;\n }\n get done() {\n return this.pendingKeysSet.size === 0;\n }\n get unwrappedData() {\n invariant(this.data !== null && this.done, \"Can only unwrap data on initialized and settled deferreds\");\n return Object.entries(this.data).reduce((acc, _ref3) => {\n let [key, value] = _ref3;\n return Object.assign(acc, {\n [key]: unwrapTrackedPromise(value)\n });\n }, {});\n }\n get pendingKeys() {\n return Array.from(this.pendingKeysSet);\n }\n}\nfunction isTrackedPromise(value) {\n return value instanceof Promise && value._tracked === true;\n}\nfunction unwrapTrackedPromise(value) {\n if (!isTrackedPromise(value)) {\n return value;\n }\n if (value._error) {\n throw value._error;\n }\n return value._data;\n}\n/**\n * @deprecated The `defer` method is deprecated in favor of returning raw\n * objects. This method will be removed in v7.\n */\nconst defer = function defer(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n return new DeferredData(data, responseInit);\n};\n/**\n * A redirect response. Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirect = function redirect(url, init) {\n if (init === void 0) {\n init = 302;\n }\n let responseInit = init;\n if (typeof responseInit === \"number\") {\n responseInit = {\n status: responseInit\n };\n } else if (typeof responseInit.status === \"undefined\") {\n responseInit.status = 302;\n }\n let headers = new Headers(responseInit.headers);\n headers.set(\"Location\", url);\n return new Response(null, _extends({}, responseInit, {\n headers\n }));\n};\n/**\n * A redirect response that will force a document reload to the new location.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirectDocument = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Reload-Document\", \"true\");\n return response;\n};\n/**\n * A redirect response that will perform a `history.replaceState` instead of a\n * `history.pushState` for client-side navigation redirects.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst replace = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Replace\", \"true\");\n return response;\n};\n/**\n * @private\n * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies\n *\n * We don't export the class for public use since it's an implementation\n * detail, but we export the interface above so folks can build their own\n * abstractions around instances via isRouteErrorResponse()\n */\nclass ErrorResponseImpl {\n constructor(status, statusText, data, internal) {\n if (internal === void 0) {\n internal = false;\n }\n this.status = status;\n this.statusText = statusText || \"\";\n this.internal = internal;\n if (data instanceof Error) {\n this.data = data.toString();\n this.error = data;\n } else {\n this.data = data;\n }\n }\n}\n/**\n * Check if the given error is an ErrorResponse generated from a 4xx/5xx\n * Response thrown from an action/loader\n */\nfunction isRouteErrorResponse(error) {\n return error != null && typeof error.status === \"number\" && typeof error.statusText === \"string\" && typeof error.internal === \"boolean\" && \"data\" in error;\n}\n\nconst validMutationMethodsArr = [\"post\", \"put\", \"patch\", \"delete\"];\nconst validMutationMethods = new Set(validMutationMethodsArr);\nconst validRequestMethodsArr = [\"get\", ...validMutationMethodsArr];\nconst validRequestMethods = new Set(validRequestMethodsArr);\nconst redirectStatusCodes = new Set([301, 302, 303, 307, 308]);\nconst redirectPreserveMethodStatusCodes = new Set([307, 308]);\nconst IDLE_NAVIGATION = {\n state: \"idle\",\n location: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_FETCHER = {\n state: \"idle\",\n data: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n};\nconst IDLE_BLOCKER = {\n state: \"unblocked\",\n proceed: undefined,\n reset: undefined,\n location: undefined\n};\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\nconst defaultMapRouteProperties = route => ({\n hasErrorBoundary: Boolean(route.hasErrorBoundary)\n});\nconst TRANSITIONS_STORAGE_KEY = \"remix-router-transitions\";\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createRouter\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Create a router and listen to history POP navigations\n */\nfunction createRouter(init) {\n const routerWindow = init.window ? init.window : typeof window !== \"undefined\" ? window : undefined;\n const isBrowser = typeof routerWindow !== \"undefined\" && typeof routerWindow.document !== \"undefined\" && typeof routerWindow.document.createElement !== \"undefined\";\n const isServer = !isBrowser;\n invariant(init.routes.length > 0, \"You must provide a non-empty routes array to createRouter\");\n let mapRouteProperties;\n if (init.mapRouteProperties) {\n mapRouteProperties = init.mapRouteProperties;\n } else if (init.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = init.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Routes keyed by ID\n let manifest = {};\n // Routes in tree format for matching\n let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties, undefined, manifest);\n let inFlightDataRoutes;\n let basename = init.basename || \"/\";\n let dataStrategyImpl = init.dataStrategy || defaultDataStrategy;\n let patchRoutesOnNavigationImpl = init.patchRoutesOnNavigation;\n // Config driven behavior flags\n let future = _extends({\n v7_fetcherPersist: false,\n v7_normalizeFormMethod: false,\n v7_partialHydration: false,\n v7_prependBasename: false,\n v7_relativeSplatPath: false,\n v7_skipActionErrorRevalidation: false\n }, init.future);\n // Cleanup function for history\n let unlistenHistory = null;\n // Externally-provided functions to call on all state changes\n let subscribers = new Set();\n // Externally-provided object to hold scroll restoration locations during routing\n let savedScrollPositions = null;\n // Externally-provided function to get scroll restoration keys\n let getScrollRestorationKey = null;\n // Externally-provided function to get current scroll position\n let getScrollPosition = null;\n // One-time flag to control the initial hydration scroll restoration. Because\n // we don't get the saved positions from until _after_\n // the initial render, we need to manually trigger a separate updateState to\n // send along the restoreScrollPosition\n // Set to true if we have `hydrationData` since we assume we were SSR'd and that\n // SSR did the initial scroll restoration.\n let initialScrollRestored = init.hydrationData != null;\n let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);\n let initialMatchesIsFOW = false;\n let initialErrors = null;\n if (initialMatches == null && !patchRoutesOnNavigationImpl) {\n // If we do not match a user-provided-route, fall back to the root\n // to allow the error boundary to take over\n let error = getInternalRouterError(404, {\n pathname: init.history.location.pathname\n });\n let {\n matches,\n route\n } = getShortCircuitMatches(dataRoutes);\n initialMatches = matches;\n initialErrors = {\n [route.id]: error\n };\n }\n // In SPA apps, if the user provided a patchRoutesOnNavigation implementation and\n // our initial match is a splat route, clear them out so we run through lazy\n // discovery on hydration in case there's a more accurate lazy route match.\n // In SSR apps (with `hydrationData`), we expect that the server will send\n // up the proper matched routes so we don't want to run lazy discovery on\n // initial hydration and want to hydrate into the splat route.\n if (initialMatches && !init.hydrationData) {\n let fogOfWar = checkFogOfWar(initialMatches, dataRoutes, init.history.location.pathname);\n if (fogOfWar.active) {\n initialMatches = null;\n }\n }\n let initialized;\n if (!initialMatches) {\n initialized = false;\n initialMatches = [];\n // If partial hydration and fog of war is enabled, we will be running\n // `patchRoutesOnNavigation` during hydration so include any partial matches as\n // the initial matches so we can properly render `HydrateFallback`'s\n if (future.v7_partialHydration) {\n let fogOfWar = checkFogOfWar(null, dataRoutes, init.history.location.pathname);\n if (fogOfWar.active && fogOfWar.matches) {\n initialMatchesIsFOW = true;\n initialMatches = fogOfWar.matches;\n }\n }\n } else if (initialMatches.some(m => m.route.lazy)) {\n // All initialMatches need to be loaded before we're ready. If we have lazy\n // functions around still then we'll need to run them in initialize()\n initialized = false;\n } else if (!initialMatches.some(m => m.route.loader)) {\n // If we've got no loaders to run, then we're good to go\n initialized = true;\n } else if (future.v7_partialHydration) {\n // If partial hydration is enabled, we're initialized so long as we were\n // provided with hydrationData for every route with a loader, and no loaders\n // were marked for explicit hydration\n let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;\n let errors = init.hydrationData ? init.hydrationData.errors : null;\n // If errors exist, don't consider routes below the boundary\n if (errors) {\n let idx = initialMatches.findIndex(m => errors[m.route.id] !== undefined);\n initialized = initialMatches.slice(0, idx + 1).every(m => !shouldLoadRouteOnHydration(m.route, loaderData, errors));\n } else {\n initialized = initialMatches.every(m => !shouldLoadRouteOnHydration(m.route, loaderData, errors));\n }\n } else {\n // Without partial hydration - we're initialized if we were provided any\n // hydrationData - which is expected to be complete\n initialized = init.hydrationData != null;\n }\n let router;\n let state = {\n historyAction: init.history.action,\n location: init.history.location,\n matches: initialMatches,\n initialized,\n navigation: IDLE_NAVIGATION,\n // Don't restore on initial updateState() if we were SSR'd\n restoreScrollPosition: init.hydrationData != null ? false : null,\n preventScrollReset: false,\n revalidation: \"idle\",\n loaderData: init.hydrationData && init.hydrationData.loaderData || {},\n actionData: init.hydrationData && init.hydrationData.actionData || null,\n errors: init.hydrationData && init.hydrationData.errors || initialErrors,\n fetchers: new Map(),\n blockers: new Map()\n };\n // -- Stateful internal variables to manage navigations --\n // Current navigation in progress (to be committed in completeNavigation)\n let pendingAction = Action.Pop;\n // Should the current navigation prevent the scroll reset if scroll cannot\n // be restored?\n let pendingPreventScrollReset = false;\n // AbortController for the active navigation\n let pendingNavigationController;\n // Should the current navigation enable document.startViewTransition?\n let pendingViewTransitionEnabled = false;\n // Store applied view transitions so we can apply them on POP\n let appliedViewTransitions = new Map();\n // Cleanup function for persisting applied transitions to sessionStorage\n let removePageHideEventListener = null;\n // We use this to avoid touching history in completeNavigation if a\n // revalidation is entirely uninterrupted\n let isUninterruptedRevalidation = false;\n // Use this internal flag to force revalidation of all loaders:\n // - submissions (completed or interrupted)\n // - useRevalidator()\n // - X-Remix-Revalidate (from redirect)\n let isRevalidationRequired = false;\n // Use this internal array to capture routes that require revalidation due\n // to a cancelled deferred on action submission\n let cancelledDeferredRoutes = [];\n // Use this internal array to capture fetcher loads that were cancelled by an\n // action navigation and require revalidation\n let cancelledFetcherLoads = new Set();\n // AbortControllers for any in-flight fetchers\n let fetchControllers = new Map();\n // Track loads based on the order in which they started\n let incrementingLoadId = 0;\n // Track the outstanding pending navigation data load to be compared against\n // the globally incrementing load when a fetcher load lands after a completed\n // navigation\n let pendingNavigationLoadId = -1;\n // Fetchers that triggered data reloads as a result of their actions\n let fetchReloadIds = new Map();\n // Fetchers that triggered redirect navigations\n let fetchRedirectIds = new Set();\n // Most recent href/match for fetcher.load calls for fetchers\n let fetchLoadMatches = new Map();\n // Ref-count mounted fetchers so we know when it's ok to clean them up\n let activeFetchers = new Map();\n // Fetchers that have requested a delete when using v7_fetcherPersist,\n // they'll be officially removed after they return to idle\n let deletedFetchers = new Set();\n // Store DeferredData instances for active route matches. When a\n // route loader returns defer() we stick one in here. Then, when a nested\n // promise resolves we update loaderData. If a new navigation starts we\n // cancel active deferreds for eliminated routes.\n let activeDeferreds = new Map();\n // Store blocker functions in a separate Map outside of router state since\n // we don't need to update UI state if they change\n let blockerFunctions = new Map();\n // Flag to ignore the next history update, so we can revert the URL change on\n // a POP navigation that was blocked by the user without touching router state\n let unblockBlockerHistoryUpdate = undefined;\n // Initialize the router, all side effects should be kicked off from here.\n // Implemented as a Fluent API for ease of:\n // let router = createRouter(init).initialize();\n function initialize() {\n // If history informs us of a POP navigation, start the navigation but do not update\n // state. We'll update our own state once the navigation completes\n unlistenHistory = init.history.listen(_ref => {\n let {\n action: historyAction,\n location,\n delta\n } = _ref;\n // Ignore this event if it was just us resetting the URL from a\n // blocked POP navigation\n if (unblockBlockerHistoryUpdate) {\n unblockBlockerHistoryUpdate();\n unblockBlockerHistoryUpdate = undefined;\n return;\n }\n warning(blockerFunctions.size === 0 || delta != null, \"You are trying to use a blocker on a POP navigation to a location \" + \"that was not created by @remix-run/router. This will fail silently in \" + \"production. This can happen if you are navigating outside the router \" + \"via `window.history.pushState`/`window.location.hash` instead of using \" + \"router navigation APIs. This can also happen if you are using \" + \"createHashRouter and the user manually changes the URL.\");\n let blockerKey = shouldBlockNavigation({\n currentLocation: state.location,\n nextLocation: location,\n historyAction\n });\n if (blockerKey && delta != null) {\n // Restore the URL to match the current UI, but don't update router state\n let nextHistoryUpdatePromise = new Promise(resolve => {\n unblockBlockerHistoryUpdate = resolve;\n });\n init.history.go(delta * -1);\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location\n });\n // Re-do the same POP navigation we just blocked, after the url\n // restoration is also complete. See:\n // https://github.com/remix-run/react-router/issues/11613\n nextHistoryUpdatePromise.then(() => init.history.go(delta));\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return startNavigation(historyAction, location);\n });\n if (isBrowser) {\n // FIXME: This feels gross. How can we cleanup the lines between\n // scrollRestoration/appliedTransitions persistance?\n restoreAppliedTransitions(routerWindow, appliedViewTransitions);\n let _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions);\n routerWindow.addEventListener(\"pagehide\", _saveAppliedTransitions);\n removePageHideEventListener = () => routerWindow.removeEventListener(\"pagehide\", _saveAppliedTransitions);\n }\n // Kick off initial data load if needed. Use Pop to avoid modifying history\n // Note we don't do any handling of lazy here. For SPA's it'll get handled\n // in the normal navigation flow. For SSR it's expected that lazy modules are\n // resolved prior to router creation since we can't go into a fallbackElement\n // UI for SSR'd apps\n if (!state.initialized) {\n startNavigation(Action.Pop, state.location, {\n initialHydration: true\n });\n }\n return router;\n }\n // Clean up a router and it's side effects\n function dispose() {\n if (unlistenHistory) {\n unlistenHistory();\n }\n if (removePageHideEventListener) {\n removePageHideEventListener();\n }\n subscribers.clear();\n pendingNavigationController && pendingNavigationController.abort();\n state.fetchers.forEach((_, key) => deleteFetcher(key));\n state.blockers.forEach((_, key) => deleteBlocker(key));\n }\n // Subscribe to state updates for the router\n function subscribe(fn) {\n subscribers.add(fn);\n return () => subscribers.delete(fn);\n }\n // Update our state and notify the calling context of the change\n function updateState(newState, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state = _extends({}, state, newState);\n // Prep fetcher cleanup so we can tell the UI which fetcher data entries\n // can be removed\n let completedFetchers = [];\n let deletedFetchersKeys = [];\n if (future.v7_fetcherPersist) {\n state.fetchers.forEach((fetcher, key) => {\n if (fetcher.state === \"idle\") {\n if (deletedFetchers.has(key)) {\n // Unmounted from the UI and can be totally removed\n deletedFetchersKeys.push(key);\n } else {\n // Returned to idle but still mounted in the UI, so semi-remains for\n // revalidations and such\n completedFetchers.push(key);\n }\n }\n });\n }\n // Remove any lingering deleted fetchers that have already been removed\n // from state.fetchers\n deletedFetchers.forEach(key => {\n if (!state.fetchers.has(key) && !fetchControllers.has(key)) {\n deletedFetchersKeys.push(key);\n }\n });\n // Iterate over a local copy so that if flushSync is used and we end up\n // removing and adding a new subscriber due to the useCallback dependencies,\n // we don't get ourselves into a loop calling the new subscriber immediately\n [...subscribers].forEach(subscriber => subscriber(state, {\n deletedFetchers: deletedFetchersKeys,\n viewTransitionOpts: opts.viewTransitionOpts,\n flushSync: opts.flushSync === true\n }));\n // Remove idle fetchers from state since we only care about in-flight fetchers.\n if (future.v7_fetcherPersist) {\n completedFetchers.forEach(key => state.fetchers.delete(key));\n deletedFetchersKeys.forEach(key => deleteFetcher(key));\n } else {\n // We already called deleteFetcher() on these, can remove them from this\n // Set now that we've handed the keys off to the data layer\n deletedFetchersKeys.forEach(key => deletedFetchers.delete(key));\n }\n }\n // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION\n // and setting state.[historyAction/location/matches] to the new route.\n // - Location is a required param\n // - Navigation will always be set to IDLE_NAVIGATION\n // - Can pass any other state in newState\n function completeNavigation(location, newState, _temp) {\n var _location$state, _location$state2;\n let {\n flushSync\n } = _temp === void 0 ? {} : _temp;\n // Deduce if we're in a loading/actionReload state:\n // - We have committed actionData in the store\n // - The current navigation was a mutation submission\n // - We're past the submitting state and into the loading state\n // - The location being loaded is not the result of a redirect\n let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === \"loading\" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true;\n let actionData;\n if (newState.actionData) {\n if (Object.keys(newState.actionData).length > 0) {\n actionData = newState.actionData;\n } else {\n // Empty actionData -> clear prior actionData due to an action error\n actionData = null;\n }\n } else if (isActionReload) {\n // Keep the current data if we're wrapping up the action reload\n actionData = state.actionData;\n } else {\n // Clear actionData on any other completed navigations\n actionData = null;\n }\n // Always preserve any existing loaderData from re-used routes\n let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;\n // On a successful navigation we can assume we got through all blockers\n // so we can start fresh\n let blockers = state.blockers;\n if (blockers.size > 0) {\n blockers = new Map(blockers);\n blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));\n }\n // Always respect the user flag. Otherwise don't reset on mutation\n // submission navigations unless they redirect\n let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true;\n // Commit any in-flight routes at the end of the HMR revalidation \"navigation\"\n if (inFlightDataRoutes) {\n dataRoutes = inFlightDataRoutes;\n inFlightDataRoutes = undefined;\n }\n if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) {\n init.history.push(location, location.state);\n } else if (pendingAction === Action.Replace) {\n init.history.replace(location, location.state);\n }\n let viewTransitionOpts;\n // On POP, enable transitions if they were enabled on the original navigation\n if (pendingAction === Action.Pop) {\n // Forward takes precedence so they behave like the original navigation\n let priorPaths = appliedViewTransitions.get(state.location.pathname);\n if (priorPaths && priorPaths.has(location.pathname)) {\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n } else if (appliedViewTransitions.has(location.pathname)) {\n // If we don't have a previous forward nav, assume we're popping back to\n // the new location and enable if that location previously enabled\n viewTransitionOpts = {\n currentLocation: location,\n nextLocation: state.location\n };\n }\n } else if (pendingViewTransitionEnabled) {\n // Store the applied transition on PUSH/REPLACE\n let toPaths = appliedViewTransitions.get(state.location.pathname);\n if (toPaths) {\n toPaths.add(location.pathname);\n } else {\n toPaths = new Set([location.pathname]);\n appliedViewTransitions.set(state.location.pathname, toPaths);\n }\n viewTransitionOpts = {\n currentLocation: state.location,\n nextLocation: location\n };\n }\n updateState(_extends({}, newState, {\n actionData,\n loaderData,\n historyAction: pendingAction,\n location,\n initialized: true,\n navigation: IDLE_NAVIGATION,\n revalidation: \"idle\",\n restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches),\n preventScrollReset,\n blockers\n }), {\n viewTransitionOpts,\n flushSync: flushSync === true\n });\n // Reset stateful navigation vars\n pendingAction = Action.Pop;\n pendingPreventScrollReset = false;\n pendingViewTransitionEnabled = false;\n isUninterruptedRevalidation = false;\n isRevalidationRequired = false;\n cancelledDeferredRoutes = [];\n }\n // Trigger a navigation event, which can either be a numerical POP or a PUSH\n // replace with an optional submission\n async function navigate(to, opts) {\n if (typeof to === \"number\") {\n init.history.go(to);\n return;\n }\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, future.v7_relativeSplatPath, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative);\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts);\n let currentLocation = state.location;\n let nextLocation = createLocation(state.location, path, opts && opts.state);\n // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded\n // URL from window.location, so we need to encode it here so the behavior\n // remains the same as POP and non-data-router usages. new URL() does all\n // the same encoding we'd get from a history.pushState/window.location read\n // without having to touch history\n nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation));\n let userReplace = opts && opts.replace != null ? opts.replace : undefined;\n let historyAction = Action.Push;\n if (userReplace === true) {\n historyAction = Action.Replace;\n } else if (userReplace === false) ; else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) {\n // By default on submissions to the current location we REPLACE so that\n // users don't have to double-click the back button to get to the prior\n // location. If the user redirects to a different location from the\n // action/loader this will be ignored and the redirect will be a PUSH\n historyAction = Action.Replace;\n }\n let preventScrollReset = opts && \"preventScrollReset\" in opts ? opts.preventScrollReset === true : undefined;\n let flushSync = (opts && opts.flushSync) === true;\n let blockerKey = shouldBlockNavigation({\n currentLocation,\n nextLocation,\n historyAction\n });\n if (blockerKey) {\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location: nextLocation,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location: nextLocation\n });\n // Send the same navigation through\n navigate(to, opts);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey, IDLE_BLOCKER);\n updateState({\n blockers\n });\n }\n });\n return;\n }\n return await startNavigation(historyAction, nextLocation, {\n submission,\n // Send through the formData serialization error if we have one so we can\n // render at the right error boundary after we match routes\n pendingError: error,\n preventScrollReset,\n replace: opts && opts.replace,\n enableViewTransition: opts && opts.viewTransition,\n flushSync\n });\n }\n // Revalidate all current loaders. If a navigation is in progress or if this\n // is interrupted by a navigation, allow this to \"succeed\" by calling all\n // loaders during the next loader round\n function revalidate() {\n interruptActiveLoads();\n updateState({\n revalidation: \"loading\"\n });\n // If we're currently submitting an action, we don't need to start a new\n // navigation, we'll just let the follow up loader execution call all loaders\n if (state.navigation.state === \"submitting\") {\n return;\n }\n // If we're currently in an idle state, start a new navigation for the current\n // action/location and mark it as uninterrupted, which will skip the history\n // update in completeNavigation\n if (state.navigation.state === \"idle\") {\n startNavigation(state.historyAction, state.location, {\n startUninterruptedRevalidation: true\n });\n return;\n }\n // Otherwise, if we're currently in a loading state, just start a new\n // navigation to the navigation.location but do not trigger an uninterrupted\n // revalidation so that history correctly updates once the navigation completes\n startNavigation(pendingAction || state.historyAction, state.navigation.location, {\n overrideNavigation: state.navigation,\n // Proxy through any rending view transition\n enableViewTransition: pendingViewTransitionEnabled === true\n });\n }\n // Start a navigation to the given action/location. Can optionally provide a\n // overrideNavigation which will override the normalLoad in the case of a redirect\n // navigation\n async function startNavigation(historyAction, location, opts) {\n // Abort any in-progress navigations and start a new one. Unset any ongoing\n // uninterrupted revalidations unless told otherwise, since we want this\n // new navigation to update history normally\n pendingNavigationController && pendingNavigationController.abort();\n pendingNavigationController = null;\n pendingAction = historyAction;\n isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;\n // Save the current scroll position every time we start a new navigation,\n // and track whether we should reset scroll on completion\n saveScrollPosition(state.location, state.matches);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let loadingNavigation = opts && opts.overrideNavigation;\n let matches = opts != null && opts.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ?\n // `matchRoutes()` has already been called if we're in here via `router.initialize()`\n state.matches : matchRoutes(routesToUse, location, basename);\n let flushSync = (opts && opts.flushSync) === true;\n // Short circuit if it's only a hash change and not a revalidation or\n // mutation submission.\n //\n // Ignore on initial page loads because since the initial hydration will always\n // be \"same hash\". For example, on /page#hash and submit a
\n // which will default to a navigation to /page\n if (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {\n completeNavigation(location, {\n matches\n }, {\n flushSync\n });\n return;\n }\n let fogOfWar = checkFogOfWar(matches, routesToUse, location.pathname);\n if (fogOfWar.active && fogOfWar.matches) {\n matches = fogOfWar.matches;\n }\n // Short circuit with a 404 on the root error boundary if we match nothing\n if (!matches) {\n let {\n error,\n notFoundMatches,\n route\n } = handleNavigational404(location.pathname);\n completeNavigation(location, {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n }, {\n flushSync\n });\n return;\n }\n // Create a controller/Request for this navigation\n pendingNavigationController = new AbortController();\n let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);\n let pendingActionResult;\n if (opts && opts.pendingError) {\n // If we have a pendingError, it means the user attempted a GET submission\n // with binary FormData so assign here and skip to handleLoaders. That\n // way we handle calling loaders above the boundary etc. It's not really\n // different from an actionError in that sense.\n pendingActionResult = [findNearestBoundary(matches).route.id, {\n type: ResultType.error,\n error: opts.pendingError\n }];\n } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {\n // Call action if we received an action submission\n let actionResult = await handleAction(request, location, opts.submission, matches, fogOfWar.active, {\n replace: opts.replace,\n flushSync\n });\n if (actionResult.shortCircuited) {\n return;\n }\n // If we received a 404 from handleAction, it's because we couldn't lazily\n // discover the destination route so we don't want to call loaders\n if (actionResult.pendingActionResult) {\n let [routeId, result] = actionResult.pendingActionResult;\n if (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) {\n pendingNavigationController = null;\n completeNavigation(location, {\n matches: actionResult.matches,\n loaderData: {},\n errors: {\n [routeId]: result.error\n }\n });\n return;\n }\n }\n matches = actionResult.matches || matches;\n pendingActionResult = actionResult.pendingActionResult;\n loadingNavigation = getLoadingNavigation(location, opts.submission);\n flushSync = false;\n // No need to do fog of war matching again on loader execution\n fogOfWar.active = false;\n // Create a GET request for the loaders\n request = createClientSideRequest(init.history, request.url, request.signal);\n }\n // Call loaders\n let {\n shortCircuited,\n matches: updatedMatches,\n loaderData,\n errors\n } = await handleLoaders(request, location, matches, fogOfWar.active, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionResult);\n if (shortCircuited) {\n return;\n }\n // Clean up now that the action/loaders have completed. Don't clean up if\n // we short circuited because pendingNavigationController will have already\n // been assigned to a new controller for the next navigation\n pendingNavigationController = null;\n completeNavigation(location, _extends({\n matches: updatedMatches || matches\n }, getActionDataForCommit(pendingActionResult), {\n loaderData,\n errors\n }));\n }\n // Call the action matched by the leaf route for this navigation and handle\n // redirects/errors\n async function handleAction(request, location, submission, matches, isFogOfWar, opts) {\n if (opts === void 0) {\n opts = {};\n }\n interruptActiveLoads();\n // Put us in a submitting state\n let navigation = getSubmittingNavigation(location, submission);\n updateState({\n navigation\n }, {\n flushSync: opts.flushSync === true\n });\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n if (discoverResult.type === \"aborted\") {\n return {\n shortCircuited: true\n };\n } else if (discoverResult.type === \"error\") {\n let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;\n return {\n matches: discoverResult.partialMatches,\n pendingActionResult: [boundaryId, {\n type: ResultType.error,\n error: discoverResult.error\n }]\n };\n } else if (!discoverResult.matches) {\n let {\n notFoundMatches,\n error,\n route\n } = handleNavigational404(location.pathname);\n return {\n matches: notFoundMatches,\n pendingActionResult: [route.id, {\n type: ResultType.error,\n error\n }]\n };\n } else {\n matches = discoverResult.matches;\n }\n }\n // Call our action and get the result\n let result;\n let actionMatch = getTargetMatch(matches, location);\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n result = {\n type: ResultType.error,\n error: getInternalRouterError(405, {\n method: request.method,\n pathname: location.pathname,\n routeId: actionMatch.route.id\n })\n };\n } else {\n let results = await callDataStrategy(\"action\", state, request, [actionMatch], matches, null);\n result = results[actionMatch.route.id];\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n }\n if (isRedirectResult(result)) {\n let replace;\n if (opts && opts.replace != null) {\n replace = opts.replace;\n } else {\n // If the user didn't explicity indicate replace behavior, replace if\n // we redirected to the exact same location we're currently at to avoid\n // double back-buttons\n let location = normalizeRedirectLocation(result.response.headers.get(\"Location\"), new URL(request.url), basename);\n replace = location === state.location.pathname + state.location.search;\n }\n await startRedirectNavigation(request, result, true, {\n submission,\n replace\n });\n return {\n shortCircuited: true\n };\n }\n if (isDeferredResult(result)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n // By default, all submissions to the current location are REPLACE\n // navigations, but if the action threw an error that'll be rendered in\n // an errorElement, we fall back to PUSH so that the user can use the\n // back button to get back to the pre-submission form location to try\n // again\n if ((opts && opts.replace) !== true) {\n pendingAction = Action.Push;\n }\n return {\n matches,\n pendingActionResult: [boundaryMatch.route.id, result]\n };\n }\n return {\n matches,\n pendingActionResult: [actionMatch.route.id, result]\n };\n }\n // Call all applicable loaders for the given matches, handling redirects,\n // errors, etc.\n async function handleLoaders(request, location, matches, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace, initialHydration, flushSync, pendingActionResult) {\n // Figure out the right navigation we want to use for data loading\n let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);\n // If this was a redirect from an action we don't have a \"submission\" but\n // we have it on the loading navigation so use that if available\n let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);\n // If this is an uninterrupted revalidation, we remain in our current idle\n // state. If not, we need to switch to our loading state and load data,\n // preserving any new action data or existing action data (in the case of\n // a revalidation interrupting an actionReload)\n // If we have partialHydration enabled, then don't update the state for the\n // initial data load since it's not a \"navigation\"\n let shouldUpdateNavigationState = !isUninterruptedRevalidation && (!future.v7_partialHydration || !initialHydration);\n // When fog of war is enabled, we enter our `loading` state earlier so we\n // can discover new routes during the `loading` state. We skip this if\n // we've already run actions since we would have done our matching already.\n // If the children() function threw then, we want to proceed with the\n // partial matches it discovered.\n if (isFogOfWar) {\n if (shouldUpdateNavigationState) {\n let actionData = getUpdatedActionData(pendingActionResult);\n updateState(_extends({\n navigation: loadingNavigation\n }, actionData !== undefined ? {\n actionData\n } : {}), {\n flushSync\n });\n }\n let discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n if (discoverResult.type === \"aborted\") {\n return {\n shortCircuited: true\n };\n } else if (discoverResult.type === \"error\") {\n let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;\n return {\n matches: discoverResult.partialMatches,\n loaderData: {},\n errors: {\n [boundaryId]: discoverResult.error\n }\n };\n } else if (!discoverResult.matches) {\n let {\n error,\n notFoundMatches,\n route\n } = handleNavigational404(location.pathname);\n return {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n };\n } else {\n matches = discoverResult.matches;\n }\n }\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, future.v7_partialHydration && initialHydration === true, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult);\n // Cancel pending deferreds for no-longer-matched routes or routes we're\n // about to reload. Note that if this is an action reload we would have\n // already cancelled all pending deferreds so this would be a no-op\n cancelActiveDeferreds(routeId => !(matches && matches.some(m => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some(m => m.route.id === routeId));\n pendingNavigationLoadId = ++incrementingLoadId;\n // Short circuit if we have no loaders to run\n if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) {\n let updatedFetchers = markFetchRedirectsDone();\n completeNavigation(location, _extends({\n matches,\n loaderData: {},\n // Commit pending error if we're short circuiting\n errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {\n [pendingActionResult[0]]: pendingActionResult[1].error\n } : null\n }, getActionDataForCommit(pendingActionResult), updatedFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {}), {\n flushSync\n });\n return {\n shortCircuited: true\n };\n }\n if (shouldUpdateNavigationState) {\n let updates = {};\n if (!isFogOfWar) {\n // Only update navigation/actionNData if we didn't already do it above\n updates.navigation = loadingNavigation;\n let actionData = getUpdatedActionData(pendingActionResult);\n if (actionData !== undefined) {\n updates.actionData = actionData;\n }\n }\n if (revalidatingFetchers.length > 0) {\n updates.fetchers = getUpdatedRevalidatingFetchers(revalidatingFetchers);\n }\n updateState(updates, {\n flushSync\n });\n }\n revalidatingFetchers.forEach(rf => {\n abortFetcher(rf.key);\n if (rf.controller) {\n // Fetchers use an independent AbortController so that aborting a fetcher\n // (via deleteFetcher) does not abort the triggering navigation that\n // triggered the revalidation\n fetchControllers.set(rf.key, rf.controller);\n }\n });\n // Proxy navigation abort through to revalidation fetchers\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(f => abortFetcher(f.key));\n if (pendingNavigationController) {\n pendingNavigationController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n let {\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, request);\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n // Clean up _after_ loaders have completed. Don't clean up if we short\n // circuited because fetchControllers would have been aborted and\n // reassigned to new controllers for the next navigation\n if (pendingNavigationController) {\n pendingNavigationController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n revalidatingFetchers.forEach(rf => fetchControllers.delete(rf.key));\n // If any loaders returned a redirect Response, start a new REPLACE navigation\n let redirect = findRedirect(loaderResults);\n if (redirect) {\n await startRedirectNavigation(request, redirect.result, true, {\n replace\n });\n return {\n shortCircuited: true\n };\n }\n redirect = findRedirect(fetcherResults);\n if (redirect) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n fetchRedirectIds.add(redirect.key);\n await startRedirectNavigation(request, redirect.result, true, {\n replace\n });\n return {\n shortCircuited: true\n };\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, loaderResults, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Wire up subscribers to update loaderData as promises settle\n activeDeferreds.forEach((deferredData, routeId) => {\n deferredData.subscribe(aborted => {\n // Note: No need to updateState here since the TrackedPromise on\n // loaderData is stable across resolve/reject\n // Remove this instance if we were aborted or if promises have settled\n if (aborted || deferredData.done) {\n activeDeferreds.delete(routeId);\n }\n });\n });\n // Preserve SSR errors during partial hydration\n if (future.v7_partialHydration && initialHydration && state.errors) {\n errors = _extends({}, state.errors, errors);\n }\n let updatedFetchers = markFetchRedirectsDone();\n let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);\n let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;\n return _extends({\n matches,\n loaderData,\n errors\n }, shouldUpdateFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {});\n }\n function getUpdatedActionData(pendingActionResult) {\n if (pendingActionResult && !isErrorResult(pendingActionResult[1])) {\n // This is cast to `any` currently because `RouteData`uses any and it\n // would be a breaking change to use any.\n // TODO: v7 - change `RouteData` to use `unknown` instead of `any`\n return {\n [pendingActionResult[0]]: pendingActionResult[1].data\n };\n } else if (state.actionData) {\n if (Object.keys(state.actionData).length === 0) {\n return null;\n } else {\n return state.actionData;\n }\n }\n }\n function getUpdatedRevalidatingFetchers(revalidatingFetchers) {\n revalidatingFetchers.forEach(rf => {\n let fetcher = state.fetchers.get(rf.key);\n let revalidatingFetcher = getLoadingFetcher(undefined, fetcher ? fetcher.data : undefined);\n state.fetchers.set(rf.key, revalidatingFetcher);\n });\n return new Map(state.fetchers);\n }\n // Trigger a fetcher load/submit for the given fetcher key\n function fetch(key, routeId, href, opts) {\n if (isServer) {\n throw new Error(\"router.fetch() was called during the server render, but it shouldn't be. \" + \"You are likely calling a useFetcher() method in the body of your component. \" + \"Try moving it to a useEffect or a callback.\");\n }\n abortFetcher(key);\n let flushSync = (opts && opts.flushSync) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, href, future.v7_relativeSplatPath, routeId, opts == null ? void 0 : opts.relative);\n let matches = matchRoutes(routesToUse, normalizedPath, basename);\n let fogOfWar = checkFogOfWar(matches, routesToUse, normalizedPath);\n if (fogOfWar.active && fogOfWar.matches) {\n matches = fogOfWar.matches;\n }\n if (!matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: normalizedPath\n }), {\n flushSync\n });\n return;\n }\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, true, normalizedPath, opts);\n if (error) {\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return;\n }\n let match = getTargetMatch(matches, path);\n let preventScrollReset = (opts && opts.preventScrollReset) === true;\n if (submission && isMutationMethod(submission.formMethod)) {\n handleFetcherAction(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission);\n return;\n }\n // Store off the match so we can call it's shouldRevalidate on subsequent\n // revalidations\n fetchLoadMatches.set(key, {\n routeId,\n path\n });\n handleFetcherLoader(key, routeId, path, match, matches, fogOfWar.active, flushSync, preventScrollReset, submission);\n }\n // Call the action for the matched fetcher.submit(), and then handle redirects,\n // errors, and revalidation\n async function handleFetcherAction(key, routeId, path, match, requestMatches, isFogOfWar, flushSync, preventScrollReset, submission) {\n interruptActiveLoads();\n fetchLoadMatches.delete(key);\n function detectAndHandle405Error(m) {\n if (!m.route.action && !m.route.lazy) {\n let error = getInternalRouterError(405, {\n method: submission.formMethod,\n pathname: path,\n routeId: routeId\n });\n setFetcherError(key, routeId, error, {\n flushSync\n });\n return true;\n }\n return false;\n }\n if (!isFogOfWar && detectAndHandle405Error(match)) {\n return;\n }\n // Put this fetcher into it's submitting state\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getSubmittingFetcher(submission, existingFetcher), {\n flushSync\n });\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);\n if (discoverResult.type === \"aborted\") {\n return;\n } else if (discoverResult.type === \"error\") {\n setFetcherError(key, routeId, discoverResult.error, {\n flushSync\n });\n return;\n } else if (!discoverResult.matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: path\n }), {\n flushSync\n });\n return;\n } else {\n requestMatches = discoverResult.matches;\n match = getTargetMatch(requestMatches, path);\n if (detectAndHandle405Error(match)) {\n return;\n }\n }\n }\n // Call the action for the fetcher\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let actionResults = await callDataStrategy(\"action\", state, fetchRequest, [match], requestMatches, key);\n let actionResult = actionResults[match.route.id];\n if (fetchRequest.signal.aborted) {\n // We can delete this so long as we weren't aborted by our own fetcher\n // re-submit which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n return;\n }\n // When using v7_fetcherPersist, we don't want errors bubbling up to the UI\n // or redirects processed for unmounted fetchers so we just revert them to\n // idle\n if (future.v7_fetcherPersist && deletedFetchers.has(key)) {\n if (isRedirectResult(actionResult) || isErrorResult(actionResult)) {\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n }\n // Let SuccessResult's fall through for revalidation\n } else {\n if (isRedirectResult(actionResult)) {\n fetchControllers.delete(key);\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our action started, so that\n // should take precedence over this redirect navigation. We already\n // set isRevalidationRequired so all loaders for the new route should\n // fire unless opted out via shouldRevalidate\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n } else {\n fetchRedirectIds.add(key);\n updateFetcherState(key, getLoadingFetcher(submission));\n return startRedirectNavigation(fetchRequest, actionResult, false, {\n fetcherSubmission: submission,\n preventScrollReset\n });\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(actionResult)) {\n setFetcherError(key, routeId, actionResult.error);\n return;\n }\n }\n if (isDeferredResult(actionResult)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n // Start the data load for current matches, or the next location if we're\n // in the middle of a navigation\n let nextLocation = state.navigation.location || state.location;\n let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let matches = state.navigation.state !== \"idle\" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches;\n invariant(matches, \"Didn't find any matches after fetcher action\");\n let loadId = ++incrementingLoadId;\n fetchReloadIds.set(key, loadId);\n let loadFetcher = getLoadingFetcher(submission, actionResult.data);\n state.fetchers.set(key, loadFetcher);\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, false, future.v7_skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, [match.route.id, actionResult]);\n // Put all revalidating fetchers into the loading state, except for the\n // current fetcher which we want to keep in it's current loading state which\n // contains it's action submission info + action data\n revalidatingFetchers.filter(rf => rf.key !== key).forEach(rf => {\n let staleKey = rf.key;\n let existingFetcher = state.fetchers.get(staleKey);\n let revalidatingFetcher = getLoadingFetcher(undefined, existingFetcher ? existingFetcher.data : undefined);\n state.fetchers.set(staleKey, revalidatingFetcher);\n abortFetcher(staleKey);\n if (rf.controller) {\n fetchControllers.set(staleKey, rf.controller);\n }\n });\n updateState({\n fetchers: new Map(state.fetchers)\n });\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(rf => abortFetcher(rf.key));\n abortController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n let {\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state, matches, matchesToLoad, revalidatingFetchers, revalidationRequest);\n if (abortController.signal.aborted) {\n return;\n }\n abortController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n fetchReloadIds.delete(key);\n fetchControllers.delete(key);\n revalidatingFetchers.forEach(r => fetchControllers.delete(r.key));\n let redirect = findRedirect(loaderResults);\n if (redirect) {\n return startRedirectNavigation(revalidationRequest, redirect.result, false, {\n preventScrollReset\n });\n }\n redirect = findRedirect(fetcherResults);\n if (redirect) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n fetchRedirectIds.add(redirect.key);\n return startRedirectNavigation(revalidationRequest, redirect.result, false, {\n preventScrollReset\n });\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, loaderResults, undefined, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Since we let revalidations complete even if the submitting fetcher was\n // deleted, only put it back to idle if it hasn't been deleted\n if (state.fetchers.has(key)) {\n let doneFetcher = getDoneFetcher(actionResult.data);\n state.fetchers.set(key, doneFetcher);\n }\n abortStaleFetchLoads(loadId);\n // If we are currently in a navigation loading state and this fetcher is\n // more recent than the navigation, we want the newer data so abort the\n // navigation and complete it with the fetcher data\n if (state.navigation.state === \"loading\" && loadId > pendingNavigationLoadId) {\n invariant(pendingAction, \"Expected pending action\");\n pendingNavigationController && pendingNavigationController.abort();\n completeNavigation(state.navigation.location, {\n matches,\n loaderData,\n errors,\n fetchers: new Map(state.fetchers)\n });\n } else {\n // otherwise just update with the fetcher data, preserving any existing\n // loaderData for loaders that did not need to reload. We have to\n // manually merge here since we aren't going through completeNavigation\n updateState({\n errors,\n loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors),\n fetchers: new Map(state.fetchers)\n });\n isRevalidationRequired = false;\n }\n }\n // Call the matched loader for fetcher.load(), handling redirects, errors, etc.\n async function handleFetcherLoader(key, routeId, path, match, matches, isFogOfWar, flushSync, preventScrollReset, submission) {\n let existingFetcher = state.fetchers.get(key);\n updateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : undefined), {\n flushSync\n });\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);\n if (isFogOfWar) {\n let discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);\n if (discoverResult.type === \"aborted\") {\n return;\n } else if (discoverResult.type === \"error\") {\n setFetcherError(key, routeId, discoverResult.error, {\n flushSync\n });\n return;\n } else if (!discoverResult.matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: path\n }), {\n flushSync\n });\n return;\n } else {\n matches = discoverResult.matches;\n match = getTargetMatch(matches, path);\n }\n }\n // Call the loader for this fetcher route match\n fetchControllers.set(key, abortController);\n let originatingLoadId = incrementingLoadId;\n let results = await callDataStrategy(\"loader\", state, fetchRequest, [match], matches, key);\n let result = results[match.route.id];\n // Deferred isn't supported for fetcher loads, await everything and treat it\n // as a normal load. resolveDeferredData will return undefined if this\n // fetcher gets aborted, so we just leave result untouched and short circuit\n // below if that happens\n if (isDeferredResult(result)) {\n result = (await resolveDeferredData(result, fetchRequest.signal, true)) || result;\n }\n // We can delete this so long as we weren't aborted by our our own fetcher\n // re-load which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n if (fetchRequest.signal.aborted) {\n return;\n }\n // We don't want errors bubbling up or redirects followed for unmounted\n // fetchers, so short circuit here if it was removed from the UI\n if (deletedFetchers.has(key)) {\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n }\n // If the loader threw a redirect Response, start a new REPLACE navigation\n if (isRedirectResult(result)) {\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our loader started, so that\n // should take precedence over this redirect navigation\n updateFetcherState(key, getDoneFetcher(undefined));\n return;\n } else {\n fetchRedirectIds.add(key);\n await startRedirectNavigation(fetchRequest, result, false, {\n preventScrollReset\n });\n return;\n }\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(result)) {\n setFetcherError(key, routeId, result.error);\n return;\n }\n invariant(!isDeferredResult(result), \"Unhandled fetcher deferred data\");\n // Put the fetcher back into an idle state\n updateFetcherState(key, getDoneFetcher(result.data));\n }\n /**\n * Utility function to handle redirects returned from an action or loader.\n * Normally, a redirect \"replaces\" the navigation that triggered it. So, for\n * example:\n *\n * - user is on /a\n * - user clicks a link to /b\n * - loader for /b redirects to /c\n *\n * In a non-JS app the browser would track the in-flight navigation to /b and\n * then replace it with /c when it encountered the redirect response. In\n * the end it would only ever update the URL bar with /c.\n *\n * In client-side routing using pushState/replaceState, we aim to emulate\n * this behavior and we also do not update history until the end of the\n * navigation (including processed redirects). This means that we never\n * actually touch history until we've processed redirects, so we just use\n * the history action from the original navigation (PUSH or REPLACE).\n */\n async function startRedirectNavigation(request, redirect, isNavigation, _temp2) {\n let {\n submission,\n fetcherSubmission,\n preventScrollReset,\n replace\n } = _temp2 === void 0 ? {} : _temp2;\n if (redirect.response.headers.has(\"X-Remix-Revalidate\")) {\n isRevalidationRequired = true;\n }\n let location = redirect.response.headers.get(\"Location\");\n invariant(location, \"Expected a Location header on the redirect Response\");\n location = normalizeRedirectLocation(location, new URL(request.url), basename);\n let redirectLocation = createLocation(state.location, location, {\n _isRedirect: true\n });\n if (isBrowser) {\n let isDocumentReload = false;\n if (redirect.response.headers.has(\"X-Remix-Reload-Document\")) {\n // Hard reload if the response contained X-Remix-Reload-Document\n isDocumentReload = true;\n } else if (ABSOLUTE_URL_REGEX.test(location)) {\n const url = init.history.createURL(location);\n isDocumentReload =\n // Hard reload if it's an absolute URL to a new origin\n url.origin !== routerWindow.location.origin ||\n // Hard reload if it's an absolute URL that does not match our basename\n stripBasename(url.pathname, basename) == null;\n }\n if (isDocumentReload) {\n if (replace) {\n routerWindow.location.replace(location);\n } else {\n routerWindow.location.assign(location);\n }\n return;\n }\n }\n // There's no need to abort on redirects, since we don't detect the\n // redirect until the action/loaders have settled\n pendingNavigationController = null;\n let redirectHistoryAction = replace === true || redirect.response.headers.has(\"X-Remix-Replace\") ? Action.Replace : Action.Push;\n // Use the incoming submission if provided, fallback on the active one in\n // state.navigation\n let {\n formMethod,\n formAction,\n formEncType\n } = state.navigation;\n if (!submission && !fetcherSubmission && formMethod && formAction && formEncType) {\n submission = getSubmissionFromNavigation(state.navigation);\n }\n // If this was a 307/308 submission we want to preserve the HTTP method and\n // re-submit the GET/POST/PUT/PATCH/DELETE as a submission navigation to the\n // redirected location\n let activeSubmission = submission || fetcherSubmission;\n if (redirectPreserveMethodStatusCodes.has(redirect.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) {\n await startNavigation(redirectHistoryAction, redirectLocation, {\n submission: _extends({}, activeSubmission, {\n formAction: location\n }),\n // Preserve these flags across redirects\n preventScrollReset: preventScrollReset || pendingPreventScrollReset,\n enableViewTransition: isNavigation ? pendingViewTransitionEnabled : undefined\n });\n } else {\n // If we have a navigation submission, we will preserve it through the\n // redirect navigation\n let overrideNavigation = getLoadingNavigation(redirectLocation, submission);\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation,\n // Send fetcher submissions through for shouldRevalidate\n fetcherSubmission,\n // Preserve these flags across redirects\n preventScrollReset: preventScrollReset || pendingPreventScrollReset,\n enableViewTransition: isNavigation ? pendingViewTransitionEnabled : undefined\n });\n }\n }\n // Utility wrapper for calling dataStrategy client-side without having to\n // pass around the manifest, mapRouteProperties, etc.\n async function callDataStrategy(type, state, request, matchesToLoad, matches, fetcherKey) {\n let results;\n let dataResults = {};\n try {\n results = await callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties);\n } catch (e) {\n // If the outer dataStrategy method throws, just return the error for all\n // matches - and it'll naturally bubble to the root\n matchesToLoad.forEach(m => {\n dataResults[m.route.id] = {\n type: ResultType.error,\n error: e\n };\n });\n return dataResults;\n }\n for (let [routeId, result] of Object.entries(results)) {\n if (isRedirectDataStrategyResultResult(result)) {\n let response = result.result;\n dataResults[routeId] = {\n type: ResultType.redirect,\n response: normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, future.v7_relativeSplatPath)\n };\n } else {\n dataResults[routeId] = await convertDataStrategyResultToDataResult(result);\n }\n }\n return dataResults;\n }\n async function callLoadersAndMaybeResolveData(state, matches, matchesToLoad, fetchersToLoad, request) {\n let currentMatches = state.matches;\n // Kick off loaders and fetchers in parallel\n let loaderResultsPromise = callDataStrategy(\"loader\", state, request, matchesToLoad, matches, null);\n let fetcherResultsPromise = Promise.all(fetchersToLoad.map(async f => {\n if (f.matches && f.match && f.controller) {\n let results = await callDataStrategy(\"loader\", state, createClientSideRequest(init.history, f.path, f.controller.signal), [f.match], f.matches, f.key);\n let result = results[f.match.route.id];\n // Fetcher results are keyed by fetcher key from here on out, not routeId\n return {\n [f.key]: result\n };\n } else {\n return Promise.resolve({\n [f.key]: {\n type: ResultType.error,\n error: getInternalRouterError(404, {\n pathname: f.path\n })\n }\n });\n }\n }));\n let loaderResults = await loaderResultsPromise;\n let fetcherResults = (await fetcherResultsPromise).reduce((acc, r) => Object.assign(acc, r), {});\n await Promise.all([resolveNavigationDeferredResults(matches, loaderResults, request.signal, currentMatches, state.loaderData), resolveFetcherDeferredResults(matches, fetcherResults, fetchersToLoad)]);\n return {\n loaderResults,\n fetcherResults\n };\n }\n function interruptActiveLoads() {\n // Every interruption triggers a revalidation\n isRevalidationRequired = true;\n // Cancel pending route-level deferreds and mark cancelled routes for\n // revalidation\n cancelledDeferredRoutes.push(...cancelActiveDeferreds());\n // Abort in-flight fetcher loads\n fetchLoadMatches.forEach((_, key) => {\n if (fetchControllers.has(key)) {\n cancelledFetcherLoads.add(key);\n }\n abortFetcher(key);\n });\n }\n function updateFetcherState(key, fetcher, opts) {\n if (opts === void 0) {\n opts = {};\n }\n state.fetchers.set(key, fetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n }, {\n flushSync: (opts && opts.flushSync) === true\n });\n }\n function setFetcherError(key, routeId, error, opts) {\n if (opts === void 0) {\n opts = {};\n }\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n deleteFetcher(key);\n updateState({\n errors: {\n [boundaryMatch.route.id]: error\n },\n fetchers: new Map(state.fetchers)\n }, {\n flushSync: (opts && opts.flushSync) === true\n });\n }\n function getFetcher(key) {\n activeFetchers.set(key, (activeFetchers.get(key) || 0) + 1);\n // If this fetcher was previously marked for deletion, unmark it since we\n // have a new instance\n if (deletedFetchers.has(key)) {\n deletedFetchers.delete(key);\n }\n return state.fetchers.get(key) || IDLE_FETCHER;\n }\n function deleteFetcher(key) {\n let fetcher = state.fetchers.get(key);\n // Don't abort the controller if this is a deletion of a fetcher.submit()\n // in it's loading phase since - we don't want to abort the corresponding\n // revalidation and want them to complete and land\n if (fetchControllers.has(key) && !(fetcher && fetcher.state === \"loading\" && fetchReloadIds.has(key))) {\n abortFetcher(key);\n }\n fetchLoadMatches.delete(key);\n fetchReloadIds.delete(key);\n fetchRedirectIds.delete(key);\n // If we opted into the flag we can clear this now since we're calling\n // deleteFetcher() at the end of updateState() and we've already handed the\n // deleted fetcher keys off to the data layer.\n // If not, we're eagerly calling deleteFetcher() and we need to keep this\n // Set populated until the next updateState call, and we'll clear\n // `deletedFetchers` then\n if (future.v7_fetcherPersist) {\n deletedFetchers.delete(key);\n }\n cancelledFetcherLoads.delete(key);\n state.fetchers.delete(key);\n }\n function deleteFetcherAndUpdateState(key) {\n let count = (activeFetchers.get(key) || 0) - 1;\n if (count <= 0) {\n activeFetchers.delete(key);\n deletedFetchers.add(key);\n if (!future.v7_fetcherPersist) {\n deleteFetcher(key);\n }\n } else {\n activeFetchers.set(key, count);\n }\n updateState({\n fetchers: new Map(state.fetchers)\n });\n }\n function abortFetcher(key) {\n let controller = fetchControllers.get(key);\n if (controller) {\n controller.abort();\n fetchControllers.delete(key);\n }\n }\n function markFetchersDone(keys) {\n for (let key of keys) {\n let fetcher = getFetcher(key);\n let doneFetcher = getDoneFetcher(fetcher.data);\n state.fetchers.set(key, doneFetcher);\n }\n }\n function markFetchRedirectsDone() {\n let doneKeys = [];\n let updatedFetchers = false;\n for (let key of fetchRedirectIds) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n fetchRedirectIds.delete(key);\n doneKeys.push(key);\n updatedFetchers = true;\n }\n }\n markFetchersDone(doneKeys);\n return updatedFetchers;\n }\n function abortStaleFetchLoads(landedId) {\n let yeetedKeys = [];\n for (let [key, id] of fetchReloadIds) {\n if (id < landedId) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n abortFetcher(key);\n fetchReloadIds.delete(key);\n yeetedKeys.push(key);\n }\n }\n }\n markFetchersDone(yeetedKeys);\n return yeetedKeys.length > 0;\n }\n function getBlocker(key, fn) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n if (blockerFunctions.get(key) !== fn) {\n blockerFunctions.set(key, fn);\n }\n return blocker;\n }\n function deleteBlocker(key) {\n state.blockers.delete(key);\n blockerFunctions.delete(key);\n }\n // Utility function to update blockers, ensuring valid state transitions\n function updateBlocker(key, newBlocker) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n // Poor mans state machine :)\n // https://mermaid.live/edit#pako:eNqVkc9OwzAMxl8l8nnjAYrEtDIOHEBIgwvKJTReGy3_lDpIqO27k6awMG0XcrLlnz87nwdonESogKXXBuE79rq75XZO3-yHds0RJVuv70YrPlUrCEe2HfrORS3rubqZfuhtpg5C9wk5tZ4VKcRUq88q9Z8RS0-48cE1iHJkL0ugbHuFLus9L6spZy8nX9MP2CNdomVaposqu3fGayT8T8-jJQwhepo_UtpgBQaDEUom04dZhAN1aJBDlUKJBxE1ceB2Smj0Mln-IBW5AFU2dwUiktt_2Qaq2dBfaKdEup85UV7Yd-dKjlnkabl2Pvr0DTkTreM\n invariant(blocker.state === \"unblocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"proceeding\" || blocker.state === \"blocked\" && newBlocker.state === \"unblocked\" || blocker.state === \"proceeding\" && newBlocker.state === \"unblocked\", \"Invalid blocker state transition: \" + blocker.state + \" -> \" + newBlocker.state);\n let blockers = new Map(state.blockers);\n blockers.set(key, newBlocker);\n updateState({\n blockers\n });\n }\n function shouldBlockNavigation(_ref2) {\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = _ref2;\n if (blockerFunctions.size === 0) {\n return;\n }\n // We ony support a single active blocker at the moment since we don't have\n // any compelling use cases for multi-blocker yet\n if (blockerFunctions.size > 1) {\n warning(false, \"A router only supports one blocker at a time\");\n }\n let entries = Array.from(blockerFunctions.entries());\n let [blockerKey, blockerFunction] = entries[entries.length - 1];\n let blocker = state.blockers.get(blockerKey);\n if (blocker && blocker.state === \"proceeding\") {\n // If the blocker is currently proceeding, we don't need to re-check\n // it and can let this navigation continue\n return;\n }\n // At this point, we know we're unblocked/blocked so we need to check the\n // user-provided blocker function\n if (blockerFunction({\n currentLocation,\n nextLocation,\n historyAction\n })) {\n return blockerKey;\n }\n }\n function handleNavigational404(pathname) {\n let error = getInternalRouterError(404, {\n pathname\n });\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let {\n matches,\n route\n } = getShortCircuitMatches(routesToUse);\n // Cancel all pending deferred on 404s since we don't keep any routes\n cancelActiveDeferreds();\n return {\n notFoundMatches: matches,\n route,\n error\n };\n }\n function cancelActiveDeferreds(predicate) {\n let cancelledRouteIds = [];\n activeDeferreds.forEach((dfd, routeId) => {\n if (!predicate || predicate(routeId)) {\n // Cancel the deferred - but do not remove from activeDeferreds here -\n // we rely on the subscribers to do that so our tests can assert proper\n // cleanup via _internalActiveDeferreds\n dfd.cancel();\n cancelledRouteIds.push(routeId);\n activeDeferreds.delete(routeId);\n }\n });\n return cancelledRouteIds;\n }\n // Opt in to capturing and reporting scroll positions during navigations,\n // used by the component\n function enableScrollRestoration(positions, getPosition, getKey) {\n savedScrollPositions = positions;\n getScrollPosition = getPosition;\n getScrollRestorationKey = getKey || null;\n // Perform initial hydration scroll restoration, since we miss the boat on\n // the initial updateState() because we've not yet rendered \n // and therefore have no savedScrollPositions available\n if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {\n initialScrollRestored = true;\n let y = getSavedScrollPosition(state.location, state.matches);\n if (y != null) {\n updateState({\n restoreScrollPosition: y\n });\n }\n }\n return () => {\n savedScrollPositions = null;\n getScrollPosition = null;\n getScrollRestorationKey = null;\n };\n }\n function getScrollKey(location, matches) {\n if (getScrollRestorationKey) {\n let key = getScrollRestorationKey(location, matches.map(m => convertRouteMatchToUiMatch(m, state.loaderData)));\n return key || location.key;\n }\n return location.key;\n }\n function saveScrollPosition(location, matches) {\n if (savedScrollPositions && getScrollPosition) {\n let key = getScrollKey(location, matches);\n savedScrollPositions[key] = getScrollPosition();\n }\n }\n function getSavedScrollPosition(location, matches) {\n if (savedScrollPositions) {\n let key = getScrollKey(location, matches);\n let y = savedScrollPositions[key];\n if (typeof y === \"number\") {\n return y;\n }\n }\n return null;\n }\n function checkFogOfWar(matches, routesToUse, pathname) {\n if (patchRoutesOnNavigationImpl) {\n if (!matches) {\n let fogMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n return {\n active: true,\n matches: fogMatches || []\n };\n } else {\n if (Object.keys(matches[0].params).length > 0) {\n // If we matched a dynamic param or a splat, it might only be because\n // we haven't yet discovered other routes that would match with a\n // higher score. Call patchRoutesOnNavigation just to be sure\n let partialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n return {\n active: true,\n matches: partialMatches\n };\n }\n }\n }\n return {\n active: false,\n matches: null\n };\n }\n async function discoverRoutes(matches, pathname, signal, fetcherKey) {\n if (!patchRoutesOnNavigationImpl) {\n return {\n type: \"success\",\n matches\n };\n }\n let partialMatches = matches;\n while (true) {\n let isNonHMR = inFlightDataRoutes == null;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let localManifest = manifest;\n try {\n await patchRoutesOnNavigationImpl({\n signal,\n path: pathname,\n matches: partialMatches,\n fetcherKey,\n patch: (routeId, children) => {\n if (signal.aborted) return;\n patchRoutesImpl(routeId, children, routesToUse, localManifest, mapRouteProperties);\n }\n });\n } catch (e) {\n return {\n type: \"error\",\n error: e,\n partialMatches\n };\n } finally {\n // If we are not in the middle of an HMR revalidation and we changed the\n // routes, provide a new identity so when we `updateState` at the end of\n // this navigation/fetch `router.routes` will be a new identity and\n // trigger a re-run of memoized `router.routes` dependencies.\n // HMR will already update the identity and reflow when it lands\n // `inFlightDataRoutes` in `completeNavigation`\n if (isNonHMR && !signal.aborted) {\n dataRoutes = [...dataRoutes];\n }\n }\n if (signal.aborted) {\n return {\n type: \"aborted\"\n };\n }\n let newMatches = matchRoutes(routesToUse, pathname, basename);\n if (newMatches) {\n return {\n type: \"success\",\n matches: newMatches\n };\n }\n let newPartialMatches = matchRoutesImpl(routesToUse, pathname, basename, true);\n // Avoid loops if the second pass results in the same partial matches\n if (!newPartialMatches || partialMatches.length === newPartialMatches.length && partialMatches.every((m, i) => m.route.id === newPartialMatches[i].route.id)) {\n return {\n type: \"success\",\n matches: null\n };\n }\n partialMatches = newPartialMatches;\n }\n }\n function _internalSetRoutes(newRoutes) {\n manifest = {};\n inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, undefined, manifest);\n }\n function patchRoutes(routeId, children) {\n let isNonHMR = inFlightDataRoutes == null;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties);\n // If we are not in the middle of an HMR revalidation and we changed the\n // routes, provide a new identity and trigger a reflow via `updateState`\n // to re-run memoized `router.routes` dependencies.\n // HMR will already update the identity and reflow when it lands\n // `inFlightDataRoutes` in `completeNavigation`\n if (isNonHMR) {\n dataRoutes = [...dataRoutes];\n updateState({});\n }\n }\n router = {\n get basename() {\n return basename;\n },\n get future() {\n return future;\n },\n get state() {\n return state;\n },\n get routes() {\n return dataRoutes;\n },\n get window() {\n return routerWindow;\n },\n initialize,\n subscribe,\n enableScrollRestoration,\n navigate,\n fetch,\n revalidate,\n // Passthrough to history-aware createHref used by useHref so we get proper\n // hash-aware URLs in DOM paths\n createHref: to => init.history.createHref(to),\n encodeLocation: to => init.history.encodeLocation(to),\n getFetcher,\n deleteFetcher: deleteFetcherAndUpdateState,\n dispose,\n getBlocker,\n deleteBlocker,\n patchRoutes,\n _internalFetchControllers: fetchControllers,\n _internalActiveDeferreds: activeDeferreds,\n // TODO: Remove setRoutes, it's temporary to avoid dealing with\n // updating the tree while validating the update algorithm.\n _internalSetRoutes\n };\n return router;\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createStaticHandler\n////////////////////////////////////////////////////////////////////////////////\nconst UNSAFE_DEFERRED_SYMBOL = Symbol(\"deferred\");\nfunction createStaticHandler(routes, opts) {\n invariant(routes.length > 0, \"You must provide a non-empty routes array to createStaticHandler\");\n let manifest = {};\n let basename = (opts ? opts.basename : null) || \"/\";\n let mapRouteProperties;\n if (opts != null && opts.mapRouteProperties) {\n mapRouteProperties = opts.mapRouteProperties;\n } else if (opts != null && opts.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = opts.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Config driven behavior flags\n let future = _extends({\n v7_relativeSplatPath: false,\n v7_throwAbortReason: false\n }, opts ? opts.future : null);\n let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest);\n /**\n * The query() method is intended for document requests, in which we want to\n * call an optional action and potentially multiple loaders for all nested\n * routes. It returns a StaticHandlerContext object, which is very similar\n * to the router state (location, loaderData, actionData, errors, etc.) and\n * also adds SSR-specific information such as the statusCode and headers\n * from action/loaders Responses.\n *\n * It _should_ never throw and should report all errors through the\n * returned context.errors object, properly associating errors to their error\n * boundary. Additionally, it tracks _deepestRenderedBoundaryId which can be\n * used to emulate React error boundaries during SSr by performing a second\n * pass only down to the boundaryId.\n *\n * The one exception where we do not return a StaticHandlerContext is when a\n * redirect response is returned or thrown from any action/loader. We\n * propagate that out and return the raw Response so the HTTP server can\n * return it directly.\n *\n * - `opts.requestContext` is an optional server context that will be passed\n * to actions/loaders in the `context` parameter\n * - `opts.skipLoaderErrorBubbling` is an optional parameter that will prevent\n * the bubbling of errors which allows single-fetch-type implementations\n * where the client will handle the bubbling and we may need to return data\n * for the handling route\n */\n async function query(request, _temp3) {\n let {\n requestContext,\n skipLoaderErrorBubbling,\n dataStrategy\n } = _temp3 === void 0 ? {} : _temp3;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\") {\n let error = getInternalRouterError(405, {\n method\n });\n let {\n matches: methodNotAllowedMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: methodNotAllowedMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n } else if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: notFoundMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, skipLoaderErrorBubbling === true, null);\n if (isResponse(result)) {\n return result;\n }\n // When returning StaticHandlerContext, we patch back in the location here\n // since we need it for React Context. But this helps keep our submit and\n // loadRouteData operating on a Request instead of a Location\n return _extends({\n location,\n basename\n }, result);\n }\n /**\n * The queryRoute() method is intended for targeted route requests, either\n * for fetch ?_data requests or resource route requests. In this case, we\n * are only ever calling a single action or loader, and we are returning the\n * returned value directly. In most cases, this will be a Response returned\n * from the action/loader, but it may be a primitive or other value as well -\n * and in such cases the calling context should handle that accordingly.\n *\n * We do respect the throw/return differentiation, so if an action/loader\n * throws, then this method will throw the value. This is important so we\n * can do proper boundary identification in Remix where a thrown Response\n * must go to the Catch Boundary but a returned Response is happy-path.\n *\n * One thing to note is that any Router-initiated Errors that make sense\n * to associate with a status code will be thrown as an ErrorResponse\n * instance which include the raw Error, such that the calling context can\n * serialize the error as they see fit while including the proper response\n * code. Examples here are 404 and 405 errors that occur prior to reaching\n * any user-defined loaders.\n *\n * - `opts.routeId` allows you to specify the specific route handler to call.\n * If not provided the handler will determine the proper route by matching\n * against `request.url`\n * - `opts.requestContext` is an optional server context that will be passed\n * to actions/loaders in the `context` parameter\n */\n async function queryRoute(request, _temp4) {\n let {\n routeId,\n requestContext,\n dataStrategy\n } = _temp4 === void 0 ? {} : _temp4;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\" && method !== \"OPTIONS\") {\n throw getInternalRouterError(405, {\n method\n });\n } else if (!matches) {\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let match = routeId ? matches.find(m => m.route.id === routeId) : getTargetMatch(matches, location);\n if (routeId && !match) {\n throw getInternalRouterError(403, {\n pathname: location.pathname,\n routeId\n });\n } else if (!match) {\n // This should never hit I don't think?\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, false, match);\n if (isResponse(result)) {\n return result;\n }\n let error = result.errors ? Object.values(result.errors)[0] : undefined;\n if (error !== undefined) {\n // If we got back result.errors, that means the loader/action threw\n // _something_ that wasn't a Response, but it's not guaranteed/required\n // to be an `instanceof Error` either, so we have to use throw here to\n // preserve the \"error\" state outside of queryImpl.\n throw error;\n }\n // Pick off the right state value to return\n if (result.actionData) {\n return Object.values(result.actionData)[0];\n }\n if (result.loaderData) {\n var _result$activeDeferre;\n let data = Object.values(result.loaderData)[0];\n if ((_result$activeDeferre = result.activeDeferreds) != null && _result$activeDeferre[match.route.id]) {\n data[UNSAFE_DEFERRED_SYMBOL] = result.activeDeferreds[match.route.id];\n }\n return data;\n }\n return undefined;\n }\n async function queryImpl(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch) {\n invariant(request.signal, \"query()/queryRoute() requests must contain an AbortController signal\");\n try {\n if (isMutationMethod(request.method.toLowerCase())) {\n let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch != null);\n return result;\n }\n let result = await loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch);\n return isResponse(result) ? result : _extends({}, result, {\n actionData: null,\n actionHeaders: {}\n });\n } catch (e) {\n // If the user threw/returned a Response in callLoaderOrAction for a\n // `queryRoute` call, we throw the `DataStrategyResult` to bail out early\n // and then return or throw the raw Response here accordingly\n if (isDataStrategyResult(e) && isResponse(e.result)) {\n if (e.type === ResultType.error) {\n throw e.result;\n }\n return e.result;\n }\n // Redirects are always returned since they don't propagate to catch\n // boundaries\n if (isRedirectResponse(e)) {\n return e;\n }\n throw e;\n }\n }\n async function submit(request, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest) {\n let result;\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n let error = getInternalRouterError(405, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: actionMatch.route.id\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n } else {\n let results = await callDataStrategy(\"action\", request, [actionMatch], matches, isRouteRequest, requestContext, dataStrategy);\n result = results[actionMatch.route.id];\n if (request.signal.aborted) {\n throwStaticHandlerAbortedError(request, isRouteRequest, future);\n }\n }\n if (isRedirectResult(result)) {\n // Uhhhh - this should never happen, we should always throw these from\n // callLoaderOrAction, but the type narrowing here keeps TS happy and we\n // can get back on the \"throw all redirect responses\" train here should\n // this ever happen :/\n throw new Response(null, {\n status: result.response.status,\n headers: {\n Location: result.response.headers.get(\"Location\")\n }\n });\n }\n if (isDeferredResult(result)) {\n let error = getInternalRouterError(400, {\n type: \"defer-action\"\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n }\n if (isRouteRequest) {\n // Note: This should only be non-Response values if we get here, since\n // isRouteRequest should throw any Response received in callLoaderOrAction\n if (isErrorResult(result)) {\n throw result.error;\n }\n return {\n matches: [actionMatch],\n loaderData: {},\n actionData: {\n [actionMatch.route.id]: result.data\n },\n errors: null,\n // Note: statusCode + headers are unused here since queryRoute will\n // return the raw Response or value\n statusCode: 200,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n // Create a GET request for the loaders\n let loaderRequest = new Request(request.url, {\n headers: request.headers,\n redirect: request.redirect,\n signal: request.signal\n });\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);\n let context = await loadRouteData(loaderRequest, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null, [boundaryMatch.route.id, result]);\n // action status codes take precedence over loader status codes\n return _extends({}, context, {\n statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,\n actionData: null,\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n }\n let context = await loadRouteData(loaderRequest, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null);\n return _extends({}, context, {\n actionData: {\n [actionMatch.route.id]: result.data\n }\n }, result.statusCode ? {\n statusCode: result.statusCode\n } : {}, {\n actionHeaders: result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {}\n });\n }\n async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, pendingActionResult) {\n let isRouteRequest = routeMatch != null;\n // Short circuit if we have no loaders to run (queryRoute())\n if (isRouteRequest && !(routeMatch != null && routeMatch.route.loader) && !(routeMatch != null && routeMatch.route.lazy)) {\n throw getInternalRouterError(400, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: routeMatch == null ? void 0 : routeMatch.route.id\n });\n }\n let requestMatches = routeMatch ? [routeMatch] : pendingActionResult && isErrorResult(pendingActionResult[1]) ? getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]) : matches;\n let matchesToLoad = requestMatches.filter(m => m.route.loader || m.route.lazy);\n // Short circuit if we have no loaders to run (query())\n if (matchesToLoad.length === 0) {\n return {\n matches,\n // Add a null for all matched routes for proper revalidation on the client\n loaderData: matches.reduce((acc, m) => Object.assign(acc, {\n [m.route.id]: null\n }), {}),\n errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? {\n [pendingActionResult[0]]: pendingActionResult[1].error\n } : null,\n statusCode: 200,\n loaderHeaders: {},\n activeDeferreds: null\n };\n }\n let results = await callDataStrategy(\"loader\", request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy);\n if (request.signal.aborted) {\n throwStaticHandlerAbortedError(request, isRouteRequest, future);\n }\n // Process and commit output from loaders\n let activeDeferreds = new Map();\n let context = processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling);\n // Add a null for any non-loader matches for proper revalidation on the client\n let executedLoaders = new Set(matchesToLoad.map(match => match.route.id));\n matches.forEach(match => {\n if (!executedLoaders.has(match.route.id)) {\n context.loaderData[match.route.id] = null;\n }\n });\n return _extends({}, context, {\n matches,\n activeDeferreds: activeDeferreds.size > 0 ? Object.fromEntries(activeDeferreds.entries()) : null\n });\n }\n // Utility wrapper for calling dataStrategy server-side without having to\n // pass around the manifest, mapRouteProperties, etc.\n async function callDataStrategy(type, request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy) {\n let results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, type, null, request, matchesToLoad, matches, null, manifest, mapRouteProperties, requestContext);\n let dataResults = {};\n await Promise.all(matches.map(async match => {\n if (!(match.route.id in results)) {\n return;\n }\n let result = results[match.route.id];\n if (isRedirectDataStrategyResultResult(result)) {\n let response = result.result;\n // Throw redirects and let the server handle them with an HTTP redirect\n throw normalizeRelativeRoutingRedirectResponse(response, request, match.route.id, matches, basename, future.v7_relativeSplatPath);\n }\n if (isResponse(result.result) && isRouteRequest) {\n // For SSR single-route requests, we want to hand Responses back\n // directly without unwrapping\n throw result;\n }\n dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);\n }));\n return dataResults;\n }\n return {\n dataRoutes,\n query,\n queryRoute\n };\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Helpers\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Given an existing StaticHandlerContext and an error thrown at render time,\n * provide an updated StaticHandlerContext suitable for a second SSR render\n */\nfunction getStaticContextFromError(routes, context, error) {\n let newContext = _extends({}, context, {\n statusCode: isRouteErrorResponse(error) ? error.status : 500,\n errors: {\n [context._deepestRenderedBoundaryId || routes[0].id]: error\n }\n });\n return newContext;\n}\nfunction throwStaticHandlerAbortedError(request, isRouteRequest, future) {\n if (future.v7_throwAbortReason && request.signal.reason !== undefined) {\n throw request.signal.reason;\n }\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted: \" + request.method + \" \" + request.url);\n}\nfunction isSubmissionNavigation(opts) {\n return opts != null && (\"formData\" in opts && opts.formData != null || \"body\" in opts && opts.body !== undefined);\n}\nfunction normalizeTo(location, matches, basename, prependBasename, to, v7_relativeSplatPath, fromRouteId, relative) {\n let contextualMatches;\n let activeRouteMatch;\n if (fromRouteId) {\n // Grab matches up to the calling route so our route-relative logic is\n // relative to the correct source route\n contextualMatches = [];\n for (let match of matches) {\n contextualMatches.push(match);\n if (match.route.id === fromRouteId) {\n activeRouteMatch = match;\n break;\n }\n }\n } else {\n contextualMatches = matches;\n activeRouteMatch = matches[matches.length - 1];\n }\n // Resolve the relative path\n let path = resolveTo(to ? to : \".\", getResolveToMatches(contextualMatches, v7_relativeSplatPath), stripBasename(location.pathname, basename) || location.pathname, relative === \"path\");\n // When `to` is not specified we inherit search/hash from the current\n // location, unlike when to=\".\" and we just inherit the path.\n // See https://github.com/remix-run/remix/issues/927\n if (to == null) {\n path.search = location.search;\n path.hash = location.hash;\n }\n // Account for `?index` params when routing to the current location\n if ((to == null || to === \"\" || to === \".\") && activeRouteMatch) {\n let nakedIndex = hasNakedIndexQuery(path.search);\n if (activeRouteMatch.route.index && !nakedIndex) {\n // Add one when we're targeting an index route\n path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n } else if (!activeRouteMatch.route.index && nakedIndex) {\n // Remove existing ones when we're not\n let params = new URLSearchParams(path.search);\n let indexValues = params.getAll(\"index\");\n params.delete(\"index\");\n indexValues.filter(v => v).forEach(v => params.append(\"index\", v));\n let qs = params.toString();\n path.search = qs ? \"?\" + qs : \"\";\n }\n }\n // If we're operating within a basename, prepend it to the pathname. If\n // this is a root navigation, then just use the raw basename which allows\n // the basename to have full control over the presence of a trailing slash\n // on root actions\n if (prependBasename && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n return createPath(path);\n}\n// Normalize navigation options by converting formMethod=GET formData objects to\n// URLSearchParams so they behave identically to links with query params\nfunction normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) {\n // Return location verbatim on non-submission navigations\n if (!opts || !isSubmissionNavigation(opts)) {\n return {\n path\n };\n }\n if (opts.formMethod && !isValidMethod(opts.formMethod)) {\n return {\n path,\n error: getInternalRouterError(405, {\n method: opts.formMethod\n })\n };\n }\n let getInvalidBodyError = () => ({\n path,\n error: getInternalRouterError(400, {\n type: \"invalid-body\"\n })\n });\n // Create a Submission on non-GET navigations\n let rawFormMethod = opts.formMethod || \"get\";\n let formMethod = normalizeFormMethod ? rawFormMethod.toUpperCase() : rawFormMethod.toLowerCase();\n let formAction = stripHashFromPath(path);\n if (opts.body !== undefined) {\n if (opts.formEncType === \"text/plain\") {\n // text only support POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n let text = typeof opts.body === \"string\" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ?\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data\n Array.from(opts.body.entries()).reduce((acc, _ref3) => {\n let [name, value] = _ref3;\n return \"\" + acc + name + \"=\" + value + \"\\n\";\n }, \"\") : String(opts.body);\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json: undefined,\n text\n }\n };\n } else if (opts.formEncType === \"application/json\") {\n // json only supports POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n try {\n let json = typeof opts.body === \"string\" ? JSON.parse(opts.body) : opts.body;\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json,\n text: undefined\n }\n };\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n }\n invariant(typeof FormData === \"function\", \"FormData is not available in this environment\");\n let searchParams;\n let formData;\n if (opts.formData) {\n searchParams = convertFormDataToSearchParams(opts.formData);\n formData = opts.formData;\n } else if (opts.body instanceof FormData) {\n searchParams = convertFormDataToSearchParams(opts.body);\n formData = opts.body;\n } else if (opts.body instanceof URLSearchParams) {\n searchParams = opts.body;\n formData = convertSearchParamsToFormData(searchParams);\n } else if (opts.body == null) {\n searchParams = new URLSearchParams();\n formData = new FormData();\n } else {\n try {\n searchParams = new URLSearchParams(opts.body);\n formData = convertSearchParamsToFormData(searchParams);\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n let submission = {\n formMethod,\n formAction,\n formEncType: opts && opts.formEncType || \"application/x-www-form-urlencoded\",\n formData,\n json: undefined,\n text: undefined\n };\n if (isMutationMethod(submission.formMethod)) {\n return {\n path,\n submission\n };\n }\n // Flatten submission onto URLSearchParams for GET submissions\n let parsedPath = parsePath(path);\n // On GET navigation submissions we can drop the ?index param from the\n // resulting location since all loaders will run. But fetcher GET submissions\n // only run a single loader so we need to preserve any incoming ?index params\n if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) {\n searchParams.append(\"index\", \"\");\n }\n parsedPath.search = \"?\" + searchParams;\n return {\n path: createPath(parsedPath),\n submission\n };\n}\n// Filter out all routes at/below any caught error as they aren't going to\n// render so we don't need to load them\nfunction getLoaderMatchesUntilBoundary(matches, boundaryId, includeBoundary) {\n if (includeBoundary === void 0) {\n includeBoundary = false;\n }\n let index = matches.findIndex(m => m.route.id === boundaryId);\n if (index >= 0) {\n return matches.slice(0, includeBoundary ? index + 1 : index);\n }\n return matches;\n}\nfunction getMatchesToLoad(history, state, matches, submission, location, initialHydration, skipActionErrorRevalidation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, deletedFetchers, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult) {\n let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : undefined;\n let currentUrl = history.createURL(state.location);\n let nextUrl = history.createURL(location);\n // Pick navigation matches that are net-new or qualify for revalidation\n let boundaryMatches = matches;\n if (initialHydration && state.errors) {\n // On initial hydration, only consider matches up to _and including_ the boundary.\n // This is inclusive to handle cases where a server loader ran successfully,\n // a child server loader bubbled up to this route, but this route has\n // `clientLoader.hydrate` so we want to still run the `clientLoader` so that\n // we have a complete version of `loaderData`\n boundaryMatches = getLoaderMatchesUntilBoundary(matches, Object.keys(state.errors)[0], true);\n } else if (pendingActionResult && isErrorResult(pendingActionResult[1])) {\n // If an action threw an error, we call loaders up to, but not including the\n // boundary\n boundaryMatches = getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]);\n }\n // Don't revalidate loaders by default after action 4xx/5xx responses\n // when the flag is enabled. They can still opt-into revalidation via\n // `shouldRevalidate` via `actionResult`\n let actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : undefined;\n let shouldSkipRevalidation = skipActionErrorRevalidation && actionStatus && actionStatus >= 400;\n let navigationMatches = boundaryMatches.filter((match, index) => {\n let {\n route\n } = match;\n if (route.lazy) {\n // We haven't loaded this route yet so we don't know if it's got a loader!\n return true;\n }\n if (route.loader == null) {\n return false;\n }\n if (initialHydration) {\n return shouldLoadRouteOnHydration(route, state.loaderData, state.errors);\n }\n // Always call the loader on new route instances and pending defer cancellations\n if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some(id => id === match.route.id)) {\n return true;\n }\n // This is the default implementation for when we revalidate. If the route\n // provides it's own implementation, then we give them full control but\n // provide this value so they can leverage it if needed after they check\n // their own specific use cases\n let currentRouteMatch = state.matches[index];\n let nextRouteMatch = match;\n return shouldRevalidateLoader(match, _extends({\n currentUrl,\n currentParams: currentRouteMatch.params,\n nextUrl,\n nextParams: nextRouteMatch.params\n }, submission, {\n actionResult,\n actionStatus,\n defaultShouldRevalidate: shouldSkipRevalidation ? false :\n // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate\n isRevalidationRequired || currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search ||\n // Search params affect all loaders\n currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch)\n }));\n });\n // Pick fetcher.loads that need to be revalidated\n let revalidatingFetchers = [];\n fetchLoadMatches.forEach((f, key) => {\n // Don't revalidate:\n // - on initial hydration (shouldn't be any fetchers then anyway)\n // - if fetcher won't be present in the subsequent render\n // - no longer matches the URL (v7_fetcherPersist=false)\n // - was unmounted but persisted due to v7_fetcherPersist=true\n if (initialHydration || !matches.some(m => m.route.id === f.routeId) || deletedFetchers.has(key)) {\n return;\n }\n let fetcherMatches = matchRoutes(routesToUse, f.path, basename);\n // If the fetcher path no longer matches, push it in with null matches so\n // we can trigger a 404 in callLoadersAndMaybeResolveData. Note this is\n // currently only a use-case for Remix HMR where the route tree can change\n // at runtime and remove a route previously loaded via a fetcher\n if (!fetcherMatches) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: null,\n match: null,\n controller: null\n });\n return;\n }\n // Revalidating fetchers are decoupled from the route matches since they\n // load from a static href. They revalidate based on explicit revalidation\n // (submission, useRevalidator, or X-Remix-Revalidate)\n let fetcher = state.fetchers.get(key);\n let fetcherMatch = getTargetMatch(fetcherMatches, f.path);\n let shouldRevalidate = false;\n if (fetchRedirectIds.has(key)) {\n // Never trigger a revalidation of an actively redirecting fetcher\n shouldRevalidate = false;\n } else if (cancelledFetcherLoads.has(key)) {\n // Always mark for revalidation if the fetcher was cancelled\n cancelledFetcherLoads.delete(key);\n shouldRevalidate = true;\n } else if (fetcher && fetcher.state !== \"idle\" && fetcher.data === undefined) {\n // If the fetcher hasn't ever completed loading yet, then this isn't a\n // revalidation, it would just be a brand new load if an explicit\n // revalidation is required\n shouldRevalidate = isRevalidationRequired;\n } else {\n // Otherwise fall back on any user-defined shouldRevalidate, defaulting\n // to explicit revalidations only\n shouldRevalidate = shouldRevalidateLoader(fetcherMatch, _extends({\n currentUrl,\n currentParams: state.matches[state.matches.length - 1].params,\n nextUrl,\n nextParams: matches[matches.length - 1].params\n }, submission, {\n actionResult,\n actionStatus,\n defaultShouldRevalidate: shouldSkipRevalidation ? false : isRevalidationRequired\n }));\n }\n if (shouldRevalidate) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: fetcherMatches,\n match: fetcherMatch,\n controller: new AbortController()\n });\n }\n });\n return [navigationMatches, revalidatingFetchers];\n}\nfunction shouldLoadRouteOnHydration(route, loaderData, errors) {\n // We dunno if we have a loader - gotta find out!\n if (route.lazy) {\n return true;\n }\n // No loader, nothing to initialize\n if (!route.loader) {\n return false;\n }\n let hasData = loaderData != null && loaderData[route.id] !== undefined;\n let hasError = errors != null && errors[route.id] !== undefined;\n // Don't run if we error'd during SSR\n if (!hasData && hasError) {\n return false;\n }\n // Explicitly opting-in to running on hydration\n if (typeof route.loader === \"function\" && route.loader.hydrate === true) {\n return true;\n }\n // Otherwise, run if we're not yet initialized with anything\n return !hasData && !hasError;\n}\nfunction isNewLoader(currentLoaderData, currentMatch, match) {\n let isNew =\n // [a] -> [a, b]\n !currentMatch ||\n // [a, b] -> [a, c]\n match.route.id !== currentMatch.route.id;\n // Handle the case that we don't have data for a re-used route, potentially\n // from a prior error or from a cancelled pending deferred\n let isMissingData = currentLoaderData[match.route.id] === undefined;\n // Always load if this is a net-new route or we don't yet have data\n return isNew || isMissingData;\n}\nfunction isNewRouteInstance(currentMatch, match) {\n let currentPath = currentMatch.route.path;\n return (\n // param change for this match, /users/123 -> /users/456\n currentMatch.pathname !== match.pathname ||\n // splat param changed, which is not present in match.path\n // e.g. /files/images/avatar.jpg -> files/finances.xls\n currentPath != null && currentPath.endsWith(\"*\") && currentMatch.params[\"*\"] !== match.params[\"*\"]\n );\n}\nfunction shouldRevalidateLoader(loaderMatch, arg) {\n if (loaderMatch.route.shouldRevalidate) {\n let routeChoice = loaderMatch.route.shouldRevalidate(arg);\n if (typeof routeChoice === \"boolean\") {\n return routeChoice;\n }\n }\n return arg.defaultShouldRevalidate;\n}\nfunction patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties) {\n var _childrenToPatch;\n let childrenToPatch;\n if (routeId) {\n let route = manifest[routeId];\n invariant(route, \"No route found to patch children into: routeId = \" + routeId);\n if (!route.children) {\n route.children = [];\n }\n childrenToPatch = route.children;\n } else {\n childrenToPatch = routesToUse;\n }\n // Don't patch in routes we already know about so that `patch` is idempotent\n // to simplify user-land code. This is useful because we re-call the\n // `patchRoutesOnNavigation` function for matched routes with params.\n let uniqueChildren = children.filter(newRoute => !childrenToPatch.some(existingRoute => isSameRoute(newRoute, existingRoute)));\n let newRoutes = convertRoutesToDataRoutes(uniqueChildren, mapRouteProperties, [routeId || \"_\", \"patch\", String(((_childrenToPatch = childrenToPatch) == null ? void 0 : _childrenToPatch.length) || \"0\")], manifest);\n childrenToPatch.push(...newRoutes);\n}\nfunction isSameRoute(newRoute, existingRoute) {\n // Most optimal check is by id\n if (\"id\" in newRoute && \"id\" in existingRoute && newRoute.id === existingRoute.id) {\n return true;\n }\n // Second is by pathing differences\n if (!(newRoute.index === existingRoute.index && newRoute.path === existingRoute.path && newRoute.caseSensitive === existingRoute.caseSensitive)) {\n return false;\n }\n // Pathless layout routes are trickier since we need to check children.\n // If they have no children then they're the same as far as we can tell\n if ((!newRoute.children || newRoute.children.length === 0) && (!existingRoute.children || existingRoute.children.length === 0)) {\n return true;\n }\n // Otherwise, we look to see if every child in the new route is already\n // represented in the existing route's children\n return newRoute.children.every((aChild, i) => {\n var _existingRoute$childr;\n return (_existingRoute$childr = existingRoute.children) == null ? void 0 : _existingRoute$childr.some(bChild => isSameRoute(aChild, bChild));\n });\n}\n/**\n * Execute route.lazy() methods to lazily load route modules (loader, action,\n * shouldRevalidate) and update the routeManifest in place which shares objects\n * with dataRoutes so those get updated as well.\n */\nasync function loadLazyRouteModule(route, mapRouteProperties, manifest) {\n if (!route.lazy) {\n return;\n }\n let lazyRoute = await route.lazy();\n // If the lazy route function was executed and removed by another parallel\n // call then we can return - first lazy() to finish wins because the return\n // value of lazy is expected to be static\n if (!route.lazy) {\n return;\n }\n let routeToUpdate = manifest[route.id];\n invariant(routeToUpdate, \"No route found in manifest\");\n // Update the route in place. This should be safe because there's no way\n // we could yet be sitting on this route as we can't get there without\n // resolving lazy() first.\n //\n // This is different than the HMR \"update\" use-case where we may actively be\n // on the route being updated. The main concern boils down to \"does this\n // mutation affect any ongoing navigations or any current state.matches\n // values?\". If not, it should be safe to update in place.\n let routeUpdates = {};\n for (let lazyRouteProperty in lazyRoute) {\n let staticRouteValue = routeToUpdate[lazyRouteProperty];\n let isPropertyStaticallyDefined = staticRouteValue !== undefined &&\n // This property isn't static since it should always be updated based\n // on the route updates\n lazyRouteProperty !== \"hasErrorBoundary\";\n warning(!isPropertyStaticallyDefined, \"Route \\\"\" + routeToUpdate.id + \"\\\" has a static property \\\"\" + lazyRouteProperty + \"\\\" \" + \"defined but its lazy function is also returning a value for this property. \" + (\"The lazy route property \\\"\" + lazyRouteProperty + \"\\\" will be ignored.\"));\n if (!isPropertyStaticallyDefined && !immutableRouteKeys.has(lazyRouteProperty)) {\n routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty];\n }\n }\n // Mutate the route with the provided updates. Do this first so we pass\n // the updated version to mapRouteProperties\n Object.assign(routeToUpdate, routeUpdates);\n // Mutate the `hasErrorBoundary` property on the route based on the route\n // updates and remove the `lazy` function so we don't resolve the lazy\n // route again.\n Object.assign(routeToUpdate, _extends({}, mapRouteProperties(routeToUpdate), {\n lazy: undefined\n }));\n}\n// Default implementation of `dataStrategy` which fetches all loaders in parallel\nasync function defaultDataStrategy(_ref4) {\n let {\n matches\n } = _ref4;\n let matchesToLoad = matches.filter(m => m.shouldLoad);\n let results = await Promise.all(matchesToLoad.map(m => m.resolve()));\n return results.reduce((acc, result, i) => Object.assign(acc, {\n [matchesToLoad[i].route.id]: result\n }), {});\n}\nasync function callDataStrategyImpl(dataStrategyImpl, type, state, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties, requestContext) {\n let loadRouteDefinitionsPromises = matches.map(m => m.route.lazy ? loadLazyRouteModule(m.route, mapRouteProperties, manifest) : undefined);\n let dsMatches = matches.map((match, i) => {\n let loadRoutePromise = loadRouteDefinitionsPromises[i];\n let shouldLoad = matchesToLoad.some(m => m.route.id === match.route.id);\n // `resolve` encapsulates route.lazy(), executing the loader/action,\n // and mapping return values/thrown errors to a `DataStrategyResult`. Users\n // can pass a callback to take fine-grained control over the execution\n // of the loader/action\n let resolve = async handlerOverride => {\n if (handlerOverride && request.method === \"GET\" && (match.route.lazy || match.route.loader)) {\n shouldLoad = true;\n }\n return shouldLoad ? callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, requestContext) : Promise.resolve({\n type: ResultType.data,\n result: undefined\n });\n };\n return _extends({}, match, {\n shouldLoad,\n resolve\n });\n });\n // Send all matches here to allow for a middleware-type implementation.\n // handler will be a no-op for unneeded routes and we filter those results\n // back out below.\n let results = await dataStrategyImpl({\n matches: dsMatches,\n request,\n params: matches[0].params,\n fetcherKey,\n context: requestContext\n });\n // Wait for all routes to load here but 'swallow the error since we want\n // it to bubble up from the `await loadRoutePromise` in `callLoaderOrAction` -\n // called from `match.resolve()`\n try {\n await Promise.all(loadRouteDefinitionsPromises);\n } catch (e) {\n // No-op\n }\n return results;\n}\n// Default logic for calling a loader/action is the user has no specified a dataStrategy\nasync function callLoaderOrAction(type, request, match, loadRoutePromise, handlerOverride, staticContext) {\n let result;\n let onReject;\n let runHandler = handler => {\n // Setup a promise we can race against so that abort signals short circuit\n let reject;\n // This will never resolve so safe to type it as Promise to\n // satisfy the function return value\n let abortPromise = new Promise((_, r) => reject = r);\n onReject = () => reject();\n request.signal.addEventListener(\"abort\", onReject);\n let actualHandler = ctx => {\n if (typeof handler !== \"function\") {\n return Promise.reject(new Error(\"You cannot call the handler for a route which defines a boolean \" + (\"\\\"\" + type + \"\\\" [routeId: \" + match.route.id + \"]\")));\n }\n return handler({\n request,\n params: match.params,\n context: staticContext\n }, ...(ctx !== undefined ? [ctx] : []));\n };\n let handlerPromise = (async () => {\n try {\n let val = await (handlerOverride ? handlerOverride(ctx => actualHandler(ctx)) : actualHandler());\n return {\n type: \"data\",\n result: val\n };\n } catch (e) {\n return {\n type: \"error\",\n result: e\n };\n }\n })();\n return Promise.race([handlerPromise, abortPromise]);\n };\n try {\n let handler = match.route[type];\n // If we have a route.lazy promise, await that first\n if (loadRoutePromise) {\n if (handler) {\n // Run statically defined handler in parallel with lazy()\n let handlerError;\n let [value] = await Promise.all([\n // If the handler throws, don't let it immediately bubble out,\n // since we need to let the lazy() execution finish so we know if this\n // route has a boundary that can handle the error\n runHandler(handler).catch(e => {\n handlerError = e;\n }), loadRoutePromise]);\n if (handlerError !== undefined) {\n throw handlerError;\n }\n result = value;\n } else {\n // Load lazy route module, then run any returned handler\n await loadRoutePromise;\n handler = match.route[type];\n if (handler) {\n // Handler still runs even if we got interrupted to maintain consistency\n // with un-abortable behavior of handler execution on non-lazy or\n // previously-lazy-loaded routes\n result = await runHandler(handler);\n } else if (type === \"action\") {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(405, {\n method: request.method,\n pathname,\n routeId: match.route.id\n });\n } else {\n // lazy() route has no loader to run. Short circuit here so we don't\n // hit the invariant below that errors on returning undefined.\n return {\n type: ResultType.data,\n result: undefined\n };\n }\n }\n } else if (!handler) {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(404, {\n pathname\n });\n } else {\n result = await runHandler(handler);\n }\n invariant(result.result !== undefined, \"You defined \" + (type === \"action\" ? \"an action\" : \"a loader\") + \" for route \" + (\"\\\"\" + match.route.id + \"\\\" but didn't return anything from your `\" + type + \"` \") + \"function. Please return a value or `null`.\");\n } catch (e) {\n // We should already be catching and converting normal handler executions to\n // DataStrategyResults and returning them, so anything that throws here is an\n // unexpected error we still need to wrap\n return {\n type: ResultType.error,\n result: e\n };\n } finally {\n if (onReject) {\n request.signal.removeEventListener(\"abort\", onReject);\n }\n }\n return result;\n}\nasync function convertDataStrategyResultToDataResult(dataStrategyResult) {\n let {\n result,\n type\n } = dataStrategyResult;\n if (isResponse(result)) {\n let data;\n try {\n let contentType = result.headers.get(\"Content-Type\");\n // Check between word boundaries instead of startsWith() due to the last\n // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type\n if (contentType && /\\bapplication\\/json\\b/.test(contentType)) {\n if (result.body == null) {\n data = null;\n } else {\n data = await result.json();\n }\n } else {\n data = await result.text();\n }\n } catch (e) {\n return {\n type: ResultType.error,\n error: e\n };\n }\n if (type === ResultType.error) {\n return {\n type: ResultType.error,\n error: new ErrorResponseImpl(result.status, result.statusText, data),\n statusCode: result.status,\n headers: result.headers\n };\n }\n return {\n type: ResultType.data,\n data,\n statusCode: result.status,\n headers: result.headers\n };\n }\n if (type === ResultType.error) {\n if (isDataWithResponseInit(result)) {\n var _result$init3, _result$init4;\n if (result.data instanceof Error) {\n var _result$init, _result$init2;\n return {\n type: ResultType.error,\n error: result.data,\n statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,\n headers: (_result$init2 = result.init) != null && _result$init2.headers ? new Headers(result.init.headers) : undefined\n };\n }\n // Convert thrown data() to ErrorResponse instances\n return {\n type: ResultType.error,\n error: new ErrorResponseImpl(((_result$init3 = result.init) == null ? void 0 : _result$init3.status) || 500, undefined, result.data),\n statusCode: isRouteErrorResponse(result) ? result.status : undefined,\n headers: (_result$init4 = result.init) != null && _result$init4.headers ? new Headers(result.init.headers) : undefined\n };\n }\n return {\n type: ResultType.error,\n error: result,\n statusCode: isRouteErrorResponse(result) ? result.status : undefined\n };\n }\n if (isDeferredData(result)) {\n var _result$init5, _result$init6;\n return {\n type: ResultType.deferred,\n deferredData: result,\n statusCode: (_result$init5 = result.init) == null ? void 0 : _result$init5.status,\n headers: ((_result$init6 = result.init) == null ? void 0 : _result$init6.headers) && new Headers(result.init.headers)\n };\n }\n if (isDataWithResponseInit(result)) {\n var _result$init7, _result$init8;\n return {\n type: ResultType.data,\n data: result.data,\n statusCode: (_result$init7 = result.init) == null ? void 0 : _result$init7.status,\n headers: (_result$init8 = result.init) != null && _result$init8.headers ? new Headers(result.init.headers) : undefined\n };\n }\n return {\n type: ResultType.data,\n data: result\n };\n}\n// Support relative routing in internal redirects\nfunction normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename, v7_relativeSplatPath) {\n let location = response.headers.get(\"Location\");\n invariant(location, \"Redirects returned/thrown from loaders/actions must have a Location header\");\n if (!ABSOLUTE_URL_REGEX.test(location)) {\n let trimmedMatches = matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1);\n location = normalizeTo(new URL(request.url), trimmedMatches, basename, true, location, v7_relativeSplatPath);\n response.headers.set(\"Location\", location);\n }\n return response;\n}\nfunction normalizeRedirectLocation(location, currentUrl, basename) {\n if (ABSOLUTE_URL_REGEX.test(location)) {\n // Strip off the protocol+origin for same-origin + same-basename absolute redirects\n let normalizedLocation = location;\n let url = normalizedLocation.startsWith(\"//\") ? new URL(currentUrl.protocol + normalizedLocation) : new URL(normalizedLocation);\n let isSameBasename = stripBasename(url.pathname, basename) != null;\n if (url.origin === currentUrl.origin && isSameBasename) {\n return url.pathname + url.search + url.hash;\n }\n }\n return location;\n}\n// Utility method for creating the Request instances for loaders/actions during\n// client-side navigations and fetches. During SSR we will always have a\n// Request instance from the static handler (query/queryRoute)\nfunction createClientSideRequest(history, location, signal, submission) {\n let url = history.createURL(stripHashFromPath(location)).toString();\n let init = {\n signal\n };\n if (submission && isMutationMethod(submission.formMethod)) {\n let {\n formMethod,\n formEncType\n } = submission;\n // Didn't think we needed this but it turns out unlike other methods, patch\n // won't be properly normalized to uppercase and results in a 405 error.\n // See: https://fetch.spec.whatwg.org/#concept-method\n init.method = formMethod.toUpperCase();\n if (formEncType === \"application/json\") {\n init.headers = new Headers({\n \"Content-Type\": formEncType\n });\n init.body = JSON.stringify(submission.json);\n } else if (formEncType === \"text/plain\") {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.text;\n } else if (formEncType === \"application/x-www-form-urlencoded\" && submission.formData) {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = convertFormDataToSearchParams(submission.formData);\n } else {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.formData;\n }\n }\n return new Request(url, init);\n}\nfunction convertFormDataToSearchParams(formData) {\n let searchParams = new URLSearchParams();\n for (let [key, value] of formData.entries()) {\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs\n searchParams.append(key, typeof value === \"string\" ? value : value.name);\n }\n return searchParams;\n}\nfunction convertSearchParamsToFormData(searchParams) {\n let formData = new FormData();\n for (let [key, value] of searchParams.entries()) {\n formData.append(key, value);\n }\n return formData;\n}\nfunction processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, skipLoaderErrorBubbling) {\n // Fill in loaderData/errors from our loaders\n let loaderData = {};\n let errors = null;\n let statusCode;\n let foundError = false;\n let loaderHeaders = {};\n let pendingError = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : undefined;\n // Process loader results into state.loaderData/state.errors\n matches.forEach(match => {\n if (!(match.route.id in results)) {\n return;\n }\n let id = match.route.id;\n let result = results[id];\n invariant(!isRedirectResult(result), \"Cannot handle redirect results in processLoaderData\");\n if (isErrorResult(result)) {\n let error = result.error;\n // If we have a pending action error, we report it at the highest-route\n // that throws a loader error, and then clear it out to indicate that\n // it was consumed\n if (pendingError !== undefined) {\n error = pendingError;\n pendingError = undefined;\n }\n errors = errors || {};\n if (skipLoaderErrorBubbling) {\n errors[id] = error;\n } else {\n // Look upwards from the matched route for the closest ancestor error\n // boundary, defaulting to the root match. Prefer higher error values\n // if lower errors bubble to the same boundary\n let boundaryMatch = findNearestBoundary(matches, id);\n if (errors[boundaryMatch.route.id] == null) {\n errors[boundaryMatch.route.id] = error;\n }\n }\n // Clear our any prior loaderData for the throwing route\n loaderData[id] = undefined;\n // Once we find our first (highest) error, we set the status code and\n // prevent deeper status codes from overriding\n if (!foundError) {\n foundError = true;\n statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n if (isDeferredResult(result)) {\n activeDeferreds.set(id, result.deferredData);\n loaderData[id] = result.deferredData.data;\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode != null && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n loaderData[id] = result.data;\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n }\n }\n });\n // If we didn't consume the pending action error (i.e., all loaders\n // resolved), then consume it here. Also clear out any loaderData for the\n // throwing route\n if (pendingError !== undefined && pendingActionResult) {\n errors = {\n [pendingActionResult[0]]: pendingError\n };\n loaderData[pendingActionResult[0]] = undefined;\n }\n return {\n loaderData,\n errors,\n statusCode: statusCode || 200,\n loaderHeaders\n };\n}\nfunction processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults, activeDeferreds) {\n let {\n loaderData,\n errors\n } = processRouteLoaderData(matches, results, pendingActionResult, activeDeferreds, false // This method is only called client side so we always want to bubble\n );\n // Process results from our revalidating fetchers\n revalidatingFetchers.forEach(rf => {\n let {\n key,\n match,\n controller\n } = rf;\n let result = fetcherResults[key];\n invariant(result, \"Did not find corresponding fetcher result\");\n // Process fetcher non-redirect errors\n if (controller && controller.signal.aborted) {\n // Nothing to do for aborted fetchers\n return;\n } else if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, match == null ? void 0 : match.route.id);\n if (!(errors && errors[boundaryMatch.route.id])) {\n errors = _extends({}, errors, {\n [boundaryMatch.route.id]: result.error\n });\n }\n state.fetchers.delete(key);\n } else if (isRedirectResult(result)) {\n // Should never get here, redirects should get processed above, but we\n // keep this to type narrow to a success result in the else\n invariant(false, \"Unhandled fetcher revalidation redirect\");\n } else if (isDeferredResult(result)) {\n // Should never get here, deferred data should be awaited for fetchers\n // in resolveDeferredResults\n invariant(false, \"Unhandled fetcher deferred data\");\n } else {\n let doneFetcher = getDoneFetcher(result.data);\n state.fetchers.set(key, doneFetcher);\n }\n });\n return {\n loaderData,\n errors\n };\n}\nfunction mergeLoaderData(loaderData, newLoaderData, matches, errors) {\n let mergedLoaderData = _extends({}, newLoaderData);\n for (let match of matches) {\n let id = match.route.id;\n if (newLoaderData.hasOwnProperty(id)) {\n if (newLoaderData[id] !== undefined) {\n mergedLoaderData[id] = newLoaderData[id];\n }\n } else if (loaderData[id] !== undefined && match.route.loader) {\n // Preserve existing keys not included in newLoaderData and where a loader\n // wasn't removed by HMR\n mergedLoaderData[id] = loaderData[id];\n }\n if (errors && errors.hasOwnProperty(id)) {\n // Don't keep any loader data below the boundary\n break;\n }\n }\n return mergedLoaderData;\n}\nfunction getActionDataForCommit(pendingActionResult) {\n if (!pendingActionResult) {\n return {};\n }\n return isErrorResult(pendingActionResult[1]) ? {\n // Clear out prior actionData on errors\n actionData: {}\n } : {\n actionData: {\n [pendingActionResult[0]]: pendingActionResult[1].data\n }\n };\n}\n// Find the nearest error boundary, looking upwards from the leaf route (or the\n// route specified by routeId) for the closest ancestor error boundary,\n// defaulting to the root match\nfunction findNearestBoundary(matches, routeId) {\n let eligibleMatches = routeId ? matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1) : [...matches];\n return eligibleMatches.reverse().find(m => m.route.hasErrorBoundary === true) || matches[0];\n}\nfunction getShortCircuitMatches(routes) {\n // Prefer a root layout route if present, otherwise shim in a route object\n let route = routes.length === 1 ? routes[0] : routes.find(r => r.index || !r.path || r.path === \"/\") || {\n id: \"__shim-error-route__\"\n };\n return {\n matches: [{\n params: {},\n pathname: \"\",\n pathnameBase: \"\",\n route\n }],\n route\n };\n}\nfunction getInternalRouterError(status, _temp5) {\n let {\n pathname,\n routeId,\n method,\n type,\n message\n } = _temp5 === void 0 ? {} : _temp5;\n let statusText = \"Unknown Server Error\";\n let errorMessage = \"Unknown @remix-run/router error\";\n if (status === 400) {\n statusText = \"Bad Request\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide a `loader` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (type === \"defer-action\") {\n errorMessage = \"defer() is not supported in actions\";\n } else if (type === \"invalid-body\") {\n errorMessage = \"Unable to encode submission body\";\n }\n } else if (status === 403) {\n statusText = \"Forbidden\";\n errorMessage = \"Route \\\"\" + routeId + \"\\\" does not match URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 404) {\n statusText = \"Not Found\";\n errorMessage = \"No route matches URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 405) {\n statusText = \"Method Not Allowed\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method.toUpperCase() + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide an `action` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (method) {\n errorMessage = \"Invalid request method \\\"\" + method.toUpperCase() + \"\\\"\";\n }\n }\n return new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);\n}\n// Find any returned redirect errors, starting from the lowest match\nfunction findRedirect(results) {\n let entries = Object.entries(results);\n for (let i = entries.length - 1; i >= 0; i--) {\n let [key, result] = entries[i];\n if (isRedirectResult(result)) {\n return {\n key,\n result\n };\n }\n }\n}\nfunction stripHashFromPath(path) {\n let parsedPath = typeof path === \"string\" ? parsePath(path) : path;\n return createPath(_extends({}, parsedPath, {\n hash: \"\"\n }));\n}\nfunction isHashChangeOnly(a, b) {\n if (a.pathname !== b.pathname || a.search !== b.search) {\n return false;\n }\n if (a.hash === \"\") {\n // /page -> /page#hash\n return b.hash !== \"\";\n } else if (a.hash === b.hash) {\n // /page#hash -> /page#hash\n return true;\n } else if (b.hash !== \"\") {\n // /page#hash -> /page#other\n return true;\n }\n // If the hash is removed the browser will re-perform a request to the server\n // /page#hash -> /page\n return false;\n}\nfunction isDataStrategyResult(result) {\n return result != null && typeof result === \"object\" && \"type\" in result && \"result\" in result && (result.type === ResultType.data || result.type === ResultType.error);\n}\nfunction isRedirectDataStrategyResultResult(result) {\n return isResponse(result.result) && redirectStatusCodes.has(result.result.status);\n}\nfunction isDeferredResult(result) {\n return result.type === ResultType.deferred;\n}\nfunction isErrorResult(result) {\n return result.type === ResultType.error;\n}\nfunction isRedirectResult(result) {\n return (result && result.type) === ResultType.redirect;\n}\nfunction isDataWithResponseInit(value) {\n return typeof value === \"object\" && value != null && \"type\" in value && \"data\" in value && \"init\" in value && value.type === \"DataWithResponseInit\";\n}\nfunction isDeferredData(value) {\n let deferred = value;\n return deferred && typeof deferred === \"object\" && typeof deferred.data === \"object\" && typeof deferred.subscribe === \"function\" && typeof deferred.cancel === \"function\" && typeof deferred.resolveData === \"function\";\n}\nfunction isResponse(value) {\n return value != null && typeof value.status === \"number\" && typeof value.statusText === \"string\" && typeof value.headers === \"object\" && typeof value.body !== \"undefined\";\n}\nfunction isRedirectResponse(result) {\n if (!isResponse(result)) {\n return false;\n }\n let status = result.status;\n let location = result.headers.get(\"Location\");\n return status >= 300 && status <= 399 && location != null;\n}\nfunction isValidMethod(method) {\n return validRequestMethods.has(method.toLowerCase());\n}\nfunction isMutationMethod(method) {\n return validMutationMethods.has(method.toLowerCase());\n}\nasync function resolveNavigationDeferredResults(matches, results, signal, currentMatches, currentLoaderData) {\n let entries = Object.entries(results);\n for (let index = 0; index < entries.length; index++) {\n let [routeId, result] = entries[index];\n let match = matches.find(m => (m == null ? void 0 : m.route.id) === routeId);\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n let currentMatch = currentMatches.find(m => m.route.id === match.route.id);\n let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== undefined;\n if (isDeferredResult(result) && isRevalidatingLoader) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n await resolveDeferredData(result, signal, false).then(result => {\n if (result) {\n results[routeId] = result;\n }\n });\n }\n }\n}\nasync function resolveFetcherDeferredResults(matches, results, revalidatingFetchers) {\n for (let index = 0; index < revalidatingFetchers.length; index++) {\n let {\n key,\n routeId,\n controller\n } = revalidatingFetchers[index];\n let result = results[key];\n let match = matches.find(m => (m == null ? void 0 : m.route.id) === routeId);\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n if (isDeferredResult(result)) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n invariant(controller, \"Expected an AbortController for revalidating fetcher deferred result\");\n await resolveDeferredData(result, controller.signal, true).then(result => {\n if (result) {\n results[key] = result;\n }\n });\n }\n }\n}\nasync function resolveDeferredData(result, signal, unwrap) {\n if (unwrap === void 0) {\n unwrap = false;\n }\n let aborted = await result.deferredData.resolveData(signal);\n if (aborted) {\n return;\n }\n if (unwrap) {\n try {\n return {\n type: ResultType.data,\n data: result.deferredData.unwrappedData\n };\n } catch (e) {\n // Handle any TrackedPromise._error values encountered while unwrapping\n return {\n type: ResultType.error,\n error: e\n };\n }\n }\n return {\n type: ResultType.data,\n data: result.deferredData.data\n };\n}\nfunction hasNakedIndexQuery(search) {\n return new URLSearchParams(search).getAll(\"index\").some(v => v === \"\");\n}\nfunction getTargetMatch(matches, location) {\n let search = typeof location === \"string\" ? parsePath(location).search : location.search;\n if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || \"\")) {\n // Return the leaf index route when index is present\n return matches[matches.length - 1];\n }\n // Otherwise grab the deepest \"path contributing\" match (ignoring index and\n // pathless layout routes)\n let pathMatches = getPathContributingMatches(matches);\n return pathMatches[pathMatches.length - 1];\n}\nfunction getSubmissionFromNavigation(navigation) {\n let {\n formMethod,\n formAction,\n formEncType,\n text,\n formData,\n json\n } = navigation;\n if (!formMethod || !formAction || !formEncType) {\n return;\n }\n if (text != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json: undefined,\n text\n };\n } else if (formData != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData,\n json: undefined,\n text: undefined\n };\n } else if (json !== undefined) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json,\n text: undefined\n };\n }\n}\nfunction getLoadingNavigation(location, submission) {\n if (submission) {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n } else {\n let navigation = {\n state: \"loading\",\n location,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined\n };\n return navigation;\n }\n}\nfunction getSubmittingNavigation(location, submission) {\n let navigation = {\n state: \"submitting\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text\n };\n return navigation;\n}\nfunction getLoadingFetcher(submission, data) {\n if (submission) {\n let fetcher = {\n state: \"loading\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data\n };\n return fetcher;\n } else {\n let fetcher = {\n state: \"loading\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data\n };\n return fetcher;\n }\n}\nfunction getSubmittingFetcher(submission, existingFetcher) {\n let fetcher = {\n state: \"submitting\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data: existingFetcher ? existingFetcher.data : undefined\n };\n return fetcher;\n}\nfunction getDoneFetcher(data) {\n let fetcher = {\n state: \"idle\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data\n };\n return fetcher;\n}\nfunction restoreAppliedTransitions(_window, transitions) {\n try {\n let sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY);\n if (sessionPositions) {\n let json = JSON.parse(sessionPositions);\n for (let [k, v] of Object.entries(json || {})) {\n if (v && Array.isArray(v)) {\n transitions.set(k, new Set(v || []));\n }\n }\n }\n } catch (e) {\n // no-op, use default empty object\n }\n}\nfunction persistAppliedTransitions(_window, transitions) {\n if (transitions.size > 0) {\n let json = {};\n for (let [k, v] of transitions) {\n json[k] = [...v];\n }\n try {\n _window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json));\n } catch (error) {\n warning(false, \"Failed to save applied view transitions in sessionStorage (\" + error + \").\");\n }\n }\n}\n//#endregion\n\nexport { AbortedDeferredError, Action, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, convertRouteMatchToUiMatch as UNSAFE_convertRouteMatchToUiMatch, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, decodePath as UNSAFE_decodePath, getResolveToMatches as UNSAFE_getResolveToMatches, invariant as UNSAFE_invariant, warning as UNSAFE_warning, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, data, defer, generatePath, getStaticContextFromError, getToPathname, isDataWithResponseInit, isDeferredData, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, redirectDocument, replace, resolvePath, resolveTo, stripBasename };\n//# sourceMappingURL=router.js.map\n","/**\n * React Router v6.30.1\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport * as React from 'react';\nimport { UNSAFE_invariant, joinPaths, matchPath, UNSAFE_decodePath, UNSAFE_getResolveToMatches, UNSAFE_warning, resolveTo, parsePath, matchRoutes, Action, UNSAFE_convertRouteMatchToUiMatch, stripBasename, IDLE_BLOCKER, isRouteErrorResponse, createMemoryHistory, AbortedDeferredError, createRouter } from '@remix-run/router';\nexport { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, resolvePath } from '@remix-run/router';\n\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n// Create react-specific types from the agnostic types in @remix-run/router to\n// export from react-router\nconst DataRouterContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterContext.displayName = \"DataRouter\";\n}\nconst DataRouterStateContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\nconst AwaitContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n AwaitContext.displayName = \"Await\";\n}\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level `` API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\n\nconst NavigationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n NavigationContext.displayName = \"Navigation\";\n}\nconst LocationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n LocationContext.displayName = \"Location\";\n}\nconst RouteContext = /*#__PURE__*/React.createContext({\n outlet: null,\n matches: [],\n isDataRoute: false\n});\nif (process.env.NODE_ENV !== \"production\") {\n RouteContext.displayName = \"Route\";\n}\nconst RouteErrorContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n RouteErrorContext.displayName = \"RouteError\";\n}\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/v6/hooks/use-href\n */\nfunction useHref(to, _temp) {\n let {\n relative\n } = _temp === void 0 ? {} : _temp;\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useHref() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n basename,\n navigator\n } = React.useContext(NavigationContext);\n let {\n hash,\n pathname,\n search\n } = useResolvedPath(to, {\n relative\n });\n let joinedPathname = pathname;\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the href. If this is a root navigation, then just use the raw\n // basename which allows the basename to have full control over the presence\n // of a trailing slash on root links\n if (basename !== \"/\") {\n joinedPathname = pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n }\n return navigator.createHref({\n pathname: joinedPathname,\n search,\n hash\n });\n}\n\n/**\n * Returns true if this component is a descendant of a ``.\n *\n * @see https://reactrouter.com/v6/hooks/use-in-router-context\n */\nfunction useInRouterContext() {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/v6/hooks/use-location\n */\nfunction useLocation() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useLocation() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/v6/hooks/use-navigation-type\n */\nfunction useNavigationType() {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns a PathMatch object if the given pattern matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * ``.\n *\n * @see https://reactrouter.com/v6/hooks/use-match\n */\nfunction useMatch(pattern) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useMatch() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n pathname\n } = useLocation();\n return React.useMemo(() => matchPath(pattern, UNSAFE_decodePath(pathname)), [pathname, pattern]);\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\n\nconst navigateEffectWarning = \"You should call navigate() in a React.useEffect(), not when \" + \"your component is first rendered.\";\n\n// Mute warnings for calls to useNavigate in SSR environments\nfunction useIsomorphicLayoutEffect(cb) {\n let isStatic = React.useContext(NavigationContext).static;\n if (!isStatic) {\n // We should be able to get rid of this once react 18.3 is released\n // See: https://github.com/facebook/react/pull/26395\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(cb);\n }\n}\n\n/**\n * Returns an imperative method for changing the location. Used by ``s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/v6/hooks/use-navigate\n */\nfunction useNavigate() {\n let {\n isDataRoute\n } = React.useContext(RouteContext);\n // Conditional usage is OK here because the usage of a data router is static\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return isDataRoute ? useNavigateStable() : useNavigateUnstable();\n}\nfunction useNavigateUnstable() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useNavigate() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let dataRouterContext = React.useContext(DataRouterContext);\n let {\n basename,\n future,\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our history listener yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === \"path\");\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to handing off to history (but only if we're not in a data router,\n // otherwise it'll prepend the basename inside of the router).\n // If this is a root navigation, then we navigate to the raw basename\n // which allows the basename to have full control over the presence of a\n // trailing slash on root links\n if (dataRouterContext == null && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);\n }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);\n return navigate;\n}\nconst OutletContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/v6/hooks/use-outlet-context\n */\nfunction useOutletContext() {\n return React.useContext(OutletContext);\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by `` to render child routes.\n *\n * @see https://reactrouter.com/v6/hooks/use-outlet\n */\nfunction useOutlet(context) {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return /*#__PURE__*/React.createElement(OutletContext.Provider, {\n value: context\n }, outlet);\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/v6/hooks/use-params\n */\nfunction useParams() {\n let {\n matches\n } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? routeMatch.params : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/v6/hooks/use-resolved-path\n */\nfunction useResolvedPath(to, _temp2) {\n let {\n relative\n } = _temp2 === void 0 ? {} : _temp2;\n let {\n future\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));\n return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === \"path\"), [to, routePathnamesJson, locationPathname, relative]);\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an `` to render their child route's\n * element.\n *\n * @see https://reactrouter.com/v6/hooks/use-routes\n */\nfunction useRoutes(routes, locationArg) {\n return useRoutesImpl(routes, locationArg);\n}\n\n// Internal implementation with accept optional param for RouterProvider usage\nfunction useRoutesImpl(routes, locationArg, dataRouterState, future) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useRoutes() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches: parentMatches\n } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n if (process.env.NODE_ENV !== \"production\") {\n // You won't get a warning about 2 different under a \n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // \n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // } />\n // } />\n // \n //\n // function Blog() {\n // return (\n // \n // } />\n // \n // );\n // }\n let parentPath = parentRoute && parentRoute.path || \"\";\n warningOnce(parentPathname, !parentRoute || parentPath.endsWith(\"*\"), \"You rendered descendant (or called `useRoutes()`) at \" + (\"\\\"\" + parentPathname + \"\\\" (under ) but the \") + \"parent route path has no trailing \\\"*\\\". This means if you navigate \" + \"deeper, the parent won't match anymore and therefore the child \" + \"routes will never render.\\n\\n\" + (\"Please change the parent to .\"));\n }\n let locationFromContext = useLocation();\n let location;\n if (locationArg) {\n var _parsedLocationArg$pa;\n let parsedLocationArg = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n !(parentPathnameBase === \"/\" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"When overriding the location using `` or `useRoutes(routes, location)`, \" + \"the location pathname must begin with the portion of the URL pathname that was \" + (\"matched by all parent routes. The current pathname base is \\\"\" + parentPathnameBase + \"\\\" \") + (\"but pathname \\\"\" + parsedLocationArg.pathname + \"\\\" was given in the `location` prop.\")) : UNSAFE_invariant(false) : void 0;\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n let pathname = location.pathname || \"/\";\n let remainingPathname = pathname;\n if (parentPathnameBase !== \"/\") {\n // Determine the remaining pathname by removing the # of URL segments the\n // parentPathnameBase has, instead of removing based on character count.\n // This is because we can't guarantee that incoming/outgoing encodings/\n // decodings will match exactly.\n // We decode paths before matching on a per-segment basis with\n // decodeURIComponent(), but we re-encode pathnames via `new URL()` so they\n // match what `window.location.pathname` would reflect. Those don't 100%\n // align when it comes to encoded URI characters such as % and &.\n //\n // So we may end up with:\n // pathname: \"/descendant/a%25b/match\"\n // parentPathnameBase: \"/descendant/a%b\"\n //\n // And the direct substring removal approach won't work :/\n let parentSegments = parentPathnameBase.replace(/^\\//, \"\").split(\"/\");\n let segments = pathname.replace(/^\\//, \"\").split(\"/\");\n remainingPathname = \"/\" + segments.slice(parentSegments.length).join(\"/\");\n }\n let matches = matchRoutes(routes, {\n pathname: remainingPathname\n });\n if (process.env.NODE_ENV !== \"production\") {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(parentRoute || matches != null, \"No routes matched location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \") : void 0;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined || matches[matches.length - 1].route.lazy !== undefined, \"Matched leaf route at location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \" + \"does not have an element or Component. This means it will render an with a \" + \"null value by default resulting in an \\\"empty\\\" page.\") : void 0;\n }\n let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),\n pathnameBase: match.pathnameBase === \"/\" ? parentPathnameBase : joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])\n })), parentMatches, dataRouterState, future);\n\n // When a user passes in a `locationArg`, the associated routes need to\n // be wrapped in a new `LocationContext.Provider` in order for `useLocation`\n // to use the scoped location instead of the global location.\n if (locationArg && renderedMatches) {\n return /*#__PURE__*/React.createElement(LocationContext.Provider, {\n value: {\n location: _extends({\n pathname: \"/\",\n search: \"\",\n hash: \"\",\n state: null,\n key: \"default\"\n }, location),\n navigationType: Action.Pop\n }\n }, renderedMatches);\n }\n return renderedMatches;\n}\nfunction DefaultErrorComponent() {\n let error = useRouteError();\n let message = isRouteErrorResponse(error) ? error.status + \" \" + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);\n let stack = error instanceof Error ? error.stack : null;\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = {\n padding: \"0.5rem\",\n backgroundColor: lightgrey\n };\n let codeStyles = {\n padding: \"2px 4px\",\n backgroundColor: lightgrey\n };\n let devInfo = null;\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Error handled by React Router default ErrorBoundary:\", error);\n devInfo = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"p\", null, \"\\uD83D\\uDCBF Hey developer \\uD83D\\uDC4B\"), /*#__PURE__*/React.createElement(\"p\", null, \"You can provide a way better UX than this when your app throws errors by providing your own \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"ErrorBoundary\"), \" or\", \" \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"errorElement\"), \" prop on your route.\"));\n }\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"h2\", null, \"Unexpected Application Error!\"), /*#__PURE__*/React.createElement(\"h3\", {\n style: {\n fontStyle: \"italic\"\n }\n }, message), stack ? /*#__PURE__*/React.createElement(\"pre\", {\n style: preStyles\n }, stack) : null, devInfo);\n}\nconst defaultErrorElement = /*#__PURE__*/React.createElement(DefaultErrorComponent, null);\nclass RenderErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n location: props.location,\n revalidation: props.revalidation,\n error: props.error\n };\n }\n static getDerivedStateFromError(error) {\n return {\n error: error\n };\n }\n static getDerivedStateFromProps(props, state) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (state.location !== props.location || state.revalidation !== \"idle\" && props.revalidation === \"idle\") {\n return {\n error: props.error,\n location: props.location,\n revalidation: props.revalidation\n };\n }\n\n // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n return {\n error: props.error !== undefined ? props.error : state.error,\n location: state.location,\n revalidation: props.revalidation || state.revalidation\n };\n }\n componentDidCatch(error, errorInfo) {\n console.error(\"React Router caught the following error during render\", error, errorInfo);\n }\n render() {\n return this.state.error !== undefined ? /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: this.props.routeContext\n }, /*#__PURE__*/React.createElement(RouteErrorContext.Provider, {\n value: this.state.error,\n children: this.props.component\n })) : this.props.children;\n }\n}\nfunction RenderedRoute(_ref) {\n let {\n routeContext,\n match,\n children\n } = _ref;\n let dataRouterContext = React.useContext(DataRouterContext);\n\n // Track how deep we got in our render pass to emulate SSR componentDidCatch\n // in a DataStaticRouter\n if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {\n dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;\n }\n return /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: routeContext\n }, children);\n}\nfunction _renderMatches(matches, parentMatches, dataRouterState, future) {\n var _dataRouterState;\n if (parentMatches === void 0) {\n parentMatches = [];\n }\n if (dataRouterState === void 0) {\n dataRouterState = null;\n }\n if (future === void 0) {\n future = null;\n }\n if (matches == null) {\n var _future;\n if (!dataRouterState) {\n return null;\n }\n if (dataRouterState.errors) {\n // Don't bail if we have data router errors so we can render them in the\n // boundary. Use the pre-matched (or shimmed) matches\n matches = dataRouterState.matches;\n } else if ((_future = future) != null && _future.v7_partialHydration && parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {\n // Don't bail if we're initializing with partial hydration and we have\n // router matches. That means we're actively running `patchRoutesOnNavigation`\n // so we should render down the partial matches to the appropriate\n // `HydrateFallback`. We only do this if `parentMatches` is empty so it\n // only impacts the root matches for `RouterProvider` and no descendant\n // ``\n matches = dataRouterState.matches;\n } else {\n return null;\n }\n }\n let renderedMatches = matches;\n\n // If we have data errors, trim matches to the highest error boundary\n let errors = (_dataRouterState = dataRouterState) == null ? void 0 : _dataRouterState.errors;\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]) !== undefined);\n !(errorIndex >= 0) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"Could not find a matching route for errors on route IDs: \" + Object.keys(errors).join(\",\")) : UNSAFE_invariant(false) : void 0;\n renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));\n }\n\n // If we're in a partial hydration mode, detect if we need to render down to\n // a given HydrateFallback while we load the rest of the hydration data\n let renderFallback = false;\n let fallbackIndex = -1;\n if (dataRouterState && future && future.v7_partialHydration) {\n for (let i = 0; i < renderedMatches.length; i++) {\n let match = renderedMatches[i];\n // Track the deepest fallback up until the first route without data\n if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {\n fallbackIndex = i;\n }\n if (match.route.id) {\n let {\n loaderData,\n errors\n } = dataRouterState;\n let needsToRunLoader = match.route.loader && loaderData[match.route.id] === undefined && (!errors || errors[match.route.id] === undefined);\n if (match.route.lazy || needsToRunLoader) {\n // We found the first route that's not ready to render (waiting on\n // lazy, or has a loader that hasn't run yet). Flag that we need to\n // render a fallback and render up until the appropriate fallback\n renderFallback = true;\n if (fallbackIndex >= 0) {\n renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);\n } else {\n renderedMatches = [renderedMatches[0]];\n }\n break;\n }\n }\n }\n }\n return renderedMatches.reduceRight((outlet, match, index) => {\n // Only data routers handle errors/fallbacks\n let error;\n let shouldRenderHydrateFallback = false;\n let errorElement = null;\n let hydrateFallbackElement = null;\n if (dataRouterState) {\n error = errors && match.route.id ? errors[match.route.id] : undefined;\n errorElement = match.route.errorElement || defaultErrorElement;\n if (renderFallback) {\n if (fallbackIndex < 0 && index === 0) {\n warningOnce(\"route-fallback\", false, \"No `HydrateFallback` element provided to render during initial hydration\");\n shouldRenderHydrateFallback = true;\n hydrateFallbackElement = null;\n } else if (fallbackIndex === index) {\n shouldRenderHydrateFallback = true;\n hydrateFallbackElement = match.route.hydrateFallbackElement || null;\n }\n }\n }\n let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));\n let getChildren = () => {\n let children;\n if (error) {\n children = errorElement;\n } else if (shouldRenderHydrateFallback) {\n children = hydrateFallbackElement;\n } else if (match.route.Component) {\n // Note: This is a de-optimized path since React won't re-use the\n // ReactElement since it's identity changes with each new\n // React.createElement call. We keep this so folks can use\n // `` in `` but generally `Component`\n // usage is only advised in `RouterProvider` when we can convert it to\n // `element` ahead of time.\n children = /*#__PURE__*/React.createElement(match.route.Component, null);\n } else if (match.route.element) {\n children = match.route.element;\n } else {\n children = outlet;\n }\n return /*#__PURE__*/React.createElement(RenderedRoute, {\n match: match,\n routeContext: {\n outlet,\n matches,\n isDataRoute: dataRouterState != null\n },\n children: children\n });\n };\n // Only wrap in an error boundary within data router usages when we have an\n // ErrorBoundary/errorElement on this route. Otherwise let it bubble up to\n // an ancestor ErrorBoundary/errorElement\n return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /*#__PURE__*/React.createElement(RenderErrorBoundary, {\n location: dataRouterState.location,\n revalidation: dataRouterState.revalidation,\n component: errorElement,\n error: error,\n children: getChildren(),\n routeContext: {\n outlet: null,\n matches,\n isDataRoute: true\n }\n }) : getChildren();\n }, null);\n}\nvar DataRouterHook = /*#__PURE__*/function (DataRouterHook) {\n DataRouterHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterHook[\"UseNavigateStable\"] = \"useNavigate\";\n return DataRouterHook;\n}(DataRouterHook || {});\nvar DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {\n DataRouterStateHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterStateHook[\"UseLoaderData\"] = \"useLoaderData\";\n DataRouterStateHook[\"UseActionData\"] = \"useActionData\";\n DataRouterStateHook[\"UseRouteError\"] = \"useRouteError\";\n DataRouterStateHook[\"UseNavigation\"] = \"useNavigation\";\n DataRouterStateHook[\"UseRouteLoaderData\"] = \"useRouteLoaderData\";\n DataRouterStateHook[\"UseMatches\"] = \"useMatches\";\n DataRouterStateHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterStateHook[\"UseNavigateStable\"] = \"useNavigate\";\n DataRouterStateHook[\"UseRouteId\"] = \"useRouteId\";\n return DataRouterStateHook;\n}(DataRouterStateHook || {});\nfunction getDataRouterConsoleError(hookName) {\n return hookName + \" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.\";\n}\nfunction useDataRouterContext(hookName) {\n let ctx = React.useContext(DataRouterContext);\n !ctx ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return ctx;\n}\nfunction useDataRouterState(hookName) {\n let state = React.useContext(DataRouterStateContext);\n !state ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return state;\n}\nfunction useRouteContext(hookName) {\n let route = React.useContext(RouteContext);\n !route ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return route;\n}\n\n// Internal version with hookName-aware debugging\nfunction useCurrentRouteId(hookName) {\n let route = useRouteContext(hookName);\n let thisRoute = route.matches[route.matches.length - 1];\n !thisRoute.route.id ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, hookName + \" can only be used on routes that contain a unique \\\"id\\\"\") : UNSAFE_invariant(false) : void 0;\n return thisRoute.route.id;\n}\n\n/**\n * Returns the ID for the nearest contextual route\n */\nfunction useRouteId() {\n return useCurrentRouteId(DataRouterStateHook.UseRouteId);\n}\n\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\nfunction useNavigation() {\n let state = useDataRouterState(DataRouterStateHook.UseNavigation);\n return state.navigation;\n}\n\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\nfunction useRevalidator() {\n let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);\n let state = useDataRouterState(DataRouterStateHook.UseRevalidator);\n return React.useMemo(() => ({\n revalidate: dataRouterContext.router.revalidate,\n state: state.revalidation\n }), [dataRouterContext.router.revalidate, state.revalidation]);\n}\n\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\nfunction useMatches() {\n let {\n matches,\n loaderData\n } = useDataRouterState(DataRouterStateHook.UseMatches);\n return React.useMemo(() => matches.map(m => UNSAFE_convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);\n}\n\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\nfunction useLoaderData() {\n let state = useDataRouterState(DataRouterStateHook.UseLoaderData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n if (state.errors && state.errors[routeId] != null) {\n console.error(\"You cannot `useLoaderData` in an errorElement (routeId: \" + routeId + \")\");\n return undefined;\n }\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the loaderData for the given routeId\n */\nfunction useRouteLoaderData(routeId) {\n let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the action data for the nearest ancestor Route action\n */\nfunction useActionData() {\n let state = useDataRouterState(DataRouterStateHook.UseActionData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n return state.actionData ? state.actionData[routeId] : undefined;\n}\n\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * ErrorBoundary/errorElement to display a proper error message.\n */\nfunction useRouteError() {\n var _state$errors;\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterStateHook.UseRouteError);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);\n\n // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n if (error !== undefined) {\n return error;\n }\n\n // Otherwise look for errors from our data router state\n return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];\n}\n\n/**\n * Returns the happy-path data from the nearest ancestor `` value\n */\nfunction useAsyncValue() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._data;\n}\n\n/**\n * Returns the error from the nearest ancestor `` value\n */\nfunction useAsyncError() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._error;\n}\nlet blockerId = 0;\n\n/**\n * Allow the application to block navigations within the SPA and present the\n * user a confirmation dialog to confirm the navigation. Mostly used to avoid\n * using half-filled form data. This does not handle hard-reloads or\n * cross-origin navigations.\n */\nfunction useBlocker(shouldBlock) {\n let {\n router,\n basename\n } = useDataRouterContext(DataRouterHook.UseBlocker);\n let state = useDataRouterState(DataRouterStateHook.UseBlocker);\n let [blockerKey, setBlockerKey] = React.useState(\"\");\n let blockerFunction = React.useCallback(arg => {\n if (typeof shouldBlock !== \"function\") {\n return !!shouldBlock;\n }\n if (basename === \"/\") {\n return shouldBlock(arg);\n }\n\n // If they provided us a function and we've got an active basename, strip\n // it from the locations we expose to the user to match the behavior of\n // useLocation\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = arg;\n return shouldBlock({\n currentLocation: _extends({}, currentLocation, {\n pathname: stripBasename(currentLocation.pathname, basename) || currentLocation.pathname\n }),\n nextLocation: _extends({}, nextLocation, {\n pathname: stripBasename(nextLocation.pathname, basename) || nextLocation.pathname\n }),\n historyAction\n });\n }, [basename, shouldBlock]);\n\n // This effect is in charge of blocker key assignment and deletion (which is\n // tightly coupled to the key)\n React.useEffect(() => {\n let key = String(++blockerId);\n setBlockerKey(key);\n return () => router.deleteBlocker(key);\n }, [router]);\n\n // This effect handles assigning the blockerFunction. This is to handle\n // unstable blocker function identities, and happens only after the prior\n // effect so we don't get an orphaned blockerFunction in the router with a\n // key of \"\". Until then we just have the IDLE_BLOCKER.\n React.useEffect(() => {\n if (blockerKey !== \"\") {\n router.getBlocker(blockerKey, blockerFunction);\n }\n }, [router, blockerKey, blockerFunction]);\n\n // Prefer the blocker from `state` not `router.state` since DataRouterContext\n // is memoized so this ensures we update on blocker state updates\n return blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : IDLE_BLOCKER;\n}\n\n/**\n * Stable version of useNavigate that is used when we are in the context of\n * a RouterProvider.\n */\nfunction useNavigateStable() {\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseNavigateStable);\n let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our router subscriber yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n router.navigate(to);\n } else {\n router.navigate(to, _extends({\n fromRouteId: id\n }, options));\n }\n }, [router, id]);\n return navigate;\n}\nconst alreadyWarned$1 = {};\nfunction warningOnce(key, cond, message) {\n if (!cond && !alreadyWarned$1[key]) {\n alreadyWarned$1[key] = true;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, message) : void 0;\n }\n}\n\nconst alreadyWarned = {};\nfunction warnOnce(key, message) {\n if (process.env.NODE_ENV !== \"production\" && !alreadyWarned[message]) {\n alreadyWarned[message] = true;\n console.warn(message);\n }\n}\nconst logDeprecation = (flag, msg, link) => warnOnce(flag, \"\\u26A0\\uFE0F React Router Future Flag Warning: \" + msg + \". \" + (\"You can use the `\" + flag + \"` future flag to opt-in early. \") + (\"For more information, see \" + link + \".\"));\nfunction logV6DeprecationWarnings(renderFuture, routerFuture) {\n if ((renderFuture == null ? void 0 : renderFuture.v7_startTransition) === undefined) {\n logDeprecation(\"v7_startTransition\", \"React Router will begin wrapping state updates in `React.startTransition` in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_starttransition\");\n }\n if ((renderFuture == null ? void 0 : renderFuture.v7_relativeSplatPath) === undefined && (!routerFuture || routerFuture.v7_relativeSplatPath === undefined)) {\n logDeprecation(\"v7_relativeSplatPath\", \"Relative route resolution within Splat routes is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath\");\n }\n if (routerFuture) {\n if (routerFuture.v7_fetcherPersist === undefined) {\n logDeprecation(\"v7_fetcherPersist\", \"The persistence behavior of fetchers is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist\");\n }\n if (routerFuture.v7_normalizeFormMethod === undefined) {\n logDeprecation(\"v7_normalizeFormMethod\", \"Casing of `formMethod` fields is being normalized to uppercase in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod\");\n }\n if (routerFuture.v7_partialHydration === undefined) {\n logDeprecation(\"v7_partialHydration\", \"`RouterProvider` hydration behavior is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_partialhydration\");\n }\n if (routerFuture.v7_skipActionErrorRevalidation === undefined) {\n logDeprecation(\"v7_skipActionErrorRevalidation\", \"The revalidation behavior after 4xx/5xx `action` responses is changing in v7\", \"https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation\");\n }\n }\n}\n\n/**\n Webpack + React 17 fails to compile on any of the following because webpack\n complains that `startTransition` doesn't exist in `React`:\n * import { startTransition } from \"react\"\n * import * as React from from \"react\";\n \"startTransition\" in React ? React.startTransition(() => setState()) : setState()\n * import * as React from from \"react\";\n \"startTransition\" in React ? React[\"startTransition\"](() => setState()) : setState()\n\n Moving it to a constant such as the following solves the Webpack/React 17 issue:\n * import * as React from from \"react\";\n const START_TRANSITION = \"startTransition\";\n START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()\n\n However, that introduces webpack/terser minification issues in production builds\n in React 18 where minification/obfuscation ends up removing the call of\n React.startTransition entirely from the first half of the ternary. Grabbing\n this exported reference once up front resolves that issue.\n\n See https://github.com/remix-run/react-router/issues/10579\n*/\nconst START_TRANSITION = \"startTransition\";\nconst startTransitionImpl = React[START_TRANSITION];\n\n/**\n * Given a Remix Router instance, render the appropriate UI\n */\nfunction RouterProvider(_ref) {\n let {\n fallbackElement,\n router,\n future\n } = _ref;\n let [state, setStateImpl] = React.useState(router.state);\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n if (v7_startTransition && startTransitionImpl) {\n startTransitionImpl(() => setStateImpl(newState));\n } else {\n setStateImpl(newState);\n }\n }, [setStateImpl, v7_startTransition]);\n\n // Need to use a layout effect here so we are subscribed early enough to\n // pick up on any render-driven redirects/navigations (useEffect/)\n React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);\n React.useEffect(() => {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, \"`` is deprecated when using \" + \"`v7_partialHydration`, use a `HydrateFallback` component instead\") : void 0;\n // Only log this once on initial mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n let navigator = React.useMemo(() => {\n return {\n createHref: router.createHref,\n encodeLocation: router.encodeLocation,\n go: n => router.navigate(n),\n push: (to, state, opts) => router.navigate(to, {\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n }),\n replace: (to, state, opts) => router.navigate(to, {\n replace: true,\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n })\n };\n }, [router]);\n let basename = router.basename || \"/\";\n let dataRouterContext = React.useMemo(() => ({\n router,\n navigator,\n static: false,\n basename\n }), [router, navigator, basename]);\n React.useEffect(() => logV6DeprecationWarnings(future, router.future), [router, future]);\n\n // The fragment and {null} here are important! We need them to keep React 18's\n // useId happy when we are server-rendering since we may have a - - - -
- - diff --git a/favicon.png b/favicon.png new file mode 100644 index 0000000..0ad5ec4 Binary files /dev/null and b/favicon.png differ diff --git a/index.html b/index.html index 744f081..b2db83d 100644 --- a/index.html +++ b/index.html @@ -2,9 +2,9 @@ - + - ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ + MindScape
diff --git a/package-lock.json b/package-lock.json index 02fd827..86ff435 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@radix-ui/react-separator": "^1.1.7", "@radix-ui/react-tabs": "^1.1.12", "@radix-ui/react-toast": "^1.2.14", + "axios": "^1.11.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "lucide-react": "^0.525.0", @@ -1847,6 +1848,12 @@ "dev": true, "license": "MIT" }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, "node_modules/autoprefixer": { "version": "10.4.14", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.14.tgz", @@ -1881,6 +1888,17 @@ "postcss": "^8.1.0" } }, + "node_modules/axios": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz", + "integrity": "sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.4", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1957,6 +1975,19 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/camelcase-css": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", @@ -2067,6 +2098,18 @@ "dev": true, "license": "MIT" }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/commander": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", @@ -2130,6 +2173,15 @@ } } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", @@ -2144,6 +2196,20 @@ "dev": true, "license": "MIT" }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -2165,6 +2231,51 @@ "dev": true, "license": "MIT" }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/esbuild": { "version": "0.25.6", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.6.tgz", @@ -2270,6 +2381,26 @@ "node": ">=8" } }, + "node_modules/follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/foreground-child": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", @@ -2287,6 +2418,22 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/form-data": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", + "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fraction.js": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", @@ -2320,7 +2467,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2336,6 +2482,43 @@ "node": ">=6.9.0" } }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/glob": { "version": "10.4.5", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", @@ -2370,11 +2553,49 @@ "node": ">=10.13.0" } }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/hasown": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, "license": "MIT", "dependencies": { "function-bind": "^1.1.2" @@ -2568,6 +2789,15 @@ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -2592,6 +2822,27 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", @@ -2939,6 +3190,12 @@ "dev": true, "license": "MIT" }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", diff --git a/package.json b/package.json index 2b1123d..a393897 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "@radix-ui/react-separator": "^1.1.7", "@radix-ui/react-tabs": "^1.1.12", "@radix-ui/react-toast": "^1.2.14", + "axios": "^1.11.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "lucide-react": "^0.525.0", diff --git a/public/logo-dark.png b/public/logo-dark.png new file mode 100644 index 0000000..507cacc Binary files /dev/null and b/public/logo-dark.png differ diff --git a/public/logo.png b/public/logo.png new file mode 100644 index 0000000..958be81 Binary files /dev/null and b/public/logo.png differ diff --git a/public/no-image.png b/public/no-image.png new file mode 100644 index 0000000..38047dd Binary files /dev/null and b/public/no-image.png differ diff --git a/src/App.jsx b/src/App.jsx index 227eefc..35c8268 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,17 +1,26 @@ -import React from "react" +// src/App.jsx + +import React, { useEffect } from "react" import { BrowserRouter as Router, Routes, Route } from "react-router-dom" import { AuthProvider } from "./components/auth-provider" import { Toaster } from "./components/ui/toaster" +import { getInitialTheme, setTheme } from "./utils/theme" -// ํŽ˜์ด์ง€ ์ปดํฌ๋„ŒํŠธ ์ž„ํฌํŠธ +// ํŽ˜์ด์ง€ ์ปดํฌ๋„ŒํŠธ import HomePage from "./pages/HomePage" import TestPage from "./pages/TestPage" import ResultPage from "./pages/ResultPage" +import SharedResultPage from "./pages/SharedResultPage" import MyPage from "./pages/MyPage" import LoginPage from "./pages/LoginPage" import RegisterPage from "./pages/RegisterPage" function App() { + useEffect(() => { + const initialTheme = getInitialTheme() + setTheme(initialTheme) + }, []) + return ( @@ -19,6 +28,7 @@ function App() { } /> } /> } /> + } /> } /> } /> } /> diff --git a/src/components/auth-provider.jsx b/src/components/auth-provider.jsx index fdafd5a..a5bc78b 100644 --- a/src/components/auth-provider.jsx +++ b/src/components/auth-provider.jsx @@ -1,9 +1,8 @@ "use client" import React, { createContext, useContext, useState, useEffect } from "react" -import { authAPI } from "../lib/api" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { getCookie, deleteCookie } from "../lib/cookie-utils" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { TEST_ACCOUNTS, MOCK_TEST_HISTORY } from "../lib/mock-data" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ +import { authAPI } from "../lib/api" +import { TEST_ACCOUNTS, MOCK_TEST_HISTORY } from "../lib/mock-data" const AuthContext = createContext(undefined) @@ -17,77 +16,59 @@ export function AuthProvider({ children }) { const checkAuthStatus = async () => { try { - const token = getCookie("auth-token") - if (token) { - const userData = await authAPI.getCurrentUser() + const userData = await authAPI.getCurrentUser() + if (userData) { + console.log("โœ… ๋กœ๊ทธ์ธ๋œ ์‚ฌ์šฉ์ž:", userData.username) setUser(userData) + } else { + // ๋ฐฑ์—”๋“œ๊ฐ€ ์—†์„ ๊ฒฝ์šฐ ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€ ํ™•์ธ + const savedUser = localStorage.getItem("dev-user") + if (savedUser) { + console.log("๐Ÿ’พ ๊ฐœ๋ฐœ ๋ชจ๋“œ: ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€์—์„œ ์‚ฌ์šฉ์ž ์ •๋ณด ๋ณต์›") + setUser(JSON.parse(savedUser)) + } } } catch (error) { - console.log("Backend API not available, checking local storage for dev user...") - - // ๋ฐฑ์—”๋“œ๊ฐ€ ์—†์„ ๊ฒฝ์šฐ ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€ ํ™•์ธ - const savedUser = localStorage.getItem("dev-user") - if (savedUser) { - setUser(JSON.parse(savedUser)) + if (error.message !== "Unauthorized") { + console.error("โŒ ์ธ์ฆ ์ƒํƒœ ํ™•์ธ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ:", error) } + setUser(null) } finally { setIsLoading(false) } } - const login = async (email, password) => { + const login = async (accountId, password) => { try { - // ๋จผ์ € ๋ฐฑ์—”๋“œ API ์‹œ๋„ - const response = await authAPI.login(email, password) - if (response.success) { - setUser(response.user) - return true - } + const response = await authAPI.login(accountId, password) + console.log("Login response:", response) // ๋””๋ฒ„๊น…์šฉ + + if (response.success && response.user) { + // ๋กœ๊ทธ์ธ ์„ฑ๊ณต ํ›„ ์‚ฌ์šฉ์ž ์ •๋ณด ๋‹ค์‹œ ์กฐํšŒ + console.log("๋กœ๊ทธ์ธ:", response.user.username) + setUser(response.user) + return true + } } catch (error) { - console.log("Backend API not available, trying test accounts...") + console.log("Login failed, trying test accounts...") // ๋ฐฑ์—”๋“œ๊ฐ€ ์—†์„ ๊ฒฝ์šฐ ํ…Œ์ŠคํŠธ ๊ณ„์ •์œผ๋กœ fallback - const testAccount = TEST_ACCOUNTS.find((account) => account.email === email && account.password === password) + const testAccount = TEST_ACCOUNTS.find( + (account) => account.username === accountId && account.password === password + ) if (testAccount) { const userData = { id: testAccount.id, name: testAccount.name, - email: testAccount.email, - personality: "์™ธํ–ฅ์  ๋ฆฌ๋”ํ˜•", // ํ…Œ์ŠคํŠธ ๊ณ„์ •์˜ ๊ธฐ๋ณธ ์„ฑํ–ฅ + username: testAccount.username, + personality: "์™ธํ–ฅ์  ๋ฆฌ๋”ํ˜•", } setUser(userData) - - // ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€์— ์ž„์‹œ ์ €์žฅ (๊ฐœ๋ฐœ์šฉ) localStorage.setItem("dev-user", JSON.stringify(userData)) localStorage.setItem("dev-test-history", JSON.stringify(MOCK_TEST_HISTORY)) - - return true - } - } - return false - } - - const register = async (name, email, password) => { - try { - const response = await authAPI.register(name, email, password) - if (response.success) { - setUser(response.user) return true } - } catch (error) { - console.log("Backend API not available, creating test account...") - - // ๋ฐฑ์—”๋“œ๊ฐ€ ์—†์„ ๊ฒฝ์šฐ ์ž„์‹œ ๊ณ„์ • ์ƒ์„ฑ - const userData = { - id: Date.now().toString(), - name: name, - email: email, - personality: null, - } - setUser(userData) - localStorage.setItem("dev-user", JSON.stringify(userData)) - return true } return false } @@ -98,16 +79,14 @@ export function AuthProvider({ children }) { } catch (error) { console.error("Logout failed:", error) } finally { - // ํด๋ผ์ด์–ธํŠธ ์ƒํƒœ ์ดˆ๊ธฐํ™” setUser(null) - deleteCookie("auth-token") - localStorage.removeItem("dev-user") // ๊ฐœ๋ฐœ์šฉ ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€๋„ ์‚ญ์ œ - localStorage.removeItem("dev-test-history") // ๊ฐœ๋ฐœ์šฉ ํ…Œ์ŠคํŠธ ํžˆ์Šคํ† ๋ฆฌ๋„ ์‚ญ์ œ + localStorage.removeItem("dev-user") + localStorage.removeItem("dev-test-history") } } return ( - + {children} ) diff --git a/src/components/header.jsx b/src/components/header.jsx index 887db2a..d6fd96b 100644 --- a/src/components/header.jsx +++ b/src/components/header.jsx @@ -1,30 +1,64 @@ "use client" -import React from "react" +import React, { useEffect, useState } from "react" import { Link, useNavigate } from "react-router-dom" import { useAuth } from "./auth-provider" import { Button } from "./ui/button" +import { getInitialTheme, setTheme } from "../utils/theme" export function Header() { const { user, logout } = useAuth() const navigate = useNavigate() + const [theme, setThemeState] = useState("light") + + useEffect(() => { + const initialTheme = getInitialTheme() + setTheme(initialTheme) + setThemeState(initialTheme) + }, []) + + const toggleTheme = () => { + const newTheme = theme === "dark" ? "light" : "dark" + setTheme(newTheme) + setThemeState(newTheme) + } + const handleLogout = () => { logout() navigate("/") } return ( -
-
- - ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ - +
+
+
+ +
+ ๋กœ๊ณ  +
+ + + {/* ๋‹คํฌ๋ชจ๋“œ ํ† ๊ธ€ ๋ฒ„ํŠผ - ๋กœ๊ณ  ์˜† */} + +
{user ? ( <> - ์•ˆ๋…•ํ•˜์„ธ์š”, {user.name}๋‹˜ + + ์•ˆ๋…•ํ•˜์„ธ์š”, {user.username}๋‹˜ +
) -} \ No newline at end of file +} diff --git a/src/components/search/SearchDrawer.jsx b/src/components/search/SearchDrawer.jsx new file mode 100644 index 0000000..3a2bd38 --- /dev/null +++ b/src/components/search/SearchDrawer.jsx @@ -0,0 +1,238 @@ +// src/components/search/SearchDrawer.jsx +import React, { useEffect, useState, useRef } from "react" +import { contentAPI } from "../../lib/api" // axios ์ธ์Šคํ„ด์Šค (ํ”„๋กœ์ ํŠธ์— ์ด๋ฏธ ์žˆ์Œ) +const noImage = "/no-image.png"; + +export default function SearchDrawer({ open, onClose }) { + const [type, setType] = useState("movie") // movie | book | music + const [q, setQ] = useState("") + const [loading, setLoading] = useState(false) + const [items, setItems] = useState([]) + const [error, setError] = useState("") + const [hasSearched, setHasSearched] = useState(false); + const lastReqId = useRef(0); // โœ… ์ถ”๊ฐ€: ์ตœ์‹  ์š”์ฒญ ํ† ํฐ + + useEffect(() => { + if (!open) return; + setError(""); + }, [open]); + + // โœ… ๋ถ„๋ฅ˜(type) ๋ฐ”๋€Œ๋ฉด ๊ฒฐ๊ณผ/์—๋Ÿฌ/์ž…๋ ฅ๊ฐ’๊นŒ์ง€ ์ดˆ๊ธฐํ™” (์š”์ฒญ ๋ ˆ์ด์Šค๋„ ๋ฌด์‹œ) + useEffect(() => { + setItems([]); + setError(""); + setHasSearched(false); + setQ(""); // โ† ๊ฒ€์ƒ‰์ฐฝ๋„ ์ดˆ๊ธฐํ™” + lastReqId.current++; // ์ง„ํ–‰ ์ค‘์ด๋˜ ๊ฒ€์ƒ‰ ์‘๋‹ต์€ ๋ฌด์‹œ๋˜๋„๋ก ํ† ํฐ ์ฆ๊ฐ€ + }, [type]); + + const IMG_BASE = import.meta.env.VITE_TMDB_IMAGE_BASE || "https://image.tmdb.org/t/p/w342"; + + // ํ”„๋ก ํŠธ(type) โ†’ ๋ฐฑ์—”๋“œ(content) & ํŒŒ๋ผ๋ฏธํ„ฐ ๋งคํ•‘ + const toBackendParams = (t, input) => { + const content = + t === "movie" ? "MOVIE" : t === "book" ? "BOOK" : "MUSIC" + if (content === "MOVIE") return { content, query: input } + if (content === "BOOK") return { content, title: input } + // MUSIC: "์ œ๋ชฉ - ๊ฐ€์ˆ˜" ํŒŒ์‹ฑ + const { title, artist } = parseMusicQuery(input) + return { content, title, artist } + } + + const search = async (e) => { + e.preventDefault(); + + if (!q.trim()) { + setError("์ œ๋ชฉ์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”."); + setHasSearched(true); + return; + } + // ์Œ์•…์€ "์ œ๋ชฉ - ๊ฐ€์ˆ˜"๊ฐ€ ๋ชจ๋‘ ์žˆ์–ด์•ผ ํ•จ + if (type === "music") { + const { title, artist } = parseMusicQuery(q) + if (!title || !artist) { + setError("์Œ์•… ๊ฒ€์ƒ‰์€ '๊ฐ€์ˆ˜ - ๋…ธ๋ž˜ ์ œ๋ชฉ' ํ˜•์‹์œผ๋กœ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š”. (์˜ˆ: ๋ด„๋‚  - ๋ฐฉํƒ„์†Œ๋…„๋‹จ)") + return + } + } + + setError("") + setLoading(true) + setItems([]) + + const reqId = ++lastReqId.current; + + try { + const params = toBackendParams(type, q.trim()) + const data = await contentAPI.search(params) + + // ๋ฐฑ์—”๋“œ ์‘๋‹ต์ด items ํ˜น์€ results ๋ฐฐ์—ด์ผ ์ˆ˜ ์žˆ์œผ๋‹ˆ ์•ˆ์ „ํ•˜๊ฒŒ ์ฒ˜๋ฆฌ + const list = + Array.isArray(data?.items) ? data.items + : Array.isArray(data?.results) ? data.results + : Array.isArray(data?.content) ? data.content // ํŽ˜์ด์ง€๋„ค์ด์…˜ ํ˜•ํƒœ ๋Œ€๋น„ + : Array.isArray(data?.documents) ? data.documents // ์™ธ๋ถ€ API ํ”„๋ก์‹œ ๋Œ€๋น„ + : Array.isArray(data) ? data + : (data ? [data] : []) // ๐Ÿ”‘ ๋‹จ์ผ ๊ฐ์ฒด๋ฉด ๊ฐ์‹ธ๊ธฐ + + setItems(list) + } catch (err) { + if (lastReqId.current !== reqId) return; + setError("๊ฒ€์ƒ‰ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค."); + // eslint-disable-next-line no-console + console.error(err); + } finally { + if (lastReqId.current === reqId) { + setLoading(false); + setHasSearched(true); + } + } + }; + + const parseMusicQuery = (raw) => { + const s = (raw || "").replace(/\s{2,}/g, " ").trim() + // ๊ตฌ๋ถ„์ž ๊ธฐ์ค€์œผ๋กœ ์ตœ๋Œ€ 2๊ฐœ๋งŒ ์ทจํ•จ + const parts = s.split(/\s*[-โ€“โ€”]\s*|\s*,\s*|\s*\|\s*/).filter(Boolean) + const [title, artist] = [parts[0] || "", parts[1] || ""] + return { title: title.trim(), artist: artist.trim() } + } + + return ( + <> + {/* ์˜ค๋ฒ„๋ ˆ์ด */} +
+ + {/* ์Šฌ๋ผ์ด๋“œ ํŒจ๋„ (์˜ค๋ฅธ์ชฝ) */} + + + ); +} diff --git a/src/index.css b/src/index.css index f53b908..5f3d86a 100644 --- a/src/index.css +++ b/src/index.css @@ -57,3 +57,21 @@ @apply bg-background text-foreground; } } + +@layer utilities { + @keyframes subtleFadeIn { + from { + opacity: 0; + transform: translateY(8px); + } + to { + opacity: 1; + transform: translateY(0); + } + } + + .animate-fade-in { + animation: subtleFadeIn 0.4s ease-out forwards; + opacity: 0; + } +} diff --git a/src/lib/api.js b/src/lib/api.js index f7f1f63..c29f792 100644 --- a/src/lib/api.js +++ b/src/lib/api.js @@ -1,13 +1,103 @@ // API ํ˜ธ์ถœ์„ ์œ„ํ•œ ๊ธฐ๋ณธ ์„ค์ • -// Vite ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋Š” import.meta.env.VITE_ ์ ‘๋‘์‚ฌ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. -const API_BASE_URL = import.meta.env.VITE_API_URL || "http://localhost:8080/api" +const API_BASE_URL = import.meta.env.VITE_API_URL || "http://localhost:8080" +const CONTENT_SERVER_BASE_URL = import.meta.env.VITE_CONTENT_API_URL || "http://localhost:8081/api" +const INFO_SERVER_BASE_URL = import.meta.env.VITE_INFO_SERVER_API_URL || "http://localhost:8082/api" + + +import { MOCK_RECOMMENDATIONS } from "./mock-data" -import { MOCK_RECOMMENDATIONS } from "./mock-data" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ // ๊ธฐ๋ณธ fetch ์„ค์ • const apiRequest = async (endpoint, options = {}) => { const url = `${API_BASE_URL}${endpoint}` + const defaultOptions = { + credentials: "include", + headers: { + "Content-Type": "application/json", + "Accept": "application/json", + ...options.headers, + }, + ...options, + } + + try { + const response = await fetch(url, defaultOptions) + + // 401 ์—๋Ÿฌ๋Š” ์กฐ์šฉํžˆ ์ฒ˜๋ฆฌ + if (response.status === 401) { + console.log("๐Ÿ”’ ๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•œ ์„œ๋น„์Šค์ž…๋‹ˆ๋‹ค.") + throw new Error("Unauthorized") + } + + // ์‘๋‹ต์˜ Content-Type ํ—ค๋” ํ™•์ธ + const contentType = response.headers.get("content-type") + console.log("Response Content-Type:", contentType) // ๋””๋ฒ„๊น… + + if (!response.ok) { + let errorMessage = response.statusText + if (contentType?.includes("application/json")) { + const errorData = await response.json() + errorMessage = errorData.message || errorMessage + } + throw new Error(`HTTP error! status: ${response.status}, message: ${errorMessage}`) + } + + // ์‘๋‹ต์ด ๋น„์–ด์žˆ๊ฑฐ๋‚˜ JSON์ด ์•„๋‹Œ ๊ฒฝ์šฐ ์ฒ˜๋ฆฌ + if (!contentType || !contentType.includes("application/json")) { + console.log("No JSON content-type, returning status-only response") // ๋””๋ฒ„๊น… + return { + success: true, + status: response.status + } + } + + // JSON ์‘๋‹ต ํŒŒ์‹ฑ + const data = await response.json() + return { + success: true, + data, + status: response.status + } + } catch (error) { + if (error.message === "Unauthorized") { + throw error + } + console.error("API request failed:", error) + throw error + } +} + + +// ์ปจํ…์ธ  ์„œ๋ฒ„์šฉ ์š”์ฒญ -------------- +// 8081 content ์„œ๋ฒ„์šฉ ์š”์ฒญ ํ•จ์ˆ˜ ์ถ”๊ฐ€ +const contentApiRequest = async (endpoint, options = {}) => { + const url = `${CONTENT_SERVER_BASE_URL}${endpoint}`; + + const defaultOptions = { + credentials: "include", + headers: { "Content-Type": "application/json", ...options.headers }, + ...options, + }; + + const response = await fetch(url, defaultOptions); + + if (!response.ok) { + const errorData = await response.json().catch(() => ({ message: response.statusText })); + throw new Error(`HTTP error! status: ${response.status}, message: ${errorData.message || "Unknown error"}`); + } + const data = await response.json(); + console.log(`๐Ÿ“ฆ [contentApiRequest] ${url} ์‘๋‹ต:`, data); + return data; +}; + +//--------------------------------------------- + +// 8082 ํ…Œ์ŠคํŠธ ์„œ๋ฒ„์šฉ ์š”์ฒญ ํ•จ์ˆ˜ ์ถ”๊ฐ€ +const testApiRequest = async (endpoint, options = {}) => { + const url = `${INFO_SERVER_BASE_URL}${endpoint}`; + const token = localStorage.getItem("accessToken"); + const defaultOptions = { credentials: "include", // ์ฟ ํ‚ค ์ž๋™ ์ „์†ก headers: { @@ -33,87 +123,334 @@ const apiRequest = async (endpoint, options = {}) => { } } +// ๋กœ๊ทธ ์ƒํƒœ๋ฅผ ์ถ”์ ํ•˜๊ธฐ ์œ„ํ•œ ๋ณ€์ˆ˜ +let isAuthChecked = false; + // ์ธ์ฆ ๊ด€๋ จ API export const authAPI = { + // ๋กœ๊ทธ์ธ - login: async (email, password) => { - return apiRequest("/auth/login", { - method: "POST", - body: JSON.stringify({ email, password }), - }) + login: async (accountId, password) => { + try { + const response = await apiRequest("/login", { + method: "POST", + body: JSON.stringify({ accountId, password }), + }) + console.log("Login response:", response) // ๋””๋ฒ„๊น…์šฉ + // ๋กœ๊ทธ์ธ ์„ฑ๊ณต ์‹œ ๋ฐ”๋กœ ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ + if (response.success) { + const userData = await apiRequest("/auth/me") + return { + success: true, + user: userData.data + } + } + return response + } catch (error) { + console.error("Login failed:", error) + return { + success: false, + error: error.message + } + } }, // ํšŒ์›๊ฐ€์ž… - register: async (name, email, password) => { - return apiRequest("/auth/register", { - method: "POST", - body: JSON.stringify({ name, email, password }), - }) + register: async (username, accountId, password) => { + try { + const response = await apiRequest("/auth/join", { + method: "POST", + body: JSON.stringify({ username, accountId, password }), + }) + return response + } catch (error) { + console.error("Register failed:", error) + throw error + } }, // ๋กœ๊ทธ์•„์›ƒ logout: async () => { - return apiRequest("/auth/logout", { - method: "POST", - }) + try { + await apiRequest("/auth/logout", { + method: "POST", + }) + // HttpOnly ์ฟ ํ‚ค๋Š” ์„œ๋ฒ„์—์„œ ์ œ๊ฑฐ๋จ + isAuthChecked = false // ๋กœ๊ทธ์•„์›ƒ ์‹œ ์ƒํƒœ ์ดˆ๊ธฐํ™” + } catch (error) { + console.error("Logout failed:", error) + throw error + } }, // ํ˜„์žฌ ์‚ฌ์šฉ์ž ์ •๋ณด ์กฐํšŒ getCurrentUser: async () => { - return apiRequest("/auth/me") + try { + const response = await apiRequest("/auth/me") + if (!response.success && !isAuthChecked) { + console.log("๐Ÿ‘ค ํ˜„์žฌ ๋น„๋กœ๊ทธ์ธ ์ƒํƒœ์ž…๋‹ˆ๋‹ค.") + isAuthChecked = true + } + return response.data + } catch (error) { + if (!isAuthChecked) { + console.log("๐Ÿ‘ค ํ˜„์žฌ ๋น„๋กœ๊ทธ์ธ ์ƒํƒœ์ž…๋‹ˆ๋‹ค.") + isAuthChecked = true + } + return null + } }, // ํ† ํฐ ๊ฒ€์ฆ validateToken: async () => { - return apiRequest("/auth/validate") + try { + const response = await apiRequest("/auth/validate") + return response.data + } catch (error) { + console.error("Token validation failed:", error) + throw error + } + }, + + // ์•„์ด๋”” ์ค‘๋ณต ํ™•์ธ + checkAccountId: async (accountId) => { + try { + const response = await apiRequest(`/auth/duplicate?accountId=${encodeURIComponent(accountId)}`, { + method: "GET" + }) + return response + } catch (error) { + console.error("AccountId check failed:", error) + throw error + } }, + } -// ํ…Œ์ŠคํŠธ ๊ด€๋ จ API +// ํ…Œ์ŠคํŠธ ๊ด€๋ จ API (์ˆ˜์ •ํ•จ) export const testAPI = { saveTestResult: async (testData) => { try { - return await apiRequest("/test/save", { + const userId = testData.userId || localStorage.getItem("userId"); // ์—†์œผ๋ฉด ๋กœ์ปฌ์—์„œ ๊ฐ€์ ธ์˜ด + + if (!userId) { + throw new Error("User ID is missing"); + } + + const response = await testApiRequest(`/test/save?id=${userId}`, { method: "POST", body: JSON.stringify(testData), - }) + }); + + return response; // { testId: ... } } catch (error) { - console.log("Backend API not available, saving to localStorage (dev mode)...") + console.log("Backend API not available, saving to localStorage (dev mode)..."); - // ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€์— ์ €์žฅ (๊ฐœ๋ฐœ์šฉ) - const history = JSON.parse(localStorage.getItem("dev-test-history") || "[]") + const history = JSON.parse(localStorage.getItem("dev-test-history") || "[]"); const newResult = { id: Date.now().toString(), ...testData, + userId: testData.userId || localStorage.getItem("userId"), // ์ €์žฅ ์‹œ์—๋„ userId ํฌํ•จ completedAt: testData.completedAt || new Date().toISOString(), - } - history.unshift(newResult) // ์ตœ์‹  ๊ฒฐ๊ณผ๊ฐ€ ๋งจ ์•ž์œผ๋กœ ์˜ค๋„๋ก - localStorage.setItem("dev-test-history", JSON.stringify(history)) + }; + history.unshift(newResult); + localStorage.setItem("dev-test-history", JSON.stringify(history)); - return { success: true, result: newResult } + return { testId: newResult.id }; } }, - getTestHistory: async () => { + +// ํ…Œ์ŠคํŠธ ํžˆ์Šคํ† ๋ฆฌ ์กฐํšŒ (์ˆ˜์ •) + +getTestResultHistory: async (userIdParam) => { + try { + const userId = userIdParam || localStorage.getItem("userId"); + + if (!userId) { + throw new Error("User ID is missing"); + } + + return await testApiRequest(`/test/history?id=${userId}`); + } catch (error) { + console.log("Backend API not available, using localStorage (dev mode)..."); + + const history = JSON.parse(localStorage.getItem("dev-test-history") || "[]"); + return history.filter(item => item.userId === userIdParam || localStorage.getItem("userId")); + } +}, + + + + + getRecommendations: async (personalityOrUserType) => { try { - return await apiRequest("/test/history") + return await apiRequest(`/recommendations/${personalityOrUserType}`) } catch (error) { - console.log("Backend API not available, using localStorage (dev mode)...") + console.log("Backend API not available, using mock data (dev mode)...") - // ๋กœ์ปฌ ์Šคํ† ๋ฆฌ์ง€์—์„œ ์กฐํšŒ (๊ฐœ๋ฐœ์šฉ) - const history = JSON.parse(localStorage.getItem("dev-test-history") || "[]") - return history + // personalityOrUserType์ด ์—†์œผ๋ฉด ๊ธฐ๋ณธ๊ฐ’ ์‚ฌ์šฉ + const key = personalityOrUserType || "๊ท ํ˜•์žกํžŒ ๋ถ„์„ํ˜•"; + return MOCK_RECOMMENDATIONS[key] || MOCK_RECOMMENDATIONS["๊ท ํ˜•์žกํžŒ ๋ถ„์„ํ˜•"]; } }, - getRecommendations: async (personality) => { + // ๊ณต์œ  URL ๊ฐ€์ ธ์˜ค๊ธฐ + getShareUrl: async (testId, name) => { try { - return await apiRequest(`/recommendations/${personality}`) + return await contentApiRequest(`/response/share/${testId}/${encodeURIComponent(name)}`, { + method: "GET", + }); } catch (error) { - console.log("Backend API not available, using mock data (dev mode)...") + console.log("Share URL API ํ˜ธ์ถœ ์‹คํŒจ:", error); + throw error; + } + }, - // ๋ชฉ์—… ๋ฐ์ดํ„ฐ ๋ฐ˜ํ™˜ (๊ฐœ๋ฐœ์šฉ) - return MOCK_RECOMMENDATIONS[personality] || MOCK_RECOMMENDATIONS["๊ท ํ˜•์žกํžŒ ๋ถ„์„ํ˜•"] + // ๊ณต์œ  ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ (value ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ) + getSharedData: async (value) => { + try { + return await contentApiRequest(`/response/share?value=${encodeURIComponent(value)}`, { + method: "GET", + }); + } catch (error) { + console.log("Shared data API ํ˜ธ์ถœ ์‹คํŒจ:", error); + throw error; } }, + } + + +// ์ปจํ…์ธ  ์„œ๋ฒ„(Gemini) API - content ์„œ๋ฒ„ ํ˜ธ์ถœ +export const contentAPI = { + requestRecommendation: async (testId) => { + try { + return await contentApiRequest(`/gemini/recommend?testId=${testId}`, { + method: "POST", + }) + } catch (error) { + console.log("Recommendation API ํ˜ธ์ถœ ์‹คํŒจ:", error) + throw error + } + }, + + //ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ์กฐํšŒ api + getTestHistory: async (testId) => { + try { + return await contentApiRequest(`/response/history?testId=${encodeURIComponent(testId)}`); + + } catch (error) { + console.log("Backend API not available, using localStorage (dev mode)..."); + + const history = JSON.parse(localStorage.getItem("dev-test-history") || "[]"); + return history.find(item => item.id === testId); // id๋Š” ๋กœ์ปฌ ์ €์žฅ ๊ธฐ์ค€ + } +}, + +//mypage ์ปจํ…์ธ  ํžˆ์Šคํ† ๋ฆฌ ์กฐํšŒ api +getMypage: async (userId, page, size) => { + try { + return await contentApiRequest(`/response/history?userId=${encodeURIComponent(userId)}&page=${page}&size=${size}`); + } catch (error) { + console.log("Backend API not available, using localStorage (dev mode)..."); + + const history = JSON.parse(localStorage.getItem("dev-test-history") || "[]"); + return history.filter(item => item.userId === userId); + } +}, + +// 3. Book ์ƒ์„ธ ์กฐํšŒ + bookRecommendation: async (testId) => { + try { + return await contentApiRequest(`/content/book?testId=${testId}`); + } catch (error) { + console.log("Book API ํ˜ธ์ถœ ์‹คํŒจ:", error); + throw error; + } + }, + + // 4. Music ์ƒ์„ธ ์กฐํšŒ + musicRecommendation: async (testId) => { + try { + return await contentApiRequest(`/content/music?testId=${testId}`); + } catch (error) { + console.log("Music API ํ˜ธ์ถœ ์‹คํŒจ:", error); + throw error; + } + }, + + // 5. Movie ์ƒ์„ธ ์กฐํšŒ (์„ ํƒ) + movieRecommendation: async (testId) => { + try { + return await contentApiRequest(`/content/movie?testId=${testId}`); + } catch (error) { + console.log("Movie API ํ˜ธ์ถœ ์‹คํŒจ:", error); + throw error; + } + }, + + + //๊ฒ€์ƒ‰ API + search: async (params) => { + // params ์˜ˆ: { content:"MOVIE", query:"์ธํ„ฐ์Šคํ…”๋ผ" } + // { content:"BOOK", title:"๋ฏธ์›€๋ฐ›์„ ์šฉ๊ธฐ" } + // { content:"MUSIC", artist:"๋น„๋น„", title:"๋ฐค์–‘๊ฐฑ" } + const qs = new URLSearchParams(params).toString() + // contentApiRequest๋Š” CONTENT_SERVER_BASE_URL (๊ธฐ๋ณธ http://localhost:8081/api)๋กœ ์š”์ฒญ ๋ณด๋ƒ„ + + return await contentApiRequest(`/content/search?${qs}`, { method: "GET" }) +}, + + + // ๋žญํ‚น ์กฐํšŒ + getRanking: async (type, size = 3) => { + try { + const result = await contentApiRequest(`/response/ranking?type=${encodeURIComponent(type)}&size=${size}`) + + // ๋ฐฑ์—”๋“œ๊ฐ€ ์‘๋‹ตํ–ˆ์ง€๋งŒ ๋ฐ์ดํ„ฐ๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ + if (!result || !result.Recommend) { + return { + testId: null, + Recommend: { + Book: [], + Music: [], + Movie: [] + } + } + } + + return result + } catch (error) { + console.log("Backend API call failed:", error) + + // API ํ˜ธ์ถœ์ด ์™„์ „ํžˆ ์‹คํŒจํ•œ ๊ฒฝ์šฐ์—๋งŒ ๋นˆ ๋ฐ์ดํ„ฐ ๋ฐ˜ํ™˜ + return { + testId: null, + Recommend: { + Book: [], + Music: [], + Movie: [] + } + } + } + } + +} + +// ๊ฒ€์ƒ‰ api + +// const client = axios.create({ +// baseURL: "/api", // gateway ํ†ตํ•ด /content๋กœ ๋ผ์šฐํŒ…๋œ๋‹ค๊ณ  ๊ฐ€์ • +// }); + + + + + +// export const searchContent = async ({ type, query }) => { +// const { data } = await client.get("/content/search", { +// params: { type, query }, +// }); +// return data; // List +// }; diff --git a/src/lib/utils.js b/src/lib/utils.js index 20aa603..58ba4a2 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -4,3 +4,43 @@ import { twMerge } from "tailwind-merge" export function cn(...inputs) { return twMerge(clsx(inputs)) } + +/** + * UTC ์‹œ๊ฐ„์„ ํ•œ๊ตญ ์‹œ๊ฐ„์œผ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜ + * @param {string|Date} dateString - UTC ์‹œ๊ฐ„ ๋ฌธ์ž์—ด ๋˜๋Š” Date ๊ฐ์ฒด + * @returns {Date} ํ•œ๊ตญ ์‹œ๊ฐ„ Date ๊ฐ์ฒด + */ +export const convertToKST = (dateString) => { + const date = new Date(dateString) + // UTC ์‹œ๊ฐ„์— 9์‹œ๊ฐ„์„ ๋”ํ•ด์„œ ํ•œ๊ตญ ์‹œ๊ฐ„์œผ๋กœ ๋ณ€ํ™˜ + return new Date(date.getTime() + (9 * 60 * 60 * 1000)) +} + +/** + * ํ•œ๊ตญ ์‹œ๊ฐ„์œผ๋กœ ํฌ๋งทํŒ…ํ•˜๋Š” ํ•จ์ˆ˜ + * @param {string|Date} dateString - UTC ์‹œ๊ฐ„ ๋ฌธ์ž์—ด ๋˜๋Š” Date ๊ฐ์ฒด + * @returns {string} ํ•œ๊ตญ ์‹œ๊ฐ„์œผ๋กœ ํฌ๋งทํŒ…๋œ ๋ฌธ์ž์—ด + */ +export const formatToKST = (dateString) => { + const kstDate = convertToKST(dateString) + return kstDate.toLocaleString("ko-KR", { + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + timeZone: "Asia/Seoul" + }) +} + +/** + * ํ•œ๊ตญ ์‹œ๊ฐ„์œผ๋กœ ๋‚ ์งœ๋งŒ ํฌ๋งทํŒ…ํ•˜๋Š” ํ•จ์ˆ˜ + * @param {string|Date} dateString - UTC ์‹œ๊ฐ„ ๋ฌธ์ž์—ด ๋˜๋Š” Date ๊ฐ์ฒด + * @returns {string} ํ•œ๊ตญ ์‹œ๊ฐ„์œผ๋กœ ํฌ๋งทํŒ…๋œ ๋‚ ์งœ ๋ฌธ์ž์—ด + */ +export const formatDateToKST = (dateString) => { + const kstDate = convertToKST(dateString) + return kstDate.toLocaleDateString("ko-KR", { + timeZone: "Asia/Seoul" + }) +} diff --git a/src/main.jsx b/src/main.jsx index f101ceb..b1f661f 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -4,7 +4,5 @@ import App from "./App.jsx" import "./index.css" // ์ „์—ญ CSS ํŒŒ์ผ ReactDOM.createRoot(document.getElementById("root")).render( - - - , + ) diff --git a/src/pages/HomePage.jsx b/src/pages/HomePage.jsx index e4517bb..b837666 100644 --- a/src/pages/HomePage.jsx +++ b/src/pages/HomePage.jsx @@ -1,58 +1,610 @@ -import React from "react" +import React, { useState, useEffect } from "react" import { Link } from "react-router-dom" import { Button } from "../components/ui/button" import { Header } from "../components/header" +import { Tabs, TabsContent, TabsList, TabsTrigger } from "../components/ui/tabs" +import { contentAPI } from "../lib/api" +import { formatDateToKST } from "../lib/utils" +import SearchDrawer from "../components/search/SearchDrawer" // โฌ…๏ธ ๋“œ๋กœ์–ด ์ปดํฌ๋„ŒํŠธ export default function HomePage() { + const [open, setOpen] = useState(false) + + + // ์„ค์ • ๋ณ€์ˆ˜๋“ค + const RANKING_SIZE = 3 // ๋žญํ‚น์—์„œ ํ‘œ์‹œํ•  ์•„์ดํ…œ ๊ฐœ์ˆ˜ + const AUTO_TAB_INTERVAL = 10000 // ์ž๋™ ํƒญ ์ „ํ™˜ ๊ฐ„๊ฒฉ (ms) + + const [allRankingData, setAllRankingData] = useState({}) + const [loading, setLoading] = useState(false) + const [activeTab, setActiveTab] = useState("Dํ˜•") + const [isAutoPlaying] = useState(true) + const [isPaused, setIsPaused] = useState(false) + const [selectedItem, setSelectedItem] = useState(null) + const [isModalOpen, setIsModalOpen] = useState(false) + const [isTransitioning, setIsTransitioning] = useState(false) + const [isDiscModalOpen, setIsDiscModalOpen] = useState(false) + + const personalityTypes = [ + { value: "Dํ˜• (์ง€๋ฐฐํ˜•)", label: "Dํ˜• (์ง€๋ฐฐํ˜•)", shortLabel: "Dํ˜•" }, + { value: "Iํ˜• (์‚ฌ๊ตํ˜•)", label: "Iํ˜• (์‚ฌ๊ตํ˜•)", shortLabel: "Iํ˜•" }, + { value: "Sํ˜• (์•ˆ์ •ํ˜•)", label: "Sํ˜• (์•ˆ์ •ํ˜•)", shortLabel: "Sํ˜•" }, + { value: "Cํ˜• (์‹ ์ค‘ํ˜•)", label: "Cํ˜• (์‹ ์ค‘ํ˜•)", shortLabel: "Cํ˜•" }, + ] + + const tabs = ["Dํ˜•", "Iํ˜•", "Sํ˜•", "Cํ˜•"] + + useEffect(() => { + fetchAllRankings() + }, []) + + const openModal = (item, type) => { + setSelectedItem({ ...item, type }) + setIsModalOpen(true) + } + + const closeModal = () => { + setIsModalOpen(false) + setSelectedItem(null) + } + + const openDiscModal = () => { + setIsDiscModalOpen(true) + } + + const closeDiscModal = () => { + setIsDiscModalOpen(false) + } + + // ์ž๋™ ํƒญ ์ „ํ™˜ ๊ธฐ๋Šฅ + useEffect(() => { + if (!isAutoPlaying || isPaused) return + + const interval = setInterval(() => { + setIsTransitioning(true) + + setTimeout(() => { + setActiveTab(current => { + const currentIndex = tabs.indexOf(current) + const nextIndex = (currentIndex + 1) % tabs.length + return tabs[nextIndex] + }) + + setTimeout(() => { + setIsTransitioning(false) + }, 150) + }, 150) + }, AUTO_TAB_INTERVAL) // ์ž๋™ ํƒญ ์ „ํ™˜ ๊ฐ„๊ฒฉ + + return () => clearInterval(interval) + }, [isAutoPlaying, isPaused]) + + const fetchAllRankings = async () => { + setLoading(true) + try { + const promises = personalityTypes.map(async (type) => { + const data = await contentAPI.getRanking(type.value, RANKING_SIZE) + return { type: type.value, shortLabel: type.shortLabel, data } + }) + + const results = await Promise.all(promises) + const rankingMap = {} + results.forEach(result => { + rankingMap[result.type] = { ...result.data, shortLabel: result.shortLabel } + }) + + setAllRankingData(rankingMap) + } catch (error) { + console.error("Failed to fetch rankings:", error) + } finally { + setLoading(false) + } + } + return ( -
+
+ {/* ์™ผ์ชฝ ๊ณ ์ • ๋‹๋ณด๊ธฐ ๋ฒ„ํŠผ (ํ™ˆ์—์„œ๋งŒ ๋…ธ์ถœ) */} + + + {/* ๊ฒ€์ƒ‰ ์Šฌ๋ผ์ด๋“œ ํŒจ๋„ */} + setOpen(false)} /> +
-

๋‚˜๋งŒ์˜ ์„ฑํ–ฅ์„ ๋ฐœ๊ฒฌํ•˜์„ธ์š”

-

+

+ ๋‚˜๋งŒ์˜ ์„ฑํ–ฅ์„ ๋ฐœ๊ฒฌํ•˜์„ธ์š” +

+

๊ฐ„๋‹จํ•œ ํ…Œ์ŠคํŠธ๋ฅผ ํ†ตํ•ด ๋‹น์‹ ์˜ ์„ฑํ–ฅ์„ ์•Œ์•„๋ณด๊ณ ,
๋งž์ถคํ˜• ์˜ํ™”, ์ฑ…, ์Œ์•…์„ ์ถ”์ฒœ๋ฐ›์•„๋ณด์„ธ์š”.

-
+

ํ…Œ์ŠคํŠธ ์†Œ๊ฐœ

-
+
๐Ÿ“

๊ฐ„๋‹จํ•œ ์„ค๋ฌธ

-

20๊ฐœ์˜ ์งˆ๋ฌธ์œผ๋กœ ๊ตฌ์„ฑ๋œ ๊ฐ„๋‹จํ•œ ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ

+

+ 20๊ฐœ์˜ ์งˆ๋ฌธ์œผ๋กœ ๊ตฌ์„ฑ๋œ ๊ฐ„๋‹จํ•œ ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ +

-
+
๐ŸŽฏ

์ •ํ™•ํ•œ ๋ถ„์„

-

๊ณผํ•™์  ๊ทผ๊ฑฐ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ํ•œ ์„ฑํ–ฅ ๋ถ„์„

+

+ ๊ณผํ•™์  ๊ทผ๊ฑฐ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ํ•œ ์„ฑํ–ฅ ๋ถ„์„ +

-
+
๐ŸŽ

๋งž์ถค ์ถ”์ฒœ

-

๋‹น์‹ ์˜ ์„ฑํ–ฅ์— ๋งž๋Š” ์ปจํ…์ธ  ์ถ”์ฒœ

+

+ ๋‹น์‹ ์˜ ์„ฑํ–ฅ์— ๋งž๋Š” ์ปจํ…์ธ  ์ถ”์ฒœ +

-
+
+ + {/* ์„ฑํ–ฅ๋ณ„ ์ธ๊ธฐ ์ฝ˜ํ…์ธ  ๋žญํ‚น ์„น์…˜ */} +
+
+

์„ฑํ–ฅ๋ณ„ ์ธ๊ธฐ ์ฝ˜ํ…์ธ 

+

+ ๊ฐ ์„ฑํ–ฅ๋ณ„๋กœ ๊ฐ€์žฅ ๋งŽ์ด ์ถ”์ฒœ๋ฐ›์€ ์ธ๊ธฐ ์ฝ˜ํ…์ธ ๋ฅผ ํ™•์ธํ•ด๋ณด์„ธ์š” +

+ +
+ + {loading ? ( +
+
+

๋กœ๋”ฉ ์ค‘...

+
+ ) : ( + setIsPaused(true)} + onMouseLeave={() => setIsPaused(false)} + > +
+
+ + + + + + Dํ˜• + + + + + + Iํ˜• + + + + + + Sํ˜• + + + + + + Cํ˜• + + +
+
+ + {personalityTypes.map((personalityType) => ( + +
+ {(() => { + const typeData = allRankingData[personalityType.value] + return ( +
+ {/* ์˜ํ™” ์„น์…˜ */} +
+
+
+ + + +
+

+ ์ธ๊ธฐ ์˜ํ™” +

+
+
+ {typeData?.Recommend?.Movie && typeData.Recommend.Movie.length > 0 ? ( + typeData.Recommend.Movie.slice(0, RANKING_SIZE).map((movie, index) => ( +
openModal(movie, 'movie')} + > +
+
+
+ #{index + 1} +
+
+ {movie.title} +
+
+
+

{movie.title}

+ {movie.overview && ( +

{movie.overview}

+ )} +
+
+
+ )) + ) : ( +
+

๋ฐ์ดํ„ฐ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค

+
+ )} +
+
+ + {/* ์ฑ… ์„น์…˜ */} +
+
+
+ + + +
+

+ ์ธ๊ธฐ ๋„์„œ +

+
+
+ {typeData?.Recommend?.Book && typeData.Recommend.Book.length > 0 ? ( + typeData.Recommend.Book.slice(0, RANKING_SIZE).map((book, index) => ( +
openModal(book, 'book')} + > +
+
+
+ #{index + 1} +
+
+ {book.title} +
+
+
+

{book.title}

+ {book.author && ( +

์ €์ž: {book.author}

+ )} +
+
+
+ )) + ) : ( +
+

๋ฐ์ดํ„ฐ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค

+
+ )} +
+
+ + {/* ์Œ์•… ์„น์…˜ */} +
+
+
+ + + +
+

+ ์ธ๊ธฐ ์Œ์•… +

+
+
+ {typeData?.Recommend?.Music && typeData.Recommend.Music.length > 0 ? ( + typeData.Recommend.Music.slice(0, RANKING_SIZE).map((music, index) => ( +
openModal(music, 'music')} + > +
+
+
+ #{index + 1} +
+
+ {music.title} +
+
+
+

{music.title}

+ {music.artist && ( +

์•„ํ‹ฐ์ŠคํŠธ: {music.artist}

+ )} +
+
+
+ )) + ) : ( +
+

๋ฐ์ดํ„ฐ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค

+
+ )} +
+
+
+ ) + })()} +
+
+ ))} + +
+ )} +
+ + {/* ์ปจํ…์ธ  ์ƒ์„ธ ๋ชจ๋‹ฌ */} + {isModalOpen && selectedItem && ( +
+
e.stopPropagation()}> +
+ {/* ํ—ค๋” */} +
+

+ {selectedItem.type === 'movie' && '๐ŸŽฌ ์˜ํ™” ์ •๋ณด'} + {selectedItem.type === 'book' && '๐Ÿ“š ๋„์„œ ์ •๋ณด'} + {selectedItem.type === 'music' && '๐ŸŽต ์Œ์•… ์ •๋ณด'} +

+ +
+ + {/* ์ปจํ…์ธ  */} +
+ {/* ์ด๋ฏธ์ง€ */} +
+ {selectedItem.type === 'movie' && ( + {selectedItem.title} + )} + {selectedItem.type === 'book' && ( + {selectedItem.title} + )} + {selectedItem.type === 'music' && ( + {selectedItem.title} + )} +
+ + {/* ์ •๋ณด */} +
+

{selectedItem.title}

+ + {selectedItem.type === 'movie' && ( + <> + {selectedItem.release_date && ( +

+ ๊ฐœ๋ด‰์ผ: {formatDateToKST(selectedItem.release_date)} +

+ )} + {selectedItem.overview && ( +
+

์ค„๊ฑฐ๋ฆฌ

+

{selectedItem.overview}

+
+ )} + + )} + + {selectedItem.type === 'book' && ( + <> + {selectedItem.author && ( +

+ ์ €์ž: {selectedItem.author} +

+ )} + {selectedItem.description && ( +
+

๋‚ด์šฉ ์†Œ๊ฐœ

+

{selectedItem.description}

+
+ )} + + )} + + {selectedItem.type === 'music' && ( + <> + {selectedItem.artist && ( +

+ ์•„ํ‹ฐ์ŠคํŠธ: {selectedItem.artist} +

+ )} + {selectedItem.description && ( +
+

์„ค๋ช…

+

{selectedItem.description}

+
+ )} + + )} +
+
+
+
+
+ )} + + {/* DISC ์„ฑํ–ฅ ์„ค๋ช… ๋ชจ๋‹ฌ */} + {isDiscModalOpen && ( +
+
e.stopPropagation()}> +
+ {/* ํ—ค๋” */} +
+

๐Ÿ“Š DISC ์„ฑํ–ฅ์ด๋ž€?

+ +
+ + {/* ์ปจํ…์ธ  */} +
+ {/* ์ขŒ์ธก ์ด๋ฏธ์ง€ */} + {/*
+
+
+
๐Ÿง 
+
DISC
+
์„ฑํ–ฅ ๋ถ„์„ ์‹œ์Šคํ…œ
+
+
+
*/} + + {/* ์šฐ์ธก ์„ค๋ช… */} +
+
+
+

DISC๋ž€?

+

+ DISC๋Š” ์ธ๊ฐ„์˜ ํ–‰๋™ ํŒจํ„ด์„ 4๊ฐ€์ง€ ์ฃผ์š” ์„ฑํ–ฅ์œผ๋กœ ๋ถ„๋ฅ˜ํ•˜๋Š” ์„ฑ๊ฒฉ ์œ ํ˜• ๋ถ„์„ ๋„๊ตฌ์ž…๋‹ˆ๋‹ค. + ๊ฐ ์„ฑํ–ฅ์€ ๊ฐœ์ธ์˜ ์ผ์ƒ์ ์ธ ํ–‰๋™, ์˜์‚ฌ์†Œํ†ต ๋ฐฉ์‹, ๊ทธ๋ฆฌ๊ณ  ์˜์‚ฌ๊ฒฐ์ • ๊ณผ์ •์—์„œ ๋‚˜ํƒ€๋‚˜๋Š” + ํŠน์ง•์ ์ธ ํŒจํ„ด์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. +

+
+ +
+
+

๐Ÿ”ฅ Dํ˜• (์ง€๋ฐฐํ˜•)

+

+ ์ง์ ‘์ ์ด๊ณ  ๊ฒฐ๋‹จ๋ ฅ ์žˆ๋Š” ๋ฆฌ๋”์‹ญ์„ ๊ฐ€์ง„ ์„ฑํ–ฅ. ๋น ๋ฅธ ์˜์‚ฌ๊ฒฐ์ •๊ณผ ๋ชฉํ‘œ ์ง€ํ–ฅ์  ํ–‰๋™์„ ์„ ํ˜ธํ•ฉ๋‹ˆ๋‹ค. +

+
+ +
+

โญ Iํ˜• (์‚ฌ๊ตํ˜•)

+

+ ๋‚™๊ด€์ ์ด๊ณ  ์‚ฌ๊ต์ ์ธ ์„ฑํ–ฅ. ์‚ฌ๋žŒ๋“ค๊ณผ์˜ ์ƒํ˜ธ์ž‘์šฉ์„ ์ฆ๊ธฐ๋ฉฐ ์ฐฝ์˜์ ์ด๊ณ  ์˜๊ฐ์„ ์ฃผ๋Š” ํŠน์„ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. +

+
+ +
+

๐ŸŒฑ Sํ˜• (์•ˆ์ •ํ˜•)

+

+ ์•ˆ์ •์ ์ด๊ณ  ํ˜‘์กฐ์ ์ธ ์„ฑํ–ฅ. ํŒ€์›Œํฌ๋ฅผ ์ค‘์‹œํ•˜๋ฉฐ ์‹ ๋ขฐํ•  ์ˆ˜ ์žˆ๊ณ  ์ผ๊ด€์„ฑ ์žˆ๋Š” ํ–‰๋™์„ ๋ณด์ž…๋‹ˆ๋‹ค. +

+
+ +
+

๐Ÿ” Cํ˜• (์‹ ์ค‘ํ˜•)

+

+ ์ฒด๊ณ„์ ์ด๊ณ  ์ •ํ™•ํ•œ ์„ฑํ–ฅ. ๋…ผ๋ฆฌ์  ์‚ฌ๊ณ ์™€ ํ’ˆ์งˆ์„ ์ค‘์‹œํ•˜๋ฉฐ ์„ธ๋ถ€์‚ฌํ•ญ์— ์ฃผ์˜๋ฅผ ๊ธฐ์šธ์ž…๋‹ˆ๋‹ค. +

+
+
+ +
+

๐Ÿ’ก DISC์˜ ํ™œ์šฉ

+

+ DISC ์„ฑํ–ฅ ๋ถ„์„์„ ํ†ตํ•ด ์ž์‹ ์˜ ๊ฐ•์ ๊ณผ ์•ฝ์ ์„ ํŒŒ์•…ํ•˜๊ณ , ๋” ๋‚˜์€ ์˜์‚ฌ์†Œํ†ต๊ณผ ๊ด€๊ณ„ ํ˜•์„ฑ์„ ๋„๋ชจํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. + ๋˜ํ•œ ๊ฐœ์ธ์—๊ฒŒ ๋งž๋Š” ์ปจํ…์ธ ์™€ ํ™œ๋™์„ ์ถ”์ฒœ๋ฐ›์•„ ๋”์šฑ ๋งŒ์กฑ์Šค๋Ÿฌ์šด ์‚ถ์„ ์‚ด ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ค๋‹ˆ๋‹ค. +

+
+
+
+
+
+
+
+ )}
) } diff --git a/src/pages/LoginPage.jsx b/src/pages/LoginPage.jsx index a23438e..7b064cb 100644 --- a/src/pages/LoginPage.jsx +++ b/src/pages/LoginPage.jsx @@ -1,22 +1,22 @@ "use client" import React, { useState } from "react" -import { useNavigate, Link } from "react-router-dom" // useNavigate์™€ Link ์ž„ํฌํŠธ -import { useAuth } from "../components/auth-provider" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Header } from "../components/header" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Button } from "../components/ui/button" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Input } from "../components/ui/input" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Label } from "../components/ui/label" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Separator } from "../components/ui/separator" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { useToast } from "../hooks/use-toast" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ +import { useNavigate, Link } from "react-router-dom" +import { useAuth } from "../components/auth-provider" +import { Header } from "../components/header" +import { Button } from "../components/ui/button" +import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card" +import { Input } from "../components/ui/input" +import { Label } from "../components/ui/label" +import { Separator } from "../components/ui/separator" +import { useToast } from "../hooks/use-toast" export default function LoginPage() { - const [email, setEmail] = useState("") + const [username, setUsername] = useState("") const [password, setPassword] = useState("") const [isLoading, setIsLoading] = useState(false) const { login } = useAuth() - const navigate = useNavigate() // useRouter ๋Œ€์‹  useNavigate ์‚ฌ์šฉ + const navigate = useNavigate() const { toast } = useToast() const handleSubmit = async (e) => { @@ -24,17 +24,17 @@ export default function LoginPage() { setIsLoading(true) try { - const success = await login(email, password) + const success = await login(username, password) if (success) { toast({ title: "๋กœ๊ทธ์ธ ์„ฑ๊ณต", description: "ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค!", }) - navigate("/") // router.push ๋Œ€์‹  navigate ์‚ฌ์šฉ + navigate("/") } else { toast({ title: "๋กœ๊ทธ์ธ ์‹คํŒจ", - description: "์ด๋ฉ”์ผ ๋˜๋Š” ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ํ™•์ธํ•ด์ฃผ์„ธ์š”.", + description: "์•„์ด๋”” ๋˜๋Š” ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ํ™•์ธํ•ด์ฃผ์„ธ์š”.", variant: "destructive", }) } @@ -50,32 +50,32 @@ export default function LoginPage() { } const handleGoogleLogin = () => { - // Google OAuth ๋กœ๊ทธ์ธ - ๋ฐฑ์—”๋“œ ์—”๋“œํฌ์ธํŠธ๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ - // Vite ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋Š” import.meta.env.VITE_ ์ ‘๋‘์‚ฌ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. - window.location.href = `${import.meta.env.VITE_API_URL || "http://localhost:8080/api"}/auth/google` + window.location.href = `${import.meta.env.VITE_API_URL}/oauth2/authorization/google` } return ( -
+
- + - ๋กœ๊ทธ์ธ -

๊ณ„์ •์— ๋กœ๊ทธ์ธํ•˜์—ฌ ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ๋ฅผ ์‹œ์ž‘ํ•˜์„ธ์š”

+ ๋กœ๊ทธ์ธ +

+ ๊ณ„์ •์— ๋กœ๊ทธ์ธํ•˜์—ฌ ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ๋ฅผ ์‹œ์ž‘ํ•˜์„ธ์š” +

- + setEmail(e.target.value)} + id="username" + type="text" + placeholder="์•„์ด๋””๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”" + value={username} + onChange={(e) => setUsername(e.target.value)} required />
@@ -97,50 +97,25 @@ export default function LoginPage() { -
-

+

๊ณ„์ •์ด ์—†์œผ์‹ ๊ฐ€์š”?{" "} ํšŒ์›๊ฐ€์ž…

- - {/* ํ…Œ์ŠคํŠธ ๊ณ„์ • ์•ˆ๋‚ด ์„น์…˜์„ ๋” ๋ช…ํ™•ํ•˜๊ฒŒ ํ‘œ์‹œ: */} -
-

๐Ÿงช ํ…Œ์ŠคํŠธ ๊ณ„์ •

-
-

- ๊ณ„์ • 1: test@example.com / password123 -

-

- ๊ณ„์ • 2: dev@example.com / dev123 -

-
-

* ๋ฐฑ์—”๋“œ ์„œ๋ฒ„๊ฐ€ ์—†์–ด๋„ ํ…Œ์ŠคํŠธ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค

-
diff --git a/src/pages/MyPage.jsx b/src/pages/MyPage.jsx index 2046f77..2e20c4e 100644 --- a/src/pages/MyPage.jsx +++ b/src/pages/MyPage.jsx @@ -8,60 +8,121 @@ import { Header } from "../components/header" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ import { Button } from "../components/ui/button" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ import { Tabs, TabsContent, TabsList, TabsTrigger } from "../components/ui/tabs" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { testAPI } from "../lib/api" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ +import { testAPI, authAPI,contentAPI } from "../lib/api" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ import { useToast } from "../hooks/use-toast" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ +import { formatToKST, formatDateToKST } from "../lib/utils" export default function MyPage() { const { user, isLoading } = useAuth() const navigate = useNavigate() // useRouter ๋Œ€์‹  useNavigate ์‚ฌ์šฉ const [history, setHistory] = useState([]) - const [selectedHistory, setSelectedHistory] = useState(null) - const [recommendations, setRecommendations] = useState(null) + const [latestResult, setLatestResult] = useState(null); + const [selectedHistory, setSelectedHistory] = useState(null); + const [resultHistory, setResultHistory] = useState([]); + const [recommendations, setRecommendations] = useState(null); const [loading, setLoading] = useState(true) + const [currentPage, setCurrentPage] = useState(0) + const [totalPages, setTotalPages] = useState(1) + const [pageSize] = useState(5) + const [pageLoading, setPageLoading] = useState(false) const { toast } = useToast() useEffect(() => { - if (!isLoading && !user) { - navigate("/login") // router.push ๋Œ€์‹  navigate ์‚ฌ์šฉ - return - } - - if (user) { - fetchTestHistory() - } - }, [user, isLoading, navigate]) // ์˜์กด์„ฑ ๋ฐฐ์—ด์— navigate ์ถ”๊ฐ€ + const fetchAll = async () => { + if (!user || isLoading) return; - const fetchTestHistory = async () => { try { - const historyData = await testAPI.getTestHistory() - setHistory(historyData) - } catch (error) { - console.error("Failed to fetch test history:", error) + // 1. ์‚ฌ์šฉ์ž ๊ธฐ๋ณธ ์ •๋ณด ํ™•์ธ + const currentUser = await authAPI.getCurrentUser(); + console.log("โœ… /auth/me ์‘๋‹ต:", currentUser); + + // 2. ์ „์ฒด ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ โ†’ ์ตœ์‹  ์„ฑํ–ฅ ์ถ”์ถœ์šฉ + const resultData = await testAPI.getTestResultHistory(user.id); // ์ด๋ฆ„ ์ถฉ๋Œ ๋ฐฉ์ง€ + console.log("๐Ÿ“ฆ ์ „์ฒด ํ…Œ์ŠคํŠธ ๊ธฐ๋ก:", resultData); + setResultHistory(resultData); + + if (resultData && resultData.length > 0) { + const sorted = resultData.sort((a, b) => b.testId - a.testId); + const latest = sorted[0]; + console.log("๐ŸŽฏ ์ตœ์‹  ์„ฑํ–ฅ ๊ฒฐ๊ณผ:", latest); + setLatestResult(latest); + } + + + // 3. ์ „์ฒด ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ๊ฐœ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์ด ํŽ˜์ด์ง€ ์ˆ˜ ๊ณ„์‚ฐ + const totalResults = resultData ? resultData.length : 0; + const calculatedTotalPages = Math.max(1, Math.ceil(totalResults / pageSize)); + setTotalPages(calculatedTotalPages); + console.log(`์ด ${totalResults}๊ฐœ ๊ฒฐ๊ณผ, ${calculatedTotalPages} ํŽ˜์ด์ง€`); + + // 4. ์ถ”์ฒœ ํžˆ์Šคํ† ๋ฆฌ ๋ชฉ๋ก + const historyData = await contentAPI.getMypage(user.id, 0, pageSize); + console.log("๐Ÿ“ฆ ๋งˆ์ดํŽ˜์ด์ง€ ์ถ”์ฒœ ํžˆ์Šคํ† ๋ฆฌ:", historyData); + + if (historyData && historyData.length > 0) { + // ๊ฐ ํžˆ์Šคํ† ๋ฆฌ ํ•ญ๋ชฉ์— createdAt ํ•„๋“œ๊ฐ€ ์—†์œผ๋ฉด ํ˜„์žฌ ์‹œ๊ฐ„์„ ์ถ”๊ฐ€ + const historyWithDates = historyData.map(item => ({ + ...item, + createdAt: item.createdAt || new Date().toISOString() + })); + // testId ๊ธฐ์ค€ ๋‚ด๋ฆผ์ฐจ์ˆœ ์ •๋ ฌ + const sortedHistory = historyWithDates.sort((a, b) => b.testId - a.testId); + setHistory(sortedHistory); // โœ… ์ถ”์ฒœ ํžˆ์Šคํ† ๋ฆฌ ์ €์žฅ + } else { + setHistory([]); + } + + } catch (err) { + console.error("โŒ ๋ฐ์ดํ„ฐ ๋กœ๋”ฉ ์‹คํŒจ:", err); toast({ title: "์˜ค๋ฅ˜", - description: "ํ…Œ์ŠคํŠธ ํžˆ์Šคํ† ๋ฆฌ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.", + description: "๋งˆ์ดํŽ˜์ด์ง€ ์ •๋ณด๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.", variant: "destructive", - }) + }); } finally { - setLoading(false) + setLoading(false); + } + }; + + fetchAll(); +}, [user, isLoading]); + + const getTestInfoById = (testId) => { + return resultHistory.find(r => r.testId === testId); } - } - const handleHistoryClick = async (item) => { + const goToPage = async (page) => { + if (page === currentPage || pageLoading || page < 0 || page >= totalPages) return; + + setPageLoading(true); try { - setSelectedHistory(item) - // ํ•ด๋‹น ์„ฑํ–ฅ์˜ ์ถ”์ฒœ ์ปจํ…์ธ  ์กฐํšŒ - const recs = await testAPI.getRecommendations(item.personality) - setRecommendations(recs) + const pageData = await contentAPI.getMypage(user.id, page, pageSize); + + if (pageData && pageData.length > 0) { + const sortedPageData = pageData.sort((a, b) => b.testId - a.testId); + setHistory(sortedPageData); + } else { + setHistory([]); + } + + setCurrentPage(page); } catch (error) { - console.error("Failed to fetch recommendations:", error) + console.error("ํŽ˜์ด์ง€ ๋กœ๋“œ ์‹คํŒจ:", error); toast({ title: "์˜ค๋ฅ˜", - description: "์ถ”์ฒœ ์ปจํ…์ธ ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.", + description: "ํŽ˜์ด์ง€๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.", variant: "destructive", - }) + }); + } finally { + setPageLoading(false); } - } + }; + + const handleHistoryClick = (item) => { + console.log("๐Ÿ“ ์ƒ์„ธ๋ณด๊ธฐ ํด๋ฆญ๋จ:", item); + setSelectedHistory(item); + setRecommendations(item.Recommend); // ์ด๋ฏธ ์‘๋‹ต ๋‚ด์— ์žˆ์Œ +}; if (isLoading || loading) { return
๋กœ๋”ฉ ์ค‘...
@@ -72,18 +133,11 @@ export default function MyPage() { } const formatDate = (dateString) => { - const date = new Date(dateString) - return date.toLocaleString("ko-KR", { - year: "numeric", - month: "2-digit", - day: "2-digit", - hour: "2-digit", - minute: "2-digit", - }) + return formatToKST(dateString) } return ( -
+
@@ -91,66 +145,123 @@ export default function MyPage() {

๋งˆ์ดํŽ˜์ด์ง€

{/* ์‚ฌ์šฉ์ž ์ •๋ณด */} - + ๋‚ด ์ •๋ณด
-

์ด๋ฆ„

-

{user.name}

+

์ด๋ฆ„

+

{user.username}

-

๋‚ด ์„ฑํ–ฅ

-

{history.length > 0 ? history[0].personality : "ํ…Œ์ŠคํŠธ๋ฅผ ์™„๋ฃŒํ•ด์ฃผ์„ธ์š”"}

+

๋‚ด ์„ฑํ–ฅ

+

+ {latestResult ? latestResult.userType : "ํ…Œ์ŠคํŠธ๋ฅผ ์™„๋ฃŒํ•ด์ฃผ์„ธ์š”"} +

+ {latestResult && ( +

+ {latestResult.typeDescription} +

+ )}
{/* ์ถ”์ฒœ ํžˆ์Šคํ† ๋ฆฌ */} - + ์ถ”์ฒœ๋ฐ›์€ ์ปจํ…์ธ  ํžˆ์Šคํ† ๋ฆฌ {history.length === 0 ? (
-

์•„์ง ํ…Œ์ŠคํŠธ๋ฅผ ์™„๋ฃŒํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

- {/* navigate ์‚ฌ์šฉ */} +

์•„์ง ํ…Œ์ŠคํŠธ๋ฅผ ์™„๋ฃŒํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

+
) : (
- {history.map((item, index) => ( -
handleHistoryClick(item)} - > -
-
-

{item.personality}

-

{formatDate(item.completedAt)}

-

์ ์ˆ˜: {item.score.toFixed(1)}์ 

+ {history.map((item, index) => { + const testInfo = getTestInfoById(item.testId) + return ( +
handleHistoryClick(item)} + > +
+
+

+ {testInfo?.userType || "์„ฑํ–ฅ ์—†์Œ"} +

+

+ {testInfo?.typeDescription || "์„ค๋ช… ์—†์Œ"} +

+

+ {testInfo?.createdAt ? formatDate(testInfo.createdAt) : "๋‚ ์งœ ์—†์Œ"} +

+
+
-
+ ); + })} + + {/* Pagination */} + {totalPages > 1 && ( +
+ + + {Array.from({ length: totalPages }, (_, index) => ( + + ))} + +
- ))} + )}
)} + + {/* ์„ ํƒ๋œ ํžˆ์Šคํ† ๋ฆฌ ์ƒ์„ธ */} {selectedHistory && recommendations && ( - + - {selectedHistory.personality} - {formatDate(selectedHistory.completedAt)} + {selectedHistory.personality} - {(() => { + const testInfo = getTestInfoById(selectedHistory.testId); + return testInfo?.createdAt ? formatDate(testInfo.createdAt) : "๋‚ ์งœ ์—†์Œ"; + })()} @@ -161,36 +272,94 @@ export default function MyPage() { ๐ŸŽต ์Œ์•… + {/* Movie ํƒญ */} -
- {recommendations.movies?.map((movie, index) => ( -
-

{movie.title}

- {movie.description &&

{movie.description}

} +
+ {recommendations?.Movie?.map((movie, index) => ( +
+ {movie.title} { + e.target.src = "/no-image.png"; + }} + /> +
+

์ œ๋ชฉ: {movie.title}

+ {movie.release_date && ( +

+ ๊ฐœ๋ด‰์ผ: {new Date(movie.release_date).toLocaleDateString("ko-KR")} +

+ )} + {movie.overview && ( +

+ ์„ค๋ช…: {movie.overview} +

+ )} +
))}
+ {/* Book */} -
- {recommendations.books?.map((book, index) => ( -
-

{book.title}

- {book.author &&

์ €์ž: {book.author}

} - {book.description &&

{book.description}

} +
+ {recommendations?.Book?.map((book, index) => ( +
+ {book.title} { + e.target.src = "/no-image.png"; + }} + /> +
+

{book.title}

+ {book.author && ( +

์ €์ž: {book.author}

+ )} + {book.description && ( +

+ ์„ค๋ช…: {book.description} +

+ )} +
))}
+ {/* Music ํƒญ */} -
- {recommendations.music?.map((artist, index) => ( -
-

{artist.name}

- {artist.genre &&

์žฅ๋ฅด: {artist.genre}

} - {artist.description &&

{artist.description}

} +
+ {recommendations?.Music?.map((music, index) => ( +
+ {music.title} { + e.target.src = "/no-image.png"; + }} + /> +
+

์ œ๋ชฉ: {music.title}

+ {music.artist && ( +

์•„ํ‹ฐ์ŠคํŠธ: {music.artist}

+ )} +
))}
diff --git a/src/pages/RegisterPage.jsx b/src/pages/RegisterPage.jsx index 5cd190f..ee25bbb 100644 --- a/src/pages/RegisterPage.jsx +++ b/src/pages/RegisterPage.jsx @@ -1,43 +1,61 @@ "use client" -import React from 'react' -import { useState } from "react" -import { useNavigate, Link } from "react-router-dom" // useNavigate์™€ Link ์ž„ํฌํŠธ -import { useAuth } from "../components/auth-provider" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Header } from "../components/header" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Button } from "../components/ui/button" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Input } from "../components/ui/input" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Label } from "../components/ui/label" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Separator } from "../components/ui/separator" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { useToast } from "../hooks/use-toast" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ +import React, { useState } from "react" +import { useNavigate, Link } from "react-router-dom" +import { Header } from "../components/header" +import { Button } from "../components/ui/button" +import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card" +import { Input } from "../components/ui/input" +import { Label } from "../components/ui/label" +import { useToast } from "../hooks/use-toast" +import { authAPI } from "../lib/api" export default function RegisterPage() { - const [name, setName] = useState("") - const [email, setEmail] = useState("") + const [username, setUsername] = useState("") + const [accountId, setAccountId] = useState("") const [password, setPassword] = useState("") const [confirmPassword, setConfirmPassword] = useState("") const [isLoading, setIsLoading] = useState(false) - const { register } = useAuth() - const navigate = useNavigate() // useRouter ๋Œ€์‹  useNavigate ์‚ฌ์šฉ + const [isAccountIdValid, setIsAccountIdValid] = useState(false) + const navigate = useNavigate() const { toast } = useToast() + const checkAccountId = async () => { + if (!accountId.trim()) { + toast({ + description: "์•„์ด๋””๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.", + variant: "destructive", + }) + return + } + + try { + const response = await authAPI.checkAccountId(accountId) + setIsAccountIdValid(true) + toast({ description: "์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์•„์ด๋””์ž…๋‹ˆ๋‹ค." }) + } catch (error) { + setIsAccountIdValid(false) + toast({ + description: "์ด๋ฏธ ์‚ฌ์šฉ์ค‘์ธ ์•„์ด๋””์ž…๋‹ˆ๋‹ค.", + variant: "destructive", + }) + } + } + const handleSubmit = async (e) => { e.preventDefault() - if (password !== confirmPassword) { + if (!isAccountIdValid) { toast({ - title: "๋น„๋ฐ€๋ฒˆํ˜ธ ๋ถˆ์ผ์น˜", - description: "๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ์ผ์น˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.", + description: "์•„์ด๋”” ์ค‘๋ณตํ™•์ธ์„ ํ•ด์ฃผ์„ธ์š”.", variant: "destructive", }) return } - if (password.length < 6) { + if (password !== confirmPassword) { toast({ - title: "๋น„๋ฐ€๋ฒˆํ˜ธ ์˜ค๋ฅ˜", - description: "๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” 6์ž ์ด์ƒ์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.", + description: "๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ์ผ์น˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.", variant: "destructive", }) return @@ -46,23 +64,13 @@ export default function RegisterPage() { setIsLoading(true) try { - const success = await register(name, email, password) - if (success) { - toast({ - title: "ํšŒ์›๊ฐ€์ž… ์„ฑ๊ณต", - description: "ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค! ๋กœ๊ทธ์ธ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.", - }) - navigate("/") // router.push ๋Œ€์‹  navigate ์‚ฌ์šฉ - } else { - toast({ - title: "ํšŒ์›๊ฐ€์ž… ์‹คํŒจ", - description: "ํšŒ์›๊ฐ€์ž… ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.", - variant: "destructive", - }) + const response = await authAPI.register(username, accountId, password) + if (response.success) { + toast({ description: "ํšŒ์›๊ฐ€์ž…์ด ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค." }) + navigate("/login") } } catch (error) { toast({ - title: "์˜ค๋ฅ˜", description: "ํšŒ์›๊ฐ€์ž… ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.", variant: "destructive", }) @@ -71,53 +79,51 @@ export default function RegisterPage() { } } - const handleGoogleRegister = () => { - // Google OAuth ํšŒ์›๊ฐ€์ž… - ๋ฐฑ์—”๋“œ ์—”๋“œํฌ์ธํŠธ๋กœ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ - // Vite ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋Š” import.meta.env.VITE_ ์ ‘๋‘์‚ฌ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. - window.location.href = `${import.meta.env.VITE_API_URL || "http://localhost:8080/api"}/auth/google` - } - return ( -
+
-
- + - ํšŒ์›๊ฐ€์ž… -

์ƒˆ ๊ณ„์ •์„ ๋งŒ๋“ค์–ด ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ๋ฅผ ์‹œ์ž‘ํ•˜์„ธ์š”

+ ํšŒ์›๊ฐ€์ž…
- + setName(e.target.value)} + value={username} + onChange={(e) => setUsername(e.target.value)} required />
- - setEmail(e.target.value)} - required - /> + +
+ { + setAccountId(e.target.value) + setIsAccountIdValid(false) + }} + required + /> + +
setPassword(e.target.value)} required @@ -129,49 +135,16 @@ export default function RegisterPage() { setConfirmPassword(e.target.value)} required />
- - - - - - -
-

- ์ด๋ฏธ ๊ณ„์ •์ด ์žˆ์œผ์‹ ๊ฐ€์š”?{" "} - - ๋กœ๊ทธ์ธ - -

-
diff --git a/src/pages/ResultPage.jsx b/src/pages/ResultPage.jsx index 93bc5f3..308a698 100644 --- a/src/pages/ResultPage.jsx +++ b/src/pages/ResultPage.jsx @@ -1,102 +1,88 @@ "use client" -import React from 'react' -import { useState, useEffect } from "react" -import { useNavigate } from "react-router-dom" // useNavigate ์ž„ํฌํŠธ -import { useAuth } from "../components/auth-provider" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Header } from "../components/header" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Button } from "../components/ui/button" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Tabs, TabsContent, TabsList, TabsTrigger } from "../components/ui/tabs" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { testAPI } from "../lib/api" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { useToast } from "../hooks/use-toast" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ +import React, { useState, useEffect } from "react" +import { useSearchParams, useNavigate } from "react-router-dom" +import { useAuth } from "../components/auth-provider" +import { Header } from "../components/header" +import { Button } from "../components/ui/button" +import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card" +import { Tabs, TabsContent, TabsList, TabsTrigger } from "../components/ui/tabs" +import { testAPI, contentAPI } from "../lib/api" +import { useToast } from "../hooks/use-toast" export default function ResultPage() { const { user, isLoading } = useAuth() - const navigate = useNavigate() // useRouter ๋Œ€์‹  useNavigate ์‚ฌ์šฉ - const [testResult, setTestResult] = useState(null) + const navigate = useNavigate() + const [latestResult, setLatestResult] = useState(null) + const [testDetail, setTestDetail] = useState(null) const [recommendations, setRecommendations] = useState(null) const [loading, setLoading] = useState(true) const { toast } = useToast() + const [searchParams] = useSearchParams() + const testId = searchParams.get("testId") useEffect(() => { - if (!isLoading && !user) { - navigate("/login") // router.push ๋Œ€์‹  navigate ์‚ฌ์šฉ - return - } - - if (user) { - fetchLatestResult() - } - }, [user, isLoading, navigate]) // ์˜์กด์„ฑ ๋ฐฐ์—ด์— navigate ์ถ”๊ฐ€ - - const fetchLatestResult = async () => { - try { - // ๋ฐฑ์—”๋“œ์—์„œ ์ตœ์‹  ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ์กฐํšŒ - const history = await testAPI.getTestHistory() - - if (history.length === 0) { - navigate("/test") // navigate ์‚ฌ์šฉ - return + const fetchBoth = async () => { + if (!user || isLoading) return + + try { + if (testId) { + const res = await contentAPI.getTestHistory(testId) + setTestDetail(res) + setRecommendations(res.Recommend) + } + + const history = await testAPI.getTestResultHistory(user.id) + if (history && history.length > 0) { + const sorted = history.sort((a, b) => b.testId - a.testId) + setLatestResult(sorted[0]) + } + } catch (error) { + toast({ + title: "์˜ค๋ฅ˜", + description: "๊ฒฐ๊ณผ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.", + variant: "destructive", + }) + } finally { + setLoading(false) } - - const latestResult = history[0] // ์ตœ์‹  ๊ฒฐ๊ณผ - setTestResult(latestResult) - - // ์„ฑํ–ฅ์— ๋”ฐ๋ฅธ ์ถ”์ฒœ ์ปจํ…์ธ  ์กฐํšŒ - const recs = await testAPI.getRecommendations(latestResult.personality) - setRecommendations(recs) - } catch (error) { - console.error("Failed to fetch test result:", error) - toast({ - title: "์˜ค๋ฅ˜", - description: "ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.", - variant: "destructive", - }) - navigate("/test") // navigate ์‚ฌ์šฉ - } finally { - setLoading(false) } - } + + fetchBoth() + }, [user, isLoading, testId]) if (isLoading || loading) { return
๋กœ๋”ฉ ์ค‘...
} - if (!user || !testResult || !recommendations) { - return null - } + if (!user || !recommendations) return null return ( -
+
- {/* ์ƒ๋‹จ ์ ˆ๋ฐ˜ - ์„ฑํ–ฅ ๊ฒฐ๊ณผ */} + {/* ์ƒ๋‹จ - ์„ฑํ–ฅ ๊ฒฐ๊ณผ */}
ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ
๐ŸŽฏ
-

{testResult.personality}

-

ํ‰๊ท  ์ ์ˆ˜: {testResult.score.toFixed(1)}์ 

+

+ {latestResult?.userType || "์„ฑํ–ฅ ์—†์Œ"} +

- {testResult.personality === "์™ธํ–ฅ์  ๋ฆฌ๋”ํ˜•" && - "๋‹น์‹ ์€ ์‚ฌ๊ต์ ์ด๊ณ  ๋ฆฌ๋”์‹ญ์ด ๋›ฐ์–ด๋‚œ ์„ฑํ–ฅ์ž…๋‹ˆ๋‹ค. ์ƒˆ๋กœ์šด ๋„์ „์„ ์ฆ๊ธฐ๊ณ  ํŒ€์„ ์ด๋„๋Š” ๊ฒƒ์„ ์ข‹์•„ํ•ฉ๋‹ˆ๋‹ค."} - {testResult.personality === "๊ท ํ˜•์žกํžŒ ๋ถ„์„ํ˜•" && - "๋‹น์‹ ์€ ๋…ผ๋ฆฌ์ ์ด๋ฉด์„œ๋„ ๊ฐ์ •์  ๊ท ํ˜•์„ ์ž˜ ๋งž์ถ”๋Š” ์„ฑํ–ฅ์ž…๋‹ˆ๋‹ค. ์‹ ์ค‘ํ•˜๊ฒŒ ํŒ๋‹จํ•˜๊ณ  ํ•ฉ๋ฆฌ์ ์ธ ๊ฒฐ์ •์„ ๋‚ด๋ฆฝ๋‹ˆ๋‹ค."} - {testResult.personality === "์‹ ์ค‘ํ•œ ์‚ฌ์ƒ‰ํ˜•" && - "๋‹น์‹ ์€ ๊นŠ์ด ์žˆ๊ฒŒ ์ƒ๊ฐํ•˜๊ณ  ์‹ ์ค‘ํ•œ ์„ฑํ–ฅ์ž…๋‹ˆ๋‹ค. ํ˜ผ์ž๋งŒ์˜ ์‹œ๊ฐ„์„ ์†Œ์ค‘ํžˆ ์—ฌ๊ธฐ๊ณ  ๋‚ด๋ฉด์˜ ์„ฑ์ฐฐ์„ ์ค‘์š”ํ•˜๊ฒŒ ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค."} + {latestResult?.typeDescription || "์„ค๋ช… ์—†์Œ"}

- {/* ํ•˜๋‹จ ์ ˆ๋ฐ˜ - ์ถ”์ฒœ ์ปจํ…์ธ  */} - + {/* ํ•˜๋‹จ - ์ถ”์ฒœ ์ฝ˜ํ…์ธ  */} + ๋งž์ถค ์ถ”์ฒœ ์ปจํ…์ธ  @@ -108,36 +94,96 @@ export default function ResultPage() { ๐ŸŽต ์Œ์•… + {/* ์˜ํ™” */}
- {recommendations.movies?.map((movie, index) => ( -
-

{movie.title}

- {movie.description &&

{movie.description}

} + {recommendations?.Movie?.map((movie, index) => ( +
+ {movie.title} { + e.target.src = "/no-image.png"; + }} + /> +
+

์ œ๋ชฉ: {movie.title}

+ {movie.release_date && ( +

+ ๊ฐœ๋ด‰์ผ: {new Date(movie.release_date).toLocaleDateString("ko-KR")} +

+ )} + {movie.overview && ( +

+ ์„ค๋ช…: {movie.overview} +

+ )} +
))}
+ {/* ์ฑ… */}
- {recommendations.books?.map((book, index) => ( -
-

{book.title}

- {book.author &&

์ €์ž: {book.author}

} - {book.description &&

{book.description}

} + {recommendations?.Book?.map((book, index) => ( +
+ {book.title} { + e.target.src = "/no-image.png"; + }} + /> +
+

{book.title}

+ {book.author && ( +

์ €์ž: {book.author}

+ )} + {book.description && ( +

+ ์„ค๋ช…: {book.description} +

+ )} +
))}
+ {/* ์Œ์•… */}
- {recommendations.music?.map((artist, index) => ( -
-

{artist.name}

- {artist.genre &&

์žฅ๋ฅด: {artist.genre}

} - {artist.description &&

{artist.description}

} + {recommendations?.Music?.map((music, index) => ( +
+ {music.title} { + e.target.src = "/no-image.png"; + }} + /> +
+

์ œ๋ชฉ: {music.title}

+ {music.artist && ( +

+ ์•„ํ‹ฐ์ŠคํŠธ: {music.artist} +

+ )} +
))}
@@ -150,9 +196,37 @@ export default function ResultPage() { - +
diff --git a/src/pages/SharedResultPage.jsx b/src/pages/SharedResultPage.jsx new file mode 100644 index 0000000..40d8bf4 --- /dev/null +++ b/src/pages/SharedResultPage.jsx @@ -0,0 +1,239 @@ +"use client" + +import React from 'react' +import { useState, useEffect } from "react" +import { useSearchParams } from "react-router-dom"; +import { useNavigate } from "react-router-dom" +import { Header } from "../components/header" +import { Button } from "../components/ui/button" +import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card" +import { Tabs, TabsContent, TabsList, TabsTrigger } from "../components/ui/tabs" +import { useToast } from "../hooks/use-toast" +import { testAPI } from "../lib/api" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ + +export default function SharedResultPage() { + const navigate = useNavigate() + const [resultData, setResultData] = useState(null) + const [loading, setLoading] = useState(true) + const { toast } = useToast() + const [searchParams] = useSearchParams() + + useEffect(() => { + const fetchResultData = async () => { + try { + // URL ํŒŒ๋ผ๋ฏธํ„ฐ์—์„œ ๊ฒฐ๊ณผ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ + const value = searchParams.get("value") // ์„œ๋ฒ„์—์„œ ๋ฐ›์€ value ํŒŒ๋ผ๋ฏธํ„ฐ + const userType = searchParams.get("userType") + const typeDescription = searchParams.get("typeDescription") + const recommendations = searchParams.get("recommendations") + const testId = searchParams.get("testId") // testId๋„ ๊ฐ€์ ธ์˜ค๊ธฐ + + // value ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ์žˆ์œผ๋ฉด ์„œ๋ฒ„์—์„œ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ + if (value) { + try { + const sharedData = await testAPI.getSharedData(value); + console.log("์„œ๋ฒ„์—์„œ ๋ฐ›์€ ๊ณต์œ  ๋ฐ์ดํ„ฐ:", sharedData); + + setResultData({ + userType: "๊ณต์œ ๋œ ๊ฒฐ๊ณผ", + typeDescription: `${sharedData.name}๋‹˜์˜ ๊ฒฐ๊ณผ์ž…๋‹ˆ๋‹ค`, + recommendations: sharedData.RecommendHistory?.body?.Recommend || null, + testId: sharedData.RecommendHistory?.body?.testId || null, + sharedValue: value, + userName: sharedData.name + }); + } catch (error) { + console.error("๊ณต์œ  ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ ์‹คํŒจ:", error); + toast({ + title: "์˜ค๋ฅ˜", + description: "๊ณต์œ ๋œ ๊ฒฐ๊ณผ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š”๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.", + variant: "destructive", + }); + navigate("/"); + } + return; + } + + if (!userType) { + toast({ + title: "์˜ค๋ฅ˜", + description: "์œ ํšจํ•˜์ง€ ์•Š์€ ๊ฒฐ๊ณผ ๋งํฌ์ž…๋‹ˆ๋‹ค.", + variant: "destructive", + }) + navigate("/") + return + } + + // recommendations๊ฐ€ ์žˆ์œผ๋ฉด JSON์œผ๋กœ ํŒŒ์‹ฑ + let parsedRecommendations = null + if (recommendations) { + try { + parsedRecommendations = JSON.parse(decodeURIComponent(recommendations)) + } catch (e) { + console.error("์ถ”์ฒœ ๋ฐ์ดํ„ฐ ํŒŒ์‹ฑ ์‹คํŒจ:", e) + } + } + + setResultData({ + userType, + typeDescription, + recommendations: parsedRecommendations, + testId // testId๋„ ์ €์žฅ + }) + + } catch (error) { + console.error("โŒ ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ ์‹คํŒจ:", error) + toast({ + title: "์˜ค๋ฅ˜", + description: "๊ฒฐ๊ณผ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.", + variant: "destructive", + }) + navigate("/") + } finally { + setLoading(false) + } + } + + fetchResultData() + }, [searchParams, navigate, toast]) + + if (loading) { + return
๋กœ๋”ฉ ์ค‘...
+ } + + if (!resultData) { + return null + } + + return ( +
+
+ +
+
+ {/* ์ƒ๋‹จ ์ ˆ๋ฐ˜ - ์„ฑํ–ฅ ๊ฒฐ๊ณผ */} +
+ + + ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ +
๐ŸŽฏ
+

+ {resultData.userType || "์„ฑํ–ฅ ์—†์Œ"} +

+
+ +

+ {resultData.typeDescription || "์„ค๋ช… ์—†์Œ"} +

+ {/* {resultData.userName && ( +
+

๊ณต์œ ์ž: {resultData.userName}

+
+ )} */} +
+
+
+ + {/* ํ•˜๋‹จ ์ ˆ๋ฐ˜ - ์ถ”์ฒœ ์ปจํ…์ธ  */} + {resultData.recommendations && ( + + + ๋งž์ถค ์ถ”์ฒœ ์ปจํ…์ธ  + + + + + ๐ŸŽฌ ์˜ํ™” + ๐Ÿ“š ์ฑ… + ๐ŸŽต ์Œ์•… + + + +
+ {resultData.recommendations?.Movie?.map((movie, index) => ( +
+ {movie.poster_path && ( + {movie.title} + )} +
+

์ œ๋ชฉ: {movie.title}

+ + {movie.release_date && ( +

+ ๊ฐœ๋ด‰์ผ: {new Date(movie.release_date).toLocaleDateString("ko-KR")} +

+ )} + + {movie.overview && ( +

+ ์„ค๋ช…: {movie.overview} +

+ )} +
+
+ ))} +
+
+ + +
+ {resultData.recommendations?.Book?.map((book, index) => ( +
+ {book.image && ( + {book.title} + )} +
+

{book.title}

+ {book.author &&

์ €์ž: {book.author}

} + {book.description &&

์„ค๋ช…: {book.description}

} +
+
+ ))} +
+
+ + +
+ {resultData.recommendations?.Music?.map((music, index) => ( +
+ {music.album && ( + {music.title} + )} +
+

์ œ๋ชฉ: {music.title}

+ {music.artist && ( +

์•„ํ‹ฐ์ŠคํŠธ: {music.artist}

+ )} +
+
+ ))} +
+
+ +
+
+
+ )} + +
+ +
+
+
+
+ ) +} \ No newline at end of file diff --git a/src/pages/TestPage.jsx b/src/pages/TestPage.jsx index ed02f3d..fd2ac70 100644 --- a/src/pages/TestPage.jsx +++ b/src/pages/TestPage.jsx @@ -1,17 +1,16 @@ "use client" -import React from 'react' -import { useState, useEffect } from "react" -import { useNavigate } from "react-router-dom" // useNavigate ์ž„ํฌํŠธ -import { useAuth } from "../components/auth-provider" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Header } from "../components/header" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Button } from "../components/ui/button" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { RadioGroup, RadioGroupItem } from "../components/ui/radio-group" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Label } from "../components/ui/label" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { Progress } from "../components/ui/progress" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { testAPI } from "../lib/api" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ -import { useToast } from "../hooks/use-toast" // ์ƒ๋Œ€ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝ +import React, { useState, useEffect } from "react" +import { useNavigate } from "react-router-dom" +import { useAuth } from "../components/auth-provider" +import { Header } from "../components/header" +import { Button } from "../components/ui/button" +import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card" +import { RadioGroup, RadioGroupItem } from "../components/ui/radio-group" +import { Label } from "../components/ui/label" +import { Progress } from "../components/ui/progress" +import { testAPI, contentAPI } from "../lib/api" +import { useToast } from "../hooks/use-toast" const questions = [ "๋‚˜๋Š” ์ƒˆ๋กœ์šด ์‚ฌ๋žŒ๋“ค๊ณผ ๋งŒ๋‚˜๋Š” ๊ฒƒ์„ ์ข‹์•„ํ•œ๋‹ค", @@ -38,7 +37,7 @@ const questions = [ export default function TestPage() { const { user, isLoading } = useAuth() - const navigate = useNavigate() // useRouter ๋Œ€์‹  useNavigate ์‚ฌ์šฉ + const navigate = useNavigate() const [answers, setAnswers] = useState({}) const [currentQuestion, setCurrentQuestion] = useState(0) const [isSubmitting, setIsSubmitting] = useState(false) @@ -46,23 +45,28 @@ export default function TestPage() { useEffect(() => { if (!isLoading && !user) { - navigate("/login") // router.push ๋Œ€์‹  navigate ์‚ฌ์šฉ + navigate("/login") } - }, [user, isLoading, navigate]) // ์˜์กด์„ฑ ๋ฐฐ์—ด์— navigate ์ถ”๊ฐ€ + }, [user, isLoading, navigate]) if (isLoading) { return
๋กœ๋”ฉ ์ค‘...
} - if (!user) { - return null - } + if (!user) return null const handleAnswerChange = (questionIndex, value) => { setAnswers((prev) => ({ ...prev, [questionIndex]: Number.parseInt(value), })) + + // ๋‹ต๋ณ€์„ ์„ ํƒํ•˜๋ฉด ์ž๋™์œผ๋กœ ๋‹ค์Œ ๋ฌธํ•ญ์œผ๋กœ ์ด๋™ + if (questionIndex < questions.length - 1) { + setTimeout(() => { + setCurrentQuestion((prev) => prev + 1) + }, 300) // 300ms ํ›„ ๋‹ค์Œ ๋ฌธํ•ญ์œผ๋กœ ์ด๋™ (์‚ฌ์šฉ์ž๊ฐ€ ์„ ํƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋„๋ก) + } } const handleNext = () => { @@ -81,31 +85,41 @@ export default function TestPage() { setIsSubmitting(true) try { - // ์ ์ˆ˜ ๊ณ„์‚ฐ ๋กœ์ง const totalScore = Object.values(answers).reduce((sum, score) => sum + score, 0) const averageScore = totalScore / questions.length let personality = "" + let typeDescription = "" + if (averageScore >= 4) { - personality = "์™ธํ–ฅ์  ๋ฆฌ๋”ํ˜•" + personality = "Dํ˜• (์ง€๋ฐฐํ˜•)" + typeDescription = "๋‹น์‹ ์€ ๋„์ „์ ์ด๊ณ  ๋ฆฌ๋”์‹ญ์ด ๊ฐ•ํ•œ Dํ˜•์ž…๋‹ˆ๋‹ค!" } else if (averageScore >= 3) { - personality = "๊ท ํ˜•์žกํžŒ ๋ถ„์„ํ˜•" + personality = "Iํ˜• (์‚ฌ๊ตํ˜•)" + typeDescription = "๋‹น์‹ ์€ ํ™œ๋ฐœํ•˜๊ณ  ์‚ฌ๋žŒ์„ ์ข‹์•„ํ•˜๋Š” Iํ˜•์ž…๋‹ˆ๋‹ค!" + } else if (averageScore >= 2) { + personality = "Sํ˜• (์•ˆ์ •ํ˜•)" + typeDescription = "๋‹น์‹ ์€ ๋”ฐ๋œปํ•˜๊ณ  ์„ฑ์‹คํ•œ Sํ˜•์ž…๋‹ˆ๋‹ค!" } else { - personality = "์‹ ์ค‘ํ•œ ์‚ฌ์ƒ‰ํ˜•" + personality = "Cํ˜• (์‹ ์ค‘ํ˜•)" + typeDescription = "๋‹น์‹ ์€ ๋ถ„์„์ ์ด๊ณ  ๊ผผ๊ผผํ•œ Cํ˜•์ž…๋‹ˆ๋‹ค!" } - // ๋ฐฑ์—”๋“œ์— ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ์ €์žฅ const testResult = { - personality, - score: averageScore, - answers, + userId: user.id, + userType: personality, + typeDescription: typeDescription, completedAt: new Date().toISOString(), } - await testAPI.saveTestResult(testResult) + const response = await testAPI.saveTestResult(testResult) + const testId = response.testId + await contentAPI.requestRecommendation(testId) + await contentAPI.bookRecommendation(testId) + await contentAPI.musicRecommendation(testId) + await contentAPI.movieRecommendation(testId) - // ๊ฒฐ๊ณผ ํŽ˜์ด์ง€๋กœ ์ด๋™ (๊ฒฐ๊ณผ๋Š” ๋ฐฑ์—”๋“œ์—์„œ ์กฐํšŒ) - navigate("/result") // router.push ๋Œ€์‹  navigate ์‚ฌ์šฉ + navigate(`/result?testId=${testId}`) toast({ title: "ํ…Œ์ŠคํŠธ ์™„๋ฃŒ", @@ -128,7 +142,7 @@ export default function TestPage() { const allAnswered = questions.every((_, index) => answers[index] !== undefined) return ( -
+
@@ -136,42 +150,34 @@ export default function TestPage() {

์„ฑํ–ฅ ํ…Œ์ŠคํŠธ

- + {currentQuestion + 1} / {questions.length}
- + - {questions[currentQuestion]} + {questions[currentQuestion]} handleAnswerChange(currentQuestion, value)} > -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
+ {[5, 4, 3, 2, 1].map((val) => ( +
+ + +
+ ))}
@@ -181,14 +187,10 @@ export default function TestPage() { ์ด์ „ - {currentQuestion === questions.length - 1 ? ( + {currentQuestion === questions.length - 1 && ( - ) : ( - )}
diff --git a/src/utils/theme.js b/src/utils/theme.js new file mode 100644 index 0000000..e6b1529 --- /dev/null +++ b/src/utils/theme.js @@ -0,0 +1,27 @@ +// src/utils/theme.js + +export const getInitialTheme = () => { + if (typeof window !== "undefined" && window.localStorage) { + const storedPrefs = window.localStorage.getItem("theme") + if (typeof storedPrefs === "string") { + return storedPrefs + } + + const userMedia = window.matchMedia("(prefers-color-scheme: dark)") + if (userMedia.matches) { + return "dark" + } + } + + return "light" +} + +export const setTheme = (theme) => { + if (theme === "dark") { + document.documentElement.classList.add("dark") + localStorage.setItem("theme", "dark") + } else { + document.documentElement.classList.remove("dark") + localStorage.setItem("theme", "light") + } +} diff --git a/tailwind.config.js b/tailwind.config.js index 0f28e6b..a7d5554 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,5 +1,6 @@ /** @type {import('tailwindcss').Config} */ module.exports = { + darkMode: 'class', content: [ "./index.html", "./src/**/*.{js,ts,jsx,tsx}", diff --git a/terraform/main.tf b/terraform/main.tf new file mode 100644 index 0000000..97e7adc --- /dev/null +++ b/terraform/main.tf @@ -0,0 +1,91 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 6.0" + } + } +} + +# Default provider +provider "aws" { + region = var.aws_region +} + +# ACM cert provider (Cloudfront = us-east-1 ์ธ์ฆ์„œ๋งŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅ) +provider "aws" { + alias = "us-east-1" + region = "us-east-1" +} + +locals { + # acm ์ธ์ฆ์„œ์— ์‚ฌ์šฉ๋  san ๋ชฉ๋ก => ์™€์ผ๋“œ์นด๋“œ๋กœ + acm_sans = ["*.${var.domain_name}"] +} + +module "s3" { + source = "./modules/s3" + + bucket_name = var.bucket_name + log_bucket_name = var.log_bucket_name + prefix = var.prefix +} + +module "acm" { + source = "./modules/acm" + + providers = { + aws.us-east-1 = aws.us-east-1 + } + + domain_name = var.domain_name + subject_alternative_names = ["*.${var.domain_name}"] + # DNS ๋ฐฉ์‹์œผ๋กœ ๋„๋ฉ”์ธ ๊ฒ€์ฆ + validation_method = "DNS" + prefix = var.prefix +} + +module "cloudfront" { + source = "./modules/cloudfront" + + prefix = var.prefix + bucket_id = module.s3.bucket_id + bucket_arn = module.s3.bucket_arn + bucket_regional_domain_name = module.s3.bucket_regional_domain_name + domain_names = [var.domain_name, "www.${var.domain_name}"] + acm_certificate_arn = module.acm.certificate_arn + # log_bucket_domain_name = module.s3.log_bucket_domain_name +} + +module "route53" { + source = "./modules/route53" + + providers = { + aws.us-east-1 = aws.us-east-1 + } + + domain_name = var.domain_name + subdomain_names = ["", "www"] + # acm ์ธ์ฆ์ด ํ•„์š”ํ•œ ์ „์ฒด ๋„๋ฉ”์ธ ๋ชฉ๋ก์„ ์ „๋‹ฌ + acm_domains_for_validation = concat([var.domain_name], local.acm_sans) + acm_certificate_domain_validation_options = module.acm.domain_validation_options + acm_certificate_arn = module.acm.certificate_arn + cloudfront_distribution_domain_name = module.cloudfront.distribution_domain_name + cloudfront_distribution_hosted_zone_id = module.cloudfront.distribution_hosted_zone_id + + depends_on = [module.acm] +} + +module "github_oidc" { + source = "./modules/oidc" + + prefix = var.prefix + allowed_repositories = var.github_allowed_repo + bucket_arn = module.s3.bucket_arn + distribution_arn = module.cloudfront.distribution_arn +} + +# S3 ํผ๋ธ”๋ฆญ ์ „๋ฉด ์ฐจ๋‹จ +# CloudFront origin access control(OAC)ํ†ตํ•ด์„œ๋งŒ (Cloudfront์บ์‹œ ๊ณ„์ธต ๊ฒฝ์œ  ์š”์ฒญ๋งŒ ํ—ˆ์šฉ) ๋ฒ„ํ‚ท ๋‚ด ๊ฐ์ฒด ์ฝ์„ ์ˆ˜ ์žˆ๋„๋ก s3 ๋ฒ„ํ‚ท ์ •์ฑ… +# Cloudfront ์ƒ์„ฑ์‹œ OAC ์ƒ์„ฑ ํ•„์š” (S3 ์— ์„œ๋ช…๊ธฐ๋ฐ˜ ์š”์ฒญ) โ†’ OAC ID ๋ฅผ s3 ์ •์ฑ…/CloudFront origin ์„ค์ •์— ์—ฐ๊ฒฐํ•˜๋ฉด Cloudfornt ๋งŒ s3์— ์ ‘๊ทผ ๊ฐ€๋Šฅ == oidc ์ƒ์„ฑ ํ•„์š” +# OIDC๋กœ GitHub actions์—์„œ s3๋กœ ๋ฐฐํฌ ๊ฐ€๋Šฅ (s3 ํผ๋ธ”๋ฆญ ๋งŒ ์ฐจ๋‹จ โ†’ oidc๋กœ ์ž๊ฒฉ ์ฆ๋ช…) \ No newline at end of file diff --git a/terraform/modules/acm/main.tf b/terraform/modules/acm/main.tf new file mode 100644 index 0000000..d0e8cd7 --- /dev/null +++ b/terraform/modules/acm/main.tf @@ -0,0 +1,32 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 6.0" + # ๋ณ„๋„ ๋ฆฌ์ „์šฉ ํ”„๋กœ๋ฐ”์ด๋” ์ง€์ •ํ•˜๋„๋ก alias ์„ค์ • + configuration_aliases = [aws.us-east-1] + } + } +} + +# ACM cert ์ƒ์„ฑ (cloudfront acm cert = us-east-1์—์„œ๋งŒ ์ƒ์„ฑ๊ฐ€๋Šฅ) +resource "aws_acm_certificate" "fe" { + provider = aws.us-east-1 + + # ๊ธฐ๋ณธ ๋„๋ฉ”์ธ + domain_name = var.domain_name + # ์ถ”๊ฐ€ ๋„๋ฉ”์ธ ๋ชฉ๋ก + subject_alternative_names = var.subject_alternative_names + # ๋„๋ฉ”์ธ ์†Œ์œ ๊ถŒ ๊ฒ€์ฆ ๋ฐฉ์‹ (DNS or EMAIL) + validation_method = var.validation_method + + lifecycle { + # ๊ฐฑ์‹ ์‹œ ์ƒˆ ์ธ์ฆ์„œ ์ƒ์„ฑํ›„ ๊ธฐ์กด ์ธ์ฆ์„œ ํŒŒ๊ดด + create_before_destroy = true + } + + tags = { + "Name" = "${var.prefix}-certificate" + } +} + diff --git a/terraform/modules/acm/outputs.tf b/terraform/modules/acm/outputs.tf new file mode 100644 index 0000000..6dd41ab --- /dev/null +++ b/terraform/modules/acm/outputs.tf @@ -0,0 +1,19 @@ +output "certificate_arn" { + description = "ACM cert ARN" + value = aws_acm_certificate.fe.arn +} + +output "certificate_id" { + description = "ACM cert ID" + value = aws_acm_certificate.fe.id +} + +output "certificate_status" { + description = "ACM cert status" + value = aws_acm_certificate.fe.status +} + +output "domain_validation_options" { + description = "Domain validation option" + value = aws_acm_certificate.fe.domain_validation_options +} diff --git a/terraform/modules/acm/variables.tf b/terraform/modules/acm/variables.tf new file mode 100644 index 0000000..e9c1d13 --- /dev/null +++ b/terraform/modules/acm/variables.tf @@ -0,0 +1,21 @@ +variable "prefix" { + description = "Prefix for ACM module" + type = string +} + +variable "domain_name" { + description = "Domain name" + type = string +} + +variable "subject_alternative_names" { + description = "Subject alternative names" + type = list(string) + default = [] +} + +variable "validation_method" { + description = "Cert validation method (DNS or EMAIL)" + type = string + default = "DNS" +} diff --git a/terraform/modules/cloudfront/main.tf b/terraform/modules/cloudfront/main.tf new file mode 100644 index 0000000..c0dbc9f --- /dev/null +++ b/terraform/modules/cloudfront/main.tf @@ -0,0 +1,126 @@ +# ํด๋ผ์šฐ๋“œํ”„๋ก ํŠธ Origin access control ์ƒ์„ฑ +resource "aws_cloudfront_origin_access_control" "fe" { + name = "${var.prefix}-oac" + description = "OAC for ${var.prefix}-s3" + origin_access_control_origin_type = "s3" + # ์š”์ฒญ๋งˆ๋‹ค ์„œ๋ช… + signing_behavior = "always" + signing_protocol = "sigv4" +} + +#CF ์ƒ์„ฑ ๋ฐ ์„ค์ • +resource "aws_cloudfront_distribution" "fe" { + # origin = s3 + origin { + domain_name = var.bucket_regional_domain_name + origin_access_control_id = aws_cloudfront_origin_access_control.fe.id + origin_id = var.bucket_id + } + + enabled = true + is_ipv6_enabled = true + comment = "${var.prefix}-cf-distribution" + # ๋ฃจํŠธ ์š”์ฒญ์‹œ ๋ฐ˜ํ™˜ ๊ธฐ๋ณธ ๊ฐ์ฒด + default_root_object = "index.html" + aliases = var.domain_names + + # ์˜ค๋ฅ˜ ํŽ˜์ด์ง€ ์„ค์ • + custom_error_response { + error_code = 403 + response_page_path = "/index.html" + response_code = 200 + error_caching_min_ttl = 0 + } + + custom_error_response { + error_code = 404 + response_page_path = "/index.html" + response_code = 200 + error_caching_min_ttl = 0 + } + + + # logging_config { + # include_cookies = false + # bucket = var.log_bucket_domain_name + # prefix = "${var.prefix}/" + # } + + # ๊ธฐ๋ณธ ์บ์‹ฑ ์ •์ฑ… + default_cache_behavior { + allowed_methods = ["GET", "HEAD", "OPTIONS"] + cached_methods = ["GET", "HEAD"] + target_origin_id = var.bucket_id + + forwarded_values { + + query_string = true + # CORS ์ฒ˜๋ฆฌ ์œ„ํ•ด Origin, Access-Control-* ํ—ค๋”๋งŒ ์ „๋‹ฌ + headers = ["Origin", "Access-Control-Request-Method", "Access-Control-Request-Headers"] + + cookies { + + forward = "all" + } + } + + # https ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ + viewer_protocol_policy = "allow-all" + # ์บ์‹œ ์œ ํšจ๊ธฐ๊ฐ„ ์ดˆ + min_ttl = 0 + default_ttl = 3600 + max_ttl = 86400 + compress = true + } + + # ์ ‘์† ๊ตญ๊ฐ€ ์ œํ•œ + restrictions { + geo_restriction { + restriction_type = "none" + } + } + + # SSL TLS ์ธ์ฆ์„ฑ + viewer_certificate { + cloudfront_default_certificate = var.acm_certificate_arn == "" ? true : false + acm_certificate_arn = var.acm_certificate_arn != "" ? var.acm_certificate_arn : null + ssl_support_method = var.acm_certificate_arn != "" ? "sni-only" : null + minimum_protocol_version = var.acm_certificate_arn != "" ? "TLSv1.2_2021" : null + + } + + tags = { + "Name" = "${var.prefix}-cf-distribution" + } +} + +# CloudFront Origin access control ํ†ตํ•ด์„œ๋งŒ ๋ฒ„ํ‚ท ๊ฐ์ฒด ์ฝ์„ ์ˆ˜ ์žˆ๋„๋ก ์ •์ฑ… ์„ค์ • +# S3 ๋ฒ„ํ‚ท ์ •์ฑ… - Cloudfront ๋ฐฐํฌ ์ •๋ณด ํ•„์š”ํ•˜๋ฏ€๋กœ ์ˆœํ™˜์ฐธ์กฐ ๋ฌธ์ œ ํ•ด๊ฒฐ ์œ„ํ•ด cloudfront๋ชจ๋“ˆ์—์„œ ์„ ์–ธ +# Cloudfront -> S3 ํ•„์š” (aws_cloudfront_distribution์—์„œ ์›๋ณธ์œผ๋กœ ์‚ฌ์šฉํ•  s3 ์ •๋ณด ํ•„์š”), S3 ๋ฒ„ํ‚ท ์ •์ฑ… -> Cloudfront ํ•„์š” (ํŠน์ • cloudfront์—์„œ ์˜ค๋Š” ์š”์ฒญ๋งŒ ํ—ˆ์šฉํ•˜๋„๋ก ์ •์ฑ…ํ•˜๊ธฐ ์œ„ํ•ด์„œ) +resource "aws_s3_bucket_policy" "fe" { + bucket = var.bucket_id + + policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Effect = "Allow" + # CloudFront์— ๊ถŒํ•œ ๋ถ€์—ฌ + Principal = { + Service = "cloudfront.amazonaws.com" + } + # Resource์˜ S3 getObject ๊ถŒํ•œ + Action = "s3:GetObject" + Resource = "${var.bucket_arn}/*" + + # "AWS:SourceArn"์˜ ๊ฐ’์ด var.cloudfront_distribution_arn์™€ ๋˜‘๊ฐ™์„ ๋•Œ๋งŒ + Condition = { + StringEquals = { + "AWS:SourceArn" = aws_cloudfront_distribution.fe.arn + } + } + } + ] + } + ) +} diff --git a/terraform/modules/cloudfront/outputs.tf b/terraform/modules/cloudfront/outputs.tf new file mode 100644 index 0000000..fa566fb --- /dev/null +++ b/terraform/modules/cloudfront/outputs.tf @@ -0,0 +1,19 @@ +output "distribution_id" { + description = "CloudFront distribution ID" + value = aws_cloudfront_distribution.fe.id +} + +output "distribution_arn" { + description = "CloudFront distribution ARN" + value = aws_cloudfront_distribution.fe.arn +} + +output "distribution_domain_name" { + description = "CloudFront distribution domain name" + value = aws_cloudfront_distribution.fe.domain_name +} + +output "distribution_hosted_zone_id" { + description = "CloudFront distribution hosting zone ID" + value = aws_cloudfront_distribution.fe.hosted_zone_id +} \ No newline at end of file diff --git a/terraform/modules/cloudfront/variables.tf b/terraform/modules/cloudfront/variables.tf new file mode 100644 index 0000000..8d3a77b --- /dev/null +++ b/terraform/modules/cloudfront/variables.tf @@ -0,0 +1,36 @@ +variable "prefix" { + description = "Prefix for CloudFront module" + type = string +} + +variable "bucket_regional_domain_name" { + description = "S3 bucket region domain name" + type = string +} + +variable "bucket_id" { + description = "S3 bucket ID" + type = string +} + +variable "bucket_arn" { + description = "S3 bucket ARN" + type = string +} + +variable "acm_certificate_arn" { + description = "ACM certificate ARN" + type = string + default = "" +} + +variable "domain_names" { + description = "Domain CNAME list" + type = list(string) +} + +variable "log_bucket_domain_name" { + description = "S3 bucket name for log" + type = string + default = "" +} \ No newline at end of file diff --git a/terraform/modules/oidc/main.tf b/terraform/modules/oidc/main.tf new file mode 100644 index 0000000..e386f66 --- /dev/null +++ b/terraform/modules/oidc/main.tf @@ -0,0 +1,88 @@ +# github์—์„œ AWS์— oidc ๋ฐฉ์‹์œผ๋กœ ์—ฐ๋™ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” oidc provider ์ƒ์„ฑ +resource "aws_iam_openid_connect_provider" "github" { + # Github actions๊ฐ€ ํ† ํฐ ๋ฐœ๊ธ‰ํ•˜๋Š” oidc endpoint url + url = "https://token.actions.githubusercontent.com" + + # ๋ฐœ๊ธ‰๋ฐ›์€ ํ† ํฐ์„ aws stsํ†ตํ•ด ๊ตํ™˜์‹œ ํ—ˆ์šฉํ•  ํด๋ผ์ด์–ธํŠธ id + client_id_list = ["sts.amazonaws.com"] + + # github oidc ์ œ๊ณต์ž์˜ tls ์ธ์ฆ์„œ thumbprint -> aws๊ฐ€ provider ep์™€ ์•ˆ์ „ํ•˜๊ฒŒ ํ†ต์‹ ํ–ˆ์Œ ๊ฒ€์ฆ + thumbprint_list = var.thumbprint_list + + tags = { + "Name" = "${var.prefix}-github-oidc" + } +} + +# github actions๊ฐ€ aws ๋ฆฌ์†Œ์Šค ์ ‘๊ทผ์‹œ ์‚ฌ์šฉํ•  iam role +resource "aws_iam_role" "github" { + name = "${var.prefix}-github-actions-role" + + assume_role_policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Effect = "Allow" + Principal = { + # ๋งŒ๋“  oidc provider๋กœ ๋ถ€ํ„ฐ ๋ฐœ๊ธ‰๋œ ํ† ํฐ๋งŒ + Federated = aws_iam_openid_connect_provider.github.arn + } + # oidc ํ† ํฐ์œผ๋กœ role ํš๋“ํ•˜๋Š” sts api ํ˜ธ์ถœ + Action = "sts:AssumeRoleWithWebIdentity" + Condition = { + StringEquals = { + # ํ† ํฐ audience ๊ฐ€ aws sts์šฉ์ธ์ง€ ๊ฒ€์ฆ + "token.actions.githubusercontent.com:aud" = "sts.amazonaws.com" + } + StringLike = { + # ํ† ํฐ subject๊ฐ€ ํŠน์ • ๋ ˆํฌ์—์„œ ๋ฐœ๊ธ‰๋œ ๊ฒƒ๋งŒ ํ—ˆ์šฉ + "token.actions.githubusercontent.com:sub" = [ + for repo in var.allowed_repositories : "repo:${repo}:*" + ] + } + } + } + ] + }) + + tags = { + "Name" = "${var.prefix}-github-actions-role" + } +} + +# ์ƒ์„ฑํ•œ iam role์— policy ๋ถ€์—ฌ +resource "aws_iam_role_policy" "github" { + name = "${var.prefix}-github-actions-role-policy" + + role = aws_iam_role.github.id + + policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + # ๋ฒ„ํ‚ท์ž์ฒด, ๋ฒ„ํ‚ท๋‚ด ๋ชจ๋“  ๊ฐ์ฒด์— ๋Œ€ํ•œ crud + Effect = "Allow" + Action = [ + "s3:ListBucket", + "s3:PutObject", + "s3:GetObject", + "s3:DeleteObject", + "s3:PutObjectAcl" + ] + Resource = [ + var.bucket_arn, "${var.bucket_arn}/*" + ] + }, + { + # cloudfront ์บ์‹œ ๋ฌดํšจํ™” + Effect = "Allow" + Action = [ + "cloudfront:CreateInvalidation" + ] + Resource = [ + var.distribution_arn + ] + } + ] + }) +} \ No newline at end of file diff --git a/terraform/modules/oidc/outputs.tf b/terraform/modules/oidc/outputs.tf new file mode 100644 index 0000000..6b1be43 --- /dev/null +++ b/terraform/modules/oidc/outputs.tf @@ -0,0 +1,15 @@ +output "role_arn" { + description = "Github IAM Role ARN" + value = aws_iam_role.github.arn +} + +output "role_name" { + description = "Github IAM ROle name" + value = aws_iam_role.github.name +} + +output "oidc_provider_arn" { + description = "Github OIDC Provider ARN" + value = aws_iam_openid_connect_provider.github.arn +} + diff --git a/terraform/modules/oidc/variables.tf b/terraform/modules/oidc/variables.tf new file mode 100644 index 0000000..68d0b9a --- /dev/null +++ b/terraform/modules/oidc/variables.tf @@ -0,0 +1,27 @@ +variable "thumbprint_list" { + description = "Github OIDC thumbprint list" + type = list(string) + default = [ + "6938fd4d98bab03faadb97b34396831e3780aea1" + ] +} + +variable "prefix" { + description = "Prefix for OIDC module" + type = string +} + +variable "allowed_repositories" { + description = "Allowed github repo list (username/repo-name)" + type = list(string) +} + +variable "bucket_arn" { + description = "Allowed S3 bucket ARN" + type = string +} + +variable "distribution_arn" { + description = "Allowed CloudFront distribution ARN for invalidation" + type = string +} \ No newline at end of file diff --git a/terraform/modules/route53/main.tf b/terraform/modules/route53/main.tf new file mode 100644 index 0000000..83455cd --- /dev/null +++ b/terraform/modules/route53/main.tf @@ -0,0 +1,69 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 6.0" + # ๋ณ„๋„ ๋ฆฌ์ „์šฉ ํ”„๋กœ๋ฐ”์ด๋” ์ง€์ •ํ•˜๋„๋ก alias ์„ค์ • + configuration_aliases = [aws.us-east-1] + } + } +} + +# ์ด๋ฏธ ์กด์žฌํ•˜๋Š” hosted zone ์กฐํšŒ +data "aws_route53_zone" "main" { + name = var.domain_name +} + +# ACM validation dns records ์ƒ์„ฑ +resource "aws_route53_record" "cert_validation" { + for_each = { for idx, domain in var.acm_domains_for_validation : idx => domain } + + name = var.acm_certificate_domain_validation_options[each.key].resource_record_name + type = var.acm_certificate_domain_validation_options[each.key].resource_record_type + records = [var.acm_certificate_domain_validation_options[each.key].resource_record_value] + ttl = 60 + zone_id = data.aws_route53_zone.main.zone_id + allow_overwrite = true +} + +# ACM cert validation +# acm ์ธ์ฆ์„œ ์œ ํšจ์„ฑ ๊ฒ€์ฆ - Route53์—์„œ ๋งŒ๋“  dns ๋ ˆ์ฝ”๋“œ๋กœ ์œ ํšจ์„ฑ ๊ฒ€์ฆํ•ด์•ผํ•˜๋ฏ€๋กœ ์ˆœํ™˜์ฐธ์กฐ ๋ฌธ์ œ ํ•ด๊ฒฐ ์œ„ํ•ด route53๋ชจ๋“ˆ์—์„œ ์„ ์–ธ +# acm ๋ชจ๋“ˆ์ด ์ธ์ฆ์„œ ์ƒ์„ฑ(aws_acm_certificate) -> route53์ด acm ๋ชจ๋“ˆ์˜ ์ •๋ณด ๋ฐ›์•„ dns ๋ ˆ์ฝ”๋“œ ์ƒ์„ฑ(aws_route53_record) -> ๋งŒ๋“  dns ๋ ˆ์ฝ”๋“œ ๊ธฐ๋ฐ˜์œผ๋กœ acm ์ธ์ฆ์„œ ์œ ํšจ์„ฑ ๊ฒ€์ฆ (aws_acm_certificate_validation) +resource "aws_acm_certificate_validation" "fe" { + provider = aws.us-east-1 + + certificate_arn = var.acm_certificate_arn + # dns ๊ฒ€์ฆ์šฉ ๋ ˆ์ฝ”๋“œ fqdn(fully qualified domain name) ๋ชฉ๋ก + validation_record_fqdns = [for record in aws_route53_record.cert_validation : record.fqdn] + + timeouts { + # ์ธ์ฆ์„œ ๊ฒ€์ฆ ์™„๋ฃŒ๊นŒ์ง€ ๋Œ€๊ธฐ ์‹œ๊ฐ„ + create = "30m" + } +} + +# a record ์ƒ์„ฑ (ipv4) +resource "aws_route53_record" "frontend_a" { + for_each = toset(var.subdomain_names) + zone_id = data.aws_route53_zone.main.zone_id + name = each.value == "" ? var.domain_name : "${each.value}.${var.domain_name}" + type = "A" + alias { + name = var.cloudfront_distribution_domain_name + zone_id = var.cloudfront_distribution_hosted_zone_id + evaluate_target_health = false + } +} + +# aaaa record ์ƒ์„ฑ (ipv6) +resource "aws_route53_record" "frontend_aaaa" { + for_each = toset(var.subdomain_names) + zone_id = data.aws_route53_zone.main.zone_id + name = each.value == "" ? var.domain_name : "${each.value}.${var.domain_name}" + type = "AAAA" + alias { + name = var.cloudfront_distribution_domain_name + zone_id = var.cloudfront_distribution_hosted_zone_id + evaluate_target_health = false + } +} \ No newline at end of file diff --git a/terraform/modules/route53/outputs.tf b/terraform/modules/route53/outputs.tf new file mode 100644 index 0000000..a819d0f --- /dev/null +++ b/terraform/modules/route53/outputs.tf @@ -0,0 +1,11 @@ +output "zone_id" { + description = "Route53 hosting zone ID" + value = data.aws_route53_zone.main.zone_id +} + +output "name_servers" { + description = "Route53 nameserver" + value = data.aws_route53_zone.main.name_servers +} + + diff --git a/terraform/modules/route53/variables.tf b/terraform/modules/route53/variables.tf new file mode 100644 index 0000000..3543b1a --- /dev/null +++ b/terraform/modules/route53/variables.tf @@ -0,0 +1,41 @@ +variable "domain_name" { + description = "Route domain name" + type = string +} + +variable "subdomain_names" { + description = "Subdomain list" + type = list(string) +} + +variable "acm_domains_for_validation" { + description = "Domain list for ACM validation" + type = list(string) + default = [] +} + +variable "acm_certificate_domain_validation_options" { + description = "ACM domain validation" + type = list(object({ + domain_name = string + resource_record_name = string + resource_record_type = string + resource_record_value = string + })) + default = [] +} + +variable "acm_certificate_arn" { + description = "ACM certificate ARN for validation" + type = string +} + +variable "cloudfront_distribution_domain_name" { + description = "Cloudfront distribution domain name for alias record" + type = string +} + +variable "cloudfront_distribution_hosted_zone_id" { + description = "Cloudfront distribution hosted zone ID for alias record" + type = string +} \ No newline at end of file diff --git a/terraform/modules/s3/main.tf b/terraform/modules/s3/main.tf new file mode 100644 index 0000000..c14f2a1 --- /dev/null +++ b/terraform/modules/s3/main.tf @@ -0,0 +1,94 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 6.0" + } + } +} +# content bucket ์ƒ์„ฑ +resource "aws_s3_bucket" "fe" { + bucket = var.bucket_name + + tags = { + "Name" = "${var.prefix}-bucket" + } +} + +resource "aws_s3_bucket_versioning" "fe" { + bucket = aws_s3_bucket.fe.id + + versioning_configuration { + status = "Enabled" + } +} + +# ํผ๋ธ”๋ฆญ ์—‘์„ธ์Šค ์ „๋ฉด ์ฐจ๋‹จ +resource "aws_s3_bucket_public_access_block" "fe" { + bucket = aws_s3_bucket.fe.id + + block_public_acls = true + block_public_policy = true + ignore_public_acls = true + restrict_public_buckets = true +} + +# ๋ชจ๋“  ๊ฐ์ฒด ์„œ๋ฒ„์‚ฌ์ด๋“œ ์•”ํ˜ธํ™” / ๋ณ„๋„ ํ‚ค ๊ด€๋ฆฌ ํ•„์š” ์—†๋Š” s3 ๊ด€๋ฆฌํ˜• ํ‚ค๋กœ ๊ฐ์ฒด ์•”ํ˜ธํ™” +resource "aws_s3_bucket_server_side_encryption_configuration" "fe" { + bucket = aws_s3_bucket.fe.id + + rule { + apply_server_side_encryption_by_default { + sse_algorithm = "AES256" + } + } +} + +resource "aws_s3_bucket_website_configuration" "bucket_config" { + bucket = aws_s3_bucket.fe.id + + index_document { + suffix = "index.html" + } + + error_document { + key = "index.html" + } +} + + +# # log bucket ์ƒ์„ฑ +# resource "aws_s3_bucket" "fe_log" { +# bucket = var.log_bucket_name +# +# tags = { +# "Name" = "${var.prefix}-log-bucket" +# } +# } +# +# resource "aws_s3_bucket_public_access_block" "fe_log" { +# bucket = aws_s3_bucket.fe_log.id +# +# # ๋ฒ„ํ‚ท acl ํ™œ์„ฑํ™” +# block_public_acls = false +# block_public_policy = false +# ignore_public_acls = false +# restrict_public_buckets = true +# } +# +# # ๋ฒ„ํ‚ท ๊ฐ์ฒด ์†Œ์œ ๊ถŒ => ๋ฒ„ํ‚ท owner, cloudfront๊ฐ€ ๋กœ๊ทธ ์—…๋กœ๋“œ ํ—ˆ์šฉ +# resource "aws_s3_bucket_ownership_controls" "fe_log" { +# bucket = aws_s3_bucket.fe_log.id +# rule { +# object_ownership = "BucketOwnerPreferred" +# } +# } +# +# # AWS log delivery ์„œ๋น„์Šค๊ฐ€ ๋กœ๊ทธ๋ฅผ ์“ธ ์ˆ˜ ์žˆ๋„๋ก acl ์„ค์ • +# resource "aws_s3_bucket_acl" "fe_log" { +# # ์†Œ์œ ๊ถŒ ์„ค์ • ๋จผ์ € ์ ์šฉ +# depends_on = [aws_s3_bucket_ownership_controls.fe_log] +# +# bucket = aws_s3_bucket.fe_log.id +# acl = "log-delivery-write" +# } \ No newline at end of file diff --git a/terraform/modules/s3/outputs.tf b/terraform/modules/s3/outputs.tf new file mode 100644 index 0000000..268e6c1 --- /dev/null +++ b/terraform/modules/s3/outputs.tf @@ -0,0 +1,24 @@ +output "bucket_id" { + description = "S3 bucket ID" + value = aws_s3_bucket.fe.id +} + +output "bucket_arn" { + description = "S3 bucket ARN" + value = aws_s3_bucket.fe.arn +} + +output "bucket_domain_name" { + description = "S3 bucket domain name" + value = aws_s3_bucket.fe.bucket_domain_name +} + +output "bucket_regional_domain_name" { + description = "S3 bucket region domain name" + value = aws_s3_bucket.fe.bucket_regional_domain_name +} + +# output "log_bucket_domain_name" { +# description = "S3 log bucket domain name" +# value = aws_s3_bucket.fe_log.bucket_domain_name +# } \ No newline at end of file diff --git a/terraform/modules/s3/variables.tf b/terraform/modules/s3/variables.tf new file mode 100644 index 0000000..583bbea --- /dev/null +++ b/terraform/modules/s3/variables.tf @@ -0,0 +1,14 @@ +variable "bucket_name" { + default = "S3 Bucket Name" + type = string +} + +variable "prefix" { + description = "Prefix for S3 module" + type = string +} + +variable "log_bucket_name" { + description = "S3 bucket name for log" + type = string +} \ No newline at end of file diff --git a/terraform/outputs.tf b/terraform/outputs.tf new file mode 100644 index 0000000..d9010c2 --- /dev/null +++ b/terraform/outputs.tf @@ -0,0 +1,104 @@ +output "S3_BUCKET_NAME" { + description = "GitHub secrets(S3_BUCKET_NAME) - S3 bukcet ID" + value = module.s3.bucket_id +} + +output "AWS_ROLE_ARN" { + description = "GitHub secrets(AWS_ROLE_ARN) - Github IAM Role ARN" + value = module.github_oidc.role_arn +} + +output "CLOUDFRONT_DISTRIBUTION_ID" { + description = "GitHub secrets(CLOUDFRONT_DISTRIBUTION_ID) - Cloudfront distribution ID" + value = module.cloudfront.distribution_id +} + +output "AWS_REGION" { + description = "GitHub secrets(AWS_REGION) - AWS region" + value = var.aws_region +} + +output "web_urls" { + description = "Frontend access URL" + value = [ + "https://${var.domain_name}", + "https://www.${var.domain_name}" + ] +} + +# output "cloudfront_distribution_domain" { +# description = "CloudFront distribution domain" +# value = module.cloudfront.distribution_domain_name +# } +# +# output "acm_certificate_status" { +# description = "ACM certificate status" +# value = module.acm.certificate_status +# } +# +# +# +# output "s3_bucket_arn" { +# description = "S3 bucket ARN" +# value = module.s3.bucket_arn +# } +# +# output "s3_bucket_domain_name" { +# description = "S3 bukcet domain name" +# value = module.s3.bucket_domain_name +# } +# +# output "s3_bucket_regional_domain_name" { +# description = "S3 bucket region domain name" +# value = module.s3.bucket_regional_domain_name +# } +# +# output "s3_fe_log_bucket_domain_name" { +# description = "Frontend CloudFront access log S3 bucket" +# value = module.s3.log_bucket_domain_name +# } +# +# output "route53_zone_id" { +# description = "Route53 hosting zone ID" +# value = module.route53.zone_id +# } +# +# output "route53_name_servers" { +# description = "Route53 nameserver" +# value = module.route53.name_servers +# } +# +# output "github_role_name" { +# description = "Github IAM Role name" +# value = module.github_oidc.role_name +# } +# +# output "github_oidc_provider_arn" { +# description = "Github OIDC Provider ARN" +# value = module.github_oidc.oidc_provider_arn +# } +# +# output "cf_distribution_arn" { +# description = "CloudFront distribution ARN" +# value = module.cloudfront.distribution_arn +# } +# +# output "cf_distribution_hosted_zone_id" { +# description = "CloudFront distribution hosted zone ID" +# value = module.cloudfront.distribution_hosted_zone_id +# } +# +# output "acm_cert_arn" { +# description = "ACM certificate ARN" +# value = module.acm.certificate_arn +# } +# +# output "acm_cert_id" { +# description = "ACM certificate ID" +# value = module.acm.certificate_id +# } +# +# output "acm_dom_val_opt" { +# description = "ACM Domain validation option" +# value = module.acm.domain_validation_options +# } \ No newline at end of file diff --git a/terraform/variables.tf b/terraform/variables.tf new file mode 100644 index 0000000..cd0a36e --- /dev/null +++ b/terraform/variables.tf @@ -0,0 +1,29 @@ +variable "aws_region" { + description = "AWS Region" + type = string +} + +variable "prefix" { + description = "Prefix" + type = string +} + +variable "domain_name" { + description = "Domain name" + type = string +} + +variable "bucket_name" { + description = "S3 bucket name" + type = string +} + +variable "github_allowed_repo" { + description = "Allowed github repo list (username/repo-name)" + type = list(string) +} + +variable "log_bucket_name" { + description = "S3 bucket name for Cloudfront access log" + type = string +} \ No newline at end of file