@leatcom/portal-sessions 0.0.35 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12516,7 +12516,7 @@ function Kg({ children: e, config: t, payload: n }) {
|
|
|
12516
12516
|
i(a.data.data.uuid);
|
|
12517
12517
|
})());
|
|
12518
12518
|
}, [t, n, r]), r ? /* @__PURE__ */ O.jsxs($l, { children: [
|
|
12519
|
-
/* @__PURE__ */ O.jsx(_u, { ...t, sessionUuid: r, children: /* @__PURE__ */ O.jsx("div", { children: /* @__PURE__ */ O.jsxs("div", { className: "flex h-screen w-screen flex-col
|
|
12519
|
+
/* @__PURE__ */ O.jsx(_u, { ...t, sessionUuid: r, children: /* @__PURE__ */ O.jsx("div", { children: /* @__PURE__ */ O.jsxs("div", { className: "bg-primary-50 flex h-screen w-screen flex-col", children: [
|
|
12520
12520
|
/* @__PURE__ */ O.jsx("div", { className: "flex h-full overflow-auto", children: e }),
|
|
12521
12521
|
r && /* @__PURE__ */ O.jsx(Lu, {})
|
|
12522
12522
|
] }) }) }),
|
|
@@ -14547,7 +14547,7 @@ function My(e, t) {
|
|
|
14547
14547
|
}
|
|
14548
14548
|
}
|
|
14549
14549
|
/**
|
|
14550
|
-
* React
|
|
14550
|
+
* React Router v6.23.1
|
|
14551
14551
|
*
|
|
14552
14552
|
* Copyright (c) Remix Software Inc.
|
|
14553
14553
|
*
|
|
@@ -14592,7 +14592,7 @@ function $y(e, t) {
|
|
|
14592
14592
|
!1,
|
|
14593
14593
|
// TODO: This error is probably because they somehow have 2 versions of the
|
|
14594
14594
|
// router loaded. We can help them understand how to avoid that.
|
|
14595
|
-
"useHref() may be used only in the context of a <
|
|
14595
|
+
"useHref() may be used only in the context of a <Router> component."
|
|
14596
14596
|
) : Ee(!1));
|
|
14597
14597
|
let {
|
|
14598
14598
|
basename: r,
|
|
@@ -14618,7 +14618,7 @@ function wn() {
|
|
|
14618
14618
|
!1,
|
|
14619
14619
|
// TODO: This error is probably because they somehow have 2 versions of the
|
|
14620
14620
|
// router loaded. We can help them understand how to avoid that.
|
|
14621
|
-
"useLocation() may be used only in the context of a <
|
|
14621
|
+
"useLocation() may be used only in the context of a <Router> component."
|
|
14622
14622
|
) : Ee(!1)), se.useContext(Xi).location;
|
|
14623
14623
|
}
|
|
14624
14624
|
const kc = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
|
|
@@ -14636,7 +14636,7 @@ function Uy() {
|
|
|
14636
14636
|
!1,
|
|
14637
14637
|
// TODO: This error is probably because they somehow have 2 versions of the
|
|
14638
14638
|
// router loaded. We can help them understand how to avoid that.
|
|
14639
|
-
"useNavigate() may be used only in the context of a <
|
|
14639
|
+
"useNavigate() may be used only in the context of a <Router> component."
|
|
14640
14640
|
) : Ee(!1));
|
|
14641
14641
|
let e = se.useContext(Yn), {
|
|
14642
14642
|
basename: t,
|
|
@@ -14690,7 +14690,7 @@ function Hy(e, t, n, r) {
|
|
|
14690
14690
|
!1,
|
|
14691
14691
|
// TODO: This error is probably because they somehow have 2 versions of the
|
|
14692
14692
|
// router loaded. We can help them understand how to avoid that.
|
|
14693
|
-
"useRoutes() may be used only in the context of a <
|
|
14693
|
+
"useRoutes() may be used only in the context of a <Router> component."
|
|
14694
14694
|
) : Ee(!1));
|
|
14695
14695
|
let {
|
|
14696
14696
|
navigator: i
|
|
@@ -14735,7 +14735,7 @@ function Ky() {
|
|
|
14735
14735
|
padding: "2px 4px",
|
|
14736
14736
|
backgroundColor: r
|
|
14737
14737
|
}, s = null;
|
|
14738
|
-
return process.env.NODE_ENV !== "production" && (console.error("Error handled by React
|
|
14738
|
+
return process.env.NODE_ENV !== "production" && (console.error("Error handled by React Router default ErrorBoundary:", e), s = /* @__PURE__ */ se.createElement(se.Fragment, null, /* @__PURE__ */ se.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ se.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ se.createElement("code", {
|
|
14739
14739
|
style: a
|
|
14740
14740
|
}, "ErrorBoundary"), " or", " ", /* @__PURE__ */ se.createElement("code", {
|
|
14741
14741
|
style: a
|
|
@@ -14773,7 +14773,7 @@ class qy extends se.Component {
|
|
|
14773
14773
|
};
|
|
14774
14774
|
}
|
|
14775
14775
|
componentDidCatch(t, n) {
|
|
14776
|
-
console.error("React
|
|
14776
|
+
console.error("React Router caught the following error during render", t, n);
|
|
14777
14777
|
}
|
|
14778
14778
|
render() {
|
|
14779
14779
|
return this.state.error !== void 0 ? /* @__PURE__ */ se.createElement(Gt.Provider, {
|
|
@@ -14913,7 +14913,7 @@ function tv(e) {
|
|
|
14913
14913
|
static: s = !1,
|
|
14914
14914
|
future: c
|
|
14915
14915
|
} = e;
|
|
14916
|
-
Gr() && (process.env.NODE_ENV !== "production" ? Ee(!1, "You cannot render a <
|
|
14916
|
+
Gr() && (process.env.NODE_ENV !== "production" ? Ee(!1, "You cannot render a <Router> inside another <Router>. You should never have more than one in your app.") : Ee(!1));
|
|
14917
14917
|
let f = t.replace(/^\/*/, "/"), g = se.useMemo(() => ({
|
|
14918
14918
|
basename: f,
|
|
14919
14919
|
navigator: a,
|
|
@@ -14942,7 +14942,7 @@ function tv(e) {
|
|
|
14942
14942
|
navigationType: i
|
|
14943
14943
|
};
|
|
14944
14944
|
}, [f, h, x, l, v, o, i]);
|
|
14945
|
-
return process.env.NODE_ENV !== "production" && pt(u != null, '<
|
|
14945
|
+
return process.env.NODE_ENV !== "production" && pt(u != null, '<Router basename="' + f + '"> is not able to match the URL ' + ('"' + h + x + l + '" because it does not start with the ') + "basename, so the <Router> won't render anything."), u == null ? null : /* @__PURE__ */ se.createElement(Wt.Provider, {
|
|
14946
14946
|
value: g
|
|
14947
14947
|
}, /* @__PURE__ */ se.createElement(Xi.Provider, {
|
|
14948
14948
|
children: n,
|
|
@@ -14985,7 +14985,7 @@ function Qn(e, t) {
|
|
|
14985
14985
|
}).initialize();
|
|
14986
14986
|
}
|
|
14987
14987
|
/**
|
|
14988
|
-
* React
|
|
14988
|
+
* React Router DOM v6.23.1
|
|
14989
14989
|
*
|
|
14990
14990
|
* Copyright (c) Remix Software Inc.
|
|
14991
14991
|
*
|
|
@@ -16303,6 +16303,7 @@ function Qv(e) {
|
|
|
16303
16303
|
type: e.type ?? mr.PORTAL,
|
|
16304
16304
|
api_key: e.apiKey,
|
|
16305
16305
|
shop_uuid: e.shopUuid,
|
|
16306
|
+
contact_uuid: e.contactUuid,
|
|
16306
16307
|
...e.amountInCents && { amount_in_cents: e.amountInCents },
|
|
16307
16308
|
...e.allowMultipleGiftcards && { allow_multiple_giftcards: e.allowMultipleGiftcards },
|
|
16308
16309
|
...e.scannerType && { scanner_type: e.scannerType },
|
|
@@ -70,7 +70,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
70
70
|
`].concat(X)):F=this.addStringAt.apply(this,[F," "].concat(X)),G.debug&&console.log("Input will be: "+F),F}},{key:"updateCaretPos",value:function(w){var _=arguments.length>1&&arguments[1]!==void 0&&arguments[1],N=this.updateCaretPosAction(w,_);this.dispatch(function(R){R.setCaretPosition(N)})}},{key:"updateCaretPosAction",value:function(w){var _=arguments.length>1&&arguments[1]!==void 0&&arguments[1],N=this.getOptions(),R=this.getCaretPosition();return R!=null&&(_?R>0&&(R-=w):R+=w),N.debug&&console.log("Caret at:",R),R}},{key:"addStringAt",value:function(w,_){var N,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w.length,W=arguments.length>3&&arguments[3]!==void 0?arguments[3]:w.length,G=arguments.length>4&&arguments[4]!==void 0&&arguments[4];return R||R===0?(N=[w.slice(0,R),_,w.slice(W)].join(""),this.isMaxLengthReached()||G&&this.updateCaretPos(_.length)):N=w+_,N}},{key:"removeAt",value:function(w){var _,N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:w.length,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w.length,W=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(N===0&&R===0)return w;if(N===R){var G=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;N&&N>=0?w.substring(N-2,N).match(G)?(_=w.substr(0,N-2)+w.substr(N),W&&this.updateCaretPos(2,!0)):(_=w.substr(0,N-1)+w.substr(N),W&&this.updateCaretPos(1,!0)):w.slice(-2).match(G)?(_=w.slice(0,-2),W&&this.updateCaretPos(2,!0)):(_=w.slice(0,-1),W&&this.updateCaretPos(1,!0))}else _=w.slice(0,N)+w.slice(R),W&&this.dispatch(function(X){X.setCaretPosition(N)});return _}},{key:"removeForwardsAt",value:function(w){var _,N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:w.length,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w.length,W=arguments.length>3&&arguments[3]!==void 0&&arguments[3];return w!=null&&w.length&&N!==null?(N===R?_=w.substring(N,N+2).match(/([\uD800-\uDBFF][\uDC00-\uDFFF])/g)?w.substr(0,N)+w.substr(N+2):w.substr(0,N)+w.substr(N+1):(_=w.slice(0,N)+w.slice(R),W&&this.dispatch(function(G){G.setCaretPosition(N)})),_):w}},{key:"handleMaxLength",value:function(w,_){var N=this.getOptions(),R=N.maxLength,W=w[N.inputName||"default"],G=_.length-1>=R;if(_.length<=W.length)return!1;if(Number.isInteger(R))return N.debug&&console.log("maxLength (num) reached:",G),G?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if(c(R)==="object"){var X=_.length-1>=R[N.inputName||"default"];return N.debug&&console.log("maxLength (obj) reached:",X),X?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return!!this.maxLengthReached}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints}},{key:"pointerEventsSupported",value:function(){return!!window.PointerEvent}},{key:"camelCase",value:function(w){return w?w.toLowerCase().trim().split(/[.\-_\s]/g).reduce(function(_,N){return N.length?_+N[0].toUpperCase()+N.slice(1):_}):""}},{key:"chunkArray",value:function(w,_){return l(Array(Math.ceil(w.length/_))).map(function(N,R){return w.slice(_*R,_+_*R)})}},{key:"escapeRegex",value:function(w){return w.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}},{key:"getRtlOffset",value:function(w,_){var N=w,R=_.indexOf("");return R<w&&R!=-1&&N--,_.indexOf("")<w&&R!=-1&&N--,N<0?0:N}}],J=[{key:"bindMethods",value:function(w,_){var N,R=function(G,X){var F=typeof Symbol<"u"&&G[Symbol.iterator]||G["@@iterator"];if(!F){if(Array.isArray(G)||(F=v(G))||X){F&&(G=F);var ce=0,fe=function(){};return{s:fe,n:function(){return ce>=G.length?{done:!0}:{done:!1,value:G[ce++]}},e:function(ae){throw ae},f:fe}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
71
71
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var re,oe=!0,ge=!1;return{s:function(){F=F.call(G)},n:function(){var ae=F.next();return oe=ae.done,ae},e:function(ae){ge=!0,re=ae},f:function(){try{oe||F.return==null||F.return()}finally{if(ge)throw re}}}}(Object.getOwnPropertyNames(w.prototype));try{for(R.s();!(N=R.n()).done;){var W=N.value;W==="constructor"||W==="bindMethods"||(_[W]=_[W].bind(_))}}catch(G){R.e(G)}finally{R.f()}}}],U&&p(V.prototype,U),J&&p(V,J),Object.defineProperty(V,"prototype",{writable:!1}),V;var V,U,J}();d(y,"noop",function(){});var b=y;function C(V){return C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},C(V)}function S(V,U){for(var J=0;J<U.length;J++){var w=U[J];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(V,B(w.key),w)}}function k(V,U,J){return(U=B(U))in V?Object.defineProperty(V,U,{value:J,enumerable:!0,configurable:!0,writable:!0}):V[U]=J,V}function B(V){var U=function(J,w){if(C(J)!="object"||!J)return J;var _=J[Symbol.toPrimitive];if(_!==void 0){var N=_.call(J,w);if(C(N)!="object")return N;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(J)}(V,"string");return C(U)=="symbol"?U:U+""}var O=function(){return V=function w(_){var N=this,R=_.dispatch,W=_.getOptions;(function(G,X){if(!(G instanceof X))throw new TypeError("Cannot call a class as a function")})(this,w),k(this,"getOptions",void 0),k(this,"dispatch",void 0),k(this,"isModifierKey",function(G){return G.altKey||G.ctrlKey||G.shiftKey||["Tab","CapsLock","Esc","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(G.code||G.key||N.keyCodeToKey(G==null?void 0:G.keyCode))}),this.dispatch=R,this.getOptions=W,b.bindMethods(w,this)},(U=[{key:"handleHighlightKeyDown",value:function(w){var _=this.getOptions();_.physicalKeyboardHighlightPreventDefault&&this.isModifierKey(w)&&(w.preventDefault(),w.stopImmediatePropagation());var N=this.getSimpleKeyboardLayoutKey(w);this.dispatch(function(R){var W,G,X=R.getButtonElement(N),F=R.getButtonElement("{".concat(N,"}"));if(X)W=X,G=N;else{if(!F)return;W=F,G="{".concat(N,"}")}var ce,fe,re,oe,ge=function(be){be.style.background=_.physicalKeyboardHighlightBgColor||"#dadce4",be.style.color=_.physicalKeyboardHighlightTextColor||"black"};if(W)if(Array.isArray(W)){if(W.forEach(function(be){return ge(be)}),_.physicalKeyboardHighlightPress)if(_.physicalKeyboardHighlightPressUsePointerEvents)(ce=W[0])===null||ce===void 0||(fe=ce.onpointerdown)===null||fe===void 0||fe.call(ce,w);else if(_.physicalKeyboardHighlightPressUseClick){var ae;(ae=W[0])===null||ae===void 0||ae.click()}else R.handleButtonClicked(G,w)}else ge(W),_.physicalKeyboardHighlightPress&&(_.physicalKeyboardHighlightPressUsePointerEvents?(re=W)===null||re===void 0||(oe=re.onpointerdown)===null||oe===void 0||oe.call(re,w):_.physicalKeyboardHighlightPressUseClick?W.click():R.handleButtonClicked(G,w))})}},{key:"handleHighlightKeyUp",value:function(w){var _=this.getOptions();_.physicalKeyboardHighlightPreventDefault&&this.isModifierKey(w)&&(w.preventDefault(),w.stopImmediatePropagation());var N=this.getSimpleKeyboardLayoutKey(w);this.dispatch(function(R){var W,G,X,F=R.getButtonElement(N)||R.getButtonElement("{".concat(N,"}")),ce=function(fe){fe.removeAttribute&&fe.removeAttribute("style")};F&&(Array.isArray(F)?(F.forEach(function(fe){return ce(fe)}),_.physicalKeyboardHighlightPressUsePointerEvents&&((W=F[0])===null||W===void 0||(G=W.onpointerup)===null||G===void 0||G.call(W,w))):(ce(F),_.physicalKeyboardHighlightPressUsePointerEvents&&(F==null||(X=F.onpointerup)===null||X===void 0||X.call(F,w))))})}},{key:"getSimpleKeyboardLayoutKey",value:function(w){var _,N="",R=w.code||w.key||this.keyCodeToKey(w==null?void 0:w.keyCode);return(N=R!=null&&R.includes("Numpad")||R!=null&&R.includes("Shift")||R!=null&&R.includes("Space")||R!=null&&R.includes("Backspace")||R!=null&&R.includes("Control")||R!=null&&R.includes("Alt")||R!=null&&R.includes("Meta")?w.code||"":w.key||this.keyCodeToKey(w==null?void 0:w.keyCode)||"").length>1?(_=N)===null||_===void 0?void 0:_.toLowerCase():N}},{key:"keyCodeToKey",value:function(w){return{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Meta",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9",106:"NumpadMultiply",107:"NumpadAdd",109:"NumpadSubtract",110:"NumpadDecimal",111:"NumpadDivide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[w]||""}}])&&S(V.prototype,U),J&&S(V,J),Object.defineProperty(V,"prototype",{writable:!1}),V;var V,U,J}();function j(V){return j=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},j(V)}function I(V,U){for(var J=0;J<U.length;J++){var w=U[J];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(V,M(w.key),w)}}function D(V,U,J){return(U=M(U))in V?Object.defineProperty(V,U,{value:J,enumerable:!0,configurable:!0,writable:!0}):V[U]=J,V}function M(V){var U=function(J,w){if(j(J)!="object"||!J)return J;var _=J[Symbol.toPrimitive];if(_!==void 0){var N=_.call(J,w);if(j(N)!="object")return N;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(J)}(V,"string");return j(U)=="symbol"?U:U+""}var $=function(){return V=function w(_){var N=_.utilities,R=_.options;(function(W,G){if(!(W instanceof G))throw new TypeError("Cannot call a class as a function")})(this,w),D(this,"utilities",void 0),D(this,"options",void 0),D(this,"candidateBoxElement",void 0),D(this,"pageIndex",0),D(this,"pageSize",void 0),this.utilities=N,this.options=R,b.bindMethods(w,this),this.pageSize=this.utilities.getOptions().layoutCandidatesPageSize||5},U=[{key:"destroy",value:function(){this.candidateBoxElement&&(this.candidateBoxElement.remove(),this.pageIndex=0)}},{key:"show",value:function(w){var _=this,N=w.candidateValue,R=w.targetElement,W=w.onSelect;if(N&&N.length){var G=this.utilities.chunkArray(N.split(" "),this.pageSize);this.renderPage({candidateListPages:G,targetElement:R,pageIndex:this.pageIndex,nbPages:G.length,onItemSelected:function(X,F){W(X,F),_.destroy()}})}}},{key:"renderPage",value:function(w){var _,N=this,R=w.candidateListPages,W=w.targetElement,G=w.pageIndex,X=w.nbPages,F=w.onItemSelected;(_=this.candidateBoxElement)===null||_===void 0||_.remove(),this.candidateBoxElement=document.createElement("div"),this.candidateBoxElement.className="hg-candidate-box";var ce=document.createElement("ul");ce.className="hg-candidate-box-list",R[G].forEach(function(Ce){var Fe,Ae=document.createElement("li"),Ve=function(){var ze=new(N.options.useTouchEvents?TouchEvent:MouseEvent)("click");return Object.defineProperty(ze,"target",{value:Ae}),ze};Ae.className="hg-candidate-box-list-item",Ae.innerHTML=((Fe=N.options.display)===null||Fe===void 0?void 0:Fe[Ce])||Ce,N.options.useTouchEvents?Ae.ontouchstart=function(ze){return F(Ce,ze||Ve())}:Ae.onclick=function(){var ze=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ve();return F(Ce,ze)},ce.appendChild(Ae)});var fe=G>0,re=document.createElement("div");re.classList.add("hg-candidate-box-prev"),fe&&re.classList.add("hg-candidate-box-btn-active");var oe=function(){fe&&N.renderPage({candidateListPages:R,targetElement:W,pageIndex:G-1,nbPages:X,onItemSelected:F})};this.options.useTouchEvents?re.ontouchstart=oe:re.onclick=oe,this.candidateBoxElement.appendChild(re),this.candidateBoxElement.appendChild(ce);var ge=G<X-1,ae=document.createElement("div");ae.classList.add("hg-candidate-box-next"),ge&&ae.classList.add("hg-candidate-box-btn-active");var be=function(){ge&&N.renderPage({candidateListPages:R,targetElement:W,pageIndex:G+1,nbPages:X,onItemSelected:F})};this.options.useTouchEvents?ae.ontouchstart=be:ae.onclick=be,this.candidateBoxElement.appendChild(ae),W.prepend(this.candidateBoxElement)}}],U&&I(V.prototype,U),J&&I(V,J),Object.defineProperty(V,"prototype",{writable:!1}),V;var V,U,J}(),P=$;function L(V){return function(U){if(Array.isArray(U))return q(U)}(V)||function(U){if(typeof Symbol<"u"&&U[Symbol.iterator]!=null||U["@@iterator"]!=null)return Array.from(U)}(V)||function(U,J){if(U){if(typeof U=="string")return q(U,J);var w=Object.prototype.toString.call(U).slice(8,-1);return w==="Object"&&U.constructor&&(w=U.constructor.name),w==="Map"||w==="Set"?Array.from(U):w==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(w)?q(U,J):void 0}}(V)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
72
72
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function q(V,U){(U==null||U>V.length)&&(U=V.length);for(var J=0,w=new Array(U);J<U;J++)w[J]=V[J];return w}function K(V){return K=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(U){return typeof U}:function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},K(V)}function Q(V,U){var J=Object.keys(V);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(V);U&&(w=w.filter(function(_){return Object.getOwnPropertyDescriptor(V,_).enumerable})),J.push.apply(J,w)}return J}function Z(V,U){for(var J=0;J<U.length;J++){var w=U[J];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(V,ue(w.key),w)}}function ee(V,U,J){return(U=ue(U))in V?Object.defineProperty(V,U,{value:J,enumerable:!0,configurable:!0,writable:!0}):V[U]=J,V}function ue(V){var U=function(J,w){if(K(J)!="object"||!J)return J;var _=J[Symbol.toPrimitive];if(_!==void 0){var N=_.call(J,w);if(K(N)!="object")return N;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(J)}(V,"string");return K(U)=="symbol"?U:U+""}var ne=function(){return V=function w(_,N){var R=this;if(function(oe,ge){if(!(oe instanceof ge))throw new TypeError("Cannot call a class as a function")}(this,w),ee(this,"input",void 0),ee(this,"options",void 0),ee(this,"utilities",void 0),ee(this,"caretPosition",void 0),ee(this,"caretPositionEnd",void 0),ee(this,"keyboardDOM",void 0),ee(this,"keyboardPluginClasses",void 0),ee(this,"keyboardDOMClass",void 0),ee(this,"buttonElements",void 0),ee(this,"currentInstanceName",void 0),ee(this,"allKeyboardInstances",void 0),ee(this,"keyboardInstanceNames",void 0),ee(this,"isFirstKeyboardInstance",void 0),ee(this,"physicalKeyboard",void 0),ee(this,"modules",void 0),ee(this,"activeButtonClass",void 0),ee(this,"holdInteractionTimeout",void 0),ee(this,"holdTimeout",void 0),ee(this,"isMouseHold",void 0),ee(this,"initialized",void 0),ee(this,"candidateBox",void 0),ee(this,"keyboardRowsDOM",void 0),ee(this,"defaultName","default"),ee(this,"activeInputElement",null),ee(this,"handleParams",function(oe,ge){var ae,be,Ce;if(typeof oe=="string")ae=oe.split(".").join(""),be=document.querySelector(".".concat(ae)),Ce=ge;else if(oe instanceof HTMLDivElement){if(!oe.className)throw console.warn("Any DOM element passed as parameter must have a class."),new Error("KEYBOARD_DOM_CLASS_ERROR");ae=oe.className.split(" ")[0],be=oe,Ce=ge}else ae="simple-keyboard",be=document.querySelector(".".concat(ae)),Ce=oe;return{keyboardDOMClass:ae,keyboardDOM:be,options:Ce}}),ee(this,"getOptions",function(){return R.options}),ee(this,"getCaretPosition",function(){return R.caretPosition}),ee(this,"getCaretPositionEnd",function(){return R.caretPositionEnd}),ee(this,"registerModule",function(oe,ge){R.modules[oe]||(R.modules[oe]={}),ge(R.modules[oe])}),ee(this,"getKeyboardClassString",function(){for(var oe=arguments.length,ge=new Array(oe),ae=0;ae<oe;ae++)ge[ae]=arguments[ae];return[R.keyboardDOMClass].concat(ge).filter(function(be){return!!be}).join(" ")}),typeof window<"u"){var W=this.handleParams(_,N),G=W.keyboardDOMClass,X=W.keyboardDOM,F=W.options,ce=F===void 0?{}:F;this.utilities=new b({getOptions:this.getOptions,getCaretPosition:this.getCaretPosition,getCaretPositionEnd:this.getCaretPositionEnd,dispatch:this.dispatch}),this.caretPosition=null,this.caretPositionEnd=null,this.keyboardDOM=X,this.options=function(oe){for(var ge=1;ge<arguments.length;ge++){var ae=arguments[ge]!=null?arguments[ge]:{};ge%2?Q(Object(ae),!0).forEach(function(be){ee(oe,be,ae[be])}):Object.getOwnPropertyDescriptors?Object.defineProperties(oe,Object.getOwnPropertyDescriptors(ae)):Q(Object(ae)).forEach(function(be){Object.defineProperty(oe,be,Object.getOwnPropertyDescriptor(ae,be))})}return oe}({layoutName:"default",theme:"hg-theme-default",inputName:"default",preventMouseDownDefault:!1,enableLayoutCandidates:!0,excludeFromLayout:{}},ce),this.keyboardPluginClasses="",b.bindMethods(w,this);var fe=this.options.inputName,re=fe===void 0?this.defaultName:fe;if(this.input={},this.input[re]="",this.keyboardDOMClass=G,this.buttonElements={},window.SimpleKeyboardInstances||(window.SimpleKeyboardInstances={}),this.currentInstanceName=this.utilities.camelCase(this.keyboardDOMClass),window.SimpleKeyboardInstances[this.currentInstanceName]=this,this.allKeyboardInstances=window.SimpleKeyboardInstances,this.keyboardInstanceNames=Object.keys(window.SimpleKeyboardInstances),this.isFirstKeyboardInstance=this.keyboardInstanceNames[0]===this.currentInstanceName,this.physicalKeyboard=new O({dispatch:this.dispatch,getOptions:this.getOptions}),this.candidateBox=this.options.enableLayoutCandidates?new P({utilities:this.utilities,options:this.options}):null,!this.keyboardDOM)throw console.warn('".'.concat(G,'" was not found in the DOM.')),new Error("KEYBOARD_DOM_ERROR");this.render(),this.modules={},this.loadModules()}},U=[{key:"setCaretPosition",value:function(w){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:w;this.caretPosition=w,this.caretPositionEnd=_}},{key:"getInputCandidates",value:function(w){var _=this,N=this.options,R=N.layoutCandidates,W=N.layoutCandidatesCaseSensitiveMatch;if(!R||K(R)!=="object")return{};var G=Object.keys(R).filter(function(ce){var fe=w.substring(0,_.getCaretPositionEnd()||0)||w,re=new RegExp("".concat(_.utilities.escapeRegex(ce),"$"),W?"g":"gi");return!!L(fe.matchAll(re)).length});if(G.length>1){var X=G.sort(function(ce,fe){return fe.length-ce.length})[0];return{candidateKey:X,candidateValue:R[X]}}if(G.length){var F=G[0];return{candidateKey:F,candidateValue:R[F]}}return{}}},{key:"showCandidatesBox",value:function(w,_,N){var R=this;this.candidateBox&&this.candidateBox.show({candidateValue:_,targetElement:N,onSelect:function(W,G){var X=R.options,F=X.layoutCandidatesCaseSensitiveMatch,ce=X.disableCandidateNormalization,fe=X.enableLayoutCandidatesKeyPress,re=W;ce||(re=W.normalize("NFD")),typeof R.options.beforeInputUpdate=="function"&&R.options.beforeInputUpdate(R);var oe=R.getInput(R.options.inputName,!0),ge=R.getCaretPositionEnd()||0,ae=oe.substring(0,ge||0)||oe,be=new RegExp("".concat(R.utilities.escapeRegex(w),"$"),F?"g":"gi"),Ce=ae.replace(be,re),Fe=oe.replace(ae,Ce),Ae=Ce.length-ae.length,Ve=(ge||oe.length)+Ae;Ve<0&&(Ve=0),R.setInput(Fe,R.options.inputName,!0),R.setCaretPosition(Ve),fe&&typeof R.options.onKeyPress=="function"&&R.options.onKeyPress(W,G),typeof R.options.onChange=="function"&&R.options.onChange(R.getInput(R.options.inputName,!0),G),typeof R.options.onChangeAll=="function"&&R.options.onChangeAll(R.getAllInputs(),G)}})}},{key:"handleButtonClicked",value:function(w,_){var N=this.options,R=N.inputName,W=R===void 0?this.defaultName:R,G=N.debug;if(w!=="{//}"){this.input[W]||(this.input[W]=""),typeof this.options.beforeInputUpdate=="function"&&this.options.beforeInputUpdate(this);var X=this.utilities.getUpdatedInput(w,this.input[W],this.caretPosition,this.caretPositionEnd);if(this.utilities.isStandardButton(w)&&this.activeInputElement&&this.input[W]&&this.input[W]===X&&this.caretPosition===0&&this.caretPositionEnd===X.length)return this.setInput("",this.options.inputName,!0),this.setCaretPosition(0),this.activeInputElement.value="",this.activeInputElement.setSelectionRange(0,0),void this.handleButtonClicked(w,_);if(typeof this.options.onKeyPress=="function"&&this.options.onKeyPress(w,_),this.input[W]!==X&&(!this.options.inputPattern||this.options.inputPattern&&this.inputPatternIsValid(X))){if(this.options.maxLength&&this.utilities.handleMaxLength(this.input,X))return;var F=this.utilities.getUpdatedInput(w,this.input[W],this.caretPosition,this.caretPositionEnd,!0);if(this.setInput(F,this.options.inputName,!0),G&&console.log("Input changed:",this.getAllInputs()),this.options.debug&&console.log("Caret at: ",this.getCaretPosition(),this.getCaretPositionEnd(),"(".concat(this.keyboardDOMClass,")"),_==null?void 0:_.type),this.options.syncInstanceInputs&&this.syncInstanceInputs(),typeof this.options.onChange=="function"&&this.options.onChange(this.getInput(this.options.inputName,!0),_),typeof this.options.onChangeAll=="function"&&this.options.onChangeAll(this.getAllInputs(),_),_!=null&&_.target&&this.options.enableLayoutCandidates){var ce,fe=this.getInputCandidates(X),re=fe.candidateKey,oe=fe.candidateValue;re&&oe?this.showCandidatesBox(re,oe,this.keyboardDOM):(ce=this.candidateBox)===null||ce===void 0||ce.destroy()}}this.caretPositionEnd&&this.caretPosition!==this.caretPositionEnd&&(this.setCaretPosition(this.caretPositionEnd,this.caretPositionEnd),this.activeInputElement&&this.activeInputElement.setSelectionRange(this.caretPositionEnd,this.caretPositionEnd),this.options.debug&&console.log("Caret position aligned",this.caretPosition)),G&&console.log("Key pressed:",w)}}},{key:"getMouseHold",value:function(){return this.isMouseHold}},{key:"setMouseHold",value:function(w){this.options.syncInstanceInputs?this.dispatch(function(_){_.isMouseHold=w}):this.isMouseHold=w}},{key:"handleButtonMouseDown",value:function(w,_){var N=this;_&&(this.options.preventMouseDownDefault&&_.preventDefault(),this.options.stopMouseDownPropagation&&_.stopPropagation(),_.target.classList.add(this.activeButtonClass)),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdTimeout&&clearTimeout(this.holdTimeout),this.setMouseHold(!0),this.options.disableButtonHold||(this.holdTimeout=window.setTimeout(function(){(N.getMouseHold()&&(!w.includes("{")&&!w.includes("}")||w==="{delete}"||w==="{backspace}"||w==="{bksp}"||w==="{space}"||w==="{tab}")||w==="{arrowright}"||w==="{arrowleft}"||w==="{arrowup}"||w==="{arrowdown}")&&(N.options.debug&&console.log("Button held:",w),N.handleButtonHold(w)),clearTimeout(N.holdTimeout)},500))}},{key:"handleButtonMouseUp",value:function(w,_){var N=this;_&&(this.options.preventMouseUpDefault&&_.preventDefault&&_.preventDefault(),this.options.stopMouseUpPropagation&&_.stopPropagation&&_.stopPropagation(),!(_.target===this.keyboardDOM||_.target&&this.keyboardDOM.contains(_.target)||this.candidateBox&&this.candidateBox.candidateBoxElement&&(_.target===this.candidateBox.candidateBoxElement||_.target&&this.candidateBox.candidateBoxElement.contains(_.target)))&&this.candidateBox&&this.candidateBox.destroy()),this.recurseButtons(function(R){R.classList.remove(N.activeButtonClass)}),this.setMouseHold(!1),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),w&&typeof this.options.onKeyReleased=="function"&&this.options.onKeyReleased(w,_)}},{key:"handleKeyboardContainerMouseDown",value:function(w){this.options.preventMouseDownDefault&&w.preventDefault()}},{key:"handleButtonHold",value:function(w){var _=this;this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdInteractionTimeout=window.setTimeout(function(){_.getMouseHold()?(_.handleButtonClicked(w),_.handleButtonHold(w)):clearTimeout(_.holdInteractionTimeout)},100)}},{key:"syncInstanceInputs",value:function(){var w=this;this.dispatch(function(_){_.replaceInput(w.input),_.setCaretPosition(w.caretPosition,w.caretPositionEnd)})}},{key:"clearInput",value:function(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.inputName||this.defaultName;this.input[w]="",this.setCaretPosition(0),this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"getInput",value:function(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.inputName||this.defaultName,_=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.options.syncInstanceInputs&&!_&&this.syncInstanceInputs(),this.options.rtl?""+this.input[w].replace("","").replace("","")+"":this.input[w]}},{key:"getAllInputs",value:function(){var w=this,_={};return Object.keys(this.input).forEach(function(N){_[N]=w.getInput(N,!0)}),_}},{key:"setInput",value:function(w){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.inputName||this.defaultName,N=arguments.length>2?arguments[2]:void 0;this.input[_]=w,!N&&this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"replaceInput",value:function(w){this.input=w}},{key:"setOptions",value:function(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},_=this.changedOptions(w);this.options=Object.assign(this.options,w),_.length&&(this.options.debug&&console.log("changedOptions",_),this.onSetOptions(_),this.render())}},{key:"changedOptions",value:function(w){var _=this;return Object.keys(w).filter(function(N){return JSON.stringify(w[N])!==JSON.stringify(_.options[N])})}},{key:"onSetOptions",value:function(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];w.includes("layoutName")&&this.candidateBox&&this.candidateBox.destroy(),(w.includes("layoutCandidatesPageSize")||w.includes("layoutCandidates"))&&this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=new P({utilities:this.utilities,options:this.options}))}},{key:"resetRows",value:function(){this.keyboardRowsDOM&&this.keyboardRowsDOM.remove(),this.keyboardDOM.className=this.keyboardDOMClass,this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.buttonElements={}}},{key:"dispatch",value:function(w){if(!window.SimpleKeyboardInstances)throw console.warn("SimpleKeyboardInstances is not defined. Dispatch cannot be called."),new Error("INSTANCES_VAR_ERROR");return Object.keys(window.SimpleKeyboardInstances).forEach(function(_){w(window.SimpleKeyboardInstances[_],_)})}},{key:"addButtonTheme",value:function(w,_){var N=this;_&&w&&(w.split(" ").forEach(function(R){_.split(" ").forEach(function(W){N.options.buttonTheme||(N.options.buttonTheme=[]);var G=!1;N.options.buttonTheme.map(function(X){if(X!=null&&X.class.split(" ").includes(W)){G=!0;var F=X.buttons.split(" ");F.includes(R)||(G=!0,F.push(R),X.buttons=F.join(" "))}return X}),G||N.options.buttonTheme.push({class:W,buttons:w})})}),this.render())}},{key:"removeButtonTheme",value:function(w,_){var N=this;if(!w&&!_)return this.options.buttonTheme=[],void this.render();w&&Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.length&&(w.split(" ").forEach(function(R){var W;(W=N.options)===null||W===void 0||(W=W.buttonTheme)===null||W===void 0||W.map(function(G,X){if(G&&_&&_.includes(G.class)||!_){var F,ce,fe=(F=G)===null||F===void 0?void 0:F.buttons.split(" ").filter(function(re){return re!==R});G&&fe!=null&&fe.length?G.buttons=fe.join(" "):((ce=N.options.buttonTheme)===null||ce===void 0||ce.splice(X,1),G=null)}return G})}),this.render())}},{key:"getButtonElement",value:function(w){var _,N=this.buttonElements[w];return N&&(_=N.length>1?N:N[0]),_}},{key:"inputPatternIsValid",value:function(w){var _,N=this.options.inputPattern;if((_=N instanceof RegExp?N:N[this.options.inputName||this.defaultName])&&w){var R=_.test(w);return this.options.debug&&console.log('inputPattern ("'.concat(_,'"): ').concat(R?"passed":"did not pass!")),R}return!0}},{key:"setEventListeners",value:function(){if(this.isFirstKeyboardInstance||!this.allKeyboardInstances){this.options.debug&&console.log("Caret handling started (".concat(this.keyboardDOMClass,")"));var w=this.options.physicalKeyboardHighlightPreventDefault,_=w!==void 0&&w;document.addEventListener("keyup",this.handleKeyUp,_),document.addEventListener("keydown",this.handleKeyDown,_),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("touchend",this.handleTouchEnd),document.addEventListener("selectionchange",this.handleSelectionChange),document.addEventListener("select",this.handleSelect)}}},{key:"handleKeyUp",value:function(w){this.caretEventHandler(w),this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyUp(w)}},{key:"handleKeyDown",value:function(w){this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyDown(w)}},{key:"handleMouseUp",value:function(w){this.caretEventHandler(w)}},{key:"handleTouchEnd",value:function(w){this.caretEventHandler(w)}},{key:"handleSelect",value:function(w){this.caretEventHandler(w)}},{key:"handleSelectionChange",value:function(w){navigator.userAgent.includes("Firefox")||this.caretEventHandler(w)}},{key:"caretEventHandler",value:function(w){var _,N=this;w.target.tagName&&(_=w.target.tagName.toLowerCase()),this.dispatch(function(R){var W=w.target===R.keyboardDOM||w.target&&R.keyboardDOM.contains(w.target);if(N.options.syncInstanceInputs&&Array.isArray(w.path)&&(W=w.path.some(function(F){var ce;return F==null||(ce=F.hasAttribute)===null||ce===void 0?void 0:ce.call(F,"data-skInstance")})),(_==="textarea"||_==="input"&&["text","search","url","tel","password"].includes(w.target.type))&&!R.options.disableCaretPositioning){var G=w.target.selectionStart,X=w.target.selectionEnd;R.options.rtl&&(G=R.utilities.getRtlOffset(G,R.getInput()),X=R.utilities.getRtlOffset(X,R.getInput())),R.setCaretPosition(G,X),N.activeInputElement=w.target,R.options.debug&&console.log("Caret at: ",R.getCaretPosition(),R.getCaretPositionEnd(),w&&w.target.tagName.toLowerCase(),"(".concat(R.keyboardDOMClass,")"),w==null?void 0:w.type)}else!R.options.disableCaretPositioning&&W||(w==null?void 0:w.type)==="selectionchange"||(R.setCaretPosition(null),N.activeInputElement=null,R.options.debug&&console.log('Caret position reset due to "'.concat(w==null?void 0:w.type,'" event'),w))})}},{key:"recurseButtons",value:function(w){var _=this;w&&Object.keys(this.buttonElements).forEach(function(N){return _.buttonElements[N].forEach(w)})}},{key:"destroy",value:function(){this.options.debug&&console.log("Destroying simple-keyboard instance: ".concat(this.currentInstanceName));var w=this.options.physicalKeyboardHighlightPreventDefault,_=w!==void 0&&w;document.removeEventListener("keyup",this.handleKeyUp,_),document.removeEventListener("keydown",this.handleKeyDown,_),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("select",this.handleSelect),document.removeEventListener("selectionchange",this.handleSelectionChange),document.onpointerup=null,document.ontouchend=null,document.ontouchcancel=null,document.onmouseup=null,this.recurseButtons(function(N){N&&(N.onpointerdown=null,N.onpointerup=null,N.onpointercancel=null,N.ontouchstart=null,N.ontouchend=null,N.ontouchcancel=null,N.onclick=null,N.onmousedown=null,N.onmouseup=null,N.remove(),N=null)}),this.keyboardDOM.onpointerdown=null,this.keyboardDOM.ontouchstart=null,this.keyboardDOM.onmousedown=null,this.resetRows(),this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=null),this.activeInputElement=null,this.keyboardDOM.removeAttribute("data-skInstance"),this.keyboardDOM.innerHTML="",window.SimpleKeyboardInstances[this.currentInstanceName]=null,delete window.SimpleKeyboardInstances[this.currentInstanceName],this.initialized=!1}},{key:"getButtonThemeClasses",value:function(w){var _=this.options.buttonTheme,N=[];return Array.isArray(_)&&_.forEach(function(R){if(R&&R.class&&typeof R.class=="string"&&R.buttons&&typeof R.buttons=="string"){var W=R.class.split(" ");R.buttons.split(" ").includes(w)&&(N=[].concat(L(N),L(W)))}else console.warn('Incorrect "buttonTheme". Please check the documentation.',R)}),N}},{key:"setDOMButtonAttributes",value:function(w,_){var N=this.options.buttonAttributes;Array.isArray(N)&&N.forEach(function(R){R.attribute&&typeof R.attribute=="string"&&R.value&&typeof R.value=="string"&&R.buttons&&typeof R.buttons=="string"?R.buttons.split(" ").includes(w)&&_(R.attribute,R.value):console.warn('Incorrect "buttonAttributes". Please check the documentation.',R)})}},{key:"onTouchDeviceDetected",value:function(){this.processAutoTouchEvents(),this.disableContextualWindow()}},{key:"disableContextualWindow",value:function(){window.oncontextmenu=function(w){if(w.target.classList.contains("hg-button"))return w.preventDefault(),w.stopPropagation(),!1}}},{key:"processAutoTouchEvents",value:function(){this.options.autoUseTouchEvents&&(this.options.useTouchEvents=!0,this.options.debug&&console.log("autoUseTouchEvents: Touch device detected, useTouchEvents enabled."))}},{key:"onInit",value:function(){this.options.debug&&console.log("".concat(this.keyboardDOMClass," Initialized")),this.setEventListeners(),typeof this.options.onInit=="function"&&this.options.onInit(this)}},{key:"beforeFirstRender",value:function(){this.utilities.isTouchDevice()&&this.onTouchDeviceDetected(),typeof this.options.beforeFirstRender=="function"&&this.options.beforeFirstRender(this),this.isFirstKeyboardInstance&&this.utilities.pointerEventsSupported()&&!this.options.useTouchEvents&&!this.options.useMouseEvents&&this.options.debug&&console.log("Using PointerEvents as it is supported by this browser"),this.options.useTouchEvents&&this.options.debug&&console.log("useTouchEvents has been enabled. Only touch events will be used.")}},{key:"beforeRender",value:function(){typeof this.options.beforeRender=="function"&&this.options.beforeRender(this)}},{key:"onRender",value:function(){typeof this.options.onRender=="function"&&this.options.onRender(this)}},{key:"onModulesLoaded",value:function(){typeof this.options.onModulesLoaded=="function"&&this.options.onModulesLoaded(this)}},{key:"loadModules",value:function(){var w=this;Array.isArray(this.options.modules)&&(this.options.modules.forEach(function(_){var N=new _(w);N.init&&N.init(w)}),this.keyboardPluginClasses="modules-loaded",this.render(),this.onModulesLoaded())}},{key:"getModuleProp",value:function(w,_){return!!this.modules[w]&&this.modules[w][_]}},{key:"getModulesList",value:function(){return Object.keys(this.modules)}},{key:"parseRowDOMContainers",value:function(w,_,N,R){var W=this,G=Array.from(w.children),X=0;return G.length&&N.forEach(function(F,ce){var fe=R[ce];if(!(fe&&fe>F))return!1;var re=F-X,oe=fe-X,ge=document.createElement("div");ge.className+="hg-button-container";var ae="".concat(W.options.layoutName,"-r").concat(_,"c").concat(ce);ge.setAttribute("data-skUID",ae);var be=G.splice(re,oe-re+1);X=oe-re,be.forEach(function(Ce){return ge.appendChild(Ce)}),G.splice(re,0,ge),w.innerHTML="",G.forEach(function(Ce){return w.appendChild(Ce)}),W.options.debug&&console.log("rowDOMContainer",be,re,oe,X+1)}),w}},{key:"render",value:function(){var w=this;this.resetRows(),this.initialized||this.beforeFirstRender(),this.beforeRender();var _="hg-layout-".concat(this.options.layoutName),N=this.options.layout||{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]},R=this.options.useTouchEvents||!1,W=R?"hg-touch-events":"",G=this.options.useMouseEvents||!1,X=this.options.disableRowButtonContainers;this.keyboardDOM.className=this.getKeyboardClassString(this.options.theme,_,this.keyboardPluginClasses,W),this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.keyboardRowsDOM=document.createElement("div"),this.keyboardRowsDOM.className="hg-rows",N[this.options.layoutName||this.defaultName].forEach(function(F,ce){var fe=F.split(" ");w.options.excludeFromLayout&&w.options.excludeFromLayout[w.options.layoutName||w.defaultName]&&(fe=fe.filter(function(ae){return w.options.excludeFromLayout&&!w.options.excludeFromLayout[w.options.layoutName||w.defaultName].includes(ae)}));var re=document.createElement("div");re.className+="hg-row";var oe=[],ge=[];fe.forEach(function(ae,be){var Ce,Fe=!X&&typeof ae=="string"&&ae.length>1&&ae.indexOf("[")===0,Ae=!X&&typeof ae=="string"&&ae.length>1&&ae.indexOf("]")===ae.length-1;Fe&&(oe.push(be),ae=ae.replace(/\[/g,"")),Ae&&(ge.push(be),ae=ae.replace(/\]/g,""));var Ve=w.utilities.getButtonClass(ae),ze=w.utilities.getButtonDisplayName(ae,w.options.display,w.options.mergeDisplay),wt=w.options.useButtonTag?"button":"div",Ke=document.createElement(wt);Ke.className+="hg-button ".concat(Ve),(Ce=Ke.classList).add.apply(Ce,L(w.getButtonThemeClasses(ae))),w.setDOMButtonAttributes(ae,function(Ee,Lt){Ke.setAttribute(Ee,Lt)}),w.activeButtonClass="hg-activeButton",!w.utilities.pointerEventsSupported()||R||G?R?(Ke.ontouchstart=function(Ee){w.handleButtonClicked(ae,Ee),w.handleButtonMouseDown(ae,Ee)},Ke.ontouchend=function(Ee){w.handleButtonMouseUp(ae,Ee)},Ke.ontouchcancel=function(Ee){w.handleButtonMouseUp(ae,Ee)}):(Ke.onclick=function(Ee){w.setMouseHold(!1),typeof w.options.onKeyReleased!="function"&&w.handleButtonClicked(ae,Ee)},Ke.onmousedown=function(Ee){typeof w.options.onKeyReleased!="function"||w.isMouseHold||w.handleButtonClicked(ae,Ee),w.handleButtonMouseDown(ae,Ee)},Ke.onmouseup=function(Ee){w.handleButtonMouseUp(ae,Ee)}):(Ke.onpointerdown=function(Ee){w.handleButtonClicked(ae,Ee),w.handleButtonMouseDown(ae,Ee)},Ke.onpointerup=function(Ee){w.handleButtonMouseUp(ae,Ee)},Ke.onpointercancel=function(Ee){w.handleButtonMouseUp(ae,Ee)}),Ke.setAttribute("data-skBtn",ae);var et="".concat(w.options.layoutName,"-r").concat(ce,"b").concat(be);Ke.setAttribute("data-skBtnUID",et);var We=document.createElement("span");We.innerHTML=ze,Ke.appendChild(We),w.buttonElements[ae]||(w.buttonElements[ae]=[]),w.buttonElements[ae].push(Ke),re.appendChild(Ke)}),re=w.parseRowDOMContainers(re,ce,oe,ge),w.keyboardRowsDOM.appendChild(re)}),this.keyboardDOM.appendChild(this.keyboardRowsDOM),this.onRender(),this.initialized||(this.initialized=!0,!this.utilities.pointerEventsSupported()||R||G?R?(document.ontouchend=function(F){return w.handleButtonMouseUp(void 0,F)},document.ontouchcancel=function(F){return w.handleButtonMouseUp(void 0,F)},this.keyboardDOM.ontouchstart=function(F){return w.handleKeyboardContainerMouseDown(F)}):R||(document.onmouseup=function(F){return w.handleButtonMouseUp(void 0,F)},this.keyboardDOM.onmousedown=function(F){return w.handleKeyboardContainerMouseDown(F)}):(document.onpointerup=function(F){return w.handleButtonMouseUp(void 0,F)},this.keyboardDOM.onpointerdown=function(F){return w.handleKeyboardContainerMouseDown(F)}),this.onInit())}}],U&&Z(V.prototype,U),J&&Z(V,J),Object.defineProperty(V,"prototype",{writable:!1}),V;var V,U,J}(),me=ne,de=ne}(),x}()},442:function(u){u.exports=n}},o={};function a(u){var f=o[u];if(f!==void 0)return f.exports;var g=o[u]={exports:{}};return r[u].call(g.exports,g,g.exports,a),g.exports}a.n=function(u){var f=u&&u.__esModule?function(){return u.default}:function(){return u};return a.d(f,{a:f}),f},a.d=function(u,f){for(var g in f)a.o(f,g)&&!a.o(u,g)&&Object.defineProperty(u,g,{enumerable:!0,get:f[g]})},a.o=function(u,f){return Object.prototype.hasOwnProperty.call(u,f)},a.r=function(u){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(u,"__esModule",{value:!0})};var s={};return function(){a.r(s),a.d(s,{KeyboardReact:function(){return c},default:function(){return p}}),a(981);var u=a(442),f=a(548),g=a.n(f);function h(d){return h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},h(d)}function x(d,m){var y=Object.keys(d);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(d);m&&(b=b.filter(function(C){return Object.getOwnPropertyDescriptor(d,C).enumerable})),y.push.apply(y,b)}return y}function l(d){for(var m=1;m<arguments.length;m++){var y=arguments[m]!=null?arguments[m]:{};m%2?x(Object(y),!0).forEach(function(b){v(d,b,y[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(y)):x(Object(y)).forEach(function(b){Object.defineProperty(d,b,Object.getOwnPropertyDescriptor(y,b))})}return d}function v(d,m,y){var b;return b=function(C,S){if(h(C)!="object"||!C)return C;var k=C[Symbol.toPrimitive];if(k!==void 0){var B=k.call(C,S||"default");if(h(B)!="object")return B;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(C)}(m,"string"),(m=h(b)=="symbol"?b:b+"")in d?Object.defineProperty(d,m,{value:y,enumerable:!0,configurable:!0,writable:!0}):d[m]=y,d}var i=function(d){return l(l({},d),{},{keyboardRef:null})},c=function(d){var m=d.baseClass||"react-simple-keyboard",y=u.useRef(null),b=u.useRef(null),C=u.useRef(null),S=u.useRef(d);return u.useEffect(function(){return function(){C.current&&C.current.destroy(),y.current=!1}},[]),u.useEffect(function(){var k=function(D){return l(l({},D),{},{theme:"simple-keyboard ".concat(D.theme||"hg-theme-default")})}(d);if(!y.current){y.current=!0,k.debug&&console.log("ReactSimpleKeyboard: Init");var B=b.current,O=".".concat(m);C.current=new(g())(B||O,k),k.keyboardRef&&k.keyboardRef(C.current)}var j=function(D,M){var $=i(M),P=i(D);return Object.keys($).filter(function(L){return $[L]!==P[L]})}(S.current,k);if(j.length){var I=C.current;S.current=k,I==null||I.setOptions(k),k.debug&&console.log("ReactSimpleKeyboard - setOptions called due to updated props:",j)}},[y,m,S,d]),u.createElement("div",{className:m,ref:b})},p=c}(),s}()})})(wl);var Yh=wl.exports;const Qh=Xo(Yh);function xl({onChange:e,keyboardRef:t,layout:n,theme:r}){const[o,a]=H.useState("default"),s=u=>{(u==="{shift}"||u==="{lock}")&&a(o==="default"?"shift":"default")};return E.jsx(Qh,{keyboardRef:u=>t.current=u,layoutName:o,layout:n,theme:r,onChange:e,onKeyPress:s,preventMouseDownDefault:!0})}function Zh(){return{subscribe:(r,o)=>{document.addEventListener(r,o)},unsubscribe:(r,o)=>{document.removeEventListener(r,o)},publish:(r,o)=>{const a=new CustomEvent(r,{detail:o});document.dispatchEvent(a)}}}function kl(){const{subscribe:e,unsubscribe:t,publish:n}=Zh();return{initialize:(u,f)=>{e("openKeyboard",u),e("closeKeyboard",f)},terminate:(u,f)=>{t("openKeyboard",u),t("closeKeyboard",f)},open:u=>{n("openKeyboard",{inputId:u.target.id,inputValue:u.target.value})},close:()=>{n("closeKeyboard")}}}function Cl(){const[e,t]=H.useState(!1),n=H.useRef(null),r=H.useRef(null),o=H.useRef(null),[a,s]=H.useState(),{session:u}=bt(),{initialize:f,terminate:g}=kl(),h=c=>{var p,d;r.current=document.getElementById(c.detail.inputId),(p=n.current)==null||p.setInput(c.detail.inputValue),(d=r.current)==null||d.addEventListener("input",m=>{var b;const y=m.target;(b=n.current)==null||b.setInput(y==null?void 0:y.value)}),t(!0)},x=()=>t(!1);H.useEffect(()=>{var p;const c=(p=o.current)==null?void 0:p.getBoundingClientRect();return c&&c.x&&!a&&s(c),f(h,x),()=>{g(h,x)}},[f,g,e]);const l=c=>{var p,d;if(r&&r.current){v(r.current,c);const m=(p=n.current)==null?void 0:p.getCaretPosition();m&&((d=r.current)==null||d.setSelectionRange(m,m))}},v=(c,p)=>{var y;const d=(y=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value"))==null?void 0:y.set;d==null||d.call(c,p);const m=new Event("input",{bubbles:!0});c.dispatchEvent(m)};if(!u||!+(u.input_data.enable_on_screen_keyboard??!1))return E.jsx(E.Fragment,{});const i=()=>{var d;const c=(d=r.current)==null?void 0:d.getBoundingClientRect();let p=!1;return a&&c&&(p=!(a.right<c.left||a.left>c.right||a.bottom<c.top||a.top>c.bottom)),p};return E.jsx("div",{ref:o,className:`mobile:hidden bottom-2 left-2 right-2 z-50 mx-auto w-[98vw] max-w-[1200px] ${!e&&"hidden"} ${i()?"b-2 block":"absolute"}`,children:E.jsx(xl,{keyboardRef:n,onChange:l})})}function $i({value:e,valueSetter:t}){const n=H.useRef(null),r=o=>{const a=o?(parseFloat(o)/100).toFixed(2):"";t(a)};return E.jsxs("div",{children:[E.jsx("input",{type:"number",readOnly:!0,className:"mb-4 h-full w-full rounded border-gray-200 p-4 text-center text-4xl text-gray-500 focus:ring-0 focus:ring-offset-0",value:e,placeholder:"0,00",onChange:o=>r(o.target.value)}),E.jsx(xl,{keyboardRef:n,layout:{default:["1 2 3","4 5 6","7 8 9","00 0 {bksp}"]},theme:"hg-theme-default hg-layout-numeric numeric-theme",onChange:r})]})}function Dn(e){const{open:t,close:n}=kl(),r=H.useRef(null),o=async s=>{(async()=>t(s))().then(()=>{var f;return(f=r.current)==null?void 0:f.scrollIntoView(!1)})},a=()=>{n()};return E.jsxs("div",{className:"relative",onFocus:o,onBlur:a,children:[E.jsx("input",{...e,ref:r,type:e.type==="date_time"?"datetime-local":e.type==="birth_date"?"date":e.type,placeholder:" ",className:"peer m-0 block max-h-[58px] w-full rounded border border-solid border-gray-300 bg-white bg-clip-padding px-3 py-4 text-base font-normal leading-tight text-gray-700 transition duration-200 ease-linear placeholder:text-transparent focus:border-2 focus:border-primary-600 focus:pb-[0.625rem] focus:pt-[1.625rem] focus:text-neutral-700 focus:outline-none peer-focus:text-primary-600 [&:not(:placeholder-shown)]:pb-[0.625rem] [&:not(:placeholder-shown)]:pt-[1.625rem]",onChange:s=>e.onChange&&e.onChange(s.target.name,s.target.value)}),E.jsx("label",{htmlFor:`${e.label}-id`,className:"pointer-events-none absolute left-0 top-0 w-max origin-[0_0] whitespace-nowrap border border-solid border-transparent px-3 py-4 text-gray-500 transition-[opacity,_transform] duration-200 ease-linear peer-focus:-translate-y-2 peer-focus:translate-x-[0.15rem] peer-focus:scale-[0.85] peer-focus:text-primary-600 peer-[:not(:placeholder-shown)]:-translate-y-2 peer-[:not(:placeholder-shown)]:translate-x-[0.15rem] peer-[:not(:placeholder-shown)]:scale-[0.85] motion-reduce:transition-none",children:e.label})]})}function ep(e){const t=H.useRef(null),[n,r]=H.useState(!1),[o,a]=H.useState(""),[s,u]=H.useState(e.defaultValue.split(";")),{name:f,onChange:g}=e;return H.useEffect(()=>{function h(x){t.current&&!t.current.contains(x.target)&&r(!1)}return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[]),H.useEffect(()=>{g&&g(f,s.join(";"))},[s]),E.jsxs("div",{ref:t,className:"relative w-full",children:[E.jsx("div",{onClick:()=>r(!n),className:`flex h-[54px] w-full cursor-pointer gap-2 truncate rounded border bg-white p-3 leading-[2.75rem] text-gray-700 ${n?"border-2 border-blue-600":"border-gray-300"}`,children:s.sort().reduce((h,x)=>h+=x+(x===s[s.length-1]?"":", "),"")}),E.jsx("div",{className:`pointer-events-none absolute left-0 top-0 origin-[0_0] border border-solid border-transparent px-3 py-4 transition-[opacity,_transform] duration-200 ease-linear motion-reduce:transition-none ${n?"-translate-y-2 translate-x-[0.15rem] scale-[0.85] text-blue-600":"text-gray-500"} ${s.length&&"-translate-y-2 translate-x-[0.15rem] scale-[0.85]"}`,children:e.label}),n&&E.jsxs("div",{className:"absolute z-20 mt-2 flex w-full flex-col gap-3 rounded bg-white p-3 shadow-md",children:[E.jsx("input",{placeholder:"Search",className:"rounded border border-solid border-gray-300 bg-transparent p-3 outline-none",type:"text",onChange:h=>a(h.target.value)}),E.jsx("hr",{}),!e.options.filter(h=>h.label.toLowerCase().includes(o.toLowerCase())).length&&E.jsx("p",{className:"text-center text-sm font-normal text-neutral-400",children:"No results found"}),e.options.map(h=>{if(!(o&&!h.label.toLowerCase().includes(o.toLowerCase())))return E.jsxs("div",{className:"flex items-center",children:[E.jsx("input",{id:h.value,type:"checkbox",value:h.value,checked:s.includes(h.value),readOnly:!0,className:"h-4 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-blue-500",onClick:x=>{x.target.checked?u([...s,x.target.value]):u(s.filter(l=>l!==x.target.value))}}),E.jsx("label",{htmlFor:h.value,className:"text-md ml-2 flex-grow font-normal text-gray-700",children:h.label})]},h.value)})]})]})}function tp(e){return E.jsxs("div",{className:"relative",children:[E.jsx("select",{...e,id:e.id,className:"peer m-0 block max-h-[58px] w-full rounded border border-solid border-gray-300 bg-white bg-clip-padding px-2 py-4 text-base font-normal leading-tight text-gray-700 transition duration-200 ease-linear placeholder:text-transparent focus:border-2 focus:border-primary-600 focus:pb-[0.625rem] focus:pt-[1.625rem] focus:text-neutral-700 focus:outline-none peer-focus:text-primary-600 [&:not(:placeholder-shown)]:pb-[0.625rem] [&:not(:placeholder-shown)]:pt-[1.625rem]",onChange:t=>e.onChange&&e.onChange(t.target.name,t.target.value),children:e.options.map(t=>E.jsx("option",{value:t.value,children:t.label},t.value))}),E.jsx("label",{htmlFor:`${e.label}-id`,className:"pointer-events-none absolute left-0 top-0 w-max origin-[0_0] whitespace-nowrap border border-solid border-transparent px-3 py-4 text-gray-500 transition-[opacity,_transform] duration-200 ease-linear peer-focus:-translate-y-2 peer-focus:translate-x-[0.15rem] peer-focus:scale-[0.85] peer-focus:text-primary-600 peer-[:not(:placeholder-shown)]:-translate-y-2 peer-[:not(:placeholder-shown)]:translate-x-[0.15rem] peer-[:not(:placeholder-shown)]:scale-[0.85] motion-reduce:transition-none",children:e.label})]})}function _t({children:e}){return E.jsx("div",{className:"h-full w-full rounded-lg border border-gray-200 bg-white p-4 shadow sm:p-6 md:p-8",children:e})}function El({children:e}){return E.jsxs(_t,{children:[E.jsx("div",{className:"flex items-center justify-center",children:E.jsxs("svg",{className:"stroke h-36 w-36 animate-[scale_.3s_ease-in-out_.9s_both] fill-none stroke-green-600 stroke-2 shadow-[inset_0px_0px_0px_#7ac142]",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 52 52",children:[E.jsx("circle",{className:"animate-[stroke_.6s_linear_forwards] fill-none stroke-green-600 stroke-2",style:{strokeDasharray:166,strokeDashoffset:166},cx:"26",cy:"26",r:"25",fill:"none"}),E.jsx("path",{className:"origin-[50%_50%] animate-[stroke_.3s_linear_.8s_forwards]",style:{strokeDasharray:48,strokeDashoffset:48},fill:"none",d:"M14.1 27.2l7.1 7.2 16.7-16.8"})]})}),e]})}const np="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4.7002%204.70016L11.2999%2011.2998'%20stroke='%23000'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M11.2998%204.70016L4.70014%2011.2998'%20stroke='%23000'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e";function Mn({title:e,isOpen:t,onClose:n,children:r}){const[o,a]=H.useState(t),s=H.useRef(null);H.useEffect(()=>{a(t)},[t]),H.useEffect(()=>{const g=s.current;g&&(o?g.show():g.close())},[o]);const u=()=>{n&&n(),a(!1)},f=g=>{g.key==="Escape"&&u()};return E.jsx("div",{className:`fixed inset-0 z-40 min-h-screen items-center bg-gray-500 bg-opacity-25 ${o?"flex":"hidden"}`,children:E.jsxs("dialog",{ref:s,onKeyDown:f,className:"scrollbar-hide absolute overflow-auto rounded-lg drop-shadow-md",children:[E.jsxs("div",{className:"flex w-full justify-between bg-gray-50 p-4",children:[E.jsx("p",{className:"truncate text-lg",children:e}),E.jsx("img",{src:np,alt:"closeButton",className:"h-[25px] w-[25px] cursor-pointer opacity-50 hover:opacity-90",onClick:u})]}),E.jsx("div",{className:"p-6",children:r})]})})}function rp(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&(t[0]=`react-i18next:: ${t[0]}`),console.warn(...t)}}const Sl={};function Vi(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&Sl[t[0]]||(typeof t[0]=="string"&&(Sl[t[0]]=new Date),rp(...t))}const Pl=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function Bl(e,t,n){e.loadNamespaces(t,Pl(e,n))}function Ol(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,Pl(e,r))}function op(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],o=t.options?t.options.fallbackLng:!1,a=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(u,f)=>{const g=t.services.backendConnector.state[`${u}|${f}`];return g===-1||g===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!s(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||s(r,e)&&(!o||s(a,e)))}function ip(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Vi("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(o,a)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!a(o.isLanguageChangingTo,e))return!1}}):op(e,t,n)}const ap=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,sp={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},lp=e=>sp[e];let Hi={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(ap,lp)};function cp(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Hi={...Hi,...e}}function up(){return Hi}let _l;function dp(e){_l=e}function fp(){return _l}const hp={type:"3rdParty",init(e){cp(e.options.react),dp(e)}},pp=H.createContext();class mp{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const gp=(e,t)=>{const n=H.useRef();return H.useEffect(()=>{n.current=e},[e,t]),n.current};function Rl(e,t,n,r){return e.getFixedT(t,n,r)}function yp(e,t,n,r){return H.useCallback(Rl(e,t,n,r),[e,t,n,r])}function Qe(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:o}=H.useContext(pp)||{},a=n||r||fp();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new mp),!a){Vi("You will need to pass in an i18next instance by using initReactI18next");const b=(S,k)=>typeof k=="string"?k:k&&typeof k=="object"&&typeof k.defaultValue=="string"?k.defaultValue:Array.isArray(S)?S[S.length-1]:S,C=[b,{},!1];return C.t=b,C.i18n={},C.ready=!1,C}a.options.react&&a.options.react.wait!==void 0&&Vi("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...up(),...a.options.react,...t},{useSuspense:u,keyPrefix:f}=s;let g=o||a.options&&a.options.defaultNS;g=typeof g=="string"?[g]:g||["translation"],a.reportNamespaces.addUsedNamespaces&&a.reportNamespaces.addUsedNamespaces(g);const h=(a.isInitialized||a.initializedStoreOnce)&&g.every(b=>ip(b,a,s)),x=yp(a,t.lng||null,s.nsMode==="fallback"?g:g[0],f),l=()=>x,v=()=>Rl(a,t.lng||null,s.nsMode==="fallback"?g:g[0],f),[i,c]=H.useState(l);let p=g.join();t.lng&&(p=`${t.lng}${p}`);const d=gp(p),m=H.useRef(!0);H.useEffect(()=>{const{bindI18n:b,bindI18nStore:C}=s;m.current=!0,!h&&!u&&(t.lng?Ol(a,t.lng,g,()=>{m.current&&c(v)}):Bl(a,g,()=>{m.current&&c(v)})),h&&d&&d!==p&&m.current&&c(v);function S(){m.current&&c(v)}return b&&a&&a.on(b,S),C&&a&&a.store.on(C,S),()=>{m.current=!1,b&&a&&b.split(" ").forEach(k=>a.off(k,S)),C&&a&&C.split(" ").forEach(k=>a.store.off(k,S))}},[a,p]),H.useEffect(()=>{m.current&&h&&c(l)},[a,f,h]);const y=[i,a,h];if(y.t=i,y.i18n=a,y.ready=h,h||!h&&!u)return y;throw new Promise(b=>{t.lng?Ol(a,t.lng,g,()=>b()):Bl(a,g,()=>b())})}function zi({callback:e}){const t=kn(),{t:n}=Qe(),[r,o]=H.useState(""),[a,s]=H.useState(!1),[u,f]=H.useState(!1),{session:g,mutate:h}=bt(),x=g==null?void 0:g.input_data.scanner_type,[l,v]=H.useState(""),i=async d=>{if(t.onContactLink){const{data:{data:m}}=await Ai.get(d);m&&t.onContactLink(m)}},c=H.useCallback(()=>{g&&(s(!0),vo.setContact(g.uuid,{contact_identifier_value:r}).then(d=>{i(d.data.data.contact.uuid).then(),h().then(()=>{De.success(n("contactSavedToSession")),e&&e()})}).catch(()=>f(!0)).finally(()=>s(!1)))},[e,r,h,g,n]),p=()=>{s(!0),Ai.linkIdentifier(r,l).then(c).finally(()=>s(!1))};return H.useEffect(()=>{x===Mt.CAMERA&&r&&!a&&c()},[r,a,x,g,c]),E.jsxs(E.Fragment,{children:[E.jsx(wo,{dataSetter:o,type:x,label:n("contactIdentifier")}),x===Mt.HAND_SCANNER&&E.jsx("div",{className:"pt-3",children:E.jsx(Ye,{type:"submit",label:n("submit"),onClick:c,disabled:a})}),E.jsx(Mn,{isOpen:u,title:n("linkContact"),onClose:()=>f(!1),children:E.jsxs("div",{className:"flex min-w-[600px] flex-col gap-3",children:[E.jsx("p",{children:n("fillInXBelow",{x:n("emailAddress").toLowerCase()})}),E.jsx(Dn,{autoFocus:!0,id:"email-input",name:"email",label:n("emailAddress"),type:"email",onChange:(d,m)=>v(m)}),E.jsx("div",{children:E.jsx(Ye,{type:"submit",label:n("linkContact"),onClick:p,disabled:a})})]})})]})}function wo({dataSetter:e,type:t=Mt.CAMERA,label:n=""}){const{t:r}=Qe(),o=a=>{e(a.data)};return t===Mt.HAND_SCANNER?E.jsxs("div",{className:"flex flex-col gap-3",children:[E.jsx("p",{children:r("fillInXBelow",{x:n.toLowerCase()})}),E.jsx(Dn,{id:`${n}-input`,name:n,label:n,type:"text",onChange:(a,s)=>e(s),autoFocus:!0})]}):E.jsx(vp,{label:n,onDecode:o})}class Le{constructor(t,n,r,o,a){this._legacyCanvasSize=Le.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=t,this.$canvas=document.createElement("canvas"),r&&typeof r=="object"?this._onDecode=n:(console.warn(r||o||a?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=n),n=typeof r=="object"?r:{},this._onDecodeError=n.onDecodeError||(typeof r=="function"?r:this._onDecodeError),this._calculateScanRegion=n.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=n.preferredCamera||a||this._preferredCamera,this._legacyCanvasSize=typeof r=="number"?r:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=n.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),t.disablePictureInPicture=!0,t.playsInline=!0,t.muted=!0;let s=!1;if(t.hidden&&(t.hidden=!1,s=!0),document.body.contains(t)||(document.body.appendChild(t),s=!0),r=t.parentElement,n.highlightScanRegion||n.highlightCodeOutline){if(o=!!n.overlay,this.$overlay=n.overlay||document.createElement("div"),a=this.$overlay.style,a.position="absolute",a.display="none",a.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&n.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}r.insertBefore(this.$overlay,this.$video.nextSibling)}n.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(t),requestAnimationFrame(()=>{let u=window.getComputedStyle(t);u.display==="none"&&(t.style.setProperty("display","block","important"),s=!0),u.visibility!=="visible"&&(t.style.setProperty("visibility","visible","important"),s=!0),s&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),t.style.opacity="0",t.style.width="0",t.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),t.addEventListener("play",this._onPlay),t.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=Le.createQrEngine()}static set WORKER_PATH(t){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await Le.listCameras(!1)).length}catch{return!1}}static async listCameras(t=!1){if(!navigator.mediaDevices)return[];let n=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),r;try{t&&(await n()).every(o=>!o.label)&&(r=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await n()).map((o,a)=>({id:o.deviceId,label:o.label||(a===0?"Default Camera":`Camera ${a+1}`)}))}finally{r&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),Le._stopVideoStream(r))}}async hasFlash(){let t;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;t=this.$video.srcObject}else t=(await this._getCameraStream()).stream;return"torch"in t.getVideoTracks()[0].getSettings()}catch{return!1}finally{t&&t!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),Le._stopVideoStream(t))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(t){throw this._flashOn=!1,t}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),Le._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:t,facingMode:n}=await this._getCameraStream();!this._active||this._paused?Le._stopVideoStream(t):(this._setVideoMirror(n),this.$video.srcObject=t,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(t){if(!this._paused)throw this._active=!1,t}}stop(){this.pause(),this._active=!1}async pause(t=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let n=()=>{this.$video.srcObject instanceof MediaStream&&(Le._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return t?(n(),!0):(await new Promise(r=>setTimeout(r,300)),this._paused?(n(),!0):!1)}async setCamera(t){t!==this._preferredCamera&&(this._preferredCamera=t,await this._restartVideoStream())}static async scanImage(t,n,r,o,a=!1,s=!1){let u,f=!1;n&&("scanRegion"in n||"qrEngine"in n||"canvas"in n||"disallowCanvasResizing"in n||"alsoTryWithoutScanRegion"in n||"returnDetailedScanResult"in n)?(u=n.scanRegion,r=n.qrEngine,o=n.canvas,a=n.disallowCanvasResizing||!1,s=n.alsoTryWithoutScanRegion||!1,f=!0):console.warn(n||r||o||a||s?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),n=!!r;try{let g,h;[r,g]=await Promise.all([r||Le.createQrEngine(),Le._loadImage(t)]),[o,h]=Le._drawToCanvas(g,u,o,a);let x;if(r instanceof Worker){let l=r;n||Le._postWorkerMessageSync(l,"inversionMode","both"),x=await new Promise((v,i)=>{let c,p,d,m=-1;p=b=>{b.data.id===m&&(l.removeEventListener("message",p),l.removeEventListener("error",d),clearTimeout(c),b.data.data!==null?v({data:b.data.data,cornerPoints:Le._convertPoints(b.data.cornerPoints,u)}):i(Le.NO_QR_CODE_FOUND))},d=b=>{l.removeEventListener("message",p),l.removeEventListener("error",d),clearTimeout(c),i("Scanner error: "+(b?b.message||b:"Unknown Error"))},l.addEventListener("message",p),l.addEventListener("error",d),c=setTimeout(()=>d("timeout"),1e4);let y=h.getImageData(0,0,o.width,o.height);m=Le._postWorkerMessageSync(l,"decode",y,[y.data.buffer])})}else x=await Promise.race([new Promise((l,v)=>window.setTimeout(()=>v("Scanner error: timeout"),1e4)),(async()=>{try{var[l]=await r.detect(o);if(!l)throw Le.NO_QR_CODE_FOUND;return{data:l.rawValue,cornerPoints:Le._convertPoints(l.cornerPoints,u)}}catch(v){if(l=v.message||v,/not implemented|service unavailable/.test(l))return Le._disableBarcodeDetector=!0,Le.scanImage(t,{scanRegion:u,canvas:o,disallowCanvasResizing:a,alsoTryWithoutScanRegion:s});throw`Scanner error: ${l}`}})()]);return f?x:x.data}catch(g){if(!u||!s)throw g;let h=await Le.scanImage(t,{qrEngine:r,canvas:o,disallowCanvasResizing:a});return f?h:h.data}finally{n||Le._postWorkerMessage(r,"close")}}setGrayscaleWeights(t,n,r,o=!0){Le._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(t){Le._postWorkerMessage(this._qrEnginePromise,"inversionMode",t)}static async createQrEngine(t){if(t&&console.warn("Specifying a worker path is not required and not supported anymore."),t=()=>Promise.resolve().then(()=>Ev).then(r=>r.createWorker()),!(!Le._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return t();let n=navigator.userAgentData;return n&&n.brands.some(({brand:r})=>/Chromium/i.test(r))&&/mac ?OS/i.test(n.platform)&&await n.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:r,platformVersion:o})=>/arm/i.test(r||"arm")&&13<=parseInt(o||"13")).catch(()=>!0)?t():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(t){let n=Math.round(.6666666666666666*Math.min(t.videoWidth,t.videoHeight));return{x:Math.round((t.videoWidth-n)/2),y:Math.round((t.videoHeight-n)/2),width:n,height:n,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var t=this.$video,n=t.videoWidth,r=t.videoHeight,o=t.offsetWidth,a=t.offsetHeight,s=t.offsetLeft,u=t.offsetTop,f=window.getComputedStyle(t),g=f.objectFit,h=n/r,x=o/a;switch(g){case"none":var l=n,v=r;break;case"fill":l=o,v=a;break;default:(g==="cover"?h>x:h<x)?(v=a,l=v*h):(l=o,v=l/h),g==="scale-down"&&(l=Math.min(l,n),v=Math.min(v,r))}var[i,c]=f.objectPosition.split(" ").map((d,m)=>{const y=parseFloat(d);return d.endsWith("%")?(m?a-v:o-l)*y/100:y});f=this._scanRegion.width||n,x=this._scanRegion.height||r,g=this._scanRegion.x||0;var p=this._scanRegion.y||0;h=this.$overlay.style,h.width=`${f/n*l}px`,h.height=`${x/r*v}px`,h.top=`${u+c+p/r*v}px`,r=/scaleX\(-1\)/.test(t.style.transform),h.left=`${s+(r?o-i-l:i)+(r?n-g-f:g)/n*l}px`,h.transform=t.style.transform}})}static _convertPoints(t,n){if(!n)return t;let r=n.x||0,o=n.y||0,a=n.width&&n.downScaledWidth?n.width/n.downScaledWidth:1;n=n.height&&n.downScaledHeight?n.height/n.downScaledHeight:1;for(let s of t)s.x=s.x*a+r,s.y=s.y*n+o;return t}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var t=Date.now()-this._lastScanTimestamp,n=1e3/this._maxScansPerSecond;t<n&&await new Promise(o=>setTimeout(o,n-t)),this._lastScanTimestamp=Date.now();try{var r=await Le.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!Le._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=Le.createQrEngine()),r?(this._onDecode?this._onDecode(r):this._legacyOnDecode&&this._legacyOnDecode(r.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",r.cornerPoints.map(({x:o,y:a})=>`${o},${a}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(t){t!==Le.NO_QR_CODE_FOUND&&console.log(t)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let t=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",n=[{width:{min:1024}},{width:{min:768}},{}],r=n.map(o=>Object.assign({},o,{[t]:{exact:this._preferredCamera}}));for(let o of[...r,...n])try{let a=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),s=this._getFacingMode(a)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:a,facingMode:s}}catch{}throw"Camera not found."}async _restartVideoStream(){let t=this._paused;await this.pause(!0)&&!t&&this._active&&await this.start()}static _stopVideoStream(t){for(let n of t.getTracks())n.stop(),t.removeTrack(n)}_setVideoMirror(t){this.$video.style.transform="scaleX("+(t==="user"?-1:1)+")"}_getFacingMode(t){return(t=t.getVideoTracks()[0])?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(t,n,r,o=!1){r=r||document.createElement("canvas");let a=n&&n.x?n.x:0,s=n&&n.y?n.y:0,u=n&&n.width?n.width:t.videoWidth||t.width,f=n&&n.height?n.height:t.videoHeight||t.height;return o||(o=n&&n.downScaledWidth?n.downScaledWidth:u,n=n&&n.downScaledHeight?n.downScaledHeight:f,r.width!==o&&(r.width=o),r.height!==n&&(r.height=n)),n=r.getContext("2d",{alpha:!1}),n.imageSmoothingEnabled=!1,n.drawImage(t,a,s,u,f,0,0,r.width,r.height),[r,n]}static async _loadImage(t){if(t instanceof Image)return await Le._awaitImageLoad(t),t;if(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGImageElement||"OffscreenCanvas"in window&&t instanceof OffscreenCanvas||"ImageBitmap"in window&&t instanceof ImageBitmap)return t;if(t instanceof File||t instanceof Blob||t instanceof URL||typeof t=="string"){let n=new Image;n.src=t instanceof File||t instanceof Blob?URL.createObjectURL(t):t.toString();try{return await Le._awaitImageLoad(n),n}finally{(t instanceof File||t instanceof Blob)&&URL.revokeObjectURL(n.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(t){t.complete&&t.naturalWidth!==0||await new Promise((n,r)=>{let o=a=>{t.removeEventListener("load",o),t.removeEventListener("error",o),a instanceof ErrorEvent?r("Image load error"):n()};t.addEventListener("load",o),t.addEventListener("error",o)})}static async _postWorkerMessage(t,n,r,o){return Le._postWorkerMessageSync(await t,n,r,o)}static _postWorkerMessageSync(t,n,r,o){if(!(t instanceof Worker))return-1;let a=Le._workerMessageId++;return t.postMessage({id:a,type:n,data:r},o),a}}Le.DEFAULT_CANVAS_SIZE=400,Le.NO_QR_CODE_FOUND="No QR code found",Le._disableBarcodeDetector=!1,Le._workerMessageId=0;function vp({label:e="",onDecode:t}){const n=H.useRef(),r=H.useRef(null),[o,a]=H.useState([]);return H.useEffect(()=>(r.current&&!n.current&&(n.current=new Le(r.current,t??(s=>console.log("decoded qr code:",s)),{returnDetailedScanResult:!0,highlightScanRegion:!0,highlightCodeOutline:!0}),Le.listCameras(!0).then(s=>a(s)),n.current.start()),()=>{var s;r.current||(s=n.current)==null||s.stop()}),[t]),E.jsxs("div",{className:"flex flex-col gap-1",children:[E.jsxs("div",{className:"flex flex-col items-center justify-between text-gray-700 sm:flex-row",children:[E.jsx("p",{children:`Scan ${e==null?void 0:e.toLowerCase()}`}),E.jsx("select",{id:"select",className:"appearance-none rounded border bg-transparent px-2.5 py-2 text-sm",onChange:s=>{var u;return(u=n.current)==null?void 0:u.setCamera(s.target.value)},children:o.map(s=>E.jsx("option",{value:s.id,children:s.label},s.id))})]}),E.jsx("video",{className:"h-full w-full rounded border object-cover",ref:r})]})}function Tl(){return E.jsxs("div",{children:[E.jsx("div",{className:"flex animate-pulse justify-end space-y-4",children:E.jsx("div",{className:"h-8 w-32 rounded bg-gray-100"})},"skeleton-item-"),E.jsx("div",{className:"my-6 h-px w-full bg-gray-100"}),E.jsx("div",{className:"space-y-4",children:E.jsx("div",{className:"animate-pulse space-y-4",children:E.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-2",children:[E.jsx("div",{className:"h-12 w-full rounded bg-gray-100"}),E.jsx("div",{className:"h-12 w-full rounded bg-gray-100"}),E.jsx("div",{className:"h-12 w-full rounded bg-gray-100"}),E.jsx("div",{className:"h-12 w-full rounded bg-gray-100"}),E.jsx("div",{className:"h-12 w-full rounded bg-gray-100"}),E.jsx("div",{className:"h-12 w-full rounded bg-gray-100"}),E.jsx("div",{className:"h-12 w-full rounded bg-gray-100"}),E.jsx("div",{className:"h-12 w-full rounded bg-gray-100"}),E.jsx("div",{className:"h-12 w-full rounded bg-gray-100"}),E.jsx("div",{className:"h-12 w-full rounded bg-gray-100"}),E.jsx("div",{className:"h-12 w-full rounded bg-gray-100"}),E.jsx("div",{className:"h-12 w-full rounded bg-gray-100"})]})},"skeleton-item-")})]})}var bp=Object.defineProperty,wp=(e,t)=>{for(var n in t)bp(e,n,{get:t[n],enumerable:!0})},Ft={};wp(Ft,{assign:()=>Cp,colors:()=>mn,createStringInterpolator:()=>Zi,skipAnimation:()=>Ml,to:()=>Dl,willAdvance:()=>ea});var qi=gr(),Te=e=>mr(e,qi),Ki=gr();Te.write=e=>mr(e,Ki);var xo=gr();Te.onStart=e=>mr(e,xo);var Wi=gr();Te.onFrame=e=>mr(e,Wi);var Gi=gr();Te.onFinish=e=>mr(e,Gi);var Fn=[];Te.setTimeout=(e,t)=>{const n=Te.now()+t,r=()=>{const a=Fn.findIndex(s=>s.cancel==r);~a&&Fn.splice(a,1),pn-=~a?1:0},o={time:n,handler:e,cancel:r};return Fn.splice(Nl(n),0,o),pn+=1,jl(),o};var Nl=e=>~(~Fn.findIndex(t=>t.time>e)||~Fn.length);Te.cancel=e=>{xo.delete(e),Wi.delete(e),Gi.delete(e),qi.delete(e),Ki.delete(e)},Te.sync=e=>{Ji=!0,Te.batchedUpdates(e),Ji=!1},Te.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function r(...o){t=o,Te.onStart(n)}return r.handler=e,r.cancel=()=>{xo.delete(n),t=null},r};var Xi=typeof window<"u"?window.requestAnimationFrame:()=>{};Te.use=e=>Xi=e,Te.now=typeof performance<"u"?()=>performance.now():Date.now,Te.batchedUpdates=e=>e(),Te.catch=console.error,Te.frameLoop="always",Te.advance=()=>{Te.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):Ll()};var hn=-1,pn=0,Ji=!1;function mr(e,t){Ji?(t.delete(e),e(0)):(t.add(e),jl())}function jl(){hn<0&&(hn=0,Te.frameLoop!=="demand"&&Xi(Al))}function xp(){hn=-1}function Al(){~hn&&(Xi(Al),Te.batchedUpdates(Ll))}function Ll(){const e=hn;hn=Te.now();const t=Nl(hn);if(t&&(Il(Fn.splice(0,t),n=>n.handler()),pn-=t),!pn){xp();return}xo.flush(),qi.flush(e?Math.min(64,hn-e):16.667),Wi.flush(),Ki.flush(),Gi.flush()}function gr(){let e=new Set,t=e;return{add(n){pn+=t==e&&!e.has(n)?1:0,e.add(n)},delete(n){return pn-=t==e&&e.has(n)?1:0,e.delete(n)},flush(n){t.size&&(e=new Set,pn-=t.size,Il(t,r=>r(n)&&e.add(r)),pn+=e.size,t=e)}}}function Il(e,t){e.forEach(n=>{try{t(n)}catch(r){Te.catch(r)}})}function Yi(){}var kp=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),pe={arr:Array.isArray,obj:e=>!!e&&e.constructor.name==="Object",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",und:e=>e===void 0};function tn(e,t){if(pe.arr(e)){if(!pe.arr(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}var Me=(e,t)=>e.forEach(t);function Jt(e,t,n){if(pe.arr(e)){for(let r=0;r<e.length;r++)t.call(n,e[r],`${r}`);return}for(const r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r)}var Pt=e=>pe.und(e)?[]:pe.arr(e)?e:[e];function yr(e,t){if(e.size){const n=Array.from(e);e.clear(),Me(n,t)}}var vr=(e,...t)=>yr(e,n=>n(...t)),Qi=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),Zi,Dl,mn=null,Ml=!1,ea=Yi,Cp=e=>{e.to&&(Dl=e.to),e.now&&(Te.now=e.now),e.colors!==void 0&&(mn=e.colors),e.skipAnimation!=null&&(Ml=e.skipAnimation),e.createStringInterpolator&&(Zi=e.createStringInterpolator),e.requestAnimationFrame&&Te.use(e.requestAnimationFrame),e.batchedUpdates&&(Te.batchedUpdates=e.batchedUpdates),e.willAdvance&&(ea=e.willAdvance),e.frameLoop&&(Te.frameLoop=e.frameLoop)},br=new Set,Rt=[],ta=[],ko=0,Co={get idle(){return!br.size&&!Rt.length},start(e){ko>e.priority?(br.add(e),Te.onStart(Ep)):(Fl(e),Te(na))},advance:na,sort(e){if(ko)Te.onFrame(()=>Co.sort(e));else{const t=Rt.indexOf(e);~t&&(Rt.splice(t,1),Ul(e))}},clear(){Rt=[],br.clear()}};function Ep(){br.forEach(Fl),br.clear(),Te(na)}function Fl(e){Rt.includes(e)||Ul(e)}function Ul(e){Rt.splice(Sp(Rt,t=>t.priority>e.priority),0,e)}function na(e){const t=ta;for(let n=0;n<Rt.length;n++){const r=Rt[n];ko=r.priority,r.idle||(ea(r),r.advance(e),r.idle||t.push(r))}return ko=0,ta=Rt,ta.length=0,Rt=t,Rt.length>0}function Sp(e,t){const n=e.findIndex(t);return n<0?e.length:n}var Pp=(e,t,n)=>Math.min(Math.max(n,e),t),Bp={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},Ut="[-+]?\\d*\\.?\\d+",Eo=Ut+"%";function So(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var Op=new RegExp("rgb"+So(Ut,Ut,Ut)),_p=new RegExp("rgba"+So(Ut,Ut,Ut,Ut)),Rp=new RegExp("hsl"+So(Ut,Eo,Eo)),Tp=new RegExp("hsla"+So(Ut,Eo,Eo,Ut)),Np=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,jp=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,Ap=/^#([0-9a-fA-F]{6})$/,Lp=/^#([0-9a-fA-F]{8})$/;function Ip(e){let t;return typeof e=="number"?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=Ap.exec(e))?parseInt(t[1]+"ff",16)>>>0:mn&&mn[e]!==void 0?mn[e]:(t=Op.exec(e))?(Un(t[1])<<24|Un(t[2])<<16|Un(t[3])<<8|255)>>>0:(t=_p.exec(e))?(Un(t[1])<<24|Un(t[2])<<16|Un(t[3])<<8|Hl(t[4]))>>>0:(t=Np.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=Lp.exec(e))?parseInt(t[1],16)>>>0:(t=jp.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=Rp.exec(e))?($l(Vl(t[1]),Po(t[2]),Po(t[3]))|255)>>>0:(t=Tp.exec(e))?($l(Vl(t[1]),Po(t[2]),Po(t[3]))|Hl(t[4]))>>>0:null}function ra(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function $l(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,a=ra(o,r,e+1/3),s=ra(o,r,e),u=ra(o,r,e-1/3);return Math.round(a*255)<<24|Math.round(s*255)<<16|Math.round(u*255)<<8}function Un(e){const t=parseInt(e,10);return t<0?0:t>255?255:t}function Vl(e){return(parseFloat(e)%360+360)%360/360}function Hl(e){const t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function Po(e){const t=parseFloat(e);return t<0?0:t>100?1:t/100}function zl(e){let t=Ip(e);if(t===null)return e;t=t||0;const n=(t&4278190080)>>>24,r=(t&16711680)>>>16,o=(t&65280)>>>8,a=(t&255)/255;return`rgba(${n}, ${r}, ${o}, ${a})`}var wr=(e,t,n)=>{if(pe.fun(e))return e;if(pe.arr(e))return wr({range:e,output:t,extrapolate:n});if(pe.str(e.output[0]))return Zi(e);const r=e,o=r.output,a=r.range||[0,1],s=r.extrapolateLeft||r.extrapolate||"extend",u=r.extrapolateRight||r.extrapolate||"extend",f=r.easing||(g=>g);return g=>{const h=Mp(g,a);return Dp(g,a[h],a[h+1],o[h],o[h+1],f,s,u,r.map)}};function Dp(e,t,n,r,o,a,s,u,f){let g=f?f(e):e;if(g<t){if(s==="identity")return g;s==="clamp"&&(g=t)}if(g>n){if(u==="identity")return g;u==="clamp"&&(g=n)}return r===o?r:t===n?e<=t?r:o:(t===-1/0?g=-g:n===1/0?g=g-t:g=(g-t)/(n-t),g=a(g),r===-1/0?g=-g:o===1/0?g=g+r:g=g*(o-r)+r,g)}function Mp(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}var Fp=(e,t="end")=>n=>{n=t==="end"?Math.min(n,.999):Math.max(n,.001);const r=n*e,o=t==="end"?Math.floor(r):Math.ceil(r);return Pp(0,1,o/e)},Bo=1.70158,Oo=Bo*1.525,ql=Bo+1,Kl=2*Math.PI/3,Wl=2*Math.PI/4.5,_o=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Up={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:Math.pow(2,10*e-10),easeOutExpo:e=>e===1?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>ql*e*e*e-Bo*e*e,easeOutBack:e=>1+ql*Math.pow(e-1,3)+Bo*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*((Oo+1)*2*e-Oo)/2:(Math.pow(2*e-2,2)*((Oo+1)*(e*2-2)+Oo)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*Kl),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*Kl)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*Wl))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*Wl)/2+1,easeInBounce:e=>1-_o(1-e),easeOutBounce:_o,easeInOutBounce:e=>e<.5?(1-_o(1-2*e))/2:(1+_o(2*e-1))/2,steps:Fp},xr=Symbol.for("FluidValue.get"),$n=Symbol.for("FluidValue.observers"),Tt=e=>!!(e&&e[xr]),Et=e=>e&&e[xr]?e[xr]():e,Gl=e=>e[$n]||null;function $p(e,t){e.eventObserved?e.eventObserved(t):e(t)}function kr(e,t){const n=e[$n];n&&n.forEach(r=>{$p(r,t)})}var Xl=class{constructor(e){if(!e&&!(e=this.get))throw Error("Unknown getter");Vp(this,e)}},Vp=(e,t)=>Jl(e,xr,t);function Vn(e,t){if(e[xr]){let n=e[$n];n||Jl(e,$n,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function Cr(e,t){const n=e[$n];if(n&&n.has(t)){const r=n.size-1;r?n.delete(t):e[$n]=null,e.observerRemoved&&e.observerRemoved(r,t)}}var Jl=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),Ro=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,Hp=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,Yl=new RegExp(`(${Ro.source})(%|[a-z]+)`,"i"),zp=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,To=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,Ql=e=>{const[t,n]=qp(e);if(!t||Qi())return e;const r=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(r)return r.trim();if(n&&n.startsWith("--")){const o=window.getComputedStyle(document.documentElement).getPropertyValue(n);return o||e}else{if(n&&To.test(n))return Ql(n);if(n)return n}return e},qp=e=>{const t=To.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]},oa,Kp=(e,t,n,r,o)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(r)}, ${o})`,Zl=e=>{oa||(oa=mn?new RegExp(`(${Object.keys(mn).join("|")})(?!\\w)`,"g"):/^\b$/);const t=e.output.map(a=>Et(a).replace(To,Ql).replace(Hp,zl).replace(oa,zl)),n=t.map(a=>a.match(Ro).map(Number)),o=n[0].map((a,s)=>n.map(u=>{if(!(s in u))throw Error('The arity of each "output" value must be equal');return u[s]})).map(a=>wr({...e,output:a}));return a=>{var f;const s=!Yl.test(t[0])&&((f=t.find(g=>Yl.test(g)))==null?void 0:f.replace(Ro,""));let u=0;return t[0].replace(Ro,()=>`${o[u++](a)}${s||""}`).replace(zp,Kp)}},ia="react-spring: ",ec=e=>{const t=e;let n=!1;if(typeof t!="function")throw new TypeError(`${ia}once requires a function parameter`);return(...r)=>{n||(t(...r),n=!0)}},Wp=ec(console.warn);function Gp(){Wp(`${ia}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var Xp=ec(console.warn);function Jp(){Xp(`${ia}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function No(e){return pe.str(e)&&(e[0]=="#"||/\d/.test(e)||!Qi()&&To.test(e)||e in(mn||{}))}var aa=Qi()?H.useEffect:H.useLayoutEffect,Yp=()=>{const e=H.useRef(!1);return aa(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function tc(){const e=H.useState()[1],t=Yp();return()=>{t.current&&e(Math.random())}}function Qp(e,t){const[n]=H.useState(()=>({inputs:t,result:e()})),r=H.useRef(),o=r.current;let a=o;return a?t&&a.inputs&&Zp(t,a.inputs)||(a={inputs:t,result:e()}):a=n,H.useEffect(()=>{r.current=a,o==n&&(n.inputs=n.result=void 0)},[a]),a.result}function Zp(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var nc=e=>H.useEffect(e,em),em=[];function rc(e){const t=H.useRef();return H.useEffect(()=>{t.current=e}),t.current}var Er=Symbol.for("Animated:node"),tm=e=>!!e&&e[Er]===e,Yt=e=>e&&e[Er],sa=(e,t)=>kp(e,Er,t),jo=e=>e&&e[Er]&&e[Er].getPayload(),oc=class{constructor(){sa(this,this)}getPayload(){return this.payload||[]}},Sr=class extends oc{constructor(e){super(),this._value=e,this.done=!0,this.durationProgress=0,pe.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new Sr(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return pe.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value===e?!1:(this._value=e,!0)}reset(){const{done:e}=this;this.done=!1,pe.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},Pr=class extends Sr{constructor(e){super(0),this._string=null,this._toString=wr({output:[e,e]})}static create(e){return new Pr(e)}getValue(){const e=this._string;return e??(this._string=this._toString(this._value))}setValue(e){if(pe.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else if(super.setValue(e))this._string=null;else return!1;return!0}reset(e){e&&(this._toString=wr({output:[this.getValue(),e]})),this._value=0,super.reset()}},Ao={dependencies:null},Lo=class extends oc{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return Jt(this.source,(n,r)=>{tm(n)?t[r]=n.getValue(e):Tt(n)?t[r]=Et(n):e||(t[r]=n)}),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&Me(this.payload,e=>e.reset())}_makePayload(e){if(e){const t=new Set;return Jt(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Ao.dependencies&&Tt(e)&&Ao.dependencies.add(e);const t=jo(e);t&&Me(t,n=>this.add(n))}},ic=class extends Lo{constructor(e){super(e)}static create(e){return new ic(e)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){const t=this.getPayload();return e.length==t.length?t.map((n,r)=>n.setValue(e[r])).some(Boolean):(super.setValue(e.map(nm)),!0)}};function nm(e){return(No(e)?Pr:Sr).create(e)}function la(e){const t=Yt(e);return t?t.constructor:pe.arr(e)?ic:No(e)?Pr:Sr}var ac=(e,t)=>{const n=!pe.fun(e)||e.prototype&&e.prototype.isReactComponent;return H.forwardRef((r,o)=>{const a=H.useRef(null),s=n&&H.useCallback(i=>{a.current=im(o,i)},[o]),[u,f]=om(r,t),g=tc(),h=()=>{const i=a.current;if(n&&!i)return;(i?t.applyAnimatedValues(i,u.getValue(!0)):!1)===!1&&g()},x=new rm(h,f),l=H.useRef();aa(()=>(l.current=x,Me(f,i=>Vn(i,x)),()=>{l.current&&(Me(l.current.deps,i=>Cr(i,l.current)),Te.cancel(l.current.update))})),H.useEffect(h,[]),nc(()=>()=>{const i=l.current;Me(i.deps,c=>Cr(c,i))});const v=t.getComponentProps(u.getValue());return le.createElement(e,{...v,ref:s})})},rm=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){e.type=="change"&&Te.write(this.update)}};function om(e,t){const n=new Set;return Ao.dependencies=n,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new Lo(e),Ao.dependencies=null,[e,n]}function im(e,t){return e&&(pe.fun(e)?e(t):e.current=t),t}var sc=Symbol.for("AnimatedComponent"),am=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:n=o=>new Lo(o),getComponentProps:r=o=>o}={})=>{const o={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:r},a=s=>{const u=lc(s)||"Anonymous";return pe.str(s)?s=a[s]||(a[s]=ac(s,o)):s=s[sc]||(s[sc]=ac(s,o)),s.displayName=`Animated(${u})`,s};return Jt(e,(s,u)=>{pe.arr(e)&&(u=lc(s)),a[u]=a(s)}),{animated:a}},lc=e=>pe.str(e)?e:e&&pe.str(e.displayName)?e.displayName:pe.fun(e)&&e.name||null;function Cn(e,...t){return pe.fun(e)?e(...t):e}var Br=(e,t)=>e===!0||!!(t&&e&&(pe.fun(e)?e(t):Pt(e).includes(t))),cc=(e,t)=>pe.obj(e)?t&&e[t]:e,uc=(e,t)=>e.default===!0?e[t]:e.default?e.default[t]:void 0,sm=e=>e,ca=(e,t=sm)=>{let n=lm;e.default&&e.default!==!0&&(e=e.default,n=Object.keys(e));const r={};for(const o of n){const a=t(e[o],o);pe.und(a)||(r[o]=a)}return r},lm=["config","onProps","onStart","onChange","onPause","onResume","onRest"],cm={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function um(e){const t={};let n=0;if(Jt(e,(r,o)=>{cm[o]||(t[o]=r,n++)}),n)return t}function dc(e){const t=um(e);if(t){const n={to:t};return Jt(e,(r,o)=>o in t||(n[o]=r)),n}return{...e}}function Or(e){return e=Et(e),pe.arr(e)?e.map(Or):No(e)?Ft.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function dm(e){for(const t in e)return!0;return!1}function ua(e){return pe.fun(e)||pe.arr(e)&&pe.obj(e[0])}function fm(e,t){var n;(n=e.ref)==null||n.delete(e),t==null||t.delete(e)}function hm(e,t){var n;t&&e.ref!==t&&((n=e.ref)==null||n.delete(e),t.add(e),e.ref=t)}var pm={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},da={...pm.default,mass:1,damping:1,easing:Up.linear,clamp:!1},mm=class{constructor(){this.velocity=0,Object.assign(this,da)}};function gm(e,t,n){n&&(n={...n},fc(n,t),t={...n,...t}),fc(e,t),Object.assign(e,t);for(const s in da)e[s]==null&&(e[s]=da[s]);let{frequency:r,damping:o}=e;const{mass:a}=e;return pe.und(r)||(r<.01&&(r=.01),o<0&&(o=0),e.tension=Math.pow(2*Math.PI/r,2)*a,e.friction=4*Math.PI*o*a/r),e}function fc(e,t){if(!pe.und(t.decay))e.duration=void 0;else{const n=!pe.und(t.tension)||!pe.und(t.friction);(n||!pe.und(t.frequency)||!pe.und(t.damping)||!pe.und(t.mass))&&(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}}var hc=[],ym=class{constructor(){this.changed=!1,this.values=hc,this.toValues=null,this.fromValues=hc,this.config=new mm,this.immediate=!1}};function pc(e,{key:t,props:n,defaultProps:r,state:o,actions:a}){return new Promise((s,u)=>{let f,g,h=Br(n.cancel??(r==null?void 0:r.cancel),t);if(h)v();else{pe.und(n.pause)||(o.paused=Br(n.pause,t));let i=r==null?void 0:r.pause;i!==!0&&(i=o.paused||Br(i,t)),f=Cn(n.delay||0,t),i?(o.resumeQueue.add(l),a.pause()):(a.resume(),l())}function x(){o.resumeQueue.add(l),o.timeouts.delete(g),g.cancel(),f=g.time-Te.now()}function l(){f>0&&!Ft.skipAnimation?(o.delayed=!0,g=Te.setTimeout(v,f),o.pauseQueue.add(x),o.timeouts.add(g)):v()}function v(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(x),o.timeouts.delete(g),e<=(o.cancelId||0)&&(h=!0);try{a.start({...n,callId:e,cancel:h},s)}catch(i){u(i)}}})}var fa=(e,t)=>t.length==1?t[0]:t.some(n=>n.cancelled)?Hn(e.get()):t.every(n=>n.noop)?mc(e.get()):$t(e.get(),t.every(n=>n.finished)),mc=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),$t=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),Hn=e=>({value:e,cancelled:!0,finished:!1});function gc(e,t,n,r){const{callId:o,parentId:a,onRest:s}=t,{asyncTo:u,promise:f}=n;return!a&&e===u&&!t.reset?f:n.promise=(async()=>{n.asyncId=o,n.asyncTo=e;const g=ca(t,(p,d)=>d==="onRest"?void 0:p);let h,x;const l=new Promise((p,d)=>(h=p,x=d)),v=p=>{const d=o<=(n.cancelId||0)&&Hn(r)||o!==n.asyncId&&$t(r,!1);if(d)throw p.result=d,x(p),p},i=(p,d)=>{const m=new yc,y=new vc;return(async()=>{if(Ft.skipAnimation)throw _r(n),y.result=$t(r,!1),x(y),y;v(m);const b=pe.obj(p)?{...p}:{...d,to:p};b.parentId=o,Jt(g,(S,k)=>{pe.und(b[k])&&(b[k]=S)});const C=await r.start(b);return v(m),n.paused&&await new Promise(S=>{n.resumeQueue.add(S)}),C})()};let c;if(Ft.skipAnimation)return _r(n),$t(r,!1);try{let p;pe.arr(e)?p=(async d=>{for(const m of d)await i(m)})(e):p=Promise.resolve(e(i,r.stop.bind(r))),await Promise.all([p.then(h),l]),c=$t(r.get(),!0,!1)}catch(p){if(p instanceof yc)c=p.result;else if(p instanceof vc)c=p.result;else throw p}finally{o==n.asyncId&&(n.asyncId=a,n.asyncTo=a?u:void 0,n.promise=a?f:void 0)}return pe.fun(s)&&Te.batchedUpdates(()=>{s(c,r,r.item)}),c})()}function _r(e,t){yr(e.timeouts,n=>n.cancel()),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var yc=class extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},vc=class extends Error{constructor(){super("SkipAnimationSignal")}},ha=e=>e instanceof pa,vm=1,pa=class extends Xl{constructor(){super(...arguments),this.id=vm++,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){const e=Yt(this);return e&&e.getValue()}to(...e){return Ft.to(this,e)}interpolate(...e){return Gp(),Ft.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){kr(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||Co.sort(this),kr(this,{type:"priority",parent:this,priority:e})}},En=Symbol.for("SpringPhase"),bc=1,ma=2,ga=4,ya=e=>(e[En]&bc)>0,gn=e=>(e[En]&ma)>0,Rr=e=>(e[En]&ga)>0,wc=(e,t)=>t?e[En]|=ma|bc:e[En]&=~ma,xc=(e,t)=>t?e[En]|=ga:e[En]&=~ga,bm=class extends pa{constructor(e,t){if(super(),this.animation=new ym,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!pe.und(e)||!pe.und(t)){const n=pe.obj(e)?{...e}:{...t,from:e};pe.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(gn(this)||this._state.asyncTo)||Rr(this)}get goal(){return Et(this.animation.to)}get velocity(){const e=Yt(this);return e instanceof Sr?e.lastVelocity||0:e.getPayload().map(t=>t.lastVelocity||0)}get hasAnimated(){return ya(this)}get isAnimating(){return gn(this)}get isPaused(){return Rr(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1;const r=this.animation;let{toValues:o}=r;const{config:a}=r,s=jo(r.to);!s&&Tt(r.to)&&(o=Pt(Et(r.to))),r.values.forEach((g,h)=>{if(g.done)return;const x=g.constructor==Pr?1:s?s[h].lastPosition:o[h];let l=r.immediate,v=x;if(!l){if(v=g.lastPosition,a.tension<=0){g.done=!0;return}let i=g.elapsedTime+=e;const c=r.fromValues[h],p=g.v0!=null?g.v0:g.v0=pe.arr(a.velocity)?a.velocity[h]:a.velocity;let d;const m=a.precision||(c==x?.005:Math.min(1,Math.abs(x-c)*.001));if(pe.und(a.duration))if(a.decay){const y=a.decay===!0?.998:a.decay,b=Math.exp(-(1-y)*i);v=c+p/(1-y)*(1-b),l=Math.abs(g.lastPosition-v)<=m,d=p*b}else{d=g.lastVelocity==null?p:g.lastVelocity;const y=a.restVelocity||m/10,b=a.clamp?0:a.bounce,C=!pe.und(b),S=c==x?g.v0>0:c<x;let k,B=!1;const O=1,j=Math.ceil(e/O);for(let I=0;I<j&&(k=Math.abs(d)>y,!(!k&&(l=Math.abs(x-v)<=m,l)));++I){C&&(B=v==x||v>x==S,B&&(d=-d*b,v=x));const D=-a.tension*1e-6*(v-x),M=-a.friction*.001*d,$=(D+M)/a.mass;d=d+$*O,v=v+d*O}}else{let y=1;a.duration>0&&(this._memoizedDuration!==a.duration&&(this._memoizedDuration=a.duration,g.durationProgress>0&&(g.elapsedTime=a.duration*g.durationProgress,i=g.elapsedTime+=e)),y=(a.progress||0)+i/this._memoizedDuration,y=y>1?1:y<0?0:y,g.durationProgress=y),v=c+a.easing(y)*(x-c),d=(v-g.lastPosition)/e,l=y==1}g.lastVelocity=d,Number.isNaN(v)&&(console.warn("Got NaN while animating:",this),l=!0)}s&&!s[h].done&&(l=!1),l?g.done=!0:t=!1,g.setValue(v,a.round)&&(n=!0)});const u=Yt(this),f=u.getValue();if(t){const g=Et(r.to);(f!==g||n)&&!a.decay?(u.setValue(g),this._onChange(g)):n&&a.decay&&this._onChange(f),this._stop()}else n&&this._onChange(f)}set(e){return Te.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(gn(this)){const{to:e,config:t}=this.animation;Te.batchedUpdates(()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let n;return pe.und(e)?(n=this.queue||[],this.queue=[]):n=[pe.obj(e)?e:{...t,to:e}],Promise.all(n.map(r=>this._update(r))).then(r=>fa(this,r))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),_r(this._state,e&&this._lastCallId),Te.batchedUpdates(()=>this._stop(t,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){const t=this.key||"";let{to:n,from:r}=e;n=pe.obj(n)?n[t]:n,(n==null||ua(n))&&(n=void 0),r=pe.obj(r)?r[t]:r,r==null&&(r=void 0);const o={to:n,from:r};return ya(this)||(e.reverse&&([n,r]=[r,n]),r=Et(r),pe.und(r)?Yt(this)||this._set(n):this._set(r)),o}_update({...e},t){const{key:n,defaultProps:r}=this;e.default&&Object.assign(r,ca(e,(s,u)=>/^on/.test(u)?cc(s,n):s)),Ec(this,e,"onProps"),jr(this,"onProps",e,this);const o=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const a=this._state;return pc(++this._lastCallId,{key:n,props:e,defaultProps:r,state:a,actions:{pause:()=>{Rr(this)||(xc(this,!0),vr(a.pauseQueue),jr(this,"onPause",$t(this,Tr(this,this.animation.to)),this))},resume:()=>{Rr(this)&&(xc(this,!1),gn(this)&&this._resume(),vr(a.resumeQueue),jr(this,"onResume",$t(this,Tr(this,this.animation.to)),this))},start:this._merge.bind(this,o)}}).then(s=>{if(e.loop&&s.finished&&!(t&&s.noop)){const u=kc(e);if(u)return this._update(u,!0)}return s})}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(Hn(this));const r=!pe.und(e.to),o=!pe.und(e.from);if(r||o)if(t.callId>this._lastToId)this._lastToId=t.callId;else return n(Hn(this));const{key:a,defaultProps:s,animation:u}=this,{to:f,from:g}=u;let{to:h=f,from:x=g}=e;o&&!r&&(!t.default||pe.und(h))&&(h=x),t.reverse&&([h,x]=[x,h]);const l=!tn(x,g);l&&(u.from=x),x=Et(x);const v=!tn(h,f);v&&this._focus(h);const i=ua(t.to),{config:c}=u,{decay:p,velocity:d}=c;(r||o)&&(c.velocity=0),t.config&&!i&&gm(c,Cn(t.config,a),t.config!==s.config?Cn(s.config,a):void 0);let m=Yt(this);if(!m||pe.und(h))return n($t(this,!0));const y=pe.und(t.reset)?o&&!t.default:!pe.und(x)&&Br(t.reset,a),b=y?x:this.get(),C=Or(h),S=pe.num(C)||pe.arr(C)||No(C),k=!i&&(!S||Br(s.immediate||t.immediate,a));if(v){const I=la(h);if(I!==m.constructor)if(k)m=this._set(C);else throw Error(`Cannot animate between ${m.constructor.name} and ${I.name}, as the "to" prop suggests`)}const B=m.constructor;let O=Tt(h),j=!1;if(!O){const I=y||!ya(this)&&l;(v||I)&&(j=tn(Or(b),C),O=!j),(!tn(u.immediate,k)&&!k||!tn(c.decay,p)||!tn(c.velocity,d))&&(O=!0)}if(j&&gn(this)&&(u.changed&&!y?O=!0:O||this._stop(f)),!i&&((O||Tt(f))&&(u.values=m.getPayload(),u.toValues=Tt(h)?null:B==Pr?[1]:Pt(C)),u.immediate!=k&&(u.immediate=k,!k&&!y&&this._set(f)),O)){const{onRest:I}=u;Me(xm,M=>Ec(this,t,M));const D=$t(this,Tr(this,f));vr(this._pendingCalls,D),this._pendingCalls.add(n),u.changed&&Te.batchedUpdates(()=>{var M;u.changed=!y,I==null||I(D,this),y?Cn(s.onRest,D):(M=u.onStart)==null||M.call(u,D,this)})}y&&this._set(b),i?n(gc(t.to,t,this._state,this)):O?this._start():gn(this)&&!v?this._pendingCalls.add(n):n(mc(b))}_focus(e){const t=this.animation;e!==t.to&&(Gl(this)&&this._detach(),t.to=e,Gl(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;Tt(t)&&(Vn(t,this),ha(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;Tt(e)&&Cr(e,this)}_set(e,t=!0){const n=Et(e);if(!pe.und(n)){const r=Yt(this);if(!r||!tn(n,r.getValue())){const o=la(n);!r||r.constructor!=o?sa(this,o.create(n)):r.setValue(n),r&&Te.batchedUpdates(()=>{this._onChange(n,t)})}}return Yt(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,jr(this,"onStart",$t(this,Tr(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Cn(this.animation.onChange,e,this)),Cn(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;Yt(this).reset(Et(e.to)),e.immediate||(e.fromValues=e.values.map(t=>t.lastPosition)),gn(this)||(wc(this,!0),Rr(this)||this._resume())}_resume(){Ft.skipAnimation?this.finish():Co.start(this)}_stop(e,t){if(gn(this)){wc(this,!1);const n=this.animation;Me(n.values,o=>{o.done=!0}),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),kr(this,{type:"idle",parent:this});const r=t?Hn(this.get()):$t(this.get(),Tr(this,e??n.to));vr(this._pendingCalls,r),n.changed&&(n.changed=!1,jr(this,"onRest",r,this))}}};function Tr(e,t){const n=Or(t),r=Or(e.get());return tn(r,n)}function kc(e,t=e.loop,n=e.to){const r=Cn(t);if(r){const o=r!==!0&&dc(r),a=(o||e).reverse,s=!o||o.reset;return Nr({...e,loop:t,default:!1,pause:void 0,to:!a||ua(n)?n:void 0,from:s?e.from:void 0,reset:s,...o})}}function Nr(e){const{to:t,from:n}=e=dc(e),r=new Set;return pe.obj(t)&&Cc(t,r),pe.obj(n)&&Cc(n,r),e.keys=r.size?Array.from(r):null,e}function wm(e){const t=Nr(e);return pe.und(t.default)&&(t.default=ca(t)),t}function Cc(e,t){Jt(e,(n,r)=>n!=null&&t.add(r))}var xm=["onStart","onRest","onChange","onPause","onResume"];function Ec(e,t,n){e.animation[n]=t[n]!==uc(t,n)?cc(t[n],e.key):void 0}function jr(e,t,...n){var r,o,a,s;(o=(r=e.animation)[t])==null||o.call(r,...n),(s=(a=e.defaultProps)[t])==null||s.call(a,...n)}var km=["onStart","onChange","onRest"],Cm=1,Em=class{constructor(e,t){this.id=Cm++,this.springs={},this.queue=[],this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each((t,n)=>e[n]=t.get()),e}set(e){for(const t in e){const n=e[t];pe.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(Nr(e)),this}start(e){let{queue:t}=this;return e?t=Pt(e).map(Nr):this.queue=[],this._flush?this._flush(this,t):(Rc(this,t),va(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;Me(Pt(t),r=>n[r].stop(!!e))}else _r(this._state,this._lastAsyncId),this.each(n=>n.stop(!!e));return this}pause(e){if(pe.und(e))this.start({pause:!0});else{const t=this.springs;Me(Pt(e),n=>t[n].pause())}return this}resume(e){if(pe.und(e))this.start({pause:!1});else{const t=this.springs;Me(Pt(e),n=>t[n].resume())}return this}each(e){Jt(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:n}=this._events,r=this._active.size>0,o=this._changed.size>0;(r&&!this._started||o&&!this._started)&&(this._started=!0,yr(e,([u,f])=>{f.value=this.get(),u(f,this,this._item)}));const a=!r&&this._started,s=o||a&&n.size?this.get():null;o&&t.size&&yr(t,([u,f])=>{f.value=s,u(f,this,this._item)}),a&&(this._started=!1,yr(n,([u,f])=>{f.value=s,u(f,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;Te.onFrame(this._onFrame)}};function va(e,t){return Promise.all(t.map(n=>Sc(e,n))).then(n=>fa(e,n))}async function Sc(e,t,n){const{keys:r,to:o,from:a,loop:s,onRest:u,onResolve:f}=t,g=pe.obj(t.default)&&t.default;s&&(t.loop=!1),o===!1&&(t.to=null),a===!1&&(t.from=null);const h=pe.arr(o)||pe.fun(o)?o:void 0;h?(t.to=void 0,t.onRest=void 0,g&&(g.onRest=void 0)):Me(km,c=>{const p=t[c];if(pe.fun(p)){const d=e._events[c];t[c]=({finished:m,cancelled:y})=>{const b=d.get(p);b?(m||(b.finished=!1),y&&(b.cancelled=!0)):d.set(p,{value:null,finished:m||!1,cancelled:y||!1})},g&&(g[c]=t[c])}});const x=e._state;t.pause===!x.paused?(x.paused=t.pause,vr(t.pause?x.pauseQueue:x.resumeQueue)):x.paused&&(t.pause=!0);const l=(r||Object.keys(e.springs)).map(c=>e.springs[c].start(t)),v=t.cancel===!0||uc(t,"cancel")===!0;(h||v&&x.asyncId)&&l.push(pc(++e._lastAsyncId,{props:t,state:x,actions:{pause:Yi,resume:Yi,start(c,p){v?(_r(x,e._lastAsyncId),p(Hn(e))):(c.onRest=u,p(gc(h,c,x,e)))}}})),x.paused&&await new Promise(c=>{x.resumeQueue.add(c)});const i=fa(e,await Promise.all(l));if(s&&i.finished&&!(n&&i.noop)){const c=kc(t,s,o);if(c)return Rc(e,[c]),Sc(e,c,!0)}return f&&Te.batchedUpdates(()=>f(i,e,e.item)),i}function Pc(e,t){const n={...e.springs};return t&&Me(Pt(t),r=>{pe.und(r.keys)&&(r=Nr(r)),pe.obj(r.to)||(r={...r,to:void 0}),_c(n,r,o=>Oc(o))}),Bc(e,n),n}function Bc(e,t){Jt(t,(n,r)=>{e.springs[r]||(e.springs[r]=n,Vn(n,e))})}function Oc(e,t){const n=new bm;return n.key=e,t&&Vn(n,t),n}function _c(e,t,n){t.keys&&Me(t.keys,r=>{(e[r]||(e[r]=n(r)))._prepareNode(t)})}function Rc(e,t){Me(t,n=>{_c(e.springs,n,r=>Oc(r,e))})}var Io=({children:e,...t})=>{const n=H.useContext(Do),r=t.pause||!!n.pause,o=t.immediate||!!n.immediate;t=Qp(()=>({pause:r,immediate:o}),[r,o]);const{Provider:a}=Do;return le.createElement(a,{value:t},e)},Do=Sm(Io,{});Io.Provider=Do.Provider,Io.Consumer=Do.Consumer;function Sm(e,t){return Object.assign(e,le.createContext(t)),e.Provider._context=e,e.Consumer._context=e,e}var Pm=()=>{const e=[],t=function(r){Jp();const o=[];return Me(e,(a,s)=>{if(pe.und(r))o.push(a.start());else{const u=n(r,a,s);u&&o.push(a.start(u))}}),o};t.current=e,t.add=function(r){e.includes(r)||e.push(r)},t.delete=function(r){const o=e.indexOf(r);~o&&e.splice(o,1)},t.pause=function(){return Me(e,r=>r.pause(...arguments)),this},t.resume=function(){return Me(e,r=>r.resume(...arguments)),this},t.set=function(r){Me(e,(o,a)=>{const s=pe.fun(r)?r(a,o):r;s&&o.set(s)})},t.start=function(r){const o=[];return Me(e,(a,s)=>{if(pe.und(r))o.push(a.start());else{const u=this._getProps(r,a,s);u&&o.push(a.start(u))}}),o},t.stop=function(){return Me(e,r=>r.stop(...arguments)),this},t.update=function(r){return Me(e,(o,a)=>o.update(this._getProps(r,o,a))),this};const n=function(r,o,a){return pe.fun(r)?r(a,o):r};return t._getProps=n,t};function Bm(e,t,n){const r=pe.fun(t)&&t;r&&!n&&(n=[]);const o=H.useMemo(()=>r||arguments.length==3?Pm():void 0,[]),a=H.useRef(0),s=tc(),u=H.useMemo(()=>({ctrls:[],queue:[],flush(d,m){const y=Pc(d,m);return a.current>0&&!u.queue.length&&!Object.keys(y).some(C=>!d.springs[C])?va(d,m):new Promise(C=>{Bc(d,y),u.queue.push(()=>{C(va(d,m))}),s()})}}),[]),f=H.useRef([...u.ctrls]),g=[],h=rc(e)||0;H.useMemo(()=>{Me(f.current.slice(e,h),d=>{fm(d,o),d.stop(!0)}),f.current.length=e,x(h,e)},[e]),H.useMemo(()=>{x(0,Math.min(h,e))},n);function x(d,m){for(let y=d;y<m;y++){const b=f.current[y]||(f.current[y]=new Em(null,u.flush)),C=r?r(y,b):t[y];C&&(g[y]=wm(C))}}const l=f.current.map((d,m)=>Pc(d,g[m])),v=H.useContext(Io),i=rc(v),c=v!==i&&dm(v);aa(()=>{a.current++,u.ctrls=f.current;const{queue:d}=u;d.length&&(u.queue=[],Me(d,m=>m())),Me(f.current,(m,y)=>{o==null||o.add(m),c&&m.start({default:v});const b=g[y];b&&(hm(m,b.ref),m.ref?m.queue.push(b):m.start(b))})}),nc(()=>()=>{Me(u.ctrls,d=>d.stop(!0))});const p=l.map(d=>({...d}));return o?[p,o]:p}function Om(e,t){const n=pe.fun(e),[[r],o]=Bm(1,n?e:[e],n?[]:t);return n||arguments.length==2?[r,o]:r}var _m=class extends pa{constructor(e,t){super(),this.source=e,this.idle=!0,this._active=new Set,this.calc=wr(...t);const n=this._get(),r=la(n);sa(this,r.create(n))}advance(e){const t=this._get(),n=this.get();tn(t,n)||(Yt(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&Tc(this._active)&&ba(this)}_get(){const e=pe.arr(this.source)?this.source.map(Et):Pt(Et(this.source));return this.calc(...e)}_start(){this.idle&&!Tc(this._active)&&(this.idle=!1,Me(jo(this),e=>{e.done=!1}),Ft.skipAnimation?(Te.batchedUpdates(()=>this.advance()),ba(this)):Co.start(this))}_attach(){let e=1;Me(Pt(this.source),t=>{Tt(t)&&Vn(t,this),ha(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))}),this.priority=e,this._start()}_detach(){Me(Pt(this.source),e=>{Tt(e)&&Cr(e,this)}),this._active.clear(),ba(this)}eventObserved(e){e.type=="change"?e.idle?this.advance():(this._active.add(e.parent),this._start()):e.type=="idle"?this._active.delete(e.parent):e.type=="priority"&&(this.priority=Pt(this.source).reduce((t,n)=>Math.max(t,(ha(n)?n.priority:0)+1),0))}};function Rm(e){return e.idle!==!1}function Tc(e){return!e.size||Array.from(e).every(Rm)}function ba(e){e.idle||(e.idle=!0,Me(jo(e),t=>{t.done=!0}),kr(e,{type:"idle",parent:e}))}Ft.assign({createStringInterpolator:Zl,to:(e,t)=>new _m(e,t)});var Nc=/^--/;function Tm(e,t){return t==null||typeof t=="boolean"||t===""?"":typeof t=="number"&&t!==0&&!Nc.test(e)&&!(Ar.hasOwnProperty(e)&&Ar[e])?t+"px":(""+t).trim()}var jc={};function Nm(e,t){if(!e.nodeType||!e.setAttribute)return!1;const n=e.nodeName==="filter"||e.parentNode&&e.parentNode.nodeName==="filter",{style:r,children:o,scrollTop:a,scrollLeft:s,viewBox:u,...f}=t,g=Object.values(f),h=Object.keys(f).map(x=>n||e.hasAttribute(x)?x:jc[x]||(jc[x]=x.replace(/([A-Z])/g,l=>"-"+l.toLowerCase())));o!==void 0&&(e.textContent=o);for(const x in r)if(r.hasOwnProperty(x)){const l=Tm(x,r[x]);Nc.test(x)?e.style.setProperty(x,l):e.style[x]=l}h.forEach((x,l)=>{e.setAttribute(x,g[l])}),a!==void 0&&(e.scrollTop=a),s!==void 0&&(e.scrollLeft=s),u!==void 0&&e.setAttribute("viewBox",u)}var Ar={animationIterationCount:!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,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},jm=(e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1),Am=["Webkit","Ms","Moz","O"];Ar=Object.keys(Ar).reduce((e,t)=>(Am.forEach(n=>e[jm(n,t)]=e[t]),e),Ar);var Lm=/^(matrix|translate|scale|rotate|skew)/,Im=/^(translate)/,Dm=/^(rotate|skew)/,wa=(e,t)=>pe.num(e)&&e!==0?e+t:e,Mo=(e,t)=>pe.arr(e)?e.every(n=>Mo(n,t)):pe.num(e)?e===t:parseFloat(e)===t,Mm=class extends Lo{constructor({x:e,y:t,z:n,...r}){const o=[],a=[];(e||t||n)&&(o.push([e||0,t||0,n||0]),a.push(s=>[`translate3d(${s.map(u=>wa(u,"px")).join(",")})`,Mo(s,0)])),Jt(r,(s,u)=>{if(u==="transform")o.push([s||""]),a.push(f=>[f,f===""]);else if(Lm.test(u)){if(delete r[u],pe.und(s))return;const f=Im.test(u)?"px":Dm.test(u)?"deg":"";o.push(Pt(s)),a.push(u==="rotate3d"?([g,h,x,l])=>[`rotate3d(${g},${h},${x},${wa(l,f)})`,Mo(l,0)]:g=>[`${u}(${g.map(h=>wa(h,f)).join(",")})`,Mo(g,u.startsWith("scale")?1:0)])}}),o.length&&(r.transform=new Fm(o,a)),super(r)}},Fm=class extends Xl{constructor(e,t){super(),this.inputs=e,this.transforms=t,this._value=null}get(){return this._value||(this._value=this._get())}_get(){let e="",t=!0;return Me(this.inputs,(n,r)=>{const o=Et(n[0]),[a,s]=this.transforms[r](pe.arr(o)?o:n.map(Et));e+=" "+a,t=t&&s}),t?"none":e}observerAdded(e){e==1&&Me(this.inputs,t=>Me(t,n=>Tt(n)&&Vn(n,this)))}observerRemoved(e){e==0&&Me(this.inputs,t=>Me(t,n=>Tt(n)&&Cr(n,this)))}eventObserved(e){e.type=="change"&&(this._value=null),kr(this,e)}},Um=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];Ft.assign({batchedUpdates:sn.unstable_batchedUpdates,createStringInterpolator:Zl,colors:Bp});var $m=am(Um,{applyAnimatedValues:Nm,createAnimatedStyle:e=>new Mm(e),getComponentProps:({scrollTop:e,scrollLeft:t,...n})=>n}),Vm=$m.animated;function Ac(e){const{rows:t}=e,n=Om({from:{opacity:0},to:{opacity:1}});return E.jsxs(Vm.div,{style:n,className:"flex w-full animate-pulse flex-col items-start space-y-3",children:[[...Array(t)].map((r,o)=>E.jsx("div",{className:"h-16 w-full rounded-lg bg-gray-100 p-5"},`skeleton_rows_${o}`)),E.jsx("span",{className:"sr-only",children:"Loading..."})]})}function Hm({item:e}){return E.jsx("th",{className:`h-10 min-w-max items-center px-4 ${e.align==="left"?"text-start":e.align==="center"?"text-center":"text-end"}`,children:E.jsx(qe,{size:"xs",weight:"normal",color:"text-gray-700",children:e&&e.value})})}function zm({row:e,onClick:t}){return E.jsx("tr",{children:e.columns.map((n,r)=>E.jsx("td",{children:E.jsx("div",{className:`my-auto flex h-12 w-full items-center ${n.align==="left"?"justify-start":n.align==="center"?"justify-center":"justify-end"} truncate px-4 font-thin`,children:n.value.type==="button_component"?E.jsx(Ye,{label:n.value.label??"",disabled:n.value.disabled,onClick:()=>t&&t(n.value.id)}):E.jsx(qe,{size:"sm",weight:"light",color:"text-gray-700",children:n.value.title})})},`${n.value}-${r}`))})}function qm(e){return E.jsx(E.Fragment,{children:[...Array(e.rows)].map((t,n)=>E.jsx("tr",{className:"border-b border-gray-50",children:[...Array(e.columns)].map((r,o)=>E.jsx("td",{className:"table-cell animate-pulse",children:E.jsx("div",{className:`flex grow items-center ${e.type=="double"?"h-[72px]":"h-12"}`,children:E.jsx("div",{className:"m-2 h-8 w-28 rounded-lg bg-gray-50"})})},`form_element_skeleton_col_${o}`))},`form_element_skeleton_${n}`))})}function Lc({header:e=[],rows:t=[],pending:n,onClick:r}){const{t:o}=Qe();return E.jsxs("div",{className:"relative overflow-auto rounded-lg rounded-b-lg rounded-t-lg border border-gray-900/10",children:[E.jsxs("table",{className:"table w-full table-auto",children:[E.jsx("thead",{className:"sticky top-0 table-header-group w-full bg-gray-50",children:E.jsx("tr",{children:e.map((a,s)=>E.jsx(Hm,{item:a},`${a.value}-${s}`))})}),E.jsx("tbody",{children:n?E.jsx(qm,{columns:e.length??5,rows:t.length??10}):t.map((a,s)=>E.jsx(zm,{row:a,onClick:r},s))})]}),!t.length&&E.jsx("div",{className:"p-6",children:E.jsx(qe,{color:"text-gray-200",className:"text-center",size:"sm",children:o("noData")})})]})}function xa(e){"@babel/helpers - typeof";return xa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xa(e)}function Ic(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":xa(XMLHttpRequest))==="object"}function Km(e){return!!e&&typeof e.then=="function"}function Wm(e){return Km(e)?e:Promise.resolve(e)}function Gm(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ka={exports:{}},Fo={exports:{}},Dc;function Xm(){return Dc||(Dc=1,function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Rn<"u"&&Rn,r=function(){function a(){this.fetch=!1,this.DOMException=n.DOMException}return a.prototype=n,new a}();(function(a){(function(s){var u=typeof a<"u"&&a||typeof self<"u"&&self||typeof u<"u"&&u,f={searchParams:"URLSearchParams"in u,iterable:"Symbol"in u&&"iterator"in Symbol,blob:"FileReader"in u&&"Blob"in u&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in u,arrayBuffer:"ArrayBuffer"in u};function g(P){return P&&DataView.prototype.isPrototypeOf(P)}if(f.arrayBuffer)var h=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],x=ArrayBuffer.isView||function(P){return P&&h.indexOf(Object.prototype.toString.call(P))>-1};function l(P){if(typeof P!="string"&&(P=String(P)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(P)||P==="")throw new TypeError('Invalid character in header field name: "'+P+'"');return P.toLowerCase()}function v(P){return typeof P!="string"&&(P=String(P)),P}function i(P){var L={next:function(){var q=P.shift();return{done:q===void 0,value:q}}};return f.iterable&&(L[Symbol.iterator]=function(){return L}),L}function c(P){this.map={},P instanceof c?P.forEach(function(L,q){this.append(q,L)},this):Array.isArray(P)?P.forEach(function(L){this.append(L[0],L[1])},this):P&&Object.getOwnPropertyNames(P).forEach(function(L){this.append(L,P[L])},this)}c.prototype.append=function(P,L){P=l(P),L=v(L);var q=this.map[P];this.map[P]=q?q+", "+L:L},c.prototype.delete=function(P){delete this.map[l(P)]},c.prototype.get=function(P){return P=l(P),this.has(P)?this.map[P]:null},c.prototype.has=function(P){return this.map.hasOwnProperty(l(P))},c.prototype.set=function(P,L){this.map[l(P)]=v(L)},c.prototype.forEach=function(P,L){for(var q in this.map)this.map.hasOwnProperty(q)&&P.call(L,this.map[q],q,this)},c.prototype.keys=function(){var P=[];return this.forEach(function(L,q){P.push(q)}),i(P)},c.prototype.values=function(){var P=[];return this.forEach(function(L){P.push(L)}),i(P)},c.prototype.entries=function(){var P=[];return this.forEach(function(L,q){P.push([q,L])}),i(P)},f.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);function p(P){if(P.bodyUsed)return Promise.reject(new TypeError("Already read"));P.bodyUsed=!0}function d(P){return new Promise(function(L,q){P.onload=function(){L(P.result)},P.onerror=function(){q(P.error)}})}function m(P){var L=new FileReader,q=d(L);return L.readAsArrayBuffer(P),q}function y(P){var L=new FileReader,q=d(L);return L.readAsText(P),q}function b(P){for(var L=new Uint8Array(P),q=new Array(L.length),K=0;K<L.length;K++)q[K]=String.fromCharCode(L[K]);return q.join("")}function C(P){if(P.slice)return P.slice(0);var L=new Uint8Array(P.byteLength);return L.set(new Uint8Array(P)),L.buffer}function S(){return this.bodyUsed=!1,this._initBody=function(P){this.bodyUsed=this.bodyUsed,this._bodyInit=P,P?typeof P=="string"?this._bodyText=P:f.blob&&Blob.prototype.isPrototypeOf(P)?this._bodyBlob=P:f.formData&&FormData.prototype.isPrototypeOf(P)?this._bodyFormData=P:f.searchParams&&URLSearchParams.prototype.isPrototypeOf(P)?this._bodyText=P.toString():f.arrayBuffer&&f.blob&&g(P)?(this._bodyArrayBuffer=C(P.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):f.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(P)||x(P))?this._bodyArrayBuffer=C(P):this._bodyText=P=Object.prototype.toString.call(P):this._bodyText="",this.headers.get("content-type")||(typeof P=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):f.searchParams&&URLSearchParams.prototype.isPrototypeOf(P)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f.blob&&(this.blob=function(){var P=p(this);if(P)return P;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var P=p(this);return P||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(m)}),this.text=function(){var P=p(this);if(P)return P;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(b(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},f.formData&&(this.formData=function(){return this.text().then(j)}),this.json=function(){return this.text().then(JSON.parse)},this}var k=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function B(P){var L=P.toUpperCase();return k.indexOf(L)>-1?L:P}function O(P,L){if(!(this instanceof O))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');L=L||{};var q=L.body;if(P instanceof O){if(P.bodyUsed)throw new TypeError("Already read");this.url=P.url,this.credentials=P.credentials,L.headers||(this.headers=new c(P.headers)),this.method=P.method,this.mode=P.mode,this.signal=P.signal,!q&&P._bodyInit!=null&&(q=P._bodyInit,P.bodyUsed=!0)}else this.url=String(P);if(this.credentials=L.credentials||this.credentials||"same-origin",(L.headers||!this.headers)&&(this.headers=new c(L.headers)),this.method=B(L.method||this.method||"GET"),this.mode=L.mode||this.mode||null,this.signal=L.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&q)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(q),(this.method==="GET"||this.method==="HEAD")&&(L.cache==="no-store"||L.cache==="no-cache")){var K=/([?&])_=[^&]*/;if(K.test(this.url))this.url=this.url.replace(K,"$1_="+new Date().getTime());else{var Q=/\?/;this.url+=(Q.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})};function j(P){var L=new FormData;return P.trim().split("&").forEach(function(q){if(q){var K=q.split("="),Q=K.shift().replace(/\+/g," "),Z=K.join("=").replace(/\+/g," ");L.append(decodeURIComponent(Q),decodeURIComponent(Z))}}),L}function I(P){var L=new c,q=P.replace(/\r?\n[\t ]+/g," ");return q.split("\r").map(function(K){return K.indexOf(`
|
|
73
|
-
`)===0?K.substr(1,K.length):K}).forEach(function(K){var Q=K.split(":"),Z=Q.shift().trim();if(Z){var ee=Q.join(":").trim();L.append(Z,ee)}}),L}S.call(O.prototype);function D(P,L){if(!(this instanceof D))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');L||(L={}),this.type="default",this.status=L.status===void 0?200:L.status,this.ok=this.status>=200&&this.status<300,this.statusText=L.statusText===void 0?"":""+L.statusText,this.headers=new c(L.headers),this.url=L.url||"",this._initBody(P)}S.call(D.prototype),D.prototype.clone=function(){return new D(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},D.error=function(){var P=new D(null,{status:0,statusText:""});return P.type="error",P};var M=[301,302,303,307,308];D.redirect=function(P,L){if(M.indexOf(L)===-1)throw new RangeError("Invalid status code");return new D(null,{status:L,headers:{location:P}})},s.DOMException=u.DOMException;try{new s.DOMException}catch{s.DOMException=function(L,q){this.message=L,this.name=q;var K=Error(L);this.stack=K.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function $(P,L){return new Promise(function(q,K){var Q=new O(P,L);if(Q.signal&&Q.signal.aborted)return K(new s.DOMException("Aborted","AbortError"));var Z=new XMLHttpRequest;function ee(){Z.abort()}Z.onload=function(){var ne={status:Z.status,statusText:Z.statusText,headers:I(Z.getAllResponseHeaders()||"")};ne.url="responseURL"in Z?Z.responseURL:ne.headers.get("X-Request-URL");var me="response"in Z?Z.response:Z.responseText;setTimeout(function(){q(new D(me,ne))},0)},Z.onerror=function(){setTimeout(function(){K(new TypeError("Network request failed"))},0)},Z.ontimeout=function(){setTimeout(function(){K(new TypeError("Network request failed"))},0)},Z.onabort=function(){setTimeout(function(){K(new s.DOMException("Aborted","AbortError"))},0)};function ue(ne){try{return ne===""&&u.location.href?u.location.href:ne}catch{return ne}}Z.open(Q.method,ue(Q.url),!0),Q.credentials==="include"?Z.withCredentials=!0:Q.credentials==="omit"&&(Z.withCredentials=!1),"responseType"in Z&&(f.blob?Z.responseType="blob":f.arrayBuffer&&Q.headers.get("Content-Type")&&Q.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(Z.responseType="arraybuffer")),L&&typeof L.headers=="object"&&!(L.headers instanceof c)?Object.getOwnPropertyNames(L.headers).forEach(function(ne){Z.setRequestHeader(ne,v(L.headers[ne]))}):Q.headers.forEach(function(ne,me){Z.setRequestHeader(me,ne)}),Q.signal&&(Q.signal.addEventListener("abort",ee),Z.onreadystatechange=function(){Z.readyState===4&&Q.signal.removeEventListener("abort",ee)}),Z.send(typeof Q._bodyInit>"u"?null:Q._bodyInit)})}return $.polyfill=!0,u.fetch||(u.fetch=$,u.Headers=c,u.Request=O,u.Response=D),s.Headers=c,s.Request=O,s.Response=D,s.fetch=$,s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var o=n.fetch?n:r;t=o.fetch,t.default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(Fo,Fo.exports)),Fo.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof Rn<"u"&&Rn.fetch?n=Rn.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof Gm<"u"&&typeof window>"u"){var r=n||Xm();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(ka,ka.exports);var Mc=ka.exports;const Fc=Xo(Mc),Uc=Ju({__proto__:null,default:Fc},[Mc]);function $c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Vc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$c(Object(n),!0).forEach(function(r){Jm(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$c(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Jm(e,t,n){return t=Ym(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ym(e){var t=Qm(e,"string");return Sn(t)=="symbol"?t:t+""}function Qm(e,t){if(Sn(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Sn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sn(e){"@babel/helpers - typeof";return Sn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sn(e)}var nn;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?nn=global.fetch:typeof window<"u"&&window.fetch?nn=window.fetch:nn=fetch);var Lr;Ic()&&(typeof global<"u"&&global.XMLHttpRequest?Lr=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Lr=window.XMLHttpRequest));var Uo;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?Uo=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(Uo=window.ActiveXObject)),!nn&&Uc&&!Lr&&!Uo&&(nn=Fc||Uc),typeof nn!="function"&&(nn=void 0);var Ca=function(t,n){if(n&&Sn(n)==="object"){var r="";for(var o in n)r+="&"+encodeURIComponent(o)+"="+encodeURIComponent(n[o]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},Hc=function(t,n,r,o){var a=function(f){if(!f.ok)return r(f.statusText||"Error",{status:f.status});f.text().then(function(g){r(null,{status:f.status,data:g})}).catch(r)};if(o){var s=o(t,n);if(s instanceof Promise){s.then(a).catch(r);return}}typeof fetch=="function"?fetch(t,n).then(a).catch(r):nn(t,n).then(a).catch(r)},zc=!1,Zm=function(t,n,r,o){t.queryStringParams&&(n=Ca(n,t.queryStringParams));var a=Vc({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(a["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),r&&(a["Content-Type"]="application/json");var s=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,u=Vc({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:a},zc?{}:s),f=typeof t.alternateFetch=="function"&&t.alternateFetch.length>=1?t.alternateFetch:void 0;try{Hc(n,u,o,f)}catch(g){if(!s||Object.keys(s).length===0||!g.message||g.message.indexOf("not implemented")<0)return o(g);try{Object.keys(s).forEach(function(h){delete u[h]}),Hc(n,u,o,f),zc=!0}catch(h){o(h)}}},eg=function(t,n,r,o){r&&Sn(r)==="object"&&(r=Ca("",r).slice(1)),t.queryStringParams&&(n=Ca(n,t.queryStringParams));try{var a;Lr?a=new Lr:a=new Uo("MSXML2.XMLHTTP.3.0"),a.open(r?"POST":"GET",n,1),t.crossDomain||a.setRequestHeader("X-Requested-With","XMLHttpRequest"),a.withCredentials=!!t.withCredentials,r&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.overrideMimeType&&a.overrideMimeType("application/json");var s=t.customHeaders;if(s=typeof s=="function"?s():s,s)for(var u in s)a.setRequestHeader(u,s[u]);a.onreadystatechange=function(){a.readyState>3&&o(a.status>=400?a.statusText:null,{status:a.status,data:a.responseText})},a.send(r)}catch(f){console&&console.log(f)}},tg=function(t,n,r,o){if(typeof r=="function"&&(o=r,r=void 0),o=o||function(){},nn&&n.indexOf("file:")!==0)return Zm(t,n,r,o);if(Ic()||typeof ActiveXObject=="function")return eg(t,n,r,o);o(new Error("No fetch and no xhr implementation found!"))};function zn(e){"@babel/helpers - typeof";return zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zn(e)}function qc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Ea(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qc(Object(n),!0).forEach(function(r){Kc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ng(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rg(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Wc(r.key),r)}}function og(e,t,n){return t&&rg(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kc(e,t,n){return t=Wc(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wc(e){var t=ig(e,"string");return zn(t)=="symbol"?t:t+""}function ig(e,t){if(zn(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(zn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ag=function(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:function(n){return JSON.parse(n)},stringify:JSON.stringify,parsePayload:function(n,r,o){return Kc({},r,o||"")},parseLoadPayload:function(n,r){},request:tg,reloadInterval:typeof window<"u"?!1:60*60*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},Gc=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ng(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return og(e,[{key:"init",value:function(n){var r=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=n,this.options=Ea(Ea(Ea({},ag()),this.options||{}),o),this.allOptions=a,this.services&&this.options.reloadInterval){var s=setInterval(function(){return r.reload()},this.options.reloadInterval);zn(s)==="object"&&typeof s.unref=="function"&&s.unref()}}},{key:"readMulti",value:function(n,r,o){this._readAny(n,n,r,r,o)}},{key:"read",value:function(n,r,o){this._readAny([n],n,[r],r,o)}},{key:"_readAny",value:function(n,r,o,a,s){var u=this,f=this.options.loadPath;typeof this.options.loadPath=="function"&&(f=this.options.loadPath(n,o)),f=Wm(f),f.then(function(g){if(!g)return s(null,{});var h=u.services.interpolator.interpolate(g,{lng:n.join("+"),ns:o.join("+")});u.loadUrl(h,s,r,a)})}},{key:"loadUrl",value:function(n,r,o,a){var s=this,u=typeof o=="string"?[o]:o,f=typeof a=="string"?[a]:a,g=this.options.parseLoadPayload(u,f);this.options.request(this.options,n,g,function(h,x){if(x&&(x.status>=500&&x.status<600||!x.status))return r("failed loading "+n+"; status code: "+x.status,!0);if(x&&x.status>=400&&x.status<500)return r("failed loading "+n+"; status code: "+x.status,!1);if(!x&&h&&h.message&&h.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+h.message,!0);if(h)return r(h,!1);var l,v;try{typeof x.data=="string"?l=s.options.parse(x.data,o,a):l=x.data}catch{v="failed parsing "+n+" to json"}if(v)return r(v,!1);r(null,l)})}},{key:"create",value:function(n,r,o,a,s){var u=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var f=this.options.parsePayload(r,o,a),g=0,h=[],x=[];n.forEach(function(l){var v=u.options.addPath;typeof u.options.addPath=="function"&&(v=u.options.addPath(l,r));var i=u.services.interpolator.interpolate(v,{lng:l,ns:r});u.options.request(u.options,i,f,function(c,p){g+=1,h.push(c),x.push(p),g===n.length&&typeof s=="function"&&s(h,x)})})}}},{key:"reload",value:function(){var n=this,r=this.services,o=r.backendConnector,a=r.languageUtils,s=r.logger,u=o.language;if(!(u&&u.toLowerCase()==="cimode")){var f=[],g=function(x){var l=a.toResolveHierarchy(x);l.forEach(function(v){f.indexOf(v)<0&&f.push(v)})};g(u),this.allOptions.preload&&this.allOptions.preload.forEach(function(h){return g(h)}),f.forEach(function(h){n.allOptions.ns.forEach(function(x){o.read(h,x,"read",null,null,function(l,v){l&&s.warn("loading namespace ".concat(x," for language ").concat(h," failed"),l),!l&&v&&s.log("loaded namespace ".concat(x," for language ").concat(h),v),o.loaded("".concat(h,"|").concat(x),l,v)})})})}}}])}();Gc.type="backend";const{slice:sg,forEach:lg}=[];function cg(e){return lg.call(sg.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}const Xc=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,ug=(e,t,n)=>{const r=n||{};r.path=r.path||"/";const o=encodeURIComponent(t);let a=`${e}=${o}`;if(r.maxAge>0){const s=r.maxAge-0;if(Number.isNaN(s))throw new Error("maxAge should be a Number");a+=`; Max-Age=${Math.floor(s)}`}if(r.domain){if(!Xc.test(r.domain))throw new TypeError("option domain is invalid");a+=`; Domain=${r.domain}`}if(r.path){if(!Xc.test(r.path))throw new TypeError("option path is invalid");a+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(a+="; HttpOnly"),r.secure&&(a+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return a},Jc={create(e,t,n,r){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+n*60*1e3)),r&&(o.domain=r),document.cookie=ug(e,encodeURIComponent(t),o)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let o=n[r];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return o.substring(t.length,o.length)}return null},remove(e){this.create(e,"",-1)}};var dg={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return Jc.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:a}=t;n&&typeof document<"u"&&Jc.create(n,e,r,o,a)}},fg={name:"querystring",lookup(e){var r;let{lookupQuerystring:t}=e,n;if(typeof window<"u"){let{search:o}=window.location;!window.location.search&&((r=window.location.hash)==null?void 0:r.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const s=o.substring(1).split("&");for(let u=0;u<s.length;u++){const f=s[u].indexOf("=");f>0&&s[u].substring(0,f)===t&&(n=s[u].substring(f+1))}}return n}};let Ir=null;const Yc=()=>{if(Ir!==null)return Ir;try{Ir=window!=="undefined"&&window.localStorage!==null;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Ir=!1}return Ir};var hg={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&Yc())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&Yc()&&window.localStorage.setItem(n,e)}};let Dr=null;const Qc=()=>{if(Dr!==null)return Dr;try{Dr=window!=="undefined"&&window.sessionStorage!==null;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Dr=!1}return Dr};var pg={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&Qc())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&Qc()&&window.sessionStorage.setItem(n,e)}},mg={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:o}=navigator;if(n)for(let a=0;a<n.length;a++)t.push(n[a]);r&&t.push(r),o&&t.push(o)}return t.length>0?t:void 0}},gg={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},yg={name:"path",lookup(e){var o;let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(o=n[typeof t=="number"?t:0])==null?void 0:o.replace("/",""):void 0}},vg={name:"subdomain",lookup(e){var o,a;let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window<"u"&&((a=(o=window.location)==null?void 0:o.hostname)==null?void 0:a.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[n]}};function bg(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e}}class Zc{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=cg(n,this.options||{},bg()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(dg),this.addDetector(fg),this.addDetector(hg),this.addDetector(pg),this.addDetector(mg),this.addDetector(gg),this.addDetector(yg),this.addDetector(vg)}addDetector(t){return this.detectors[t.name]=t,this}detect(t){t||(t=this.options.order);let n=[];return t.forEach(r=>{if(this.detectors[r]){let o=this.detectors[r].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(n=n.concat(o))}}),n=n.map(r=>this.options.convertDetectedLanguage(r)),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t,n){n||(n=this.options.caches),n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}Zc.type="languageDetector",pt.use(Gc).use(Zc).use(hp).init({fallbackLng:"en",interpolation:{escapeValue:!1},backend:{loadPath:"https://translations.piggy.eu/portal-sessions/{{lng}}.json"}});function wg({children:e,config:t,payload:n}){const[r,o]=H.useState("");return H.useEffect(()=>{r||(tt.initialize(t.apiKey,t.host),localStorage.setItem("apiKey",JSON.stringify(t.apiKey)),(async()=>{const a=await vo.create(n);o(a.data.data.uuid)})())},[t,n,r]),r?E.jsxs(H.StrictMode,{children:[E.jsx(ml,{...t,sessionUuid:r,children:E.jsx("div",{children:E.jsxs("div",{className:"flex h-screen w-screen flex-col bg-primary-50",children:[E.jsx("div",{className:"flex h-full overflow-auto",children:e}),r&&E.jsx(Cl,{})]})})}),E.jsx(ms,{position:"bottom-center"})]}):E.jsx(E.Fragment,{children:"Loading..."})}/**
|
|
73
|
+
`)===0?K.substr(1,K.length):K}).forEach(function(K){var Q=K.split(":"),Z=Q.shift().trim();if(Z){var ee=Q.join(":").trim();L.append(Z,ee)}}),L}S.call(O.prototype);function D(P,L){if(!(this instanceof D))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');L||(L={}),this.type="default",this.status=L.status===void 0?200:L.status,this.ok=this.status>=200&&this.status<300,this.statusText=L.statusText===void 0?"":""+L.statusText,this.headers=new c(L.headers),this.url=L.url||"",this._initBody(P)}S.call(D.prototype),D.prototype.clone=function(){return new D(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},D.error=function(){var P=new D(null,{status:0,statusText:""});return P.type="error",P};var M=[301,302,303,307,308];D.redirect=function(P,L){if(M.indexOf(L)===-1)throw new RangeError("Invalid status code");return new D(null,{status:L,headers:{location:P}})},s.DOMException=u.DOMException;try{new s.DOMException}catch{s.DOMException=function(L,q){this.message=L,this.name=q;var K=Error(L);this.stack=K.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function $(P,L){return new Promise(function(q,K){var Q=new O(P,L);if(Q.signal&&Q.signal.aborted)return K(new s.DOMException("Aborted","AbortError"));var Z=new XMLHttpRequest;function ee(){Z.abort()}Z.onload=function(){var ne={status:Z.status,statusText:Z.statusText,headers:I(Z.getAllResponseHeaders()||"")};ne.url="responseURL"in Z?Z.responseURL:ne.headers.get("X-Request-URL");var me="response"in Z?Z.response:Z.responseText;setTimeout(function(){q(new D(me,ne))},0)},Z.onerror=function(){setTimeout(function(){K(new TypeError("Network request failed"))},0)},Z.ontimeout=function(){setTimeout(function(){K(new TypeError("Network request failed"))},0)},Z.onabort=function(){setTimeout(function(){K(new s.DOMException("Aborted","AbortError"))},0)};function ue(ne){try{return ne===""&&u.location.href?u.location.href:ne}catch{return ne}}Z.open(Q.method,ue(Q.url),!0),Q.credentials==="include"?Z.withCredentials=!0:Q.credentials==="omit"&&(Z.withCredentials=!1),"responseType"in Z&&(f.blob?Z.responseType="blob":f.arrayBuffer&&Q.headers.get("Content-Type")&&Q.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(Z.responseType="arraybuffer")),L&&typeof L.headers=="object"&&!(L.headers instanceof c)?Object.getOwnPropertyNames(L.headers).forEach(function(ne){Z.setRequestHeader(ne,v(L.headers[ne]))}):Q.headers.forEach(function(ne,me){Z.setRequestHeader(me,ne)}),Q.signal&&(Q.signal.addEventListener("abort",ee),Z.onreadystatechange=function(){Z.readyState===4&&Q.signal.removeEventListener("abort",ee)}),Z.send(typeof Q._bodyInit>"u"?null:Q._bodyInit)})}return $.polyfill=!0,u.fetch||(u.fetch=$,u.Headers=c,u.Request=O,u.Response=D),s.Headers=c,s.Request=O,s.Response=D,s.fetch=$,s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var o=n.fetch?n:r;t=o.fetch,t.default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(Fo,Fo.exports)),Fo.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof Rn<"u"&&Rn.fetch?n=Rn.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof Gm<"u"&&typeof window>"u"){var r=n||Xm();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(ka,ka.exports);var Mc=ka.exports;const Fc=Xo(Mc),Uc=Ju({__proto__:null,default:Fc},[Mc]);function $c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Vc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$c(Object(n),!0).forEach(function(r){Jm(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$c(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Jm(e,t,n){return t=Ym(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ym(e){var t=Qm(e,"string");return Sn(t)=="symbol"?t:t+""}function Qm(e,t){if(Sn(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Sn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sn(e){"@babel/helpers - typeof";return Sn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sn(e)}var nn;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?nn=global.fetch:typeof window<"u"&&window.fetch?nn=window.fetch:nn=fetch);var Lr;Ic()&&(typeof global<"u"&&global.XMLHttpRequest?Lr=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Lr=window.XMLHttpRequest));var Uo;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?Uo=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(Uo=window.ActiveXObject)),!nn&&Uc&&!Lr&&!Uo&&(nn=Fc||Uc),typeof nn!="function"&&(nn=void 0);var Ca=function(t,n){if(n&&Sn(n)==="object"){var r="";for(var o in n)r+="&"+encodeURIComponent(o)+"="+encodeURIComponent(n[o]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},Hc=function(t,n,r,o){var a=function(f){if(!f.ok)return r(f.statusText||"Error",{status:f.status});f.text().then(function(g){r(null,{status:f.status,data:g})}).catch(r)};if(o){var s=o(t,n);if(s instanceof Promise){s.then(a).catch(r);return}}typeof fetch=="function"?fetch(t,n).then(a).catch(r):nn(t,n).then(a).catch(r)},zc=!1,Zm=function(t,n,r,o){t.queryStringParams&&(n=Ca(n,t.queryStringParams));var a=Vc({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(a["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),r&&(a["Content-Type"]="application/json");var s=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,u=Vc({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:a},zc?{}:s),f=typeof t.alternateFetch=="function"&&t.alternateFetch.length>=1?t.alternateFetch:void 0;try{Hc(n,u,o,f)}catch(g){if(!s||Object.keys(s).length===0||!g.message||g.message.indexOf("not implemented")<0)return o(g);try{Object.keys(s).forEach(function(h){delete u[h]}),Hc(n,u,o,f),zc=!0}catch(h){o(h)}}},eg=function(t,n,r,o){r&&Sn(r)==="object"&&(r=Ca("",r).slice(1)),t.queryStringParams&&(n=Ca(n,t.queryStringParams));try{var a;Lr?a=new Lr:a=new Uo("MSXML2.XMLHTTP.3.0"),a.open(r?"POST":"GET",n,1),t.crossDomain||a.setRequestHeader("X-Requested-With","XMLHttpRequest"),a.withCredentials=!!t.withCredentials,r&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.overrideMimeType&&a.overrideMimeType("application/json");var s=t.customHeaders;if(s=typeof s=="function"?s():s,s)for(var u in s)a.setRequestHeader(u,s[u]);a.onreadystatechange=function(){a.readyState>3&&o(a.status>=400?a.statusText:null,{status:a.status,data:a.responseText})},a.send(r)}catch(f){console&&console.log(f)}},tg=function(t,n,r,o){if(typeof r=="function"&&(o=r,r=void 0),o=o||function(){},nn&&n.indexOf("file:")!==0)return Zm(t,n,r,o);if(Ic()||typeof ActiveXObject=="function")return eg(t,n,r,o);o(new Error("No fetch and no xhr implementation found!"))};function zn(e){"@babel/helpers - typeof";return zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zn(e)}function qc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Ea(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qc(Object(n),!0).forEach(function(r){Kc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ng(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rg(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Wc(r.key),r)}}function og(e,t,n){return t&&rg(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kc(e,t,n){return t=Wc(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wc(e){var t=ig(e,"string");return zn(t)=="symbol"?t:t+""}function ig(e,t){if(zn(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(zn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ag=function(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:function(n){return JSON.parse(n)},stringify:JSON.stringify,parsePayload:function(n,r,o){return Kc({},r,o||"")},parseLoadPayload:function(n,r){},request:tg,reloadInterval:typeof window<"u"?!1:60*60*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},Gc=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ng(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return og(e,[{key:"init",value:function(n){var r=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=n,this.options=Ea(Ea(Ea({},ag()),this.options||{}),o),this.allOptions=a,this.services&&this.options.reloadInterval){var s=setInterval(function(){return r.reload()},this.options.reloadInterval);zn(s)==="object"&&typeof s.unref=="function"&&s.unref()}}},{key:"readMulti",value:function(n,r,o){this._readAny(n,n,r,r,o)}},{key:"read",value:function(n,r,o){this._readAny([n],n,[r],r,o)}},{key:"_readAny",value:function(n,r,o,a,s){var u=this,f=this.options.loadPath;typeof this.options.loadPath=="function"&&(f=this.options.loadPath(n,o)),f=Wm(f),f.then(function(g){if(!g)return s(null,{});var h=u.services.interpolator.interpolate(g,{lng:n.join("+"),ns:o.join("+")});u.loadUrl(h,s,r,a)})}},{key:"loadUrl",value:function(n,r,o,a){var s=this,u=typeof o=="string"?[o]:o,f=typeof a=="string"?[a]:a,g=this.options.parseLoadPayload(u,f);this.options.request(this.options,n,g,function(h,x){if(x&&(x.status>=500&&x.status<600||!x.status))return r("failed loading "+n+"; status code: "+x.status,!0);if(x&&x.status>=400&&x.status<500)return r("failed loading "+n+"; status code: "+x.status,!1);if(!x&&h&&h.message&&h.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+h.message,!0);if(h)return r(h,!1);var l,v;try{typeof x.data=="string"?l=s.options.parse(x.data,o,a):l=x.data}catch{v="failed parsing "+n+" to json"}if(v)return r(v,!1);r(null,l)})}},{key:"create",value:function(n,r,o,a,s){var u=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var f=this.options.parsePayload(r,o,a),g=0,h=[],x=[];n.forEach(function(l){var v=u.options.addPath;typeof u.options.addPath=="function"&&(v=u.options.addPath(l,r));var i=u.services.interpolator.interpolate(v,{lng:l,ns:r});u.options.request(u.options,i,f,function(c,p){g+=1,h.push(c),x.push(p),g===n.length&&typeof s=="function"&&s(h,x)})})}}},{key:"reload",value:function(){var n=this,r=this.services,o=r.backendConnector,a=r.languageUtils,s=r.logger,u=o.language;if(!(u&&u.toLowerCase()==="cimode")){var f=[],g=function(x){var l=a.toResolveHierarchy(x);l.forEach(function(v){f.indexOf(v)<0&&f.push(v)})};g(u),this.allOptions.preload&&this.allOptions.preload.forEach(function(h){return g(h)}),f.forEach(function(h){n.allOptions.ns.forEach(function(x){o.read(h,x,"read",null,null,function(l,v){l&&s.warn("loading namespace ".concat(x," for language ").concat(h," failed"),l),!l&&v&&s.log("loaded namespace ".concat(x," for language ").concat(h),v),o.loaded("".concat(h,"|").concat(x),l,v)})})})}}}])}();Gc.type="backend";const{slice:sg,forEach:lg}=[];function cg(e){return lg.call(sg.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}const Xc=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,ug=(e,t,n)=>{const r=n||{};r.path=r.path||"/";const o=encodeURIComponent(t);let a=`${e}=${o}`;if(r.maxAge>0){const s=r.maxAge-0;if(Number.isNaN(s))throw new Error("maxAge should be a Number");a+=`; Max-Age=${Math.floor(s)}`}if(r.domain){if(!Xc.test(r.domain))throw new TypeError("option domain is invalid");a+=`; Domain=${r.domain}`}if(r.path){if(!Xc.test(r.path))throw new TypeError("option path is invalid");a+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(a+="; HttpOnly"),r.secure&&(a+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return a},Jc={create(e,t,n,r){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+n*60*1e3)),r&&(o.domain=r),document.cookie=ug(e,encodeURIComponent(t),o)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let o=n[r];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return o.substring(t.length,o.length)}return null},remove(e){this.create(e,"",-1)}};var dg={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return Jc.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:a}=t;n&&typeof document<"u"&&Jc.create(n,e,r,o,a)}},fg={name:"querystring",lookup(e){var r;let{lookupQuerystring:t}=e,n;if(typeof window<"u"){let{search:o}=window.location;!window.location.search&&((r=window.location.hash)==null?void 0:r.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const s=o.substring(1).split("&");for(let u=0;u<s.length;u++){const f=s[u].indexOf("=");f>0&&s[u].substring(0,f)===t&&(n=s[u].substring(f+1))}}return n}};let Ir=null;const Yc=()=>{if(Ir!==null)return Ir;try{Ir=window!=="undefined"&&window.localStorage!==null;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Ir=!1}return Ir};var hg={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&Yc())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&Yc()&&window.localStorage.setItem(n,e)}};let Dr=null;const Qc=()=>{if(Dr!==null)return Dr;try{Dr=window!=="undefined"&&window.sessionStorage!==null;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Dr=!1}return Dr};var pg={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&Qc())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&Qc()&&window.sessionStorage.setItem(n,e)}},mg={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:o}=navigator;if(n)for(let a=0;a<n.length;a++)t.push(n[a]);r&&t.push(r),o&&t.push(o)}return t.length>0?t:void 0}},gg={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},yg={name:"path",lookup(e){var o;let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(o=n[typeof t=="number"?t:0])==null?void 0:o.replace("/",""):void 0}},vg={name:"subdomain",lookup(e){var o,a;let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window<"u"&&((a=(o=window.location)==null?void 0:o.hostname)==null?void 0:a.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[n]}};function bg(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e}}class Zc{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=cg(n,this.options||{},bg()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(dg),this.addDetector(fg),this.addDetector(hg),this.addDetector(pg),this.addDetector(mg),this.addDetector(gg),this.addDetector(yg),this.addDetector(vg)}addDetector(t){return this.detectors[t.name]=t,this}detect(t){t||(t=this.options.order);let n=[];return t.forEach(r=>{if(this.detectors[r]){let o=this.detectors[r].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(n=n.concat(o))}}),n=n.map(r=>this.options.convertDetectedLanguage(r)),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t,n){n||(n=this.options.caches),n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}Zc.type="languageDetector",pt.use(Gc).use(Zc).use(hp).init({fallbackLng:"en",interpolation:{escapeValue:!1},backend:{loadPath:"https://translations.piggy.eu/portal-sessions/{{lng}}.json"}});function wg({children:e,config:t,payload:n}){const[r,o]=H.useState("");return H.useEffect(()=>{r||(tt.initialize(t.apiKey,t.host),localStorage.setItem("apiKey",JSON.stringify(t.apiKey)),(async()=>{const a=await vo.create(n);o(a.data.data.uuid)})())},[t,n,r]),r?E.jsxs(H.StrictMode,{children:[E.jsx(ml,{...t,sessionUuid:r,children:E.jsx("div",{children:E.jsxs("div",{className:"bg-primary-50 flex h-screen w-screen flex-col",children:[E.jsx("div",{className:"flex h-full overflow-auto",children:e}),r&&E.jsx(Cl,{})]})})}),E.jsx(ms,{position:"bottom-center"})]}):E.jsx(E.Fragment,{children:"Loading..."})}/**
|
|
74
74
|
* @remix-run/router v1.16.1
|
|
75
75
|
*
|
|
76
76
|
* Copyright (c) Remix Software Inc.
|
|
@@ -81,7 +81,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
81
81
|
* @license MIT
|
|
82
82
|
*/function nt(){return nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nt.apply(this,arguments)}var at;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(at||(at={}));function xg(e){e===void 0&&(e={});let{initialEntries:t=["/"],initialIndex:n,v5Compat:r=!1}=e,o;o=t.map((v,i)=>h(v,typeof v=="string"?null:v.state,i===0?"default":void 0));let a=f(n??o.length-1),s=at.Pop,u=null;function f(v){return Math.min(Math.max(v,0),o.length-1)}function g(){return o[a]}function h(v,i,c){i===void 0&&(i=null);let p=Sa(o?g().pathname:"/",v,i,c);return ct(p.pathname.charAt(0)==="/","relative pathnames are not supported in memory history: "+JSON.stringify(v)),p}function x(v){return typeof v=="string"?v:Pn(v)}return{get index(){return a},get action(){return s},get location(){return g()},createHref:x,createURL(v){return new URL(x(v),"http://localhost")},encodeLocation(v){let i=typeof v=="string"?rn(v):v;return{pathname:i.pathname||"",search:i.search||"",hash:i.hash||""}},push(v,i){s=at.Push;let c=h(v,i);a+=1,o.splice(a,o.length,c),r&&u&&u({action:s,location:c,delta:1})},replace(v,i){s=at.Replace;let c=h(v,i);o[a]=c,r&&u&&u({action:s,location:c,delta:0})},go(v){s=at.Pop;let i=f(a+v),c=o[i];a=i,u&&u({action:s,location:c,delta:v})},listen(v){return u=v,()=>{u=null}}}}function ke(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ct(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function kg(){return Math.random().toString(36).substr(2,8)}function Sa(e,t,n,r){return n===void 0&&(n=null),nt({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?rn(t):t,{state:n,key:t&&t.key||r||kg()})}function Pn(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function rn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}var Ze;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Ze||(Ze={}));const Cg=new Set(["lazy","caseSensitive","path","id","index","children"]);function Eg(e){return e.index===!0}function Pa(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((o,a)=>{let s=[...n,a],u=typeof o.id=="string"?o.id:s.join("-");if(ke(o.index!==!0||!o.children,"Cannot specify children on an index route"),ke(!r[u],'Found a route id collision on id "'+u+`". Route id's must be globally unique within Data Router usages`),Eg(o)){let f=nt({},o,t(o),{id:u});return r[u]=f,f}else{let f=nt({},o,t(o),{id:u,children:void 0});return r[u]=f,o.children&&(f.children=Pa(o.children,t,s,r)),f}})}function qn(e,t,n){n===void 0&&(n="/");let r=typeof t=="string"?rn(t):t,o=Vt(r.pathname||"/",n);if(o==null)return null;let a=eu(e);Pg(a);let s=null;for(let u=0;s==null&&u<a.length;++u){let f=Dg(o);s=Lg(a[u],f)}return s}function Sg(e,t){let{route:n,pathname:r,params:o}=e;return{id:n.id,pathname:r,params:o,data:t[n.id],handle:n.handle}}function eu(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let o=(a,s,u)=>{let f={relativePath:u===void 0?a.path||"":u,caseSensitive:a.caseSensitive===!0,childrenIndex:s,route:a};f.relativePath.startsWith("/")&&(ke(f.relativePath.startsWith(r),'Absolute route path "'+f.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),f.relativePath=f.relativePath.slice(r.length));let g=Qt([r,f.relativePath]),h=n.concat(f);a.children&&a.children.length>0&&(ke(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+g+'".')),eu(a.children,t,h,g)),!(a.path==null&&!a.index)&&t.push({path:g,score:jg(g,a.index),routesMeta:h})};return e.forEach((a,s)=>{var u;if(a.path===""||!((u=a.path)!=null&&u.includes("?")))o(a,s);else for(let f of tu(a.path))o(a,s,f)}),t}function tu(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return o?[a,""]:[a];let s=tu(r.join("/")),u=[];return u.push(...s.map(f=>f===""?a:[a,f].join("/"))),o&&u.push(...s),u.map(f=>e.startsWith("/")&&f===""?"/":f)}function Pg(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Ag(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Bg=/^:[\w-]+$/,Og=3,_g=2,Rg=1,Tg=10,Ng=-2,nu=e=>e==="*";function jg(e,t){let n=e.split("/"),r=n.length;return n.some(nu)&&(r+=Ng),t&&(r+=_g),n.filter(o=>!nu(o)).reduce((o,a)=>o+(Bg.test(a)?Og:a===""?Rg:Tg),r)}function Ag(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function Lg(e,t){let{routesMeta:n}=e,r={},o="/",a=[];for(let s=0;s<n.length;++s){let u=n[s],f=s===n.length-1,g=o==="/"?t:t.slice(o.length)||"/",h=Ba({path:u.relativePath,caseSensitive:u.caseSensitive,end:f},g);if(!h)return null;Object.assign(r,h.params);let x=u.route;a.push({params:r,pathname:Qt([o,h.pathname]),pathnameBase:Ug(Qt([o,h.pathnameBase])),route:x}),h.pathnameBase!=="/"&&(o=Qt([o,h.pathnameBase]))}return a}function Ba(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Ig(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let a=o[0],s=a.replace(/(.)\/+$/,"$1"),u=o.slice(1);return{params:r.reduce((g,h,x)=>{let{paramName:l,isOptional:v}=h;if(l==="*"){let c=u[x]||"";s=a.slice(0,a.length-c.length).replace(/(.)\/+$/,"$1")}const i=u[x];return v&&!i?g[l]=void 0:g[l]=(i||"").replace(/%2F/g,"/"),g},{}),pathname:a,pathnameBase:s,pattern:e}}function Ig(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),ct(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,u,f)=>(r.push({paramName:u,isOptional:f!=null}),f?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function Dg(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ct(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Vt(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function Mg(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?rn(e):e;return{pathname:n?n.startsWith("/")?n:Fg(n,t):t,search:$g(r),hash:Vg(o)}}function Fg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function Oa(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function ru(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function _a(e,t){let n=ru(e);return t?n.map((r,o)=>o===e.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Ra(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=rn(e):(o=nt({},e),ke(!o.pathname||!o.pathname.includes("?"),Oa("?","pathname","search",o)),ke(!o.pathname||!o.pathname.includes("#"),Oa("#","pathname","hash",o)),ke(!o.search||!o.search.includes("#"),Oa("#","search","hash",o)));let a=e===""||o.pathname==="",s=a?"/":o.pathname,u;if(s==null)u=n;else{let x=t.length-1;if(!r&&s.startsWith("..")){let l=s.split("/");for(;l[0]==="..";)l.shift(),x-=1;o.pathname=l.join("/")}u=x>=0?t[x]:"/"}let f=Mg(o,u),g=s&&s!=="/"&&s.endsWith("/"),h=(a||s===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(g||h)&&(f.pathname+="/"),f}const Qt=e=>e.join("/").replace(/\/\/+/g,"/"),Ug=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),$g=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Vg=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class ou{constructor(t,n,r,o){o===void 0&&(o=!1),this.status=t,this.statusText=n||"",this.internal=o,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function Ta(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const iu=["post","put","patch","delete"],Hg=new Set(iu),zg=["get",...iu],qg=new Set(zg),Kg=new Set([301,302,303,307,308]),Wg=new Set([307,308]),Na={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Gg={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Mr={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},ja=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Xg=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),au="remix-router-transitions";function Jg(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",r=!n;ke(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let o;if(e.mapRouteProperties)o=e.mapRouteProperties;else if(e.detectErrorBoundary){let A=e.detectErrorBoundary;o=z=>({hasErrorBoundary:A(z)})}else o=Xg;let a={},s=Pa(e.routes,o,void 0,a),u,f=e.basename||"/",g=e.unstable_dataStrategy||ey,h=nt({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,unstable_skipActionErrorRevalidation:!1},e.future),x=null,l=new Set,v=null,i=null,c=null,p=e.hydrationData!=null,d=qn(s,e.history.location,f),m=null;if(d==null){let A=Nt(404,{pathname:e.history.location.pathname}),{matches:z,route:Y}=yu(s);d=z,m={[Y.id]:A}}let y,b=d.some(A=>A.route.lazy),C=d.some(A=>A.route.loader);if(b)y=!1;else if(!C)y=!0;else if(h.v7_partialHydration){let A=e.hydrationData?e.hydrationData.loaderData:null,z=e.hydrationData?e.hydrationData.errors:null,Y=ie=>ie.route.loader?typeof ie.route.loader=="function"&&ie.route.loader.hydrate===!0?!1:A&&A[ie.route.id]!==void 0||z&&z[ie.route.id]!==void 0:!0;if(z){let ie=d.findIndex(he=>z[he.route.id]!==void 0);y=d.slice(0,ie+1).every(Y)}else y=d.every(Y)}else y=e.hydrationData!=null;let S,k={historyAction:e.history.action,location:e.history.location,matches:d,initialized:y,navigation:Na,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||m,fetchers:new Map,blockers:new Map},B=at.Pop,O=!1,j,I=!1,D=new Map,M=null,$=!1,P=!1,L=[],q=[],K=new Map,Q=0,Z=-1,ee=new Map,ue=new Set,ne=new Map,me=new Map,de=new Set,V=new Map,U=new Map,J=!1;function w(){if(x=e.history.listen(A=>{let{action:z,location:Y,delta:ie}=A;if(J){J=!1;return}ct(U.size===0||ie!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let he=Wt({currentLocation:k.location,nextLocation:Y,historyAction:z});if(he&&ie!=null){J=!0,e.history.go(ie*-1),ht(he,{state:"blocked",location:Y,proceed(){ht(he,{state:"proceeding",proceed:void 0,reset:void 0,location:Y}),e.history.go(ie)},reset(){let Pe=new Map(k.blockers);Pe.set(he,Mr),R({blockers:Pe})}});return}return F(z,Y)}),n){fy(t,D);let A=()=>hy(t,D);t.addEventListener("pagehide",A),M=()=>t.removeEventListener("pagehide",A)}return k.initialized||F(at.Pop,k.location,{initialHydration:!0}),S}function _(){x&&x(),M&&M(),l.clear(),j&&j.abort(),k.fetchers.forEach((A,z)=>wt(z)),k.blockers.forEach((A,z)=>mt(z))}function N(A){return l.add(A),()=>l.delete(A)}function R(A,z){z===void 0&&(z={}),k=nt({},k,A);let Y=[],ie=[];h.v7_fetcherPersist&&k.fetchers.forEach((he,Pe)=>{he.state==="idle"&&(de.has(Pe)?ie.push(Pe):Y.push(Pe))}),[...l].forEach(he=>he(k,{deletedFetchers:ie,unstable_viewTransitionOpts:z.viewTransitionOpts,unstable_flushSync:z.flushSync===!0})),h.v7_fetcherPersist&&(Y.forEach(he=>k.fetchers.delete(he)),ie.forEach(he=>wt(he)))}function W(A,z,Y){var ie,he;let{flushSync:Pe}=Y===void 0?{}:Y,we=k.actionData!=null&&k.navigation.formMethod!=null&&Ht(k.navigation.formMethod)&&k.navigation.state==="loading"&&((ie=A.state)==null?void 0:ie._isRedirect)!==!0,ve;z.actionData?Object.keys(z.actionData).length>0?ve=z.actionData:ve=null:we?ve=k.actionData:ve=null;let Re=z.loaderData?mu(k.loaderData,z.loaderData,z.matches||[],z.errors):k.loaderData,_e=k.blockers;_e.size>0&&(_e=new Map(_e),_e.forEach((Se,T)=>_e.set(T,Mr)));let dt=O===!0||k.navigation.formMethod!=null&&Ht(k.navigation.formMethod)&&((he=A.state)==null?void 0:he._isRedirect)!==!0;u&&(s=u,u=void 0),$||B===at.Pop||(B===at.Push?e.history.push(A,A.state):B===at.Replace&&e.history.replace(A,A.state));let ft;if(B===at.Pop){let Se=D.get(k.location.pathname);Se&&Se.has(A.pathname)?ft={currentLocation:k.location,nextLocation:A}:D.has(A.pathname)&&(ft={currentLocation:A,nextLocation:k.location})}else if(I){let Se=D.get(k.location.pathname);Se?Se.add(A.pathname):(Se=new Set([A.pathname]),D.set(k.location.pathname,Se)),ft={currentLocation:k.location,nextLocation:A}}R(nt({},z,{actionData:ve,loaderData:Re,historyAction:B,location:A,initialized:!0,navigation:Na,revalidation:"idle",restoreScrollPosition:on(A,z.matches||k.matches),preventScrollReset:dt,blockers:_e}),{viewTransitionOpts:ft,flushSync:Pe===!0}),B=at.Pop,O=!1,I=!1,$=!1,P=!1,L=[],q=[]}async function G(A,z){if(typeof A=="number"){e.history.go(A);return}let Y=Aa(k.location,k.matches,f,h.v7_prependBasename,A,h.v7_relativeSplatPath,z==null?void 0:z.fromRouteId,z==null?void 0:z.relative),{path:ie,submission:he,error:Pe}=su(h.v7_normalizeFormMethod,!1,Y,z),we=k.location,ve=Sa(k.location,ie,z&&z.state);ve=nt({},ve,e.history.encodeLocation(ve));let Re=z&&z.replace!=null?z.replace:void 0,_e=at.Push;Re===!0?_e=at.Replace:Re===!1||he!=null&&Ht(he.formMethod)&&he.formAction===k.location.pathname+k.location.search&&(_e=at.Replace);let dt=z&&"preventScrollReset"in z?z.preventScrollReset===!0:void 0,ft=(z&&z.unstable_flushSync)===!0,Se=Wt({currentLocation:we,nextLocation:ve,historyAction:_e});if(Se){ht(Se,{state:"blocked",location:ve,proceed(){ht(Se,{state:"proceeding",proceed:void 0,reset:void 0,location:ve}),G(A,z)},reset(){let T=new Map(k.blockers);T.set(Se,Mr),R({blockers:T})}});return}return await F(_e,ve,{submission:he,pendingError:Pe,preventScrollReset:dt,replace:z&&z.replace,enableViewTransition:z&&z.unstable_viewTransition,flushSync:ft})}function X(){if(Fe(),R({revalidation:"loading"}),k.navigation.state!=="submitting"){if(k.navigation.state==="idle"){F(k.historyAction,k.location,{startUninterruptedRevalidation:!0});return}F(B||k.historyAction,k.navigation.location,{overrideNavigation:k.navigation})}}async function F(A,z,Y){j&&j.abort(),j=null,B=A,$=(Y&&Y.startUninterruptedRevalidation)===!0,xt(k.location,k.matches),O=(Y&&Y.preventScrollReset)===!0,I=(Y&&Y.enableViewTransition)===!0;let ie=u||s,he=Y&&Y.overrideNavigation,Pe=qn(ie,z,f),we=(Y&&Y.flushSync)===!0;if(!Pe){let Se=Nt(404,{pathname:z.pathname}),{matches:T,route:se}=yu(ie);gt(),W(z,{matches:T,loaderData:{},errors:{[se.id]:Se}},{flushSync:we});return}if(k.initialized&&!P&&ay(k.location,z)&&!(Y&&Y.submission&&Ht(Y.submission.formMethod))){W(z,{matches:Pe},{flushSync:we});return}j=new AbortController;let ve=Kn(e.history,z,j.signal,Y&&Y.submission),Re;if(Y&&Y.pendingError)Re=[Fr(Pe).route.id,{type:Ze.error,error:Y.pendingError}];else if(Y&&Y.submission&&Ht(Y.submission.formMethod)){let Se=await ce(ve,z,Y.submission,Pe,{replace:Y.replace,flushSync:we});if(Se.shortCircuited)return;Re=Se.pendingActionResult,he=Ma(z,Y.submission),we=!1,ve=Kn(e.history,ve.url,ve.signal)}let{shortCircuited:_e,loaderData:dt,errors:ft}=await fe(ve,z,Pe,he,Y&&Y.submission,Y&&Y.fetcherSubmission,Y&&Y.replace,Y&&Y.initialHydration===!0,we,Re);_e||(j=null,W(z,nt({matches:Pe},gu(Re),{loaderData:dt,errors:ft})))}async function ce(A,z,Y,ie,he){he===void 0&&(he={}),Fe();let Pe=uy(z,Y);R({navigation:Pe},{flushSync:he.flushSync===!0});let we,ve=Da(ie,z);if(!ve.route.action&&!ve.route.lazy)we={type:Ze.error,error:Nt(405,{method:A.method,pathname:z.pathname,routeId:ve.route.id})};else if(we=(await be("action",A,[ve],ie))[0],A.signal.aborted)return{shortCircuited:!0};if(On(we)){let Re;return he&&he.replace!=null?Re=he.replace:Re=fu(we.response.headers.get("Location"),new URL(A.url),f)===k.location.pathname+k.location.search,await ae(A,we,{submission:Y,replace:Re}),{shortCircuited:!0}}if(Bn(we))throw Nt(400,{type:"defer-action"});if(jt(we)){let Re=Fr(ie,ve.route.id);return(he&&he.replace)!==!0&&(B=at.Push),{pendingActionResult:[Re.route.id,we]}}return{pendingActionResult:[ve.route.id,we]}}async function fe(A,z,Y,ie,he,Pe,we,ve,Re,_e){let dt=ie||Ma(z,he),ft=he||Pe||Cu(dt),Se=u||s,[T,se]=lu(e.history,k,Y,ft,z,h.v7_partialHydration&&ve===!0,h.unstable_skipActionErrorRevalidation,P,L,q,de,ne,ue,Se,f,_e);if(gt(Oe=>!(Y&&Y.some(rt=>rt.route.id===Oe))||T&&T.some(rt=>rt.route.id===Oe)),Z=++Q,T.length===0&&se.length===0){let Oe=Ee();return W(z,nt({matches:Y,loaderData:{},errors:_e&&jt(_e[1])?{[_e[0]]:_e[1].error}:null},gu(_e),Oe?{fetchers:new Map(k.fetchers)}:{}),{flushSync:Re}),{shortCircuited:!0}}if(!$&&(!h.v7_partialHydration||!ve)){se.forEach(rt=>{let lt=k.fetchers.get(rt.key),He=Ur(void 0,lt?lt.data:void 0);k.fetchers.set(rt.key,He)});let Oe;_e&&!jt(_e[1])?Oe={[_e[0]]:_e[1].data}:k.actionData&&(Object.keys(k.actionData).length===0?Oe=null:Oe=k.actionData),R(nt({navigation:dt},Oe!==void 0?{actionData:Oe}:{},se.length>0?{fetchers:new Map(k.fetchers)}:{}),{flushSync:Re})}se.forEach(Oe=>{K.has(Oe.key)&&et(Oe.key),Oe.controller&&K.set(Oe.key,Oe.controller)});let ye=()=>se.forEach(Oe=>et(Oe.key));j&&j.signal.addEventListener("abort",ye);let{loaderResults:xe,fetcherResults:Ie}=await Ce(k.matches,Y,T,se,A);if(A.signal.aborted)return{shortCircuited:!0};j&&j.signal.removeEventListener("abort",ye),se.forEach(Oe=>K.delete(Oe.key));let Ue=vu([...xe,...Ie]);if(Ue){if(Ue.idx>=T.length){let Oe=se[Ue.idx-T.length].key;ue.add(Oe)}return await ae(A,Ue.result,{replace:we}),{shortCircuited:!0}}let{loaderData:je,errors:Be}=pu(k,Y,T,xe,_e,se,Ie,V);V.forEach((Oe,rt)=>{Oe.subscribe(lt=>{(lt||Oe.done)&&V.delete(rt)})}),h.v7_partialHydration&&ve&&k.errors&&Object.entries(k.errors).filter(Oe=>{let[rt]=Oe;return!T.some(lt=>lt.route.id===rt)}).forEach(Oe=>{let[rt,lt]=Oe;Be=Object.assign(Be||{},{[rt]:lt})});let st=Ee(),Ge=Lt(Z),Xe=st||Ge||se.length>0;return nt({loaderData:je,errors:Be},Xe?{fetchers:new Map(k.fetchers)}:{})}function re(A,z,Y,ie){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");K.has(A)&&et(A);let he=(ie&&ie.unstable_flushSync)===!0,Pe=u||s,we=Aa(k.location,k.matches,f,h.v7_prependBasename,Y,h.v7_relativeSplatPath,z,ie==null?void 0:ie.relative),ve=qn(Pe,we,f);if(!ve){Ve(A,z,Nt(404,{pathname:we}),{flushSync:he});return}let{path:Re,submission:_e,error:dt}=su(h.v7_normalizeFormMethod,!0,we,ie);if(dt){Ve(A,z,dt,{flushSync:he});return}let ft=Da(ve,Re);if(O=(ie&&ie.preventScrollReset)===!0,_e&&Ht(_e.formMethod)){oe(A,z,Re,ft,ve,he,_e);return}ne.set(A,{routeId:z,path:Re}),ge(A,z,Re,ft,ve,he,_e)}async function oe(A,z,Y,ie,he,Pe,we){if(Fe(),ne.delete(A),!ie.route.action&&!ie.route.lazy){let He=Nt(405,{method:we.formMethod,pathname:Y,routeId:z});Ve(A,z,He,{flushSync:Pe});return}let ve=k.fetchers.get(A);Ae(A,dy(we,ve),{flushSync:Pe});let Re=new AbortController,_e=Kn(e.history,Y,Re.signal,we);K.set(A,Re);let dt=Q,Se=(await be("action",_e,[ie],he))[0];if(_e.signal.aborted){K.get(A)===Re&&K.delete(A);return}if(h.v7_fetcherPersist&&de.has(A)){if(On(Se)||jt(Se)){Ae(A,yn(void 0));return}}else{if(On(Se))if(K.delete(A),Z>dt){Ae(A,yn(void 0));return}else return ue.add(A),Ae(A,Ur(we)),ae(_e,Se,{fetcherSubmission:we});if(jt(Se)){Ve(A,z,Se.error);return}}if(Bn(Se))throw Nt(400,{type:"defer-action"});let T=k.navigation.location||k.location,se=Kn(e.history,T,Re.signal),ye=u||s,xe=k.navigation.state!=="idle"?qn(ye,k.navigation.location,f):k.matches;ke(xe,"Didn't find any matches after fetcher action");let Ie=++Q;ee.set(A,Ie);let Ue=Ur(we,Se.data);k.fetchers.set(A,Ue);let[je,Be]=lu(e.history,k,xe,we,T,!1,h.unstable_skipActionErrorRevalidation,P,L,q,de,ne,ue,ye,f,[ie.route.id,Se]);Be.filter(He=>He.key!==A).forEach(He=>{let an=He.key,Go=k.fetchers.get(an),Wa=Ur(void 0,Go?Go.data:void 0);k.fetchers.set(an,Wa),K.has(an)&&et(an),He.controller&&K.set(an,He.controller)}),R({fetchers:new Map(k.fetchers)});let st=()=>Be.forEach(He=>et(He.key));Re.signal.addEventListener("abort",st);let{loaderResults:Ge,fetcherResults:Xe}=await Ce(k.matches,xe,je,Be,se);if(Re.signal.aborted)return;Re.signal.removeEventListener("abort",st),ee.delete(A),K.delete(A),Be.forEach(He=>K.delete(He.key));let Oe=vu([...Ge,...Xe]);if(Oe){if(Oe.idx>=je.length){let He=Be[Oe.idx-je.length].key;ue.add(He)}return ae(se,Oe.result)}let{loaderData:rt,errors:lt}=pu(k,k.matches,je,Ge,void 0,Be,Xe,V);if(k.fetchers.has(A)){let He=yn(Se.data);k.fetchers.set(A,He)}Lt(Ie),k.navigation.state==="loading"&&Ie>Z?(ke(B,"Expected pending action"),j&&j.abort(),W(k.navigation.location,{matches:xe,loaderData:rt,errors:lt,fetchers:new Map(k.fetchers)})):(R({errors:lt,loaderData:mu(k.loaderData,rt,xe,lt),fetchers:new Map(k.fetchers)}),P=!1)}async function ge(A,z,Y,ie,he,Pe,we){let ve=k.fetchers.get(A);Ae(A,Ur(we,ve?ve.data:void 0),{flushSync:Pe});let Re=new AbortController,_e=Kn(e.history,Y,Re.signal);K.set(A,Re);let dt=Q,Se=(await be("loader",_e,[ie],he))[0];if(Bn(Se)&&(Se=await ku(Se,_e.signal,!0)||Se),K.get(A)===Re&&K.delete(A),!_e.signal.aborted){if(de.has(A)){Ae(A,yn(void 0));return}if(On(Se))if(Z>dt){Ae(A,yn(void 0));return}else{ue.add(A),await ae(_e,Se);return}if(jt(Se)){Ve(A,z,Se.error);return}ke(!Bn(Se),"Unhandled fetcher deferred data"),Ae(A,yn(Se.data))}}async function ae(A,z,Y){let{submission:ie,fetcherSubmission:he,replace:Pe}=Y===void 0?{}:Y;z.response.headers.has("X-Remix-Revalidate")&&(P=!0);let we=z.response.headers.get("Location");ke(we,"Expected a Location header on the redirect Response"),we=fu(we,new URL(A.url),f);let ve=Sa(k.location,we,{_isRedirect:!0});if(n){let T=!1;if(z.response.headers.has("X-Remix-Reload-Document"))T=!0;else if(ja.test(we)){const se=e.history.createURL(we);T=se.origin!==t.location.origin||Vt(se.pathname,f)==null}if(T){Pe?t.location.replace(we):t.location.assign(we);return}}j=null;let Re=Pe===!0?at.Replace:at.Push,{formMethod:_e,formAction:dt,formEncType:ft}=k.navigation;!ie&&!he&&_e&&dt&&ft&&(ie=Cu(k.navigation));let Se=ie||he;if(Wg.has(z.response.status)&&Se&&Ht(Se.formMethod))await F(Re,ve,{submission:nt({},Se,{formAction:we}),preventScrollReset:O});else{let T=Ma(ve,ie);await F(Re,ve,{overrideNavigation:T,fetcherSubmission:he,preventScrollReset:O})}}async function be(A,z,Y,ie){try{let he=await ty(g,A,z,Y,ie,a,o);return await Promise.all(he.map((Pe,we)=>{if(sy(Pe)){let ve=Pe.result;return{type:Ze.redirect,response:oy(ve,z,Y[we].route.id,ie,f,h.v7_relativeSplatPath)}}return ry(Pe)}))}catch(he){return Y.map(()=>({type:Ze.error,error:he}))}}async function Ce(A,z,Y,ie,he){let[Pe,...we]=await Promise.all([Y.length?be("loader",he,Y,z):[],...ie.map(ve=>{if(ve.matches&&ve.match&&ve.controller){let Re=Kn(e.history,ve.path,ve.controller.signal);return be("loader",Re,[ve.match],ve.matches).then(_e=>_e[0])}else return Promise.resolve({type:Ze.error,error:Nt(404,{pathname:ve.path})})})]);return await Promise.all([xu(A,Y,Pe,Pe.map(()=>he.signal),!1,k.loaderData),xu(A,ie.map(ve=>ve.match),we,ie.map(ve=>ve.controller?ve.controller.signal:null),!0)]),{loaderResults:Pe,fetcherResults:we}}function Fe(){P=!0,L.push(...gt()),ne.forEach((A,z)=>{K.has(z)&&(q.push(z),et(z))})}function Ae(A,z,Y){Y===void 0&&(Y={}),k.fetchers.set(A,z),R({fetchers:new Map(k.fetchers)},{flushSync:(Y&&Y.flushSync)===!0})}function Ve(A,z,Y,ie){ie===void 0&&(ie={});let he=Fr(k.matches,z);wt(A),R({errors:{[he.route.id]:Y},fetchers:new Map(k.fetchers)},{flushSync:(ie&&ie.flushSync)===!0})}function ze(A){return h.v7_fetcherPersist&&(me.set(A,(me.get(A)||0)+1),de.has(A)&&de.delete(A)),k.fetchers.get(A)||Gg}function wt(A){let z=k.fetchers.get(A);K.has(A)&&!(z&&z.state==="loading"&&ee.has(A))&&et(A),ne.delete(A),ee.delete(A),ue.delete(A),de.delete(A),k.fetchers.delete(A)}function Ke(A){if(h.v7_fetcherPersist){let z=(me.get(A)||0)-1;z<=0?(me.delete(A),de.add(A)):me.set(A,z)}else wt(A);R({fetchers:new Map(k.fetchers)})}function et(A){let z=K.get(A);ke(z,"Expected fetch controller: "+A),z.abort(),K.delete(A)}function We(A){for(let z of A){let Y=ze(z),ie=yn(Y.data);k.fetchers.set(z,ie)}}function Ee(){let A=[],z=!1;for(let Y of ue){let ie=k.fetchers.get(Y);ke(ie,"Expected fetcher: "+Y),ie.state==="loading"&&(ue.delete(Y),A.push(Y),z=!0)}return We(A),z}function Lt(A){let z=[];for(let[Y,ie]of ee)if(ie<A){let he=k.fetchers.get(Y);ke(he,"Expected fetcher: "+Y),he.state==="loading"&&(et(Y),ee.delete(Y),z.push(Y))}return We(z),z.length>0}function ut(A,z){let Y=k.blockers.get(A)||Mr;return U.get(A)!==z&&U.set(A,z),Y}function mt(A){k.blockers.delete(A),U.delete(A)}function ht(A,z){let Y=k.blockers.get(A)||Mr;ke(Y.state==="unblocked"&&z.state==="blocked"||Y.state==="blocked"&&z.state==="blocked"||Y.state==="blocked"&&z.state==="proceeding"||Y.state==="blocked"&&z.state==="unblocked"||Y.state==="proceeding"&&z.state==="unblocked","Invalid blocker state transition: "+Y.state+" -> "+z.state);let ie=new Map(k.blockers);ie.set(A,z),R({blockers:ie})}function Wt(A){let{currentLocation:z,nextLocation:Y,historyAction:ie}=A;if(U.size===0)return;U.size>1&&ct(!1,"A router only supports one blocker at a time");let he=Array.from(U.entries()),[Pe,we]=he[he.length-1],ve=k.blockers.get(Pe);if(!(ve&&ve.state==="proceeding")&&we({currentLocation:z,nextLocation:Y,historyAction:ie}))return Pe}function gt(A){let z=[];return V.forEach((Y,ie)=>{(!A||A(ie))&&(Y.cancel(),z.push(ie),V.delete(ie))}),z}function Bt(A,z,Y){if(v=A,c=z,i=Y||null,!p&&k.navigation===Na){p=!0;let ie=on(k.location,k.matches);ie!=null&&R({restoreScrollPosition:ie})}return()=>{v=null,c=null,i=null}}function yt(A,z){return i&&i(A,z.map(ie=>Sg(ie,k.loaderData)))||A.key}function xt(A,z){if(v&&c){let Y=yt(A,z);v[Y]=c()}}function on(A,z){if(v){let Y=yt(A,z),ie=v[Y];if(typeof ie=="number")return ie}return null}function _n(A){a={},u=Pa(A,o,void 0,a)}return S={get basename(){return f},get future(){return h},get state(){return k},get routes(){return s},get window(){return t},initialize:w,subscribe:N,enableScrollRestoration:Bt,navigate:G,fetch:re,revalidate:X,createHref:A=>e.history.createHref(A),encodeLocation:A=>e.history.encodeLocation(A),getFetcher:ze,deleteFetcher:Ke,dispose:_,getBlocker:ut,deleteBlocker:mt,_internalFetchControllers:K,_internalActiveDeferreds:V,_internalSetRoutes:_n},S}function Yg(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Aa(e,t,n,r,o,a,s,u){let f,g;if(s){f=[];for(let x of t)if(f.push(x),x.route.id===s){g=x;break}}else f=t,g=t[t.length-1];let h=Ra(o||".",_a(f,a),Vt(e.pathname,n)||e.pathname,u==="path");return o==null&&(h.search=e.search,h.hash=e.hash),(o==null||o===""||o===".")&&g&&g.route.index&&!Ia(h.search)&&(h.search=h.search?h.search.replace(/^\?/,"?index&"):"?index"),r&&n!=="/"&&(h.pathname=h.pathname==="/"?n:Qt([n,h.pathname])),Pn(h)}function su(e,t,n,r){if(!r||!Yg(r))return{path:n};if(r.formMethod&&!cy(r.formMethod))return{path:n,error:Nt(405,{method:r.formMethod})};let o=()=>({path:n,error:Nt(400,{type:"invalid-body"})}),a=r.formMethod||"get",s=e?a.toUpperCase():a.toLowerCase(),u=bu(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!Ht(s))return o();let l=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((v,i)=>{let[c,p]=i;return""+v+c+"="+p+`
|
|
83
83
|
`},""):String(r.body);return{path:n,submission:{formMethod:s,formAction:u,formEncType:r.formEncType,formData:void 0,json:void 0,text:l}}}else if(r.formEncType==="application/json"){if(!Ht(s))return o();try{let l=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:s,formAction:u,formEncType:r.formEncType,formData:void 0,json:l,text:void 0}}}catch{return o()}}}ke(typeof FormData=="function","FormData is not available in this environment");let f,g;if(r.formData)f=La(r.formData),g=r.formData;else if(r.body instanceof FormData)f=La(r.body),g=r.body;else if(r.body instanceof URLSearchParams)f=r.body,g=hu(f);else if(r.body==null)f=new URLSearchParams,g=new FormData;else try{f=new URLSearchParams(r.body),g=hu(f)}catch{return o()}let h={formMethod:s,formAction:u,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:g,json:void 0,text:void 0};if(Ht(h.formMethod))return{path:n,submission:h};let x=rn(n);return t&&x.search&&Ia(x.search)&&f.append("index",""),x.search="?"+f,{path:Pn(x),submission:h}}function Qg(e,t){let n=e;if(t){let r=e.findIndex(o=>o.route.id===t);r>=0&&(n=e.slice(0,r))}return n}function lu(e,t,n,r,o,a,s,u,f,g,h,x,l,v,i,c){let p=c?jt(c[1])?c[1].error:c[1].data:void 0,d=e.createURL(t.location),m=e.createURL(o),y=c&&jt(c[1])?c[0]:void 0,b=y?Qg(n,y):n,C=c?c[1].statusCode:void 0,S=s&&C&&C>=400,k=b.filter((O,j)=>{let{route:I}=O;if(I.lazy)return!0;if(I.loader==null)return!1;if(a)return typeof I.loader!="function"||I.loader.hydrate?!0:t.loaderData[I.id]===void 0&&(!t.errors||t.errors[I.id]===void 0);if(Zg(t.loaderData,t.matches[j],O)||f.some($=>$===O.route.id))return!0;let D=t.matches[j],M=O;return uu(O,nt({currentUrl:d,currentParams:D.params,nextUrl:m,nextParams:M.params},r,{actionResult:p,unstable_actionStatus:C,defaultShouldRevalidate:S?!1:u||d.pathname+d.search===m.pathname+m.search||d.search!==m.search||cu(D,M)}))}),B=[];return x.forEach((O,j)=>{if(a||!n.some(P=>P.route.id===O.routeId)||h.has(j))return;let I=qn(v,O.path,i);if(!I){B.push({key:j,routeId:O.routeId,path:O.path,matches:null,match:null,controller:null});return}let D=t.fetchers.get(j),M=Da(I,O.path),$=!1;l.has(j)?$=!1:g.includes(j)?$=!0:D&&D.state!=="idle"&&D.data===void 0?$=u:$=uu(M,nt({currentUrl:d,currentParams:t.matches[t.matches.length-1].params,nextUrl:m,nextParams:n[n.length-1].params},r,{actionResult:p,unstable_actionStatus:C,defaultShouldRevalidate:S?!1:u})),$&&B.push({key:j,routeId:O.routeId,path:O.path,matches:I,match:M,controller:new AbortController})}),[k,B]}function Zg(e,t,n){let r=!t||n.route.id!==t.route.id,o=e[n.route.id]===void 0;return r||o}function cu(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function uu(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}async function du(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let o=n[e.id];ke(o,"No route found in manifest");let a={};for(let s in r){let f=o[s]!==void 0&&s!=="hasErrorBoundary";ct(!f,'Route "'+o.id+'" has a static property "'+s+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+s+'" will be ignored.')),!f&&!Cg.has(s)&&(a[s]=r[s])}Object.assign(o,a),Object.assign(o,nt({},t(o),{lazy:void 0}))}function ey(e){return Promise.all(e.matches.map(t=>t.resolve()))}async function ty(e,t,n,r,o,a,s,u){let f=r.reduce((x,l)=>x.add(l.route.id),new Set),g=new Set,h=await e({matches:o.map(x=>{let l=f.has(x.route.id);return nt({},x,{shouldLoad:l,resolve:i=>(g.add(x.route.id),l?ny(t,n,x,a,s,i,u):Promise.resolve({type:Ze.data,result:void 0}))})}),request:n,params:o[0].params,context:u});return o.forEach(x=>ke(g.has(x.route.id),'`match.resolve()` was not called for route id "'+x.route.id+'". You must call `match.resolve()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.')),h.filter((x,l)=>f.has(o[l].route.id))}async function ny(e,t,n,r,o,a,s){let u,f,g=h=>{let x,l=new Promise((c,p)=>x=p);f=()=>x(),t.signal.addEventListener("abort",f);let v=c=>typeof h!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):h({request:t,params:n.params,context:s},...c!==void 0?[c]:[]),i;return a?i=a(c=>v(c)):i=(async()=>{try{return{type:"data",result:await v()}}catch(c){return{type:"error",result:c}}})(),Promise.race([i,l])};try{let h=n.route[e];if(n.route.lazy)if(h){let x,[l]=await Promise.all([g(h).catch(v=>{x=v}),du(n.route,o,r)]);if(x!==void 0)throw x;u=l}else if(await du(n.route,o,r),h=n.route[e],h)u=await g(h);else if(e==="action"){let x=new URL(t.url),l=x.pathname+x.search;throw Nt(405,{method:t.method,pathname:l,routeId:n.route.id})}else return{type:Ze.data,result:void 0};else if(h)u=await g(h);else{let x=new URL(t.url),l=x.pathname+x.search;throw Nt(404,{pathname:l})}ke(u.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(h){return{type:Ze.error,result:h}}finally{f&&t.signal.removeEventListener("abort",f)}return u}async function ry(e){let{result:t,type:n,status:r}=e;if(wu(t)){let s;try{let u=t.headers.get("Content-Type");u&&/\bapplication\/json\b/.test(u)?t.body==null?s=null:s=await t.json():s=await t.text()}catch(u){return{type:Ze.error,error:u}}return n===Ze.error?{type:Ze.error,error:new ou(t.status,t.statusText,s),statusCode:t.status,headers:t.headers}:{type:Ze.data,data:s,statusCode:t.status,headers:t.headers}}if(n===Ze.error)return{type:Ze.error,error:t,statusCode:Ta(t)?t.status:r};if(ly(t)){var o,a;return{type:Ze.deferred,deferredData:t,statusCode:(o=t.init)==null?void 0:o.status,headers:((a=t.init)==null?void 0:a.headers)&&new Headers(t.init.headers)}}return{type:Ze.data,data:t,statusCode:r}}function oy(e,t,n,r,o,a){let s=e.headers.get("Location");if(ke(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!ja.test(s)){let u=r.slice(0,r.findIndex(f=>f.route.id===n)+1);s=Aa(new URL(t.url),u,o,!0,s,a),e.headers.set("Location",s)}return e}function fu(e,t,n){if(ja.test(e)){let r=e,o=r.startsWith("//")?new URL(t.protocol+r):new URL(r),a=Vt(o.pathname,n)!=null;if(o.origin===t.origin&&a)return o.pathname+o.search+o.hash}return e}function Kn(e,t,n,r){let o=e.createURL(bu(t)).toString(),a={signal:n};if(r&&Ht(r.formMethod)){let{formMethod:s,formEncType:u}=r;a.method=s.toUpperCase(),u==="application/json"?(a.headers=new Headers({"Content-Type":u}),a.body=JSON.stringify(r.json)):u==="text/plain"?a.body=r.text:u==="application/x-www-form-urlencoded"&&r.formData?a.body=La(r.formData):a.body=r.formData}return new Request(o,a)}function La(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function hu(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function iy(e,t,n,r,o,a){let s={},u=null,f,g=!1,h={},x=r&&jt(r[1])?r[1].error:void 0;return n.forEach((l,v)=>{let i=t[v].route.id;if(ke(!On(l),"Cannot handle redirect results in processLoaderData"),jt(l)){let c=l.error;x!==void 0&&(c=x,x=void 0),u=u||{};{let p=Fr(e,i);u[p.route.id]==null&&(u[p.route.id]=c)}s[i]=void 0,g||(g=!0,f=Ta(l.error)?l.error.status:500),l.headers&&(h[i]=l.headers)}else Bn(l)?(o.set(i,l.deferredData),s[i]=l.deferredData.data,l.statusCode!=null&&l.statusCode!==200&&!g&&(f=l.statusCode),l.headers&&(h[i]=l.headers)):(s[i]=l.data,l.statusCode&&l.statusCode!==200&&!g&&(f=l.statusCode),l.headers&&(h[i]=l.headers))}),x!==void 0&&r&&(u={[r[0]]:x},s[r[0]]=void 0),{loaderData:s,errors:u,statusCode:f||200,loaderHeaders:h}}function pu(e,t,n,r,o,a,s,u){let{loaderData:f,errors:g}=iy(t,n,r,o,u);for(let h=0;h<a.length;h++){let{key:x,match:l,controller:v}=a[h];ke(s!==void 0&&s[h]!==void 0,"Did not find corresponding fetcher result");let i=s[h];if(!(v&&v.signal.aborted))if(jt(i)){let c=Fr(e.matches,l==null?void 0:l.route.id);g&&g[c.route.id]||(g=nt({},g,{[c.route.id]:i.error})),e.fetchers.delete(x)}else if(On(i))ke(!1,"Unhandled fetcher revalidation redirect");else if(Bn(i))ke(!1,"Unhandled fetcher deferred data");else{let c=yn(i.data);e.fetchers.set(x,c)}}return{loaderData:f,errors:g}}function mu(e,t,n,r){let o=nt({},t);for(let a of n){let s=a.route.id;if(t.hasOwnProperty(s)?t[s]!==void 0&&(o[s]=t[s]):e[s]!==void 0&&a.route.loader&&(o[s]=e[s]),r&&r.hasOwnProperty(s))break}return o}function gu(e){return e?jt(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Fr(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function yu(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Nt(e,t){let{pathname:n,routeId:r,method:o,type:a}=t===void 0?{}:t,s="Unknown Server Error",u="Unknown @remix-run/router error";return e===400?(s="Bad Request",o&&n&&r?u="You made a "+o+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":a==="defer-action"?u="defer() is not supported in actions":a==="invalid-body"&&(u="Unable to encode submission body")):e===403?(s="Forbidden",u='Route "'+r+'" does not match URL "'+n+'"'):e===404?(s="Not Found",u='No route matches URL "'+n+'"'):e===405&&(s="Method Not Allowed",o&&n&&r?u="You made a "+o.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":o&&(u='Invalid request method "'+o.toUpperCase()+'"')),new ou(e||500,s,new Error(u),!0)}function vu(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(On(n))return{result:n,idx:t}}}function bu(e){let t=typeof e=="string"?rn(e):e;return Pn(nt({},t,{hash:""}))}function ay(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function sy(e){return wu(e.result)&&Kg.has(e.result.status)}function Bn(e){return e.type===Ze.deferred}function jt(e){return e.type===Ze.error}function On(e){return(e&&e.type)===Ze.redirect}function ly(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function wu(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function cy(e){return qg.has(e.toLowerCase())}function Ht(e){return Hg.has(e.toLowerCase())}async function xu(e,t,n,r,o,a){for(let s=0;s<n.length;s++){let u=n[s],f=t[s];if(!f)continue;let g=e.find(x=>x.route.id===f.route.id),h=g!=null&&!cu(g,f)&&(a&&a[f.route.id])!==void 0;if(Bn(u)&&(o||h)){let x=r[s];ke(x,"Expected an AbortSignal for revalidating fetcher deferred result"),await ku(u,x,o).then(l=>{l&&(n[s]=l||n[s])})}}}async function ku(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:Ze.data,data:e.deferredData.unwrappedData}}catch(o){return{type:Ze.error,error:o}}return{type:Ze.data,data:e.deferredData.data}}}function Ia(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Da(e,t){let n=typeof t=="string"?rn(t).search:t.search;if(e[e.length-1].route.index&&Ia(n||""))return e[e.length-1];let r=ru(e);return r[r.length-1]}function Cu(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:a,json:s}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(s!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:s,text:void 0}}}function Ma(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function uy(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Ur(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function dy(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function yn(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function fy(e,t){try{let n=e.sessionStorage.getItem(au);if(n){let r=JSON.parse(n);for(let[o,a]of Object.entries(r||{}))a&&Array.isArray(a)&&t.set(o,new Set(a||[]))}}catch{}}function hy(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(au,JSON.stringify(n))}catch(r){ct(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/**
|
|
84
|
-
* React
|
|
84
|
+
* React Router v6.23.1
|
|
85
85
|
*
|
|
86
86
|
* Copyright (c) Remix Software Inc.
|
|
87
87
|
*
|
|
@@ -89,10 +89,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
89
89
|
* LICENSE.md file in the root directory of this source tree.
|
|
90
90
|
*
|
|
91
91
|
* @license MIT
|
|
92
|
-
*/function $r(){return $r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$r.apply(this,arguments)}const Wn=le.createContext(null);process.env.NODE_ENV!=="production"&&(Wn.displayName="DataRouter");const $o=le.createContext(null);process.env.NODE_ENV!=="production"&&($o.displayName="DataRouterState");const py=le.createContext(null);process.env.NODE_ENV!=="production"&&(py.displayName="Await");const zt=le.createContext(null);process.env.NODE_ENV!=="production"&&(zt.displayName="Navigation");const Vo=le.createContext(null);process.env.NODE_ENV!=="production"&&(Vo.displayName="Location");const qt=le.createContext({outlet:null,matches:[],isDataRoute:!1});process.env.NODE_ENV!=="production"&&(qt.displayName="Route");const Fa=le.createContext(null);process.env.NODE_ENV!=="production"&&(Fa.displayName="RouteError");function my(e,t){let{relative:n}=t===void 0?{}:t;Vr()||(process.env.NODE_ENV!=="production"?ke(!1,"useHref() may be used only in the context of a <
|
|
92
|
+
*/function $r(){return $r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$r.apply(this,arguments)}const Wn=le.createContext(null);process.env.NODE_ENV!=="production"&&(Wn.displayName="DataRouter");const $o=le.createContext(null);process.env.NODE_ENV!=="production"&&($o.displayName="DataRouterState");const py=le.createContext(null);process.env.NODE_ENV!=="production"&&(py.displayName="Await");const zt=le.createContext(null);process.env.NODE_ENV!=="production"&&(zt.displayName="Navigation");const Vo=le.createContext(null);process.env.NODE_ENV!=="production"&&(Vo.displayName="Location");const qt=le.createContext({outlet:null,matches:[],isDataRoute:!1});process.env.NODE_ENV!=="production"&&(qt.displayName="Route");const Fa=le.createContext(null);process.env.NODE_ENV!=="production"&&(Fa.displayName="RouteError");function my(e,t){let{relative:n}=t===void 0?{}:t;Vr()||(process.env.NODE_ENV!=="production"?ke(!1,"useHref() may be used only in the context of a <Router> component."):ke(!1));let{basename:r,navigator:o}=le.useContext(zt),{hash:a,pathname:s,search:u}=Hr(e,{relative:n}),f=s;return r!=="/"&&(f=s==="/"?r:Qt([r,s])),o.createHref({pathname:f,search:u,hash:a})}function Vr(){return le.useContext(Vo)!=null}function vn(){return Vr()||(process.env.NODE_ENV!=="production"?ke(!1,"useLocation() may be used only in the context of a <Router> component."):ke(!1)),le.useContext(Vo).location}const Eu="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Su(e){le.useContext(zt).static||le.useLayoutEffect(e)}function At(){let{isDataRoute:e}=le.useContext(qt);return e?Ry():gy()}function gy(){Vr()||(process.env.NODE_ENV!=="production"?ke(!1,"useNavigate() may be used only in the context of a <Router> component."):ke(!1));let e=le.useContext(Wn),{basename:t,future:n,navigator:r}=le.useContext(zt),{matches:o}=le.useContext(qt),{pathname:a}=vn(),s=JSON.stringify(_a(o,n.v7_relativeSplatPath)),u=le.useRef(!1);return Su(()=>{u.current=!0}),le.useCallback(function(g,h){if(h===void 0&&(h={}),process.env.NODE_ENV!=="production"&&ct(u.current,Eu),!u.current)return;if(typeof g=="number"){r.go(g);return}let x=Ra(g,JSON.parse(s),a,h.relative==="path");e==null&&t!=="/"&&(x.pathname=x.pathname==="/"?t:Qt([t,x.pathname])),(h.replace?r.replace:r.push)(x,h.state,h)},[t,r,s,a,e])}const yy=le.createContext(null);function vy(e){let t=le.useContext(qt).outlet;return t&&le.createElement(yy.Provider,{value:e},t)}function Pu(){let{matches:e}=le.useContext(qt),t=e[e.length-1];return t?t.params:{}}function Hr(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=le.useContext(zt),{matches:o}=le.useContext(qt),{pathname:a}=vn(),s=JSON.stringify(_a(o,r.v7_relativeSplatPath));return le.useMemo(()=>Ra(e,JSON.parse(s),a,n==="path"),[e,s,a,n])}function by(e,t,n,r){Vr()||(process.env.NODE_ENV!=="production"?ke(!1,"useRoutes() may be used only in the context of a <Router> component."):ke(!1));let{navigator:o}=le.useContext(zt),{matches:a}=le.useContext(qt),s=a[a.length-1],u=s?s.params:{},f=s?s.pathname:"/",g=s?s.pathnameBase:"/",h=s&&s.route;if(process.env.NODE_ENV!=="production"){let d=h&&h.path||"";_u(f,!h||d.endsWith("*"),"You rendered descendant <Routes> (or called `useRoutes()`) at "+('"'+f+'" (under <Route path="'+d+'">) but the ')+`parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
93
93
|
|
|
94
|
-
`+('Please change the parent <Route path="'+d+'"> to <Route ')+('path="'+(d==="/"?"*":d+"/*")+'">.'))}let x=vn(),l;l=x;let v=l.pathname||"/",i=v;if(g!=="/"){let d=g.replace(/^\//,"").split("/");i="/"+v.replace(/^\//,"").split("/").slice(d.length).join("/")}let c=qn(e,{pathname:i});return process.env.NODE_ENV!=="production"&&(process.env.NODE_ENV!=="production"&&ct(h||c!=null,'No routes matched location "'+l.pathname+l.search+l.hash+'" '),process.env.NODE_ENV!=="production"&&ct(c==null||c[c.length-1].route.element!==void 0||c[c.length-1].route.Component!==void 0||c[c.length-1].route.lazy!==void 0,'Matched leaf route at location "'+l.pathname+l.search+l.hash+'" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.')),Ey(c&&c.map(d=>Object.assign({},d,{params:Object.assign({},u,d.params),pathname:Qt([g,o.encodeLocation?o.encodeLocation(d.pathname).pathname:d.pathname]),pathnameBase:d.pathnameBase==="/"?g:Qt([g,o.encodeLocation?o.encodeLocation(d.pathnameBase).pathname:d.pathnameBase])})),a,n,r)}function wy(){let e=_y(),t=Ta(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},s=null;return process.env.NODE_ENV!=="production"&&(console.error("Error handled by React
|
|
95
|
-
* React
|
|
94
|
+
`+('Please change the parent <Route path="'+d+'"> to <Route ')+('path="'+(d==="/"?"*":d+"/*")+'">.'))}let x=vn(),l;l=x;let v=l.pathname||"/",i=v;if(g!=="/"){let d=g.replace(/^\//,"").split("/");i="/"+v.replace(/^\//,"").split("/").slice(d.length).join("/")}let c=qn(e,{pathname:i});return process.env.NODE_ENV!=="production"&&(process.env.NODE_ENV!=="production"&&ct(h||c!=null,'No routes matched location "'+l.pathname+l.search+l.hash+'" '),process.env.NODE_ENV!=="production"&&ct(c==null||c[c.length-1].route.element!==void 0||c[c.length-1].route.Component!==void 0||c[c.length-1].route.lazy!==void 0,'Matched leaf route at location "'+l.pathname+l.search+l.hash+'" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.')),Ey(c&&c.map(d=>Object.assign({},d,{params:Object.assign({},u,d.params),pathname:Qt([g,o.encodeLocation?o.encodeLocation(d.pathname).pathname:d.pathname]),pathnameBase:d.pathnameBase==="/"?g:Qt([g,o.encodeLocation?o.encodeLocation(d.pathnameBase).pathname:d.pathnameBase])})),a,n,r)}function wy(){let e=_y(),t=Ta(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},s=null;return process.env.NODE_ENV!=="production"&&(console.error("Error handled by React Router default ErrorBoundary:",e),s=le.createElement(le.Fragment,null,le.createElement("p",null,"💿 Hey developer 👋"),le.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",le.createElement("code",{style:a},"ErrorBoundary")," or"," ",le.createElement("code",{style:a},"errorElement")," prop on your route."))),le.createElement(le.Fragment,null,le.createElement("h2",null,"Unexpected Application Error!"),le.createElement("h3",{style:{fontStyle:"italic"}},t),n?le.createElement("pre",{style:o},n):null,s)}const xy=le.createElement(wy,null);class ky extends le.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?le.createElement(qt.Provider,{value:this.props.routeContext},le.createElement(Fa.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Cy(e){let{routeContext:t,match:n,children:r}=e,o=le.useContext(Wn);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),le.createElement(qt.Provider,{value:t},r)}function Ey(e,t,n,r){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var a;if((a=n)!=null&&a.errors)e=n.matches;else return null}let s=e,u=(o=n)==null?void 0:o.errors;if(u!=null){let h=s.findIndex(x=>x.route.id&&(u==null?void 0:u[x.route.id])!==void 0);h>=0||(process.env.NODE_ENV!=="production"?ke(!1,"Could not find a matching route for errors on route IDs: "+Object.keys(u).join(",")):ke(!1)),s=s.slice(0,Math.min(s.length,h+1))}let f=!1,g=-1;if(n&&r&&r.v7_partialHydration)for(let h=0;h<s.length;h++){let x=s[h];if((x.route.HydrateFallback||x.route.hydrateFallbackElement)&&(g=h),x.route.id){let{loaderData:l,errors:v}=n,i=x.route.loader&&l[x.route.id]===void 0&&(!v||v[x.route.id]===void 0);if(x.route.lazy||i){f=!0,g>=0?s=s.slice(0,g+1):s=[s[0]];break}}}return s.reduceRight((h,x,l)=>{let v,i=!1,c=null,p=null;n&&(v=u&&x.route.id?u[x.route.id]:void 0,c=x.route.errorElement||xy,f&&(g<0&&l===0?(_u("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),i=!0,p=null):g===l&&(i=!0,p=x.route.hydrateFallbackElement||null)));let d=t.concat(s.slice(0,l+1)),m=()=>{let y;return v?y=c:i?y=p:x.route.Component?y=le.createElement(x.route.Component,null):x.route.element?y=x.route.element:y=h,le.createElement(Cy,{match:x,routeContext:{outlet:h,matches:d,isDataRoute:n!=null},children:y})};return n&&(x.route.ErrorBoundary||x.route.errorElement||l===0)?le.createElement(ky,{location:n.location,revalidation:n.revalidation,component:c,error:v,children:m(),routeContext:{outlet:null,matches:d,isDataRoute:!0}}):m()},null)}var Bu=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Bu||{}),zr=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(zr||{});function Ua(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function Sy(e){let t=le.useContext(Wn);return t||(process.env.NODE_ENV!=="production"?ke(!1,Ua(e)):ke(!1)),t}function Py(e){let t=le.useContext($o);return t||(process.env.NODE_ENV!=="production"?ke(!1,Ua(e)):ke(!1)),t}function By(e){let t=le.useContext(qt);return t||(process.env.NODE_ENV!=="production"?ke(!1,Ua(e)):ke(!1)),t}function $a(e){let t=By(e),n=t.matches[t.matches.length-1];return n.route.id||(process.env.NODE_ENV!=="production"?ke(!1,e+' can only be used on routes that contain a unique "id"'):ke(!1)),n.route.id}function Oy(){return $a(zr.UseRouteId)}function _y(){var e;let t=le.useContext(Fa),n=Py(zr.UseRouteError),r=$a(zr.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function Ry(){let{router:e}=Sy(Bu.UseNavigateStable),t=$a(zr.UseNavigateStable),n=le.useRef(!1);return Su(()=>{n.current=!0}),le.useCallback(function(o,a){a===void 0&&(a={}),process.env.NODE_ENV!=="production"&&ct(n.current,Eu),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,$r({fromRouteId:t},a)))},[e,t])}const Ou={};function _u(e,t,n){!t&&!Ou[e]&&(Ou[e]=!0,process.env.NODE_ENV!=="production"&&ct(!1,n))}function Kt(e){return vy(e.context)}function Ty(e){let{basename:t="/",children:n=null,location:r,navigationType:o=at.Pop,navigator:a,static:s=!1,future:u}=e;Vr()&&(process.env.NODE_ENV!=="production"?ke(!1,"You cannot render a <Router> inside another <Router>. You should never have more than one in your app."):ke(!1));let f=t.replace(/^\/*/,"/"),g=le.useMemo(()=>({basename:f,navigator:a,static:s,future:$r({v7_relativeSplatPath:!1},u)}),[f,u,a,s]);typeof r=="string"&&(r=rn(r));let{pathname:h="/",search:x="",hash:l="",state:v=null,key:i="default"}=r,c=le.useMemo(()=>{let p=Vt(h,f);return p==null?null:{location:{pathname:p,search:x,hash:l,state:v,key:i},navigationType:o}},[f,h,x,l,v,i,o]);return process.env.NODE_ENV!=="production"&&ct(c!=null,'<Router basename="'+f+'"> is not able to match the URL '+('"'+h+x+l+'" because it does not start with the ')+"basename, so the <Router> won't render anything."),c==null?null:le.createElement(zt.Provider,{value:g},le.createElement(Vo.Provider,{children:n,value:c}))}new Promise(()=>{});function Ny(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(process.env.NODE_ENV!=="production"&&e.element&&process.env.NODE_ENV!=="production"&&ct(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:le.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(process.env.NODE_ENV!=="production"&&e.hydrateFallbackElement&&process.env.NODE_ENV!=="production"&&ct(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:le.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(process.env.NODE_ENV!=="production"&&e.errorElement&&process.env.NODE_ENV!=="production"&&ct(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:le.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}function Gn(e,t){return Jg({basename:void 0,future:$r({},void 0,{v7_prependBasename:!0}),history:xg({initialEntries:void 0,initialIndex:void 0}),hydrationData:void 0,routes:e,mapRouteProperties:Ny,unstable_dataStrategy:void 0}).initialize()}/**
|
|
95
|
+
* React Router DOM v6.23.1
|
|
96
96
|
*
|
|
97
97
|
* Copyright (c) Remix Software Inc.
|
|
98
98
|
*
|
|
@@ -100,7 +100,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
100
100
|
* LICENSE.md file in the root directory of this source tree.
|
|
101
101
|
*
|
|
102
102
|
* @license MIT
|
|
103
|
-
*/function Xn(){return Xn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xn.apply(this,arguments)}function Va(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,a;for(a=0;a<r.length;a++)o=r[a],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}const Ho="get",zo="application/x-www-form-urlencoded";function qo(e){return e!=null&&typeof e.tagName=="string"}function jy(e){return qo(e)&&e.tagName.toLowerCase()==="button"}function Ay(e){return qo(e)&&e.tagName.toLowerCase()==="form"}function Ly(e){return qo(e)&&e.tagName.toLowerCase()==="input"}function Iy(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Dy(e,t){return e.button===0&&(!t||t==="_self")&&!Iy(e)}let Ko=null;function My(){if(Ko===null)try{new FormData(document.createElement("form"),0),Ko=!1}catch{Ko=!0}return Ko}const Fy=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ha(e){return e!=null&&!Fy.has(e)?(process.env.NODE_ENV!=="production"&&ct(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+zo+'"')),null):e}function Uy(e,t){let n,r,o,a,s;if(Ay(e)){let u=e.getAttribute("action");r=u?Vt(u,t):null,n=e.getAttribute("method")||Ho,o=Ha(e.getAttribute("enctype"))||zo,a=new FormData(e)}else if(jy(e)||Ly(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||u.getAttribute("action");if(r=f?Vt(f,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||Ho,o=Ha(e.getAttribute("formenctype"))||Ha(u.getAttribute("enctype"))||zo,a=new FormData(u,e),!My()){let{name:g,type:h,value:x}=e;if(h==="image"){let l=g?g+".":"";a.append(l+"x","0"),a.append(l+"y","0")}else g&&a.append(g,x)}}else{if(qo(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Ho,r=null,o=zo,s=e}return a&&o==="text/plain"&&(s=a,a=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:a,body:s}}const $y=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],Vy=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],Hy=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","unstable_viewTransition"],zy="6";try{window.__reactRouterVersion=zy}catch{}const za=le.createContext({isTransitioning:!1});process.env.NODE_ENV!=="production"&&(za.displayName="ViewTransition");const Ru=le.createContext(new Map);process.env.NODE_ENV!=="production"&&(Ru.displayName="Fetchers");const Tu=le["startTransition"],Nu=Yu["flushSync"];function qy(e){Tu?Tu(e):e()}function qr(e){Nu?Nu(e):e()}class Ky{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function Wy(e){let{fallbackElement:t,router:n,future:r}=e,[o,a]=le.useState(n.state),[s,u]=le.useState(),[f,g]=le.useState({isTransitioning:!1}),[h,x]=le.useState(),[l,v]=le.useState(),[i,c]=le.useState(),p=le.useRef(new Map),{v7_startTransition:d}=r||{},m=le.useCallback(k=>{d?qy(k):k()},[d]),y=le.useCallback((k,B)=>{let{deletedFetchers:O,unstable_flushSync:j,unstable_viewTransitionOpts:I}=B;O.forEach(M=>p.current.delete(M)),k.fetchers.forEach((M,$)=>{M.data!==void 0&&p.current.set($,M.data)});let D=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!I||D){j?qr(()=>a(k)):m(()=>a(k));return}if(j){qr(()=>{l&&(h&&h.resolve(),l.skipTransition()),g({isTransitioning:!0,flushSync:!0,currentLocation:I.currentLocation,nextLocation:I.nextLocation})});let M=n.window.document.startViewTransition(()=>{qr(()=>a(k))});M.finished.finally(()=>{qr(()=>{x(void 0),v(void 0),u(void 0),g({isTransitioning:!1})})}),qr(()=>v(M));return}l?(h&&h.resolve(),l.skipTransition(),c({state:k,currentLocation:I.currentLocation,nextLocation:I.nextLocation})):(u(k),g({isTransitioning:!0,flushSync:!1,currentLocation:I.currentLocation,nextLocation:I.nextLocation}))},[n.window,l,h,p,m]);le.useLayoutEffect(()=>n.subscribe(y),[n,y]),le.useEffect(()=>{f.isTransitioning&&!f.flushSync&&x(new Ky)},[f]),le.useEffect(()=>{if(h&&s&&n.window){let k=s,B=h.promise,O=n.window.document.startViewTransition(async()=>{m(()=>a(k)),await B});O.finished.finally(()=>{x(void 0),v(void 0),u(void 0),g({isTransitioning:!1})}),v(O)}},[m,s,h,n.window]),le.useEffect(()=>{h&&s&&o.location.key===s.location.key&&h.resolve()},[h,l,o.location,s]),le.useEffect(()=>{!f.isTransitioning&&i&&(u(i.state),g({isTransitioning:!0,flushSync:!1,currentLocation:i.currentLocation,nextLocation:i.nextLocation}),c(void 0))},[f.isTransitioning,i]),le.useEffect(()=>{process.env.NODE_ENV!=="production"&&ct(t==null||!n.future.v7_partialHydration,"`<RouterProvider fallbackElement>` is deprecated when using `v7_partialHydration`, use a `HydrateFallback` component instead")},[]);let b=le.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:k=>n.navigate(k),push:(k,B,O)=>n.navigate(k,{state:B,preventScrollReset:O==null?void 0:O.preventScrollReset}),replace:(k,B,O)=>n.navigate(k,{replace:!0,state:B,preventScrollReset:O==null?void 0:O.preventScrollReset})}),[n]),C=n.basename||"/",S=le.useMemo(()=>({router:n,navigator:b,static:!1,basename:C}),[n,b,C]);return le.createElement(le.Fragment,null,le.createElement(Wn.Provider,{value:S},le.createElement($o.Provider,{value:o},le.createElement(Ru.Provider,{value:p.current},le.createElement(za.Provider,{value:f},le.createElement(Ty,{basename:C,location:o.location,navigationType:o.historyAction,navigator:b,future:{v7_relativeSplatPath:n.future.v7_relativeSplatPath}},o.initialized||n.future.v7_partialHydration?le.createElement(Gy,{routes:n.routes,future:n.future,state:o}):t))))),null)}function Gy(e){let{routes:t,future:n,state:r}=e;return by(t,void 0,r,n)}process.env.NODE_ENV;const Xy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Jy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ju=le.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:a,replace:s,state:u,target:f,to:g,preventScrollReset:h,unstable_viewTransition:x}=t,l=Va(t,$y),{basename:v}=le.useContext(zt),i,c=!1;if(typeof g=="string"&&Jy.test(g)&&(i=g,Xy))try{let y=new URL(window.location.href),b=g.startsWith("//")?new URL(y.protocol+g):new URL(g),C=Vt(b.pathname,v);b.origin===y.origin&&C!=null?g=C+b.search+b.hash:c=!0}catch{process.env.NODE_ENV!=="production"&&ct(!1,'<Link to="'+g+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let p=my(g,{relative:o}),d=ev(g,{replace:s,state:u,target:f,preventScrollReset:h,relative:o,unstable_viewTransition:x});function m(y){r&&r(y),y.defaultPrevented||d(y)}return le.createElement("a",Xn({},l,{href:i||p,onClick:c||a?r:m,ref:n,target:f}))});process.env.NODE_ENV!=="production"&&(ju.displayName="Link");const Yy=le.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:o=!1,className:a="",end:s=!1,style:u,to:f,unstable_viewTransition:g,children:h}=t,x=Va(t,Vy),l=Hr(f,{relative:x.relative}),v=vn(),i=le.useContext($o),{navigator:c,basename:p}=le.useContext(zt),d=i!=null&&av(l)&&g===!0,m=c.encodeLocation?c.encodeLocation(l).pathname:l.pathname,y=v.pathname,b=i&&i.navigation&&i.navigation.location?i.navigation.location.pathname:null;o||(y=y.toLowerCase(),b=b?b.toLowerCase():null,m=m.toLowerCase()),b&&p&&(b=Vt(b,p)||b);const C=m!=="/"&&m.endsWith("/")?m.length-1:m.length;let S=y===m||!s&&y.startsWith(m)&&y.charAt(C)==="/",k=b!=null&&(b===m||!s&&b.startsWith(m)&&b.charAt(m.length)==="/"),B={isActive:S,isPending:k,isTransitioning:d},O=S?r:void 0,j;typeof a=="function"?j=a(B):j=[a,S?"active":null,k?"pending":null,d?"transitioning":null].filter(Boolean).join(" ");let I=typeof u=="function"?u(B):u;return le.createElement(ju,Xn({},x,{"aria-current":O,className:j,ref:n,style:I,to:f,unstable_viewTransition:g}),typeof h=="function"?h(B):h)});process.env.NODE_ENV!=="production"&&(Yy.displayName="NavLink");const Qy=le.forwardRef((e,t)=>{let{fetcherKey:n,navigate:r,reloadDocument:o,replace:a,state:s,method:u=Ho,action:f,onSubmit:g,relative:h,preventScrollReset:x,unstable_viewTransition:l}=e,v=Va(e,Hy),i=ov(),c=iv(f,{relative:h}),p=u.toLowerCase()==="get"?"get":"post",d=m=>{if(g&&g(m),m.defaultPrevented)return;m.preventDefault();let y=m.nativeEvent.submitter,b=(y==null?void 0:y.getAttribute("formmethod"))||u;i(y||m.currentTarget,{fetcherKey:n,method:b,navigate:r,replace:a,state:s,relative:h,preventScrollReset:x,unstable_viewTransition:l})};return le.createElement("form",Xn({ref:t,method:p,action:c,onSubmit:o?g:d},v))});process.env.NODE_ENV!=="production"&&(Qy.displayName="Form"),process.env.NODE_ENV;var Wo;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Wo||(Wo={}));var Au;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Au||(Au={}));function Zy(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function Lu(e){let t=le.useContext(Wn);return t||(process.env.NODE_ENV!=="production"?ke(!1,Zy(e)):ke(!1)),t}function ev(e,t){let{target:n,replace:r,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:u}=t===void 0?{}:t,f=At(),g=vn(),h=Hr(e,{relative:s});return le.useCallback(x=>{if(Dy(x,n)){x.preventDefault();let l=r!==void 0?r:Pn(g)===Pn(h);f(e,{replace:l,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:u})}},[g,f,h,r,o,n,e,a,s,u])}function tv(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}let nv=0,rv=()=>"__"+String(++nv)+"__";function ov(){let{router:e}=Lu(Wo.UseSubmit),{basename:t}=le.useContext(zt),n=Oy();return le.useCallback(function(r,o){o===void 0&&(o={}),tv();let{action:a,method:s,encType:u,formData:f,body:g}=Uy(r,t);if(o.navigate===!1){let h=o.fetcherKey||rv();e.fetch(h,n,o.action||a,{preventScrollReset:o.preventScrollReset,formData:f,body:g,formMethod:o.method||s,formEncType:o.encType||u,unstable_flushSync:o.unstable_flushSync})}else e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:f,body:g,formMethod:o.method||s,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:n,unstable_flushSync:o.unstable_flushSync,unstable_viewTransition:o.unstable_viewTransition})},[e,t,n])}function iv(e,t){let{relative:n}=t===void 0?{}:t,{basename:r}=le.useContext(zt),o=le.useContext(qt);o||(process.env.NODE_ENV!=="production"?ke(!1,"useFormAction must be used inside a RouteContext"):ke(!1));let[a]=o.matches.slice(-1),s=Xn({},Hr(e||".",{relative:n})),u=vn();if(e==null){s.search=u.search;let f=new URLSearchParams(s.search);f.has("index")&&f.get("index")===""&&(f.delete("index"),s.search=f.toString()?"?"+f.toString():"")}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(s.pathname=s.pathname==="/"?r:Qt([r,s.pathname])),Pn(s)}function av(e,t){t===void 0&&(t={});let n=le.useContext(za);n==null&&(process.env.NODE_ENV!=="production"?ke(!1,"`unstable_useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"):ke(!1));let{basename:r}=Lu(Wo.useViewTransitionState),o=Hr(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=Vt(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=Vt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ba(o.pathname,s)!=null||Ba(o.pathname,a)!=null}const sv="data:image/svg+xml,%3csvg%20width='24'%20height='25'%20viewBox='0%200%2024%2025'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1.37482%209.55838C0.802045%2011.696%200.887351%2013.9567%201.61959%2016.045C2.35183%2018.1334%203.69695%2019.9524%205.47921%2021.2642C7.26146%2022.5761%209.39798%2023.3199%2011.6096%2023.3985C13.8212%2023.477%2016.0051%2022.8866%2017.876%2021.7045C19.7468%2020.5223%2021.2175%2018.8034%2022.0961%2016.7722C22.9746%2014.7411%2023.2201%2012.4921%2022.8004%2010.3193C22.3807%208.1464%2021.3154%206.15066%2019.7436%204.59277C18.1718%203.03489%2016.1667%201.98732%2013.9902%201.58693M7.14096%202.53681C5.21049%203.48732%203.60119%204.98315%202.51232%206.8391M10.7049%201.48193C10.452%201.51191%2010.2003%201.55066%209.95012%201.59811M18.1995%2015.656C18.757%2014.5927%2019.0317%2013.4039%2018.9971%2012.2038C18.9625%2011.0037%2018.6198%209.83263%2018.002%208.8032C17.3842%207.77377%2016.512%206.92055%2015.4692%206.32553C14.4264%205.73051%2013.2481%205.4137%2012.0476%205.40554C10.847%205.39739%209.66449%205.69816%208.61372%206.27895C7.56295%206.85974%206.67923%207.70104%206.04747%208.72198C5.41572%209.74292%205.05717%2010.9092%205.00628%2012.1087C4.9554%2013.3082%205.21389%2014.5007%205.75691%2015.5714M9.15764%2013.3648C9.00624%2012.9162%208.96314%2012.4382%209.03189%2011.9698C9.10064%2011.5014%209.27926%2011.0559%209.55317%2010.6697C9.82708%2010.2836%2010.1885%209.96774%2010.6079%209.74803C11.0272%209.52832%2011.4926%209.41098%2011.966%209.4056C12.4394%209.40023%2012.9074%209.50697%2013.3316%209.71709C13.7559%209.92722%2014.1244%2010.2348%2014.407%2010.6146C14.6896%2010.9944%2014.8783%2011.4358%2014.9576%2011.9025C15.037%2012.3692%2015.0048%2012.8481%2014.8636%2013.3M14.0993%2010.2622C14.0043%2010.1691%2013.9032%2010.0825%2013.7967%2010.0028M8.2478%2018.3147C9.32147%2018.9965%2010.5606%2019.3728%2011.832%2019.4033C13.1035%2019.4339%2014.3592%2019.1174%2015.4644%2018.488'%20stroke='%233430FF'%20stroke-width='2'%20stroke-linecap='round'/%3e%3c/svg%3e";function lv(){const e=At(),{t}=Qe(),n=kn();return H.useEffect(()=>{n.sessionUuid&&e(`/${n.sessionUuid}`)},[n.sessionUuid,e]),E.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 text-center",children:[E.jsxs("div",{className:"flex items-center justify-center gap-3",children:[E.jsx("img",{alt:"logo",src:sv,className:"z-10 h-16 w-16 hover:animate-spin"}),E.jsxs("p",{className:"z-10 text-7xl font-semibold tracking-wide text-gray-600",children:["Welcome to ",E.jsx("span",{className:"italic",children:"PortalSessions"})]})]}),n.sessionUuid?E.jsx(Ye,{style:{padding:"1.5rem 2rem"},label:t("continue"),onClick:()=>e(`/${n.sessionUuid}`)}):E.jsx("p",{className:"text-error-600",children:`${t("somethingWentWrong")} ${t("portalSessionNotFound")}.`})]})}function cv(){const e=At(),{t}=Qe(),{sessionUuid:n}=kn(),{session:r,isLoading:o,mutate:a}=bt();return H.useEffect(()=>{if(!o&&r){const s=r.type in Zt?`/${r.type.toLowerCase()}`:"/";e(s)}},[o,a,e,r]),o?E.jsx(Tl,{}):E.jsx("div",{className:"flex w-full items-center justify-center text-error-600",children:`${t("portalSessionNotFound")} (${n})`})}Gn([{path:"/",element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(qa,{})},{path:"/top-up/:hash",element:E.jsx(Du,{})},{path:"/redeem/:hash",element:E.jsx(Iu,{})}]}]);function qa(){const{t:e}=Qe(),[t,n]=H.useState(""),[r,o]=H.useState(!1),{session:a}=bt(),s=At(),u=a==null?void 0:a.input_data.scanner_type,f=H.useCallback(()=>a.results.remaining_amount??(a==null?void 0:a.input_data.amount_in_cents),[a]),g=H.useCallback(async()=>{o(!0);const{data:{data:h}}=await Ii.get(t);s(`${a.type===Tn.REDEEM_GIFTCARD?"redeem":"top-up"}/${h.hash}`)},[t,s,a]);return H.useEffect(()=>{u===Mt.CAMERA&&t&&!r&&g().then()},[t,r,u,g]),(a==null?void 0:a.type)===Tn.REDEEM_GIFTCARD&&!(a!=null&&a.input_data.amount_in_cents)?E.jsx(E.Fragment,{children:e("xIsRequired",{x:"Amount in cents"})}):E.jsx("div",{className:"container m-auto",children:E.jsx(_t,{children:E.jsxs("div",{className:"flex flex-col gap-3",children:[E.jsx(qe,{size:"sm",weight:"extralight",children:e("scanGiftcard")}),(a==null?void 0:a.type)===Tn.REDEEM_GIFTCARD&&E.jsx(qe,{size:"lg",children:`${e("amountToBePaid")}: ${tr(f())}`}),E.jsx(wo,{dataSetter:n,type:u,label:e("hash")}),u===Mt.HAND_SCANNER&&E.jsx("div",{children:E.jsx(Ye,{type:"submit",label:e("submit"),onClick:g})})]})})})}function Iu(){const{t:e}=Qe(),{hash:t}=Pu(),{giftcard:n,mutate:r}=hl(t),{session:o,mutate:a}=bt(),{onUseGiftcard:s}=kn(),u=At(),f=(o==null?void 0:o.input_data.amount_in_cents)??0,g=(o==null?void 0:o.input_data.allow_multiple_giftcards)??!0;if(!n)return E.jsx(E.Fragment,{children:e("giftcardNotFound")});const h=async()=>{const v=await Ii.transaction(n.uuid,-l());await r();const i=await a(),c=i==null?void 0:i.data.data.events;Zo(c),De.success(`${e("transactionSuccessful")}!`),s&&s(v.data.data)},x=()=>o.results.remaining_amount??f,l=()=>Math.min(x(),n.amount_in_cents);return E.jsx("div",{className:"container m-auto",children:E.jsx(_t,{children:E.jsxs("div",{className:"flex h-96 flex-col items-center justify-between",children:[E.jsxs("div",{children:[E.jsxs(qe,{size:"md",align:"center",children:[e("giftcard"),": ",n.hash]}),E.jsx(qe,{size:"sm",align:"center",weight:"light",className:"text-gray-500",children:n.expiration_date?e("expiresAtDate",{date:n.formatted_expiration_date}):n.formatted_expiration_date})]}),E.jsxs("div",{children:[E.jsx(qe,{size:"lg",align:"center",children:e("balance")}),E.jsx(qe,{size:"4xl",align:"center",children:n.display_amount})]}),E.jsx("div",{className:"mx-auto flex gap-2",children:l()?E.jsx(Ye,{label:e("confirmAndPay",{amount:tr(l(),o==null?void 0:o.currency)}),onClick:h}):E.jsxs("div",{className:"flex flex-col gap-4",children:[E.jsx(qe,{size:"lg",align:"center",className:"text-gray-500",children:e("xOfYPaid",{x:x()?tr(f-x(),o==null?void 0:o.currency):e("fullAmount"),y:tr(f,o==null?void 0:o.currency)})}),g&&x()?E.jsx(Ye,{label:e("useAnotherGiftcard"),onClick:()=>u("../")}):null]})})]})})})}function Du(){const{t:e}=Qe(),{hash:t}=Pu(),{giftcard:n,mutate:r}=hl(t),[o,a]=H.useState(!1),[s,u]=H.useState("");if(!n)return E.jsx(E.Fragment,{children:e("giftcardNotFound")});const f=async()=>{const g=await Ii.transaction(n.uuid,parseFloat(s)*100);await r(),De.success(`${e("transactionSuccessful")}! ${e("totalUpgradedAmount")}: ${tr(g.data.data.amount_in_cents)}`),a(!1)};return E.jsxs("div",{className:"container m-auto",children:[E.jsx(_t,{children:E.jsxs("div",{className:"flex h-96 flex-col items-center justify-between",children:[E.jsxs("div",{children:[E.jsxs(qe,{size:"md",align:"center",children:[e("giftcard"),": ",n.hash]}),E.jsx(qe,{size:"sm",align:"center",weight:"light",className:"text-gray-500",children:n.expiration_date?e("expiresAtDate",{date:n.formatted_expiration_date}):n.formatted_expiration_date})]}),E.jsxs("div",{children:[E.jsx(qe,{size:"lg",align:"center",children:e("balance")}),E.jsx(qe,{size:"4xl",align:"center",children:n.display_amount})]}),E.jsx("div",{className:"mx-auto flex gap-2",children:E.jsx(Ye,{label:e("topUp"),onClick:()=>a(!0)})})]})}),E.jsx(Mn,{isOpen:o,onClose:()=>a(!1),children:E.jsxs("div",{className:"flex flex-col gap-4",children:[E.jsx($i,{value:s,valueSetter:u}),E.jsx(Ye,{label:e("submit"),onClick:f})]})})]})}Gn([{path:"/",element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(Fu,{})},{path:"email",element:E.jsx(Uu,{})},{path:"identifier",element:E.jsx(Ka,{})},{path:"register",element:E.jsx($u,{})}]}]);function uv(){const{t:e}=Qe(),{contact:t,isLoading:n,mutate:r}=yo(),[o,a]=H.useState(),[s,u]=H.useState();H.useEffect(()=>{o||(async()=>{const{data:h}=await fl.get();a(h.data.elements)})()},[t,o]);const f=(h,x)=>{u({...s,[h]:x})},g=async()=>{s&&(await fl.update(s),await r(),De.success(e("contactAttributesUpdated")))};return!o||n?E.jsx(Tl,{}):E.jsxs("div",{className:"flex h-full flex-col gap-6",children:[E.jsx("div",{className:"flex justify-end",children:E.jsx(Ye,{label:e("saveChanges"),onClick:g})}),E.jsx("hr",{}),E.jsx("div",{className:"grid h-full grid-cols-2 gap-x-6 gap-y-2 overflow-y-auto p-1",children:o.map(h=>{if(h.type==="media_upload")return;const x=h.disabled?E.jsx(Xh,{type:h.type,value:t.current_display_values[h.name],label:h.label,underlying_value:t.current_values[h.name]}):E.jsx(Jh,{...h,onChange:f});return E.jsx("div",{children:x},h.id)})})]})}function dv(){const{t:e}=Qe(),{data:t,isLoading:n,mutate:r}=Uh(),o=async s=>{await Fh.update({subscription_type_id:s.subscription_type.id}),await r()},a=s=>{const u=s.subscription_type.strategy,f=s.status;if(u===In.FUNCTIONAL)return e("disabled");switch(f){case hr.SUBSCRIBED:return e("unsubscribe");case hr.UNSUBSCRIBED:return u===In.OPT_IN||In.OPT_OUT?e("subscribe"):e("sendConfirmationEmail");case hr.PENDING_CONFIRMATION:return e("sendReminder");default:return""}};return n?E.jsx(Ac,{rows:5}):E.jsx("div",{children:t.data.data.map(s=>E.jsxs("div",{className:"mb-4 flex justify-between rounded-lg border border-gray-200 px-6 py-4 bg-white",children:[E.jsxs("div",{children:[E.jsxs("div",{className:"flex gap-3",children:[E.jsx(qe,{weight:"normal",children:s.subscription_type.name}),E.jsx("span",{className:`flex gap-2 rounded-full px-2 py-0.5 text-sm font-light ${s.is_subscribed?"bg-[#03985515] text-[#039855]":"bg-[#E0273115] text-[#E02731]"}`,children:s.status.charAt(0)+s.status.substring(1).toLowerCase()})]}),E.jsx(qe,{color:"text-gray-400",size:"sm",children:s.subscription_type.description})]}),E.jsx(Ye,{style:{color:"inherit",backgroundColor:"white",border:"1px solid rgb(229 231 235)"},disabled:s.subscription_type.strategy===In.FUNCTIONAL,onClick:()=>o(s),label:a(s)})]},s.subscription_type.uuid))})}const Mu="contact-identifiers",fv={create:e=>tt.instance.post(Je(Mu),e)},hv=()=>{const{data:e,error:t,isLoading:n,isValidating:r,mutate:o}=fn(Je(Mu));return{identifiers:e==null?void 0:e.data.data,data:e,error:t,isLoading:n,isValidating:r,mutate:o}};function pv(){const{t:e}=Qe(),{data:t,isLoading:n,mutate:r}=hv(),[o,a]=H.useState(!1),[s,u]=H.useState(""),[f,g]=H.useState(!1),h=()=>{g(!0),fv.create({value:s}).then(()=>{r(),a(!1)}).catch(x=>De.error(x)).finally(()=>g(!1))};return n?E.jsx(Ac,{rows:5}):E.jsxs("div",{className:"flex flex-col gap-2",children:[E.jsx("div",{className:"flex justify-end",children:E.jsx(Ye,{label:e("addIdentifier"),onClick:()=>a(!0)})}),t.data.data.map(x=>E.jsx("div",{className:"flex justify-between rounded-lg border border-gray-200 px-6 py-4 bg-white",children:E.jsxs("div",{children:[E.jsx(qe,{weight:"semibold",children:x.name}),E.jsx(qe,{children:x.value})]})},x.value)),E.jsx(Mn,{isOpen:o,onClose:()=>a(!1),title:e("addIdentifier"),children:E.jsxs("div",{className:"flex flex-col gap-4 min-w-96",children:[E.jsx(Dn,{id:"add-identifier",name:"identifier",label:"Identifier value",type:"text",onChange:(x,l)=>u(l),autoFocus:!0}),E.jsx(Ye,{label:e("addIdentifier"),onClick:h,disabled:f})]})})]})}function mv(){const{t:e}=Qe(),[t,n]=H.useState(),r=H.useMemo(()=>[{id:0,label:e("contactDetails"),icon:E.jsx("path",{d:"M10 0a10 10 0 1 0 10 10A10.011 10.011 0 0 0 10 0Zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6Zm0 13a8.949 8.949 0 0 1-4.951-1.488A3.987 3.987 0 0 1 9 13h2a3.987 3.987 0 0 1 3.951 3.512A8.949 8.949 0 0 1 10 18Z"}),content:E.jsx(uv,{})},{id:1,label:e("subscriptions"),icon:E.jsx("path",{d:"M18 7.5h-.423l-.452-1.09.3-.3a1.5 1.5 0 0 0 0-2.121L16.01 2.575a1.5 1.5 0 0 0-2.121 0l-.3.3-1.089-.452V2A1.5 1.5 0 0 0 11 .5H9A1.5 1.5 0 0 0 7.5 2v.423l-1.09.452-.3-.3a1.5 1.5 0 0 0-2.121 0L2.576 3.99a1.5 1.5 0 0 0 0 2.121l.3.3L2.423 7.5H2A1.5 1.5 0 0 0 .5 9v2A1.5 1.5 0 0 0 2 12.5h.423l.452 1.09-.3.3a1.5 1.5 0 0 0 0 2.121l1.415 1.413a1.5 1.5 0 0 0 2.121 0l.3-.3 1.09.452V18A1.5 1.5 0 0 0 9 19.5h2a1.5 1.5 0 0 0 1.5-1.5v-.423l1.09-.452.3.3a1.5 1.5 0 0 0 2.121 0l1.415-1.414a1.5 1.5 0 0 0 0-2.121l-.3-.3.452-1.09H18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 18 7.5Zm-8 6a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7Z"}),content:E.jsx(dv,{})},{id:2,label:e("identifiers"),icon:E.jsx("path",{d:"M18 7.5h-.423l-.452-1.09.3-.3a1.5 1.5 0 0 0 0-2.121L16.01 2.575a1.5 1.5 0 0 0-2.121 0l-.3.3-1.089-.452V2A1.5 1.5 0 0 0 11 .5H9A1.5 1.5 0 0 0 7.5 2v.423l-1.09.452-.3-.3a1.5 1.5 0 0 0-2.121 0L2.576 3.99a1.5 1.5 0 0 0 0 2.121l.3.3L2.423 7.5H2A1.5 1.5 0 0 0 .5 9v2A1.5 1.5 0 0 0 2 12.5h.423l.452 1.09-.3.3a1.5 1.5 0 0 0 0 2.121l1.415 1.413a1.5 1.5 0 0 0 2.121 0l.3-.3 1.09.452V18A1.5 1.5 0 0 0 9 19.5h2a1.5 1.5 0 0 0 1.5-1.5v-.423l1.09-.452.3.3a1.5 1.5 0 0 0 2.121 0l1.415-1.414a1.5 1.5 0 0 0 0-2.121l-.3-.3.452-1.09H18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 18 7.5Zm-8 6a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7Z"}),content:E.jsx(pv,{})}],[e]);return H.useEffect(()=>{t||n(r[0])},[r,t]),E.jsxs("div",{className:"h-full sm:flex",children:[E.jsx("ul",{className:"flex-column space-y mb-4 space-y-4 text-sm font-medium text-gray-500 md:mb-0 md:me-4",children:r.map(o=>E.jsx("li",{children:E.jsxs("div",{className:`inline-flex w-full cursor-pointer items-center rounded-lg px-4 py-3 ${o.id===(t==null?void 0:t.id)?"bg-primary-600 text-white":"bg-gray-50 hover:bg-gray-100 hover:text-gray-900"}`,onClick:()=>n(o),children:[E.jsx("svg",{className:`me-2 h-4 w-4 ${o.id===(t==null?void 0:t.id)?"text-white":"text-gray-500"}`,"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 20 20",children:o.icon}),E.jsx("p",{className:"truncate",children:o.label})]})},o.id))}),E.jsx("div",{className:"text-medium h-full w-full rounded-lg bg-gray-50 p-6",children:t&&t.content})]})}function gv(){const{data:e,isLoading:t,mutate:n}=Mh(),{mutate:r}=yo(),{onClaimReward:o}=kn(),{t:a}=Qe(),s=async u=>{const f=await Dh.claim(u);n(),r(),De.success(a("rewardClaimed",{name:f.data.data.title})),o&&o(f.data.data)};return E.jsx(Lc,{header:t?[]:e.data.data.header.items,rows:t?[]:e.data.data.rows,pending:t,onClick:s})}function yv(){const{data:e,isLoading:t,mutate:n}=$h(),{mutate:r}=bt(),{onRedeemVoucher:o}=kn(),{t:a}=Qe(),s=async u=>{const f=await Fi.redeemById(u),g=await r(),h=g==null?void 0:g.data.data.events;Zo(h),n(),De.success(a("voucherSuccessfullyRedeemed")),o&&o(f.data.data)};return E.jsx(Lc,{header:t?[]:e.data.data.header.items,rows:t?[]:e.data.data.rows,pending:t,onClick:s})}function vv(){const{t:e}=Qe(),{session:{loyalty_program:t}}=bt(),{contact:n,isLoading:r}=yo();if(r)return E.jsx(E.Fragment,{});const o=[{value:n.credit_balance.balance,label:t.custom_credit_name||e("points")},{value:n.current_display_values.loyalty_number_of_transactions,label:e("transactions")},{value:n.tier?n.tier.name:"-",label:e("tier")}];return E.jsxs("div",{className:"flex w-full justify-between text-inherit",children:[E.jsxs("div",{children:[E.jsx("p",{className:"text-md font-medium",children:`${n.current_display_values.firstname} ${n.current_display_values.lastname}`}),E.jsx("p",{className:"text-sm",children:n.current_display_values.email})]}),E.jsx("div",{className:"flex gap-8",children:o.map(a=>E.jsxs("div",{className:"flex flex-col items-center",children:[E.jsx("p",{className:"text-md font-medium",children:a.value}),E.jsx("p",{className:"text-sm",children:a.label})]},a.label))})]})}function bv(){const{t:e}=Qe(),{session:t}=bt(),n=t.contact,[r,o]=H.useState("rewards");if(!n)return E.jsx(E.Fragment,{children:e("contactNotFound")});const a=()=>{switch(r){case"profile":return E.jsx(mv,{});case"rewards":return E.jsx(gv,{});case"vouchers":return E.jsx(yv,{})}};return E.jsx("div",{className:"container m-auto flex h-full p-4",children:E.jsx(_t,{children:E.jsxs("div",{className:"flex h-full flex-col gap-6",children:[E.jsx(vv,{}),E.jsx("hr",{}),E.jsx("div",{children:E.jsx(zh,{elements:[{key:"profile",label:e("profile"),active:r==="profile"},{key:"rewards",label:e("rewards"),active:r==="rewards"},{key:"vouchers",label:e("vouchers"),active:r==="vouchers"}],onClick:s=>o(s)})}),E.jsx("div",{className:"overflow-y-auto",children:a()})]})})})}function wv(){const{session:e}=bt(),t=At(),{t:n}=Qe();return E.jsxs("div",{className:"m-auto flex flex-col items-center gap-4",children:[E.jsx("p",{children:n("noContactLinked")}),E.jsxs("div",{className:"flex gap-4",children:[e.input_data.enable_registration&&E.jsx(Ye,{label:n("registerNewContact"),onClick:()=>t("register")}),e.input_data.enable_email_identification&&E.jsx(Ye,{label:n("linkViaEmail"),onClick:()=>t("email")}),E.jsx(Ye,{label:n("linkViaCard"),onClick:()=>t("identifier")})]})]})}function Ka(){const e=At();return E.jsx("div",{className:"container m-auto",children:E.jsx(_t,{children:E.jsx(zi,{callback:()=>e("../")})})})}function Fu(){const{session:e}=bt();return e&&(e.contact?E.jsx(bv,{}):!e.input_data.enable_registration&&!e.input_data.enable_email_identification?E.jsx(Ka,{}):E.jsx(wv,{}))}function Uu(){const[e,t]=H.useState(""),{session:n,mutate:r}=bt(),o=At(),{t:a}=Qe(),s=async()=>{n&&(await vo.setContact(n.uuid,{email:e}),await r(),De.success(a("contactSavedToSession")),o("../"))};return E.jsx("div",{className:"container m-auto",children:E.jsx(_t,{children:E.jsxs("div",{className:"flex flex-col gap-3",children:[E.jsx("p",{children:a("fillInXBelow",{x:a("emailAddress").toLowerCase()})}),E.jsx(Dn,{autoFocus:!0,id:"email-input",name:"email",label:a("emailAddress"),type:"email",onChange:(u,f)=>t(f)}),E.jsx("div",{children:E.jsx(Ye,{type:"submit",label:a("linkContact"),onClick:s})})]})})})}function $u(){const[e,t]=H.useState(""),{session:n,mutate:r}=bt(),o=At(),{t:a}=Qe(),s=async()=>{n&&(await Ai.create(e),await r(),De.success(a("contactSavedToSession")),o("../"))};return E.jsx("div",{className:"container m-auto",children:E.jsx(_t,{children:E.jsxs("div",{className:"flex flex-col gap-3",children:[E.jsx("p",{children:a("fillInXBelow",{x:a("emailAddress").toLowerCase()})}),E.jsx(Dn,{autoFocus:!0,id:"email-input",name:"email",label:a("emailAddress"),type:"email",onChange:(u,f)=>t(f)}),E.jsx("div",{children:E.jsx(Ye,{type:"submit",label:a("register"),onClick:s})})]})})})}Gn([{path:"/",element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(Vu,{})},{path:"balance",element:E.jsx(Hu,{})}]}]);function Vu(){const e=At();return E.jsx("div",{className:"container m-auto",children:E.jsx(_t,{children:E.jsx(zi,{callback:()=>e("balance")})})})}function Hu(){const{t:e}=Qe(),{balance:t,mutate:n}=Ih(),[r,o]=H.useState(""),[a,s]=H.useState(1),[u,f]=H.useState(!1),g=async()=>{r&&(await Lh.transaction({amount_in_cents:parseFloat(r)*100*a}),await n(),De.success(e("prepaidTransactionCreated")),f(!1))};return E.jsxs("div",{className:"container m-auto",children:[E.jsxs(_t,{children:[E.jsxs(qe,{size:"lg",align:"center",weight:"normal",children:[e("prepaidBalance"),": ",t==null?void 0:t.balance]}),E.jsx("div",{className:"mt-6 flex justify-center",children:E.jsxs("div",{className:"grid w-1/3 grid-cols-2 gap-x-2",children:[E.jsx(Ye,{label:e("upgrade"),onClick:()=>{f(!0),s(1)}}),E.jsx(Ye,{label:e("depreciate"),onClick:()=>{f(!0),s(-1)}})]})})]}),E.jsx(Mn,{isOpen:u,onClose:()=>f(!1),children:E.jsxs("div",{className:"flex flex-col gap-4",children:[E.jsx($i,{value:r,valueSetter:o}),E.jsx(Ye,{label:e("submit"),onClick:g})]})})]})}Gn([{path:"/",element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(zu,{})},{path:"success",element:E.jsx(qu,{})}]}]);function zu(){const{t:e}=Qe(),[t,n]=H.useState(""),[r,o]=H.useState(!1),{session:a,mutate:s}=bt(),u=At(),f=async()=>{if(t){const{data:{data:g}}=await Ah.create({unit_value:parseFloat(t)});await s(),u("success",{state:{transaction:g}})}};return H.useEffect(()=>{a&&a.contact&&o(!0)},[u,a]),E.jsxs("div",{className:"container m-auto",children:[E.jsx(_t,{children:E.jsx(zi,{})}),E.jsx(Mn,{isOpen:r,children:E.jsxs("div",{className:"flex flex-col gap-4",children:[E.jsxs("p",{className:"text-center",children:[e("unitValue"),":"]}),E.jsx($i,{value:t,valueSetter:n}),E.jsx(Ye,{label:e("submit"),onClick:f})]})})]})}function qu(){const{state:e}=vn(),{t}=Qe(),{session:{loyalty_program:n}}=bt(),{contact:r}=yo();return E.jsx("div",{className:"m-auto",children:E.jsx(El,{children:E.jsxs("div",{className:"mt-8 flex w-96 flex-col gap-4",children:[E.jsxs(qe,{size:"lg",weight:"bold",align:"center",children:[t("creditReceptionCreated"),"!"]}),e&&e.transaction&&E.jsxs(qe,{color:"text-gray-500",align:"center",children:["+",e.transaction.credits," ",n.custom_credit_name||t("points").toLowerCase()]}),E.jsx("div",{className:"h-24"}),r&&E.jsxs("div",{className:"flex justify-between",children:[E.jsxs(qe,{color:"text-gray-200",children:[t("currentCreditBalance"),":"]}),E.jsxs(qe,{color:"text-gray-200",children:[r.credit_balance.balance," ",n.custom_credit_name||t("points").toLowerCase()]})]})]})})})}Gn([{path:"/",element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(Ku,{})},{path:"success",element:E.jsx(Wu,{})}]}]);function Ku(){const{t:e}=Qe(),[t,n]=H.useState(""),[r,o]=H.useState(""),[a,s]=H.useState(!1),[u,f]=H.useState(!1),{session:g,mutate:h}=bt(),x=g==null?void 0:g.input_data.scanner_type,l=At(),v=H.useCallback(async()=>{r&&await vo.setContact(g.uuid,{contact_identifier_value:r});const{data:{data:c}}=await Fi.redeemByCode(t),p=await h(),d=p==null?void 0:p.data.data.events;Zo(d),l("success",{state:{voucher:c}})},[t,r,l,g]),i=H.useCallback(async()=>{if(g){s(!0);const{data:{data:c}}=await Fi.get(t);c.contact||g.contact?await v():f(!0),s(!1)}},[t,v,g]);return H.useEffect(()=>{x===Mt.CAMERA&&t&&!a&&(async()=>await i())()},[t,a,x,i,u]),E.jsxs("div",{className:"container m-auto",children:[E.jsxs(_t,{children:[E.jsx(wo,{dataSetter:n,type:x,label:e("voucherCode")}),x===Mt.HAND_SCANNER&&E.jsx("div",{className:"pt-3",children:E.jsx(Ye,{type:"submit",label:e("redeemVoucher"),onClick:i})})]}),E.jsxs(Mn,{isOpen:u,onClose:()=>f(!1),children:[E.jsx("p",{className:"pb-4 text-error-600",children:e("noContactLinkedToVoucher")}),E.jsx(wo,{dataSetter:o,type:x,label:e("contactIdentifier")}),x===Mt.HAND_SCANNER&&E.jsx("div",{className:"pt-3",children:E.jsx(Ye,{type:"submit",label:e("redeemVoucher"),onClick:v})})]})]})}function Wu(){const{t:e}=Qe(),{state:t}=vn();return E.jsx("div",{className:"m-auto",children:E.jsx(El,{children:E.jsx(qe,{size:"lg",align:"center",className:"pt-6",children:e("voucherWithCodeSuccessfullyRedeemed",{code:t.voucher.code})})})})}const xv=Gn([{path:"/",element:E.jsx(lv,{})},{path:":portalSessionUuid",element:E.jsx(cv,{}),errorElement:E.jsx("div",{children:"No session UUID"})},{path:Zt.REDEEM_GIFTCARD,element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(qa,{})},{path:"redeem/:hash",element:E.jsx(Iu,{})}]},{path:Zt.TOP_UP_GIFTCARD,element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(qa,{})},{path:"top-up/:hash",element:E.jsx(Du,{})}]},{path:Zt.PORTAL,element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(Fu,{})},{path:"email",element:E.jsx(Uu,{})},{path:"identifier",element:E.jsx(Ka,{})},{path:"register",element:E.jsx($u,{})}]},{path:Zt.PREPAID,element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(Vu,{})},{path:"balance",element:E.jsx(Hu,{})}]},{path:Zt.SAVE,element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(zu,{})},{path:"success",element:E.jsx(qu,{})}]},{path:Zt.VOUCHER,element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(Ku,{})},{path:"success",element:E.jsx(Wu,{})}]}]),Gu=()=>E.jsx(Wy,{router:xv});function kv(e){return E.jsx(wg,{config:e,payload:{type:e.type??Tn.PORTAL,api_key:e.apiKey,shop_uuid:e.shopUuid,...e.amountInCents&&{amount_in_cents:e.amountInCents},...e.allowMultipleGiftcards&&{allow_multiple_giftcards:e.allowMultipleGiftcards},...e.scannerType&&{scanner_type:e.scannerType},...e.enableRegistration&&{enable_registration:e.enableRegistration},...e.enableEmailIdentification&&{enable_email_identification:e.enableEmailIdentification},...e.enableOnScreenKeyboard&&{enable_on_screen_keyboard:e.enableOnScreenKeyboard}},children:E.jsx(Gu,{})})}function Cv({uuid:e,host:t}){const[n,r]=H.useState(!1);return H.useEffect(()=>{n||(tt.initialize(void 0,t),r(!0))},[t,n]),n?E.jsxs(H.StrictMode,{children:[E.jsx(ml,{sessionUuid:e,children:E.jsx("div",{className:"flex h-screen w-screen bg-primary-50",children:E.jsxs("div",{className:"flex h-screen w-screen flex-col bg-primary-50",children:[E.jsx("div",{className:"flex h-full overflow-auto",children:E.jsx(Gu,{})}),e&&E.jsx(Cl,{})]})})}),E.jsx(ms,{position:"bottom-center"})]}):E.jsx(E.Fragment,{children:"Initializing..."})}const Ev=Object.freeze(Object.defineProperty({__proto__:null,createWorker:()=>new Worker(URL.createObjectURL(new Blob([`class x{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new x(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;f<b+d;f++)for(let g=a;g<a+c;g++)this.set(g,f,!!e)}}
|
|
103
|
+
*/function Xn(){return Xn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xn.apply(this,arguments)}function Va(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,a;for(a=0;a<r.length;a++)o=r[a],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}const Ho="get",zo="application/x-www-form-urlencoded";function qo(e){return e!=null&&typeof e.tagName=="string"}function jy(e){return qo(e)&&e.tagName.toLowerCase()==="button"}function Ay(e){return qo(e)&&e.tagName.toLowerCase()==="form"}function Ly(e){return qo(e)&&e.tagName.toLowerCase()==="input"}function Iy(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Dy(e,t){return e.button===0&&(!t||t==="_self")&&!Iy(e)}let Ko=null;function My(){if(Ko===null)try{new FormData(document.createElement("form"),0),Ko=!1}catch{Ko=!0}return Ko}const Fy=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ha(e){return e!=null&&!Fy.has(e)?(process.env.NODE_ENV!=="production"&&ct(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+zo+'"')),null):e}function Uy(e,t){let n,r,o,a,s;if(Ay(e)){let u=e.getAttribute("action");r=u?Vt(u,t):null,n=e.getAttribute("method")||Ho,o=Ha(e.getAttribute("enctype"))||zo,a=new FormData(e)}else if(jy(e)||Ly(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||u.getAttribute("action");if(r=f?Vt(f,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||Ho,o=Ha(e.getAttribute("formenctype"))||Ha(u.getAttribute("enctype"))||zo,a=new FormData(u,e),!My()){let{name:g,type:h,value:x}=e;if(h==="image"){let l=g?g+".":"";a.append(l+"x","0"),a.append(l+"y","0")}else g&&a.append(g,x)}}else{if(qo(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Ho,r=null,o=zo,s=e}return a&&o==="text/plain"&&(s=a,a=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:a,body:s}}const $y=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],Vy=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],Hy=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","unstable_viewTransition"],zy="6";try{window.__reactRouterVersion=zy}catch{}const za=le.createContext({isTransitioning:!1});process.env.NODE_ENV!=="production"&&(za.displayName="ViewTransition");const Ru=le.createContext(new Map);process.env.NODE_ENV!=="production"&&(Ru.displayName="Fetchers");const Tu=le["startTransition"],Nu=Yu["flushSync"];function qy(e){Tu?Tu(e):e()}function qr(e){Nu?Nu(e):e()}class Ky{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function Wy(e){let{fallbackElement:t,router:n,future:r}=e,[o,a]=le.useState(n.state),[s,u]=le.useState(),[f,g]=le.useState({isTransitioning:!1}),[h,x]=le.useState(),[l,v]=le.useState(),[i,c]=le.useState(),p=le.useRef(new Map),{v7_startTransition:d}=r||{},m=le.useCallback(k=>{d?qy(k):k()},[d]),y=le.useCallback((k,B)=>{let{deletedFetchers:O,unstable_flushSync:j,unstable_viewTransitionOpts:I}=B;O.forEach(M=>p.current.delete(M)),k.fetchers.forEach((M,$)=>{M.data!==void 0&&p.current.set($,M.data)});let D=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!I||D){j?qr(()=>a(k)):m(()=>a(k));return}if(j){qr(()=>{l&&(h&&h.resolve(),l.skipTransition()),g({isTransitioning:!0,flushSync:!0,currentLocation:I.currentLocation,nextLocation:I.nextLocation})});let M=n.window.document.startViewTransition(()=>{qr(()=>a(k))});M.finished.finally(()=>{qr(()=>{x(void 0),v(void 0),u(void 0),g({isTransitioning:!1})})}),qr(()=>v(M));return}l?(h&&h.resolve(),l.skipTransition(),c({state:k,currentLocation:I.currentLocation,nextLocation:I.nextLocation})):(u(k),g({isTransitioning:!0,flushSync:!1,currentLocation:I.currentLocation,nextLocation:I.nextLocation}))},[n.window,l,h,p,m]);le.useLayoutEffect(()=>n.subscribe(y),[n,y]),le.useEffect(()=>{f.isTransitioning&&!f.flushSync&&x(new Ky)},[f]),le.useEffect(()=>{if(h&&s&&n.window){let k=s,B=h.promise,O=n.window.document.startViewTransition(async()=>{m(()=>a(k)),await B});O.finished.finally(()=>{x(void 0),v(void 0),u(void 0),g({isTransitioning:!1})}),v(O)}},[m,s,h,n.window]),le.useEffect(()=>{h&&s&&o.location.key===s.location.key&&h.resolve()},[h,l,o.location,s]),le.useEffect(()=>{!f.isTransitioning&&i&&(u(i.state),g({isTransitioning:!0,flushSync:!1,currentLocation:i.currentLocation,nextLocation:i.nextLocation}),c(void 0))},[f.isTransitioning,i]),le.useEffect(()=>{process.env.NODE_ENV!=="production"&&ct(t==null||!n.future.v7_partialHydration,"`<RouterProvider fallbackElement>` is deprecated when using `v7_partialHydration`, use a `HydrateFallback` component instead")},[]);let b=le.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:k=>n.navigate(k),push:(k,B,O)=>n.navigate(k,{state:B,preventScrollReset:O==null?void 0:O.preventScrollReset}),replace:(k,B,O)=>n.navigate(k,{replace:!0,state:B,preventScrollReset:O==null?void 0:O.preventScrollReset})}),[n]),C=n.basename||"/",S=le.useMemo(()=>({router:n,navigator:b,static:!1,basename:C}),[n,b,C]);return le.createElement(le.Fragment,null,le.createElement(Wn.Provider,{value:S},le.createElement($o.Provider,{value:o},le.createElement(Ru.Provider,{value:p.current},le.createElement(za.Provider,{value:f},le.createElement(Ty,{basename:C,location:o.location,navigationType:o.historyAction,navigator:b,future:{v7_relativeSplatPath:n.future.v7_relativeSplatPath}},o.initialized||n.future.v7_partialHydration?le.createElement(Gy,{routes:n.routes,future:n.future,state:o}):t))))),null)}function Gy(e){let{routes:t,future:n,state:r}=e;return by(t,void 0,r,n)}process.env.NODE_ENV;const Xy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Jy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ju=le.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:a,replace:s,state:u,target:f,to:g,preventScrollReset:h,unstable_viewTransition:x}=t,l=Va(t,$y),{basename:v}=le.useContext(zt),i,c=!1;if(typeof g=="string"&&Jy.test(g)&&(i=g,Xy))try{let y=new URL(window.location.href),b=g.startsWith("//")?new URL(y.protocol+g):new URL(g),C=Vt(b.pathname,v);b.origin===y.origin&&C!=null?g=C+b.search+b.hash:c=!0}catch{process.env.NODE_ENV!=="production"&&ct(!1,'<Link to="'+g+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let p=my(g,{relative:o}),d=ev(g,{replace:s,state:u,target:f,preventScrollReset:h,relative:o,unstable_viewTransition:x});function m(y){r&&r(y),y.defaultPrevented||d(y)}return le.createElement("a",Xn({},l,{href:i||p,onClick:c||a?r:m,ref:n,target:f}))});process.env.NODE_ENV!=="production"&&(ju.displayName="Link");const Yy=le.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:o=!1,className:a="",end:s=!1,style:u,to:f,unstable_viewTransition:g,children:h}=t,x=Va(t,Vy),l=Hr(f,{relative:x.relative}),v=vn(),i=le.useContext($o),{navigator:c,basename:p}=le.useContext(zt),d=i!=null&&av(l)&&g===!0,m=c.encodeLocation?c.encodeLocation(l).pathname:l.pathname,y=v.pathname,b=i&&i.navigation&&i.navigation.location?i.navigation.location.pathname:null;o||(y=y.toLowerCase(),b=b?b.toLowerCase():null,m=m.toLowerCase()),b&&p&&(b=Vt(b,p)||b);const C=m!=="/"&&m.endsWith("/")?m.length-1:m.length;let S=y===m||!s&&y.startsWith(m)&&y.charAt(C)==="/",k=b!=null&&(b===m||!s&&b.startsWith(m)&&b.charAt(m.length)==="/"),B={isActive:S,isPending:k,isTransitioning:d},O=S?r:void 0,j;typeof a=="function"?j=a(B):j=[a,S?"active":null,k?"pending":null,d?"transitioning":null].filter(Boolean).join(" ");let I=typeof u=="function"?u(B):u;return le.createElement(ju,Xn({},x,{"aria-current":O,className:j,ref:n,style:I,to:f,unstable_viewTransition:g}),typeof h=="function"?h(B):h)});process.env.NODE_ENV!=="production"&&(Yy.displayName="NavLink");const Qy=le.forwardRef((e,t)=>{let{fetcherKey:n,navigate:r,reloadDocument:o,replace:a,state:s,method:u=Ho,action:f,onSubmit:g,relative:h,preventScrollReset:x,unstable_viewTransition:l}=e,v=Va(e,Hy),i=ov(),c=iv(f,{relative:h}),p=u.toLowerCase()==="get"?"get":"post",d=m=>{if(g&&g(m),m.defaultPrevented)return;m.preventDefault();let y=m.nativeEvent.submitter,b=(y==null?void 0:y.getAttribute("formmethod"))||u;i(y||m.currentTarget,{fetcherKey:n,method:b,navigate:r,replace:a,state:s,relative:h,preventScrollReset:x,unstable_viewTransition:l})};return le.createElement("form",Xn({ref:t,method:p,action:c,onSubmit:o?g:d},v))});process.env.NODE_ENV!=="production"&&(Qy.displayName="Form"),process.env.NODE_ENV;var Wo;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Wo||(Wo={}));var Au;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Au||(Au={}));function Zy(e){return e+" must be used within a data router. See https://reactrouter.com/routers/picking-a-router."}function Lu(e){let t=le.useContext(Wn);return t||(process.env.NODE_ENV!=="production"?ke(!1,Zy(e)):ke(!1)),t}function ev(e,t){let{target:n,replace:r,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:u}=t===void 0?{}:t,f=At(),g=vn(),h=Hr(e,{relative:s});return le.useCallback(x=>{if(Dy(x,n)){x.preventDefault();let l=r!==void 0?r:Pn(g)===Pn(h);f(e,{replace:l,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:u})}},[g,f,h,r,o,n,e,a,s,u])}function tv(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}let nv=0,rv=()=>"__"+String(++nv)+"__";function ov(){let{router:e}=Lu(Wo.UseSubmit),{basename:t}=le.useContext(zt),n=Oy();return le.useCallback(function(r,o){o===void 0&&(o={}),tv();let{action:a,method:s,encType:u,formData:f,body:g}=Uy(r,t);if(o.navigate===!1){let h=o.fetcherKey||rv();e.fetch(h,n,o.action||a,{preventScrollReset:o.preventScrollReset,formData:f,body:g,formMethod:o.method||s,formEncType:o.encType||u,unstable_flushSync:o.unstable_flushSync})}else e.navigate(o.action||a,{preventScrollReset:o.preventScrollReset,formData:f,body:g,formMethod:o.method||s,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:n,unstable_flushSync:o.unstable_flushSync,unstable_viewTransition:o.unstable_viewTransition})},[e,t,n])}function iv(e,t){let{relative:n}=t===void 0?{}:t,{basename:r}=le.useContext(zt),o=le.useContext(qt);o||(process.env.NODE_ENV!=="production"?ke(!1,"useFormAction must be used inside a RouteContext"):ke(!1));let[a]=o.matches.slice(-1),s=Xn({},Hr(e||".",{relative:n})),u=vn();if(e==null){s.search=u.search;let f=new URLSearchParams(s.search);f.has("index")&&f.get("index")===""&&(f.delete("index"),s.search=f.toString()?"?"+f.toString():"")}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(s.pathname=s.pathname==="/"?r:Qt([r,s.pathname])),Pn(s)}function av(e,t){t===void 0&&(t={});let n=le.useContext(za);n==null&&(process.env.NODE_ENV!=="production"?ke(!1,"`unstable_useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"):ke(!1));let{basename:r}=Lu(Wo.useViewTransitionState),o=Hr(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=Vt(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=Vt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ba(o.pathname,s)!=null||Ba(o.pathname,a)!=null}const sv="data:image/svg+xml,%3csvg%20width='24'%20height='25'%20viewBox='0%200%2024%2025'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1.37482%209.55838C0.802045%2011.696%200.887351%2013.9567%201.61959%2016.045C2.35183%2018.1334%203.69695%2019.9524%205.47921%2021.2642C7.26146%2022.5761%209.39798%2023.3199%2011.6096%2023.3985C13.8212%2023.477%2016.0051%2022.8866%2017.876%2021.7045C19.7468%2020.5223%2021.2175%2018.8034%2022.0961%2016.7722C22.9746%2014.7411%2023.2201%2012.4921%2022.8004%2010.3193C22.3807%208.1464%2021.3154%206.15066%2019.7436%204.59277C18.1718%203.03489%2016.1667%201.98732%2013.9902%201.58693M7.14096%202.53681C5.21049%203.48732%203.60119%204.98315%202.51232%206.8391M10.7049%201.48193C10.452%201.51191%2010.2003%201.55066%209.95012%201.59811M18.1995%2015.656C18.757%2014.5927%2019.0317%2013.4039%2018.9971%2012.2038C18.9625%2011.0037%2018.6198%209.83263%2018.002%208.8032C17.3842%207.77377%2016.512%206.92055%2015.4692%206.32553C14.4264%205.73051%2013.2481%205.4137%2012.0476%205.40554C10.847%205.39739%209.66449%205.69816%208.61372%206.27895C7.56295%206.85974%206.67923%207.70104%206.04747%208.72198C5.41572%209.74292%205.05717%2010.9092%205.00628%2012.1087C4.9554%2013.3082%205.21389%2014.5007%205.75691%2015.5714M9.15764%2013.3648C9.00624%2012.9162%208.96314%2012.4382%209.03189%2011.9698C9.10064%2011.5014%209.27926%2011.0559%209.55317%2010.6697C9.82708%2010.2836%2010.1885%209.96774%2010.6079%209.74803C11.0272%209.52832%2011.4926%209.41098%2011.966%209.4056C12.4394%209.40023%2012.9074%209.50697%2013.3316%209.71709C13.7559%209.92722%2014.1244%2010.2348%2014.407%2010.6146C14.6896%2010.9944%2014.8783%2011.4358%2014.9576%2011.9025C15.037%2012.3692%2015.0048%2012.8481%2014.8636%2013.3M14.0993%2010.2622C14.0043%2010.1691%2013.9032%2010.0825%2013.7967%2010.0028M8.2478%2018.3147C9.32147%2018.9965%2010.5606%2019.3728%2011.832%2019.4033C13.1035%2019.4339%2014.3592%2019.1174%2015.4644%2018.488'%20stroke='%233430FF'%20stroke-width='2'%20stroke-linecap='round'/%3e%3c/svg%3e";function lv(){const e=At(),{t}=Qe(),n=kn();return H.useEffect(()=>{n.sessionUuid&&e(`/${n.sessionUuid}`)},[n.sessionUuid,e]),E.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 text-center",children:[E.jsxs("div",{className:"flex items-center justify-center gap-3",children:[E.jsx("img",{alt:"logo",src:sv,className:"z-10 h-16 w-16 hover:animate-spin"}),E.jsxs("p",{className:"z-10 text-7xl font-semibold tracking-wide text-gray-600",children:["Welcome to ",E.jsx("span",{className:"italic",children:"PortalSessions"})]})]}),n.sessionUuid?E.jsx(Ye,{style:{padding:"1.5rem 2rem"},label:t("continue"),onClick:()=>e(`/${n.sessionUuid}`)}):E.jsx("p",{className:"text-error-600",children:`${t("somethingWentWrong")} ${t("portalSessionNotFound")}.`})]})}function cv(){const e=At(),{t}=Qe(),{sessionUuid:n}=kn(),{session:r,isLoading:o,mutate:a}=bt();return H.useEffect(()=>{if(!o&&r){const s=r.type in Zt?`/${r.type.toLowerCase()}`:"/";e(s)}},[o,a,e,r]),o?E.jsx(Tl,{}):E.jsx("div",{className:"flex w-full items-center justify-center text-error-600",children:`${t("portalSessionNotFound")} (${n})`})}Gn([{path:"/",element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(qa,{})},{path:"/top-up/:hash",element:E.jsx(Du,{})},{path:"/redeem/:hash",element:E.jsx(Iu,{})}]}]);function qa(){const{t:e}=Qe(),[t,n]=H.useState(""),[r,o]=H.useState(!1),{session:a}=bt(),s=At(),u=a==null?void 0:a.input_data.scanner_type,f=H.useCallback(()=>a.results.remaining_amount??(a==null?void 0:a.input_data.amount_in_cents),[a]),g=H.useCallback(async()=>{o(!0);const{data:{data:h}}=await Ii.get(t);s(`${a.type===Tn.REDEEM_GIFTCARD?"redeem":"top-up"}/${h.hash}`)},[t,s,a]);return H.useEffect(()=>{u===Mt.CAMERA&&t&&!r&&g().then()},[t,r,u,g]),(a==null?void 0:a.type)===Tn.REDEEM_GIFTCARD&&!(a!=null&&a.input_data.amount_in_cents)?E.jsx(E.Fragment,{children:e("xIsRequired",{x:"Amount in cents"})}):E.jsx("div",{className:"container m-auto",children:E.jsx(_t,{children:E.jsxs("div",{className:"flex flex-col gap-3",children:[E.jsx(qe,{size:"sm",weight:"extralight",children:e("scanGiftcard")}),(a==null?void 0:a.type)===Tn.REDEEM_GIFTCARD&&E.jsx(qe,{size:"lg",children:`${e("amountToBePaid")}: ${tr(f())}`}),E.jsx(wo,{dataSetter:n,type:u,label:e("hash")}),u===Mt.HAND_SCANNER&&E.jsx("div",{children:E.jsx(Ye,{type:"submit",label:e("submit"),onClick:g})})]})})})}function Iu(){const{t:e}=Qe(),{hash:t}=Pu(),{giftcard:n,mutate:r}=hl(t),{session:o,mutate:a}=bt(),{onUseGiftcard:s}=kn(),u=At(),f=(o==null?void 0:o.input_data.amount_in_cents)??0,g=(o==null?void 0:o.input_data.allow_multiple_giftcards)??!0;if(!n)return E.jsx(E.Fragment,{children:e("giftcardNotFound")});const h=async()=>{const v=await Ii.transaction(n.uuid,-l());await r();const i=await a(),c=i==null?void 0:i.data.data.events;Zo(c),De.success(`${e("transactionSuccessful")}!`),s&&s(v.data.data)},x=()=>o.results.remaining_amount??f,l=()=>Math.min(x(),n.amount_in_cents);return E.jsx("div",{className:"container m-auto",children:E.jsx(_t,{children:E.jsxs("div",{className:"flex h-96 flex-col items-center justify-between",children:[E.jsxs("div",{children:[E.jsxs(qe,{size:"md",align:"center",children:[e("giftcard"),": ",n.hash]}),E.jsx(qe,{size:"sm",align:"center",weight:"light",className:"text-gray-500",children:n.expiration_date?e("expiresAtDate",{date:n.formatted_expiration_date}):n.formatted_expiration_date})]}),E.jsxs("div",{children:[E.jsx(qe,{size:"lg",align:"center",children:e("balance")}),E.jsx(qe,{size:"4xl",align:"center",children:n.display_amount})]}),E.jsx("div",{className:"mx-auto flex gap-2",children:l()?E.jsx(Ye,{label:e("confirmAndPay",{amount:tr(l(),o==null?void 0:o.currency)}),onClick:h}):E.jsxs("div",{className:"flex flex-col gap-4",children:[E.jsx(qe,{size:"lg",align:"center",className:"text-gray-500",children:e("xOfYPaid",{x:x()?tr(f-x(),o==null?void 0:o.currency):e("fullAmount"),y:tr(f,o==null?void 0:o.currency)})}),g&&x()?E.jsx(Ye,{label:e("useAnotherGiftcard"),onClick:()=>u("../")}):null]})})]})})})}function Du(){const{t:e}=Qe(),{hash:t}=Pu(),{giftcard:n,mutate:r}=hl(t),[o,a]=H.useState(!1),[s,u]=H.useState("");if(!n)return E.jsx(E.Fragment,{children:e("giftcardNotFound")});const f=async()=>{const g=await Ii.transaction(n.uuid,parseFloat(s)*100);await r(),De.success(`${e("transactionSuccessful")}! ${e("totalUpgradedAmount")}: ${tr(g.data.data.amount_in_cents)}`),a(!1)};return E.jsxs("div",{className:"container m-auto",children:[E.jsx(_t,{children:E.jsxs("div",{className:"flex h-96 flex-col items-center justify-between",children:[E.jsxs("div",{children:[E.jsxs(qe,{size:"md",align:"center",children:[e("giftcard"),": ",n.hash]}),E.jsx(qe,{size:"sm",align:"center",weight:"light",className:"text-gray-500",children:n.expiration_date?e("expiresAtDate",{date:n.formatted_expiration_date}):n.formatted_expiration_date})]}),E.jsxs("div",{children:[E.jsx(qe,{size:"lg",align:"center",children:e("balance")}),E.jsx(qe,{size:"4xl",align:"center",children:n.display_amount})]}),E.jsx("div",{className:"mx-auto flex gap-2",children:E.jsx(Ye,{label:e("topUp"),onClick:()=>a(!0)})})]})}),E.jsx(Mn,{isOpen:o,onClose:()=>a(!1),children:E.jsxs("div",{className:"flex flex-col gap-4",children:[E.jsx($i,{value:s,valueSetter:u}),E.jsx(Ye,{label:e("submit"),onClick:f})]})})]})}Gn([{path:"/",element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(Fu,{})},{path:"email",element:E.jsx(Uu,{})},{path:"identifier",element:E.jsx(Ka,{})},{path:"register",element:E.jsx($u,{})}]}]);function uv(){const{t:e}=Qe(),{contact:t,isLoading:n,mutate:r}=yo(),[o,a]=H.useState(),[s,u]=H.useState();H.useEffect(()=>{o||(async()=>{const{data:h}=await fl.get();a(h.data.elements)})()},[t,o]);const f=(h,x)=>{u({...s,[h]:x})},g=async()=>{s&&(await fl.update(s),await r(),De.success(e("contactAttributesUpdated")))};return!o||n?E.jsx(Tl,{}):E.jsxs("div",{className:"flex h-full flex-col gap-6",children:[E.jsx("div",{className:"flex justify-end",children:E.jsx(Ye,{label:e("saveChanges"),onClick:g})}),E.jsx("hr",{}),E.jsx("div",{className:"grid h-full grid-cols-2 gap-x-6 gap-y-2 overflow-y-auto p-1",children:o.map(h=>{if(h.type==="media_upload")return;const x=h.disabled?E.jsx(Xh,{type:h.type,value:t.current_display_values[h.name],label:h.label,underlying_value:t.current_values[h.name]}):E.jsx(Jh,{...h,onChange:f});return E.jsx("div",{children:x},h.id)})})]})}function dv(){const{t:e}=Qe(),{data:t,isLoading:n,mutate:r}=Uh(),o=async s=>{await Fh.update({subscription_type_id:s.subscription_type.id}),await r()},a=s=>{const u=s.subscription_type.strategy,f=s.status;if(u===In.FUNCTIONAL)return e("disabled");switch(f){case hr.SUBSCRIBED:return e("unsubscribe");case hr.UNSUBSCRIBED:return u===In.OPT_IN||In.OPT_OUT?e("subscribe"):e("sendConfirmationEmail");case hr.PENDING_CONFIRMATION:return e("sendReminder");default:return""}};return n?E.jsx(Ac,{rows:5}):E.jsx("div",{children:t.data.data.map(s=>E.jsxs("div",{className:"mb-4 flex justify-between rounded-lg border border-gray-200 px-6 py-4 bg-white",children:[E.jsxs("div",{children:[E.jsxs("div",{className:"flex gap-3",children:[E.jsx(qe,{weight:"normal",children:s.subscription_type.name}),E.jsx("span",{className:`flex gap-2 rounded-full px-2 py-0.5 text-sm font-light ${s.is_subscribed?"bg-[#03985515] text-[#039855]":"bg-[#E0273115] text-[#E02731]"}`,children:s.status.charAt(0)+s.status.substring(1).toLowerCase()})]}),E.jsx(qe,{color:"text-gray-400",size:"sm",children:s.subscription_type.description})]}),E.jsx(Ye,{style:{color:"inherit",backgroundColor:"white",border:"1px solid rgb(229 231 235)"},disabled:s.subscription_type.strategy===In.FUNCTIONAL,onClick:()=>o(s),label:a(s)})]},s.subscription_type.uuid))})}const Mu="contact-identifiers",fv={create:e=>tt.instance.post(Je(Mu),e)},hv=()=>{const{data:e,error:t,isLoading:n,isValidating:r,mutate:o}=fn(Je(Mu));return{identifiers:e==null?void 0:e.data.data,data:e,error:t,isLoading:n,isValidating:r,mutate:o}};function pv(){const{t:e}=Qe(),{data:t,isLoading:n,mutate:r}=hv(),[o,a]=H.useState(!1),[s,u]=H.useState(""),[f,g]=H.useState(!1),h=()=>{g(!0),fv.create({value:s}).then(()=>{r(),a(!1)}).catch(x=>De.error(x)).finally(()=>g(!1))};return n?E.jsx(Ac,{rows:5}):E.jsxs("div",{className:"flex flex-col gap-2",children:[E.jsx("div",{className:"flex justify-end",children:E.jsx(Ye,{label:e("addIdentifier"),onClick:()=>a(!0)})}),t.data.data.map(x=>E.jsx("div",{className:"flex justify-between rounded-lg border border-gray-200 px-6 py-4 bg-white",children:E.jsxs("div",{children:[E.jsx(qe,{weight:"semibold",children:x.name}),E.jsx(qe,{children:x.value})]})},x.value)),E.jsx(Mn,{isOpen:o,onClose:()=>a(!1),title:e("addIdentifier"),children:E.jsxs("div",{className:"flex flex-col gap-4 min-w-96",children:[E.jsx(Dn,{id:"add-identifier",name:"identifier",label:"Identifier value",type:"text",onChange:(x,l)=>u(l),autoFocus:!0}),E.jsx(Ye,{label:e("addIdentifier"),onClick:h,disabled:f})]})})]})}function mv(){const{t:e}=Qe(),[t,n]=H.useState(),r=H.useMemo(()=>[{id:0,label:e("contactDetails"),icon:E.jsx("path",{d:"M10 0a10 10 0 1 0 10 10A10.011 10.011 0 0 0 10 0Zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6Zm0 13a8.949 8.949 0 0 1-4.951-1.488A3.987 3.987 0 0 1 9 13h2a3.987 3.987 0 0 1 3.951 3.512A8.949 8.949 0 0 1 10 18Z"}),content:E.jsx(uv,{})},{id:1,label:e("subscriptions"),icon:E.jsx("path",{d:"M18 7.5h-.423l-.452-1.09.3-.3a1.5 1.5 0 0 0 0-2.121L16.01 2.575a1.5 1.5 0 0 0-2.121 0l-.3.3-1.089-.452V2A1.5 1.5 0 0 0 11 .5H9A1.5 1.5 0 0 0 7.5 2v.423l-1.09.452-.3-.3a1.5 1.5 0 0 0-2.121 0L2.576 3.99a1.5 1.5 0 0 0 0 2.121l.3.3L2.423 7.5H2A1.5 1.5 0 0 0 .5 9v2A1.5 1.5 0 0 0 2 12.5h.423l.452 1.09-.3.3a1.5 1.5 0 0 0 0 2.121l1.415 1.413a1.5 1.5 0 0 0 2.121 0l.3-.3 1.09.452V18A1.5 1.5 0 0 0 9 19.5h2a1.5 1.5 0 0 0 1.5-1.5v-.423l1.09-.452.3.3a1.5 1.5 0 0 0 2.121 0l1.415-1.414a1.5 1.5 0 0 0 0-2.121l-.3-.3.452-1.09H18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 18 7.5Zm-8 6a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7Z"}),content:E.jsx(dv,{})},{id:2,label:e("identifiers"),icon:E.jsx("path",{d:"M18 7.5h-.423l-.452-1.09.3-.3a1.5 1.5 0 0 0 0-2.121L16.01 2.575a1.5 1.5 0 0 0-2.121 0l-.3.3-1.089-.452V2A1.5 1.5 0 0 0 11 .5H9A1.5 1.5 0 0 0 7.5 2v.423l-1.09.452-.3-.3a1.5 1.5 0 0 0-2.121 0L2.576 3.99a1.5 1.5 0 0 0 0 2.121l.3.3L2.423 7.5H2A1.5 1.5 0 0 0 .5 9v2A1.5 1.5 0 0 0 2 12.5h.423l.452 1.09-.3.3a1.5 1.5 0 0 0 0 2.121l1.415 1.413a1.5 1.5 0 0 0 2.121 0l.3-.3 1.09.452V18A1.5 1.5 0 0 0 9 19.5h2a1.5 1.5 0 0 0 1.5-1.5v-.423l1.09-.452.3.3a1.5 1.5 0 0 0 2.121 0l1.415-1.414a1.5 1.5 0 0 0 0-2.121l-.3-.3.452-1.09H18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 18 7.5Zm-8 6a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7Z"}),content:E.jsx(pv,{})}],[e]);return H.useEffect(()=>{t||n(r[0])},[r,t]),E.jsxs("div",{className:"h-full sm:flex",children:[E.jsx("ul",{className:"flex-column space-y mb-4 space-y-4 text-sm font-medium text-gray-500 md:mb-0 md:me-4",children:r.map(o=>E.jsx("li",{children:E.jsxs("div",{className:`inline-flex w-full cursor-pointer items-center rounded-lg px-4 py-3 ${o.id===(t==null?void 0:t.id)?"bg-primary-600 text-white":"bg-gray-50 hover:bg-gray-100 hover:text-gray-900"}`,onClick:()=>n(o),children:[E.jsx("svg",{className:`me-2 h-4 w-4 ${o.id===(t==null?void 0:t.id)?"text-white":"text-gray-500"}`,"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 20 20",children:o.icon}),E.jsx("p",{className:"truncate",children:o.label})]})},o.id))}),E.jsx("div",{className:"text-medium h-full w-full rounded-lg bg-gray-50 p-6",children:t&&t.content})]})}function gv(){const{data:e,isLoading:t,mutate:n}=Mh(),{mutate:r}=yo(),{onClaimReward:o}=kn(),{t:a}=Qe(),s=async u=>{const f=await Dh.claim(u);n(),r(),De.success(a("rewardClaimed",{name:f.data.data.title})),o&&o(f.data.data)};return E.jsx(Lc,{header:t?[]:e.data.data.header.items,rows:t?[]:e.data.data.rows,pending:t,onClick:s})}function yv(){const{data:e,isLoading:t,mutate:n}=$h(),{mutate:r}=bt(),{onRedeemVoucher:o}=kn(),{t:a}=Qe(),s=async u=>{const f=await Fi.redeemById(u),g=await r(),h=g==null?void 0:g.data.data.events;Zo(h),n(),De.success(a("voucherSuccessfullyRedeemed")),o&&o(f.data.data)};return E.jsx(Lc,{header:t?[]:e.data.data.header.items,rows:t?[]:e.data.data.rows,pending:t,onClick:s})}function vv(){const{t:e}=Qe(),{session:{loyalty_program:t}}=bt(),{contact:n,isLoading:r}=yo();if(r)return E.jsx(E.Fragment,{});const o=[{value:n.credit_balance.balance,label:t.custom_credit_name||e("points")},{value:n.current_display_values.loyalty_number_of_transactions,label:e("transactions")},{value:n.tier?n.tier.name:"-",label:e("tier")}];return E.jsxs("div",{className:"flex w-full justify-between text-inherit",children:[E.jsxs("div",{children:[E.jsx("p",{className:"text-md font-medium",children:`${n.current_display_values.firstname} ${n.current_display_values.lastname}`}),E.jsx("p",{className:"text-sm",children:n.current_display_values.email})]}),E.jsx("div",{className:"flex gap-8",children:o.map(a=>E.jsxs("div",{className:"flex flex-col items-center",children:[E.jsx("p",{className:"text-md font-medium",children:a.value}),E.jsx("p",{className:"text-sm",children:a.label})]},a.label))})]})}function bv(){const{t:e}=Qe(),{session:t}=bt(),n=t.contact,[r,o]=H.useState("rewards");if(!n)return E.jsx(E.Fragment,{children:e("contactNotFound")});const a=()=>{switch(r){case"profile":return E.jsx(mv,{});case"rewards":return E.jsx(gv,{});case"vouchers":return E.jsx(yv,{})}};return E.jsx("div",{className:"container m-auto flex h-full p-4",children:E.jsx(_t,{children:E.jsxs("div",{className:"flex h-full flex-col gap-6",children:[E.jsx(vv,{}),E.jsx("hr",{}),E.jsx("div",{children:E.jsx(zh,{elements:[{key:"profile",label:e("profile"),active:r==="profile"},{key:"rewards",label:e("rewards"),active:r==="rewards"},{key:"vouchers",label:e("vouchers"),active:r==="vouchers"}],onClick:s=>o(s)})}),E.jsx("div",{className:"overflow-y-auto",children:a()})]})})})}function wv(){const{session:e}=bt(),t=At(),{t:n}=Qe();return E.jsxs("div",{className:"m-auto flex flex-col items-center gap-4",children:[E.jsx("p",{children:n("noContactLinked")}),E.jsxs("div",{className:"flex gap-4",children:[e.input_data.enable_registration&&E.jsx(Ye,{label:n("registerNewContact"),onClick:()=>t("register")}),e.input_data.enable_email_identification&&E.jsx(Ye,{label:n("linkViaEmail"),onClick:()=>t("email")}),E.jsx(Ye,{label:n("linkViaCard"),onClick:()=>t("identifier")})]})]})}function Ka(){const e=At();return E.jsx("div",{className:"container m-auto",children:E.jsx(_t,{children:E.jsx(zi,{callback:()=>e("../")})})})}function Fu(){const{session:e}=bt();return e&&(e.contact?E.jsx(bv,{}):!e.input_data.enable_registration&&!e.input_data.enable_email_identification?E.jsx(Ka,{}):E.jsx(wv,{}))}function Uu(){const[e,t]=H.useState(""),{session:n,mutate:r}=bt(),o=At(),{t:a}=Qe(),s=async()=>{n&&(await vo.setContact(n.uuid,{email:e}),await r(),De.success(a("contactSavedToSession")),o("../"))};return E.jsx("div",{className:"container m-auto",children:E.jsx(_t,{children:E.jsxs("div",{className:"flex flex-col gap-3",children:[E.jsx("p",{children:a("fillInXBelow",{x:a("emailAddress").toLowerCase()})}),E.jsx(Dn,{autoFocus:!0,id:"email-input",name:"email",label:a("emailAddress"),type:"email",onChange:(u,f)=>t(f)}),E.jsx("div",{children:E.jsx(Ye,{type:"submit",label:a("linkContact"),onClick:s})})]})})})}function $u(){const[e,t]=H.useState(""),{session:n,mutate:r}=bt(),o=At(),{t:a}=Qe(),s=async()=>{n&&(await Ai.create(e),await r(),De.success(a("contactSavedToSession")),o("../"))};return E.jsx("div",{className:"container m-auto",children:E.jsx(_t,{children:E.jsxs("div",{className:"flex flex-col gap-3",children:[E.jsx("p",{children:a("fillInXBelow",{x:a("emailAddress").toLowerCase()})}),E.jsx(Dn,{autoFocus:!0,id:"email-input",name:"email",label:a("emailAddress"),type:"email",onChange:(u,f)=>t(f)}),E.jsx("div",{children:E.jsx(Ye,{type:"submit",label:a("register"),onClick:s})})]})})})}Gn([{path:"/",element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(Vu,{})},{path:"balance",element:E.jsx(Hu,{})}]}]);function Vu(){const e=At();return E.jsx("div",{className:"container m-auto",children:E.jsx(_t,{children:E.jsx(zi,{callback:()=>e("balance")})})})}function Hu(){const{t:e}=Qe(),{balance:t,mutate:n}=Ih(),[r,o]=H.useState(""),[a,s]=H.useState(1),[u,f]=H.useState(!1),g=async()=>{r&&(await Lh.transaction({amount_in_cents:parseFloat(r)*100*a}),await n(),De.success(e("prepaidTransactionCreated")),f(!1))};return E.jsxs("div",{className:"container m-auto",children:[E.jsxs(_t,{children:[E.jsxs(qe,{size:"lg",align:"center",weight:"normal",children:[e("prepaidBalance"),": ",t==null?void 0:t.balance]}),E.jsx("div",{className:"mt-6 flex justify-center",children:E.jsxs("div",{className:"grid w-1/3 grid-cols-2 gap-x-2",children:[E.jsx(Ye,{label:e("upgrade"),onClick:()=>{f(!0),s(1)}}),E.jsx(Ye,{label:e("depreciate"),onClick:()=>{f(!0),s(-1)}})]})})]}),E.jsx(Mn,{isOpen:u,onClose:()=>f(!1),children:E.jsxs("div",{className:"flex flex-col gap-4",children:[E.jsx($i,{value:r,valueSetter:o}),E.jsx(Ye,{label:e("submit"),onClick:g})]})})]})}Gn([{path:"/",element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(zu,{})},{path:"success",element:E.jsx(qu,{})}]}]);function zu(){const{t:e}=Qe(),[t,n]=H.useState(""),[r,o]=H.useState(!1),{session:a,mutate:s}=bt(),u=At(),f=async()=>{if(t){const{data:{data:g}}=await Ah.create({unit_value:parseFloat(t)});await s(),u("success",{state:{transaction:g}})}};return H.useEffect(()=>{a&&a.contact&&o(!0)},[u,a]),E.jsxs("div",{className:"container m-auto",children:[E.jsx(_t,{children:E.jsx(zi,{})}),E.jsx(Mn,{isOpen:r,children:E.jsxs("div",{className:"flex flex-col gap-4",children:[E.jsxs("p",{className:"text-center",children:[e("unitValue"),":"]}),E.jsx($i,{value:t,valueSetter:n}),E.jsx(Ye,{label:e("submit"),onClick:f})]})})]})}function qu(){const{state:e}=vn(),{t}=Qe(),{session:{loyalty_program:n}}=bt(),{contact:r}=yo();return E.jsx("div",{className:"m-auto",children:E.jsx(El,{children:E.jsxs("div",{className:"mt-8 flex w-96 flex-col gap-4",children:[E.jsxs(qe,{size:"lg",weight:"bold",align:"center",children:[t("creditReceptionCreated"),"!"]}),e&&e.transaction&&E.jsxs(qe,{color:"text-gray-500",align:"center",children:["+",e.transaction.credits," ",n.custom_credit_name||t("points").toLowerCase()]}),E.jsx("div",{className:"h-24"}),r&&E.jsxs("div",{className:"flex justify-between",children:[E.jsxs(qe,{color:"text-gray-200",children:[t("currentCreditBalance"),":"]}),E.jsxs(qe,{color:"text-gray-200",children:[r.credit_balance.balance," ",n.custom_credit_name||t("points").toLowerCase()]})]})]})})})}Gn([{path:"/",element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(Ku,{})},{path:"success",element:E.jsx(Wu,{})}]}]);function Ku(){const{t:e}=Qe(),[t,n]=H.useState(""),[r,o]=H.useState(""),[a,s]=H.useState(!1),[u,f]=H.useState(!1),{session:g,mutate:h}=bt(),x=g==null?void 0:g.input_data.scanner_type,l=At(),v=H.useCallback(async()=>{r&&await vo.setContact(g.uuid,{contact_identifier_value:r});const{data:{data:c}}=await Fi.redeemByCode(t),p=await h(),d=p==null?void 0:p.data.data.events;Zo(d),l("success",{state:{voucher:c}})},[t,r,l,g]),i=H.useCallback(async()=>{if(g){s(!0);const{data:{data:c}}=await Fi.get(t);c.contact||g.contact?await v():f(!0),s(!1)}},[t,v,g]);return H.useEffect(()=>{x===Mt.CAMERA&&t&&!a&&(async()=>await i())()},[t,a,x,i,u]),E.jsxs("div",{className:"container m-auto",children:[E.jsxs(_t,{children:[E.jsx(wo,{dataSetter:n,type:x,label:e("voucherCode")}),x===Mt.HAND_SCANNER&&E.jsx("div",{className:"pt-3",children:E.jsx(Ye,{type:"submit",label:e("redeemVoucher"),onClick:i})})]}),E.jsxs(Mn,{isOpen:u,onClose:()=>f(!1),children:[E.jsx("p",{className:"pb-4 text-error-600",children:e("noContactLinkedToVoucher")}),E.jsx(wo,{dataSetter:o,type:x,label:e("contactIdentifier")}),x===Mt.HAND_SCANNER&&E.jsx("div",{className:"pt-3",children:E.jsx(Ye,{type:"submit",label:e("redeemVoucher"),onClick:v})})]})]})}function Wu(){const{t:e}=Qe(),{state:t}=vn();return E.jsx("div",{className:"m-auto",children:E.jsx(El,{children:E.jsx(qe,{size:"lg",align:"center",className:"pt-6",children:e("voucherWithCodeSuccessfullyRedeemed",{code:t.voucher.code})})})})}const xv=Gn([{path:"/",element:E.jsx(lv,{})},{path:":portalSessionUuid",element:E.jsx(cv,{}),errorElement:E.jsx("div",{children:"No session UUID"})},{path:Zt.REDEEM_GIFTCARD,element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(qa,{})},{path:"redeem/:hash",element:E.jsx(Iu,{})}]},{path:Zt.TOP_UP_GIFTCARD,element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(qa,{})},{path:"top-up/:hash",element:E.jsx(Du,{})}]},{path:Zt.PORTAL,element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(Fu,{})},{path:"email",element:E.jsx(Uu,{})},{path:"identifier",element:E.jsx(Ka,{})},{path:"register",element:E.jsx($u,{})}]},{path:Zt.PREPAID,element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(Vu,{})},{path:"balance",element:E.jsx(Hu,{})}]},{path:Zt.SAVE,element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(zu,{})},{path:"success",element:E.jsx(qu,{})}]},{path:Zt.VOUCHER,element:E.jsx(Kt,{}),children:[{index:!0,element:E.jsx(Ku,{})},{path:"success",element:E.jsx(Wu,{})}]}]),Gu=()=>E.jsx(Wy,{router:xv});function kv(e){return E.jsx(wg,{config:e,payload:{type:e.type??Tn.PORTAL,api_key:e.apiKey,shop_uuid:e.shopUuid,contact_uuid:e.contactUuid,...e.amountInCents&&{amount_in_cents:e.amountInCents},...e.allowMultipleGiftcards&&{allow_multiple_giftcards:e.allowMultipleGiftcards},...e.scannerType&&{scanner_type:e.scannerType},...e.enableRegistration&&{enable_registration:e.enableRegistration},...e.enableEmailIdentification&&{enable_email_identification:e.enableEmailIdentification},...e.enableOnScreenKeyboard&&{enable_on_screen_keyboard:e.enableOnScreenKeyboard}},children:E.jsx(Gu,{})})}function Cv({uuid:e,host:t}){const[n,r]=H.useState(!1);return H.useEffect(()=>{n||(tt.initialize(void 0,t),r(!0))},[t,n]),n?E.jsxs(H.StrictMode,{children:[E.jsx(ml,{sessionUuid:e,children:E.jsx("div",{className:"flex h-screen w-screen bg-primary-50",children:E.jsxs("div",{className:"flex h-screen w-screen flex-col bg-primary-50",children:[E.jsx("div",{className:"flex h-full overflow-auto",children:E.jsx(Gu,{})}),e&&E.jsx(Cl,{})]})})}),E.jsx(ms,{position:"bottom-center"})]}):E.jsx(E.Fragment,{children:"Initializing..."})}const Ev=Object.freeze(Object.defineProperty({__proto__:null,createWorker:()=>new Worker(URL.createObjectURL(new Blob([`class x{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new x(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;f<b+d;f++)for(let g=a;g<a+c;g++)this.set(g,f,!!e)}}
|
|
104
104
|
class A{constructor(a,b,c){this.width=a;a*=b;if(c&&c.length!==a)throw Error("Wrong buffer size");this.data=c||new Uint8ClampedArray(a)}get(a,b){return this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c}}
|
|
105
105
|
class ba{constructor(a){this.bitOffset=this.byteOffset=0;this.bytes=a}readBits(a){if(1>a||32<a||a>this.available())throw Error("Cannot read "+a.toString()+" bits");var b=0;if(0<this.bitOffset){b=8-this.bitOffset;var c=a<b?a:b;b-=c;b=(this.bytes[this.byteOffset]&255>>8-c<<b)>>b;a-=c;this.bitOffset+=c;8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(0<a){for(;8<=a;)b=b<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,a-=8;0<a&&(c=8-a,b=b<<a|(this.bytes[this.byteOffset]&255>>c<<c)>>c,
|
|
106
106
|
this.bitOffset+=a)}return b}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var B,C=B||(B={});C.Numeric="numeric";C.Alphanumeric="alphanumeric";C.Byte="byte";C.Kanji="kanji";C.ECI="eci";C.StructuredAppend="structuredappend";var D,E=D||(D={});E[E.Terminator=0]="Terminator";E[E.Numeric=1]="Numeric";E[E.Alphanumeric=2]="Alphanumeric";E[E.Byte=4]="Byte";E[E.Kanji=8]="Kanji";E[E.ECI=7]="ECI";E[E.StructuredAppend=3]="StructuredAppend";let F="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");
|