diff --git a/.idea/sonarlint.xml b/.idea/sonarlint.xml new file mode 100644 index 0000000..e69de29 diff --git a/backend/src/main/java/org/example/backend/IdService.java b/backend/src/main/java/org/example/backend/IdService.java new file mode 100644 index 0000000..e632869 --- /dev/null +++ b/backend/src/main/java/org/example/backend/IdService.java @@ -0,0 +1,15 @@ +package org.example.backend; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import java.util.UUID; + +@Service +@RequiredArgsConstructor + +public class IdService { + + public String randomId() { + return UUID.randomUUID().toString(); + } +} diff --git a/backend/src/main/java/org/example/backend/NewProduct.java b/backend/src/main/java/org/example/backend/NewProduct.java new file mode 100644 index 0000000..e837220 --- /dev/null +++ b/backend/src/main/java/org/example/backend/NewProduct.java @@ -0,0 +1,9 @@ +package org.example.backend; + +import lombok.With; + +@With +public record NewProduct( + String name, + int amount +){} diff --git a/backend/src/main/java/org/example/backend/ProductController.java b/backend/src/main/java/org/example/backend/ProductController.java index 9006c14..b1b3d17 100644 --- a/backend/src/main/java/org/example/backend/ProductController.java +++ b/backend/src/main/java/org/example/backend/ProductController.java @@ -2,12 +2,8 @@ import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - import java.util.List; + @RequiredArgsConstructor @RestController @RequestMapping("/api/products") @@ -19,12 +15,16 @@ public List getAllGroceries() { return productService.findAllGroceries(); } + @PostMapping + public Product addProduct(@RequestBody NewProduct newProduct) { + return productService.saveProduct(newProduct); + } + @DeleteMapping("{id}") void delete(@PathVariable String id) { productService.deletebyid(id); } - @GetMapping("{id}") public Product getGroceryProductById(@PathVariable String id){ return productService.findGroceriesById(id); diff --git a/backend/src/main/java/org/example/backend/ProductService.java b/backend/src/main/java/org/example/backend/ProductService.java index 16028bb..c51a242 100644 --- a/backend/src/main/java/org/example/backend/ProductService.java +++ b/backend/src/main/java/org/example/backend/ProductService.java @@ -11,6 +11,7 @@ @Service public class ProductService { private final ProductRepository productRepository; + private final IdService idService; public void deletebyid(String id) { productRepository.deleteById(id); @@ -21,6 +22,10 @@ public List findAllGroceries(){ return productRepository.findAll(); } + public Product saveProduct(NewProduct newProduct){ + Product product = new Product(idService.randomId(), newProduct.name(), newProduct.amount()); + return productRepository.save(product); + } public Product findGroceriesById(String id) { return productRepository.findById(id) diff --git a/backend/src/main/resources/static/index.html b/backend/src/main/resources/static/index.html index 47b0a8a..324f78a 100644 --- a/backend/src/main/resources/static/index.html +++ b/backend/src/main/resources/static/index.html @@ -1,15 +1,15 @@ - - - - - Vite + React + TS - - - - -
+ + + + + Vite + React + TS + + + + +
- - + + \ No newline at end of file diff --git a/backend/src/test/java/org/example/backend/ProductControllerTest.java b/backend/src/test/java/org/example/backend/ProductControllerTest.java index 9678fc6..c155ce8 100644 --- a/backend/src/test/java/org/example/backend/ProductControllerTest.java +++ b/backend/src/test/java/org/example/backend/ProductControllerTest.java @@ -4,12 +4,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; @SpringBootTest @@ -21,8 +22,9 @@ class ProductControllerTest { @Autowired ProductRepository productRepository; - @DirtiesContext + @Test + @DirtiesContext void getAllGroceries() throws Exception { //GIVEN //WHEN @@ -42,13 +44,29 @@ void deletebyid() throws Exception { mockMvc.perform(MockMvcRequestBuilders.delete("/api/products/2")) //Then .andExpect(status().isOk()); + } + @Test + @DirtiesContext + void addNewProduct() throws Exception { + //GIVEN - - - - + //WHEN + mockMvc.perform(post("/api/products") + .contentType(MediaType.APPLICATION_JSON) + .content(""" + { + "name": "Milch", + "amount": 1 + } + """)) + //THEN + .andExpect(status().isOk()) + .andExpect(jsonPath("$.id").exists()) + .andExpect(jsonPath("$.name").value("Milch")) + .andExpect(jsonPath("$.amount").value(1)); } + @Test @DirtiesContext void getGroceryProductById() throws Exception { diff --git a/backend/src/test/java/org/example/backend/ProductServiceTest.java b/backend/src/test/java/org/example/backend/ProductServiceTest.java index 0b23623..92f408d 100644 --- a/backend/src/test/java/org/example/backend/ProductServiceTest.java +++ b/backend/src/test/java/org/example/backend/ProductServiceTest.java @@ -1,7 +1,6 @@ package org.example.backend; import org.junit.jupiter.api.Test; - import java.util.List; import java.util.Optional; @@ -9,8 +8,11 @@ import static org.mockito.Mockito.*; class ProductServiceTest { + + IdService idService = mock(IdService.class); ProductRepository productRepository = mock(ProductRepository.class); - ProductService productService = new ProductService(productRepository); + ProductService productService = new ProductService(productRepository, idService); + @Test void findAllGroceries() { @@ -28,22 +30,37 @@ void findAllGroceries() { assertEquals(products, actual); } @Test + void addProdukt() { + // GIVEN + NewProduct newProduct = new NewProduct("Orangen", 5); + Product saveProduct = new Product(idService.randomId(), newProduct.name(), newProduct.amount()); + when(productRepository.save(saveProduct)).thenReturn(saveProduct); + when(idService.randomId()).thenReturn(saveProduct.id()); + + // WHEN + Product actual = productService.saveProduct(newProduct); + + // THEN + Product expected = new Product(idService.randomId(), newProduct.name(), newProduct.amount()); + verify(productRepository).save(saveProduct); + assertEquals(expected, actual); + } + @Test void deleteProduct_Test() { doNothing().when(productRepository).deleteById("2"); productService.deletebyid("2"); verify(productRepository).deleteById("2"); } - - @Test - void findGroceriesById() { - //GIVEN - String id = "4"; - Product product = new Product("4","apple", 7); - when(productRepository.findById(id)).thenReturn(Optional.of(product)); - //WHEN - Product actual = productService.findGroceriesById(id); - //THEN - verify(productRepository).findById(id); - assertEquals(product, actual); + @Test + void findGroceriesById() { + //GIVEN + String id = "4"; + Product product = new Product("4","apple", 7); + when(productRepository.findById(id)).thenReturn(Optional.of(product)); + //WHEN + Product actual = productService.findGroceriesById(id); + //THEN + verify(productRepository).findById(id); + assertEquals(product, actual); } } \ No newline at end of file diff --git a/frontend/dist/assets/index-DO30CrK6.js b/frontend/dist/assets/index-DO30CrK6.js new file mode 100644 index 0000000..6e06445 --- /dev/null +++ b/frontend/dist/assets/index-DO30CrK6.js @@ -0,0 +1,45 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();var Ws={exports:{}},El={},Qs={exports:{}},F={};/** + * @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 ar=Symbol.for("react.element"),Nf=Symbol.for("react.portal"),Of=Symbol.for("react.fragment"),Lf=Symbol.for("react.strict_mode"),zf=Symbol.for("react.profiler"),Ff=Symbol.for("react.provider"),Df=Symbol.for("react.context"),Af=Symbol.for("react.forward_ref"),Mf=Symbol.for("react.suspense"),jf=Symbol.for("react.memo"),If=Symbol.for("react.lazy"),Eu=Symbol.iterator;function Uf(e){return e===null||typeof e!="object"?null:(e=Eu&&e[Eu]||e["@@iterator"],typeof e=="function"?e:null)}var Ks={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Xs=Object.assign,Js={};function mn(e,t,n){this.props=e,this.context=t,this.refs=Js,this.updater=n||Ks}mn.prototype.isReactComponent={};mn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};mn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function qs(){}qs.prototype=mn.prototype;function Ei(e,t,n){this.props=e,this.context=t,this.refs=Js,this.updater=n||Ks}var ki=Ei.prototype=new qs;ki.constructor=Ei;Xs(ki,mn.prototype);ki.isPureReactComponent=!0;var ku=Array.isArray,Ys=Object.prototype.hasOwnProperty,xi={current:null},Gs={key:!0,ref:!0,__self:!0,__source:!0};function Zs(e,t,n){var r,l={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)Ys.call(t,r)&&!Gs.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1>>1,G=R[Q];if(0>>1;Ql(Wl,z))Ctl(vr,Wl)?(R[Q]=vr,R[Ct]=z,Q=Ct):(R[Q]=Wl,R[xt]=z,Q=xt);else if(Ctl(vr,z))R[Q]=vr,R[Ct]=z,Q=Ct;else break e}}return O}function l(R,O){var z=R.sortIndex-O.sortIndex;return z!==0?z:R.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,u=i.now();e.unstable_now=function(){return i.now()-u}}var s=[],a=[],p=1,h=null,m=3,S=!1,v=!1,w=!1,k=typeof setTimeout=="function"?setTimeout:null,d=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function f(R){for(var O=n(a);O!==null;){if(O.callback===null)r(a);else if(O.startTime<=R)r(a),O.sortIndex=O.expirationTime,t(s,O);else break;O=n(a)}}function g(R){if(w=!1,f(R),!v)if(n(s)!==null)v=!0,Hl(x);else{var O=n(a);O!==null&&Vl(g,O.startTime-R)}}function x(R,O){v=!1,w&&(w=!1,d(T),T=-1),S=!0;var z=m;try{for(f(O),h=n(s);h!==null&&(!(h.expirationTime>O)||R&&!Oe());){var Q=h.callback;if(typeof Q=="function"){h.callback=null,m=h.priorityLevel;var G=Q(h.expirationTime<=O);O=e.unstable_now(),typeof G=="function"?h.callback=G:h===n(s)&&r(s),f(O)}else r(s);h=n(s)}if(h!==null)var yr=!0;else{var xt=n(a);xt!==null&&Vl(g,xt.startTime-O),yr=!1}return yr}finally{h=null,m=z,S=!1}}var C=!1,_=null,T=-1,M=5,L=-1;function Oe(){return!(e.unstable_now()-LR||125Q?(R.sortIndex=z,t(a,R),n(s)===null&&R===n(a)&&(w?(d(T),T=-1):w=!0,Vl(g,z-Q))):(R.sortIndex=G,t(s,R),v||S||(v=!0,Hl(x))),R},e.unstable_shouldYield=Oe,e.unstable_wrapCallback=function(R){var O=m;return function(){var z=m;m=O;try{return R.apply(this,arguments)}finally{m=z}}}})(ra);na.exports=ra;var Yf=na.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 Gf=Wn,Ee=Yf;function E(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"),ko=Object.prototype.hasOwnProperty,Zf=/^[: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]*$/,Cu={},_u={};function bf(e){return ko.call(_u,e)?!0:ko.call(Cu,e)?!1:Zf.test(e)?_u[e]=!0:(Cu[e]=!0,!1)}function ed(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 td(e,t,n,r){if(t===null||typeof t>"u"||ed(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 ce(e,t,n,r,l,o,i){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=o,this.removeEmptyString=i}var ne={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ne[e]=new ce(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ne[t]=new ce(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ne[e]=new ce(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ne[e]=new ce(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){ne[e]=new ce(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ne[e]=new ce(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ne[e]=new ce(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ne[e]=new ce(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ne[e]=new ce(e,5,!1,e.toLowerCase(),null,!1,!1)});var _i=/[\-:]([a-z])/g;function Pi(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(_i,Pi);ne[t]=new ce(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(_i,Pi);ne[t]=new ce(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(_i,Pi);ne[t]=new ce(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ne[e]=new ce(e,1,!1,e.toLowerCase(),null,!1,!1)});ne.xlinkHref=new ce("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ne[e]=new ce(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ri(e,t,n,r){var l=ne.hasOwnProperty(t)?ne[t]:null;(l!==null?l.type!==0:r||!(2u||l[i]!==o[u]){var s=` +`+l[i].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=i&&0<=u);break}}}finally{Xl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ln(e):""}function nd(e){switch(e.tag){case 5:return Ln(e.type);case 16:return Ln("Lazy");case 13:return Ln("Suspense");case 19:return Ln("SuspenseList");case 0:case 2:case 15:return e=Jl(e.type,!1),e;case 11:return e=Jl(e.type.render,!1),e;case 1:return e=Jl(e.type,!0),e;default:return""}}function Po(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 Wt:return"Fragment";case Vt:return"Portal";case xo:return"Profiler";case Ti:return"StrictMode";case Co:return"Suspense";case _o:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ia:return(e.displayName||"Context")+".Consumer";case oa:return(e._context.displayName||"Context")+".Provider";case Ni:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Oi:return t=e.displayName||null,t!==null?t:Po(e.type)||"Memo";case lt:t=e._payload,e=e._init;try{return Po(e(t))}catch{}}return null}function rd(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 Po(t);case 8:return t===Ti?"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 gt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function sa(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ld(e){var t=sa(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,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Sr(e){e._valueTracker||(e._valueTracker=ld(e))}function aa(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=sa(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function qr(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 Ro(e,t){var n=t.checked;return V({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ru(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=gt(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 ca(e,t){t=t.checked,t!=null&&Ri(e,"checked",t,!1)}function To(e,t){ca(e,t);var n=gt(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")?No(e,t.type,n):t.hasOwnProperty("defaultValue")&&No(e,t.type,gt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Tu(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 No(e,t,n){(t!=="number"||qr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zn=Array.isArray;function tn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Er.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Kn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var An={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},od=["Webkit","ms","Moz","O"];Object.keys(An).forEach(function(e){od.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),An[t]=An[e]})});function ha(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||An.hasOwnProperty(e)&&An[e]?(""+t).trim():t+"px"}function ma(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=ha(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var id=V({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 zo(e,t){if(t){if(id[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(E(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(E(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(E(61))}if(t.style!=null&&typeof t.style!="object")throw Error(E(62))}}function Fo(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 Do=null;function Li(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ao=null,nn=null,rn=null;function Lu(e){if(e=dr(e)){if(typeof Ao!="function")throw Error(E(280));var t=e.stateNode;t&&(t=Pl(t),Ao(e.stateNode,e.type,t))}}function ya(e){nn?rn?rn.push(e):rn=[e]:nn=e}function va(){if(nn){var e=nn,t=rn;if(rn=nn=null,Lu(e),t)for(e=0;e>>=0,e===0?32:31-(vd(e)/gd|0)|0}var kr=64,xr=4194304;function Fn(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 br(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var u=i&~l;u!==0?r=Fn(u):(o&=i,o!==0&&(r=Fn(o)))}else i=n&~l,i!==0?r=Fn(i):o!==0&&(r=Fn(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function cr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ae(t),e[t]=n}function kd(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=jn),Bu=" ",$u=!1;function ja(e,t){switch(e){case"keyup":return Yd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ia(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Qt=!1;function Zd(e,t){switch(e){case"compositionend":return Ia(t);case"keypress":return t.which!==32?null:($u=!0,Bu);case"textInput":return e=t.data,e===Bu&&$u?null:e;default:return null}}function bd(e,t){if(Qt)return e==="compositionend"||!Ui&&ja(e,t)?(e=Aa(),Ir=Mi=st=null,Qt=!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=Qu(n)}}function Ha(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ha(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Va(){for(var e=window,t=qr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=qr(e.document)}return t}function Bi(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 sp(e){var t=Va(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ha(n.ownerDocument.documentElement,n)){if(r!==null&&Bi(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,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=Ku(n,o);var i=Ku(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.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,Kt=null,$o=null,Un=null,Ho=!1;function Xu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ho||Kt==null||Kt!==qr(r)||(r=Kt,"selectionStart"in r&&Bi(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}),Un&&Zn(Un,r)||(Un=r,r=nl($o,"onSelect"),0qt||(e.current=Jo[qt],Jo[qt]=null,qt--)}function j(e,t){qt++,Jo[qt]=e.current,e.current=t}var wt={},ie=Et(wt),pe=Et(!1),Dt=wt;function an(e,t){var n=e.type.contextTypes;if(!n)return wt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function he(e){return e=e.childContextTypes,e!=null}function ll(){U(pe),U(ie)}function es(e,t,n){if(ie.current!==wt)throw Error(E(168));j(ie,t),j(pe,n)}function Za(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(E(108,rd(e)||"Unknown",l));return V({},n,r)}function ol(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||wt,Dt=ie.current,j(ie,e),j(pe,pe.current),!0}function ts(e,t,n){var r=e.stateNode;if(!r)throw Error(E(169));n?(e=Za(e,t,Dt),r.__reactInternalMemoizedMergedChildContext=e,U(pe),U(ie),j(ie,e)):U(pe),j(pe,n)}var Xe=null,Rl=!1,so=!1;function ba(e){Xe===null?Xe=[e]:Xe.push(e)}function Sp(e){Rl=!0,ba(e)}function kt(){if(!so&&Xe!==null){so=!0;var e=0,t=A;try{var n=Xe;for(A=1;e>=i,l-=i,Je=1<<32-Ae(t)+l|n<T?(M=_,_=null):M=_.sibling;var L=m(d,_,f[T],g);if(L===null){_===null&&(_=M);break}e&&_&&L.alternate===null&&t(d,_),c=o(L,c,T),C===null?x=L:C.sibling=L,C=L,_=M}if(T===f.length)return n(d,_),B&&_t(d,T),x;if(_===null){for(;TT?(M=_,_=null):M=_.sibling;var Oe=m(d,_,L.value,g);if(Oe===null){_===null&&(_=M);break}e&&_&&Oe.alternate===null&&t(d,_),c=o(Oe,c,T),C===null?x=Oe:C.sibling=Oe,C=Oe,_=M}if(L.done)return n(d,_),B&&_t(d,T),x;if(_===null){for(;!L.done;T++,L=f.next())L=h(d,L.value,g),L!==null&&(c=o(L,c,T),C===null?x=L:C.sibling=L,C=L);return B&&_t(d,T),x}for(_=r(d,_);!L.done;T++,L=f.next())L=S(_,d,T,L.value,g),L!==null&&(e&&L.alternate!==null&&_.delete(L.key===null?T:L.key),c=o(L,c,T),C===null?x=L:C.sibling=L,C=L);return e&&_.forEach(function(Sn){return t(d,Sn)}),B&&_t(d,T),x}function k(d,c,f,g){if(typeof f=="object"&&f!==null&&f.type===Wt&&f.key===null&&(f=f.props.children),typeof f=="object"&&f!==null){switch(f.$$typeof){case wr:e:{for(var x=f.key,C=c;C!==null;){if(C.key===x){if(x=f.type,x===Wt){if(C.tag===7){n(d,C.sibling),c=l(C,f.props.children),c.return=d,d=c;break e}}else if(C.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===lt&&ls(x)===C.type){n(d,C.sibling),c=l(C,f.props),c.ref=Rn(d,C,f),c.return=d,d=c;break e}n(d,C);break}else t(d,C);C=C.sibling}f.type===Wt?(c=zt(f.props.children,d.mode,g,f.key),c.return=d,d=c):(g=Kr(f.type,f.key,f.props,null,d.mode,g),g.ref=Rn(d,c,f),g.return=d,d=g)}return i(d);case Vt:e:{for(C=f.key;c!==null;){if(c.key===C)if(c.tag===4&&c.stateNode.containerInfo===f.containerInfo&&c.stateNode.implementation===f.implementation){n(d,c.sibling),c=l(c,f.children||[]),c.return=d,d=c;break e}else{n(d,c);break}else t(d,c);c=c.sibling}c=vo(f,d.mode,g),c.return=d,d=c}return i(d);case lt:return C=f._init,k(d,c,C(f._payload),g)}if(zn(f))return v(d,c,f,g);if(kn(f))return w(d,c,f,g);Or(d,f)}return typeof f=="string"&&f!==""||typeof f=="number"?(f=""+f,c!==null&&c.tag===6?(n(d,c.sibling),c=l(c,f),c.return=d,d=c):(n(d,c),c=yo(f,d.mode,g),c.return=d,d=c),i(d)):n(d,c)}return k}var fn=rc(!0),lc=rc(!1),sl=Et(null),al=null,Zt=null,Wi=null;function Qi(){Wi=Zt=al=null}function Ki(e){var t=sl.current;U(sl),e._currentValue=t}function Go(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 on(e,t){al=e,Wi=Zt=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(de=!0),e.firstContext=null)}function Te(e){var t=e._currentValue;if(Wi!==e)if(e={context:e,memoizedValue:t,next:null},Zt===null){if(al===null)throw Error(E(308));Zt=e,al.dependencies={lanes:0,firstContext:e}}else Zt=Zt.next=e;return t}var Tt=null;function Xi(e){Tt===null?Tt=[e]:Tt.push(e)}function oc(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Xi(t)):(n.next=l.next,l.next=n),t.interleaved=n,be(e,r)}function be(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 ot=!1;function Ji(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ic(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 Ye(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ht(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,D&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,be(e,n)}return l=r.interleaved,l===null?(t.next=t,Xi(r)):(t.next=l.next,l.next=t),r.interleaved=t,be(e,n)}function Br(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,Fi(e,n)}}function os(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,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 cl(e,t,n,r){var l=e.updateQueue;ot=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var s=u,a=s.next;s.next=null,i===null?o=a:i.next=a,i=s;var p=e.alternate;p!==null&&(p=p.updateQueue,u=p.lastBaseUpdate,u!==i&&(u===null?p.firstBaseUpdate=a:u.next=a,p.lastBaseUpdate=s))}if(o!==null){var h=l.baseState;i=0,p=a=s=null,u=o;do{var m=u.lane,S=u.eventTime;if((r&m)===m){p!==null&&(p=p.next={eventTime:S,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var v=e,w=u;switch(m=t,S=n,w.tag){case 1:if(v=w.payload,typeof v=="function"){h=v.call(S,h,m);break e}h=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=w.payload,m=typeof v=="function"?v.call(S,h,m):v,m==null)break e;h=V({},h,m);break e;case 2:ot=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,m=l.effects,m===null?l.effects=[u]:m.push(u))}else S={eventTime:S,lane:m,tag:u.tag,payload:u.payload,callback:u.callback,next:null},p===null?(a=p=S,s=h):p=p.next=S,i|=m;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;m=u,u=m.next,m.next=null,l.lastBaseUpdate=m,l.shared.pending=null}}while(!0);if(p===null&&(s=h),l.baseState=s,l.firstBaseUpdate=a,l.lastBaseUpdate=p,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);jt|=i,e.lanes=i,e.memoizedState=h}}function is(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=co.transition;co.transition={};try{e(!1),t()}finally{A=n,co.transition=r}}function xc(){return Ne().memoizedState}function Cp(e,t,n){var r=yt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Cc(e))_c(t,n);else if(n=oc(e,t,n,r),n!==null){var l=se();Me(n,e,r,l),Pc(n,t,r)}}function _p(e,t,n){var r=yt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Cc(e))_c(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,u=o(i,n);if(l.hasEagerState=!0,l.eagerState=u,Ie(u,i)){var s=t.interleaved;s===null?(l.next=l,Xi(t)):(l.next=s.next,s.next=l),t.interleaved=l;return}}catch{}finally{}n=oc(e,t,l,r),n!==null&&(l=se(),Me(n,e,r,l),Pc(n,t,r))}}function Cc(e){var t=e.alternate;return e===H||t!==null&&t===H}function _c(e,t){Bn=dl=!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){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fi(e,n)}}var pl={readContext:Te,useCallback:re,useContext:re,useEffect:re,useImperativeHandle:re,useInsertionEffect:re,useLayoutEffect:re,useMemo:re,useReducer:re,useRef:re,useState:re,useDebugValue:re,useDeferredValue:re,useTransition:re,useMutableSource:re,useSyncExternalStore:re,useId:re,unstable_isNewReconciler:!1},Pp={readContext:Te,useCallback:function(e,t){return $e().memoizedState=[e,t===void 0?null:t],e},useContext:Te,useEffect:ss,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hr(4194308,4,gc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hr(4,2,e,t)},useMemo:function(e,t){var n=$e();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=$e();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=Cp.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=$e();return e={current:e},t.memoizedState=e},useState:us,useDebugValue:nu,useDeferredValue:function(e){return $e().memoizedState=e},useTransition:function(){var e=us(!1),t=e[0];return e=xp.bind(null,e[1]),$e().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=$e();if(B){if(n===void 0)throw Error(E(407));n=n()}else{if(n=t(),b===null)throw Error(E(349));Mt&30||cc(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,ss(dc.bind(null,r,o,e),[e]),r.flags|=2048,ir(9,fc.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=$e(),t=b.identifierPrefix;if(B){var n=qe,r=Je;n=(r&~(1<<32-Ae(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=lr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[He]=t,e[tr]=r,Mc(e,t,!1,!1),t.stateNode=e;e:{switch(i=Fo(n,r),n){case"dialog":I("cancel",e),I("close",e),l=r;break;case"iframe":case"object":case"embed":I("load",e),l=r;break;case"video":case"audio":for(l=0;lhn&&(t.flags|=128,r=!0,Tn(o,!1),t.lanes=4194304)}else{if(!r)if(e=fl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Tn(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!B)return le(t),null}else 2*K()-o.renderingStartTime>hn&&n!==1073741824&&(t.flags|=128,r=!0,Tn(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=K(),t.sibling=null,n=$.current,j($,r?n&1|2:n&1),t):(le(t),null);case 22:case 23:return su(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ve&1073741824&&(le(t),t.subtreeFlags&6&&(t.flags|=8192)):le(t),null;case 24:return null;case 25:return null}throw Error(E(156,t.tag))}function Dp(e,t){switch(Hi(t),t.tag){case 1:return he(t.type)&&ll(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return dn(),U(pe),U(ie),Gi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Yi(t),null;case 13:if(U($),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(E(340));cn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U($),null;case 4:return dn(),null;case 10:return Ki(t.type._context),null;case 22:case 23:return su(),null;case 24:return null;default:return null}}var zr=!1,oe=!1,Ap=typeof WeakSet=="function"?WeakSet:Set,P=null;function bt(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){W(e,t,r)}else n.current=null}function ii(e,t,n){try{n()}catch(r){W(e,t,r)}}var ws=!1;function Mp(e,t){if(Vo=el,e=Va(),Bi(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,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,u=-1,s=-1,a=0,p=0,h=e,m=null;t:for(;;){for(var S;h!==n||l!==0&&h.nodeType!==3||(u=i+l),h!==o||r!==0&&h.nodeType!==3||(s=i+r),h.nodeType===3&&(i+=h.nodeValue.length),(S=h.firstChild)!==null;)m=h,h=S;for(;;){if(h===e)break t;if(m===n&&++a===l&&(u=i),m===o&&++p===r&&(s=i),(S=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=S}n=u===-1||s===-1?null:{start:u,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(Wo={focusedElem:e,selectionRange:n},el=!1,P=t;P!==null;)if(t=P,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,P=e;else for(;P!==null;){t=P;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var w=v.memoizedProps,k=v.memoizedState,d=t.stateNode,c=d.getSnapshotBeforeUpdate(t.elementType===t.type?w:ze(t.type,w),k);d.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var f=t.stateNode.containerInfo;f.nodeType===1?f.textContent="":f.nodeType===9&&f.documentElement&&f.removeChild(f.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(E(163))}}catch(g){W(t,t.return,g)}if(e=t.sibling,e!==null){e.return=t.return,P=e;break}P=t.return}return v=ws,ws=!1,v}function $n(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 o=l.destroy;l.destroy=void 0,o!==void 0&&ii(t,n,o)}l=l.next}while(l!==r)}}function Ol(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 ui(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 Uc(e){var t=e.alternate;t!==null&&(e.alternate=null,Uc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[He],delete t[tr],delete t[Xo],delete t[gp],delete t[wp])),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 Bc(e){return e.tag===5||e.tag===3||e.tag===4}function Ss(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Bc(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 si(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=rl));else if(r!==4&&(e=e.child,e!==null))for(si(e,t,n),e=e.sibling;e!==null;)si(e,t,n),e=e.sibling}function ai(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(ai(e,t,n),e=e.sibling;e!==null;)ai(e,t,n),e=e.sibling}var ee=null,Fe=!1;function nt(e,t,n){for(n=n.child;n!==null;)$c(e,t,n),n=n.sibling}function $c(e,t,n){if(We&&typeof We.onCommitFiberUnmount=="function")try{We.onCommitFiberUnmount(kl,n)}catch{}switch(n.tag){case 5:oe||bt(n,t);case 6:var r=ee,l=Fe;ee=null,nt(e,t,n),ee=r,Fe=l,ee!==null&&(Fe?(e=ee,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ee.removeChild(n.stateNode));break;case 18:ee!==null&&(Fe?(e=ee,n=n.stateNode,e.nodeType===8?uo(e.parentNode,n):e.nodeType===1&&uo(e,n),Yn(e)):uo(ee,n.stateNode));break;case 4:r=ee,l=Fe,ee=n.stateNode.containerInfo,Fe=!0,nt(e,t,n),ee=r,Fe=l;break;case 0:case 11:case 14:case 15:if(!oe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&ii(n,t,i),l=l.next}while(l!==r)}nt(e,t,n);break;case 1:if(!oe&&(bt(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){W(n,t,u)}nt(e,t,n);break;case 21:nt(e,t,n);break;case 22:n.mode&1?(oe=(r=oe)||n.memoizedState!==null,nt(e,t,n),oe=r):nt(e,t,n);break;default:nt(e,t,n)}}function Es(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ap),t.forEach(function(r){var l=Qp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Le(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=K()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ip(r/1960))-r,10e?16:e,at===null)var r=!1;else{if(e=at,at=null,yl=0,D&6)throw Error(E(331));var l=D;for(D|=4,P=e.current;P!==null;){var o=P,i=o.child;if(P.flags&16){var u=o.deletions;if(u!==null){for(var s=0;sK()-iu?Lt(e,0):ou|=n),me(e,t)}function qc(e,t){t===0&&(e.mode&1?(t=xr,xr<<=1,!(xr&130023424)&&(xr=4194304)):t=1);var n=se();e=be(e,t),e!==null&&(cr(e,t,n),me(e,n))}function Wp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qc(e,n)}function Qp(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(E(314))}r!==null&&r.delete(t),qc(e,n)}var Yc;Yc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||pe.current)de=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return de=!1,zp(e,t,n);de=!!(e.flags&131072)}else de=!1,B&&t.flags&1048576&&ec(t,ul,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Vr(e,t),e=t.pendingProps;var l=an(t,ie.current);on(t,n),l=bi(null,t,r,e,l,n);var o=eu();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,he(r)?(o=!0,ol(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Ji(t),l.updater=Nl,t.stateNode=l,l._reactInternals=t,bo(t,r,e,n),t=ni(null,t,r,!0,o,n)):(t.tag=0,B&&o&&$i(t),ue(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Vr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Xp(r),e=ze(r,e),l){case 0:t=ti(null,t,r,e,n);break e;case 1:t=ys(null,t,r,e,n);break e;case 11:t=hs(null,t,r,e,n);break e;case 14:t=ms(null,t,r,ze(r.type,e),n);break e}throw Error(E(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),ti(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),ys(e,t,r,l,n);case 3:e:{if(Fc(t),e===null)throw Error(E(387));r=t.pendingProps,o=t.memoizedState,l=o.element,ic(e,t),cl(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=pn(Error(E(423)),t),t=vs(e,t,r,n,l);break e}else if(r!==l){l=pn(Error(E(424)),t),t=vs(e,t,r,n,l);break e}else for(ge=pt(t.stateNode.containerInfo.firstChild),we=t,B=!0,De=null,n=lc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(cn(),r===l){t=et(e,t,n);break e}ue(e,t,r,n)}t=t.child}return t;case 5:return uc(t),e===null&&Yo(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Qo(r,l)?i=null:o!==null&&Qo(r,o)&&(t.flags|=32),zc(e,t),ue(e,t,i,n),t.child;case 6:return e===null&&Yo(t),null;case 13:return Dc(e,t,n);case 4:return qi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=fn(t,null,r,n):ue(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),hs(e,t,r,l,n);case 7:return ue(e,t,t.pendingProps,n),t.child;case 8:return ue(e,t,t.pendingProps.children,n),t.child;case 12:return ue(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,j(sl,r._currentValue),r._currentValue=i,o!==null)if(Ie(o.value,i)){if(o.children===l.children&&!pe.current){t=et(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var u=o.dependencies;if(u!==null){i=o.child;for(var s=u.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=Ye(-1,n&-n),s.tag=2;var a=o.updateQueue;if(a!==null){a=a.shared;var p=a.pending;p===null?s.next=s:(s.next=p.next,p.next=s),a.pending=s}}o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),Go(o.return,n,t),u.lanes|=n;break}s=s.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(E(341));i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Go(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}ue(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,on(t,n),l=Te(l),r=r(l),t.flags|=1,ue(e,t,r,n),t.child;case 14:return r=t.type,l=ze(r,t.pendingProps),l=ze(r.type,l),ms(e,t,r,l,n);case 15:return Oc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),Vr(e,t),t.tag=1,he(r)?(e=!0,ol(t)):e=!1,on(t,n),Rc(t,r,l),bo(t,r,l,n),ni(null,t,r,!0,e,n);case 19:return Ac(e,t,n);case 22:return Lc(e,t,n)}throw Error(E(156,t.tag))};function Gc(e,t){return Ca(e,t)}function Kp(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 Pe(e,t,n,r){return new Kp(e,t,n,r)}function cu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xp(e){if(typeof e=="function")return cu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ni)return 11;if(e===Oi)return 14}return 2}function vt(e,t){var n=e.alternate;return n===null?(n=Pe(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 Kr(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")cu(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Wt:return zt(n.children,l,o,t);case Ti:i=8,l|=8;break;case xo:return e=Pe(12,n,t,l|2),e.elementType=xo,e.lanes=o,e;case Co:return e=Pe(13,n,t,l),e.elementType=Co,e.lanes=o,e;case _o:return e=Pe(19,n,t,l),e.elementType=_o,e.lanes=o,e;case ua:return zl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case oa:i=10;break e;case ia:i=9;break e;case Ni:i=11;break e;case Oi:i=14;break e;case lt:i=16,r=null;break e}throw Error(E(130,e==null?e:typeof e,""))}return t=Pe(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function zt(e,t,n,r){return e=Pe(7,e,r,t),e.lanes=n,e}function zl(e,t,n,r){return e=Pe(22,e,r,t),e.elementType=ua,e.lanes=n,e.stateNode={isHidden:!1},e}function yo(e,t,n){return e=Pe(6,e,null,t),e.lanes=n,e}function vo(e,t,n){return t=Pe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Jp(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=Yl(0),this.expirationTimes=Yl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function fu(e,t,n,r,l,o,i,u,s){return e=new Jp(e,t,n,u,s),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Pe(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ji(o),e}function qp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(tf)}catch(e){console.error(e)}}tf(),ta.exports=ke;var eh=ta.exports,nf,Ns=eh;nf=Ns.createRoot,Ns.hydrateRoot;function rf(e,t){return function(){return e.apply(t,arguments)}}const{toString:th}=Object.prototype,{getPrototypeOf:mu}=Object,jl=(e=>t=>{const n=th.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ue=e=>(e=e.toLowerCase(),t=>jl(t)===e),Il=e=>t=>typeof t===e,{isArray:gn}=Array,sr=Il("undefined");function nh(e){return e!==null&&!sr(e)&&e.constructor!==null&&!sr(e.constructor)&&Se(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const lf=Ue("ArrayBuffer");function rh(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&lf(e.buffer),t}const lh=Il("string"),Se=Il("function"),of=Il("number"),Ul=e=>e!==null&&typeof e=="object",oh=e=>e===!0||e===!1,Xr=e=>{if(jl(e)!=="object")return!1;const t=mu(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},ih=Ue("Date"),uh=Ue("File"),sh=Ue("Blob"),ah=Ue("FileList"),ch=e=>Ul(e)&&Se(e.pipe),fh=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Se(e.append)&&((t=jl(e))==="formdata"||t==="object"&&Se(e.toString)&&e.toString()==="[object FormData]"))},dh=Ue("URLSearchParams"),[ph,hh,mh,yh]=["ReadableStream","Request","Response","Headers"].map(Ue),vh=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function hr(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,l;if(typeof e!="object"&&(e=[e]),gn(e))for(r=0,l=e.length;r0;)if(l=n[r],t===l.toLowerCase())return l;return null}const Ot=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,sf=e=>!sr(e)&&e!==Ot;function hi(){const{caseless:e}=sf(this)&&this||{},t={},n=(r,l)=>{const o=e&&uf(t,l)||l;Xr(t[o])&&Xr(r)?t[o]=hi(t[o],r):Xr(r)?t[o]=hi({},r):gn(r)?t[o]=r.slice():t[o]=r};for(let r=0,l=arguments.length;r(hr(t,(l,o)=>{n&&Se(l)?e[o]=rf(l,n):e[o]=l},{allOwnKeys:r}),e),wh=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Sh=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Eh=(e,t,n,r)=>{let l,o,i;const u={};if(t=t||{},e==null)return t;do{for(l=Object.getOwnPropertyNames(e),o=l.length;o-- >0;)i=l[o],(!r||r(i,e,t))&&!u[i]&&(t[i]=e[i],u[i]=!0);e=n!==!1&&mu(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kh=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},xh=e=>{if(!e)return null;if(gn(e))return e;let t=e.length;if(!of(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Ch=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&mu(Uint8Array)),_h=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let l;for(;(l=r.next())&&!l.done;){const o=l.value;t.call(e,o[0],o[1])}},Ph=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Rh=Ue("HTMLFormElement"),Th=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,l){return r.toUpperCase()+l}),Os=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Nh=Ue("RegExp"),af=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};hr(n,(l,o)=>{let i;(i=t(l,o,e))!==!1&&(r[o]=i||l)}),Object.defineProperties(e,r)},Oh=e=>{af(e,(t,n)=>{if(Se(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Se(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Lh=(e,t)=>{const n={},r=l=>{l.forEach(o=>{n[o]=!0})};return gn(e)?r(e):r(String(e).split(t)),n},zh=()=>{},Fh=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,go="abcdefghijklmnopqrstuvwxyz",Ls="0123456789",cf={DIGIT:Ls,ALPHA:go,ALPHA_DIGIT:go+go.toUpperCase()+Ls},Dh=(e=16,t=cf.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function Ah(e){return!!(e&&Se(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const Mh=e=>{const t=new Array(10),n=(r,l)=>{if(Ul(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[l]=r;const o=gn(r)?[]:{};return hr(r,(i,u)=>{const s=n(i,l+1);!sr(s)&&(o[u]=s)}),t[l]=void 0,o}}return r};return n(e,0)},jh=Ue("AsyncFunction"),Ih=e=>e&&(Ul(e)||Se(e))&&Se(e.then)&&Se(e.catch),ff=((e,t)=>e?setImmediate:t?((n,r)=>(Ot.addEventListener("message",({source:l,data:o})=>{l===Ot&&o===n&&r.length&&r.shift()()},!1),l=>{r.push(l),Ot.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Se(Ot.postMessage)),Uh=typeof queueMicrotask<"u"?queueMicrotask.bind(Ot):typeof process<"u"&&process.nextTick||ff,y={isArray:gn,isArrayBuffer:lf,isBuffer:nh,isFormData:fh,isArrayBufferView:rh,isString:lh,isNumber:of,isBoolean:oh,isObject:Ul,isPlainObject:Xr,isReadableStream:ph,isRequest:hh,isResponse:mh,isHeaders:yh,isUndefined:sr,isDate:ih,isFile:uh,isBlob:sh,isRegExp:Nh,isFunction:Se,isStream:ch,isURLSearchParams:dh,isTypedArray:Ch,isFileList:ah,forEach:hr,merge:hi,extend:gh,trim:vh,stripBOM:wh,inherits:Sh,toFlatObject:Eh,kindOf:jl,kindOfTest:Ue,endsWith:kh,toArray:xh,forEachEntry:_h,matchAll:Ph,isHTMLForm:Rh,hasOwnProperty:Os,hasOwnProp:Os,reduceDescriptors:af,freezeMethods:Oh,toObjectSet:Lh,toCamelCase:Th,noop:zh,toFiniteNumber:Fh,findKey:uf,global:Ot,isContextDefined:sf,ALPHABET:cf,generateString:Dh,isSpecCompliantForm:Ah,toJSONObject:Mh,isAsyncFn:jh,isThenable:Ih,setImmediate:ff,asap:Uh};function N(e,t,n,r,l){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),l&&(this.response=l)}y.inherits(N,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:y.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const df=N.prototype,pf={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{pf[e]={value:e}});Object.defineProperties(N,pf);Object.defineProperty(df,"isAxiosError",{value:!0});N.from=(e,t,n,r,l,o)=>{const i=Object.create(df);return y.toFlatObject(e,i,function(s){return s!==Error.prototype},u=>u!=="isAxiosError"),N.call(i,e.message,t,n,r,l),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};const Bh=null;function mi(e){return y.isPlainObject(e)||y.isArray(e)}function hf(e){return y.endsWith(e,"[]")?e.slice(0,-2):e}function zs(e,t,n){return e?e.concat(t).map(function(l,o){return l=hf(l),!n&&o?"["+l+"]":l}).join(n?".":""):t}function $h(e){return y.isArray(e)&&!e.some(mi)}const Hh=y.toFlatObject(y,{},null,function(t){return/^is[A-Z]/.test(t)});function Bl(e,t,n){if(!y.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=y.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,k){return!y.isUndefined(k[w])});const r=n.metaTokens,l=n.visitor||p,o=n.dots,i=n.indexes,s=(n.Blob||typeof Blob<"u"&&Blob)&&y.isSpecCompliantForm(t);if(!y.isFunction(l))throw new TypeError("visitor must be a function");function a(v){if(v===null)return"";if(y.isDate(v))return v.toISOString();if(!s&&y.isBlob(v))throw new N("Blob is not supported. Use a Buffer instead.");return y.isArrayBuffer(v)||y.isTypedArray(v)?s&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function p(v,w,k){let d=v;if(v&&!k&&typeof v=="object"){if(y.endsWith(w,"{}"))w=r?w:w.slice(0,-2),v=JSON.stringify(v);else if(y.isArray(v)&&$h(v)||(y.isFileList(v)||y.endsWith(w,"[]"))&&(d=y.toArray(v)))return w=hf(w),d.forEach(function(f,g){!(y.isUndefined(f)||f===null)&&t.append(i===!0?zs([w],g,o):i===null?w:w+"[]",a(f))}),!1}return mi(v)?!0:(t.append(zs(k,w,o),a(v)),!1)}const h=[],m=Object.assign(Hh,{defaultVisitor:p,convertValue:a,isVisitable:mi});function S(v,w){if(!y.isUndefined(v)){if(h.indexOf(v)!==-1)throw Error("Circular reference detected in "+w.join("."));h.push(v),y.forEach(v,function(d,c){(!(y.isUndefined(d)||d===null)&&l.call(t,d,y.isString(c)?c.trim():c,w,m))===!0&&S(d,w?w.concat(c):[c])}),h.pop()}}if(!y.isObject(e))throw new TypeError("data must be an object");return S(e),t}function Fs(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function yu(e,t){this._pairs=[],e&&Bl(e,this,t)}const mf=yu.prototype;mf.append=function(t,n){this._pairs.push([t,n])};mf.toString=function(t){const n=t?function(r){return t.call(this,r,Fs)}:Fs;return this._pairs.map(function(l){return n(l[0])+"="+n(l[1])},"").join("&")};function Vh(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function yf(e,t,n){if(!t)return e;const r=n&&n.encode||Vh,l=n&&n.serialize;let o;if(l?o=l(t,n):o=y.isURLSearchParams(t)?t.toString():new yu(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Ds{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){y.forEach(this.handlers,function(r){r!==null&&t(r)})}}const vf={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Wh=typeof URLSearchParams<"u"?URLSearchParams:yu,Qh=typeof FormData<"u"?FormData:null,Kh=typeof Blob<"u"?Blob:null,Xh={isBrowser:!0,classes:{URLSearchParams:Wh,FormData:Qh,Blob:Kh},protocols:["http","https","file","blob","url","data"]},vu=typeof window<"u"&&typeof document<"u",Jh=(e=>vu&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),qh=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Yh=vu&&window.location.href||"http://localhost",Gh=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:vu,hasStandardBrowserEnv:Jh,hasStandardBrowserWebWorkerEnv:qh,origin:Yh},Symbol.toStringTag,{value:"Module"})),je={...Gh,...Xh};function Zh(e,t){return Bl(e,new je.classes.URLSearchParams,Object.assign({visitor:function(n,r,l,o){return je.isNode&&y.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function bh(e){return y.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function em(e){const t={},n=Object.keys(e);let r;const l=n.length;let o;for(r=0;r=n.length;return i=!i&&y.isArray(l)?l.length:i,s?(y.hasOwnProp(l,i)?l[i]=[l[i],r]:l[i]=r,!u):((!l[i]||!y.isObject(l[i]))&&(l[i]=[]),t(n,r,l[i],o)&&y.isArray(l[i])&&(l[i]=em(l[i])),!u)}if(y.isFormData(e)&&y.isFunction(e.entries)){const n={};return y.forEachEntry(e,(r,l)=>{t(bh(r),l,n,0)}),n}return null}function tm(e,t,n){if(y.isString(e))try{return(t||JSON.parse)(e),y.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const mr={transitional:vf,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",l=r.indexOf("application/json")>-1,o=y.isObject(t);if(o&&y.isHTMLForm(t)&&(t=new FormData(t)),y.isFormData(t))return l?JSON.stringify(gf(t)):t;if(y.isArrayBuffer(t)||y.isBuffer(t)||y.isStream(t)||y.isFile(t)||y.isBlob(t)||y.isReadableStream(t))return t;if(y.isArrayBufferView(t))return t.buffer;if(y.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let u;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Zh(t,this.formSerializer).toString();if((u=y.isFileList(t))||r.indexOf("multipart/form-data")>-1){const s=this.env&&this.env.FormData;return Bl(u?{"files[]":t}:t,s&&new s,this.formSerializer)}}return o||l?(n.setContentType("application/json",!1),tm(t)):t}],transformResponse:[function(t){const n=this.transitional||mr.transitional,r=n&&n.forcedJSONParsing,l=this.responseType==="json";if(y.isResponse(t)||y.isReadableStream(t))return t;if(t&&y.isString(t)&&(r&&!this.responseType||l)){const i=!(n&&n.silentJSONParsing)&&l;try{return JSON.parse(t)}catch(u){if(i)throw u.name==="SyntaxError"?N.from(u,N.ERR_BAD_RESPONSE,this,null,this.response):u}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:je.classes.FormData,Blob:je.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};y.forEach(["delete","get","head","post","put","patch"],e=>{mr.headers[e]={}});const nm=y.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),rm=e=>{const t={};let n,r,l;return e&&e.split(` +`).forEach(function(i){l=i.indexOf(":"),n=i.substring(0,l).trim().toLowerCase(),r=i.substring(l+1).trim(),!(!n||t[n]&&nm[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},As=Symbol("internals");function On(e){return e&&String(e).trim().toLowerCase()}function Jr(e){return e===!1||e==null?e:y.isArray(e)?e.map(Jr):String(e)}function lm(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const om=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function wo(e,t,n,r,l){if(y.isFunction(r))return r.call(this,t,n);if(l&&(t=n),!!y.isString(t)){if(y.isString(r))return t.indexOf(r)!==-1;if(y.isRegExp(r))return r.test(t)}}function im(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function um(e,t){const n=y.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(l,o,i){return this[r].call(this,t,l,o,i)},configurable:!0})})}class ye{constructor(t){t&&this.set(t)}set(t,n,r){const l=this;function o(u,s,a){const p=On(s);if(!p)throw new Error("header name must be a non-empty string");const h=y.findKey(l,p);(!h||l[h]===void 0||a===!0||a===void 0&&l[h]!==!1)&&(l[h||s]=Jr(u))}const i=(u,s)=>y.forEach(u,(a,p)=>o(a,p,s));if(y.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(y.isString(t)&&(t=t.trim())&&!om(t))i(rm(t),n);else if(y.isHeaders(t))for(const[u,s]of t.entries())o(s,u,r);else t!=null&&o(n,t,r);return this}get(t,n){if(t=On(t),t){const r=y.findKey(this,t);if(r){const l=this[r];if(!n)return l;if(n===!0)return lm(l);if(y.isFunction(n))return n.call(this,l,r);if(y.isRegExp(n))return n.exec(l);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=On(t),t){const r=y.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||wo(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let l=!1;function o(i){if(i=On(i),i){const u=y.findKey(r,i);u&&(!n||wo(r,r[u],u,n))&&(delete r[u],l=!0)}}return y.isArray(t)?t.forEach(o):o(t),l}clear(t){const n=Object.keys(this);let r=n.length,l=!1;for(;r--;){const o=n[r];(!t||wo(this,this[o],o,t,!0))&&(delete this[o],l=!0)}return l}normalize(t){const n=this,r={};return y.forEach(this,(l,o)=>{const i=y.findKey(r,o);if(i){n[i]=Jr(l),delete n[o];return}const u=t?im(o):String(o).trim();u!==o&&delete n[o],n[u]=Jr(l),r[u]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return y.forEach(this,(r,l)=>{r!=null&&r!==!1&&(n[l]=t&&y.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(l=>r.set(l)),r}static accessor(t){const r=(this[As]=this[As]={accessors:{}}).accessors,l=this.prototype;function o(i){const u=On(i);r[u]||(um(l,i),r[u]=!0)}return y.isArray(t)?t.forEach(o):o(t),this}}ye.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);y.reduceDescriptors(ye.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});y.freezeMethods(ye);function So(e,t){const n=this||mr,r=t||n,l=ye.from(r.headers);let o=r.data;return y.forEach(e,function(u){o=u.call(n,o,l.normalize(),t?t.status:void 0)}),l.normalize(),o}function wf(e){return!!(e&&e.__CANCEL__)}function wn(e,t,n){N.call(this,e??"canceled",N.ERR_CANCELED,t,n),this.name="CanceledError"}y.inherits(wn,N,{__CANCEL__:!0});function Sf(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new N("Request failed with status code "+n.status,[N.ERR_BAD_REQUEST,N.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function sm(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function am(e,t){e=e||10;const n=new Array(e),r=new Array(e);let l=0,o=0,i;return t=t!==void 0?t:1e3,function(s){const a=Date.now(),p=r[o];i||(i=a),n[l]=s,r[l]=a;let h=o,m=0;for(;h!==l;)m+=n[h++],h=h%e;if(l=(l+1)%e,l===o&&(o=(o+1)%e),a-i{n=p,l=null,o&&(clearTimeout(o),o=null),e.apply(null,a)};return[(...a)=>{const p=Date.now(),h=p-n;h>=r?i(a,p):(l=a,o||(o=setTimeout(()=>{o=null,i(l)},r-h)))},()=>l&&i(l)]}const wl=(e,t,n=3)=>{let r=0;const l=am(50,250);return cm(o=>{const i=o.loaded,u=o.lengthComputable?o.total:void 0,s=i-r,a=l(s),p=i<=u;r=i;const h={loaded:i,total:u,progress:u?i/u:void 0,bytes:s,rate:a||void 0,estimated:a&&u&&p?(u-i)/a:void 0,event:o,lengthComputable:u!=null,[t?"download":"upload"]:!0};e(h)},n)},Ms=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},js=e=>(...t)=>y.asap(()=>e(...t)),fm=je.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function l(o){let i=o;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=l(window.location.href),function(i){const u=y.isString(i)?l(i):i;return u.protocol===r.protocol&&u.host===r.host}}():function(){return function(){return!0}}(),dm=je.hasStandardBrowserEnv?{write(e,t,n,r,l,o){const i=[e+"="+encodeURIComponent(t)];y.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),y.isString(r)&&i.push("path="+r),y.isString(l)&&i.push("domain="+l),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function pm(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function hm(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ef(e,t){return e&&!pm(t)?hm(e,t):t}const Is=e=>e instanceof ye?{...e}:e;function Ut(e,t){t=t||{};const n={};function r(a,p,h){return y.isPlainObject(a)&&y.isPlainObject(p)?y.merge.call({caseless:h},a,p):y.isPlainObject(p)?y.merge({},p):y.isArray(p)?p.slice():p}function l(a,p,h){if(y.isUndefined(p)){if(!y.isUndefined(a))return r(void 0,a,h)}else return r(a,p,h)}function o(a,p){if(!y.isUndefined(p))return r(void 0,p)}function i(a,p){if(y.isUndefined(p)){if(!y.isUndefined(a))return r(void 0,a)}else return r(void 0,p)}function u(a,p,h){if(h in t)return r(a,p);if(h in e)return r(void 0,a)}const s={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:u,headers:(a,p)=>l(Is(a),Is(p),!0)};return y.forEach(Object.keys(Object.assign({},e,t)),function(p){const h=s[p]||l,m=h(e[p],t[p],p);y.isUndefined(m)&&h!==u||(n[p]=m)}),n}const kf=e=>{const t=Ut({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:l,xsrfCookieName:o,headers:i,auth:u}=t;t.headers=i=ye.from(i),t.url=yf(Ef(t.baseURL,t.url),e.params,e.paramsSerializer),u&&i.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):"")));let s;if(y.isFormData(n)){if(je.hasStandardBrowserEnv||je.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((s=i.getContentType())!==!1){const[a,...p]=s?s.split(";").map(h=>h.trim()).filter(Boolean):[];i.setContentType([a||"multipart/form-data",...p].join("; "))}}if(je.hasStandardBrowserEnv&&(r&&y.isFunction(r)&&(r=r(t)),r||r!==!1&&fm(t.url))){const a=l&&o&&dm.read(o);a&&i.set(l,a)}return t},mm=typeof XMLHttpRequest<"u",ym=mm&&function(e){return new Promise(function(n,r){const l=kf(e);let o=l.data;const i=ye.from(l.headers).normalize();let{responseType:u,onUploadProgress:s,onDownloadProgress:a}=l,p,h,m,S,v;function w(){S&&S(),v&&v(),l.cancelToken&&l.cancelToken.unsubscribe(p),l.signal&&l.signal.removeEventListener("abort",p)}let k=new XMLHttpRequest;k.open(l.method.toUpperCase(),l.url,!0),k.timeout=l.timeout;function d(){if(!k)return;const f=ye.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),x={data:!u||u==="text"||u==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:f,config:e,request:k};Sf(function(_){n(_),w()},function(_){r(_),w()},x),k=null}"onloadend"in k?k.onloadend=d:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(d)},k.onabort=function(){k&&(r(new N("Request aborted",N.ECONNABORTED,e,k)),k=null)},k.onerror=function(){r(new N("Network Error",N.ERR_NETWORK,e,k)),k=null},k.ontimeout=function(){let g=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded";const x=l.transitional||vf;l.timeoutErrorMessage&&(g=l.timeoutErrorMessage),r(new N(g,x.clarifyTimeoutError?N.ETIMEDOUT:N.ECONNABORTED,e,k)),k=null},o===void 0&&i.setContentType(null),"setRequestHeader"in k&&y.forEach(i.toJSON(),function(g,x){k.setRequestHeader(x,g)}),y.isUndefined(l.withCredentials)||(k.withCredentials=!!l.withCredentials),u&&u!=="json"&&(k.responseType=l.responseType),a&&([m,v]=wl(a,!0),k.addEventListener("progress",m)),s&&k.upload&&([h,S]=wl(s),k.upload.addEventListener("progress",h),k.upload.addEventListener("loadend",S)),(l.cancelToken||l.signal)&&(p=f=>{k&&(r(!f||f.type?new wn(null,e,k):f),k.abort(),k=null)},l.cancelToken&&l.cancelToken.subscribe(p),l.signal&&(l.signal.aborted?p():l.signal.addEventListener("abort",p)));const c=sm(l.url);if(c&&je.protocols.indexOf(c)===-1){r(new N("Unsupported protocol "+c+":",N.ERR_BAD_REQUEST,e));return}k.send(o||null)})},vm=(e,t)=>{let n=new AbortController,r;const l=function(s){if(!r){r=!0,i();const a=s instanceof Error?s:this.reason;n.abort(a instanceof N?a:new wn(a instanceof Error?a.message:a))}};let o=t&&setTimeout(()=>{l(new N(`timeout ${t} of ms exceeded`,N.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(s=>{s&&(s.removeEventListener?s.removeEventListener("abort",l):s.unsubscribe(l))}),e=null)};e.forEach(s=>s&&s.addEventListener&&s.addEventListener("abort",l));const{signal:u}=n;return u.unsubscribe=i,[u,()=>{o&&clearTimeout(o),o=null}]},gm=function*(e,t){let n=e.byteLength;if(!t||n{const o=wm(e,t,l);let i=0,u,s=a=>{u||(u=!0,r&&r(a))};return new ReadableStream({async pull(a){try{const{done:p,value:h}=await o.next();if(p){s(),a.close();return}let m=h.byteLength;if(n){let S=i+=m;n(S)}a.enqueue(new Uint8Array(h))}catch(p){throw s(p),p}},cancel(a){return s(a),o.return()}},{highWaterMark:2})},$l=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",xf=$l&&typeof ReadableStream=="function",yi=$l&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Cf=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Sm=xf&&Cf(()=>{let e=!1;const t=new Request(je.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Bs=64*1024,vi=xf&&Cf(()=>y.isReadableStream(new Response("").body)),Sl={stream:vi&&(e=>e.body)};$l&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Sl[t]&&(Sl[t]=y.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new N(`Response type '${t}' is not supported`,N.ERR_NOT_SUPPORT,r)})})})(new Response);const Em=async e=>{if(e==null)return 0;if(y.isBlob(e))return e.size;if(y.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(y.isArrayBufferView(e)||y.isArrayBuffer(e))return e.byteLength;if(y.isURLSearchParams(e)&&(e=e+""),y.isString(e))return(await yi(e)).byteLength},km=async(e,t)=>{const n=y.toFiniteNumber(e.getContentLength());return n??Em(t)},xm=$l&&(async e=>{let{url:t,method:n,data:r,signal:l,cancelToken:o,timeout:i,onDownloadProgress:u,onUploadProgress:s,responseType:a,headers:p,withCredentials:h="same-origin",fetchOptions:m}=kf(e);a=a?(a+"").toLowerCase():"text";let[S,v]=l||o||i?vm([l,o],i):[],w,k;const d=()=>{!w&&setTimeout(()=>{S&&S.unsubscribe()}),w=!0};let c;try{if(s&&Sm&&n!=="get"&&n!=="head"&&(c=await km(p,r))!==0){let C=new Request(t,{method:"POST",body:r,duplex:"half"}),_;if(y.isFormData(r)&&(_=C.headers.get("content-type"))&&p.setContentType(_),C.body){const[T,M]=Ms(c,wl(js(s)));r=Us(C.body,Bs,T,M,yi)}}y.isString(h)||(h=h?"include":"omit"),k=new Request(t,{...m,signal:S,method:n.toUpperCase(),headers:p.normalize().toJSON(),body:r,duplex:"half",credentials:h});let f=await fetch(k);const g=vi&&(a==="stream"||a==="response");if(vi&&(u||g)){const C={};["status","statusText","headers"].forEach(L=>{C[L]=f[L]});const _=y.toFiniteNumber(f.headers.get("content-length")),[T,M]=u&&Ms(_,wl(js(u),!0))||[];f=new Response(Us(f.body,Bs,T,()=>{M&&M(),g&&d()},yi),C)}a=a||"text";let x=await Sl[y.findKey(Sl,a)||"text"](f,e);return!g&&d(),v&&v(),await new Promise((C,_)=>{Sf(C,_,{data:x,headers:ye.from(f.headers),status:f.status,statusText:f.statusText,config:e,request:k})})}catch(f){throw d(),f&&f.name==="TypeError"&&/fetch/i.test(f.message)?Object.assign(new N("Network Error",N.ERR_NETWORK,e,k),{cause:f.cause||f}):N.from(f,f&&f.code,e,k)}}),gi={http:Bh,xhr:ym,fetch:xm};y.forEach(gi,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const $s=e=>`- ${e}`,Cm=e=>y.isFunction(e)||e===null||e===!1,_f={getAdapter:e=>{e=y.isArray(e)?e:[e];const{length:t}=e;let n,r;const l={};for(let o=0;o`adapter ${u} `+(s===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since : +`+o.map($s).join(` +`):" "+$s(o[0]):"as no adapter specified";throw new N("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:gi};function Eo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new wn(null,e)}function Hs(e){return Eo(e),e.headers=ye.from(e.headers),e.data=So.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),_f.getAdapter(e.adapter||mr.adapter)(e).then(function(r){return Eo(e),r.data=So.call(e,e.transformResponse,r),r.headers=ye.from(r.headers),r},function(r){return wf(r)||(Eo(e),r&&r.response&&(r.response.data=So.call(e,e.transformResponse,r.response),r.response.headers=ye.from(r.response.headers))),Promise.reject(r)})}const Pf="1.7.4",gu={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{gu[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Vs={};gu.transitional=function(t,n,r){function l(o,i){return"[Axios v"+Pf+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,u)=>{if(t===!1)throw new N(l(i," has been removed"+(n?" in "+n:"")),N.ERR_DEPRECATED);return n&&!Vs[i]&&(Vs[i]=!0,console.warn(l(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,u):!0}};function _m(e,t,n){if(typeof e!="object")throw new N("options must be an object",N.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let l=r.length;for(;l-- >0;){const o=r[l],i=t[o];if(i){const u=e[o],s=u===void 0||i(u,o,e);if(s!==!0)throw new N("option "+o+" must be "+s,N.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new N("Unknown option "+o,N.ERR_BAD_OPTION)}}const wi={assertOptions:_m,validators:gu},rt=wi.validators;class Ft{constructor(t){this.defaults=t,this.interceptors={request:new Ds,response:new Ds}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let l;Error.captureStackTrace?Error.captureStackTrace(l={}):l=new Error;const o=l.stack?l.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ut(this.defaults,n);const{transitional:r,paramsSerializer:l,headers:o}=n;r!==void 0&&wi.assertOptions(r,{silentJSONParsing:rt.transitional(rt.boolean),forcedJSONParsing:rt.transitional(rt.boolean),clarifyTimeoutError:rt.transitional(rt.boolean)},!1),l!=null&&(y.isFunction(l)?n.paramsSerializer={serialize:l}:wi.assertOptions(l,{encode:rt.function,serialize:rt.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&y.merge(o.common,o[n.method]);o&&y.forEach(["delete","get","head","post","put","patch","common"],v=>{delete o[v]}),n.headers=ye.concat(i,o);const u=[];let s=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(s=s&&w.synchronous,u.unshift(w.fulfilled,w.rejected))});const a=[];this.interceptors.response.forEach(function(w){a.push(w.fulfilled,w.rejected)});let p,h=0,m;if(!s){const v=[Hs.bind(this),void 0];for(v.unshift.apply(v,u),v.push.apply(v,a),m=v.length,p=Promise.resolve(n);h{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](l);r._listeners=null}),this.promise.then=l=>{let o;const i=new Promise(u=>{r.subscribe(u),o=u}).then(l);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,u){r.reason||(r.reason=new wn(o,i,u),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new wu(function(l){t=l}),cancel:t}}}function Pm(e){return function(n){return e.apply(null,n)}}function Rm(e){return y.isObject(e)&&e.isAxiosError===!0}const Si={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Si).forEach(([e,t])=>{Si[t]=e});function Rf(e){const t=new Ft(e),n=rf(Ft.prototype.request,t);return y.extend(n,Ft.prototype,t,{allOwnKeys:!0}),y.extend(n,t,null,{allOwnKeys:!0}),n.create=function(l){return Rf(Ut(e,l))},n}const J=Rf(mr);J.Axios=Ft;J.CanceledError=wn;J.CancelToken=wu;J.isCancel=wf;J.VERSION=Pf;J.toFormData=Bl;J.AxiosError=N;J.Cancel=J.CanceledError;J.all=function(t){return Promise.all(t)};J.spread=Pm;J.isAxiosError=Rm;J.mergeConfig=Ut;J.AxiosHeaders=ye;J.formToJSON=e=>gf(y.isHTMLForm(e)?new FormData(e):e);J.getAdapter=_f.getAdapter;J.HttpStatusCode=Si;J.default=J;function Tm({products:e}){return Ve.jsxs("div",{children:[Ve.jsx("h1",{children:"Einkaufsliste"}),Ve.jsx("ul",{children:e.map(t=>Ve.jsxs("li",{children:[t.name," - Menge: ",t.amount]},t.id))})]})}function Nm(){const[e,t]=Wn.useState([]);function n(){J.get("/api/products").then(r=>{t(r.data)}).catch(r=>{console.error("Es gab einen Fehler beim Abrufen der Daten!",r)})}return Wn.useEffect(()=>{n()},[]),Ve.jsxs(Ve.Fragment,{children:[Ve.jsx("h1",{children:"Groceries app"}),Ve.jsx(Tm,{products:e})]})}nf(document.getElementById("root")).render(Ve.jsx(Wn.StrictMode,{children:Ve.jsx(Nm,{})})); diff --git a/frontend/dist/assets/index-DiwrgTda.css b/frontend/dist/assets/index-DiwrgTda.css new file mode 100644 index 0000000..7704ff6 --- /dev/null +++ b/frontend/dist/assets/index-DiwrgTda.css @@ -0,0 +1 @@ +#root{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.card{padding:2em}.read-the-docs{color:#888}:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;display:flex;place-items:center;min-width:320px;min-height:100vh}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}} diff --git a/frontend/dist/vite.svg b/frontend/dist/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/frontend/dist/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/index.html b/frontend/index.html index e4b78ea..909d224 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,13 +1,13 @@ - - - - - Vite + React + TS - - -
- - - + + + + + Vite + React + TS + + +
+ + + \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 60de7fe..ae05e01 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -10,7 +10,8 @@ "dependencies": { "axios": "^1.7.4", "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "react-router-dom": "^6.26.1" }, "devDependencies": { "@eslint/js": "^9.8.0", @@ -973,6 +974,15 @@ "node": ">= 8" } }, + "node_modules/@remix-run/router": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.19.1.tgz", + "integrity": "sha512-S45oynt/WH19bHbIXjtli6QmwNYvaz+vtnubvNpNDvUOoA/OWh6j1OikIP3G+v5GHdxyC6EXoChG3HgYGEUfcg==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.20.0", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.20.0.tgz", @@ -2982,6 +2992,38 @@ "node": ">=0.10.0" } }, + "node_modules/react-router": { + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.26.1.tgz", + "integrity": "sha512-kIwJveZNwp7teQRI5QmwWo39A5bXRyqpH0COKKmPnyD2vBvDwgFXSqDUYtt1h+FEyfnE8eXr7oe0MxRzVwCcvQ==", + "license": "MIT", + "dependencies": { + "@remix-run/router": "1.19.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/react-router-dom": { + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.26.1.tgz", + "integrity": "sha512-veut7m41S1fLql4pLhxeSW3jlqs+4MtjRLj0xvuCEXsxusJCbs6I8yn9BxzzDX2XDgafrccY6hwjmd/bL54tFw==", + "license": "MIT", + "dependencies": { + "@remix-run/router": "1.19.1", + "react-router": "6.26.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 4dcf6b3..3bf77fa 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,7 +12,8 @@ "dependencies": { "axios": "^1.7.4", "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "react-router-dom": "^6.26.1" }, "devDependencies": { "@eslint/js": "^9.8.0", diff --git a/frontend/src/App.css b/frontend/src/App.css index dceaf09..618257d 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -26,7 +26,7 @@ body{ text-align: center; } .search-card{ -background-color: darkgray; + background-color: darkgray; padding: 1.2rem; } @@ -99,5 +99,4 @@ background-color: darkgray; padding: 1rem; background-color: #f8f8f8; border-radius: 10px; -} - +} \ No newline at end of file diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 45021dd..af50fb3 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -14,5 +14,4 @@ export default function App() { ) -} - +} \ No newline at end of file diff --git a/frontend/src/components/AddProduct.css b/frontend/src/components/AddProduct.css new file mode 100644 index 0000000..fdc2dd6 --- /dev/null +++ b/frontend/src/components/AddProduct.css @@ -0,0 +1,51 @@ +.add-product { + display: flex; + flex-direction: column; + gap: 1rem; + padding: 1rem; + background-color: #f8f8f8; + border-radius: 10px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); +} + +.add-product h3 { + font-size: 1.8rem; + color: #333; + text-align: center; +} + +.name-input { + width: 100%; + padding: 0.5rem; + border: 2px solid #cccccc; + border-radius: 5px; + font-size: 1rem; +} + +.amount-input { + width: 50%; + padding: 0.5rem; + border: 2px solid #cccccc; + border-radius: 5px; + font-size: 1rem; +} + +button { + background-color: #4CAF50; + color: white; + padding: 0.7rem 1.5rem; + border: none; + border-radius: 5px; + cursor: pointer; + font-size: 1rem; + transition: background-color 0.3s ease, transform 0.1s ease; +} + +button:hover { + background-color: #45a049; +} + +button:active { + transform: scale(0.95); /* Эффект нажатия */ + background-color: #3e8e41; /* Темнее цвет для эффекта нажатия */ +} diff --git "a/frontend/src/components/AddProdu\321\201t.tsx" "b/frontend/src/components/AddProdu\321\201t.tsx" new file mode 100644 index 0000000..de0c48c --- /dev/null +++ "b/frontend/src/components/AddProdu\321\201t.tsx" @@ -0,0 +1,46 @@ +import { useState, ChangeEvent, FormEvent } from 'react' +import axios from 'axios' +import { Product } from "../models/product.tsx" + + +type AddProductProps = { + productAdd: () => void; +}; + +export default function AddProduct({ productAdd }: AddProductProps) { + const [name, setName] = useState(""); + const [amount, setAmount] = useState("") + + const handleSubmit = (event: FormEvent) => { + event.preventDefault(); + + const newProduct = { + name: name.trim(), + amount: parseInt(amount) + } + + axios.post("/api/products", newProduct) + .then(() => { + setName("") + setAmount("") + productAdd() + }) + .catch(error => { + console.error("Es ist ein Fehler aufgetreten!", error) + }) + } + + return ( +
+

Neues Produkt hinzufügen

+
+ ) => setName(event.target.value)} + placeholder="Product name" /> + ) => setAmount(event.target.value)} + placeholder="Menge"/> + +
+
+ ) +} diff --git a/frontend/src/components/ProductCard.tsx b/frontend/src/components/ProductCard.tsx index 6220832..ed03455 100644 --- a/frontend/src/components/ProductCard.tsx +++ b/frontend/src/components/ProductCard.tsx @@ -2,7 +2,7 @@ import { Product } from "../models/product.tsx"; type ProductCardProps = { product: Product; -}; +} export default function ProductCard(props: Readonly) { return ( @@ -12,5 +12,5 @@ export default function ProductCard(props: Readonly) {

Menge: {props.product.amount}

- ); + ) } diff --git a/frontend/src/components/ProductList.tsx b/frontend/src/components/ProductList.tsx index 32fbf85..17c1df2 100644 --- a/frontend/src/components/ProductList.tsx +++ b/frontend/src/components/ProductList.tsx @@ -1,51 +1,51 @@ +import { useEffect, useState } from 'react' +import axios from 'axios' +import { Product } from "../models/product.tsx" +import GetGroceriesById from "./GetGroceriesById.tsx" +import ProductCard from "./ProductCard.tsx" +import AddProduct from "./AddProduсt.tsx" + -import axios from 'axios'; -import { Product } from '../models/product.tsx'; -import GetGroceriesById from "./GetGroceriesById.tsx"; -import ProductCard from "./ProductCard.tsx"; -import {useEffect, useState} from "react"; export default function ProductList() { - const [products, setProducts] = useState([]); // Verwende den Typ für die State-Variable + const [products, setProducts] = useState([]) - useEffect(() => { + const fetchProducts = () => { axios.get('/api/products') .then(response => { - setProducts(response.data); + setProducts(response.data) }) .catch(error => { console.error("Es gab einen Fehler beim Abrufen der Daten!", error); - }); - }, []); + }) + } - function deleteThisItem(id:string){ + useEffect(() => { + fetchProducts() + }, []) + + function deleteThisItem(id: string) { axios.delete("/api/products/" + id) - .then(() => {axios.get('api/products') - .then(response => { - setProducts(response.data); - }) + .then(() => fetchProducts()) .catch(error => { - console.error("Es gab einen Fehler beim Abrufen der Daten!", error); - });}) - + console.error("Es ist ein Problem aufgetreten!", error) + }) } return (

Einkaufsliste

- + +
{products.map(product => (
  • {product.name} - Menge: {product.amount} - - + +
  • ))}
    -
    ); } - - diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index 6f4ac9b..d908efe 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -2,9 +2,12 @@ import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' import App from './App.tsx' import './index.css' +import {BrowserRouter} from "react-router-dom" createRoot(document.getElementById('root')!).render( - + + + , )