Some checks failed
Client Admin / build-deploy (push) Failing after 8s
Client Client / build-deploy (push) Failing after 3s
Client Registration / build-deploy (push) Failing after 20s
Client Tech / build-deploy (push) Failing after 1s
Client Home / build-deploy (push) Successful in 14s
2 lines
669 KiB
JavaScript
2 lines
669 KiB
JavaScript
/*! For license information please see bundle.js.LICENSE.txt */
|
||
(()=>{"use strict";var e={20(e,t,n){var r=n(540),o=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,n){var r,a={},l=null,u=null;for(r in void 0!==n&&(l=""+n),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)i.call(t,r)&&!c.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===a[r]&&(a[r]=t[r]);return{$$typeof:o,type:e,key:l,ref:u,props:a,_owner:s.current}}t.Fragment=a,t.jsx=l,t.jsxs=l},56(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},72(e){var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var a={},i=[],s=0;s<e.length;s++){var c=e[s],l=r.base?c[0]+r.base:c[0],u=a[l]||0,d="".concat(l," ").concat(u);a[l]=u+1;var h=n(d),p={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==h)t[h].references++,t[h].updater(p);else{var f=o(p,r);r.byIndex=s,t.splice(s,0,{identifier:d,updater:f,references:1})}i.push(d)}return i}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var a=r(e=e||[],o=o||{});return function(e){e=e||[];for(var i=0;i<a.length;i++){var s=n(a[i]);t[s].references--}for(var c=r(e,o),l=0;l<a.length;l++){var u=n(a[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}a=c}}},113(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},159(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},287(e,t){var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator,f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,m={};function v(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||f}function y(){}function b(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||f}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=v.prototype;var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var w=Array.isArray,k=Object.prototype.hasOwnProperty,C={current:null},S={key:!0,ref:!0,__self:!0,__source:!0};function T(e,t,r){var o,a={},i=null,s=null;if(null!=t)for(o in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(i=""+t.key),t)k.call(t,o)&&!S.hasOwnProperty(o)&&(a[o]=t[o]);var c=arguments.length-2;if(1===c)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(o in c=e.defaultProps)void 0===a[o]&&(a[o]=c[o]);return{$$typeof:n,type:e,key:i,ref:s,props:a,_owner:C.current}}function I(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var j=/\/+/g;function A(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function N(e,t,o,a,i){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var c=!1;if(null===e)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case n:case r:c=!0}}if(c)return i=i(c=e),e=""===a?"."+A(c,0):a,w(i)?(o="",null!=e&&(o=e.replace(j,"$&/")+"/"),N(i,t,o,"",function(e){return e})):null!=i&&(I(i)&&(i=function(e,t){return{$$typeof:n,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(i,o+(!i.key||c&&c.key===i.key?"":(""+i.key).replace(j,"$&/")+"/")+e)),t.push(i)),1;if(c=0,a=""===a?".":a+":",w(e))for(var l=0;l<e.length;l++){var u=a+A(s=e[l],l);c+=N(s,t,o,u,i)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),l=0;!(s=e.next()).done;)c+=N(s=s.value,t,o,u=a+A(s,l++),i);else if("object"===s)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return c}function E(e,t,n){if(null==e)return e;var r=[],o=0;return N(e,r,"","",function(e){return t.call(n,e,o++)}),r}function _(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var P={current:null},O={transition:null},R={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:O,ReactCurrentOwner:C};function M(){throw Error("act(...) is not supported in production builds of React.")}t.Children={map:E,forEach:function(e,t,n){E(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return E(e,function(){t++}),t},toArray:function(e){return E(e,function(e){return e})||[]},only:function(e){if(!I(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=v,t.Fragment=o,t.Profiler=i,t.PureComponent=b,t.StrictMode=a,t.Suspense=u,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=R,t.act=M,t.cloneElement=function(e,t,r){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=g({},e.props),a=e.key,i=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(i=t.ref,s=C.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in t)k.call(t,l)&&!S.hasOwnProperty(l)&&(o[l]=void 0===t[l]&&void 0!==c?c[l]:t[l])}var l=arguments.length-2;if(1===l)o.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];o.children=c}return{$$typeof:n,type:e.type,key:a,ref:i,props:o,_owner:s}},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},t.createElement=T,t.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:l,render:e}},t.isValidElement=I,t.lazy=function(e){return{$$typeof:h,_payload:{_status:-1,_result:e},_init:_}},t.memo=function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=O.transition;O.transition={};try{e()}finally{O.transition=t}},t.unstable_act=M,t.useCallback=function(e,t){return P.current.useCallback(e,t)},t.useContext=function(e){return P.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return P.current.useDeferredValue(e)},t.useEffect=function(e,t){return P.current.useEffect(e,t)},t.useId=function(){return P.current.useId()},t.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return P.current.useMemo(e,t)},t.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},t.useRef=function(e){return P.current.useRef(e)},t.useState=function(e){return P.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return P.current.useTransition()},t.version="18.3.1"},314(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,r,o,a){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(r)for(var s=0;s<this.length;s++){var c=this[s][0];null!=c&&(i[c]=!0)}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);r&&i[u[0]]||(void 0!==a&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=a),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),t.push(u))}},t}},338(e,t,n){var r=n(961);t.H=r.createRoot,r.hydrateRoot},463(e,t){function n(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<a(o,t)))break e;e[r]=t,e[n]=o,n=r}}function r(e){return 0===e.length?null:e[0]}function o(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,i=o>>>1;r<i;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>a(c,n))l<o&&0>a(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else{if(!(l<o&&0>a(u,n)))break e;e[r]=u,e[l]=n,r=l}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var i=performance;t.unstable_now=function(){return i.now()}}else{var s=Date,c=s.now();t.unstable_now=function(){return s.now()-c}}var l=[],u=[],d=1,h=null,p=3,f=!1,g=!1,m=!1,v="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function x(e){for(var t=r(u);null!==t;){if(null===t.callback)o(u);else{if(!(t.startTime<=e))break;o(u),t.sortIndex=t.expirationTime,n(l,t)}t=r(u)}}function w(e){if(m=!1,x(e),!g)if(null!==r(l))g=!0,O(k);else{var t=r(u);null!==t&&R(w,t.startTime-e)}}function k(e,n){g=!1,m&&(m=!1,y(I),I=-1),f=!0;var a=p;try{for(x(n),h=r(l);null!==h&&(!(h.expirationTime>n)||e&&!N());){var i=h.callback;if("function"==typeof i){h.callback=null,p=h.priorityLevel;var s=i(h.expirationTime<=n);n=t.unstable_now(),"function"==typeof s?h.callback=s:h===r(l)&&o(l),x(n)}else o(l);h=r(l)}if(null!==h)var c=!0;else{var d=r(u);null!==d&&R(w,d.startTime-n),c=!1}return c}finally{h=null,p=a,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var C,S=!1,T=null,I=-1,j=5,A=-1;function N(){return!(t.unstable_now()-A<j)}function E(){if(null!==T){var e=t.unstable_now();A=e;var n=!0;try{n=T(!0,e)}finally{n?C():(S=!1,T=null)}}else S=!1}if("function"==typeof b)C=function(){b(E)};else if("undefined"!=typeof MessageChannel){var _=new MessageChannel,P=_.port2;_.port1.onmessage=E,C=function(){P.postMessage(null)}}else C=function(){v(E,0)};function O(e){T=e,S||(S=!0,C())}function R(e,n){I=v(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){g||f||(g=!0,O(k))},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function(e){switch(p){case 1:case 2:case 3:var t=3;break;default:t=p}var n=p;p=t;try{return e()}finally{p=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=p;p=e;try{return t()}finally{p=n}},t.unstable_scheduleCallback=function(e,o,a){var i=t.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?i+a:i,e){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return e={id:d++,callback:o,priorityLevel:e,startTime:a,expirationTime:s=a+s,sortIndex:-1},a>i?(e.sortIndex=a,n(u,e),null===r(l)&&e===r(u)&&(m?(y(I),I=-1):m=!0,R(w,a-i))):(e.sortIndex=s,n(l,e),g||f||(g=!0,O(k))),e},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}},540(e,t,n){e.exports=n(287)},551(e,t,n){var r=n(540),o=n(982);function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,s={};function c(e,t){l(e,t),l(e+"Capture",t)}function l(e,t){for(s[e]=t,e=0;e<t.length;e++)i.add(t[e])}var u=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),d=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},f={};function g(e,t,n,r,o,a,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=i}var m={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){m[e]=new g(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];m[t]=new g(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){m[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){m[e]=new g(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){m[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){m[e]=new g(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){m[e]=new g(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){m[e]=new g(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){m[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}function b(e,t,n,r){var o=m.hasOwnProperty(t)?m[t]:null;(null!==o?0!==o.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,o,r)&&(n=null),r||null===o?function(e){return!!d.call(f,e)||!d.call(p,e)&&(h.test(e)?f[e]=!0:(p[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=null===n?3!==o.type&&"":n:(t=o.attributeName,r=o.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(o=o.type)||4===o&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(v,y);m[t]=new g(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(v,y);m[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(v,y);m[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){m[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),m.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){m[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});var x=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for("react.element"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),j=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),P=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var O=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var R=Symbol.iterator;function M(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=R&&e[R]||e["@@iterator"])?e:null}var z,L=Object.assign;function q(e){if(void 0===z)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);z=t&&t[1]||""}return"\n"+z+e}var D=!1;function F(e,t){if(!e||D)return"";D=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var o=t.stack.split("\n"),a=r.stack.split("\n"),i=o.length-1,s=a.length-1;1<=i&&0<=s&&o[i]!==a[s];)s--;for(;1<=i&&0<=s;i--,s--)if(o[i]!==a[s]){if(1!==i||1!==s)do{if(i--,0>--s||o[i]!==a[s]){var c="\n"+o[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}}while(1<=i&&0<=s);break}}}finally{D=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?q(e):""}function U(e){switch(e.tag){case 5:return q(e.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("SuspenseList");case 0:case 2:case 15:return F(e.type,!1);case 11:return F(e.type.render,!1);case 1:return F(e.type,!0);default:return""}}function B(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case C:return"Fragment";case k:return"Portal";case T:return"Profiler";case S:return"StrictMode";case N:return"Suspense";case E:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case j:return(e.displayName||"Context")+".Consumer";case I:return(e._context.displayName||"Context")+".Provider";case A:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case _:return null!==(t=e.displayName||null)?t:B(e.type)||"Memo";case P:t=e._payload,e=e._init;try{return B(e(t))}catch(e){}}return null}function H(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return B(t);case 8:return t===S?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function K(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function $(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function G(e){e._valueTracker||(e._valueTracker=function(e){var t=$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var o=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(e){r=""+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function W(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function V(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Q(e,t){var n=t.checked;return L({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function Y(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=K(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function J(e,t){null!=(t=t.checked)&&b(e,"checked",t,!1)}function X(e,t){J(e,t);var n=K(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ee(e,t.type,n):t.hasOwnProperty("defaultValue")&&ee(e,t.type,K(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Z(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ee(e,t,n){"number"===t&&V(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var te=Array.isArray;function ne(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+K(n),t=null,o=0;o<e.length;o++){if(e[o].value===n)return e[o].selected=!0,void(r&&(e[o].defaultSelected=!0));null!==t||e[o].disabled||(t=e[o])}null!==t&&(t.selected=!0)}}function re(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(a(91));return L({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function oe(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(a(92));if(te(n)){if(1<n.length)throw Error(a(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:K(n)}}function ae(e,t){var n=K(t.value),r=K(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function ie(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function se(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ce(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?se(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var le,ue,de=(ue=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((le=le||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=le.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction(function(){return ue(e,t)})}:ue);function he(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var pe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fe=["Webkit","ms","Moz","O"];function ge(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||pe.hasOwnProperty(e)&&pe[e]?(""+t).trim():t+"px"}function me(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),o=ge(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}Object.keys(pe).forEach(function(e){fe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),pe[t]=pe[e]})});var ve=L({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ye(e,t){if(t){if(ve[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(a(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(a(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(a(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(a(62))}}function be(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xe=null;function we(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var ke=null,Ce=null,Se=null;function Te(e){if(e=xo(e)){if("function"!=typeof ke)throw Error(a(280));var t=e.stateNode;t&&(t=ko(t),ke(e.stateNode,e.type,t))}}function Ie(e){Ce?Se?Se.push(e):Se=[e]:Ce=e}function je(){if(Ce){var e=Ce,t=Se;if(Se=Ce=null,Te(e),t)for(e=0;e<t.length;e++)Te(t[e])}}function Ae(e,t){return e(t)}function Ne(){}var Ee=!1;function _e(e,t,n){if(Ee)return e(t,n);Ee=!0;try{return Ae(e,t,n)}finally{Ee=!1,(null!==Ce||null!==Se)&&(Ne(),je())}}function Pe(e,t){var n=e.stateNode;if(null===n)return null;var r=ko(n);if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(a(231,t,typeof n));return n}var Oe=!1;if(u)try{var Re={};Object.defineProperty(Re,"passive",{get:function(){Oe=!0}}),window.addEventListener("test",Re,Re),window.removeEventListener("test",Re,Re)}catch(ue){Oe=!1}function Me(e,t,n,r,o,a,i,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var ze=!1,Le=null,qe=!1,De=null,Fe={onError:function(e){ze=!0,Le=e}};function Ue(e,t,n,r,o,a,i,s,c){ze=!1,Le=null,Me.apply(Fe,arguments)}function Be(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function He(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&null!==(e=e.alternate)&&(t=e.memoizedState),null!==t)return t.dehydrated}return null}function Ke(e){if(Be(e)!==e)throw Error(a(188))}function $e(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=Be(e)))throw Error(a(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(null===o)break;var i=o.alternate;if(null===i){if(null!==(r=o.return)){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return Ke(o),e;if(i===r)return Ke(o),t;i=i.sibling}throw Error(a(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,c=o.child;c;){if(c===n){s=!0,n=o,r=i;break}if(c===r){s=!0,r=o,n=i;break}c=c.sibling}if(!s){for(c=i.child;c;){if(c===n){s=!0,n=i,r=o;break}if(c===r){s=!0,r=i,n=o;break}c=c.sibling}if(!s)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(3!==n.tag)throw Error(a(188));return n.stateNode.current===n?e:t}(e))?Ge(e):null}function Ge(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=Ge(e);if(null!==t)return t;e=e.sibling}return null}var We=o.unstable_scheduleCallback,Ve=o.unstable_cancelCallback,Qe=o.unstable_shouldYield,Ye=o.unstable_requestPaint,Je=o.unstable_now,Xe=o.unstable_getCurrentPriorityLevel,Ze=o.unstable_ImmediatePriority,et=o.unstable_UserBlockingPriority,tt=o.unstable_NormalPriority,nt=o.unstable_LowPriority,rt=o.unstable_IdlePriority,ot=null,at=null,it=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(st(e)/ct|0)|0},st=Math.log,ct=Math.LN2,lt=64,ut=4194304;function dt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ht(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,o=e.suspendedLanes,a=e.pingedLanes,i=268435455&n;if(0!==i){var s=i&~o;0!==s?r=dt(s):0!==(a&=i)&&(r=dt(a))}else 0!==(i=n&~o)?r=dt(i):0!==a&&(r=dt(a));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&o)&&((o=r&-r)>=(a=t&-t)||16===o&&4194240&a))return t;if(4&r&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)o=1<<(n=31-it(t)),r|=e[n],t&=~o;return r}function pt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function ft(e){return 0!=(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function gt(){var e=lt;return!(4194240&(lt<<=1))&&(lt=64),e}function mt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function vt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-it(t)]=n}function yt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-it(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var bt=0;function xt(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var wt,kt,Ct,St,Tt,It=!1,jt=[],At=null,Nt=null,Et=null,_t=new Map,Pt=new Map,Ot=[],Rt="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Mt(e,t){switch(e){case"focusin":case"focusout":At=null;break;case"dragenter":case"dragleave":Nt=null;break;case"mouseover":case"mouseout":Et=null;break;case"pointerover":case"pointerout":_t.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pt.delete(t.pointerId)}}function zt(e,t,n,r,o,a){return null===e||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[o]},null!==t&&null!==(t=xo(t))&&kt(t),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==o&&-1===t.indexOf(o)&&t.push(o),e)}function Lt(e){var t=bo(e.target);if(null!==t){var n=Be(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=He(n)))return e.blockedOn=t,void Tt(e.priority,function(){Ct(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function qt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Qt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=xo(n))&&kt(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);xe=r,n.target.dispatchEvent(r),xe=null,t.shift()}return!0}function Dt(e,t,n){qt(e)&&n.delete(t)}function Ft(){It=!1,null!==At&&qt(At)&&(At=null),null!==Nt&&qt(Nt)&&(Nt=null),null!==Et&&qt(Et)&&(Et=null),_t.forEach(Dt),Pt.forEach(Dt)}function Ut(e,t){e.blockedOn===t&&(e.blockedOn=null,It||(It=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,Ft)))}function Bt(e){function t(t){return Ut(t,e)}if(0<jt.length){Ut(jt[0],e);for(var n=1;n<jt.length;n++){var r=jt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==At&&Ut(At,e),null!==Nt&&Ut(Nt,e),null!==Et&&Ut(Et,e),_t.forEach(t),Pt.forEach(t),n=0;n<Ot.length;n++)(r=Ot[n]).blockedOn===e&&(r.blockedOn=null);for(;0<Ot.length&&null===(n=Ot[0]).blockedOn;)Lt(n),null===n.blockedOn&&Ot.shift()}var Ht=x.ReactCurrentBatchConfig,Kt=!0;function $t(e,t,n,r){var o=bt,a=Ht.transition;Ht.transition=null;try{bt=1,Wt(e,t,n,r)}finally{bt=o,Ht.transition=a}}function Gt(e,t,n,r){var o=bt,a=Ht.transition;Ht.transition=null;try{bt=4,Wt(e,t,n,r)}finally{bt=o,Ht.transition=a}}function Wt(e,t,n,r){if(Kt){var o=Qt(e,t,n,r);if(null===o)Kr(e,t,r,Vt,n),Mt(e,r);else if(function(e,t,n,r,o){switch(t){case"focusin":return At=zt(At,e,t,n,r,o),!0;case"dragenter":return Nt=zt(Nt,e,t,n,r,o),!0;case"mouseover":return Et=zt(Et,e,t,n,r,o),!0;case"pointerover":var a=o.pointerId;return _t.set(a,zt(_t.get(a)||null,e,t,n,r,o)),!0;case"gotpointercapture":return a=o.pointerId,Pt.set(a,zt(Pt.get(a)||null,e,t,n,r,o)),!0}return!1}(o,e,t,n,r))r.stopPropagation();else if(Mt(e,r),4&t&&-1<Rt.indexOf(e)){for(;null!==o;){var a=xo(o);if(null!==a&&wt(a),null===(a=Qt(e,t,n,r))&&Kr(e,t,r,Vt,n),a===o)break;o=a}null!==o&&r.stopPropagation()}else Kr(e,t,r,null,n)}}var Vt=null;function Qt(e,t,n,r){if(Vt=null,null!==(e=bo(e=we(r))))if(null===(t=Be(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=He(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Vt=e,null}function Yt(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Xe()){case Ze:return 1;case et:return 4;case tt:case nt:return 16;case rt:return 536870912;default:return 16}default:return 16}}var Jt=null,Xt=null,Zt=null;function en(){if(Zt)return Zt;var e,t,n=Xt,r=n.length,o="value"in Jt?Jt.value:Jt.textContent,a=o.length;for(e=0;e<r&&n[e]===o[e];e++);var i=r-e;for(t=1;t<=i&&n[r-t]===o[a-t];t++);return Zt=o.slice(e,1<t?1-t:void 0)}function tn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function nn(){return!0}function rn(){return!1}function on(e){function t(t,n,r,o,a){for(var i in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=o,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(i)&&(t=e[i],this[i]=t?t(o):o[i]);return this.isDefaultPrevented=(null!=o.defaultPrevented?o.defaultPrevented:!1===o.returnValue)?nn:rn,this.isPropagationStopped=rn,this}return L(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=nn)},persist:function(){},isPersistent:nn}),t}var an,sn,cn,ln={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},un=on(ln),dn=L({},ln,{view:0,detail:0}),hn=on(dn),pn=L({},dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==cn&&(cn&&"mousemove"===e.type?(an=e.screenX-cn.screenX,sn=e.screenY-cn.screenY):sn=an=0,cn=e),an)},movementY:function(e){return"movementY"in e?e.movementY:sn}}),fn=on(pn),gn=on(L({},pn,{dataTransfer:0})),mn=on(L({},dn,{relatedTarget:0})),vn=on(L({},ln,{animationName:0,elapsedTime:0,pseudoElement:0})),yn=L({},ln,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),bn=on(yn),xn=on(L({},ln,{data:0})),wn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",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",224:"Meta"},Cn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Cn[e])&&!!t[e]}function Tn(){return Sn}var In=L({},dn,{key:function(e){if(e.key){var t=wn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=tn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?kn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tn,charCode:function(e){return"keypress"===e.type?tn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?tn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),jn=on(In),An=on(L({},pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Nn=on(L({},dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tn})),En=on(L({},ln,{propertyName:0,elapsedTime:0,pseudoElement:0})),_n=L({},pn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Pn=on(_n),On=[9,13,27,32],Rn=u&&"CompositionEvent"in window,Mn=null;u&&"documentMode"in document&&(Mn=document.documentMode);var zn=u&&"TextEvent"in window&&!Mn,Ln=u&&(!Rn||Mn&&8<Mn&&11>=Mn),qn=String.fromCharCode(32),Dn=!1;function Fn(e,t){switch(e){case"keyup":return-1!==On.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Un(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Bn=!1,Hn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Kn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Hn[e.type]:"textarea"===t}function $n(e,t,n,r){Ie(r),0<(t=Gr(t,"onChange")).length&&(n=new un("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Gn=null,Wn=null;function Vn(e){qr(e,0)}function Qn(e){if(W(wo(e)))return e}function Yn(e,t){if("change"===e)return t}var Jn=!1;if(u){var Xn;if(u){var Zn="oninput"in document;if(!Zn){var er=document.createElement("div");er.setAttribute("oninput","return;"),Zn="function"==typeof er.oninput}Xn=Zn}else Xn=!1;Jn=Xn&&(!document.documentMode||9<document.documentMode)}function tr(){Gn&&(Gn.detachEvent("onpropertychange",nr),Wn=Gn=null)}function nr(e){if("value"===e.propertyName&&Qn(Wn)){var t=[];$n(t,Wn,e,we(e)),_e(Vn,t)}}function rr(e,t,n){"focusin"===e?(tr(),Wn=n,(Gn=t).attachEvent("onpropertychange",nr)):"focusout"===e&&tr()}function or(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Qn(Wn)}function ar(e,t){if("click"===e)return Qn(t)}function ir(e,t){if("input"===e||"change"===e)return Qn(t)}var sr="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function cr(e,t){if(sr(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!d.call(t,o)||!sr(e[o],t[o]))return!1}return!0}function lr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ur(e,t){var n,r=lr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=lr(r)}}function dr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?dr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function hr(){for(var e=window,t=V();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=V((e=t.contentWindow).document)}return t}function pr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function fr(e){var t=hr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&dr(n.ownerDocument.documentElement,n)){if(null!==r&&pr(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var o=n.textContent.length,a=Math.min(r.start,o);r=void 0===r.end?a:Math.min(r.end,o),!e.extend&&a>r&&(o=r,r=a,a=o),o=ur(n,a);var i=ur(n,r);o&&i&&(1!==e.rangeCount||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&((t=t.createRange()).setStart(o.node,o.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var gr=u&&"documentMode"in document&&11>=document.documentMode,mr=null,vr=null,yr=null,br=!1;function xr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;br||null==mr||mr!==V(r)||(r="selectionStart"in(r=mr)&&pr(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},yr&&cr(yr,r)||(yr=r,0<(r=Gr(vr,"onSelect")).length&&(t=new un("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=mr)))}function wr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var kr={animationend:wr("Animation","AnimationEnd"),animationiteration:wr("Animation","AnimationIteration"),animationstart:wr("Animation","AnimationStart"),transitionend:wr("Transition","TransitionEnd")},Cr={},Sr={};function Tr(e){if(Cr[e])return Cr[e];if(!kr[e])return e;var t,n=kr[e];for(t in n)if(n.hasOwnProperty(t)&&t in Sr)return Cr[e]=n[t];return e}u&&(Sr=document.createElement("div").style,"AnimationEvent"in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),"TransitionEvent"in window||delete kr.transitionend.transition);var Ir=Tr("animationend"),jr=Tr("animationiteration"),Ar=Tr("animationstart"),Nr=Tr("transitionend"),Er=new Map,_r="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Pr(e,t){Er.set(e,t),c(t,[e])}for(var Or=0;Or<_r.length;Or++){var Rr=_r[Or];Pr(Rr.toLowerCase(),"on"+(Rr[0].toUpperCase()+Rr.slice(1)))}Pr(Ir,"onAnimationEnd"),Pr(jr,"onAnimationIteration"),Pr(Ar,"onAnimationStart"),Pr("dblclick","onDoubleClick"),Pr("focusin","onFocus"),Pr("focusout","onBlur"),Pr(Nr,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Mr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),zr=new Set("cancel close invalid load scroll toggle".split(" ").concat(Mr));function Lr(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,o,i,s,c,l){if(Ue.apply(this,arguments),ze){if(!ze)throw Error(a(198));var u=Le;ze=!1,Le=null,qe||(qe=!0,De=u)}}(r,t,void 0,e),e.currentTarget=null}function qr(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var a=void 0;if(t)for(var i=r.length-1;0<=i;i--){var s=r[i],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&o.isPropagationStopped())break e;Lr(o,s,l),a=c}else for(i=0;i<r.length;i++){if(c=(s=r[i]).instance,l=s.currentTarget,s=s.listener,c!==a&&o.isPropagationStopped())break e;Lr(o,s,l),a=c}}}if(qe)throw e=De,qe=!1,De=null,e}function Dr(e,t){var n=t[mo];void 0===n&&(n=t[mo]=new Set);var r=e+"__bubble";n.has(r)||(Hr(t,e,2,!1),n.add(r))}function Fr(e,t,n){var r=0;t&&(r|=4),Hr(n,e,r,t)}var Ur="_reactListening"+Math.random().toString(36).slice(2);function Br(e){if(!e[Ur]){e[Ur]=!0,i.forEach(function(t){"selectionchange"!==t&&(zr.has(t)||Fr(t,!1,e),Fr(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Ur]||(t[Ur]=!0,Fr("selectionchange",!1,t))}}function Hr(e,t,n,r){switch(Yt(t)){case 1:var o=$t;break;case 4:o=Gt;break;default:o=Wt}n=o.bind(null,t,n,e),o=void 0,!Oe||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(o=!0),r?void 0!==o?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):void 0!==o?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Kr(e,t,n,r,o){var a=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var i=r.tag;if(3===i||4===i){var s=r.stateNode.containerInfo;if(s===o||8===s.nodeType&&s.parentNode===o)break;if(4===i)for(i=r.return;null!==i;){var c=i.tag;if((3===c||4===c)&&((c=i.stateNode.containerInfo)===o||8===c.nodeType&&c.parentNode===o))return;i=i.return}for(;null!==s;){if(null===(i=bo(s)))return;if(5===(c=i.tag)||6===c){r=a=i;continue e}s=s.parentNode}}r=r.return}_e(function(){var r=a,o=we(n),i=[];e:{var s=Er.get(e);if(void 0!==s){var c=un,l=e;switch(e){case"keypress":if(0===tn(n))break e;case"keydown":case"keyup":c=jn;break;case"focusin":l="focus",c=mn;break;case"focusout":l="blur",c=mn;break;case"beforeblur":case"afterblur":c=mn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=fn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=gn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=Nn;break;case Ir:case jr:case Ar:c=vn;break;case Nr:c=En;break;case"scroll":c=hn;break;case"wheel":c=Pn;break;case"copy":case"cut":case"paste":c=bn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=An}var u=!!(4&t),d=!u&&"scroll"===e,h=u?null!==s?s+"Capture":null:s;u=[];for(var p,f=r;null!==f;){var g=(p=f).stateNode;if(5===p.tag&&null!==g&&(p=g,null!==h&&null!=(g=Pe(f,h))&&u.push($r(f,g,p))),d)break;f=f.return}0<u.length&&(s=new c(s,l,null,n,o),i.push({event:s,listeners:u}))}}if(!(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===xe||!(l=n.relatedTarget||n.fromElement)||!bo(l)&&!l[go])&&(c||s)&&(s=o.window===o?o:(s=o.ownerDocument)?s.defaultView||s.parentWindow:window,c?(c=r,null!==(l=(l=n.relatedTarget||n.toElement)?bo(l):null)&&(l!==(d=Be(l))||5!==l.tag&&6!==l.tag)&&(l=null)):(c=null,l=r),c!==l)){if(u=fn,g="onMouseLeave",h="onMouseEnter",f="mouse","pointerout"!==e&&"pointerover"!==e||(u=An,g="onPointerLeave",h="onPointerEnter",f="pointer"),d=null==c?s:wo(c),p=null==l?s:wo(l),(s=new u(g,f+"leave",c,n,o)).target=d,s.relatedTarget=p,g=null,bo(o)===r&&((u=new u(h,f+"enter",l,n,o)).target=p,u.relatedTarget=d,g=u),d=g,c&&l)e:{for(h=l,f=0,p=u=c;p;p=Wr(p))f++;for(p=0,g=h;g;g=Wr(g))p++;for(;0<f-p;)u=Wr(u),f--;for(;0<p-f;)h=Wr(h),p--;for(;f--;){if(u===h||null!==h&&u===h.alternate)break e;u=Wr(u),h=Wr(h)}u=null}else u=null;null!==c&&Vr(i,s,c,u,!1),null!==l&&null!==d&&Vr(i,d,l,u,!0)}if("select"===(c=(s=r?wo(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===c&&"file"===s.type)var m=Yn;else if(Kn(s))if(Jn)m=ir;else{m=or;var v=rr}else(c=s.nodeName)&&"input"===c.toLowerCase()&&("checkbox"===s.type||"radio"===s.type)&&(m=ar);switch(m&&(m=m(e,r))?$n(i,m,n,o):(v&&v(e,s,r),"focusout"===e&&(v=s._wrapperState)&&v.controlled&&"number"===s.type&&ee(s,"number",s.value)),v=r?wo(r):window,e){case"focusin":(Kn(v)||"true"===v.contentEditable)&&(mr=v,vr=r,yr=null);break;case"focusout":yr=vr=mr=null;break;case"mousedown":br=!0;break;case"contextmenu":case"mouseup":case"dragend":br=!1,xr(i,n,o);break;case"selectionchange":if(gr)break;case"keydown":case"keyup":xr(i,n,o)}var y;if(Rn)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Bn?Fn(e,n)&&(b="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(b="onCompositionStart");b&&(Ln&&"ko"!==n.locale&&(Bn||"onCompositionStart"!==b?"onCompositionEnd"===b&&Bn&&(y=en()):(Xt="value"in(Jt=o)?Jt.value:Jt.textContent,Bn=!0)),0<(v=Gr(r,b)).length&&(b=new xn(b,e,null,n,o),i.push({event:b,listeners:v}),(y||null!==(y=Un(n)))&&(b.data=y))),(y=zn?function(e,t){switch(e){case"compositionend":return Un(t);case"keypress":return 32!==t.which?null:(Dn=!0,qn);case"textInput":return(e=t.data)===qn&&Dn?null:e;default:return null}}(e,n):function(e,t){if(Bn)return"compositionend"===e||!Rn&&Fn(e,t)?(e=en(),Zt=Xt=Jt=null,Bn=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ln&&"ko"!==t.locale?null:t.data}}(e,n))&&0<(r=Gr(r,"onBeforeInput")).length&&(o=new xn("onBeforeInput","beforeinput",null,n,o),i.push({event:o,listeners:r}),o.data=y)}qr(i,t)})}function $r(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Gr(e,t){for(var n=t+"Capture",r=[];null!==e;){var o=e,a=o.stateNode;5===o.tag&&null!==a&&(o=a,null!=(a=Pe(e,n))&&r.unshift($r(e,a,o)),null!=(a=Pe(e,t))&&r.push($r(e,a,o))),e=e.return}return r}function Wr(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Vr(e,t,n,r,o){for(var a=t._reactName,i=[];null!==n&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(null!==c&&c===r)break;5===s.tag&&null!==l&&(s=l,o?null!=(c=Pe(n,a))&&i.unshift($r(n,c,s)):o||null!=(c=Pe(n,a))&&i.push($r(n,c,s))),n=n.return}0!==i.length&&e.push({event:t,listeners:i})}var Qr=/\r\n?/g,Yr=/\u0000|\uFFFD/g;function Jr(e){return("string"==typeof e?e:""+e).replace(Qr,"\n").replace(Yr,"")}function Xr(e,t,n){if(t=Jr(t),Jr(e)!==t&&n)throw Error(a(425))}function Zr(){}var eo=null,to=null;function no(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var ro="function"==typeof setTimeout?setTimeout:void 0,oo="function"==typeof clearTimeout?clearTimeout:void 0,ao="function"==typeof Promise?Promise:void 0,io="function"==typeof queueMicrotask?queueMicrotask:void 0!==ao?function(e){return ao.resolve(null).then(e).catch(so)}:ro;function so(e){setTimeout(function(){throw e})}function co(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&8===o.nodeType)if("/$"===(n=o.data)){if(0===r)return e.removeChild(o),void Bt(t);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=o}while(n);Bt(t)}function lo(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function uo(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var ho=Math.random().toString(36).slice(2),po="__reactFiber$"+ho,fo="__reactProps$"+ho,go="__reactContainer$"+ho,mo="__reactEvents$"+ho,vo="__reactListeners$"+ho,yo="__reactHandles$"+ho;function bo(e){var t=e[po];if(t)return t;for(var n=e.parentNode;n;){if(t=n[go]||n[po]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=uo(e);null!==e;){if(n=e[po])return n;e=uo(e)}return t}n=(e=n).parentNode}return null}function xo(e){return!(e=e[po]||e[go])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function wo(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(a(33))}function ko(e){return e[fo]||null}var Co=[],So=-1;function To(e){return{current:e}}function Io(e){0>So||(e.current=Co[So],Co[So]=null,So--)}function jo(e,t){So++,Co[So]=e.current,e.current=t}var Ao={},No=To(Ao),Eo=To(!1),_o=Ao;function Po(e,t){var n=e.type.contextTypes;if(!n)return Ao;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o,a={};for(o in n)a[o]=t[o];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function Oo(e){return null!=e.childContextTypes}function Ro(){Io(Eo),Io(No)}function Mo(e,t,n){if(No.current!==Ao)throw Error(a(168));jo(No,t),jo(Eo,n)}function zo(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var o in r=r.getChildContext())if(!(o in t))throw Error(a(108,H(e)||"Unknown",o));return L({},n,r)}function Lo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ao,_o=No.current,jo(No,e),jo(Eo,Eo.current),!0}function qo(e,t,n){var r=e.stateNode;if(!r)throw Error(a(169));n?(e=zo(e,t,_o),r.__reactInternalMemoizedMergedChildContext=e,Io(Eo),Io(No),jo(No,e)):Io(Eo),jo(Eo,n)}var Do=null,Fo=!1,Uo=!1;function Bo(e){null===Do?Do=[e]:Do.push(e)}function Ho(){if(!Uo&&null!==Do){Uo=!0;var e=0,t=bt;try{var n=Do;for(bt=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}Do=null,Fo=!1}catch(t){throw null!==Do&&(Do=Do.slice(e+1)),We(Ze,Ho),t}finally{bt=t,Uo=!1}}return null}var Ko=[],$o=0,Go=null,Wo=0,Vo=[],Qo=0,Yo=null,Jo=1,Xo="";function Zo(e,t){Ko[$o++]=Wo,Ko[$o++]=Go,Go=e,Wo=t}function ea(e,t,n){Vo[Qo++]=Jo,Vo[Qo++]=Xo,Vo[Qo++]=Yo,Yo=e;var r=Jo;e=Xo;var o=32-it(r)-1;r&=~(1<<o),n+=1;var a=32-it(t)+o;if(30<a){var i=o-o%5;a=(r&(1<<i)-1).toString(32),r>>=i,o-=i,Jo=1<<32-it(t)+o|n<<o|r,Xo=a+e}else Jo=1<<a|n<<o|r,Xo=e}function ta(e){null!==e.return&&(Zo(e,1),ea(e,1,0))}function na(e){for(;e===Go;)Go=Ko[--$o],Ko[$o]=null,Wo=Ko[--$o],Ko[$o]=null;for(;e===Yo;)Yo=Vo[--Qo],Vo[Qo]=null,Xo=Vo[--Qo],Vo[Qo]=null,Jo=Vo[--Qo],Vo[Qo]=null}var ra=null,oa=null,aa=!1,ia=null;function sa(e,t){var n=El(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function ca(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,ra=e,oa=lo(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,ra=e,oa=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==Yo?{id:Jo,overflow:Xo}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=El(18,null,null,0)).stateNode=t,n.return=e,e.child=n,ra=e,oa=null,!0);default:return!1}}function la(e){return!(!(1&e.mode)||128&e.flags)}function ua(e){if(aa){var t=oa;if(t){var n=t;if(!ca(e,t)){if(la(e))throw Error(a(418));t=lo(n.nextSibling);var r=ra;t&&ca(e,t)?sa(r,n):(e.flags=-4097&e.flags|2,aa=!1,ra=e)}}else{if(la(e))throw Error(a(418));e.flags=-4097&e.flags|2,aa=!1,ra=e}}}function da(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;ra=e}function ha(e){if(e!==ra)return!1;if(!aa)return da(e),aa=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!no(e.type,e.memoizedProps)),t&&(t=oa)){if(la(e))throw pa(),Error(a(418));for(;t;)sa(e,t),t=lo(t.nextSibling)}if(da(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(a(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){oa=lo(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}oa=null}}else oa=ra?lo(e.stateNode.nextSibling):null;return!0}function pa(){for(var e=oa;e;)e=lo(e.nextSibling)}function fa(){oa=ra=null,aa=!1}function ga(e){null===ia?ia=[e]:ia.push(e)}var ma=x.ReactCurrentBatchConfig;function va(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(a(309));var r=n.stateNode}if(!r)throw Error(a(147,e));var o=r,i=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===i?t.ref:(t=function(e){var t=o.refs;null===e?delete t[i]:t[i]=e},t._stringRef=i,t)}if("string"!=typeof e)throw Error(a(284));if(!n._owner)throw Error(a(290,e))}return e}function ya(e,t){throw e=Object.prototype.toString.call(t),Error(a(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ba(e){return(0,e._init)(e._payload)}function xa(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function o(e,t){return(e=Pl(e,t)).index=0,e.sibling=null,e}function i(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function s(t){return e&&null===t.alternate&&(t.flags|=2),t}function c(e,t,n,r){return null===t||6!==t.tag?((t=zl(n,e.mode,r)).return=e,t):((t=o(t,n)).return=e,t)}function l(e,t,n,r){var a=n.type;return a===C?d(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===a||"object"==typeof a&&null!==a&&a.$$typeof===P&&ba(a)===t.type)?((r=o(t,n.props)).ref=va(e,t,n),r.return=e,r):((r=Ol(n.type,n.key,n.props,null,e.mode,r)).ref=va(e,t,n),r.return=e,r)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Ll(n,e.mode,r)).return=e,t):((t=o(t,n.children||[])).return=e,t)}function d(e,t,n,r,a){return null===t||7!==t.tag?((t=Rl(n,e.mode,r,a)).return=e,t):((t=o(t,n)).return=e,t)}function h(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=zl(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case w:return(n=Ol(t.type,t.key,t.props,null,e.mode,n)).ref=va(e,null,t),n.return=e,n;case k:return(t=Ll(t,e.mode,n)).return=e,t;case P:return h(e,(0,t._init)(t._payload),n)}if(te(t)||M(t))return(t=Rl(t,e.mode,n,null)).return=e,t;ya(e,t)}return null}function p(e,t,n,r){var o=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==o?null:c(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case w:return n.key===o?l(e,t,n,r):null;case k:return n.key===o?u(e,t,n,r):null;case P:return p(e,t,(o=n._init)(n._payload),r)}if(te(n)||M(n))return null!==o?null:d(e,t,n,r,null);ya(e,n)}return null}function f(e,t,n,r,o){if("string"==typeof r&&""!==r||"number"==typeof r)return c(t,e=e.get(n)||null,""+r,o);if("object"==typeof r&&null!==r){switch(r.$$typeof){case w:return l(t,e=e.get(null===r.key?n:r.key)||null,r,o);case k:return u(t,e=e.get(null===r.key?n:r.key)||null,r,o);case P:return f(e,t,n,(0,r._init)(r._payload),o)}if(te(r)||M(r))return d(t,e=e.get(n)||null,r,o,null);ya(t,r)}return null}function g(o,a,s,c){for(var l=null,u=null,d=a,g=a=0,m=null;null!==d&&g<s.length;g++){d.index>g?(m=d,d=null):m=d.sibling;var v=p(o,d,s[g],c);if(null===v){null===d&&(d=m);break}e&&d&&null===v.alternate&&t(o,d),a=i(v,a,g),null===u?l=v:u.sibling=v,u=v,d=m}if(g===s.length)return n(o,d),aa&&Zo(o,g),l;if(null===d){for(;g<s.length;g++)null!==(d=h(o,s[g],c))&&(a=i(d,a,g),null===u?l=d:u.sibling=d,u=d);return aa&&Zo(o,g),l}for(d=r(o,d);g<s.length;g++)null!==(m=f(d,o,g,s[g],c))&&(e&&null!==m.alternate&&d.delete(null===m.key?g:m.key),a=i(m,a,g),null===u?l=m:u.sibling=m,u=m);return e&&d.forEach(function(e){return t(o,e)}),aa&&Zo(o,g),l}function m(o,s,c,l){var u=M(c);if("function"!=typeof u)throw Error(a(150));if(null==(c=u.call(c)))throw Error(a(151));for(var d=u=null,g=s,m=s=0,v=null,y=c.next();null!==g&&!y.done;m++,y=c.next()){g.index>m?(v=g,g=null):v=g.sibling;var b=p(o,g,y.value,l);if(null===b){null===g&&(g=v);break}e&&g&&null===b.alternate&&t(o,g),s=i(b,s,m),null===d?u=b:d.sibling=b,d=b,g=v}if(y.done)return n(o,g),aa&&Zo(o,m),u;if(null===g){for(;!y.done;m++,y=c.next())null!==(y=h(o,y.value,l))&&(s=i(y,s,m),null===d?u=y:d.sibling=y,d=y);return aa&&Zo(o,m),u}for(g=r(o,g);!y.done;m++,y=c.next())null!==(y=f(g,o,m,y.value,l))&&(e&&null!==y.alternate&&g.delete(null===y.key?m:y.key),s=i(y,s,m),null===d?u=y:d.sibling=y,d=y);return e&&g.forEach(function(e){return t(o,e)}),aa&&Zo(o,m),u}return function e(r,a,i,c){if("object"==typeof i&&null!==i&&i.type===C&&null===i.key&&(i=i.props.children),"object"==typeof i&&null!==i){switch(i.$$typeof){case w:e:{for(var l=i.key,u=a;null!==u;){if(u.key===l){if((l=i.type)===C){if(7===u.tag){n(r,u.sibling),(a=o(u,i.props.children)).return=r,r=a;break e}}else if(u.elementType===l||"object"==typeof l&&null!==l&&l.$$typeof===P&&ba(l)===u.type){n(r,u.sibling),(a=o(u,i.props)).ref=va(r,u,i),a.return=r,r=a;break e}n(r,u);break}t(r,u),u=u.sibling}i.type===C?((a=Rl(i.props.children,r.mode,c,i.key)).return=r,r=a):((c=Ol(i.type,i.key,i.props,null,r.mode,c)).ref=va(r,a,i),c.return=r,r=c)}return s(r);case k:e:{for(u=i.key;null!==a;){if(a.key===u){if(4===a.tag&&a.stateNode.containerInfo===i.containerInfo&&a.stateNode.implementation===i.implementation){n(r,a.sibling),(a=o(a,i.children||[])).return=r,r=a;break e}n(r,a);break}t(r,a),a=a.sibling}(a=Ll(i,r.mode,c)).return=r,r=a}return s(r);case P:return e(r,a,(u=i._init)(i._payload),c)}if(te(i))return g(r,a,i,c);if(M(i))return m(r,a,i,c);ya(r,i)}return"string"==typeof i&&""!==i||"number"==typeof i?(i=""+i,null!==a&&6===a.tag?(n(r,a.sibling),(a=o(a,i)).return=r,r=a):(n(r,a),(a=zl(i,r.mode,c)).return=r,r=a),s(r)):n(r,a)}}var wa=xa(!0),ka=xa(!1),Ca=To(null),Sa=null,Ta=null,Ia=null;function ja(){Ia=Ta=Sa=null}function Aa(e){var t=Ca.current;Io(Ca),e._currentValue=t}function Na(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ea(e,t){Sa=e,Ia=Ta=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(bs=!0),e.firstContext=null)}function _a(e){var t=e._currentValue;if(Ia!==e)if(e={context:e,memoizedValue:t,next:null},null===Ta){if(null===Sa)throw Error(a(308));Ta=e,Sa.dependencies={lanes:0,firstContext:e}}else Ta=Ta.next=e;return t}var Pa=null;function Oa(e){null===Pa?Pa=[e]:Pa.push(e)}function Ra(e,t,n,r){var o=t.interleaved;return null===o?(n.next=n,Oa(t)):(n.next=o.next,o.next=n),t.interleaved=n,Ma(e,r)}function Ma(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var za=!1;function La(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function qa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Da(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Fa(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&jc){var o=r.pending;return null===o?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Ma(e,n)}return null===(o=r.interleaved)?(t.next=t,Oa(r)):(t.next=o.next,o.next=t),r.interleaved=t,Ma(e,n)}function Ua(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,yt(e,n)}}function Ba(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var o=null,a=null;if(null!==(n=n.firstBaseUpdate)){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===a?o=a=i:a=a.next=i,n=n.next}while(null!==n);null===a?o=a=t:a=a.next=t}else o=a=t;return n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:a,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ha(e,t,n,r){var o=e.updateQueue;za=!1;var a=o.firstBaseUpdate,i=o.lastBaseUpdate,s=o.shared.pending;if(null!==s){o.shared.pending=null;var c=s,l=c.next;c.next=null,null===i?a=l:i.next=l,i=c;var u=e.alternate;null!==u&&(s=(u=u.updateQueue).lastBaseUpdate)!==i&&(null===s?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c)}if(null!==a){var d=o.baseState;for(i=0,u=l=c=null,s=a;;){var h=s.lane,p=s.eventTime;if((r&h)===h){null!==u&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var f=e,g=s;switch(h=t,p=n,g.tag){case 1:if("function"==typeof(f=g.payload)){d=f.call(p,d,h);break e}d=f;break e;case 3:f.flags=-65537&f.flags|128;case 0:if(null==(h="function"==typeof(f=g.payload)?f.call(p,d,h):f))break e;d=L({},d,h);break e;case 2:za=!0}}null!==s.callback&&0!==s.lane&&(e.flags|=64,null===(h=o.effects)?o.effects=[s]:h.push(s))}else p={eventTime:p,lane:h,tag:s.tag,payload:s.payload,callback:s.callback,next:null},null===u?(l=u=p,c=d):u=u.next=p,i|=h;if(null===(s=s.next)){if(null===(s=o.shared.pending))break;s=(h=s).next,h.next=null,o.lastBaseUpdate=h,o.shared.pending=null}}if(null===u&&(c=d),o.baseState=c,o.firstBaseUpdate=l,o.lastBaseUpdate=u,null!==(t=o.shared.interleaved)){o=t;do{i|=o.lane,o=o.next}while(o!==t)}else null===a&&(o.shared.lanes=0);Mc|=i,e.lanes=i,e.memoizedState=d}}function Ka(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(null!==o){if(r.callback=null,r=n,"function"!=typeof o)throw Error(a(191,o));o.call(r)}}}var $a={},Ga=To($a),Wa=To($a),Va=To($a);function Qa(e){if(e===$a)throw Error(a(174));return e}function Ya(e,t){switch(jo(Va,t),jo(Wa,e),jo(Ga,$a),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ce(null,"");break;default:t=ce(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Io(Ga),jo(Ga,t)}function Ja(){Io(Ga),Io(Wa),Io(Va)}function Xa(e){Qa(Va.current);var t=Qa(Ga.current),n=ce(t,e.type);t!==n&&(jo(Wa,e),jo(Ga,n))}function Za(e){Wa.current===e&&(Io(Ga),Io(Wa))}var ei=To(0);function ti(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ni=[];function ri(){for(var e=0;e<ni.length;e++)ni[e]._workInProgressVersionPrimary=null;ni.length=0}var oi=x.ReactCurrentDispatcher,ai=x.ReactCurrentBatchConfig,ii=0,si=null,ci=null,li=null,ui=!1,di=!1,hi=0,pi=0;function fi(){throw Error(a(321))}function gi(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!sr(e[n],t[n]))return!1;return!0}function mi(e,t,n,r,o,i){if(ii=i,si=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,oi.current=null===e||null===e.memoizedState?Zi:es,e=n(r,o),di){i=0;do{if(di=!1,hi=0,25<=i)throw Error(a(301));i+=1,li=ci=null,t.updateQueue=null,oi.current=ts,e=n(r,o)}while(di)}if(oi.current=Xi,t=null!==ci&&null!==ci.next,ii=0,li=ci=si=null,ui=!1,t)throw Error(a(300));return e}function vi(){var e=0!==hi;return hi=0,e}function yi(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===li?si.memoizedState=li=e:li=li.next=e,li}function bi(){if(null===ci){var e=si.alternate;e=null!==e?e.memoizedState:null}else e=ci.next;var t=null===li?si.memoizedState:li.next;if(null!==t)li=t,ci=e;else{if(null===e)throw Error(a(310));e={memoizedState:(ci=e).memoizedState,baseState:ci.baseState,baseQueue:ci.baseQueue,queue:ci.queue,next:null},null===li?si.memoizedState=li=e:li=li.next=e}return li}function xi(e,t){return"function"==typeof t?t(e):t}function wi(e){var t=bi(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var r=ci,o=r.baseQueue,i=n.pending;if(null!==i){if(null!==o){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(null!==o){i=o.next,r=r.baseState;var c=s=null,l=null,u=i;do{var d=u.lane;if((ii&d)===d)null!==l&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===l?(c=l=h,s=r):l=l.next=h,si.lanes|=d,Mc|=d}u=u.next}while(null!==u&&u!==i);null===l?s=r:l.next=c,sr(r,t.memoizedState)||(bs=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=l,n.lastRenderedState=r}if(null!==(e=n.interleaved)){o=e;do{i=o.lane,si.lanes|=i,Mc|=i,o=o.next}while(o!==e)}else null===o&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function ki(e){var t=bi(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(null!==o){n.pending=null;var s=o=o.next;do{i=e(i,s.action),s=s.next}while(s!==o);sr(i,t.memoizedState)||(bs=!0),t.memoizedState=i,null===t.baseQueue&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Ci(){}function Si(e,t){var n=si,r=bi(),o=t(),i=!sr(r.memoizedState,o);if(i&&(r.memoizedState=o,bs=!0),r=r.queue,zi(ji.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||null!==li&&1&li.memoizedState.tag){if(n.flags|=2048,_i(9,Ii.bind(null,n,r,o,t),void 0,null),null===Ac)throw Error(a(349));30&ii||Ti(n,t,o)}return o}function Ti(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=si.updateQueue)?(t={lastEffect:null,stores:null},si.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Ii(e,t,n,r){t.value=n,t.getSnapshot=r,Ai(t)&&Ni(e)}function ji(e,t,n){return n(function(){Ai(t)&&Ni(e)})}function Ai(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!sr(e,n)}catch(e){return!0}}function Ni(e){var t=Ma(e,1);null!==t&&tl(t,e,1,-1)}function Ei(e){var t=yi();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:xi,lastRenderedState:e},t.queue=e,e=e.dispatch=Vi.bind(null,si,e),[t.memoizedState,e]}function _i(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=si.updateQueue)?(t={lastEffect:null,stores:null},si.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Pi(){return bi().memoizedState}function Oi(e,t,n,r){var o=yi();si.flags|=e,o.memoizedState=_i(1|t,n,void 0,void 0===r?null:r)}function Ri(e,t,n,r){var o=bi();r=void 0===r?null:r;var a=void 0;if(null!==ci){var i=ci.memoizedState;if(a=i.destroy,null!==r&&gi(r,i.deps))return void(o.memoizedState=_i(t,n,a,r))}si.flags|=e,o.memoizedState=_i(1|t,n,a,r)}function Mi(e,t){return Oi(8390656,8,e,t)}function zi(e,t){return Ri(2048,8,e,t)}function Li(e,t){return Ri(4,2,e,t)}function qi(e,t){return Ri(4,4,e,t)}function Di(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Fi(e,t,n){return n=null!=n?n.concat([e]):null,Ri(4,4,Di.bind(null,t,e),n)}function Ui(){}function Bi(e,t){var n=bi();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&gi(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Hi(e,t){var n=bi();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&gi(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Ki(e,t,n){return 21&ii?(sr(n,t)||(n=gt(),si.lanes|=n,Mc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,bs=!0),e.memoizedState=n)}function $i(e,t){var n=bt;bt=0!==n&&4>n?n:4,e(!0);var r=ai.transition;ai.transition={};try{e(!1),t()}finally{bt=n,ai.transition=r}}function Gi(){return bi().memoizedState}function Wi(e,t,n){var r=el(e);n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Qi(e)?Yi(t,n):null!==(n=Ra(e,t,n,r))&&(tl(n,e,r,Zc()),Ji(n,t,r))}function Vi(e,t,n){var r=el(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Qi(e))Yi(t,o);else{var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var i=t.lastRenderedState,s=a(i,n);if(o.hasEagerState=!0,o.eagerState=s,sr(s,i)){var c=t.interleaved;return null===c?(o.next=o,Oa(t)):(o.next=c.next,c.next=o),void(t.interleaved=o)}}catch(e){}null!==(n=Ra(e,t,o,r))&&(tl(n,e,r,o=Zc()),Ji(n,t,r))}}function Qi(e){var t=e.alternate;return e===si||null!==t&&t===si}function Yi(e,t){di=ui=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ji(e,t,n){if(4194240&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,yt(e,n)}}var Xi={readContext:_a,useCallback:fi,useContext:fi,useEffect:fi,useImperativeHandle:fi,useInsertionEffect:fi,useLayoutEffect:fi,useMemo:fi,useReducer:fi,useRef:fi,useState:fi,useDebugValue:fi,useDeferredValue:fi,useTransition:fi,useMutableSource:fi,useSyncExternalStore:fi,useId:fi,unstable_isNewReconciler:!1},Zi={readContext:_a,useCallback:function(e,t){return yi().memoizedState=[e,void 0===t?null:t],e},useContext:_a,useEffect:Mi,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,Oi(4194308,4,Di.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Oi(4194308,4,e,t)},useInsertionEffect:function(e,t){return Oi(4,2,e,t)},useMemo:function(e,t){var n=yi();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=yi();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Wi.bind(null,si,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},yi().memoizedState=e},useState:Ei,useDebugValue:Ui,useDeferredValue:function(e){return yi().memoizedState=e},useTransition:function(){var e=Ei(!1),t=e[0];return e=$i.bind(null,e[1]),yi().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=si,o=yi();if(aa){if(void 0===n)throw Error(a(407));n=n()}else{if(n=t(),null===Ac)throw Error(a(349));30&ii||Ti(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,Mi(ji.bind(null,r,i,e),[e]),r.flags|=2048,_i(9,Ii.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=yi(),t=Ac.identifierPrefix;if(aa){var n=Xo;t=":"+t+"R"+(n=(Jo&~(1<<32-it(Jo)-1)).toString(32)+n),0<(n=hi++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=pi++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},es={readContext:_a,useCallback:Bi,useContext:_a,useEffect:zi,useImperativeHandle:Fi,useInsertionEffect:Li,useLayoutEffect:qi,useMemo:Hi,useReducer:wi,useRef:Pi,useState:function(){return wi(xi)},useDebugValue:Ui,useDeferredValue:function(e){return Ki(bi(),ci.memoizedState,e)},useTransition:function(){return[wi(xi)[0],bi().memoizedState]},useMutableSource:Ci,useSyncExternalStore:Si,useId:Gi,unstable_isNewReconciler:!1},ts={readContext:_a,useCallback:Bi,useContext:_a,useEffect:zi,useImperativeHandle:Fi,useInsertionEffect:Li,useLayoutEffect:qi,useMemo:Hi,useReducer:ki,useRef:Pi,useState:function(){return ki(xi)},useDebugValue:Ui,useDeferredValue:function(e){var t=bi();return null===ci?t.memoizedState=e:Ki(t,ci.memoizedState,e)},useTransition:function(){return[ki(xi)[0],bi().memoizedState]},useMutableSource:Ci,useSyncExternalStore:Si,useId:Gi,unstable_isNewReconciler:!1};function ns(e,t){if(e&&e.defaultProps){for(var n in t=L({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function rs(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:L({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var os={isMounted:function(e){return!!(e=e._reactInternals)&&Be(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Zc(),o=el(e),a=Da(r,o);a.payload=t,null!=n&&(a.callback=n),null!==(t=Fa(e,a,o))&&(tl(t,e,o,r),Ua(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Zc(),o=el(e),a=Da(r,o);a.tag=1,a.payload=t,null!=n&&(a.callback=n),null!==(t=Fa(e,a,o))&&(tl(t,e,o,r),Ua(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Zc(),r=el(e),o=Da(n,r);o.tag=2,null!=t&&(o.callback=t),null!==(t=Fa(e,o,r))&&(tl(t,e,r,n),Ua(t,e,r))}};function as(e,t,n,r,o,a,i){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,a,i):!(t.prototype&&t.prototype.isPureReactComponent&&cr(n,r)&&cr(o,a))}function is(e,t,n){var r=!1,o=Ao,a=t.contextType;return"object"==typeof a&&null!==a?a=_a(a):(o=Oo(t)?_o:No.current,a=(r=null!=(r=t.contextTypes))?Po(e,o):Ao),t=new t(n,a),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=os,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=a),t}function ss(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&os.enqueueReplaceState(t,t.state,null)}function cs(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},La(e);var a=t.contextType;"object"==typeof a&&null!==a?o.context=_a(a):(a=Oo(t)?_o:No.current,o.context=Po(e,a)),o.state=e.memoizedState,"function"==typeof(a=t.getDerivedStateFromProps)&&(rs(e,t,a,n),o.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(t=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),t!==o.state&&os.enqueueReplaceState(o,o.state,null),Ha(e,n,o,r),o.state=e.memoizedState),"function"==typeof o.componentDidMount&&(e.flags|=4194308)}function ls(e,t){try{var n="",r=t;do{n+=U(r),r=r.return}while(r);var o=n}catch(e){o="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:o,digest:null}}function us(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function ds(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var hs="function"==typeof WeakMap?WeakMap:Map;function ps(e,t,n){(n=Da(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Hc||(Hc=!0,Kc=r),ds(0,t)},n}function fs(e,t,n){(n=Da(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){ds(0,t)}}var a=e.stateNode;return null!==a&&"function"==typeof a.componentDidCatch&&(n.callback=function(){ds(0,t),"function"!=typeof r&&(null===$c?$c=new Set([this]):$c.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function gs(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new hs;var o=new Set;r.set(t,o)}else void 0===(o=r.get(t))&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=Sl.bind(null,e,t,n),t.then(e,e))}function ms(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function vs(e,t,n,r,o){return 1&e.mode?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Da(-1,1)).tag=2,Fa(n,t,1))),n.lanes|=1),e)}var ys=x.ReactCurrentOwner,bs=!1;function xs(e,t,n,r){t.child=null===e?ka(t,null,n,r):wa(t,e.child,n,r)}function ws(e,t,n,r,o){n=n.render;var a=t.ref;return Ea(t,o),r=mi(e,t,n,r,a,o),n=vi(),null===e||bs?(aa&&n&&ta(t),t.flags|=1,xs(e,t,r,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Hs(e,t,o))}function ks(e,t,n,r,o){if(null===e){var a=n.type;return"function"!=typeof a||_l(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Ol(n.type,null,r,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,Cs(e,t,a,r,o))}if(a=e.child,0===(e.lanes&o)){var i=a.memoizedProps;if((n=null!==(n=n.compare)?n:cr)(i,r)&&e.ref===t.ref)return Hs(e,t,o)}return t.flags|=1,(e=Pl(a,r)).ref=t.ref,e.return=t,t.child=e}function Cs(e,t,n,r,o){if(null!==e){var a=e.memoizedProps;if(cr(a,r)&&e.ref===t.ref){if(bs=!1,t.pendingProps=r=a,0===(e.lanes&o))return t.lanes=e.lanes,Hs(e,t,o);131072&e.flags&&(bs=!0)}}return Is(e,t,n,r,o)}function Ss(e,t,n){var r=t.pendingProps,o=r.children,a=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(1&t.mode){if(!(1073741824&n))return e=null!==a?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,jo(Pc,_c),_c|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==a?a.baseLanes:n,jo(Pc,_c),_c|=r}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},jo(Pc,_c),_c|=n;else null!==a?(r=a.baseLanes|n,t.memoizedState=null):r=n,jo(Pc,_c),_c|=r;return xs(e,t,o,n),t.child}function Ts(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Is(e,t,n,r,o){var a=Oo(n)?_o:No.current;return a=Po(t,a),Ea(t,o),n=mi(e,t,n,r,a,o),r=vi(),null===e||bs?(aa&&r&&ta(t),t.flags|=1,xs(e,t,n,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Hs(e,t,o))}function js(e,t,n,r,o){if(Oo(n)){var a=!0;Lo(t)}else a=!1;if(Ea(t,o),null===t.stateNode)Bs(e,t),is(t,n,r),cs(t,n,r,o),r=!0;else if(null===e){var i=t.stateNode,s=t.memoizedProps;i.props=s;var c=i.context,l=n.contextType;l="object"==typeof l&&null!==l?_a(l):Po(t,l=Oo(n)?_o:No.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof i.getSnapshotBeforeUpdate;d||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(s!==r||c!==l)&&ss(t,i,r,l),za=!1;var h=t.memoizedState;i.state=h,Ha(t,r,i,o),c=t.memoizedState,s!==r||h!==c||Eo.current||za?("function"==typeof u&&(rs(t,n,u,r),c=t.memoizedState),(s=za||as(t,n,s,r,h,c,l))?(d||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),i.props=r,i.state=c,i.context=l,r=s):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,qa(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:ns(t.type,s),i.props=l,d=t.pendingProps,h=i.context,c="object"==typeof(c=n.contextType)&&null!==c?_a(c):Po(t,c=Oo(n)?_o:No.current);var p=n.getDerivedStateFromProps;(u="function"==typeof p||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(s!==d||h!==c)&&ss(t,i,r,c),za=!1,h=t.memoizedState,i.state=h,Ha(t,r,i,o);var f=t.memoizedState;s!==d||h!==f||Eo.current||za?("function"==typeof p&&(rs(t,n,p,r),f=t.memoizedState),(l=za||as(t,n,l,r,h,f,c)||!1)?(u||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,f,c),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,f,c)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),i.props=r,i.state=f,i.context=c,r=l):("function"!=typeof i.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return As(e,t,n,r,a,o)}function As(e,t,n,r,o,a){Ts(e,t);var i=!!(128&t.flags);if(!r&&!i)return o&&qo(t,n,!1),Hs(e,t,a);r=t.stateNode,ys.current=t;var s=i&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&i?(t.child=wa(t,e.child,null,a),t.child=wa(t,null,s,a)):xs(e,t,s,a),t.memoizedState=r.state,o&&qo(t,n,!0),t.child}function Ns(e){var t=e.stateNode;t.pendingContext?Mo(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Mo(0,t.context,!1),Ya(e,t.containerInfo)}function Es(e,t,n,r,o){return fa(),ga(o),t.flags|=256,xs(e,t,n,r),t.child}var _s,Ps,Os,Rs={dehydrated:null,treeContext:null,retryLane:0};function Ms(e){return{baseLanes:e,cachePool:null,transitions:null}}function zs(e,t,n){var r,o=t.pendingProps,i=ei.current,s=!1,c=!!(128&t.flags);if((r=c)||(r=(null===e||null!==e.memoizedState)&&!!(2&i)),r?(s=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(i|=1),jo(ei,1&i),null===e)return ua(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(c=o.children,e=o.fallback,s?(o=t.mode,s=t.child,c={mode:"hidden",children:c},1&o||null===s?s=Ml(c,o,0,null):(s.childLanes=0,s.pendingProps=c),e=Rl(e,o,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Ms(n),t.memoizedState=Rs,e):Ls(t,c));if(null!==(i=e.memoizedState)&&null!==(r=i.dehydrated))return function(e,t,n,r,o,i,s){if(n)return 256&t.flags?(t.flags&=-257,qs(e,t,s,r=us(Error(a(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=Ml({mode:"visible",children:r.children},o,0,null),(i=Rl(i,o,s,null)).flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,1&t.mode&&wa(t,e.child,null,s),t.child.memoizedState=Ms(s),t.memoizedState=Rs,i);if(!(1&t.mode))return qs(e,t,s,null);if("$!"===o.data){if(r=o.nextSibling&&o.nextSibling.dataset)var c=r.dgst;return r=c,qs(e,t,s,r=us(i=Error(a(419)),r,void 0))}if(c=0!==(s&e.childLanes),bs||c){if(null!==(r=Ac)){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}0!==(o=0!==(o&(r.suspendedLanes|s))?0:o)&&o!==i.retryLane&&(i.retryLane=o,Ma(e,o),tl(r,e,o,-1))}return fl(),qs(e,t,s,r=us(Error(a(421))))}return"$?"===o.data?(t.flags|=128,t.child=e.child,t=Il.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,oa=lo(o.nextSibling),ra=t,aa=!0,ia=null,null!==e&&(Vo[Qo++]=Jo,Vo[Qo++]=Xo,Vo[Qo++]=Yo,Jo=e.id,Xo=e.overflow,Yo=t),(t=Ls(t,r.children)).flags|=4096,t)}(e,t,c,o,r,i,n);if(s){s=o.fallback,c=t.mode,r=(i=e.child).sibling;var l={mode:"hidden",children:o.children};return 1&c||t.child===i?(o=Pl(i,l)).subtreeFlags=14680064&i.subtreeFlags:((o=t.child).childLanes=0,o.pendingProps=l,t.deletions=null),null!==r?s=Pl(r,s):(s=Rl(s,c,n,null)).flags|=2,s.return=t,o.return=t,o.sibling=s,t.child=o,o=s,s=t.child,c=null===(c=e.child.memoizedState)?Ms(n):{baseLanes:c.baseLanes|n,cachePool:null,transitions:c.transitions},s.memoizedState=c,s.childLanes=e.childLanes&~n,t.memoizedState=Rs,o}return e=(s=e.child).sibling,o=Pl(s,{mode:"visible",children:o.children}),!(1&t.mode)&&(o.lanes=n),o.return=t,o.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=o,t.memoizedState=null,o}function Ls(e,t){return(t=Ml({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function qs(e,t,n,r){return null!==r&&ga(r),wa(t,e.child,null,n),(e=Ls(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Ds(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Na(e.return,t,n)}function Fs(e,t,n,r,o){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=o)}function Us(e,t,n){var r=t.pendingProps,o=r.revealOrder,a=r.tail;if(xs(e,t,r.children,n),2&(r=ei.current))r=1&r|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Ds(e,n,t);else if(19===e.tag)Ds(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(jo(ei,r),1&t.mode)switch(o){case"forwards":for(n=t.child,o=null;null!==n;)null!==(e=n.alternate)&&null===ti(e)&&(o=n),n=n.sibling;null===(n=o)?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Fs(t,!1,o,n,a);break;case"backwards":for(n=null,o=t.child,t.child=null;null!==o;){if(null!==(e=o.alternate)&&null===ti(e)){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Fs(t,!0,n,null,a);break;case"together":Fs(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function Bs(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Hs(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Mc|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(a(153));if(null!==t.child){for(n=Pl(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Pl(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Ks(e,t){if(!aa)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function $s(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=14680064&o.subtreeFlags,r|=14680064&o.flags,o.return=e,o=o.sibling;else for(o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Gs(e,t,n){var r=t.pendingProps;switch(na(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $s(t),null;case 1:case 17:return Oo(t.type)&&Ro(),$s(t),null;case 3:return r=t.stateNode,Ja(),Io(Eo),Io(No),ri(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(ha(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==ia&&(al(ia),ia=null))),$s(t),null;case 5:Za(t);var o=Qa(Va.current);if(n=t.type,null!==e&&null!=t.stateNode)Ps(e,t,n,r),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(a(166));return $s(t),null}if(e=Qa(Ga.current),ha(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[po]=t,r[fo]=i,e=!!(1&t.mode),n){case"dialog":Dr("cancel",r),Dr("close",r);break;case"iframe":case"object":case"embed":Dr("load",r);break;case"video":case"audio":for(o=0;o<Mr.length;o++)Dr(Mr[o],r);break;case"source":Dr("error",r);break;case"img":case"image":case"link":Dr("error",r),Dr("load",r);break;case"details":Dr("toggle",r);break;case"input":Y(r,i),Dr("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Dr("invalid",r);break;case"textarea":oe(r,i),Dr("invalid",r)}for(var c in ye(n,i),o=null,i)if(i.hasOwnProperty(c)){var l=i[c];"children"===c?"string"==typeof l?r.textContent!==l&&(!0!==i.suppressHydrationWarning&&Xr(r.textContent,l,e),o=["children",l]):"number"==typeof l&&r.textContent!==""+l&&(!0!==i.suppressHydrationWarning&&Xr(r.textContent,l,e),o=["children",""+l]):s.hasOwnProperty(c)&&null!=l&&"onScroll"===c&&Dr("scroll",r)}switch(n){case"input":G(r),Z(r,i,!0);break;case"textarea":G(r),ie(r);break;case"select":case"option":break;default:"function"==typeof i.onClick&&(r.onclick=Zr)}r=o,t.updateQueue=r,null!==r&&(t.flags|=4)}else{c=9===o.nodeType?o:o.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=se(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=c.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),"select"===n&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[po]=t,e[fo]=r,_s(e,t),t.stateNode=e;e:{switch(c=be(n,r),n){case"dialog":Dr("cancel",e),Dr("close",e),o=r;break;case"iframe":case"object":case"embed":Dr("load",e),o=r;break;case"video":case"audio":for(o=0;o<Mr.length;o++)Dr(Mr[o],e);o=r;break;case"source":Dr("error",e),o=r;break;case"img":case"image":case"link":Dr("error",e),Dr("load",e),o=r;break;case"details":Dr("toggle",e),o=r;break;case"input":Y(e,r),o=Q(e,r),Dr("invalid",e);break;case"option":default:o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=L({},r,{value:void 0}),Dr("invalid",e);break;case"textarea":oe(e,r),o=re(e,r),Dr("invalid",e)}for(i in ye(n,o),l=o)if(l.hasOwnProperty(i)){var u=l[i];"style"===i?me(e,u):"dangerouslySetInnerHTML"===i?null!=(u=u?u.__html:void 0)&&de(e,u):"children"===i?"string"==typeof u?("textarea"!==n||""!==u)&&he(e,u):"number"==typeof u&&he(e,""+u):"suppressContentEditableWarning"!==i&&"suppressHydrationWarning"!==i&&"autoFocus"!==i&&(s.hasOwnProperty(i)?null!=u&&"onScroll"===i&&Dr("scroll",e):null!=u&&b(e,i,u,c))}switch(n){case"input":G(e),Z(e,r,!1);break;case"textarea":G(e),ie(e);break;case"option":null!=r.value&&e.setAttribute("value",""+K(r.value));break;case"select":e.multiple=!!r.multiple,null!=(i=r.value)?ne(e,!!r.multiple,i,!1):null!=r.defaultValue&&ne(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof o.onClick&&(e.onclick=Zr)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return $s(t),null;case 6:if(e&&null!=t.stateNode)Os(0,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(a(166));if(n=Qa(Va.current),Qa(Ga.current),ha(t)){if(r=t.stateNode,n=t.memoizedProps,r[po]=t,(i=r.nodeValue!==n)&&null!==(e=ra))switch(e.tag){case 3:Xr(r.nodeValue,n,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Xr(r.nodeValue,n,!!(1&e.mode))}i&&(t.flags|=4)}else(r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[po]=t,t.stateNode=r}return $s(t),null;case 13:if(Io(ei),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(aa&&null!==oa&&1&t.mode&&!(128&t.flags))pa(),fa(),t.flags|=98560,i=!1;else if(i=ha(t),null!==r&&null!==r.dehydrated){if(null===e){if(!i)throw Error(a(318));if(!(i=null!==(i=t.memoizedState)?i.dehydrated:null))throw Error(a(317));i[po]=t}else fa(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;$s(t),i=!1}else null!==ia&&(al(ia),ia=null),i=!0;if(!i)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=n,t):((r=null!==r)!=(null!==e&&null!==e.memoizedState)&&r&&(t.child.flags|=8192,1&t.mode&&(null===e||1&ei.current?0===Oc&&(Oc=3):fl())),null!==t.updateQueue&&(t.flags|=4),$s(t),null);case 4:return Ja(),null===e&&Br(t.stateNode.containerInfo),$s(t),null;case 10:return Aa(t.type._context),$s(t),null;case 19:if(Io(ei),null===(i=t.memoizedState))return $s(t),null;if(r=!!(128&t.flags),null===(c=i.rendering))if(r)Ks(i,!1);else{if(0!==Oc||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(c=ti(e))){for(t.flags|=128,Ks(i,!1),null!==(r=c.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;null!==n;)e=r,(i=n).flags&=14680066,null===(c=i.alternate)?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,e=c.dependencies,i.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return jo(ei,1&ei.current|2),t.child}e=e.sibling}null!==i.tail&&Je()>Uc&&(t.flags|=128,r=!0,Ks(i,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=ti(c))){if(t.flags|=128,r=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),Ks(i,!0),null===i.tail&&"hidden"===i.tailMode&&!c.alternate&&!aa)return $s(t),null}else 2*Je()-i.renderingStartTime>Uc&&1073741824!==n&&(t.flags|=128,r=!0,Ks(i,!1),t.lanes=4194304);i.isBackwards?(c.sibling=t.child,t.child=c):(null!==(n=i.last)?n.sibling=c:t.child=c,i.last=c)}return null!==i.tail?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Je(),t.sibling=null,n=ei.current,jo(ei,r?1&n|2:1&n),t):($s(t),null);case 22:case 23:return ul(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&1&t.mode?!!(1073741824&_c)&&($s(t),6&t.subtreeFlags&&(t.flags|=8192)):$s(t),null;case 24:case 25:return null}throw Error(a(156,t.tag))}function Ws(e,t){switch(na(t),t.tag){case 1:return Oo(t.type)&&Ro(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Ja(),Io(Eo),Io(No),ri(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Za(t),null;case 13:if(Io(ei),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(a(340));fa()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Io(ei),null;case 4:return Ja(),null;case 10:return Aa(t.type._context),null;case 22:case 23:return ul(),null;default:return null}}_s=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ps=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Qa(Ga.current);var a,i=null;switch(n){case"input":o=Q(e,o),r=Q(e,r),i=[];break;case"select":o=L({},o,{value:void 0}),r=L({},r,{value:void 0}),i=[];break;case"textarea":o=re(e,o),r=re(e,r),i=[];break;default:"function"!=typeof o.onClick&&"function"==typeof r.onClick&&(e.onclick=Zr)}for(u in ye(n,r),n=null,o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&null!=o[u])if("style"===u){var c=o[u];for(a in c)c.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(s.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var l=r[u];if(c=null!=o?o[u]:void 0,r.hasOwnProperty(u)&&l!==c&&(null!=l||null!=c))if("style"===u)if(c){for(a in c)!c.hasOwnProperty(a)||l&&l.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in l)l.hasOwnProperty(a)&&c[a]!==l[a]&&(n||(n={}),n[a]=l[a])}else n||(i||(i=[]),i.push(u,n)),n=l;else"dangerouslySetInnerHTML"===u?(l=l?l.__html:void 0,c=c?c.__html:void 0,null!=l&&c!==l&&(i=i||[]).push(u,l)):"children"===u?"string"!=typeof l&&"number"!=typeof l||(i=i||[]).push(u,""+l):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(s.hasOwnProperty(u)?(null!=l&&"onScroll"===u&&Dr("scroll",e),i||c===l||(i=[])):(i=i||[]).push(u,l))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}},Os=function(e,t,n,r){n!==r&&(t.flags|=4)};var Vs=!1,Qs=!1,Ys="function"==typeof WeakSet?WeakSet:Set,Js=null;function Xs(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){Cl(e,t,n)}else n.current=null}function Zs(e,t,n){try{n()}catch(n){Cl(e,t,n)}}var ec=!1;function tc(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var o=r=r.next;do{if((o.tag&e)===e){var a=o.destroy;o.destroy=void 0,void 0!==a&&Zs(t,n,a)}o=o.next}while(o!==r)}}function nc(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function rc(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function oc(e){var t=e.alternate;null!==t&&(e.alternate=null,oc(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&null!==(t=e.stateNode)&&(delete t[po],delete t[fo],delete t[mo],delete t[vo],delete t[yo]),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ac(e){return 5===e.tag||3===e.tag||4===e.tag}function ic(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||ac(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function sc(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Zr));else if(4!==r&&null!==(e=e.child))for(sc(e,t,n),e=e.sibling;null!==e;)sc(e,t,n),e=e.sibling}function cc(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(cc(e,t,n),e=e.sibling;null!==e;)cc(e,t,n),e=e.sibling}var lc=null,uc=!1;function dc(e,t,n){for(n=n.child;null!==n;)hc(e,t,n),n=n.sibling}function hc(e,t,n){if(at&&"function"==typeof at.onCommitFiberUnmount)try{at.onCommitFiberUnmount(ot,n)}catch(e){}switch(n.tag){case 5:Qs||Xs(n,t);case 6:var r=lc,o=uc;lc=null,dc(e,t,n),uc=o,null!==(lc=r)&&(uc?(e=lc,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):lc.removeChild(n.stateNode));break;case 18:null!==lc&&(uc?(e=lc,n=n.stateNode,8===e.nodeType?co(e.parentNode,n):1===e.nodeType&&co(e,n),Bt(e)):co(lc,n.stateNode));break;case 4:r=lc,o=uc,lc=n.stateNode.containerInfo,uc=!0,dc(e,t,n),lc=r,uc=o;break;case 0:case 11:case 14:case 15:if(!Qs&&null!==(r=n.updateQueue)&&null!==(r=r.lastEffect)){o=r=r.next;do{var a=o,i=a.destroy;a=a.tag,void 0!==i&&(2&a||4&a)&&Zs(n,t,i),o=o.next}while(o!==r)}dc(e,t,n);break;case 1:if(!Qs&&(Xs(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Cl(n,t,e)}dc(e,t,n);break;case 21:dc(e,t,n);break;case 22:1&n.mode?(Qs=(r=Qs)||null!==n.memoizedState,dc(e,t,n),Qs=r):dc(e,t,n);break;default:dc(e,t,n)}}function pc(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Ys),t.forEach(function(t){var r=jl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function fc(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,s=t,c=s;e:for(;null!==c;){switch(c.tag){case 5:lc=c.stateNode,uc=!1;break e;case 3:case 4:lc=c.stateNode.containerInfo,uc=!0;break e}c=c.return}if(null===lc)throw Error(a(160));hc(i,s,o),lc=null,uc=!1;var l=o.alternate;null!==l&&(l.return=null),o.return=null}catch(e){Cl(o,t,e)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)gc(t,e),t=t.sibling}function gc(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(fc(t,e),mc(e),4&r){try{tc(3,e,e.return),nc(3,e)}catch(t){Cl(e,e.return,t)}try{tc(5,e,e.return)}catch(t){Cl(e,e.return,t)}}break;case 1:fc(t,e),mc(e),512&r&&null!==n&&Xs(n,n.return);break;case 5:if(fc(t,e),mc(e),512&r&&null!==n&&Xs(n,n.return),32&e.flags){var o=e.stateNode;try{he(o,"")}catch(t){Cl(e,e.return,t)}}if(4&r&&null!=(o=e.stateNode)){var i=e.memoizedProps,s=null!==n?n.memoizedProps:i,c=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===c&&"radio"===i.type&&null!=i.name&&J(o,i),be(c,s);var u=be(c,i);for(s=0;s<l.length;s+=2){var d=l[s],h=l[s+1];"style"===d?me(o,h):"dangerouslySetInnerHTML"===d?de(o,h):"children"===d?he(o,h):b(o,d,h,u)}switch(c){case"input":X(o,i);break;case"textarea":ae(o,i);break;case"select":var p=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var f=i.value;null!=f?ne(o,!!i.multiple,f,!1):p!==!!i.multiple&&(null!=i.defaultValue?ne(o,!!i.multiple,i.defaultValue,!0):ne(o,!!i.multiple,i.multiple?[]:"",!1))}o[fo]=i}catch(t){Cl(e,e.return,t)}}break;case 6:if(fc(t,e),mc(e),4&r){if(null===e.stateNode)throw Error(a(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(t){Cl(e,e.return,t)}}break;case 3:if(fc(t,e),mc(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Bt(t.containerInfo)}catch(t){Cl(e,e.return,t)}break;case 4:default:fc(t,e),mc(e);break;case 13:fc(t,e),mc(e),8192&(o=e.child).flags&&(i=null!==o.memoizedState,o.stateNode.isHidden=i,!i||null!==o.alternate&&null!==o.alternate.memoizedState||(Fc=Je())),4&r&&pc(e);break;case 22:if(d=null!==n&&null!==n.memoizedState,1&e.mode?(Qs=(u=Qs)||d,fc(t,e),Qs=u):fc(t,e),mc(e),8192&r){if(u=null!==e.memoizedState,(e.stateNode.isHidden=u)&&!d&&1&e.mode)for(Js=e,d=e.child;null!==d;){for(h=Js=d;null!==Js;){switch(f=(p=Js).child,p.tag){case 0:case 11:case 14:case 15:tc(4,p,p.return);break;case 1:Xs(p,p.return);var g=p.stateNode;if("function"==typeof g.componentWillUnmount){r=p,n=p.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(e){Cl(r,n,e)}}break;case 5:Xs(p,p.return);break;case 22:if(null!==p.memoizedState){xc(h);continue}}null!==f?(f.return=p,Js=f):xc(h)}d=d.sibling}e:for(d=null,h=e;;){if(5===h.tag){if(null===d){d=h;try{o=h.stateNode,u?"function"==typeof(i=o.style).setProperty?i.setProperty("display","none","important"):i.display="none":(c=h.stateNode,s=null!=(l=h.memoizedProps.style)&&l.hasOwnProperty("display")?l.display:null,c.style.display=ge("display",s))}catch(t){Cl(e,e.return,t)}}}else if(6===h.tag){if(null===d)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(t){Cl(e,e.return,t)}}else if((22!==h.tag&&23!==h.tag||null===h.memoizedState||h===e)&&null!==h.child){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;null===h.sibling;){if(null===h.return||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:fc(t,e),mc(e),4&r&&pc(e);case 21:}}function mc(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(ac(n)){var r=n;break e}n=n.return}throw Error(a(160))}switch(r.tag){case 5:var o=r.stateNode;32&r.flags&&(he(o,""),r.flags&=-33),cc(e,ic(e),o);break;case 3:case 4:var i=r.stateNode.containerInfo;sc(e,ic(e),i);break;default:throw Error(a(161))}}catch(t){Cl(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function vc(e,t,n){Js=e,yc(e,t,n)}function yc(e,t,n){for(var r=!!(1&e.mode);null!==Js;){var o=Js,a=o.child;if(22===o.tag&&r){var i=null!==o.memoizedState||Vs;if(!i){var s=o.alternate,c=null!==s&&null!==s.memoizedState||Qs;s=Vs;var l=Qs;if(Vs=i,(Qs=c)&&!l)for(Js=o;null!==Js;)c=(i=Js).child,22===i.tag&&null!==i.memoizedState?wc(o):null!==c?(c.return=i,Js=c):wc(o);for(;null!==a;)Js=a,yc(a,t,n),a=a.sibling;Js=o,Vs=s,Qs=l}bc(e)}else 8772&o.subtreeFlags&&null!==a?(a.return=o,Js=a):bc(e)}}function bc(e){for(;null!==Js;){var t=Js;if(8772&t.flags){var n=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:Qs||nc(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!Qs)if(null===n)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:ns(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;null!==i&&Ka(t,i,r);break;case 3:var s=t.updateQueue;if(null!==s){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Ka(t,s,n)}break;case 5:var c=t.stateNode;if(null===n&&4&t.flags){n=c;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var u=t.alternate;if(null!==u){var d=u.memoizedState;if(null!==d){var h=d.dehydrated;null!==h&&Bt(h)}}}break;default:throw Error(a(163))}Qs||512&t.flags&&rc(t)}catch(e){Cl(t,t.return,e)}}if(t===e){Js=null;break}if(null!==(n=t.sibling)){n.return=t.return,Js=n;break}Js=t.return}}function xc(e){for(;null!==Js;){var t=Js;if(t===e){Js=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Js=n;break}Js=t.return}}function wc(e){for(;null!==Js;){var t=Js;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{nc(4,t)}catch(e){Cl(t,n,e)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var o=t.return;try{r.componentDidMount()}catch(e){Cl(t,o,e)}}var a=t.return;try{rc(t)}catch(e){Cl(t,a,e)}break;case 5:var i=t.return;try{rc(t)}catch(e){Cl(t,i,e)}}}catch(e){Cl(t,t.return,e)}if(t===e){Js=null;break}var s=t.sibling;if(null!==s){s.return=t.return,Js=s;break}Js=t.return}}var kc,Cc=Math.ceil,Sc=x.ReactCurrentDispatcher,Tc=x.ReactCurrentOwner,Ic=x.ReactCurrentBatchConfig,jc=0,Ac=null,Nc=null,Ec=0,_c=0,Pc=To(0),Oc=0,Rc=null,Mc=0,zc=0,Lc=0,qc=null,Dc=null,Fc=0,Uc=1/0,Bc=null,Hc=!1,Kc=null,$c=null,Gc=!1,Wc=null,Vc=0,Qc=0,Yc=null,Jc=-1,Xc=0;function Zc(){return 6&jc?Je():-1!==Jc?Jc:Jc=Je()}function el(e){return 1&e.mode?2&jc&&0!==Ec?Ec&-Ec:null!==ma.transition?(0===Xc&&(Xc=gt()),Xc):0!==(e=bt)?e:e=void 0===(e=window.event)?16:Yt(e.type):1}function tl(e,t,n,r){if(50<Qc)throw Qc=0,Yc=null,Error(a(185));vt(e,n,r),2&jc&&e===Ac||(e===Ac&&(!(2&jc)&&(zc|=n),4===Oc&&il(e,Ec)),nl(e,r),1===n&&0===jc&&!(1&t.mode)&&(Uc=Je()+500,Fo&&Ho()))}function nl(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,a=e.pendingLanes;0<a;){var i=31-it(a),s=1<<i,c=o[i];-1===c?0!==(s&n)&&0===(s&r)||(o[i]=pt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}(e,t);var r=ht(e,e===Ac?Ec:0);if(0===r)null!==n&&Ve(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ve(n),1===t)0===e.tag?function(e){Fo=!0,Bo(e)}(sl.bind(null,e)):Bo(sl.bind(null,e)),io(function(){!(6&jc)&&Ho()}),n=null;else{switch(xt(r)){case 1:n=Ze;break;case 4:n=et;break;case 16:default:n=tt;break;case 536870912:n=rt}n=Al(n,rl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function rl(e,t){if(Jc=-1,Xc=0,6&jc)throw Error(a(327));var n=e.callbackNode;if(wl()&&e.callbackNode!==n)return null;var r=ht(e,e===Ac?Ec:0);if(0===r)return null;if(30&r||0!==(r&e.expiredLanes)||t)t=gl(e,r);else{t=r;var o=jc;jc|=2;var i=pl();for(Ac===e&&Ec===t||(Bc=null,Uc=Je()+500,dl(e,t));;)try{vl();break}catch(t){hl(e,t)}ja(),Sc.current=i,jc=o,null!==Nc?t=0:(Ac=null,Ec=0,t=Oc)}if(0!==t){if(2===t&&0!==(o=ft(e))&&(r=o,t=ol(e,o)),1===t)throw n=Rc,dl(e,0),il(e,r),nl(e,Je()),n;if(6===t)il(e,r);else{if(o=e.current.alternate,!(30&r||function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var o=n[r],a=o.getSnapshot;o=o.value;try{if(!sr(a(),o))return!1}catch(e){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(o)||(t=gl(e,r),2===t&&(i=ft(e),0!==i&&(r=i,t=ol(e,i))),1!==t)))throw n=Rc,dl(e,0),il(e,r),nl(e,Je()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(a(345));case 2:case 5:xl(e,Dc,Bc);break;case 3:if(il(e,r),(130023424&r)===r&&10<(t=Fc+500-Je())){if(0!==ht(e,0))break;if(((o=e.suspendedLanes)&r)!==r){Zc(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=ro(xl.bind(null,e,Dc,Bc),t);break}xl(e,Dc,Bc);break;case 4:if(il(e,r),(4194240&r)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-it(r);i=1<<s,(s=t[s])>o&&(o=s),r&=~i}if(r=o,10<(r=(120>(r=Je()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Cc(r/1960))-r)){e.timeoutHandle=ro(xl.bind(null,e,Dc,Bc),r);break}xl(e,Dc,Bc);break;default:throw Error(a(329))}}}return nl(e,Je()),e.callbackNode===n?rl.bind(null,e):null}function ol(e,t){var n=qc;return e.current.memoizedState.isDehydrated&&(dl(e,t).flags|=256),2!==(e=gl(e,t))&&(t=Dc,Dc=n,null!==t&&al(t)),e}function al(e){null===Dc?Dc=e:Dc.push.apply(Dc,e)}function il(e,t){for(t&=~Lc,t&=~zc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-it(t),r=1<<n;e[n]=-1,t&=~r}}function sl(e){if(6&jc)throw Error(a(327));wl();var t=ht(e,0);if(!(1&t))return nl(e,Je()),null;var n=gl(e,t);if(0!==e.tag&&2===n){var r=ft(e);0!==r&&(t=r,n=ol(e,r))}if(1===n)throw n=Rc,dl(e,0),il(e,t),nl(e,Je()),n;if(6===n)throw Error(a(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,xl(e,Dc,Bc),nl(e,Je()),null}function cl(e,t){var n=jc;jc|=1;try{return e(t)}finally{0===(jc=n)&&(Uc=Je()+500,Fo&&Ho())}}function ll(e){null!==Wc&&0===Wc.tag&&!(6&jc)&&wl();var t=jc;jc|=1;var n=Ic.transition,r=bt;try{if(Ic.transition=null,bt=1,e)return e()}finally{bt=r,Ic.transition=n,!(6&(jc=t))&&Ho()}}function ul(){_c=Pc.current,Io(Pc)}function dl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,oo(n)),null!==Nc)for(n=Nc.return;null!==n;){var r=n;switch(na(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&Ro();break;case 3:Ja(),Io(Eo),Io(No),ri();break;case 5:Za(r);break;case 4:Ja();break;case 13:case 19:Io(ei);break;case 10:Aa(r.type._context);break;case 22:case 23:ul()}n=n.return}if(Ac=e,Nc=e=Pl(e.current,null),Ec=_c=t,Oc=0,Rc=null,Lc=zc=Mc=0,Dc=qc=null,null!==Pa){for(t=0;t<Pa.length;t++)if(null!==(r=(n=Pa[t]).interleaved)){n.interleaved=null;var o=r.next,a=n.pending;if(null!==a){var i=a.next;a.next=o,r.next=i}n.pending=r}Pa=null}return e}function hl(e,t){for(;;){var n=Nc;try{if(ja(),oi.current=Xi,ui){for(var r=si.memoizedState;null!==r;){var o=r.queue;null!==o&&(o.pending=null),r=r.next}ui=!1}if(ii=0,li=ci=si=null,di=!1,hi=0,Tc.current=null,null===n||null===n.return){Oc=1,Rc=t,Nc=null;break}e:{var i=e,s=n.return,c=n,l=t;if(t=Ec,c.flags|=32768,null!==l&&"object"==typeof l&&"function"==typeof l.then){var u=l,d=c,h=d.tag;if(!(1&d.mode||0!==h&&11!==h&&15!==h)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var f=ms(s);if(null!==f){f.flags&=-257,vs(f,s,c,0,t),1&f.mode&&gs(i,u,t),l=u;var g=(t=f).updateQueue;if(null===g){var m=new Set;m.add(l),t.updateQueue=m}else g.add(l);break e}if(!(1&t)){gs(i,u,t),fl();break e}l=Error(a(426))}else if(aa&&1&c.mode){var v=ms(s);if(null!==v){!(65536&v.flags)&&(v.flags|=256),vs(v,s,c,0,t),ga(ls(l,c));break e}}i=l=ls(l,c),4!==Oc&&(Oc=2),null===qc?qc=[i]:qc.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t,Ba(i,ps(0,l,t));break e;case 1:c=l;var y=i.type,b=i.stateNode;if(!(128&i.flags||"function"!=typeof y.getDerivedStateFromError&&(null===b||"function"!=typeof b.componentDidCatch||null!==$c&&$c.has(b)))){i.flags|=65536,t&=-t,i.lanes|=t,Ba(i,fs(i,c,t));break e}}i=i.return}while(null!==i)}bl(n)}catch(e){t=e,Nc===n&&null!==n&&(Nc=n=n.return);continue}break}}function pl(){var e=Sc.current;return Sc.current=Xi,null===e?Xi:e}function fl(){0!==Oc&&3!==Oc&&2!==Oc||(Oc=4),null===Ac||!(268435455&Mc)&&!(268435455&zc)||il(Ac,Ec)}function gl(e,t){var n=jc;jc|=2;var r=pl();for(Ac===e&&Ec===t||(Bc=null,dl(e,t));;)try{ml();break}catch(t){hl(e,t)}if(ja(),jc=n,Sc.current=r,null!==Nc)throw Error(a(261));return Ac=null,Ec=0,Oc}function ml(){for(;null!==Nc;)yl(Nc)}function vl(){for(;null!==Nc&&!Qe();)yl(Nc)}function yl(e){var t=kc(e.alternate,e,_c);e.memoizedProps=e.pendingProps,null===t?bl(e):Nc=t,Tc.current=null}function bl(e){var t=e;do{var n=t.alternate;if(e=t.return,32768&t.flags){if(null!==(n=Ws(n,t)))return n.flags&=32767,void(Nc=n);if(null===e)return Oc=6,void(Nc=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(n=Gs(n,t,_c)))return void(Nc=n);if(null!==(t=t.sibling))return void(Nc=t);Nc=t=e}while(null!==t);0===Oc&&(Oc=5)}function xl(e,t,n){var r=bt,o=Ic.transition;try{Ic.transition=null,bt=1,function(e,t,n,r){do{wl()}while(null!==Wc);if(6&jc)throw Error(a(327));n=e.finishedWork;var o=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(a(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-it(n),a=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~a}}(e,i),e===Ac&&(Nc=Ac=null,Ec=0),!(2064&n.subtreeFlags)&&!(2064&n.flags)||Gc||(Gc=!0,Al(tt,function(){return wl(),null})),i=!!(15990&n.flags),15990&n.subtreeFlags||i){i=Ic.transition,Ic.transition=null;var s=bt;bt=1;var c=jc;jc|=4,Tc.current=null,function(e,t){if(eo=Kt,pr(e=hr())){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch(e){n=null;break e}var s=0,c=-1,l=-1,u=0,d=0,h=e,p=null;t:for(;;){for(var f;h!==n||0!==o&&3!==h.nodeType||(c=s+o),h!==i||0!==r&&3!==h.nodeType||(l=s+r),3===h.nodeType&&(s+=h.nodeValue.length),null!==(f=h.firstChild);)p=h,h=f;for(;;){if(h===e)break t;if(p===n&&++u===o&&(c=s),p===i&&++d===r&&(l=s),null!==(f=h.nextSibling))break;p=(h=p).parentNode}h=f}n=-1===c||-1===l?null:{start:c,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(to={focusedElem:e,selectionRange:n},Kt=!1,Js=t;null!==Js;)if(e=(t=Js).child,1028&t.subtreeFlags&&null!==e)e.return=t,Js=e;else for(;null!==Js;){t=Js;try{var g=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==g){var m=g.memoizedProps,v=g.memoizedState,y=t.stateNode,b=y.getSnapshotBeforeUpdate(t.elementType===t.type?m:ns(t.type,m),v);y.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var x=t.stateNode.containerInfo;1===x.nodeType?x.textContent="":9===x.nodeType&&x.documentElement&&x.removeChild(x.documentElement);break;default:throw Error(a(163))}}catch(e){Cl(t,t.return,e)}if(null!==(e=t.sibling)){e.return=t.return,Js=e;break}Js=t.return}g=ec,ec=!1}(e,n),gc(n,e),fr(to),Kt=!!eo,to=eo=null,e.current=n,vc(n,e,o),Ye(),jc=c,bt=s,Ic.transition=i}else e.current=n;if(Gc&&(Gc=!1,Wc=e,Vc=o),0===(i=e.pendingLanes)&&($c=null),function(e){if(at&&"function"==typeof at.onCommitFiberRoot)try{at.onCommitFiberRoot(ot,e,void 0,!(128&~e.current.flags))}catch(e){}}(n.stateNode),nl(e,Je()),null!==t)for(r=e.onRecoverableError,n=0;n<t.length;n++)r((o=t[n]).value,{componentStack:o.stack,digest:o.digest});if(Hc)throw Hc=!1,e=Kc,Kc=null,e;!!(1&Vc)&&0!==e.tag&&wl(),1&(i=e.pendingLanes)?e===Yc?Qc++:(Qc=0,Yc=e):Qc=0,Ho()}(e,t,n,r)}finally{Ic.transition=o,bt=r}return null}function wl(){if(null!==Wc){var e=xt(Vc),t=Ic.transition,n=bt;try{if(Ic.transition=null,bt=16>e?16:e,null===Wc)var r=!1;else{if(e=Wc,Wc=null,Vc=0,6&jc)throw Error(a(331));var o=jc;for(jc|=4,Js=e.current;null!==Js;){var i=Js,s=i.child;if(16&Js.flags){var c=i.deletions;if(null!==c){for(var l=0;l<c.length;l++){var u=c[l];for(Js=u;null!==Js;){var d=Js;switch(d.tag){case 0:case 11:case 15:tc(8,d,i)}var h=d.child;if(null!==h)h.return=d,Js=h;else for(;null!==Js;){var p=(d=Js).sibling,f=d.return;if(oc(d),d===u){Js=null;break}if(null!==p){p.return=f,Js=p;break}Js=f}}}var g=i.alternate;if(null!==g){var m=g.child;if(null!==m){g.child=null;do{var v=m.sibling;m.sibling=null,m=v}while(null!==m)}}Js=i}}if(2064&i.subtreeFlags&&null!==s)s.return=i,Js=s;else e:for(;null!==Js;){if(2048&(i=Js).flags)switch(i.tag){case 0:case 11:case 15:tc(9,i,i.return)}var y=i.sibling;if(null!==y){y.return=i.return,Js=y;break e}Js=i.return}}var b=e.current;for(Js=b;null!==Js;){var x=(s=Js).child;if(2064&s.subtreeFlags&&null!==x)x.return=s,Js=x;else e:for(s=b;null!==Js;){if(2048&(c=Js).flags)try{switch(c.tag){case 0:case 11:case 15:nc(9,c)}}catch(e){Cl(c,c.return,e)}if(c===s){Js=null;break e}var w=c.sibling;if(null!==w){w.return=c.return,Js=w;break e}Js=c.return}}if(jc=o,Ho(),at&&"function"==typeof at.onPostCommitFiberRoot)try{at.onPostCommitFiberRoot(ot,e)}catch(e){}r=!0}return r}finally{bt=n,Ic.transition=t}}return!1}function kl(e,t,n){e=Fa(e,t=ps(0,t=ls(n,t),1),1),t=Zc(),null!==e&&(vt(e,1,t),nl(e,t))}function Cl(e,t,n){if(3===e.tag)kl(e,e,n);else for(;null!==t;){if(3===t.tag){kl(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===$c||!$c.has(r))){t=Fa(t,e=fs(t,e=ls(n,e),1),1),e=Zc(),null!==t&&(vt(t,1,e),nl(t,e));break}}t=t.return}}function Sl(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=Zc(),e.pingedLanes|=e.suspendedLanes&n,Ac===e&&(Ec&n)===n&&(4===Oc||3===Oc&&(130023424&Ec)===Ec&&500>Je()-Fc?dl(e,0):Lc|=n),nl(e,t)}function Tl(e,t){0===t&&(1&e.mode?(t=ut,!(130023424&(ut<<=1))&&(ut=4194304)):t=1);var n=Zc();null!==(e=Ma(e,t))&&(vt(e,t,n),nl(e,n))}function Il(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Tl(e,n)}function jl(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;null!==o&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(a(314))}null!==r&&r.delete(t),Tl(e,n)}function Al(e,t){return We(e,t)}function Nl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function El(e,t,n,r){return new Nl(e,t,n,r)}function _l(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Pl(e,t){var n=e.alternate;return null===n?((n=El(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ol(e,t,n,r,o,i){var s=2;if(r=e,"function"==typeof e)_l(e)&&(s=1);else if("string"==typeof e)s=5;else e:switch(e){case C:return Rl(n.children,o,i,t);case S:s=8,o|=8;break;case T:return(e=El(12,n,t,2|o)).elementType=T,e.lanes=i,e;case N:return(e=El(13,n,t,o)).elementType=N,e.lanes=i,e;case E:return(e=El(19,n,t,o)).elementType=E,e.lanes=i,e;case O:return Ml(n,o,i,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case I:s=10;break e;case j:s=9;break e;case A:s=11;break e;case _:s=14;break e;case P:s=16,r=null;break e}throw Error(a(130,null==e?e:typeof e,""))}return(t=El(s,n,t,o)).elementType=e,t.type=r,t.lanes=i,t}function Rl(e,t,n,r){return(e=El(7,e,r,t)).lanes=n,e}function Ml(e,t,n,r){return(e=El(22,e,r,t)).elementType=O,e.lanes=n,e.stateNode={isHidden:!1},e}function zl(e,t,n){return(e=El(6,e,null,t)).lanes=n,e}function Ll(e,t,n){return(t=El(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ql(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mt(0),this.expirationTimes=mt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mt(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Dl(e,t,n,r,o,a,i,s,c){return e=new ql(e,t,n,s,c),1===t?(t=1,!0===a&&(t|=8)):t=0,a=El(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},La(a),e}function Fl(e){if(!e)return Ao;e:{if(Be(e=e._reactInternals)!==e||1!==e.tag)throw Error(a(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Oo(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(a(171))}if(1===e.tag){var n=e.type;if(Oo(n))return zo(e,n,t)}return t}function Ul(e,t,n,r,o,a,i,s,c){return(e=Dl(n,r,!0,e,0,a,0,s,c)).context=Fl(null),n=e.current,(a=Da(r=Zc(),o=el(n))).callback=null!=t?t:null,Fa(n,a,o),e.current.lanes=o,vt(e,o,r),nl(e,r),e}function Bl(e,t,n,r){var o=t.current,a=Zc(),i=el(o);return n=Fl(n),null===t.context?t.context=n:t.pendingContext=n,(t=Da(a,i)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=Fa(o,t,i))&&(tl(e,o,i,a),Ua(e,o,i)),i}function Hl(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Kl(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function $l(e,t){Kl(e,t),(e=e.alternate)&&Kl(e,t)}kc=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||Eo.current)bs=!0;else{if(0===(e.lanes&n)&&!(128&t.flags))return bs=!1,function(e,t,n){switch(t.tag){case 3:Ns(t),fa();break;case 5:Xa(t);break;case 1:Oo(t.type)&&Lo(t);break;case 4:Ya(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;jo(Ca,r._currentValue),r._currentValue=o;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(jo(ei,1&ei.current),t.flags|=128,null):0!==(n&t.child.childLanes)?zs(e,t,n):(jo(ei,1&ei.current),null!==(e=Hs(e,t,n))?e.sibling:null);jo(ei,1&ei.current);break;case 19:if(r=0!==(n&t.childLanes),128&e.flags){if(r)return Us(e,t,n);t.flags|=128}if(null!==(o=t.memoizedState)&&(o.rendering=null,o.tail=null,o.lastEffect=null),jo(ei,ei.current),r)break;return null;case 22:case 23:return t.lanes=0,Ss(e,t,n)}return Hs(e,t,n)}(e,t,n);bs=!!(131072&e.flags)}else bs=!1,aa&&1048576&t.flags&&ea(t,Wo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Bs(e,t),e=t.pendingProps;var o=Po(t,No.current);Ea(t,n),o=mi(null,t,r,e,o,n);var i=vi();return t.flags|=1,"object"==typeof o&&null!==o&&"function"==typeof o.render&&void 0===o.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Oo(r)?(i=!0,Lo(t)):i=!1,t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,La(t),o.updater=os,t.stateNode=o,o._reactInternals=t,cs(t,r,e,n),t=As(null,t,r,!0,i,n)):(t.tag=0,aa&&i&&ta(t),xs(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Bs(e,t),e=t.pendingProps,r=(o=r._init)(r._payload),t.type=r,o=t.tag=function(e){if("function"==typeof e)return _l(e)?1:0;if(null!=e){if((e=e.$$typeof)===A)return 11;if(e===_)return 14}return 2}(r),e=ns(r,e),o){case 0:t=Is(null,t,r,e,n);break e;case 1:t=js(null,t,r,e,n);break e;case 11:t=ws(null,t,r,e,n);break e;case 14:t=ks(null,t,r,ns(r.type,e),n);break e}throw Error(a(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,Is(e,t,r,o=t.elementType===r?o:ns(r,o),n);case 1:return r=t.type,o=t.pendingProps,js(e,t,r,o=t.elementType===r?o:ns(r,o),n);case 3:e:{if(Ns(t),null===e)throw Error(a(387));r=t.pendingProps,o=(i=t.memoizedState).element,qa(e,t),Ha(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated){if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,256&t.flags){t=Es(e,t,r,n,o=ls(Error(a(423)),t));break e}if(r!==o){t=Es(e,t,r,n,o=ls(Error(a(424)),t));break e}for(oa=lo(t.stateNode.containerInfo.firstChild),ra=t,aa=!0,ia=null,n=ka(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(fa(),r===o){t=Hs(e,t,n);break e}xs(e,t,r,n)}t=t.child}return t;case 5:return Xa(t),null===e&&ua(t),r=t.type,o=t.pendingProps,i=null!==e?e.memoizedProps:null,s=o.children,no(r,o)?s=null:null!==i&&no(r,i)&&(t.flags|=32),Ts(e,t),xs(e,t,s,n),t.child;case 6:return null===e&&ua(t),null;case 13:return zs(e,t,n);case 4:return Ya(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=wa(t,null,r,n):xs(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,ws(e,t,r,o=t.elementType===r?o:ns(r,o),n);case 7:return xs(e,t,t.pendingProps,n),t.child;case 8:case 12:return xs(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,jo(Ca,r._currentValue),r._currentValue=s,null!==i)if(sr(i.value,s)){if(i.children===o.children&&!Eo.current){t=Hs(e,t,n);break e}}else for(null!==(i=t.child)&&(i.return=t);null!==i;){var c=i.dependencies;if(null!==c){s=i.child;for(var l=c.firstContext;null!==l;){if(l.context===r){if(1===i.tag){(l=Da(-1,n&-n)).tag=2;var u=i.updateQueue;if(null!==u){var d=(u=u.shared).pending;null===d?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}i.lanes|=n,null!==(l=i.alternate)&&(l.lanes|=n),Na(i.return,n,t),c.lanes|=n;break}l=l.next}}else if(10===i.tag)s=i.type===t.type?null:i.child;else if(18===i.tag){if(null===(s=i.return))throw Error(a(341));s.lanes|=n,null!==(c=s.alternate)&&(c.lanes|=n),Na(s,n,t),s=i.sibling}else s=i.child;if(null!==s)s.return=i;else for(s=i;null!==s;){if(s===t){s=null;break}if(null!==(i=s.sibling)){i.return=s.return,s=i;break}s=s.return}i=s}xs(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Ea(t,n),r=r(o=_a(o)),t.flags|=1,xs(e,t,r,n),t.child;case 14:return o=ns(r=t.type,t.pendingProps),ks(e,t,r,o=ns(r.type,o),n);case 15:return Cs(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ns(r,o),Bs(e,t),t.tag=1,Oo(r)?(e=!0,Lo(t)):e=!1,Ea(t,n),is(t,r,o),cs(t,r,o,n),As(null,t,r,!0,e,n);case 19:return Us(e,t,n);case 22:return Ss(e,t,n)}throw Error(a(156,t.tag))};var Gl="function"==typeof reportError?reportError:function(e){console.error(e)};function Wl(e){this._internalRoot=e}function Vl(e){this._internalRoot=e}function Ql(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Yl(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Jl(){}function Xl(e,t,n,r,o){var a=n._reactRootContainer;if(a){var i=a;if("function"==typeof o){var s=o;o=function(){var e=Hl(i);s.call(e)}}Bl(t,i,e,o)}else i=function(e,t,n,r,o){if(o){if("function"==typeof r){var a=r;r=function(){var e=Hl(i);a.call(e)}}var i=Ul(t,r,e,0,null,!1,0,"",Jl);return e._reactRootContainer=i,e[go]=i.current,Br(8===e.nodeType?e.parentNode:e),ll(),i}for(;o=e.lastChild;)e.removeChild(o);if("function"==typeof r){var s=r;r=function(){var e=Hl(c);s.call(e)}}var c=Dl(e,0,!1,null,0,!1,0,"",Jl);return e._reactRootContainer=c,e[go]=c.current,Br(8===e.nodeType?e.parentNode:e),ll(function(){Bl(t,c,n,r)}),c}(n,t,e,o,r);return Hl(i)}Vl.prototype.render=Wl.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(a(409));Bl(e,t,null,null)},Vl.prototype.unmount=Wl.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;ll(function(){Bl(null,e,null,null)}),t[go]=null}},Vl.prototype.unstable_scheduleHydration=function(e){if(e){var t=St();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ot.length&&0!==t&&t<Ot[n].priority;n++);Ot.splice(n,0,e),0===n&&Lt(e)}},wt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=dt(t.pendingLanes);0!==n&&(yt(t,1|n),nl(t,Je()),!(6&jc)&&(Uc=Je()+500,Ho()))}break;case 13:ll(function(){var t=Ma(e,1);if(null!==t){var n=Zc();tl(t,e,1,n)}}),$l(e,1)}},kt=function(e){if(13===e.tag){var t=Ma(e,134217728);null!==t&&tl(t,e,134217728,Zc()),$l(e,134217728)}},Ct=function(e){if(13===e.tag){var t=el(e),n=Ma(e,t);null!==n&&tl(n,e,t,Zc()),$l(e,t)}},St=function(){return bt},Tt=function(e,t){var n=bt;try{return bt=e,t()}finally{bt=n}},ke=function(e,t,n){switch(t){case"input":if(X(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=ko(r);if(!o)throw Error(a(90));W(r),X(r,o)}}}break;case"textarea":ae(e,n);break;case"select":null!=(t=n.value)&&ne(e,!!n.multiple,t,!1)}},Ae=cl,Ne=ll;var Zl={usingClientEntryPoint:!1,Events:[xo,wo,ko,Ie,je,cl]},eu={findFiberByHostInstance:bo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},tu={bundleType:eu.bundleType,version:eu.version,rendererPackageName:eu.rendererPackageName,rendererConfig:eu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:x.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=$e(e))?null:e.stateNode},findFiberByHostInstance:eu.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var nu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nu.isDisabled&&nu.supportsFiber)try{ot=nu.inject(tu),at=nu}catch(ue){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Zl,t.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Ql(t))throw Error(a(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:k,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},t.createRoot=function(e,t){if(!Ql(e))throw Error(a(299));var n=!1,r="",o=Gl;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(o=t.onRecoverableError)),t=Dl(e,1,!1,null,0,n,0,r,o),e[go]=t.current,Br(8===e.nodeType?e.parentNode:e),new Wl(t)},t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(a(188));throw e=Object.keys(e).join(","),Error(a(268,e))}return null===(e=$e(t))?null:e.stateNode},t.flushSync=function(e){return ll(e)},t.hydrate=function(e,t,n){if(!Yl(t))throw Error(a(200));return Xl(null,e,t,!0,n)},t.hydrateRoot=function(e,t,n){if(!Ql(e))throw Error(a(405));var r=null!=n&&n.hydratedSources||null,o=!1,i="",s=Gl;if(null!=n&&(!0===n.unstable_strictMode&&(o=!0),void 0!==n.identifierPrefix&&(i=n.identifierPrefix),void 0!==n.onRecoverableError&&(s=n.onRecoverableError)),t=Ul(t,null,e,1,null!=n?n:null,o,0,i,s),e[go]=t.current,Br(e),r)for(e=0;e<r.length;e++)o=(o=(n=r[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new Vl(t)},t.render=function(e,t,n){if(!Yl(t))throw Error(a(200));return Xl(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!Yl(e))throw Error(a(40));return!!e._reactRootContainer&&(ll(function(){Xl(null,null,e,!1,function(){e._reactRootContainer=null,e[go]=null})}),!0)},t.unstable_batchedUpdates=cl,t.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Yl(n))throw Error(a(200));if(null==e||void 0===e._reactInternals)throw Error(a(38));return Xl(e,t,n,!1,r)},t.version="18.3.1-next-f1338f8080-20240426"},601(e){e.exports=function(e){return e[1]}},659(e){var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},671(e,t,n){n.d(t,{A:()=>s});var r=n(601),o=n.n(r),a=n(314),i=n.n(a)()(o());i.push([e.id,'/* ================================================================\n LAUNCH PROGRESS & RESULTS — append to wizard.css\n ================================================================ */\n\n/* Progress spinner during create/launch */\n.submit-progress {\n text-align: center;\n padding: 48px 24px;\n}\n.submit-progress h2 {\n margin: 16px 0 8px;\n font-size: 1.25rem;\n}\n.submit-progress p {\n color: #6b7280;\n margin-bottom: 32px;\n}\n\n.progress-spinner {\n width: 48px;\n height: 48px;\n border: 3px solid #e5e7eb;\n border-top-color: #3b82f6;\n border-radius: 50%;\n margin: 0 auto;\n animation: spin 0.8s linear infinite;\n}\n@keyframes spin {\n to { transform: rotate(360deg); }\n}\n\n/* Two-step progress indicator */\n.progress-steps {\n display: flex;\n justify-content: center;\n gap: 32px;\n margin-top: 24px;\n}\n.progress-step {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 0.875rem;\n color: #9ca3af;\n}\n.progress-step.step-active {\n color: #3b82f6;\n font-weight: 500;\n}\n.progress-step.step-done {\n color: #10b981;\n}\n.step-indicator {\n width: 24px;\n height: 24px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 0.75rem;\n font-weight: 600;\n background: #f3f4f6;\n}\n.step-active .step-indicator {\n background: #dbeafe;\n color: #3b82f6;\n}\n.step-done .step-indicator {\n background: #d1fae5;\n color: #10b981;\n}\n.mini-spinner {\n display: inline-block;\n width: 14px;\n height: 14px;\n border: 2px solid #93c5fd;\n border-top-color: #3b82f6;\n border-radius: 50%;\n animation: spin 0.6s linear infinite;\n}\n\n/* Per-channel launch results */\n.launch-results {\n text-align: left;\n margin: 24px auto;\n max-width: 480px;\n}\n.launch-results h3 {\n font-size: 0.875rem;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: #6b7280;\n margin-bottom: 12px;\n}\n.launch-channel-result {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n border-radius: 8px;\n margin-bottom: 8px;\n background: #f9fafb;\n border: 1px solid #e5e7eb;\n flex-wrap: wrap;\n}\n.launch-channel-result.launch-status-submitted {\n border-color: #d1fae5;\n background: #f0fdf4;\n}\n.launch-channel-result.launch-status-pending_review {\n border-color: #fef3c7;\n background: #fffbeb;\n}\n.launch-channel-result.launch-status-error {\n border-color: #fecaca;\n background: #fef2f2;\n}\n.launch-channel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n.launch-channel-name {\n font-weight: 500;\n min-width: 100px;\n}\n.launch-status-badge {\n font-size: 0.8rem;\n font-weight: 500;\n padding: 2px 8px;\n border-radius: 4px;\n margin-left: auto;\n}\n.launch-status-badge.status-submitted {\n color: #059669;\n background: #d1fae5;\n}\n.launch-status-badge.status-pending_review {\n color: #d97706;\n background: #fef3c7;\n}\n.launch-status-badge.status-error {\n color: #dc2626;\n background: #fecaca;\n}\n.launch-channel-message {\n width: 100%;\n font-size: 0.8rem;\n color: #6b7280;\n padding-left: 20px;\n}\n.launch-external-id {\n font-size: 0.75rem;\n font-family: monospace;\n color: #9ca3af;\n padding-left: 20px;\n}\n\n/* Error state */\n.submit-error {\n text-align: center;\n padding: 48px 24px;\n}\n.submit-error h2 {\n margin: 16px 0 8px;\n color: #dc2626;\n}\n.submit-error p {\n color: #6b7280;\n margin-bottom: 24px;\n}\n.error-actions {\n display: flex;\n justify-content: center;\n gap: 12px;\n}\n\n/* Status badges in results */\n.status-badge.status-warning {\n background: #fef3c7;\n color: #d97706;\n}\n\n/* ================================================================\n CONFIRM LAUNCH MODAL\n ================================================================ */\n\n.confirm-overlay {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1000;\n padding: 24px;\n backdrop-filter: blur(2px);\n}\n.confirm-modal {\n background: #fff;\n border-radius: 12px;\n max-width: 520px;\n width: 100%;\n padding: 28px 32px;\n box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);\n animation: modalIn 0.2s ease-out;\n}\n@keyframes modalIn {\n from { opacity: 0; transform: translateY(12px) scale(0.98); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n}\n\n.confirm-header {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-bottom: 12px;\n}\n.confirm-icon-wrap {\n width: 44px;\n height: 44px;\n border-radius: 50%;\n background: #fffbeb;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n}\n.confirm-header h2 {\n font-size: 1.15rem;\n margin: 0;\n}\n.confirm-subtitle {\n font-size: 0.9rem;\n color: #4b5563;\n margin: 0 0 20px;\n line-height: 1.5;\n}\n\n/* Billing summary table */\n.confirm-billing {\n border: 1px solid #e5e7eb;\n border-radius: 8px;\n overflow: hidden;\n margin-bottom: 16px;\n}\n.confirm-billing-row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 10px 16px;\n font-size: 0.875rem;\n border-bottom: 1px solid #f3f4f6;\n}\n.confirm-billing-row:last-child {\n border-bottom: none;\n}\n.confirm-billing-sub {\n background: #f9fafb;\n padding-left: 28px;\n font-size: 0.825rem;\n color: #6b7280;\n}\n.confirm-billing-total {\n background: #f0f9ff;\n font-weight: 600;\n border-top: 2px solid #e5e7eb;\n}\n.confirm-amount {\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n}\n.confirm-ch-dot {\n display: inline-block;\n width: 8px;\n height: 8px;\n border-radius: 50%;\n margin-right: 6px;\n vertical-align: middle;\n}\n\n/* Note / fine print */\n.confirm-note {\n font-size: 0.78rem;\n color: #9ca3af;\n line-height: 1.5;\n margin-bottom: 16px;\n}\n\n/* Terms checkbox */\n.confirm-terms {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n padding: 14px 16px;\n background: #f9fafb;\n border: 1px solid #e5e7eb;\n border-radius: 8px;\n margin-bottom: 20px;\n cursor: pointer;\n font-size: 0.84rem;\n line-height: 1.5;\n color: #374151;\n}\n.confirm-terms input[type="checkbox"] {\n margin-top: 3px;\n width: 16px;\n height: 16px;\n flex-shrink: 0;\n accent-color: #3b82f6;\n cursor: pointer;\n}\n\n/* Actions */\n.confirm-actions {\n display: flex;\n justify-content: flex-end;\n gap: 12px;\n}\n.confirm-actions .btn-primary:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n/* Pricing source tag (visible when client has negotiated rate) */\n.confirm-pricing-source {\n color: #059669;\n font-weight: 500;\n}\n',""]);const s=i},767(e,t,n){n.d(t,{A:()=>s});var r=n(601),o=n.n(r),a=n(314),i=n.n(a)()(o());i.push([e.id,"/* ═══════════════════════════════════════════════\n Campaign Wizard Styles\n Extends the core AdPlatform design system\n ═══════════════════════════════════════════════ */\n\n/* ── Wrapper ── */\n.wizard-wrapper {\n display: flex;\n flex-direction: column;\n min-height: calc(100vh - var(--topbar-height));\n background: var(--color-bg);\n}\n.wizard-loading,\n.wizard-error {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 16px;\n padding: 80px 24px;\n color: var(--color-text-muted);\n}\n\n/* ── Header ── */\n.wizard-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 32px;\n background: var(--color-bg-elevated);\n border-bottom: 1px solid var(--color-border);\n}\n.wizard-header-left {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n.wizard-back-btn {\n width: 36px;\n height: 36px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: 1px solid var(--color-border);\n border-radius: var(--radius-md);\n color: var(--color-text-muted);\n cursor: pointer;\n transition: all var(--transition-fast);\n}\n.wizard-back-btn:hover {\n background: var(--color-bg-subtle);\n color: var(--color-text);\n border-color: var(--color-text-muted);\n}\n.wizard-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--color-text);\n letter-spacing: -0.2px;\n}\n.wizard-subtitle {\n font-size: 12px;\n color: var(--color-text-muted);\n font-weight: 500;\n}\n.wizard-header-right {\n display: flex;\n align-items: center;\n gap: 14px;\n}\n.save-indicator {\n font-size: 12px;\n color: var(--color-text-muted);\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.save-indicator.saved {\n color: var(--color-success);\n}\n\n/* ── Step Rail ── */\n.wizard-rail {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0;\n padding: 20px 32px;\n background: var(--color-bg-elevated);\n border-bottom: 1px solid var(--color-border);\n position: relative;\n overflow: hidden;\n}\n.wizard-rail::before {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 3px;\n background: var(--color-border-light);\n}\n.wizard-rail-progress {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 3px;\n background: var(--color-primary);\n transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);\n border-radius: 0 2px 2px 0;\n}\n.wizard-rail-step {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 20px;\n background: none;\n border: none;\n cursor: pointer;\n transition: all var(--transition-fast);\n position: relative;\n z-index: 1;\n}\n.wizard-rail-step:hover .rail-step-label {\n color: var(--color-text);\n}\n.rail-step-indicator {\n width: 28px;\n height: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n font-size: 13px;\n font-weight: 600;\n background: var(--color-bg-subtle);\n color: var(--color-text-muted);\n border: 2px solid var(--color-border);\n transition: all var(--transition-fast);\n}\n.wizard-rail-step.active .rail-step-indicator {\n background: var(--color-primary);\n color: white;\n border-color: var(--color-primary);\n box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);\n}\n.wizard-rail-step.complete .rail-step-indicator {\n background: var(--color-primary);\n color: white;\n border-color: var(--color-primary);\n}\n.wizard-rail-step.past .rail-step-indicator {\n background: var(--color-primary-light);\n color: var(--color-primary);\n border-color: var(--color-primary);\n}\n.rail-step-label {\n font-size: 13px;\n font-weight: 500;\n color: var(--color-text-muted);\n transition: color var(--transition-fast);\n}\n.wizard-rail-step.active .rail-step-label {\n color: var(--color-primary);\n font-weight: 600;\n}\n.wizard-rail-step.complete .rail-step-label,\n.wizard-rail-step.past .rail-step-label {\n color: var(--color-text-secondary);\n}\n\n/* Connectors between steps */\n.wizard-rail-step:not(:last-child)::after {\n content: '';\n display: block;\n width: 40px;\n height: 2px;\n background: var(--color-border);\n margin-left: 12px;\n}\n.wizard-rail-step.complete:not(:last-child)::after,\n.wizard-rail-step.past:not(:last-child)::after {\n background: var(--color-primary);\n}\n\n/* ── Body ── */\n.wizard-body {\n flex: 1;\n overflow-y: auto;\n padding: 28px 32px 32px;\n max-width: 820px;\n margin: 0 auto;\n width: 100%;\n}\n\n/* ── Footer ── */\n.wizard-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 32px;\n background: var(--color-bg-elevated);\n border-top: 1px solid var(--color-border);\n}\n.wizard-footer-center {\n font-size: 13px;\n color: var(--color-text-muted);\n font-weight: 500;\n}\n\n/* ── Step Content (shared) ── */\n.wizard-step-content {\n animation: stepFadeIn 0.3s ease;\n}\n@keyframes stepFadeIn {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n.step-intro {\n margin-bottom: 24px;\n}\n.step-intro h2 {\n font-size: 22px;\n font-weight: 700;\n color: var(--color-text);\n letter-spacing: -0.3px;\n margin-bottom: 6px;\n}\n.step-intro p {\n font-size: 14px;\n color: var(--color-text-secondary);\n line-height: 1.5;\n}\n\n.field-hint {\n font-size: 12px;\n color: var(--color-text-muted);\n margin-top: 6px;\n}\n.field-sub-label {\n font-size: 12px;\n font-weight: 500;\n color: var(--color-text-muted);\n margin-bottom: 4px;\n display: block;\n}\n.field-error {\n font-size: 13px;\n color: var(--color-danger);\n margin-top: 6px;\n}\n.text-muted {\n color: var(--color-text-muted);\n}\n\n/* ── Step 1: Business ── */\n.url-input-row {\n display: flex;\n gap: 12px;\n}\n.url-input-row .form-input {\n flex: 1;\n}\n.analysis-card {\n background: var(--color-success-light);\n border: 1px solid #a7f3d0;\n border-radius: var(--radius-lg);\n margin-bottom: 24px;\n overflow: hidden;\n}\n.analysis-card-header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n font-size: 14px;\n font-weight: 600;\n color: var(--color-success);\n}\n.analysis-card-body {\n padding: 0 16px 16px;\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n.analysis-detail {\n display: flex;\n gap: 12px;\n font-size: 13px;\n}\n.analysis-label {\n min-width: 90px;\n font-weight: 600;\n color: #065f46;\n flex-shrink: 0;\n}\n.analysis-value {\n color: #064e3b;\n line-height: 1.5;\n}\n.category-tag {\n display: inline-block;\n padding: 2px 10px;\n background: rgba(5, 150, 105, 0.15);\n color: var(--color-success);\n border-radius: 20px;\n font-size: 12px;\n font-weight: 600;\n}\n.objective-grid {\n display: grid;\n grid-template-columns: 1fr 1fr 1fr;\n gap: 10px;\n}\n.objective-card {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 2px;\n padding: 12px 14px;\n background: var(--color-bg-elevated);\n border: 2px solid var(--color-border);\n border-radius: var(--radius-lg);\n cursor: pointer;\n transition: all var(--transition-fast);\n text-align: left;\n}\n.objective-card:hover {\n border-color: var(--color-primary);\n background: var(--color-primary-light);\n}\n.objective-card.selected {\n border-color: var(--color-primary);\n background: var(--color-primary-light);\n box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);\n}\n.objective-icon {\n font-size: 18px;\n margin-bottom: 2px;\n}\n.objective-label {\n font-size: 13px;\n font-weight: 600;\n color: var(--color-text);\n}\n.objective-desc {\n font-size: 11px;\n color: var(--color-text-muted);\n line-height: 1.3;\n}\n\n/* ── Step 2: Budget ── */\n\n/* Category select enhanced */\n.form-select-lg {\n padding: 12px 14px;\n font-size: 15px;\n min-height: 48px;\n}\n\n/* ── Channel Recommendation Badge ── */\n.channel-rec-badge {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 3px 8px;\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n border-radius: 10px;\n background: var(--color-success-light, #ecfdf5);\n color: var(--color-success, #059669);\n}\n.channel-rec-badge svg {\n width: 10px;\n height: 10px;\n}\n\n/* Channel strength hint */\n.channel-strength {\n display: flex;\n align-items: center;\n gap: 4px;\n margin-top: 6px;\n font-size: 11px;\n color: var(--color-text-muted);\n font-style: italic;\n}\n\n/* Channel context bar */\n.channel-context-bar {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n background: var(--color-primary-bg, #EEF2FF);\n border: 1px solid color-mix(in srgb, var(--color-primary) 15%, transparent);\n border-radius: 10px;\n margin-bottom: 20px;\n font-size: 13px;\n color: var(--color-primary);\n}\n.channel-context-bar svg {\n flex-shrink: 0;\n}\n\n.budget-input-wrap {\n display: flex;\n align-items: center;\n gap: 0;\n max-width: 280px;\n}\n.budget-prefix,\n.budget-suffix {\n padding: 10px 12px;\n background: var(--color-bg-subtle);\n border: 1px solid var(--color-border);\n font-size: 14px;\n font-weight: 500;\n color: var(--color-text-secondary);\n}\n.budget-prefix {\n border-radius: var(--radius-md) 0 0 var(--radius-md);\n border-right: none;\n}\n.budget-suffix {\n border-radius: 0 var(--radius-md) var(--radius-md) 0;\n border-left: none;\n white-space: nowrap;\n}\n.budget-input {\n border-radius: 0 !important;\n text-align: center;\n font-weight: 600;\n font-size: 18px;\n}\n.budget-presets {\n display: flex;\n gap: 8px;\n margin-top: 12px;\n}\n.preset-chip {\n padding: 6px 16px;\n border: 1px solid var(--color-border);\n border-radius: 20px;\n background: var(--color-bg-elevated);\n font-size: 13px;\n font-weight: 500;\n color: var(--color-text-secondary);\n cursor: pointer;\n transition: all var(--transition-fast);\n}\n.preset-chip:hover {\n border-color: var(--color-primary);\n color: var(--color-primary);\n}\n.preset-chip.active {\n background: var(--color-primary);\n border-color: var(--color-primary);\n color: white;\n}\n.estimate-banner {\n padding: 16px 20px;\n background: var(--color-primary-light);\n border: 1px solid #bfdbfe;\n border-radius: var(--radius-lg);\n margin-bottom: 24px;\n}\n.estimate-row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-size: 14px;\n color: var(--color-primary-dark);\n}\n.estimate-row strong {\n font-size: 18px;\n}\n.estimate-note {\n font-size: 12px;\n color: #3b82f6;\n margin-top: 8px;\n line-height: 1.5;\n}\n.bidding-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 10px;\n}\n.bidding-card {\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 14px 16px;\n background: var(--color-bg-elevated);\n border: 2px solid var(--color-border);\n border-radius: var(--radius-lg);\n cursor: pointer;\n transition: all var(--transition-fast);\n text-align: left;\n}\n.bidding-card:hover {\n border-color: var(--color-primary);\n}\n.bidding-card.selected {\n border-color: var(--color-primary);\n background: var(--color-primary-light);\n}\n.bidding-card-top {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.bidding-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--color-text);\n}\n.recommended-tag {\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n padding: 2px 8px;\n background: var(--color-success-light);\n color: var(--color-success);\n border-radius: 10px;\n}\n.bidding-desc {\n font-size: 12px;\n color: var(--color-text-muted);\n line-height: 1.4;\n}\n.toggle-label {\n display: flex;\n align-items: center;\n gap: 6px;\n cursor: pointer;\n font-size: 12px;\n}\n.toggle-text {\n color: var(--color-text-muted);\n}\n\n/* ── Step 3: Creative ── */\n.generate-bar {\n margin-bottom: 28px;\n padding: 20px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n transition: all 0.2s ease;\n}\n.generate-bar.empty {\n background: linear-gradient(135deg, #eef2ff 0%, #f0fdf4 100%);\n border-color: #c7d2fe;\n}\n.generate-bar-content {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n.generate-bar-icon {\n width: 44px;\n height: 44px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--color-primary-light, #eef2ff);\n border-radius: 10px;\n color: var(--color-primary);\n flex-shrink: 0;\n}\n.generate-bar.empty .generate-bar-icon {\n background: white;\n}\n.generate-bar-text {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n.generate-bar-text strong {\n font-size: 14px;\n color: var(--color-text);\n}\n.generate-bar-text span {\n font-size: 12px;\n color: var(--color-text-muted);\n}\n.creative-section {\n margin-bottom: 28px;\n}\n.creative-section-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 8px;\n}\n.creative-section-header h3 {\n font-size: 16px;\n font-weight: 600;\n color: var(--color-text);\n}\n.creative-section-hint {\n font-size: 13px;\n color: var(--color-text-muted);\n margin-bottom: 12px;\n}\n.asset-count {\n font-size: 12px;\n color: var(--color-text-muted);\n font-weight: 500;\n}\n\n/* Asset Editor */\n.asset-editor {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.asset-row {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-md);\n transition: border-color var(--transition-fast);\n}\n.asset-row:hover {\n border-color: var(--color-text-muted);\n}\n.asset-row.editing {\n border-color: var(--color-primary);\n box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);\n}\n.asset-text {\n flex: 1;\n font-size: 14px;\n color: var(--color-text);\n}\n.char-counter {\n font-size: 11px;\n font-family: var(--font-mono);\n color: var(--color-text-muted);\n flex-shrink: 0;\n}\n.char-counter.over {\n color: var(--color-danger);\n font-weight: 600;\n}\n.asset-action {\n width: 28px;\n height: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n color: var(--color-text-muted);\n cursor: pointer;\n border-radius: var(--radius-sm);\n flex-shrink: 0;\n}\n.asset-action:hover {\n background: var(--color-bg-subtle);\n color: var(--color-text);\n}\n.asset-action.danger:hover {\n background: var(--color-danger-light);\n color: var(--color-danger);\n}\n.asset-edit-row {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n}\n.asset-edit-row .form-input {\n flex: 1;\n margin: 0;\n}\n.add-asset-btn {\n align-self: flex-start;\n margin-top: 4px;\n}\n\n/* Images */\n.image-grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));\n gap: 12px;\n}\n.image-thumb {\n position: relative;\n border-radius: var(--radius-md);\n overflow: hidden;\n border: 1px solid var(--color-border);\n aspect-ratio: 4/3;\n background: var(--color-bg-subtle);\n}\n.image-thumb img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n.image-thumb-meta {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 6px 8px;\n background: linear-gradient(transparent, rgba(0,0,0,0.6));\n display: flex;\n gap: 6px;\n}\n.orientation-tag,\n.dim-tag {\n font-size: 10px;\n font-weight: 600;\n color: white;\n background: rgba(0,0,0,0.4);\n padding: 1px 6px;\n border-radius: 4px;\n}\n.image-remove {\n position: absolute;\n top: 6px;\n right: 6px;\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0,0,0,0.6);\n border: none;\n border-radius: 50%;\n color: white;\n cursor: pointer;\n opacity: 0;\n transition: opacity var(--transition-fast);\n}\n.image-thumb:hover .image-remove {\n opacity: 1;\n}\n.empty-images {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n padding: 32px;\n background: var(--color-bg-subtle);\n border: 2px dashed var(--color-border);\n border-radius: var(--radius-lg);\n color: var(--color-text-muted);\n font-size: 13px;\n}\n\n/* Ad Preview */\n.ad-preview-card {\n max-width: 400px;\n padding: 16px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n box-shadow: var(--shadow-sm);\n}\n.ad-preview-label {\n font-size: 12px;\n color: var(--color-text-muted);\n margin-bottom: 4px;\n}\n.ad-preview-headline {\n font-size: 18px;\n font-weight: 600;\n color: #1a0dab;\n margin-bottom: 4px;\n cursor: pointer;\n}\n.ad-preview-desc {\n font-size: 13px;\n color: var(--color-text-secondary);\n line-height: 1.5;\n}\n\n/* ── Step 4: Audience ── */\n.audience-section {\n margin-bottom: 24px;\n padding-bottom: 20px;\n border-bottom: 1px solid var(--color-border-light);\n}\n.audience-section:last-child {\n border-bottom: none;\n}\n.audience-section h3 {\n font-size: 16px;\n font-weight: 600;\n color: var(--color-text);\n margin-bottom: 12px;\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.optional-tag {\n font-size: 10px;\n font-weight: 500;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n color: var(--color-text-muted);\n background: var(--color-bg-subtle);\n padding: 2px 8px;\n border-radius: 10px;\n}\n\n/* Geo Search */\n.geo-search-wrap {\n position: relative;\n margin-bottom: 12px;\n}\n.geo-search-spinner {\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n}\n.geo-dropdown {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n margin-top: 4px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n box-shadow: var(--shadow-lg);\n max-height: 240px;\n overflow-y: auto;\n z-index: 50;\n}\n.geo-result {\n display: flex;\n align-items: center;\n gap: 10px;\n width: 100%;\n padding: 10px 14px;\n background: none;\n border: none;\n cursor: pointer;\n text-align: left;\n transition: background var(--transition-fast);\n}\n.geo-result:hover {\n background: var(--color-bg-subtle);\n}\n.geo-result:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n.geo-result-name {\n font-size: 14px;\n font-weight: 500;\n color: var(--color-text);\n}\n.geo-result-type {\n font-size: 11px;\n font-weight: 600;\n padding: 1px 8px;\n background: var(--color-primary-light);\n color: var(--color-primary);\n border-radius: 10px;\n}\n.geo-result-canonical {\n font-size: 12px;\n color: var(--color-text-muted);\n margin-left: auto;\n}\n.location-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n.location-chip {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 6px 12px;\n background: var(--color-primary-light);\n color: var(--color-primary);\n border-radius: 20px;\n font-size: 13px;\n font-weight: 500;\n}\n.chip-remove {\n background: none;\n border: none;\n color: var(--color-primary);\n cursor: pointer;\n font-size: 16px;\n line-height: 1;\n padding: 0 0 0 2px;\n opacity: 0.6;\n}\n.chip-remove:hover {\n opacity: 1;\n}\n\n/* Demo Chips */\n.demo-group {\n margin-bottom: 16px;\n}\n.demo-group label {\n display: block;\n font-size: 13px;\n font-weight: 600;\n color: var(--color-text-secondary);\n margin-bottom: 8px;\n}\n.chip-row {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n.chip {\n padding: 6px 16px;\n border: 1px solid var(--color-border);\n border-radius: 20px;\n background: var(--color-bg-elevated);\n font-size: 13px;\n font-weight: 500;\n color: var(--color-text-secondary);\n cursor: pointer;\n transition: all var(--transition-fast);\n}\n.chip:hover {\n border-color: var(--color-primary);\n color: var(--color-primary);\n}\n.chip.active {\n background: var(--color-primary);\n border-color: var(--color-primary);\n color: white;\n}\n\n/* Segment Blocks */\n.segment-block {\n margin-top: 16px;\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n overflow: hidden;\n}\n.segment-block-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n padding: 12px 16px;\n background: var(--color-bg-subtle);\n border: none;\n cursor: pointer;\n font-size: 14px;\n font-weight: 600;\n color: var(--color-text);\n}\n.segment-block-header:hover {\n background: var(--color-bg-muted);\n}\n.expand-icon {\n font-size: 12px;\n color: var(--color-text-muted);\n}\n.segment-block-desc {\n padding: 0 16px 8px;\n font-size: 12px;\n color: var(--color-text-muted);\n}\n.segment-list {\n max-height: 300px;\n overflow-y: auto;\n padding: 0 16px 12px;\n}\n.segment-item-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 0;\n font-size: 13px;\n color: var(--color-text-secondary);\n cursor: pointer;\n}\n.segment-item-row:hover {\n color: var(--color-text);\n}\n.segment-item-row input[type=\"checkbox\"] {\n accent-color: var(--color-primary);\n}\n.selected-count {\n padding: 8px 16px;\n font-size: 12px;\n font-weight: 600;\n color: var(--color-primary);\n background: var(--color-primary-light);\n border-top: 1px solid var(--color-border-light);\n}\n\n/* ── Step 5: Review ── */\n.review-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 14px;\n margin-bottom: 16px;\n}\n.review-grid-col {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n@media (max-width: 768px) {\n .review-grid {\n grid-template-columns: 1fr;\n }\n}\n.review-section {\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n overflow: hidden;\n}\n.review-section-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 10px 16px;\n background: var(--color-bg-subtle);\n border-bottom: 1px solid var(--color-border-light);\n}\n.review-section-title {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.review-section-title h3 {\n font-size: 13px;\n font-weight: 600;\n}\n.review-icon {\n font-size: 15px;\n}\n.review-section-body {\n padding: 12px 16px;\n}\n.review-row {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n padding: 5px 0;\n border-bottom: 1px solid var(--color-border-light);\n}\n.review-row:last-child {\n border-bottom: none;\n}\n.review-label {\n font-size: 12px;\n color: var(--color-text-muted);\n font-weight: 500;\n min-width: 60px;\n flex-shrink: 0;\n}\n.review-value {\n font-size: 13px;\n color: var(--color-text);\n text-align: right;\n}\n\n/* Compact creative summary on review */\n.review-creative-summary {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n color: var(--color-text-secondary);\n flex-wrap: wrap;\n}\n.review-dot-sep {\n color: var(--color-text-muted);\n}\n.review-sub-section {\n margin-bottom: 16px;\n}\n.review-sub-section:last-child {\n margin-bottom: 0;\n}\n.review-sub-label {\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n color: var(--color-text-muted);\n display: block;\n margin-bottom: 8px;\n}\n.review-asset-item {\n font-size: 13px;\n color: var(--color-text);\n padding: 6px 12px;\n background: var(--color-bg-subtle);\n border-radius: var(--radius-sm);\n margin-bottom: 4px;\n}\n.review-more {\n font-size: 12px;\n color: var(--color-text-muted);\n padding: 4px 0;\n}\n.review-image-row {\n display: flex;\n gap: 8px;\n align-items: center;\n}\n.review-thumb {\n width: 56px;\n height: 42px;\n object-fit: cover;\n border-radius: var(--radius-sm);\n border: 1px solid var(--color-border);\n}\n.review-more-images {\n font-size: 12px;\n color: var(--color-text-muted);\n font-weight: 500;\n}\n\n/* Validation */\n.issues-box {\n background: var(--color-warning-bg, #FEF3C7);\n border: 1px solid var(--color-warning-border, #FCD34D);\n border-radius: var(--radius-lg);\n margin-bottom: 20px;\n overflow: hidden;\n}\n.issue-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 16px;\n font-size: 13px;\n color: var(--color-warning-text, #92400E);\n cursor: pointer;\n transition: background 0.15s ease;\n border-bottom: 1px solid rgba(252, 211, 77, 0.3);\n}\n.issue-row:last-child {\n border-bottom: none;\n}\n.issue-row:hover {\n background: rgba(252, 211, 77, 0.15);\n}\n.issue-fix {\n margin-left: auto;\n font-weight: 600;\n font-size: 12px;\n color: var(--color-primary);\n}\n\n/* Phase loading spinner */\n.phase-loading {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 60px 24px;\n text-align: center;\n}\n.loading-spinner {\n width: 40px;\n height: 40px;\n border: 3px solid var(--color-border);\n border-top-color: var(--color-primary);\n border-radius: 50%;\n animation: spin 0.8s linear infinite;\n margin-bottom: 16px;\n}\n\n/* Error box */\n.error-box {\n padding: 12px 16px;\n background: var(--color-danger-light, #FEF2F2);\n border: 1px solid #fecaca;\n border-radius: 8px;\n font-size: 13px;\n color: var(--color-danger, #DC2626);\n margin-bottom: 16px;\n}\n\n.validation-box {\n padding: 16px 20px;\n background: var(--color-warning-light);\n border: 1px solid #fcd34d;\n border-radius: var(--radius-lg);\n margin-bottom: 20px;\n font-size: 14px;\n}\n.validation-box strong {\n display: block;\n color: var(--color-warning);\n margin-bottom: 8px;\n}\n.validation-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 6px 0;\n font-size: 13px;\n color: #92400e;\n}\n\n/* Submit */\n.submit-bar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 20px 24px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n margin-top: 24px;\n}\n.submit-bar-info {\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n.submit-bar-info strong {\n font-size: 15px;\n color: var(--color-text);\n}\n.submit-bar-info span {\n font-size: 13px;\n color: var(--color-text-muted);\n}\n\n/* Success State */\n.submit-success {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n padding: 48px 24px;\n}\n.success-icon {\n width: 72px;\n height: 72px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--color-success-light);\n color: var(--color-success);\n border-radius: 50%;\n margin-bottom: 20px;\n}\n.submit-success h2 {\n font-size: 24px;\n font-weight: 700;\n margin-bottom: 12px;\n}\n.submit-success p {\n font-size: 15px;\n color: var(--color-text-secondary);\n max-width: 480px;\n line-height: 1.6;\n margin-bottom: 28px;\n}\n.submit-details {\n width: 100%;\n max-width: 400px;\n background: var(--color-bg-subtle);\n border-radius: var(--radius-lg);\n padding: 16px 20px;\n}\n\n/* ── Draft Campaigns List (in Campaigns view) ── */\n.drafts-section {\n margin-bottom: 28px;\n}\n.drafts-section h3 {\n font-size: 14px;\n font-weight: 600;\n color: var(--color-text-muted);\n text-transform: uppercase;\n letter-spacing: 0.3px;\n margin-bottom: 12px;\n}\n.draft-cards {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));\n gap: 12px;\n}\n.draft-card {\n display: flex;\n align-items: center;\n gap: 14px;\n padding: 14px 16px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n cursor: pointer;\n transition: all var(--transition-fast);\n}\n.draft-card:hover {\n border-color: var(--color-primary);\n box-shadow: var(--shadow-sm);\n}\n.draft-icon {\n width: 36px;\n height: 36px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--color-warning-light);\n border-radius: var(--radius-md);\n flex-shrink: 0;\n}\n.draft-info {\n flex: 1;\n min-width: 0;\n}\n.draft-name {\n font-size: 14px;\n font-weight: 500;\n color: var(--color-text);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.draft-meta {\n font-size: 12px;\n color: var(--color-text-muted);\n}\n.draft-actions {\n display: flex;\n gap: 4px;\n}\n.draft-actions button {\n width: 28px;\n height: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n color: var(--color-text-muted);\n cursor: pointer;\n border-radius: var(--radius-sm);\n}\n.draft-actions button:hover {\n background: var(--color-bg-subtle);\n color: var(--color-text);\n}\n.draft-actions button.danger:hover {\n background: var(--color-danger-light);\n color: var(--color-danger);\n}\n\n/* ── Responsive ── */\n@media (max-width: 768px) {\n .wizard-rail {\n padding: 16px;\n overflow-x: auto;\n justify-content: flex-start;\n }\n .rail-step-label {\n display: none;\n }\n .wizard-rail-step:not(:last-child)::after {\n width: 20px;\n }\n .wizard-body {\n padding: 20px;\n }\n .objective-grid,\n .bidding-grid {\n grid-template-columns: 1fr 1fr;\n }\n .wizard-footer {\n padding: 12px 20px;\n }\n .url-input-row {\n flex-direction: column;\n }\n .submit-bar {\n flex-direction: column;\n gap: 16px;\n text-align: center;\n }\n}\n\n/* ═══════════════════════════════════════════════\n Phase 2 – Channel, Allocation & Objective Styles\n ═══════════════════════════════════════════════ */\n\n/* ── Category Grid (ObjectiveStep) ── */\n.category-grid {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 10px;\n}\n.category-card {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 6px;\n padding: 14px 10px;\n border: 2px solid var(--color-border);\n border-radius: 10px;\n background: var(--color-surface);\n cursor: pointer;\n transition: all 0.15s ease;\n font-size: 13px;\n color: var(--color-text-secondary);\n}\n.category-card:hover { border-color: var(--color-text-tertiary); }\n.category-card.selected {\n border-color: var(--color-primary);\n background: var(--color-primary-bg);\n color: var(--color-primary);\n}\n.category-icon { font-size: 22px; }\n.category-label { font-weight: 500; text-align: center; }\n\n/* ── Channel Grid (ChannelStep) ── */\n.channel-grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));\n gap: 16px;\n margin-bottom: 20px;\n}\n.channel-card {\n display: flex;\n flex-direction: column;\n padding: 20px;\n border: 2px solid var(--color-border);\n border-radius: 12px;\n background: var(--color-surface);\n cursor: pointer;\n transition: all 0.2s ease;\n text-align: left;\n position: relative;\n}\n.channel-card:hover:not(:disabled) {\n border-color: var(--channel-color, var(--color-primary));\n box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);\n}\n.channel-card.selected {\n border-color: var(--channel-color, var(--color-primary));\n background: var(--color-surface);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--channel-color, var(--color-primary)) 15%, transparent);\n}\n.channel-card.unsupported {\n opacity: 0.45;\n cursor: not-allowed;\n}\n.channel-card-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 12px;\n}\n.channel-icon svg { display: block; }\n.channel-icon-fallback {\n width: 28px;\n height: 28px;\n border-radius: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #fff;\n font-weight: 700;\n font-size: 14px;\n}\n.channel-card-check svg {\n color: var(--channel-color, var(--color-primary));\n}\n.check-empty {\n width: 20px;\n height: 20px;\n border: 2px solid var(--color-border);\n border-radius: 6px;\n}\n.channel-card.selected .check-empty { display: none; }\n.channel-card-body { flex: 1; margin-bottom: 12px; }\n.channel-name {\n font-weight: 600;\n font-size: 15px;\n color: var(--color-text);\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 4px;\n}\n.stub-badge {\n font-size: 10px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 4px;\n background: var(--color-warning-bg, #FEF3C7);\n color: var(--color-warning-text, #92400E);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n.channel-desc {\n font-size: 13px;\n color: var(--color-text-secondary);\n line-height: 1.4;\n}\n.channel-card-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding-top: 12px;\n border-top: 1px solid var(--color-border);\n}\n.channel-min-budget {\n font-size: 12px;\n color: var(--color-text-tertiary);\n font-weight: 500;\n}\n.channel-unsupported-label {\n font-size: 11px;\n color: var(--color-danger, #DC2626);\n}\n\n/* ── Channel Summary ── */\n.channel-summary {\n padding: 16px;\n background: var(--color-surface);\n border: 1px solid var(--color-border);\n border-radius: 10px;\n margin-bottom: 16px;\n}\n.channel-summary-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-bottom: 8px;\n}\n.channel-chip {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 4px 12px;\n border: 2px solid;\n border-radius: 20px;\n font-size: 13px;\n font-weight: 500;\n background: var(--color-surface);\n}\n.chip-remove {\n background: none;\n border: none;\n cursor: pointer;\n font-size: 16px;\n line-height: 1;\n padding: 0;\n color: var(--color-text-tertiary);\n}\n.chip-remove:hover { color: var(--color-danger, #DC2626); }\n.channel-summary-info {\n font-size: 13px;\n color: var(--color-text-secondary);\n}\n.channel-summary-note {\n color: var(--color-text-tertiary);\n}\n.channel-empty-hint {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 16px;\n color: var(--color-text-tertiary);\n font-size: 14px;\n}\n\n/* ── Budget Channel Requirements Bar ── */\n.budget-channels-bar {\n padding: 14px 18px;\n background: var(--color-surface, #f8fafc);\n border: 1px solid var(--color-border);\n border-radius: 10px;\n margin-bottom: 24px;\n}\n.budget-channels-label {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n color: var(--color-text-muted);\n margin-bottom: 10px;\n}\n.budget-channels-list {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-bottom: 4px;\n}\n.budget-channel-tag {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 5px 12px;\n border: 1.5px solid;\n border-radius: 20px;\n font-size: 13px;\n font-weight: 500;\n background: white;\n color: var(--color-text);\n}\n.budget-ch-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n.budget-ch-min {\n font-size: 11px;\n color: var(--color-text-muted);\n padding-left: 4px;\n border-left: 1px solid var(--color-border);\n margin-left: 4px;\n}\n.budget-channels-note {\n font-size: 12px;\n color: var(--color-text-muted);\n margin-top: 8px;\n padding-top: 8px;\n border-top: 1px solid var(--color-border-light, #e2e8f0);\n}\n\n/* ── Budget Period Toggle ── */\n.period-toggle {\n display: inline-flex;\n border: 1px solid var(--color-border);\n border-radius: 8px;\n overflow: hidden;\n}\n.toggle-btn {\n padding: 8px 20px;\n border: none;\n background: var(--color-surface);\n font-size: 13px;\n font-weight: 500;\n color: var(--color-text-secondary);\n cursor: pointer;\n transition: all 0.15s ease;\n}\n.toggle-btn:not(:last-child) {\n border-right: 1px solid var(--color-border);\n}\n.toggle-btn.active {\n background: var(--color-primary);\n color: #fff;\n}\n.toggle-btn:hover:not(.active) {\n background: var(--color-bg);\n}\n\n/* ── Allocation Sliders ── */\n.allocation-sliders {\n display: flex;\n flex-direction: column;\n gap: 16px;\n margin-bottom: 12px;\n}\n.allocation-row {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.allocation-label {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 14px;\n font-weight: 500;\n}\n.alloc-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n.alloc-name { color: var(--color-text); }\n.allocation-controls {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.alloc-slider {\n flex: 1;\n height: 6px;\n -webkit-appearance: none;\n appearance: none;\n border-radius: 3px;\n background: var(--color-border);\n outline: none;\n}\n.alloc-slider::-webkit-slider-thumb {\n -webkit-appearance: none;\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background: var(--slider-color, var(--color-primary));\n cursor: pointer;\n border: 2px solid #fff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);\n}\n.alloc-slider::-moz-range-thumb {\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background: var(--slider-color, var(--color-primary));\n cursor: pointer;\n border: 2px solid #fff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);\n}\n.alloc-values {\n display: flex;\n align-items: center;\n gap: 4px;\n flex-shrink: 0;\n min-width: 160px;\n}\n.alloc-pct-input {\n width: 48px;\n padding: 4px 6px;\n border: 1px solid var(--color-border);\n border-radius: 6px;\n font-size: 13px;\n text-align: center;\n background: var(--color-surface);\n color: var(--color-text);\n}\n.alloc-pct-sign {\n font-size: 13px;\n color: var(--color-text-secondary);\n margin-right: 8px;\n}\n.alloc-amount {\n font-size: 12px;\n color: var(--color-text-tertiary);\n font-weight: 500;\n}\n\n/* ── Allocation Balance Indicator ── */\n.allocation-balance {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n padding: 8px 12px;\n border-radius: 8px;\n margin-bottom: 12px;\n}\n.allocation-balance.balanced {\n background: var(--color-success-bg, #F0FDF4);\n color: var(--color-success-text, #166534);\n}\n.allocation-balance.unbalanced {\n background: var(--color-warning-bg, #FEF3C7);\n color: var(--color-warning-text, #92400E);\n}\n\n/* ── Allocation Bar (visual) ── */\n.allocation-bar {\n display: flex;\n height: 8px;\n border-radius: 4px;\n overflow: hidden;\n background: var(--color-border);\n}\n.alloc-bar-segment {\n transition: width 0.3s ease;\n min-width: 2px;\n}\n.alloc-bar-segment:first-child { border-radius: 4px 0 0 4px; }\n.alloc-bar-segment:last-child { border-radius: 0 4px 4px 0; }\n\n/* ── Recommendation Box ── */\n.recommendation-box {\n padding: 16px;\n background: var(--color-primary-bg, #EEF2FF);\n border: 1px solid color-mix(in srgb, var(--color-primary) 20%, transparent);\n border-radius: 10px;\n margin-bottom: 16px;\n}\n.recommendation-header {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 13px;\n color: var(--color-primary);\n margin-bottom: 12px;\n}\n.recommendation-channels {\n display: flex;\n flex-direction: column;\n gap: 8px;\n margin-bottom: 12px;\n}\n.rec-channel {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 14px;\n}\n.rec-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n}\n.rec-channel strong { margin-left: auto; }\n\n/* ── Warning Box ── */\n.warning-box {\n padding: 12px 16px;\n background: var(--color-warning-bg, #FEF3C7);\n border: 1px solid var(--color-warning-border, #FCD34D);\n border-radius: 8px;\n font-size: 13px;\n color: var(--color-warning-text, #92400E);\n}\n\n/* ── Review: Channel rows ── */\n.review-channels-list {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n.review-channel-row {\n display: flex;\n align-items: center;\n gap: 10px;\n font-size: 14px;\n}\n.review-channel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n.review-channel-name {\n font-weight: 500;\n flex: 1;\n}\n.review-channel-pct {\n font-size: 13px;\n color: var(--color-text-secondary);\n font-weight: 600;\n min-width: 40px;\n text-align: right;\n}\n.review-channel-amt {\n font-size: 13px;\n color: var(--color-text-tertiary);\n min-width: 80px;\n text-align: right;\n}\n.review-empty-note {\n font-size: 12px;\n color: var(--color-text-tertiary);\n font-style: italic;\n padding: 4px 0;\n}\n\n/* Review channel chips */\n.review-channels {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.review-channel-chip {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 4px 10px;\n border: 1.5px solid;\n border-radius: 8px;\n font-size: 12px;\n font-weight: 500;\n background: var(--color-surface, #f8fafc);\n}\n.review-ch-dot {\n width: 7px;\n height: 7px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n\n/* ── Responsive ── */\n@media (max-width: 640px) {\n .category-grid {\n grid-template-columns: repeat(2, 1fr);\n }\n .channel-grid {\n grid-template-columns: 1fr;\n }\n .objective-grid {\n grid-template-columns: 1fr 1fr;\n }\n .alloc-values {\n min-width: auto;\n flex-wrap: wrap;\n }\n .allocation-controls {\n flex-direction: column;\n align-items: stretch;\n }\n}\n\n/* ── Audience Profile Summary ── */\n.audience-profile-summary {\n background: var(--color-surface, #f8fafc);\n border: 1px solid var(--color-border, #e2e8f0);\n border-radius: 12px;\n padding: 20px;\n margin-top: 24px;\n}\n.audience-profile-summary h3 {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 15px;\n font-weight: 600;\n margin: 0 0 4px 0;\n}\n.audience-profile-summary .field-hint {\n margin-bottom: 12px;\n}\n.profile-factors {\n display: flex;\n gap: 16px;\n flex-wrap: wrap;\n}\n.profile-factor {\n display: flex;\n flex-direction: column;\n gap: 4px;\n padding: 10px 16px;\n background: white;\n border: 1px solid var(--color-border, #e2e8f0);\n border-radius: 8px;\n min-width: 140px;\n}\n.factor-label {\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n color: var(--color-text-secondary, #64748b);\n font-weight: 600;\n}\n.factor-value {\n font-size: 14px;\n font-weight: 600;\n color: var(--color-text-primary, #1e293b);\n}\n.factor-value.neutral {\n color: var(--color-text-secondary, #64748b);\n}\n.factor-value.has-value {\n color: var(--color-accent, #4F46E5);\n}\n\n/* ── Review: Audience Factors ── */\n.review-factors {\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n margin-top: 6px;\n}\n.review-factor-chip {\n display: inline-flex;\n align-items: center;\n padding: 4px 12px;\n border-radius: 20px;\n font-size: 12px;\n font-weight: 600;\n background: var(--color-surface, #f1f5f9);\n color: var(--color-accent, #4F46E5);\n border: 1px solid var(--color-border, #e2e8f0);\n}\n",""]);const s=i},825(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},848(e,t,n){e.exports=n(20)},877(e,t,n){n.d(t,{A:()=>s});var r=n(601),o=n.n(r),a=n(314),i=n.n(a)()(o());i.push([e.id,"@import url(https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap);"]),i.push([e.id,":root {\n --color-primary: #2563eb;\n --color-primary-dark: #1e40af;\n --color-primary-light: #eff6ff;\n --color-primary-hover: #1d4ed8;\n --color-success: #059669;\n --color-success-light: #ecfdf5;\n --color-warning: #d97706;\n --color-warning-light: #fffbeb;\n --color-danger: #dc2626;\n --color-danger-light: #fef2f2;\n --color-text: #111827;\n --color-text-secondary: #374151;\n --color-text-muted: #9ca3af;\n --color-bg: #f8f9fb;\n --color-bg-elevated: #ffffff;\n --color-bg-subtle: #f3f4f6;\n --color-bg-muted: #e5e7eb;\n --color-border: #e5e7eb;\n --color-border-light: #f3f4f6;\n --sidebar-width: 260px;\n --sidebar-collapsed: 72px;\n --topbar-height: 56px;\n --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n --font-mono: 'JetBrains Mono', 'Fira Code', monospace;\n --radius-sm: 6px;\n --radius-md: 8px;\n --radius-lg: 12px;\n --radius-xl: 16px;\n --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);\n --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);\n --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);\n --transition-fast: 0.15s ease;\n --transition-normal: 0.25s ease;\n}\n*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}\nbody{font-family:var(--font-sans);background:var(--color-bg);color:var(--color-text);-webkit-font-smoothing:antialiased;line-height:1.5}\n.mono{font-family:var(--font-mono);font-size:13px}\n\n/* Landing */\n.landing-page{min-height:100vh;display:flex;flex-direction:column;background:linear-gradient(135deg,#f8f9fb 0%,#eff6ff 100%)}\n.landing-header{padding:20px 40px;display:flex;align-items:center;justify-content:space-between}\n.landing-logo{display:flex;align-items:center;gap:12px}\n.landing-logo-icon{width:40px;height:40px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,var(--color-primary),var(--color-primary-dark));border-radius:var(--radius-md);color:white}\n.landing-logo-icon svg{width:22px;height:22px}\n.landing-logo-text{font-size:20px;font-weight:700;color:var(--color-text)}\n.landing-hero{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:60px 40px}\n.landing-hero h1{font-size:42px;font-weight:700;color:var(--color-text);margin-bottom:8px;letter-spacing:-0.5px}\n.landing-hero .landing-subtitle{font-size:24px;font-weight:400;color:var(--color-text-secondary);margin-bottom:16px;letter-spacing:-0.3px}\n.landing-hero p{font-size:18px;color:var(--color-text-secondary);max-width:520px;margin-bottom:40px}\n.landing-features{display:flex;gap:24px;margin-top:60px;max-width:800px}\n.feature-card{flex:1;padding:24px;background:var(--color-bg-elevated);border-radius:var(--radius-lg);border:1px solid var(--color-border);box-shadow:var(--shadow-sm)}\n.feature-card-icon{width:44px;height:44px;display:flex;align-items:center;justify-content:center;background:var(--color-primary-light);border-radius:var(--radius-md);color:var(--color-primary);margin-bottom:16px}\n.feature-card-icon svg{width:22px;height:22px}\n.feature-card h3{font-size:16px;font-weight:600;margin-bottom:8px}\n.feature-card p{font-size:14px;color:var(--color-text-muted);line-height:1.6}\n\n/* Status Pages */\n.status-page{min-height:100vh;display:flex;align-items:center;justify-content:center;background:var(--color-bg);padding:20px}\n.status-card{max-width:440px;width:100%;padding:48px 40px;background:var(--color-bg-elevated);border-radius:var(--radius-xl);box-shadow:var(--shadow-lg);text-align:center}\n.status-icon{font-size:48px;margin-bottom:20px}\n.status-icon.error{color:var(--color-danger)}\n.status-card h2{font-size:22px;font-weight:700;margin-bottom:12px}\n.status-card p{font-size:14px;color:var(--color-text-secondary);margin-bottom:8px;line-height:1.6}\n.error-text{color:var(--color-danger);background:var(--color-danger-light);padding:12px 16px;border-radius:var(--radius-md);margin:16px 0;font-size:13px}\n.status-actions{display:flex;flex-direction:column;gap:10px;margin-top:24px}\n\n/* Loading */\n.loading-screen{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;color:var(--color-text-muted);font-size:14px}\n.loading-spinner{width:36px;height:36px;border:3px solid var(--color-bg-muted);border-top-color:var(--color-primary);border-radius:50%;animation:spin 0.8s linear infinite}\n@keyframes spin{to{transform:rotate(360deg)}}\n\n/* Platform Layout */\n.platform{display:flex;min-height:100vh}\n.platform.sidebar-collapsed .main-area{margin-left:var(--sidebar-collapsed)}\n\n/* Sidebar */\n.sidebar{position:fixed;left:0;top:0;bottom:0;width:var(--sidebar-width);background:var(--color-bg-elevated);border-right:1px solid var(--color-border);display:flex;flex-direction:column;transition:width var(--transition-normal);z-index:100}\n.sidebar.collapsed{width:var(--sidebar-collapsed)}\n.sidebar-header{padding:20px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--color-border-light)}\n.logo{display:flex;align-items:center;gap:12px}\n.logo-icon{width:40px;height:40px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,var(--color-primary) 0%,#1e40af 100%);border-radius:var(--radius-md);color:white;flex-shrink:0}\n.logo-icon svg{width:22px;height:22px}\n.logo-text{font-size:18px;font-weight:600;color:var(--color-text);letter-spacing:-0.3px}\n.collapse-btn{width:28px;height:28px;display:flex;align-items:center;justify-content:center;background:none;border:none;color:var(--color-text-muted);cursor:pointer;border-radius:var(--radius-sm);transition:all var(--transition-fast)}\n.collapse-btn:hover{background:var(--color-bg-subtle);color:var(--color-text)}\n.collapse-btn svg{width:18px;height:18px}\n.sidebar-nav{flex:1;padding:16px 12px;overflow-y:auto}\n.nav-section{margin-bottom:24px}\n.nav-label{display:block;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.5px;color:var(--color-text-muted);padding:0 12px;margin-bottom:8px}\n.nav-list{list-style:none}\n.nav-item{width:100%;display:flex;align-items:center;gap:12px;padding:10px 12px;background:none;border:none;border-radius:var(--radius-md);color:var(--color-text-secondary);font-size:14px;font-weight:500;cursor:pointer;transition:all var(--transition-fast);text-align:left}\n.nav-item:hover{background:var(--color-bg-subtle);color:var(--color-text)}\n.nav-item.active{background:var(--color-primary-light);color:var(--color-primary)}\n.nav-icon{width:22px;height:22px;display:flex;align-items:center;justify-content:center;flex-shrink:0}\n.nav-icon svg{width:20px;height:20px}\n.sidebar-footer{padding:16px 12px;border-top:1px solid var(--color-border-light)}\n.sidebar-brand{display:flex;align-items:center;justify-content:center;gap:6px;font-size:12px;color:var(--color-text-muted)}\n.sidebar-brand strong{color:var(--color-text-secondary)}\n\n/* Main Area */\n.main-area{flex:1;margin-left:var(--sidebar-width);min-height:100%;display:flex;flex-direction:column;transition:margin-left var(--transition-normal)}\n\n/* Top Bar */\n.top-bar{height:var(--topbar-height);padding:0 32px;display:flex;align-items:center;justify-content:space-between;background:var(--color-bg-elevated);border-bottom:1px solid var(--color-border);position:sticky;top:0;z-index:50}\n.breadcrumb{display:flex;align-items:center;gap:8px;font-size:14px}\n.breadcrumb-item{color:var(--color-text-muted)}\n.breadcrumb-separator{color:var(--color-border)}\n.breadcrumb-current{color:var(--color-text);font-weight:600}\n.top-bar-actions{display:flex;align-items:center;gap:16px}\n.client-badge{padding:4px 12px;background:var(--color-primary-light);color:var(--color-primary);border-radius:20px;font-size:12px;font-weight:600}\n.user-menu{position:relative}\n.user-menu-trigger{display:flex;align-items:center;gap:10px;padding:6px 10px;background:none;border:1px solid transparent;border-radius:var(--radius-md);cursor:pointer;transition:all var(--transition-fast)}\n.user-menu-trigger:hover{background:var(--color-bg-subtle);border-color:var(--color-border)}\n.user-avatar{width:32px;height:32px;display:flex;align-items:center;justify-content:center;background:var(--color-primary);color:white;border-radius:50%;font-size:13px;font-weight:600}\n.user-name{font-size:13px;font-weight:500;color:var(--color-text)}\n.user-dropdown{position:absolute;right:0;top:100%;margin-top:8px;width:220px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);padding:8px;z-index:200}\n.user-dropdown-item{width:100%;display:flex;align-items:center;gap:10px;padding:8px 12px;background:none;border:none;border-radius:var(--radius-sm);font-size:13px;color:var(--color-text-secondary);cursor:pointer;transition:all var(--transition-fast);text-align:left}\n.user-dropdown-item:hover{background:var(--color-bg-subtle);color:var(--color-text)}\n.user-dropdown-item.danger{color:var(--color-danger)}\n.user-dropdown-item.danger:hover{background:var(--color-danger-light)}\n.user-dropdown-divider{height:1px;background:var(--color-border-light);margin:6px 0}\n\n/* Content Area */\n.content-area{flex:1;padding:32px}\n.view-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:28px}\n.view-header h1{font-size:28px;font-weight:700;letter-spacing:-0.3px}\n.view-subtitle{font-size:14px;color:var(--color-text-muted);margin-top:4px}\n\n/* Stats Grid */\n.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:20px;margin-bottom:28px}\n.stat-card{padding:24px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg)}\n.stat-label{font-size:13px;font-weight:500;color:var(--color-text-muted);text-transform:uppercase;letter-spacing:0.3px;margin-bottom:8px}\n.stat-value{font-size:28px;font-weight:700;color:var(--color-text)}\n.stat-value.text-green{color:var(--color-success)}\n.stat-value.text-red{color:var(--color-danger)}\n.stat-value.text-blue{color:var(--color-primary)}\n\n/* Content Cards */\n.content-card{background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg);overflow:hidden}\n.content-card-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--color-border-light)}\n.content-card-header h3{font-size:16px;font-weight:600}\n.content-card-body{padding:0}\n.content-card-body.padded{padding:24px}\n\n/* Data Table */\n.data-table{width:100%;border-collapse:collapse}\n.data-table th{text-align:left;padding:12px 20px;font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:0.5px;color:var(--color-text-muted);background:var(--color-bg-subtle);border-bottom:1px solid var(--color-border)}\n.data-table td{padding:14px 20px;font-size:14px;border-bottom:1px solid var(--color-border-light)}\n.data-table tr:last-child td{border-bottom:none}\n.data-table tr:hover td{background:var(--color-bg-subtle);cursor:pointer}\n\n/* Campaign Rows */\n.campaign-row{display:flex;align-items:center;justify-content:space-between;padding:14px 20px;border-bottom:1px solid var(--color-border-light);cursor:pointer;transition:background var(--transition-fast)}\n.campaign-row:hover{background:var(--color-bg-subtle)}\n.campaign-row:last-child{border-bottom:none}\n.campaign-info{display:flex;flex-direction:column;gap:2px}\n.campaign-name{font-size:14px;font-weight:500;color:var(--color-text)}\n.campaign-type{font-size:12px;color:var(--color-text-muted)}\n\n/* Status Badges */\n.status-badge{display:inline-flex;align-items:center;padding:3px 10px;border-radius:20px;font-size:12px;font-weight:600;text-transform:capitalize}\n.status-badge.status-enabled,.status-badge.status-active{background:var(--color-success-light);color:var(--color-success)}\n.status-badge.status-paused{background:var(--color-warning-light);color:var(--color-warning)}\n.status-badge.status-removed,.status-badge.status-disabled,.status-badge.status-cancelled{background:var(--color-danger-light);color:var(--color-danger)}\n.status-badge.status-draft{background:var(--color-bg-subtle);color:var(--color-text-muted)}\n.status-badge.status-in-review,.status-badge.status-scheduled,.status-badge.status-staged{background:var(--color-primary-light);color:var(--color-primary)}\n.status-badge.status-completed{background:var(--color-bg-subtle);color:var(--color-text-secondary)}\n.status-badge.status-action-needed,.status-badge.status-error{background:var(--color-danger-light);color:var(--color-danger)}\n.status-badge.status-pending{background:var(--color-primary-light);color:var(--color-primary)}\n\n/* Campaign Cards */\n.campaign-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:16px}\n.campaign-card{background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:20px;cursor:pointer;transition:border-color 0.15s,box-shadow 0.15s}\n.campaign-card:hover{border-color:var(--color-primary);box-shadow:0 0 0 1px var(--color-primary)}\n.campaign-card-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:12px}\n.campaign-card-title{font-size:15px;font-weight:600;color:var(--color-text);line-height:1.3;flex:1;margin-right:12px}\n.campaign-card-body{display:flex;flex-direction:column;gap:10px}\n.campaign-card-meta{display:flex;flex-wrap:wrap;gap:12px;font-size:13px;color:var(--color-text-muted)}\n.campaign-card-meta span{display:inline-flex;align-items:center;gap:4px}\n.campaign-card-meta svg{opacity:0.6}\n.campaign-card-channels{display:flex;gap:6px;flex-wrap:wrap}\n.channel-pill{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:12px;font-size:11px;font-weight:600;background:var(--color-bg-subtle);color:var(--color-text-secondary);text-transform:capitalize}\n.campaign-card-actions{display:flex;gap:8px;margin-top:12px;padding-top:12px;border-top:1px solid var(--color-border-light)}\n.campaign-card-actions .btn{font-size:12px;padding:5px 12px}\n\n/* Filter Tabs */\n.filter-tabs{display:flex;gap:2px;padding:3px;background:var(--color-bg-subtle);border-radius:var(--radius-md);width:fit-content;border:1px solid var(--color-border-light)}\n.filter-tab{padding:7px 14px;border-radius:calc(var(--radius-md) - 2px);font-size:13px;font-weight:500;color:var(--color-text-muted);background:none;border:none;cursor:pointer;transition:all 0.15s;white-space:nowrap}\n.filter-tab:hover{color:var(--color-text-secondary);background:rgba(0,0,0,0.03)}\n.filter-tab.active{background:var(--color-bg-elevated);color:var(--color-text);box-shadow:0 1px 3px rgba(0,0,0,0.08),0 1px 2px rgba(0,0,0,0.04);font-weight:600}\n.filter-tab .tab-count{display:inline-flex;align-items:center;justify-content:center;margin-left:6px;min-width:18px;height:18px;padding:0 5px;border-radius:9px;font-size:11px;font-weight:600;background:var(--color-bg-muted);color:var(--color-text-muted)}\n.filter-tab.active .tab-count{background:var(--color-primary);color:white}\n\n/* Search Box */\n.search-box{position:relative;margin-left:auto}\n.search-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--color-text-muted);pointer-events:none;display:flex}\n.search-input{width:240px;padding:8px 12px 8px 36px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-md);font-size:13px;font-family:var(--font-sans);color:var(--color-text);transition:border-color var(--transition-fast),box-shadow var(--transition-fast),width var(--transition-normal)}\n.search-input:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px rgba(37,99,235,0.1);width:300px}\n.search-input::placeholder{color:var(--color-text-muted)}\n.search-clear{position:absolute;right:8px;top:50%;transform:translateY(-50%);background:none;border:none;cursor:pointer;color:var(--color-text-muted);padding:2px;display:flex;align-items:center;border-radius:var(--radius-sm)}\n.search-clear:hover{color:var(--color-text-secondary);background:var(--color-bg-subtle)}\n\n/* Draft Section */\n.drafts-section{margin-bottom:24px}\n.drafts-section h3{font-size:14px;font-weight:600;color:var(--color-text-secondary);margin-bottom:12px}\n.draft-cards{display:flex;gap:12px;overflow-x:auto;padding-bottom:4px}\n.draft-card{display:flex;align-items:center;gap:12px;padding:12px 16px;background:var(--color-bg-elevated);border:1px dashed var(--color-warning);border-radius:var(--radius-md);cursor:pointer;white-space:nowrap;min-width:220px;transition:border-color 0.15s,background 0.15s}\n.draft-card:hover{background:var(--color-warning-light);border-color:var(--color-warning)}\n.draft-icon{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:var(--radius-sm);background:var(--color-warning-light);flex-shrink:0}\n.draft-info{flex:1;min-width:0}\n.draft-name{font-size:13px;font-weight:600;color:var(--color-text);overflow:hidden;text-overflow:ellipsis}\n.draft-meta{font-size:11px;color:var(--color-text-muted);margin-top:2px}\n.draft-actions{display:flex;gap:4px;flex-shrink:0}\n.draft-actions button{background:none;border:none;padding:4px;cursor:pointer;color:var(--color-text-muted);border-radius:var(--radius-sm);transition:background 0.15s,color 0.15s}\n.draft-actions button:hover{background:var(--color-bg-subtle);color:var(--color-text-secondary)}\n.draft-actions button.danger:hover{background:var(--color-danger-light);color:var(--color-danger)}\n\n/* Campaigns Toolbar */\n.campaigns-toolbar{display:flex;align-items:center;gap:16px;margin-bottom:20px;flex-wrap:wrap}\n.campaigns-toolbar .filter-tabs{margin-bottom:0}\n\n/* Detail Panel */\n.detail-panel{position:fixed;right:0;top:0;bottom:0;width:420px;background:var(--color-bg-elevated);border-left:1px solid var(--color-border);box-shadow:var(--shadow-lg);z-index:150;display:flex;flex-direction:column;animation:slideIn 0.25s ease}\n@keyframes slideIn{from{transform:translateX(100%)}to{transform:translateX(0)}}\n.detail-panel-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--color-border)}\n.detail-panel-header h3{font-size:18px;font-weight:600}\n.detail-panel-body{flex:1;overflow-y:auto;padding:24px}\n.detail-section{margin-bottom:28px}\n.detail-section h4{font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:0.5px;color:var(--color-text-muted);margin-bottom:16px}\n.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}\n.detail-item{display:flex;flex-direction:column;gap:4px}\n.detail-label{font-size:12px;color:var(--color-text-muted)}\n.detail-value{font-size:14px;font-weight:500;color:var(--color-text)}\n.detail-panel-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.3);z-index:140;animation:fadeIn 0.2s ease}\n.detail-actions{display:flex;gap:8px;flex-wrap:wrap}\n.detail-actions .btn{gap:6px}\n.channel-allocation-list{display:flex;flex-direction:column;gap:12px}\n.channel-alloc-row{display:flex;align-items:center;gap:10px}\n.channel-alloc-info{display:flex;flex-direction:column;min-width:100px}\n.channel-alloc-name{font-size:13px;font-weight:600;color:var(--color-text)}\n.channel-alloc-budget{font-size:11px;color:var(--color-text-muted)}\n.channel-alloc-bar-track{flex:1;height:8px;background:var(--color-bg-subtle);border-radius:4px;overflow:hidden}\n.channel-alloc-bar{height:100%;background:var(--color-primary);border-radius:4px;transition:width 0.3s ease}\n.channel-alloc-pct{font-size:12px;font-weight:600;color:var(--color-text-muted);min-width:36px;text-align:right}\n.detail-timeline{display:flex;flex-direction:column;gap:12px;padding-left:8px;border-left:2px solid var(--color-border-light)}\n.timeline-item{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--color-text-secondary);position:relative;margin-left:-9px}\n.timeline-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0}\n.timeline-dot.created{background:var(--color-text-muted)}\n.timeline-dot.launched{background:var(--color-primary)}\n.timeline-dot.completed{background:var(--color-success)}\n\n/* Modal */\n.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.4);display:flex;align-items:center;justify-content:center;z-index:200;animation:fadeIn 0.15s ease}\n.modal-content{background:var(--color-bg-elevated);border-radius:var(--radius-xl);box-shadow:0 20px 60px rgba(0,0,0,0.15);max-width:420px;width:90%;animation:scaleIn 0.2s ease}\n@keyframes scaleIn{from{opacity:0;transform:scale(0.95)}to{opacity:1;transform:scale(1)}}\n\n/* Launch Modal */\n.launch-modal{padding:0;overflow:hidden}\n.launch-modal-header{padding:28px 28px 20px;text-align:center}\n.launch-modal-icon{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:50%;background:var(--color-primary-light);color:var(--color-primary);margin-bottom:12px}\n.launch-modal-icon svg{width:22px;height:22px}\n.launch-modal-header h3{font-size:18px;font-weight:700;color:var(--color-text);margin-bottom:4px}\n.launch-modal-header p{font-size:14px;color:var(--color-text-muted);line-height:1.4}\n.launch-modal-header p strong{color:var(--color-text)}\n\n.launch-modal-billing{padding:0 28px 20px;display:flex;flex-direction:column;gap:10px}\n.billing-row{display:flex;justify-content:space-between;align-items:center;font-size:14px;color:var(--color-text-secondary);padding:6px 0}\n.billing-row span:last-child{font-weight:600;font-family:var(--font-mono);font-size:13px}\n.billing-total{border-top:1px solid var(--color-border);padding-top:12px;margin-top:4px;font-weight:600;color:var(--color-text);font-size:15px}\n.billing-total span:last-child{color:var(--color-primary);font-size:15px}\n\n.launch-modal-actions{display:flex;justify-content:flex-end;gap:10px;padding:16px 28px;background:var(--color-bg-subtle);border-top:1px solid var(--color-border-light)}\n.btn-launch{gap:6px}\n@keyframes fadeIn{from{opacity:0}to{opacity:1}}\n.modal{width:520px;max-height:90vh;background:var(--color-bg-elevated);border-radius:var(--radius-xl);box-shadow:var(--shadow-lg);display:flex;flex-direction:column;animation:scaleIn 0.2s ease}\n@keyframes scaleIn{from{transform:scale(0.95);opacity:0}to{transform:scale(1);opacity:1}}\n.modal-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--color-border)}\n.modal-header h3{font-size:18px;font-weight:600}\n.modal-close{width:32px;height:32px;display:flex;align-items:center;justify-content:center;background:none;border:none;color:var(--color-text-muted);cursor:pointer;border-radius:var(--radius-sm)}\n.modal-close:hover{background:var(--color-bg-subtle);color:var(--color-text)}\n.modal-body{padding:24px;overflow-y:auto}\n.modal-footer{display:flex;justify-content:flex-end;gap:12px;padding:16px 24px;border-top:1px solid var(--color-border);background:var(--color-bg-subtle);border-radius:0 0 var(--radius-xl) var(--radius-xl)}\n\n/* Forms */\n.form-group{margin-bottom:20px}\n.form-group label{display:block;font-size:13px;font-weight:600;color:var(--color-text-secondary);margin-bottom:6px}\n.form-input,.form-select,.form-textarea{width:100%;padding:10px 14px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-md);font-size:14px;font-family:var(--font-sans);color:var(--color-text);transition:border-color var(--transition-fast),box-shadow var(--transition-fast)}\n.form-input:focus,.form-select:focus,.form-textarea:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px rgba(37,99,235,0.1)}\n.form-input::placeholder{color:var(--color-text-muted)}\n.form-row{display:flex;gap:16px}\n.form-row .form-group{flex:1}\n.input-row{display:flex;gap:12px;align-items:flex-end;margin-bottom:20px}\n.input-row .form-input{flex:1}\n\n/* Buttons */\n.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 20px;border:1px solid transparent;border-radius:var(--radius-md);font-size:14px;font-weight:600;font-family:var(--font-sans);cursor:pointer;transition:all var(--transition-fast);text-decoration:none}\n.btn:disabled{opacity:0.6;cursor:not-allowed}\n.btn-primary{background:var(--color-primary);color:white;border-color:var(--color-primary)}\n.btn-primary:hover:not(:disabled){background:var(--color-primary-hover)}\n.btn-outline{background:var(--color-bg-elevated);color:var(--color-text-secondary);border-color:var(--color-border)}\n.btn-outline:hover:not(:disabled){background:var(--color-bg-subtle);border-color:var(--color-text-muted)}\n.btn-danger{background:var(--color-danger);color:white;border-color:var(--color-danger)}\n.btn-danger:hover:not(:disabled){background:#b91c1c}\n.btn-sm{padding:6px 14px;font-size:13px}\n.btn-ghost{background:none;border:none;color:var(--color-text-muted);cursor:pointer;padding:6px 12px;border-radius:var(--radius-sm);transition:all 0.15s}\n.btn-ghost:hover{background:var(--color-bg-subtle);color:var(--color-text)}\n.btn-lg{padding:14px 28px;font-size:16px}\n.btn-icon{padding:8px}\n.btn-spinner{display:inline-block;width:14px;height:14px;border:2px solid rgba(255,255,255,0.3);border-top-color:white;border-radius:50%;animation:spin 0.6s linear infinite}\n\n/* Info/Error Boxes */\n.info-box{padding:14px 20px;background:var(--color-primary-light);border:1px solid #bfdbfe;border-radius:var(--radius-md);font-size:14px;color:var(--color-primary-dark);margin-bottom:20px}\n.error-box{padding:14px 20px;background:var(--color-danger-light);border:1px solid #fca5a5;border-radius:var(--radius-md);font-size:14px;color:var(--color-danger);margin-bottom:20px}\n\n/* Empty States */\n.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px 24px;text-align:center;color:var(--color-text-muted)}\n.empty-state svg{margin-bottom:16px;opacity:0.5}\n.empty-state h3{font-size:16px;font-weight:600;color:var(--color-text-secondary);margin-bottom:8px}\n.empty-state p{font-size:14px;margin-bottom:20px}\n\n/* Settings */\n.settings-layout{display:flex;gap:32px}\n.settings-nav{width:200px;flex-shrink:0}\n.settings-nav-item{width:100%;display:block;padding:10px 16px;background:none;border:none;border-radius:var(--radius-md);font-size:14px;font-weight:500;color:var(--color-text-secondary);cursor:pointer;text-align:left;transition:all var(--transition-fast);margin-bottom:4px}\n.settings-nav-item:hover{background:var(--color-bg-subtle)}\n.settings-nav-item.active{background:var(--color-primary-light);color:var(--color-primary)}\n.settings-content{flex:1}\n.settings-section{background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:28px;margin-bottom:24px}\n.settings-section h3{font-size:16px;font-weight:600;margin-bottom:20px;padding-bottom:16px;border-bottom:1px solid var(--color-border-light)}\n.setting-row{display:flex;align-items:center;justify-content:space-between;padding:14px 0;border-bottom:1px solid var(--color-border-light)}\n.setting-row:last-child{border-bottom:none}\n.setting-info{flex:1}\n.setting-label{font-size:14px;font-weight:500;color:var(--color-text)}\n.setting-desc{font-size:13px;color:var(--color-text-muted);margin-top:2px}\n.setting-value{font-size:13px;color:var(--color-text-secondary);font-family:var(--font-mono)}\n.session-info-detailed{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}\n\n/* Developer */\n.preset-row{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px}\n.dev-form{background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:24px;margin-bottom:24px}\n.dev-response{background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg);overflow:hidden}\n.response-header{display:flex;align-items:center;gap:12px;padding:14px 20px;background:var(--color-bg-subtle);border-bottom:1px solid var(--color-border);font-size:13px;font-weight:500}\n.status-dot{width:10px;height:10px;border-radius:50%}\n.status-dot.green{background:var(--color-success)}\n.status-dot.red{background:var(--color-danger)}\n.elapsed{color:var(--color-text-muted);margin-left:auto}\n.request-id{color:var(--color-text-muted);font-family:var(--font-mono);font-size:12px}\n.response-body{padding:20px;font-family:var(--font-mono);font-size:13px;line-height:1.6;overflow-x:auto;max-height:500px;overflow-y:auto;white-space:pre-wrap;word-break:break-word}\n\n/* Skeletons */\n.skeleton{background:linear-gradient(90deg,var(--color-bg-subtle) 25%,var(--color-bg-muted) 50%,var(--color-bg-subtle) 75%);background-size:200% 100%;animation:skeleton-shimmer 1.5s infinite;border-radius:var(--radius-sm)}\n@keyframes skeleton-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}\n.skeleton-row{height:16px;margin-bottom:12px}\n.loading-placeholder{padding:16px 0}\n.loading-placeholder.padded{padding:20px}\n\n/* Detail panel notices */\n.detail-notice{display:flex;gap:12px;padding:14px 16px;border-radius:var(--radius-md);margin-bottom:16px;font-size:13px;line-height:1.5}\n.detail-notice.notice-info{background:var(--color-primary-light);border:1px solid rgba(37,99,235,0.15)}\n.detail-notice .notice-icon{flex-shrink:0;margin-top:1px;color:var(--color-primary)}\n.detail-notice strong{display:block;font-weight:600;color:var(--color-text);margin-bottom:2px}\n.detail-notice p{color:var(--color-text-secondary);margin:0}\n\n/* Small status badge (for channel rows) */\n.status-badge-sm{display:inline-flex;align-items:center;padding:1px 8px;border-radius:10px;font-size:11px;font-weight:600}\n.status-badge-sm.status-active,.status-badge-sm.status-enabled{background:var(--color-success-light);color:var(--color-success)}\n.status-badge-sm.status-in-review,.status-badge-sm.status-pending,.status-badge-sm.status-staged{background:var(--color-primary-light);color:var(--color-primary)}\n.status-badge-sm.status-paused{background:var(--color-warning-light);color:var(--color-warning)}\n.status-badge-sm.status-error,.status-badge-sm.status-cancelled{background:var(--color-danger-light);color:var(--color-danger)}\n\n/* Danger outline button */\n.btn-danger-outline{color:var(--color-danger);border-color:var(--color-danger)}\n.btn-danger-outline:hover{background:var(--color-danger-light)}\n\n/* Timeline dot: submitted */\n.timeline-dot.submitted{background:var(--color-primary)}\n\n/* Responsive */\n@media(max-width:900px){.settings-layout{flex-direction:column}.settings-nav{width:100%;display:flex;gap:8px;overflow-x:auto}.landing-features{flex-direction:column}}\n@media(max-width:768px){.content-area{padding:20px}.view-header{flex-direction:column;gap:16px}.detail-panel{width:100%}.sidebar{transform:translateX(-100%)}.sidebar.open{transform:translateX(0)}.main-area{margin-left:0}}\n",""]);const s=i},961(e,t,n){!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(551)},982(e,t,n){e.exports=n(463)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={id:r,exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.nc=void 0;var r=n(540),o=n(338);const a={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",CACHE_PREFIX:"msal",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_RESPONSE_TYPE:"code",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",FRAGMENT_RESPONSE_MODE:"fragment",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",NOT_AVAILABLE:"Not Available",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],TOKEN_RESPONSE_TYPE:"token",ID_TOKEN_RESPONSE_TYPE:"id_token",SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},i=[a.OPENID_SCOPE,a.PROFILE_SCOPE,a.OFFLINE_ACCESS_SCOPE],s=[...i,a.EMAIL_SCOPE],c="Content-Type",l="Retry-After",u="X-AnchorMailbox",d="x-ms-request-id",h="x-ms-httpver",p="idtoken",f="client.info",g="adal.idtoken",m="error",v="error.description",y="active-account",b="active-account-filters",x="common",w="organizations",k="consumers",C="access_token",S={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"},T={PLAIN:"plain",S256:"S256"},I={QUERY:"query",FRAGMENT:"fragment"},j={...I,FORM_POST:"form_post"},A="Generic",N="-",E={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},_="appmetadata",P="1",O="authority-metadata",R="config",M="cache",z="network",L="hardcoded_values",q={SCHEMA_VERSION:5,MAX_CUR_HEADER_BYTES:80,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"},D={BEARER:"Bearer",POP:"pop",SSH:"ssh-cert"},F="throttling";var U;!function(e){e[e.Error=0]="Error",e[e.Warning=1]="Warning",e[e.Info=2]="Info",e[e.Verbose=3]="Verbose",e[e.Trace=4]="Trace"}(U||(U={}));class B{constructor(e,t,n){this.level=U.Info;const r=e||B.createDefaultLoggerOptions();this.localCallback=r.loggerCallback||(()=>{}),this.piiLoggingEnabled=r.piiLoggingEnabled||!1,this.level="number"==typeof r.logLevel?r.logLevel:U.Info,this.correlationId=r.correlationId||a.EMPTY_STRING,this.packageName=t||a.EMPTY_STRING,this.packageVersion=n||a.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:U.Info}}clone(e,t,n){return new B({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:n||this.correlationId},e,t)}logMessage(e,t){if(t.logLevel>this.level||!this.piiLoggingEnabled&&t.containsPii)return;const n=`[${(new Date).toUTCString()}] : [${t.correlationId||this.correlationId||""}] : ${this.packageName}@${this.packageVersion} : ${U[t.logLevel]} - ${e}`;this.executeCallback(t.logLevel,n,t.containsPii||!1)}executeCallback(e,t,n){this.localCallback&&this.localCallback(e,t,n)}error(e,t){this.logMessage(e,{logLevel:U.Error,containsPii:!1,correlationId:t||a.EMPTY_STRING})}errorPii(e,t){this.logMessage(e,{logLevel:U.Error,containsPii:!0,correlationId:t||a.EMPTY_STRING})}warning(e,t){this.logMessage(e,{logLevel:U.Warning,containsPii:!1,correlationId:t||a.EMPTY_STRING})}warningPii(e,t){this.logMessage(e,{logLevel:U.Warning,containsPii:!0,correlationId:t||a.EMPTY_STRING})}info(e,t){this.logMessage(e,{logLevel:U.Info,containsPii:!1,correlationId:t||a.EMPTY_STRING})}infoPii(e,t){this.logMessage(e,{logLevel:U.Info,containsPii:!0,correlationId:t||a.EMPTY_STRING})}verbose(e,t){this.logMessage(e,{logLevel:U.Verbose,containsPii:!1,correlationId:t||a.EMPTY_STRING})}verbosePii(e,t){this.logMessage(e,{logLevel:U.Verbose,containsPii:!0,correlationId:t||a.EMPTY_STRING})}trace(e,t){this.logMessage(e,{logLevel:U.Trace,containsPii:!1,correlationId:t||a.EMPTY_STRING})}tracePii(e,t){this.logMessage(e,{logLevel:U.Trace,containsPii:!0,correlationId:t||a.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}const H="AAD",K="OIDC",$="none",G="unexpected_error",W="post_request_failed",V={[G]:"Unexpected error in authentication.",[W]:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."};class Q extends Error{constructor(e,t,n){super(t?`${e}: ${t}`:e),Object.setPrototypeOf(this,Q.prototype),this.errorCode=e||a.EMPTY_STRING,this.errorMessage=t||a.EMPTY_STRING,this.subError=n||a.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}}function Y(e,t){return new Q(e,t?`${V[e]} ${t}`:V[e])}const J="client_info_decoding_error",X="client_info_empty_error",Z="token_parsing_error",ee="null_or_empty_token",te="endpoints_resolution_error",ne="network_error",re="openid_config_error",oe="hash_not_deserialized",ae="invalid_state",ie="state_mismatch",se="state_not_found",ce="nonce_mismatch",le="auth_time_not_found",ue="max_age_transpired",de="multiple_matching_tokens",he="multiple_matching_accounts",pe="multiple_matching_appMetadata",fe="request_cannot_be_made",ge="cannot_remove_empty_scope",me="cannot_append_scopeset",ve="empty_input_scopeset",ye="device_code_polling_cancelled",be="device_code_expired",xe="device_code_unknown_error",we="no_account_in_silent_request",ke="invalid_cache_record",Ce="invalid_cache_environment",Se="no_account_found",Te="no_crypto_object",Ie="unexpected_credential_type",je="invalid_assertion",Ae="invalid_client_credential",Ne="token_refresh_required",Ee="user_timeout_reached",_e="token_claims_cnf_required_for_signedjwt",Pe="authorization_code_missing_from_server_response",Oe="binding_key_not_removed",Re="end_session_endpoint_not_supported",Me="key_id_missing",ze="no_network_connectivity",Le="user_canceled",qe="missing_tenant_id_error",De="method_not_implemented",Fe="nested_app_auth_bridge_disabled",Ue={[J]:"The client info could not be parsed/decoded correctly",[X]:"The client info was empty",[Z]:"Token cannot be parsed",[ee]:"The token is null or empty",[te]:"Endpoints cannot be resolved",[ne]:"Network request failed",[re]:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",[oe]:"The hash parameters could not be deserialized",[ae]:"State was not the expected format",[ie]:"State mismatch error",[se]:"State not found",[ce]:"Nonce mismatch error",[le]:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.",[ue]:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",[de]:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.",[he]:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",[pe]:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",[fe]:"Token request cannot be made without authorization code or refresh token.",[ge]:"Cannot remove null or empty scope from ScopeSet",[me]:"Cannot append ScopeSet",[ve]:"Empty input ScopeSet cannot be processed",[ye]:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",[be]:"Device code is expired.",[xe]:"Device code stopped polling for unknown reasons.",[we]:"Please pass an account object, silent flow is not supported without account information",[ke]:"Cache record object was null or undefined.",[Ce]:"Invalid environment when attempting to create cache entry",[Se]:"No account found in cache for given key.",[Te]:"No crypto object detected.",[Ie]:"Unexpected credential type.",[je]:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",[Ae]:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",[Ne]:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.",[Ee]:"User defined timeout for device code polling reached",[_e]:"Cannot generate a POP jwt if the token_claims are not populated",[Pe]:"Server response does not contain an authorization code to proceed",[Oe]:"Could not remove the credential's binding key from storage.",[Re]:"The provided authority does not support logout",[Me]:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.",[ze]:"No network connectivity. Check your internet connection.",[Le]:"User cancelled the flow.",[qe]:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",[De]:"This method has not been implemented",[Fe]:"The nested app auth bridge is disabled"};class Be extends Q{constructor(e,t){super(e,t?`${Ue[e]}: ${t}`:Ue[e]),this.name="ClientAuthError",Object.setPrototypeOf(this,Be.prototype)}}function He(e,t){return new Be(e,t)}const Ke={createNewGuid:()=>{throw He(De)},base64Decode:()=>{throw He(De)},base64Encode:()=>{throw He(De)},base64UrlEncode:()=>{throw He(De)},encodeKid:()=>{throw He(De)},async getPublicKeyThumbprint(){throw He(De)},async removeTokenBindingKey(){throw He(De)},async clearKeystore(){throw He(De)},async signJwt(){throw He(De)},async hashString(){throw He(De)}},$e="@azure/msal-common",Ge="14.16.1";function We(e,t){const n=function(e){if(!e)throw He(ee);const t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(e);if(!t||t.length<4)throw He(Z);return t[2]}(e);try{const e=t(n);return JSON.parse(e)}catch(e){throw He(Z)}}function Ve(e,t){if(0===t||Date.now()-3e5>e+t)throw He(ue)}function Qe(){return Math.round((new Date).getTime()/1e3)}function Ye(e,t){const n=Number(e)||0;return Qe()+t>n}function Je(e){return[at(e),it(e),st(e),ct(e),lt(e)].join(N).toLowerCase()}function Xe(e,t,n,r,o){return{credentialType:E.ID_TOKEN,homeAccountId:e,environment:t,clientId:r,secret:n,realm:o}}function Ze(e,t,n,r,o,a,i,s,c,l,u,d,h,p,f){const g={homeAccountId:e,credentialType:E.ACCESS_TOKEN,secret:n,cachedAt:Qe().toString(),expiresOn:i.toString(),extendedExpiresOn:s.toString(),environment:t,clientId:r,realm:o,target:a,tokenType:u||D.BEARER};if(d&&(g.userAssertionHash=d),l&&(g.refreshOn=l.toString()),p&&(g.requestedClaims=p,g.requestedClaimsHash=f),g.tokenType?.toLowerCase()!==D.BEARER.toLowerCase())switch(g.credentialType=E.ACCESS_TOKEN_WITH_AUTH_SCHEME,g.tokenType){case D.POP:const e=We(n,c);if(!e?.cnf?.kid)throw He(_e);g.keyId=e.cnf.kid;break;case D.SSH:g.keyId=h}return g}function et(e,t,n,r,o,a,i){const s={credentialType:E.REFRESH_TOKEN,homeAccountId:e,environment:t,clientId:r,secret:n};return a&&(s.userAssertionHash=a),o&&(s.familyId=o),i&&(s.expiresOn=i.toString()),s}function tt(e){return e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("credentialType")&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("secret")}function nt(e){return!!e&&tt(e)&&e.hasOwnProperty("realm")&&e.hasOwnProperty("target")&&(e.credentialType===E.ACCESS_TOKEN||e.credentialType===E.ACCESS_TOKEN_WITH_AUTH_SCHEME)}function rt(e){return!!e&&tt(e)&&e.hasOwnProperty("realm")&&e.credentialType===E.ID_TOKEN}function ot(e){return!!e&&tt(e)&&e.credentialType===E.REFRESH_TOKEN}function at(e){return[e.homeAccountId,e.environment].join(N).toLowerCase()}function it(e){const t=e.credentialType===E.REFRESH_TOKEN&&e.familyId||e.clientId;return[e.credentialType,t,e.realm||""].join(N).toLowerCase()}function st(e){return(e.target||"").toLowerCase()}function ct(e){return(e.requestedClaimsHash||"").toLowerCase()}function lt(e){return e.tokenType&&e.tokenType.toLowerCase()!==D.BEARER.toLowerCase()?e.tokenType.toLowerCase():""}function ut(){return Qe()+86400}function dt(e,t,n){e.authorization_endpoint=t.authorization_endpoint,e.token_endpoint=t.token_endpoint,e.end_session_endpoint=t.end_session_endpoint,e.issuer=t.issuer,e.endpointsFromNetwork=n,e.jwks_uri=t.jwks_uri}function ht(e,t,n){e.aliases=t.aliases,e.preferred_cache=t.preferred_cache,e.preferred_network=t.preferred_network,e.aliasesFromNetwork=n}function pt(e){return e.expiresAt<=Qe()}const ft="redirect_uri_empty",gt="claims_request_parsing_error",mt="authority_uri_insecure",vt="url_parse_error",yt="empty_url_error",bt="empty_input_scopes_error",xt="invalid_prompt_value",wt="invalid_claims",kt="token_request_empty",Ct="logout_request_empty",St="invalid_code_challenge_method",Tt="pkce_params_missing",It="invalid_cloud_discovery_metadata",jt="invalid_authority_metadata",At="untrusted_authority",Nt="missing_ssh_jwk",Et="missing_ssh_kid",_t="missing_nonce_authentication_header",Pt="invalid_authentication_header",Ot="cannot_set_OIDCOptions",Rt="cannot_allow_native_broker",Mt="authority_mismatch",zt={[ft]:"A redirect URI is required for all calls, and none has been set.",[gt]:"Could not parse the given claims request object.",[mt]:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options",[vt]:"URL could not be parsed into appropriate segments.",[yt]:"URL was empty or null.",[bt]:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",[xt]:"Please see here for valid configuration options: https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#commonauthorizationurlrequest",[wt]:"Given claims parameter must be a stringified JSON object.",[kt]:"Token request was empty and not found in cache.",[Ct]:"The logout request was null or undefined.",[St]:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',[Tt]:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",[It]:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",[jt]:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",[At]:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",[Nt]:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",[Et]:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",[_t]:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",[Pt]:"Invalid authentication header provided",[Ot]:"Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",[Rt]:"Cannot set allowNativeBroker parameter to true when not in AAD protocol mode.",[Mt]:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority."};class Lt extends Q{constructor(e){super(e,zt[e]),this.name="ClientConfigurationError",Object.setPrototypeOf(this,Lt.prototype)}}function qt(e){return new Lt(e)}class Dt{static isEmptyObj(e){if(e)try{const t=JSON.parse(e);return 0===Object.keys(t).length}catch(e){}return!0}static startsWith(e,t){return 0===e.indexOf(t)}static endsWith(e,t){return e.length>=t.length&&e.lastIndexOf(t)===e.length-t.length}static queryStringToObject(e){const t={},n=e.split("&"),r=e=>decodeURIComponent(e.replace(/\+/g," "));return n.forEach(e=>{if(e.trim()){const[n,o]=e.split(/=(.+)/g,2);n&&o&&(t[r(n)]=r(o))}}),t}static trimArrayEntries(e){return e.map(e=>e.trim())}static removeEmptyStringsFromArray(e){return e.filter(e=>!!e)}static jsonParseHelper(e){try{return JSON.parse(e)}catch(e){return null}}static matchPattern(e,t){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(t)}}class Ft{constructor(e){const t=e?Dt.trimArrayEntries([...e]):[],n=t?Dt.removeEmptyStringsFromArray(t):[];this.validateInputScopes(n),this.scopes=new Set,n.forEach(e=>this.scopes.add(e))}static fromString(e){const t=(e||a.EMPTY_STRING).split(" ");return new Ft(t)}static createSearchScopes(e){const t=new Ft(e);return t.containsOnlyOIDCScopes()?t.removeScope(a.OFFLINE_ACCESS_SCOPE):t.removeOIDCScopes(),t}validateInputScopes(e){if(!e||e.length<1)throw qt(bt)}containsScope(e){const t=this.printScopesLowerCase().split(" "),n=new Ft(t);return!!e&&n.scopes.has(e.toLowerCase())}containsScopeSet(e){return!(!e||e.scopes.size<=0)&&this.scopes.size>=e.scopes.size&&e.asArray().every(e=>this.containsScope(e))}containsOnlyOIDCScopes(){let e=0;return s.forEach(t=>{this.containsScope(t)&&(e+=1)}),this.scopes.size===e}appendScope(e){e&&this.scopes.add(e.trim())}appendScopes(e){try{e.forEach(e=>this.appendScope(e))}catch(e){throw He(me)}}removeScope(e){if(!e)throw He(ge);this.scopes.delete(e.trim())}removeOIDCScopes(){s.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw He(ve);const t=new Set;return e.scopes.forEach(e=>t.add(e.toLowerCase())),this.scopes.forEach(e=>t.add(e.toLowerCase())),t}intersectingScopeSets(e){if(!e)throw He(ve);e.containsOnlyOIDCScopes()||e.removeOIDCScopes();const t=this.unionScopeSets(e),n=e.getScopeCount(),r=this.getScopeCount();return t.size<r+n}getScopeCount(){return this.scopes.size}asArray(){const e=[];return this.scopes.forEach(t=>e.push(t)),e}printScopes(){return this.scopes?this.asArray().join(" "):a.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}function Ut(e,t){if(!e)throw He(X);try{const n=t(e);return JSON.parse(n)}catch(e){throw He(J)}}function Bt(e){if(!e)throw He(J);const t=e.split(".",2);return{uid:t[0],utid:t.length<2?a.EMPTY_STRING:t[1]}}function Ht(e,t){return!!e&&!!t&&e===t.split(".")[1]}function Kt(e,t,n,r){if(r){const{oid:t,sub:n,tid:o,name:a,tfp:i,acr:s}=r,c=o||i||s||"";return{tenantId:c,localAccountId:t||n||"",name:a,isHomeTenant:Ht(c,e)}}return{tenantId:n,localAccountId:t,isHomeTenant:Ht(n,e)}}function $t(e,t,n,r){let o=e;if(t){const{isHomeTenant:n,...r}=t;o={...e,...r}}if(n){const{isHomeTenant:t,...a}=Kt(e.homeAccountId,e.localAccountId,e.tenantId,n);return o={...o,...a,idTokenClaims:n,idToken:r},o}return o}function Gt(e){return e&&(e.tid||e.tfp||e.acr)||null}class Wt{generateAccountId(){return[this.homeAccountId,this.environment].join(N).toLowerCase()}generateAccountKey(){return Wt.generateAccountCacheKey({homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId})}getAccountInfo(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,name:this.name,nativeAccountId:this.nativeAccountId,authorityType:this.authorityType,tenantProfiles:new Map((this.tenantProfiles||[]).map(e=>[e.tenantId,e]))}}isSingleTenant(){return!this.tenantProfiles}static generateAccountCacheKey(e){const t=e.homeAccountId.split(".")[1];return[e.homeAccountId,e.environment||"",t||e.tenantId||""].join(N).toLowerCase()}static createAccount(e,t,n){const r=new Wt;let o;1===t.authorityType?r.authorityType="ADFS":t.protocolMode===H?r.authorityType="MSSTS":r.authorityType=A,e.clientInfo&&n&&(o=Ut(e.clientInfo,n)),r.clientInfo=e.clientInfo,r.homeAccountId=e.homeAccountId,r.nativeAccountId=e.nativeAccountId;const a=e.environment||t&&t.getPreferredCache();if(!a)throw He(Ce);r.environment=a,r.realm=o?.utid||Gt(e.idTokenClaims)||"",r.localAccountId=o?.uid||e.idTokenClaims?.oid||e.idTokenClaims?.sub||"";const i=e.idTokenClaims?.preferred_username||e.idTokenClaims?.upn,s=e.idTokenClaims?.emails?e.idTokenClaims.emails[0]:null;if(r.username=i||s||"",r.name=e.idTokenClaims?.name||"",r.cloudGraphHostName=e.cloudGraphHostName,r.msGraphHost=e.msGraphHost,e.tenantProfiles)r.tenantProfiles=e.tenantProfiles;else{const t=Kt(e.homeAccountId,r.localAccountId,r.realm,e.idTokenClaims);r.tenantProfiles=[t]}return r}static createFromAccountInfo(e,t,n){const r=new Wt;return r.authorityType=e.authorityType||A,r.homeAccountId=e.homeAccountId,r.localAccountId=e.localAccountId,r.nativeAccountId=e.nativeAccountId,r.realm=e.tenantId,r.environment=e.environment,r.username=e.username,r.name=e.name,r.cloudGraphHostName=t,r.msGraphHost=n,r.tenantProfiles=Array.from(e.tenantProfiles?.values()||[]),r}static generateHomeAccountId(e,t,n,r,o){if(1!==t&&2!==t){if(e)try{const t=Ut(e,r.base64Decode);if(t.uid&&t.utid)return`${t.uid}.${t.utid}`}catch(e){}n.warning("No client info in response")}return o?.sub||""}static isAccountEntity(e){return!!e&&e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType")}static accountInfoIsEqual(e,t,n){if(!e||!t)return!1;let r=!0;if(n){const n=e.idTokenClaims||{},o=t.idTokenClaims||{};r=n.iat===o.iat&&n.nonce===o.nonce}return e.homeAccountId===t.homeAccountId&&e.localAccountId===t.localAccountId&&e.username===t.username&&e.tenantId===t.tenantId&&e.environment===t.environment&&e.nativeAccountId===t.nativeAccountId&&r}}function Vt(e){return e.startsWith("#/")?e.substring(2):e.startsWith("#")||e.startsWith("?")?e.substring(1):e}function Qt(e){if(!e||e.indexOf("=")<0)return null;try{const t=Vt(e),n=Object.fromEntries(new URLSearchParams(t));if(n.code||n.error||n.error_description||n.state)return n}catch(e){throw He(oe)}return null}class Yt{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,!this._urlString)throw qt(yt);e.includes("#")||(this._urlString=Yt.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let t=e.toLowerCase();return Dt.endsWith(t,"?")?t=t.slice(0,-1):Dt.endsWith(t,"?/")&&(t=t.slice(0,-2)),Dt.endsWith(t,"/")||(t+="/"),t}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch(e){throw qt(vt)}if(!e.HostNameAndPort||!e.PathSegments)throw qt(vt);if(!e.Protocol||"https:"!==e.Protocol.toLowerCase())throw qt(mt)}static appendQueryString(e,t){return t?e.indexOf("?")<0?`${e}?${t}`:`${e}&${t}`:e}static removeHashFromUrl(e){return Yt.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const t=this.getUrlComponents(),n=t.PathSegments;return!e||0===n.length||n[0]!==x&&n[0]!==w||(n[0]=e),Yt.constructAuthorityUriFromObject(t)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),t=this.urlString.match(e);if(!t)throw qt(vt);const n={Protocol:t[1],HostNameAndPort:t[4],AbsolutePath:t[5],QueryString:t[7]};let r=n.AbsolutePath.split("/");return r=r.filter(e=>e&&e.length>0),n.PathSegments=r,n.QueryString&&n.QueryString.endsWith("/")&&(n.QueryString=n.QueryString.substring(0,n.QueryString.length-1)),n}static getDomainFromUrl(e){const t=RegExp("^([^:/?#]+://)?([^/?#]*)"),n=e.match(t);if(!n)throw qt(vt);return n[2]}static getAbsoluteUrl(e,t){if(e[0]===a.FORWARD_SLASH){const n=new Yt(t).getUrlComponents();return n.Protocol+"//"+n.HostNameAndPort+e}return e}static constructAuthorityUriFromObject(e){return new Yt(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static hashContainsKnownProperties(e){return!!Qt(e)}}const Jt={"login.microsoftonline.com":{token_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/logout"},"login.chinacloudapi.cn":{token_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.chinacloudapi.cn/{tenantid}/discovery/v2.0/keys",issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",authorization_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/logout"},"login.microsoftonline.us":{token_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.us/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/logout"}},Xt={tenant_discovery_endpoint:"https://{canonicalAuthority}/v2.0/.well-known/openid-configuration",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},Zt=new Set;function en(e,t,n,r){if(r?.trace(`getAliasesFromMetadata called with source: ${n}`),e&&t){const o=tn(t,e);if(o)return r?.trace(`getAliasesFromMetadata: found cloud discovery metadata in ${n}, returning aliases`),o.aliases;r?.trace(`getAliasesFromMetadata: did not find cloud discovery metadata in ${n}`)}return null}function tn(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(r.aliases.includes(t))return r}return null}Xt.metadata.forEach(e=>{e.aliases.forEach(e=>{Zt.add(e)})});const nn="cache_quota_exceeded",rn="cache_error_unknown",on={[nn]:"Exceeded cache storage capacity.",[rn]:"Unexpected error occurred when using cache storage."};class an extends Error{constructor(e,t){const n=t||(on[e]?on[e]:on[rn]);super(`${e}: ${n}`),Object.setPrototypeOf(this,an.prototype),this.name="CacheError",this.errorCode=e,this.errorMessage=n}}function sn(e){return e instanceof Error?"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name||e.message.includes("exceeded the quota")?new an(nn):new an(e.name,e.message):new an(rn)}class cn{constructor(e,t,n,r){this.clientId=e,this.cryptoImpl=t,this.commonLogger=n.clone($e,Ge),this.staticAuthorityOptions=r}getAllAccounts(e,t){return this.buildTenantProfiles(this.getAccountsFilteredBy(t||{},e),e,t)}getAccountInfoFilteredBy(e,t){const n=this.getAllAccounts(t,e);return n.length>1?n.sort(e=>e.idTokenClaims?-1:1)[0]:1===n.length?n[0]:null}getBaseAccountInfo(e,t){const n=this.getAccountsFilteredBy(e,t);return n.length>0?n[0].getAccountInfo():null}buildTenantProfiles(e,t,n){return e.flatMap(e=>this.getTenantProfilesFromAccountEntity(e,t,n?.tenantId,n))}getTenantedAccountInfoByFilter(e,t,n,r,o){let a,i=null;if(o&&!this.tenantProfileMatchesFilter(n,o))return null;const s=this.getIdToken(e,r,t,n.tenantId);return s&&(a=We(s.secret,this.cryptoImpl.base64Decode),!this.idTokenClaimsMatchTenantProfileFilter(a,o))?null:(i=$t(e,n,a,s?.secret),i)}getTenantProfilesFromAccountEntity(e,t,n,r){const o=e.getAccountInfo();let a=o.tenantProfiles||new Map;const i=this.getTokenKeys();if(n){const e=a.get(n);if(!e)return[];a=new Map([[n,e]])}const s=[];return a.forEach(e=>{const n=this.getTenantedAccountInfoByFilter(o,i,e,t,r);n&&s.push(n)}),s}tenantProfileMatchesFilter(e,t){return!(t.localAccountId&&!this.matchLocalAccountIdFromTenantProfile(e,t.localAccountId)||t.name&&e.name!==t.name||void 0!==t.isHomeTenant&&e.isHomeTenant!==t.isHomeTenant)}idTokenClaimsMatchTenantProfileFilter(e,t){if(t){if(t.localAccountId&&!this.matchLocalAccountIdFromTokenClaims(e,t.localAccountId))return!1;if(t.loginHint&&!this.matchLoginHintFromTokenClaims(e,t.loginHint))return!1;if(t.username&&!this.matchUsername(e.preferred_username,t.username))return!1;if(t.name&&!this.matchName(e,t.name))return!1;if(t.sid&&!this.matchSid(e,t.sid))return!1}return!0}async saveCacheRecord(e,t,n){if(!e)throw He(ke);try{e.account&&this.setAccount(e.account,t),e.idToken&&!1!==n?.idToken&&this.setIdTokenCredential(e.idToken,t),e.accessToken&&!1!==n?.accessToken&&await this.saveAccessToken(e.accessToken,t),e.refreshToken&&!1!==n?.refreshToken&&this.setRefreshTokenCredential(e.refreshToken,t),e.appMetadata&&this.setAppMetadata(e.appMetadata,t)}catch(e){throw this.commonLogger?.error("CacheManager.saveCacheRecord: failed"),e instanceof Q?e:sn(e)}}async saveAccessToken(e,t){const n={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType,requestedClaimsHash:e.requestedClaimsHash},r=this.getTokenKeys(),o=Ft.fromString(e.target);r.accessToken.forEach(e=>{if(!this.accessTokenKeyMatchesFilter(e,n,!1))return;const r=this.getAccessTokenCredential(e,t);r&&this.credentialMatchesFilter(r,n)&&Ft.fromString(r.target).intersectingScopeSets(o)&&this.removeAccessToken(e,t)}),this.setAccessTokenCredential(e,t)}getAccountsFilteredBy(e,t){const n=this.getAccountKeys(),r=[];return n.forEach(n=>{if(!this.isAccountKey(n,e.homeAccountId))return;const o=this.getAccount(n,t,this.commonLogger);if(!o)return;if(e.homeAccountId&&!this.matchHomeAccountId(o,e.homeAccountId))return;if(e.username&&!this.matchUsername(o.username,e.username))return;if(e.environment&&!this.matchEnvironment(o,e.environment))return;if(e.realm&&!this.matchRealm(o,e.realm))return;if(e.nativeAccountId&&!this.matchNativeAccountId(o,e.nativeAccountId))return;if(e.authorityType&&!this.matchAuthorityType(o,e.authorityType))return;const a={localAccountId:e?.localAccountId,name:e?.name},i=o.tenantProfiles?.filter(e=>this.tenantProfileMatchesFilter(e,a));i&&0===i.length||r.push(o)}),r}isAccountKey(e,t,n){return!(e.split(N).length<3||t&&!e.toLowerCase().includes(t.toLowerCase())||n&&!e.toLowerCase().includes(n.toLowerCase()))}isCredentialKey(e){if(e.split(N).length<6)return!1;const t=e.toLowerCase();if(-1===t.indexOf(E.ID_TOKEN.toLowerCase())&&-1===t.indexOf(E.ACCESS_TOKEN.toLowerCase())&&-1===t.indexOf(E.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())&&-1===t.indexOf(E.REFRESH_TOKEN.toLowerCase()))return!1;if(t.indexOf(E.REFRESH_TOKEN.toLowerCase())>-1){const e=`${E.REFRESH_TOKEN}${N}${this.clientId}${N}`,n=`${E.REFRESH_TOKEN}${N}${P}${N}`;if(-1===t.indexOf(e.toLowerCase())&&-1===t.indexOf(n.toLowerCase()))return!1}else if(-1===t.indexOf(this.clientId.toLowerCase()))return!1;return!0}credentialMatchesFilter(e,t){if(t.clientId&&!this.matchClientId(e,t.clientId))return!1;if(t.userAssertionHash&&!this.matchUserAssertionHash(e,t.userAssertionHash))return!1;if("string"==typeof t.homeAccountId&&!this.matchHomeAccountId(e,t.homeAccountId))return!1;if(t.environment&&!this.matchEnvironment(e,t.environment))return!1;if(t.realm&&!this.matchRealm(e,t.realm))return!1;if(t.credentialType&&!this.matchCredentialType(e,t.credentialType))return!1;if(t.familyId&&!this.matchFamilyId(e,t.familyId))return!1;if(t.target&&!this.matchTarget(e,t.target))return!1;if((t.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==t.requestedClaimsHash)return!1;if(e.credentialType===E.ACCESS_TOKEN_WITH_AUTH_SCHEME){if(t.tokenType&&!this.matchTokenType(e,t.tokenType))return!1;if(t.tokenType===D.SSH&&t.keyId&&!this.matchKeyId(e,t.keyId))return!1}return!0}getAppMetadataFilteredBy(e){const t=this.getKeys(),n={};return t.forEach(t=>{if(!this.isAppMetadata(t))return;const r=this.getAppMetadata(t);r&&(e.environment&&!this.matchEnvironment(r,e.environment)||e.clientId&&!this.matchClientId(r,e.clientId)||(n[t]=r))}),n}getAuthorityMetadataByAlias(e){const t=this.getAuthorityMetadataKeys();let n=null;return t.forEach(t=>{if(!this.isAuthorityMetadata(t)||-1===t.indexOf(this.clientId))return;const r=this.getAuthorityMetadata(t);r&&-1!==r.aliases.indexOf(e)&&(n=r)}),n}async removeAllAccounts(e){const t=this.getAccountKeys(),n=[];t.forEach(t=>{n.push(this.removeAccount(t,e))}),await Promise.all(n)}async removeAccount(e,t){const n=this.getAccount(e,t,this.commonLogger);n&&(await this.removeAccountContext(n,t),this.removeItem(e,t))}async removeAccountContext(e,t){const n=this.getTokenKeys(),r=e.generateAccountId();n.idToken.forEach(e=>{0===e.indexOf(r)&&this.removeIdToken(e,t)}),n.accessToken.forEach(e=>{0===e.indexOf(r)&&this.removeAccessToken(e,t)}),n.refreshToken.forEach(e=>{0===e.indexOf(r)&&this.removeRefreshToken(e,t)}),this.getKeys().forEach(e=>{e.includes(r)&&this.removeItem(e,t)})}updateOutdatedCachedAccount(e,t,n,r){if(t&&t.isSingleTenant()){this.commonLogger?.verbose("updateOutdatedCachedAccount: Found a single-tenant (outdated) account entity in the cache, migrating to multi-tenant account entity");const o=this.getAccountKeys().filter(e=>e.startsWith(t.homeAccountId)),a=[];o.forEach(e=>{const t=this.getCachedAccountEntity(e,n);t&&a.push(t)});const i=a.find(e=>Ht(e.realm,e.homeAccountId))||a[0];i.tenantProfiles=a.map(e=>({tenantId:e.realm,localAccountId:e.localAccountId,name:e.name,isHomeTenant:Ht(e.realm,e.homeAccountId)}));const s=cn.toObject(new Wt,{...i}),c=s.generateAccountKey();return o.forEach(t=>{t!==c&&this.removeOutdatedAccount(e,n)}),this.setAccount(s,n),r?.verbose("Updated an outdated account entity in the cache"),s}return t}removeAccessToken(e,t){const n=this.getAccessTokenCredential(e,t);if(this.removeItem(e,t),!n||n.credentialType.toLowerCase()!==E.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()||n.tokenType!==D.POP)return;const r=n.keyId;r&&this.cryptoImpl.removeTokenBindingKey(r).catch(()=>{this.commonLogger.error("Binding key could not be removed")})}removeAppMetadata(e){return this.getKeys().forEach(t=>{this.isAppMetadata(t)&&this.removeItem(t,e)}),!0}readAccountFromCache(e,t){const n=Wt.generateAccountCacheKey(e);return this.getAccount(n,t,this.commonLogger)}getIdToken(e,t,n,r,o){this.commonLogger.trace("CacheManager - getIdToken called");const a={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:E.ID_TOKEN,clientId:this.clientId,realm:r},i=this.getIdTokensByFilter(a,t,n),s=i.size;if(s<1)return this.commonLogger.info("CacheManager:getIdToken - No token found"),null;if(s>1){let n=i;if(!r){const t=new Map;i.forEach((n,r)=>{n.realm===e.tenantId&&t.set(r,n)});const r=t.size;if(r<1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result"),i.values().next().value;if(1===r)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile"),t.values().next().value;n=t}return this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them"),n.forEach((e,n)=>{this.removeIdToken(n,t)}),o&&t&&o.addFields({multiMatchedID:i.size},t),null}return this.commonLogger.info("CacheManager:getIdToken - Returning ID token"),i.values().next().value}getIdTokensByFilter(e,t,n){const r=n&&n.idToken||this.getTokenKeys().idToken,o=new Map;return r.forEach(n=>{if(!this.idTokenKeyMatchesFilter(n,{clientId:this.clientId,...e}))return;const r=this.getIdTokenCredential(n,t);r&&this.credentialMatchesFilter(r,e)&&o.set(n,r)}),o}idTokenKeyMatchesFilter(e,t){const n=e.toLowerCase();return!(t.clientId&&-1===n.indexOf(t.clientId.toLowerCase())||t.homeAccountId&&-1===n.indexOf(t.homeAccountId.toLowerCase()))}removeIdToken(e,t){this.removeItem(e,t)}removeRefreshToken(e,t){this.removeItem(e,t)}getAccessToken(e,t,n,r,o){this.commonLogger.trace("CacheManager - getAccessToken called");const a=Ft.createSearchScopes(t.scopes),i=t.authenticationScheme||D.BEARER,s=i&&i.toLowerCase()!==D.BEARER.toLowerCase()?E.ACCESS_TOKEN_WITH_AUTH_SCHEME:E.ACCESS_TOKEN,c={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:s,clientId:this.clientId,realm:r||e.tenantId,target:a,tokenType:i,keyId:t.sshKid,requestedClaimsHash:t.requestedClaimsHash},l=n&&n.accessToken||this.getTokenKeys().accessToken,u=[];l.forEach(e=>{if(this.accessTokenKeyMatchesFilter(e,c,!0)){const n=this.getAccessTokenCredential(e,t.correlationId);n&&this.credentialMatchesFilter(n,c)&&u.push(n)}});const d=u.length;return d<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found"),null):d>1?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them"),u.forEach(e=>{this.removeAccessToken(Je(e),t.correlationId)}),o&&t.correlationId&&o.addFields({multiMatchedAT:u.length},t.correlationId),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token"),u[0])}accessTokenKeyMatchesFilter(e,t,n){const r=e.toLowerCase();if(t.clientId&&-1===r.indexOf(t.clientId.toLowerCase()))return!1;if(t.homeAccountId&&-1===r.indexOf(t.homeAccountId.toLowerCase()))return!1;if(t.realm&&-1===r.indexOf(t.realm.toLowerCase()))return!1;if(t.requestedClaimsHash&&-1===r.indexOf(t.requestedClaimsHash.toLowerCase()))return!1;if(t.target){const e=t.target.asArray();for(let t=0;t<e.length;t++){if(n&&!r.includes(e[t].toLowerCase()))return!1;if(!n&&r.includes(e[t].toLowerCase()))return!0}}return!0}getAccessTokensByFilter(e,t){const n=this.getTokenKeys(),r=[];return n.accessToken.forEach(n=>{if(!this.accessTokenKeyMatchesFilter(n,e,!0))return;const o=this.getAccessTokenCredential(n,t);o&&this.credentialMatchesFilter(o,e)&&r.push(o)}),r}getRefreshToken(e,t,n,r,o){this.commonLogger.trace("CacheManager - getRefreshToken called");const a=t?P:void 0,i={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:E.REFRESH_TOKEN,clientId:this.clientId,familyId:a},s=r&&r.refreshToken||this.getTokenKeys().refreshToken,c=[];s.forEach(e=>{if(this.refreshTokenKeyMatchesFilter(e,i)){const t=this.getRefreshTokenCredential(e,n);t&&this.credentialMatchesFilter(t,i)&&c.push(t)}});const l=c.length;return l<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(l>1&&o&&n&&o.addFields({multiMatchedRT:l},n),this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),c[0])}refreshTokenKeyMatchesFilter(e,t){const n=e.toLowerCase();return!(t.familyId&&-1===n.indexOf(t.familyId.toLowerCase())||!t.familyId&&t.clientId&&-1===n.indexOf(t.clientId.toLowerCase())||t.homeAccountId&&-1===n.indexOf(t.homeAccountId.toLowerCase()))}readAppMetadataFromCache(e){const t={environment:e,clientId:this.clientId},n=this.getAppMetadataFilteredBy(t),r=Object.keys(n).map(e=>n[e]),o=r.length;if(o<1)return null;if(o>1)throw He(pe);return r[0]}isAppMetadataFOCI(e){const t=this.readAppMetadataFromCache(e);return!(!t||t.familyId!==P)}matchHomeAccountId(e,t){return!("string"!=typeof e.homeAccountId||t!==e.homeAccountId)}matchLocalAccountIdFromTokenClaims(e,t){return t===(e.oid||e.sub)}matchLocalAccountIdFromTenantProfile(e,t){return e.localAccountId===t}matchName(e,t){return!(t.toLowerCase()!==e.name?.toLowerCase())}matchUsername(e,t){return!(!e||"string"!=typeof e||t?.toLowerCase()!==e.toLowerCase())}matchUserAssertionHash(e,t){return!(!e.userAssertionHash||t!==e.userAssertionHash)}matchEnvironment(e,t){if(this.staticAuthorityOptions){const n=function(e,t){let n;const r=e.canonicalAuthority;if(r){const o=new Yt(r).getUrlComponents().HostNameAndPort;n=en(o,e.cloudDiscoveryMetadata?.metadata,R,t)||en(o,Xt.metadata,L,t)||e.knownAuthorities}return n||[]}(this.staticAuthorityOptions,this.commonLogger);if(n.includes(t)&&n.includes(e.environment))return!0}const n=this.getAuthorityMetadataByAlias(t);return!!(n&&n.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,t){return e.credentialType&&t.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,t){return!(!e.clientId||t!==e.clientId)}matchFamilyId(e,t){return!(!e.familyId||t!==e.familyId)}matchRealm(e,t){return!(e.realm?.toLowerCase()!==t.toLowerCase())}matchNativeAccountId(e,t){return!(!e.nativeAccountId||t!==e.nativeAccountId)}matchLoginHintFromTokenClaims(e,t){return e.login_hint===t||e.preferred_username===t||e.upn===t}matchSid(e,t){return e.sid===t}matchAuthorityType(e,t){return!(!e.authorityType||t.toLowerCase()!==e.authorityType.toLowerCase())}matchTarget(e,t){return!(e.credentialType!==E.ACCESS_TOKEN&&e.credentialType!==E.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target)&&Ft.fromString(e.target).containsScopeSet(t)}matchTokenType(e,t){return!(!e.tokenType||e.tokenType!==t)}matchKeyId(e,t){return!(!e.keyId||e.keyId!==t)}isAppMetadata(e){return-1!==e.indexOf(_)}isAuthorityMetadata(e){return-1!==e.indexOf(O)}generateAuthorityMetadataCacheKey(e){return`${O}-${this.clientId}-${e}`}static toObject(e,t){for(const n in t)e[n]=t[n];return e}}class ln extends cn{setAccount(){throw He(De)}getAccount(){throw He(De)}getCachedAccountEntity(){throw He(De)}setIdTokenCredential(){throw He(De)}getIdTokenCredential(){throw He(De)}setAccessTokenCredential(){throw He(De)}getAccessTokenCredential(){throw He(De)}setRefreshTokenCredential(){throw He(De)}getRefreshTokenCredential(){throw He(De)}setAppMetadata(){throw He(De)}getAppMetadata(){throw He(De)}setServerTelemetry(){throw He(De)}getServerTelemetry(){throw He(De)}setAuthorityMetadata(){throw He(De)}getAuthorityMetadata(){throw He(De)}getAuthorityMetadataKeys(){throw He(De)}setThrottlingCache(){throw He(De)}getThrottlingCache(){throw He(De)}removeItem(){throw He(De)}getKeys(){throw He(De)}getAccountKeys(){throw He(De)}getTokenKeys(){throw He(De)}updateCredentialCacheKey(){throw He(De)}removeOutdatedAccount(){throw He(De)}}const un={tokenRenewalOffsetSeconds:300,preventCorsPreflight:!1},dn={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:U.Info,correlationId:a.EMPTY_STRING},hn={claimsBasedCachingEnabled:!1},pn={async sendGetRequestAsync(){throw He(De)},async sendPostRequestAsync(){throw He(De)}},fn={sku:a.SKU,version:Ge,cpu:a.EMPTY_STRING,os:a.EMPTY_STRING},gn={clientSecret:a.EMPTY_STRING,clientAssertion:void 0},mn={azureCloudInstance:$,tenant:`${a.DEFAULT_COMMON_TENANT}`},vn={application:{appName:"",appVersion:""}};function yn(e){return e.authOptions.authority.options.protocolMode===K}const bn={sendGetRequestAsync:()=>Promise.reject(He(De)),sendPostRequestAsync:()=>Promise.reject(He(De))},xn="acquireTokenByCode",wn="acquireTokenByRefreshToken",kn="acquireTokenSilent",Cn="acquireTokenSilentAsync",Sn="acquireTokenPopup",Tn="acquireTokenRedirect",In="cryptoOptsGetPublicKeyThumbprint",jn="cryptoOptsSignJwt",An="silentCacheClientAcquireToken",Nn="silentIframeClientAcquireToken",En="silentRefreshClientAcquireToken",_n="ssoSilent",Pn="standardInteractionClientGetDiscoveredAuthority",On="fetchAccountIdWithNativeBroker",Rn="nativeInteractionClientAcquireToken",Mn="networkClientSendPostRequestAsync",zn="refreshTokenClientExecutePostToTokenEndpoint",Ln="authorizationCodeClientExecutePostToTokenEndpoint",qn="refreshTokenClientExecuteTokenRequest",Dn="refreshTokenClientAcquireToken",Fn="refreshTokenClientAcquireTokenWithCachedRefreshToken",Un="refreshTokenClientAcquireTokenByRefreshToken",Bn="refreshTokenClientCreateTokenRequestBody",Hn="acquireTokenFromCache",Kn="silentFlowClientAcquireCachedToken",$n="silentFlowClientGenerateResultFromCacheRecord",Gn="acquireTokenBySilentIframe",Wn="initializeBaseRequest",Vn="initializeSilentRequest",Qn="initializeClientApplication",Yn="silentIframeClientTokenHelper",Jn="silentHandlerInitiateAuthRequest",Xn="silentHandlerMonitorIframeForHash",Zn="silentHandlerLoadFrame",er="silentHandlerLoadFrameSync",tr="standardInteractionClientCreateAuthCodeClient",nr="standardInteractionClientGetClientConfiguration",rr="standardInteractionClientInitializeAuthorizationRequest",or="standardInteractionClientInitializeAuthorizationCodeRequest",ar="getAuthCodeUrl",ir="handleCodeResponseFromServer",sr="handleCodeResponse",cr="updateTokenEndpointAuthority",lr="authClientAcquireToken",ur="authClientExecuteTokenRequest",dr="authClientCreateTokenRequestBody",hr="authClientCreateQueryString",pr="popTokenGenerateCnf",fr="popTokenGenerateKid",gr="handleServerTokenResponse",mr="deserializeResponse",vr="authorityFactoryCreateDiscoveredInstance",yr="authorityResolveEndpointsAsync",br="authorityGetCloudDiscoveryMetadataFromNetwork",xr="authorityUpdateCloudDiscoveryMetadata",wr="authorityGetEndpointMetadataFromNetwork",kr="authorityUpdateEndpointMetadata",Cr="authorityUpdateMetadataWithRegionalInformation",Sr="regionDiscoveryDetectRegion",Tr="regionDiscoveryGetRegionFromIMDS",Ir="regionDiscoveryGetCurrentVersion",jr="acquireTokenByCodeAsync",Ar="handleRedirectPromise",Nr="handleNativeRedirectPromise",Er="nativeMessageHandlerHandshake",_r="removeHiddenIframe",Pr="clearTokensAndKeysWithClaims",Or="cacheManagerGetRefreshToken",Rr="generatePkceCodes",Mr="generateCodeVerifier",zr="generateCodeChallengeFromVerifier",Lr="sha256Digest",qr="getRandomValues",Dr=(new Map([[xn,"ATByCode"],[wn,"ATByRT"],[kn,"ATS"],[Cn,"ATSAsync"],[Sn,"ATPopup"],[Tn,"ATRedirect"],[In,"CryptoGetPKThumb"],[jn,"CryptoSignJwt"],[An,"SltCacheClientAT"],[Nn,"SltIframeClientAT"],[En,"SltRClientAT"],[_n,"SsoSlt"],[Pn,"StdIntClientGetDiscAuth"],[On,"FetchAccIdWithNtvBroker"],[Rn,"NtvIntClientAT"],["baseClientCreateTokenRequestHeaders","BaseClientCreateTReqHead"],[Mn,"NetClientSendPost"],[zn,"RTClientExecPost"],[Ln,"AuthCodeClientExecPost"],["brokerHandshake","BrokerHandshake"],["acquireTokenByRefreshTokenInBroker","ATByRTInBroker"],["acquireTokenByBroker","ATByBroker"],[qn,"RTClientExecTReq"],[Dn,"RTClientAT"],[Fn,"RTClientATWithCachedRT"],[Un,"RTClientATByRT"],[Bn,"RTClientCreateTReqBody"],[Hn,"ATFromCache"],[Kn,"SltFlowClientATCached"],[$n,"SltFlowClientGenResFromCache"],[Gn,"ATBySltIframe"],[Wn,"InitBaseReq"],[Vn,"InitSltReq"],[Qn,"InitClientApplication"],[Yn,"SIClientTHelper"],[Jn,"SHandlerInitAuthReq"],[Xn,"SltHandlerMonitorIframeForHash"],[Zn,"SHandlerLoadFrame"],[er,"SHandlerLoadFrameSync"],[tr,"StdIntClientCreateAuthCodeClient"],[nr,"StdIntClientGetClientConf"],[rr,"StdIntClientInitAuthReq"],[or,"StdIntClientInitAuthCodeReq"],[ar,"GetAuthCodeUrl"],[ir,"HandleCodeResFromServer"],[sr,"HandleCodeResp"],[cr,"UpdTEndpointAuth"],[lr,"AuthClientAT"],[ur,"AuthClientExecTReq"],[dr,"AuthClientCreateTReqBody"],[hr,"AuthClientCreateQueryStr"],[pr,"PopTGenCnf"],[fr,"PopTGenKid"],[gr,"HandleServerTRes"],[mr,"DeserializeRes"],[vr,"AuthFactCreateDiscInst"],[yr,"AuthResolveEndpointsAsync"],["authorityResolveEndpointsFromLocalSources","AuthResolveEndpointsFromLocal"],[br,"AuthGetCDMetaFromNet"],[xr,"AuthUpdCDMeta"],[wr,"AuthUpdCDMetaFromNet"],[kr,"AuthUpdEndpointMeta"],[Cr,"AuthUpdMetaWithRegInfo"],[Sr,"RegDiscDetectReg"],[Tr,"RegDiscGetRegFromIMDS"],[Ir,"RegDiscGetCurrentVer"],[jr,"ATByCodeAsync"],["getEndpointMetadataFromNetwork","GetEndpointMetaFromNet"],["getCloudDiscoveryMetadataFromNetworkMeasurement","GetCDMetaFromNet"],[Ar,"HandleRedirectPromise"],[Nr,"HandleNtvRedirectPromise"],["updateCloudDiscoveryMetadataMeasurement","UpdateCDMeta"],["usernamePasswordClientAcquireToken","UserPassClientAT"],[Er,"NtvMsgHandlerHandshake"],["nativeGenerateAuthResult","NtvGenAuthRes"],[_r,"RemoveHiddenIframe"],[Pr,"ClearTAndKeysWithClaims"],[Or,"CacheManagerGetRT"],[Rr,"GenPkceCodes"],[Mr,"GenCodeVerifier"],[zr,"GenCodeChallengeFromVerifier"],[Lr,"Sha256Digest"],[qr,"GetRandomValues"]]),1);new Set(["accessTokenSize","durationMs","idTokenSize","matsSilentStatus","matsHttpStatus","refreshTokenSize","queuedTimeMs","startTimeMs","status","multiMatchedAT","multiMatchedID","multiMatchedRT"]);class Fr{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class Ur{generateId(){return"callback-id"}startMeasurement(e,t){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:Dr,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:t||""},measurement:new Fr}}startPerformanceMeasurement(){return new Fr}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}const Br="invalid_grant",Hr="msal",Kr="msal.js.browser",$r="53ee284d-920a-4b59-9d30-a60315b26836",Gr="ppnbnpeolgkicgegkbkbjmhlideopiji",Wr="Handshake",Vr="GetToken",Qr="localStorage",Yr="sessionStorage",Jr="memoryStorage",Xr="request.state",Zr="request.origin",eo="urlHash",to="request.params",no="interaction.status",ro="ccs.credential",oo="request.correlationId",ao="request.native",io="msal.account.keys",so="msal.token.keys",co="msal.version",lo="wrapper.sku",uo="wrapper.version",ho=861,po=862;var fo,go;(go=fo||(fo={})).Redirect="redirect",go.Popup="popup",go.Silent="silent",go.None="none";const mo="startup",vo="login",yo="logout",bo="acquireToken",xo="ssoSilent",wo="handleRedirect",ko="none",Co={scopes:i},So="msal.db",To=`${So}.keys`,Io=[0,5,4];class jo{navigateInternal(e,t){return jo.defaultNavigateWindow(e,t)}navigateExternal(e,t){return jo.defaultNavigateWindow(e,t)}static defaultNavigateWindow(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise(e=>{setTimeout(()=>{e(!0)},t.timeout)})}}class Ao extends Q{constructor(e,t,n){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,Ao.prototype),this.name="NetworkError",this.error=e,this.httpStatus=t,this.responseHeaders=n}}function No(e,t,n){return new Ao(e,t,n)}const Eo="pkce_not_created",_o="crypto_nonexistent",Po="empty_navigate_uri",Oo="hash_empty_error",Ro="no_state_in_hash",Mo="hash_does_not_contain_known_properties",zo="unable_to_parse_state",Lo="state_interaction_type_mismatch",qo="interaction_in_progress",Do="popup_window_error",Fo="empty_window_error",Uo="user_cancelled",Bo="monitor_popup_timeout",Ho="monitor_window_timeout",Ko="redirect_in_iframe",$o="block_iframe_reload",Go="block_nested_popups",Wo="iframe_closed_prematurely",Vo="silent_logout_unsupported",Qo="no_account_error",Yo="silent_prompt_value_error",Jo="no_token_request_cache_error",Xo="unable_to_parse_token_request_cache_error",Zo="no_cached_authority_error",ea="auth_request_not_set_error",ta="invalid_cache_type",na="non_browser_environment",ra="database_not_open",oa="no_network_connectivity",aa="post_request_failed",ia="get_request_failed",sa="failed_to_parse_response",ca="unable_to_load_token",la="crypto_key_not_found",ua="auth_code_required",da="auth_code_or_nativeAccountId_required",ha="spa_code_and_nativeAccountId_present",pa="database_unavailable",fa="unable_to_acquire_token_from_native_platform",ga="native_handshake_timeout",ma="native_extension_not_installed",va="native_connection_not_established",ya="uninitialized_public_client_application",ba="native_prompt_not_supported",xa="invalid_base64_string",wa="invalid_pop_token_request",ka="failed_to_build_headers",Ca="failed_to_parse_headers",Sa="For more visit: aka.ms/msaljs/browser-errors",Ta={[Eo]:"The PKCE code challenge and verifier could not be generated.",[_o]:"The crypto object or function is not available.",[Po]:"Navigation URI is empty. Please check stack trace for more info.",[Oo]:`Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. ${Sa}`,[Ro]:"Hash does not contain state. Please verify that the request originated from msal.",[Mo]:`Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. ${Sa}`,[zo]:"Unable to parse state. Please verify that the request originated from msal.",[Lo]:"Hash contains state but the interaction type does not match the caller.",[qo]:`Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. ${Sa}`,[Do]:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.",[Fo]:"window.open returned null or undefined window object.",[Uo]:"User cancelled the flow.",[Bo]:`Token acquisition in popup failed due to timeout. ${Sa}`,[Ho]:`Token acquisition in iframe failed due to timeout. ${Sa}`,[Ko]:"Redirects are not supported for iframed or brokered applications. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs.",[$o]:`Request was blocked inside an iframe because MSAL detected an authentication response. ${Sa}`,[Go]:"Request was blocked inside a popup because MSAL detected it was running in a popup.",[Wo]:"The iframe being monitored was closed prematurely.",[Vo]:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead.",[Qo]:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.",[Yo]:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'.",[Jo]:"No token request found in cache.",[Xo]:"The cached token request could not be parsed.",[Zo]:"No cached authority found.",[ea]:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler",[ta]:"Invalid cache type",[na]:"Login and token requests are not supported in non-browser environments.",[ra]:"Database is not open!",[oa]:"No network connectivity. Check your internet connection.",[aa]:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'",[ia]:"Network request failed. Please check the network trace to determine root cause.",[sa]:"Failed to parse network response. Check network trace.",[ca]:"Error loading token to cache.",[la]:"Cryptographic Key or Keypair not found in browser storage.",[ua]:"An authorization code must be provided (as the `code` property on the request) to this flow.",[da]:"An authorization code or nativeAccountId must be provided to this flow.",[ha]:"Request cannot contain both spa code and native account id.",[pa]:"IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts.",[fa]:`Unable to acquire token from native platform. ${Sa}`,[ga]:"Timed out while attempting to establish connection to browser extension",[ma]:"Native extension is not installed. If you think this is a mistake call the initialize function.",[va]:`Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). ${Sa}`,[ya]:`You must call and await the initialize function before attempting to call any other MSAL API. ${Sa}`,[ba]:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",[xa]:"Invalid base64 encoded string.",[wa]:"Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",[ka]:"Failed to build request headers object.",[Ca]:"Failed to parse response headers"};class Ia extends Q{constructor(e,t){super(e,Ta[e],t),Object.setPrototypeOf(this,Ia.prototype),this.name="BrowserAuthError"}}function ja(e,t){return new Ia(e,t)}class Aa{async sendGetRequestAsync(e,t){let n,r={},o=0;const a=Na(t);try{n=await fetch(e,{method:"GET",headers:a})}catch(e){throw ja(window.navigator.onLine?ia:oa)}r=Ea(n.headers);try{return o=n.status,{headers:r,body:await n.json(),status:o}}catch(e){throw No(ja(sa),o,r)}}async sendPostRequestAsync(e,t){const n=t&&t.body||"",r=Na(t);let o,a=0,i={};try{o=await fetch(e,{method:"POST",headers:r,body:n})}catch(e){throw ja(window.navigator.onLine?aa:oa)}i=Ea(o.headers);try{return a=o.status,{headers:i,body:await o.json(),status:a}}catch(e){throw No(ja(sa),a,i)}}}function Na(e){try{const t=new Headers;if(!e||!e.headers)return t;const n=e.headers;return Object.entries(n).forEach(([e,n])=>{t.append(e,n)}),t}catch(e){throw ja(ka)}}function Ea(e){try{const t={};return e.forEach((e,n)=>{t[n]=e}),t}catch(e){throw ja(Ca)}}function _a(e){return encodeURIComponent(Oa(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"))}function Pa(e){return Ra(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Oa(e){return Ra((new TextEncoder).encode(e))}function Ra(e){const t=Array.from(e,e=>String.fromCodePoint(e)).join("");return btoa(t)}const Ma="SHA-256",za=new Uint8Array([1,0,1]),La="0123456789abcdef",qa=new Uint32Array(1),Da={name:"RSASSA-PKCS1-v1_5",hash:Ma,modulusLength:2048,publicExponent:za};async function Fa(e,t,n){t?.addQueueMeasurement(Lr,n);const r=(new TextEncoder).encode(e);return window.crypto.subtle.digest(Ma,r)}function Ua(e){return window.crypto.getRandomValues(e)}function Ba(){return window.crypto.getRandomValues(qa),qa[0]}function Ha(){const e=Date.now(),t=1024*Ba()+(1023&Ba()),n=new Uint8Array(16),r=Math.trunc(t/2**30),o=t&2**30-1,a=Ba();n[0]=e/2**40,n[1]=e/2**32,n[2]=e/2**24,n[3]=e/65536,n[4]=e/256,n[5]=e,n[6]=112|r>>>8,n[7]=r,n[8]=128|o>>>24,n[9]=o>>>16,n[10]=o>>>8,n[11]=o,n[12]=a>>>24,n[13]=a>>>16,n[14]=a>>>8,n[15]=a;let i="";for(let e=0;e<n.length;e++)i+=La.charAt(n[e]>>>4),i+=La.charAt(15&n[e]),3!==e&&5!==e&&7!==e&&9!==e||(i+="-");return i}async function Ka(e){return window.crypto.subtle.exportKey("jwk",e)}async function $a(e){const t=await Fa(e);return Pa(new Uint8Array(t))}const Ga="storage_not_supported",Wa="stubbed_public_client_application_called",Va="in_mem_redirect_unavailable",Qa={[Ga]:"Given storage configuration option was not supported.",[Wa]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[Va]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};class Ya extends Q{constructor(e,t){super(e,t),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,Ya.prototype)}}function Ja(e){return new Ya(e,Qa[e])}function Xa(){return window.parent!==window}function Za(){return"undefined"!=typeof window&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function ei(){if("undefined"==typeof window)throw ja(na)}function ti(e){if(!e)throw ja(ya)}function ni(e){ei(),function(){if(Yt.hashContainsKnownProperties(window.location.hash)&&Xa())throw ja($o)}(),function(){if("undefined"!=typeof window&&window.opener&&window.opener!==window&&"string"==typeof window.name&&0===window.name.indexOf(`${Hr}.`))throw ja(Go)}(),ti(e)}function ri(e,t){if(ni(e),function(e){if(Xa()&&!e)throw ja(Ko)}(t.system.allowRedirectInIframe),t.cache.cacheLocation===Jr&&!t.cache.storeAuthStateInCookie)throw Ja(Va)}function oi(e){const t=document.createElement("link");t.rel="preconnect",t.href=new URL(e).origin,t.crossOrigin="anonymous",document.head.appendChild(t),window.setTimeout(()=>{try{document.head.removeChild(t)}catch{}},1e4)}const ai="3.30.0";class ii{static loggerCallback(e,t){switch(e){case U.Error:return void console.error(t);case U.Info:return void console.info(t);case U.Verbose:return void console.debug(t);case U.Warning:return void console.warn(t);default:return void console.log(t)}}constructor(e){let t;this.browserEnvironment="undefined"!=typeof window,this.config=function({auth:e,cache:t,system:n,telemetry:r},o){const i={clientId:a.EMPTY_STRING,authority:`${a.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:a.EMPTY_STRING,authorityMetadata:a.EMPTY_STRING,redirectUri:"undefined"!=typeof window?Za():"",postLogoutRedirectUri:a.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:H,OIDCOptions:{serverResponseType:I.FRAGMENT,defaultScopes:[a.OPENID_SCOPE,a.PROFILE_SCOPE,a.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:$,tenant:a.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1},s={cacheLocation:Yr,temporaryCacheLocation:Yr,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!(!t||t.cacheLocation!==Qr),claimsBasedCachingEnabled:!1},c={loggerCallback:()=>{},logLevel:U.Info,piiLoggingEnabled:!1},l={...{...un,loggerOptions:c,networkClient:o?new Aa:bn,navigationClient:new jo,loadFrameTimeout:0,windowHashTimeout:n?.loadFrameTimeout||6e4,iframeHashTimeout:n?.loadFrameTimeout||1e4,navigateFrameWait:0,redirectNavigationTimeout:3e4,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:n?.nativeBrokerHandshakeTimeout||2e3,pollIntervalMilliseconds:30},...n,loggerOptions:n?.loggerOptions||c},u={application:{appName:a.EMPTY_STRING,appVersion:a.EMPTY_STRING},client:new Ur};if(e?.protocolMode!==K&&e?.OIDCOptions&&new B(l.loggerOptions).warning(JSON.stringify(qt(Ot))),e?.protocolMode&&e.protocolMode!==H&&l?.allowNativeBroker)throw qt(Rt);return{auth:{...i,...e,OIDCOptions:{...i.OIDCOptions,...e?.OIDCOptions}},cache:{...s,...t},system:l,telemetry:{...u,...r}}}(e,this.browserEnvironment);try{t=window[Yr]}catch(e){}const n=t?.getItem("msal.browser.log.level"),r=t?.getItem("msal.browser.log.pii")?.toLowerCase(),o="true"===r||"false"!==r&&void 0,i={...this.config.system.loggerOptions},s=n&&Object.keys(U).includes(n)?U[n]:void 0;s&&(i.loggerCallback=ii.loggerCallback,i.logLevel=s),void 0!==o&&(i.piiLoggingEnabled=o),this.logger=new B(i,"@azure/msal-browser",ai),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}class si extends ii{getModuleName(){return si.MODULE_NAME}getId(){return si.ID}async initialize(){return this.available="undefined"!=typeof window,this.available}}si.MODULE_NAME="",si.ID="StandardOperatingContext";const ci="missing_kid_error",li="missing_alg_error",ui={[ci]:"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.",[li]:"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."};class di extends Q{constructor(e,t){super(e,t),this.name="JoseHeaderError",Object.setPrototypeOf(this,di.prototype)}}function hi(e){return new di(e,ui[e])}class pi{constructor(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}static getShrHeaderString(e){if(!e.kid)throw hi(ci);if(!e.alg)throw hi(li);const t=new pi({typ:e.typ||"pop",kid:e.kid,alg:e.alg});return JSON.stringify(t)}}function fi(e){return(new TextDecoder).decode(function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw ja(xa)}const n=atob(t);return Uint8Array.from(n,e=>e.codePointAt(0)||0)}(e))}class gi{constructor(){this.dbName=So,this.version=1,this.tableName=To,this.dbOpen=!1}async open(){return new Promise((e,t)=>{const n=window.indexedDB.open(this.dbName,this.version);n.addEventListener("upgradeneeded",e=>{e.target.result.createObjectStore(this.tableName)}),n.addEventListener("success",t=>{const n=t;this.db=n.target.result,this.dbOpen=!0,e()}),n.addEventListener("error",()=>t(ja(pa)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((t,n)=>{if(!this.db)return n(ja(ra));const r=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);r.addEventListener("success",e=>{const n=e;this.closeConnection(),t(n.target.result)}),r.addEventListener("error",e=>{this.closeConnection(),n(e)})})}async setItem(e,t){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(ja(ra));const o=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(t,e);o.addEventListener("success",()=>{this.closeConnection(),n()}),o.addEventListener("error",e=>{this.closeConnection(),r(e)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((t,n)=>{if(!this.db)return n(ja(ra));const r=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);r.addEventListener("success",()=>{this.closeConnection(),t()}),r.addEventListener("error",e=>{this.closeConnection(),n(e)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,t)=>{if(!this.db)return t(ja(ra));const n=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();n.addEventListener("success",t=>{const n=t;this.closeConnection(),e(n.target.result)}),n.addEventListener("error",e=>{this.closeConnection(),t(e)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((t,n)=>{if(!this.db)return n(ja(ra));const r=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);r.addEventListener("success",e=>{const n=e;this.closeConnection(),t(1===n.target.result)}),r.addEventListener("error",e=>{this.closeConnection(),n(e)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,t)=>{const n=window.indexedDB.deleteDatabase(So),r=setTimeout(()=>t(!1),200);n.addEventListener("success",()=>(clearTimeout(r),e(!0))),n.addEventListener("blocked",()=>(clearTimeout(r),e(!0))),n.addEventListener("error",()=>(clearTimeout(r),t(!1)))})}}class mi{constructor(){this.cache=new Map}getItem(e){return this.cache.get(e)||null}setItem(e,t){this.cache.set(e,t)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((t,n)=>{e.push(n)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}}class vi{constructor(e){this.inMemoryCache=new mi,this.indexedDBCache=new gi,this.logger=e}handleDatabaseAccessError(e){if(!(e instanceof Ia&&e.errorCode===pa))throw e;this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.")}async getItem(e){const t=this.inMemoryCache.getItem(e);if(!t)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(e){this.handleDatabaseAccessError(e)}return t}async setItem(e,t){this.inMemoryCache.setItem(e,t);try{await this.indexedDBCache.setItem(e,t)}catch(e){this.handleDatabaseAccessError(e)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(e){this.handleDatabaseAccessError(e)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(0===e.length)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(e){this.handleDatabaseAccessError(e)}return e}async containsKey(e){const t=this.inMemoryCache.containsKey(e);if(!t)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(e){this.handleDatabaseAccessError(e)}return t}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}class yi{constructor(e,t,n){this.logger=e,function(e){if(!window)throw ja(na);if(!window.crypto)throw ja(_o);if(!e&&!window.crypto.subtle)throw ja(_o,"crypto_subtle_undefined")}(n??!1),this.cache=new vi(this.logger),this.performanceClient=t}createNewGuid(){return Ha()}base64Encode(e){return Oa(e)}base64Decode(e){return fi(e)}base64UrlEncode(e){return _a(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){const t=this.performanceClient?.startMeasurement(In,e.correlationId),n=await async function(e,t){return window.crypto.subtle.generateKey(Da,e,t)}(yi.EXTRACTABLE,yi.POP_KEY_USAGES),r=await Ka(n.publicKey),o=bi({e:r.e,kty:r.kty,n:r.n}),a=await this.hashString(o),i=await Ka(n.privateKey),s=await async function(e){return window.crypto.subtle.importKey("jwk",e,Da,!1,["sign"])}(i);return await this.cache.setItem(a,{privateKey:s,publicKey:n.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),t&&t.end({success:!0}),a}async removeTokenBindingKey(e){return await this.cache.removeItem(e),!await this.cache.containsKey(e)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,t,n,r){const o=this.performanceClient?.startMeasurement(jn,r),a=await this.cache.getItem(t);if(!a)throw ja(la);const i=await Ka(a.publicKey),s=bi(i),c=_a(JSON.stringify({kid:t})),l=_a(pi.getShrHeaderString({...n?.header,alg:i.alg,kid:c}));e.cnf={jwk:JSON.parse(s)};const u=`${l}.${_a(JSON.stringify(e))}`,d=(new TextEncoder).encode(u),h=await async function(e,t){return window.crypto.subtle.sign(Da,e,t)}(a.privateKey,d),p=`${u}.${Pa(new Uint8Array(h))}`;return o&&o.end({success:!0}),p}async hashString(e){return $a(e)}}function bi(e){return JSON.stringify(e,Object.keys(e).sort())}yi.POP_KEY_USAGES=["sign","verify"],yi.EXTRACTABLE=!0;const xi=(e,t,n,r,o)=>(...a)=>{n.trace(`Executing function ${t}`);const i=r?.startMeasurement(t,o);if(o){const e=t+"CallCount";r?.incrementFields({[e]:1},o)}try{const r=e(...a);return i?.end({success:!0}),n.trace(`Returning result from ${t}`),r}catch(e){n.trace(`Error occurred in ${t}`);try{n.trace(JSON.stringify(e))}catch(e){n.trace("Unable to print error message.")}throw i?.end({success:!1},e),e}},wi=(e,t,n,r,o)=>(...a)=>{n.trace(`Executing function ${t}`);const i=r?.startMeasurement(t,o);if(o){const e=t+"CallCount";r?.incrementFields({[e]:1},o)}return r?.setPreQueueTime(t,o),e(...a).then(e=>(n.trace(`Returning result from ${t}`),i?.end({success:!0}),e)).catch(e=>{n.trace(`Error occurred in ${t}`);try{n.trace(JSON.stringify(e))}catch(e){n.trace("Unable to print error message.")}throw i?.end({success:!1},e),e})};class ki{constructor(e,t,n,r){this.networkInterface=e,this.logger=t,this.performanceClient=n,this.correlationId=r}async detectRegion(e,t){this.performanceClient?.addQueueMeasurement(Sr,this.correlationId);let n=e;if(n)t.region_source="3";else{const e=ki.IMDS_OPTIONS;try{const r=await wi(this.getRegionFromIMDS.bind(this),Tr,this.logger,this.performanceClient,this.correlationId)(a.IMDS_VERSION,e);if(200===r.status&&(n=r.body,t.region_source="4"),400===r.status){const r=await wi(this.getCurrentVersion.bind(this),Ir,this.logger,this.performanceClient,this.correlationId)(e);if(!r)return t.region_source="1",null;const o=await wi(this.getRegionFromIMDS.bind(this),Tr,this.logger,this.performanceClient,this.correlationId)(r,e);200===o.status&&(n=o.body,t.region_source="4")}}catch(e){return t.region_source="1",null}}return n||(t.region_source="1"),n||null}async getRegionFromIMDS(e,t){return this.performanceClient?.addQueueMeasurement(Tr,this.correlationId),this.networkInterface.sendGetRequestAsync(`${a.IMDS_ENDPOINT}?api-version=${e}&format=text`,t,a.IMDS_TIMEOUT)}async getCurrentVersion(e){this.performanceClient?.addQueueMeasurement(Ir,this.correlationId);try{const t=await this.networkInterface.sendGetRequestAsync(`${a.IMDS_ENDPOINT}?format=json`,e);return 400===t.status&&t.body&&t.body["newest-versions"]&&t.body["newest-versions"].length>0?t.body["newest-versions"][0]:null}catch(e){return null}}}ki.IMDS_OPTIONS={headers:{Metadata:"true"}};class Ci{constructor(e,t,n,r,o,a,i,s){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=t,this.cacheManager=n,this.authorityOptions=r,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=o,this.performanceClient=i,this.correlationId=a,this.managedIdentity=s||!1,this.regionDiscovery=new ki(t,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(a.CIAM_AUTH_URL))return 3;const t=e.PathSegments;if(t.length)switch(t[0].toLowerCase()){case a.ADFS:return 1;case a.DSTS:return 2}return 0}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new Yt(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw He(te)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw He(te)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw He(te)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw He(Re);return this.replacePath(this.metadata.end_session_endpoint)}throw He(te)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw He(te)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw He(te)}canReplaceTenant(e){return 1===e.PathSegments.length&&!Ci.reservedTenantDomains.has(e.PathSegments[0])&&0===this.getAuthorityType(e)&&this.protocolMode===H}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let t=e;const n=new Yt(this.metadata.canonical_authority).getUrlComponents(),r=n.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach((e,o)=>{let a=r[o];if(0===o&&this.canReplaceTenant(n)){const e=new Yt(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];a!==e&&(this.logger.verbose(`Replacing tenant domain name ${a} with id ${e}`),a=e)}e!==a&&(t=t.replace(`/${a}/`,`/${e}/`))}),this.replaceTenant(t)}get defaultOpenIdConfigurationEndpoint(){const e=this.hostnameAndPort;return this.canonicalAuthority.endsWith("v2.0/")||1===this.authorityType||this.protocolMode!==H&&!this.isAliasOfKnownMicrosoftAuthority(e)?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){this.performanceClient?.addQueueMeasurement(yr,this.correlationId);const e=this.getCurrentMetadataEntity(),t=await wi(this.updateCloudDiscoveryMetadata.bind(this),xr,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);const n=await wi(this.updateEndpointMetadata.bind(this),kr,this.logger,this.performanceClient,this.correlationId)(e);this.updateCachedMetadata(e,t,{source:n}),this.performanceClient?.addFields({cloudDiscoverySource:t,authorityEndpointSource:n},this.correlationId)}getCurrentMetadataEntity(){let e=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);return e||(e={aliases:[],preferred_cache:this.hostnameAndPort,preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:"",token_endpoint:"",end_session_endpoint:"",issuer:"",aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:ut(),jwks_uri:""}),e}updateCachedMetadata(e,t,n){t!==M&&n?.source!==M&&(e.expiresAt=ut(),e.canonical_authority=this.canonicalAuthority);const r=this.cacheManager.generateAuthorityMetadataCacheKey(e.preferred_cache);this.cacheManager.setAuthorityMetadata(r,e),this.metadata=e}async updateEndpointMetadata(e){this.performanceClient?.addQueueMeasurement(kr,this.correlationId);const t=this.updateEndpointMetadataFromLocalSources(e);if(t)return t.source===L&&this.authorityOptions.azureRegionConfiguration?.azureRegion&&t.metadata&&(dt(e,await wi(this.updateMetadataWithRegionalInformation.bind(this),Cr,this.logger,this.performanceClient,this.correlationId)(t.metadata),!1),e.canonical_authority=this.canonicalAuthority),t.source;let n=await wi(this.getEndpointMetadataFromNetwork.bind(this),wr,this.logger,this.performanceClient,this.correlationId)();if(n)return this.authorityOptions.azureRegionConfiguration?.azureRegion&&(n=await wi(this.updateMetadataWithRegionalInformation.bind(this),Cr,this.logger,this.performanceClient,this.correlationId)(n)),dt(e,n,!0),z;throw He(re,this.defaultOpenIdConfigurationEndpoint)}updateEndpointMetadataFromLocalSources(e){this.logger.verbose("Attempting to get endpoint metadata from authority configuration");const t=this.getEndpointMetadataFromConfig();if(t)return this.logger.verbose("Found endpoint metadata in authority configuration"),dt(e,t,!1),{source:R};if(this.logger.verbose("Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values."),this.authorityOptions.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get endpoint metadata from the network metadata cache.");else{const t=this.getEndpointMetadataFromHardcodedValues();if(t)return dt(e,t,!1),{source:L,metadata:t};this.logger.verbose("Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.")}const n=pt(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!n?(this.logger.verbose("Found endpoint metadata in the cache."),{source:M}):(n&&this.logger.verbose("The metadata entity is expired."),null)}isAuthoritySameType(e){return new Yt(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch(e){throw qt(jt)}return null}async getEndpointMetadataFromNetwork(){this.performanceClient?.addQueueMeasurement(wr,this.correlationId);const e={},t=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from ${t}`);try{const n=await this.networkInterface.sendGetRequestAsync(t,e),r=function(e){return e.hasOwnProperty("authorization_endpoint")&&e.hasOwnProperty("token_endpoint")&&e.hasOwnProperty("issuer")&&e.hasOwnProperty("jwks_uri")}(n.body);return r?n.body:(this.logger.verbose("Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration"),null)}catch(e){return this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${e}`),null}}getEndpointMetadataFromHardcodedValues(){return this.hostnameAndPort in Jt?Jt[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(e){this.performanceClient?.addQueueMeasurement(Cr,this.correlationId);const t=this.authorityOptions.azureRegionConfiguration?.azureRegion;if(t){if(t!==a.AZURE_REGION_AUTO_DISCOVER_FLAG)return this.regionDiscoveryMetadata.region_outcome="2",this.regionDiscoveryMetadata.region_used=t,Ci.replaceWithRegionalInformation(e,t);const n=await wi(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),Sr,this.logger,this.performanceClient,this.correlationId)(this.authorityOptions.azureRegionConfiguration?.environmentRegion,this.regionDiscoveryMetadata);if(n)return this.regionDiscoveryMetadata.region_outcome="4",this.regionDiscoveryMetadata.region_used=n,Ci.replaceWithRegionalInformation(e,n);this.regionDiscoveryMetadata.region_outcome="5"}return e}async updateCloudDiscoveryMetadata(e){this.performanceClient?.addQueueMeasurement(xr,this.correlationId);const t=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(t)return t;const n=await wi(this.getCloudDiscoveryMetadataFromNetwork.bind(this),br,this.logger,this.performanceClient,this.correlationId)();if(n)return ht(e,n,!0),z;throw qt(At)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||a.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||a.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${e.canonical_authority||a.NOT_APPLICABLE}`);const t=this.getCloudDiscoveryMetadataFromConfig();if(t)return this.logger.verbose("Found cloud discovery metadata in authority configuration"),ht(e,t,!1),R;if(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values."),this.options.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded cloud discovery metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get cloud discovery metadata from the network metadata cache.");else{const t=(n=this.hostnameAndPort,tn(Xt.metadata,n));if(t)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),ht(e,t,!1),L;this.logger.verbose("Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.")}var n;const r=pt(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose("Found cloud discovery metadata in the cache."),M):(r&&this.logger.verbose("The metadata entity is expired."),null)}getCloudDiscoveryMetadataFromConfig(){if(3===this.authorityType)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),Ci.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");const e=tn(JSON.parse(this.authorityOptions.cloudDiscoveryMetadata).metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),e)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),e;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch(e){throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),qt(It)}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),Ci.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){this.performanceClient?.addQueueMeasurement(br,this.correlationId);const e=`${a.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`,t={};let n=null;try{const r=await this.networkInterface.sendGetRequestAsync(e,t);let o,i;if(function(e){return e.hasOwnProperty("tenant_discovery_endpoint")&&e.hasOwnProperty("metadata")}(r.body))o=r.body,i=o.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${o.tenant_discovery_endpoint}`);else{if(!function(e){return e.hasOwnProperty("error")&&e.hasOwnProperty("error_description")}(r.body))return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),null;if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${r.status}`),o=r.body,o.error===a.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${o.error}`),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${o.error_description}`),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),i=[]}this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),n=tn(i,this.hostnameAndPort)}catch(e){if(e instanceof Q)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata.\nError: ${e.errorCode}\nError Description: ${e.errorMessage}`);else{const t=e;this.logger.error(`A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.\nError: ${t.name}\nError Description: ${t.message}`)}return null}return n||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),n=Ci.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),n}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(e=>e&&Yt.getDomainFromUrl(e).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,t){let n;if(t&&t.azureCloudInstance!==$){const e=t.tenant?t.tenant:a.DEFAULT_COMMON_TENANT;n=`${t.azureCloudInstance}/${e}/`}return n||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return a.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw He(te)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return Zt.has(e)}static isPublicCloudAuthority(e){return a.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,t,n){const r=new Yt(e);r.validateAsUri();const o=r.getUrlComponents();let i=`${t}.${o.HostNameAndPort}`;this.isPublicCloudAuthority(o.HostNameAndPort)&&(i=`${t}.${a.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const s=Yt.constructAuthorityUriFromObject({...r.getUrlComponents(),HostNameAndPort:i}).urlString;return n?`${s}?${n}`:s}static replaceWithRegionalInformation(e,t){const n={...e};return n.authorization_endpoint=Ci.buildRegionalAuthorityString(n.authorization_endpoint,t),n.token_endpoint=Ci.buildRegionalAuthorityString(n.token_endpoint,t),n.end_session_endpoint&&(n.end_session_endpoint=Ci.buildRegionalAuthorityString(n.end_session_endpoint,t)),n}static transformCIAMAuthority(e){let t=e;const n=new Yt(e).getUrlComponents();return 0===n.PathSegments.length&&n.HostNameAndPort.endsWith(a.CIAM_AUTH_URL)&&(t=`${t}${n.HostNameAndPort.split(".")[0]}${a.AAD_TENANT_DOMAIN_SUFFIX}`),t}}function Si(e){return e.endsWith(a.FORWARD_SLASH)?e:`${e}${a.FORWARD_SLASH}`}Ci.reservedTenantDomains=new Set(["{tenant}","{tenantid}",x,k,w]);const Ti="no_tokens_found",Ii="native_account_unavailable",ji="refresh_token_expired",Ai="bad_token",Ni=["interaction_required","consent_required","login_required",Ai],Ei=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],_i={[Ti]:"No refresh token found in the cache. Please sign-in.",[Ii]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[ji]:"Refresh token has expired.",[Ai]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve."};class Pi extends Q{constructor(e,t,n,r,o,i,s,c){super(e,t,n),Object.setPrototypeOf(this,Pi.prototype),this.timestamp=r||a.EMPTY_STRING,this.traceId=o||a.EMPTY_STRING,this.correlationId=i||a.EMPTY_STRING,this.claims=s||a.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=c}}function Oi(e,t,n){const r=!!e&&Ni.indexOf(e)>-1,o=!!n&&Ei.indexOf(n)>-1,a=!!t&&Ni.some(e=>t.indexOf(e)>-1);return r||a||o}function Ri(e){return new Pi(e,_i[e])}class Mi{static setRequestState(e,t,n){const r=Mi.generateLibraryState(e,n);return t?`${r}${a.RESOURCE_DELIM}${t}`:r}static generateLibraryState(e,t){if(!e)throw He(Te);const n={id:e.createNewGuid()};t&&(n.meta=t);const r=JSON.stringify(n);return e.base64Encode(r)}static parseRequestState(e,t){if(!e)throw He(Te);if(!t)throw He(ae);try{const n=t.split(a.RESOURCE_DELIM),r=n[0],o=n.length>1?n.slice(1).join(a.RESOURCE_DELIM):a.EMPTY_STRING,i=e.base64Decode(r),s=JSON.parse(i);return{userRequestState:o||a.EMPTY_STRING,libraryState:s}}catch(e){throw He(ae)}}}const zi="home_account_id",Li="UPN";class qi{constructor(){if(!window.localStorage)throw Ja(Ga)}getItem(e){return window.localStorage.getItem(e)}setItem(e,t){window.localStorage.setItem(e,t)}removeItem(e){window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}}class Di{constructor(){if(!window.sessionStorage)throw Ja(Ga)}getItem(e){return window.sessionStorage.getItem(e)}setItem(e,t){window.sessionStorage.setItem(e,t)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}}function Fi(e,t){if(!t)return null;try{return Mi.parseRequestState(e,t).libraryState.meta}catch(e){throw He(ae)}}class Ui{getItem(e){const t=`${encodeURIComponent(e)}`,n=document.cookie.split(";");for(let e=0;e<n.length;e++){const r=n[e],[o,...a]=decodeURIComponent(r).trim().split("="),i=a.join("=");if(o===t)return i}return""}setItem(e,t,n,r=!0){let o=`${encodeURIComponent(e)}=${encodeURIComponent(t)};path=/;SameSite=Lax;`;if(n){const e=function(e){const t=new Date;return new Date(t.getTime()+864e5*e).toUTCString()}(n);o+=`expires=${e};`}r&&(o+="Secure;"),document.cookie=o}removeItem(e){this.setItem(e,"",-1)}getKeys(){const e=document.cookie.split(";"),t=[];return e.forEach(e=>{const n=decodeURIComponent(e).trim().split("=");t.push(n[0])}),t}containsKey(e){return this.getKeys().includes(e)}}class Bi extends cn{constructor(e,t,n,r,o,a){super(e,n,r,o),this.cacheConfig=t,this.logger=r,this.internalStorage=new mi,this.browserStorage=this.setupBrowserStorage(this.cacheConfig.cacheLocation),this.temporaryCacheStorage=this.setupBrowserStorage(this.cacheConfig.temporaryCacheLocation),this.cookieStorage=new Ui,t.cacheMigrationEnabled&&(this.migrateCacheEntries(),this.createKeyMaps()),this.performanceClient=a}setupBrowserStorage(e){try{switch(e){case Qr:return new qi;case Yr:return new Di}}catch(e){this.logger.error(e)}return this.cacheConfig.cacheLocation=Jr,new mi}migrateCacheEntries(){const e=this.browserStorage.getItem(co);e&&this.logger.info(`MSAL.js was last initialized with version ${e}`),e!==ai&&this.browserStorage.setItem(co,ai);const t=`${a.CACHE_PREFIX}.${p}`,n=`${a.CACHE_PREFIX}.${f}`,r=`${a.CACHE_PREFIX}.${m}`,o=`${a.CACHE_PREFIX}.${v}`,i=[this.browserStorage.getItem(t),this.browserStorage.getItem(n),this.browserStorage.getItem(r),this.browserStorage.getItem(o)];[p,f,m,v].forEach((e,t)=>{const n=i[t];n&&this.setTemporaryCache(e,n,!0)})}createKeyMaps(){this.logger.trace("BrowserCacheManager - createKeyMaps called.");const e=this.cryptoImpl.createNewGuid(),t=this.getItem(io),n=this.getItem(`${so}.${this.clientId}`);t&&n?this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration."):this.browserStorage.getKeys().forEach(t=>{if(this.isCredentialKey(t)){const n=this.getItem(t);if(n){const r=this.validateAndParseJson(n);if(r&&r.hasOwnProperty("credentialType"))switch(r.credentialType){case E.ID_TOKEN:if(rt(r)){this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${t} found, saving key to token key map`);const n=r,o=this.updateCredentialCacheKey(t,n,e);return void this.addTokenKey(o,E.ID_TOKEN,e)}this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${t}`);break;case E.ACCESS_TOKEN:case E.ACCESS_TOKEN_WITH_AUTH_SCHEME:if(nt(r)){this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${t} found, saving key to token key map`);const n=r,o=this.updateCredentialCacheKey(t,n,e);return void this.addTokenKey(o,E.ACCESS_TOKEN,e)}this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${t}`);break;case E.REFRESH_TOKEN:if(ot(r)){this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${t} found, saving key to token key map`);const n=r,o=this.updateCredentialCacheKey(t,n,e);return void this.addTokenKey(o,E.REFRESH_TOKEN,e)}this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${t}`)}}}if(this.isAccountKey(t)){const n=this.getItem(t);if(n){const r=this.validateAndParseJson(n);r&&Wt.isAccountEntity(r)&&(this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${t} found, saving key to account key map`),this.addAccountKeyToMap(t,e))}}})}validateAndParseJson(e){try{const t=JSON.parse(e);return t&&"object"==typeof t?t:null}catch(e){return null}}getItem(e){return this.browserStorage.getItem(e)}setItem(e,t,n){let r=[];for(let o=0;o<=20;o++)try{this.browserStorage.setItem(e,t),o>0&&this.removeAccessTokenKeys(r.slice(0,o),n);break}catch(a){const i=sn(a);if(!(i.errorCode===nn&&o<20))throw i;if(r.length||(r=e===`${so}.${this.clientId}`?JSON.parse(t).accessToken:this.getTokenKeys().accessToken),r.length<=o)throw i;this.removeAccessToken(r[o],n,!1)}}getAccount(e,t,n){this.logger.trace("BrowserCacheManager.getAccount called");const r=this.getCachedAccountEntity(e,t);return this.updateOutdatedCachedAccount(e,r,t,n)}getCachedAccountEntity(e,t){const n=this.getItem(e);if(!n)return this.removeAccountKeyFromMap(e,t),null;const r=this.validateAndParseJson(n);return r&&Wt.isAccountEntity(r)?cn.toObject(new Wt,r):null}setAccount(e,t){this.logger.trace("BrowserCacheManager.setAccount called");const n=e.generateAccountKey();e.lastUpdatedAt=Date.now().toString(),this.setItem(n,JSON.stringify(e),t),this.addAccountKeyToMap(n,t)}getAccountKeys(){this.logger.trace("BrowserCacheManager.getAccountKeys called");const e=this.getItem(io);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])}addAccountKeyToMap(e,t){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${e}`);const n=this.getAccountKeys();-1===n.indexOf(e)?(n.push(e),this.setItem(io,JSON.stringify(n),t),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")}removeAccountKeyFromMap(e,t){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${e}`);const n=this.getAccountKeys(),r=n.indexOf(e);if(r>-1){if(n.splice(r,1),0===n.length)return void this.removeItem(io);this.setItem(io,JSON.stringify(n),t),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")}else this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}async removeAccount(e,t){super.removeAccount(e,t),this.removeAccountKeyFromMap(e,t)}removeOutdatedAccount(e,t){this.removeItem(e),this.removeAccountKeyFromMap(e,t)}removeIdToken(e,t){super.removeIdToken(e,t),this.removeTokenKey(e,E.ID_TOKEN,t)}removeAccessToken(e,t,n=!0){super.removeAccessToken(e,t),this.performanceClient?.incrementFields({accessTokensRemoved:1},t),n&&this.removeTokenKey(e,E.ACCESS_TOKEN,t)}removeAccessTokenKeys(e,t){this.logger.trace("removeAccessTokenKey called");const n=this.getTokenKeys();let r=0;if(e.forEach(e=>{const t=n.accessToken.indexOf(e);t>-1&&(n.accessToken.splice(t,1),r++)}),r>0)return this.logger.info(`removed ${r} accessToken keys from tokenKeys map`),void this.setTokenKeys(n,t)}removeRefreshToken(e,t){super.removeRefreshToken(e,t),this.removeTokenKey(e,E.REFRESH_TOKEN,t)}getTokenKeys(){this.logger.trace("BrowserCacheManager.getTokenKeys called");const e=this.getItem(`${so}.${this.clientId}`);if(e){const t=this.validateAndParseJson(e);if(t&&t.hasOwnProperty("idToken")&&t.hasOwnProperty("accessToken")&&t.hasOwnProperty("refreshToken"))return t;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}}setTokenKeys(e,t){0!==e.idToken.length||0!==e.accessToken.length||0!==e.refreshToken.length?this.setItem(`${so}.${this.clientId}`,JSON.stringify(e),t):this.removeItem(`${so}.${this.clientId}`)}addTokenKey(e,t,n){this.logger.trace("BrowserCacheManager addTokenKey called");const r=this.getTokenKeys();switch(t){case E.ID_TOKEN:-1===r.idToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),r.idToken.push(e));break;case E.ACCESS_TOKEN:const n=r.accessToken.indexOf(e);-1!==n&&r.accessToken.splice(n,1),this.logger.trace(`access token ${-1===n?"added to":"updated in"} map`),r.accessToken.push(e);break;case E.REFRESH_TOKEN:-1===r.refreshToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),r.refreshToken.push(e));break;default:throw this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${t}`),He(Ie)}this.setTokenKeys(r,n)}removeTokenKey(e,t,n,r=this.getTokenKeys()){switch(this.logger.trace("BrowserCacheManager removeTokenKey called"),t){case E.ID_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${e} from map`);const n=r.idToken.indexOf(e);n>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),r.idToken.splice(n,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case E.ACCESS_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: ${e} from map`);const o=r.accessToken.indexOf(e);o>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),r.accessToken.splice(o,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case E.REFRESH_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: ${e} from map`);const a=r.refreshToken.indexOf(e);a>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),r.refreshToken.splice(a,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:throw this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${t}`),He(Ie)}this.setTokenKeys(r,n)}getIdTokenCredential(e,t){const n=this.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeIdToken(e,t),null;const r=this.validateAndParseJson(n);return r&&rt(r)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),r):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null)}setIdTokenCredential(e,t){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const n=Je(e);e.lastUpdatedAt=Date.now().toString(),this.setItem(n,JSON.stringify(e),t),this.addTokenKey(n,E.ID_TOKEN,t)}getAccessTokenCredential(e,t){const n=this.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,E.ACCESS_TOKEN,t),null;const r=this.validateAndParseJson(n);return r&&nt(r)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),r):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null)}setAccessTokenCredential(e,t){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const n=Je(e);e.lastUpdatedAt=Date.now().toString(),this.setItem(n,JSON.stringify(e),t),this.addTokenKey(n,E.ACCESS_TOKEN,t)}getRefreshTokenCredential(e,t){const n=this.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,E.REFRESH_TOKEN,t),null;const r=this.validateAndParseJson(n);return r&&ot(r)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),r):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null)}setRefreshTokenCredential(e,t){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const n=Je(e);e.lastUpdatedAt=Date.now().toString(),this.setItem(n,JSON.stringify(e),t),this.addTokenKey(n,E.REFRESH_TOKEN,t)}getAppMetadata(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const n=this.validateAndParseJson(t);return n&&((r=n)&&0===e.indexOf(_)&&r.hasOwnProperty("clientId")&&r.hasOwnProperty("environment"))?(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),n):(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null);var r}setAppMetadata(e,t){this.logger.trace("BrowserCacheManager.setAppMetadata called");const n=function({environment:e,clientId:t}){return[_,e,t].join(N).toLowerCase()}(e);this.setItem(n,JSON.stringify(e),t)}getServerTelemetry(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const n=this.validateAndParseJson(t);return n&&function(e,t){const n=0===e.indexOf(q.CACHE_KEY);let r=!0;return t&&(r=t.hasOwnProperty("failedRequests")&&t.hasOwnProperty("errors")&&t.hasOwnProperty("cacheHits")),n&&r}(e,n)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),n):(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null)}setServerTelemetry(e,t,n){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t),n)}getAuthorityMetadata(e){const t=this.internalStorage.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const n=this.validateAndParseJson(t);return n&&function(e,t){return!!t&&0===e.indexOf(O)&&t.hasOwnProperty("aliases")&&t.hasOwnProperty("preferred_cache")&&t.hasOwnProperty("preferred_network")&&t.hasOwnProperty("canonical_authority")&&t.hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("aliasesFromNetwork")&&t.hasOwnProperty("endpointsFromNetwork")&&t.hasOwnProperty("expiresAt")&&t.hasOwnProperty("jwks_uri")}(e,n)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),n):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(e=>this.isAuthorityMetadata(e))}setWrapperMetadata(e,t){this.internalStorage.setItem(lo,e),this.internalStorage.setItem(uo,t)}getWrapperMetadata(){return[this.internalStorage.getItem(lo)||a.EMPTY_STRING,this.internalStorage.getItem(uo)||a.EMPTY_STRING]}setAuthorityMetadata(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))}getActiveAccount(e){const t=this.generateCacheKey(b),n=this.getItem(t);if(!n){this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");const t=this.generateCacheKey(y),n=this.getItem(t);if(!n)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null;const r=this.getAccountInfoFilteredBy({localAccountId:n},e);return r?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(r,e),r):null}const r=this.validateAndParseJson(n);return r?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:r.homeAccountId,localAccountId:r.localAccountId,tenantId:r.tenantId},e)):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e,t){const n=this.generateCacheKey(b),r=this.generateCacheKey(y);if(e){this.logger.verbose("setActiveAccount: Active account set");const o={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId,lastUpdatedAt:Date.now().toString()};this.setItem(n,JSON.stringify(o),t),this.setItem(r,e.localAccountId,t)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(n),this.browserStorage.removeItem(r)}getThrottlingCache(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const n=this.validateAndParseJson(t);return n&&function(e,t){let n=!1;e&&(n=0===e.indexOf(F));let r=!0;return t&&(r=t.hasOwnProperty("throttleTime")),n&&r}(e,n)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),n):(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null)}setThrottlingCache(e,t,n){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t),n)}getTemporaryCache(e,t){const n=t?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const e=this.cookieStorage.getItem(n);if(e)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),e}const r=this.temporaryCacheStorage.getItem(n);if(!r){if(this.cacheConfig.cacheLocation===Qr){const e=this.browserStorage.getItem(n);if(e)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),e}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),r}setTemporaryCache(e,t,n){const r=n?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(r,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(r,t,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}async clear(e){await this.removeAllAccounts(e),this.removeAppMetadata(e),this.temporaryCacheStorage.getKeys().forEach(e=>{-1===e.indexOf(a.CACHE_PREFIX)&&-1===e.indexOf(this.clientId)||this.removeTemporaryItem(e)}),this.browserStorage.getKeys().forEach(e=>{-1===e.indexOf(a.CACHE_PREFIX)&&-1===e.indexOf(this.clientId)||this.browserStorage.removeItem(e)}),this.internalStorage.clear()}async clearTokensAndKeysWithClaims(e,t){e.addQueueMeasurement(Pr,t);const n=this.getTokenKeys();let r=0;n.accessToken.forEach(e=>{const n=this.getAccessTokenCredential(e,t);n?.requestedClaimsHash&&e.includes(n.requestedClaimsHash.toLowerCase())&&(this.removeAccessToken(e,t),r++)}),r>0&&this.logger.warning(`${r} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return this.validateAndParseJson(e)?JSON.stringify(e):Dt.startsWith(e,a.CACHE_PREFIX)||Dt.startsWith(e,g)?e:`${a.CACHE_PREFIX}.${this.clientId}.${e}`}generateAuthorityKey(e){const{libraryState:{id:t}}=Mi.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`authority.${t}`)}generateNonceKey(e){const{libraryState:{id:t}}=Mi.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`nonce.id_token.${t}`)}generateStateKey(e){const{libraryState:{id:t}}=Mi.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Xr}.${t}`)}getCachedAuthority(e){const t=this.generateStateKey(e),n=this.getTemporaryCache(t);if(!n)return null;const r=this.generateAuthorityKey(n);return this.getTemporaryCache(r)}updateCacheEntries(e,t,n,r,o){this.logger.trace("BrowserCacheManager.updateCacheEntries called");const a=this.generateStateKey(e);this.setTemporaryCache(a,e,!1);const i=this.generateNonceKey(e);this.setTemporaryCache(i,t,!1);const s=this.generateAuthorityKey(e);if(this.setTemporaryCache(s,n,!1),o){const e={credential:o.homeAccountId,type:zi};this.setTemporaryCache(ro,JSON.stringify(e),!0)}else if(r){const e={credential:r,type:Li};this.setTemporaryCache(ro,JSON.stringify(e),!0)}}resetRequestCache(e){this.logger.trace("BrowserCacheManager.resetRequestCache called"),e&&(this.temporaryCacheStorage.getKeys().forEach(t=>{-1!==t.indexOf(e)&&this.removeTemporaryItem(t)}),this.removeTemporaryItem(this.generateStateKey(e)),this.removeTemporaryItem(this.generateNonceKey(e)),this.removeTemporaryItem(this.generateAuthorityKey(e))),this.removeTemporaryItem(this.generateCacheKey(to)),this.removeTemporaryItem(this.generateCacheKey(Zr)),this.removeTemporaryItem(this.generateCacheKey(eo)),this.removeTemporaryItem(this.generateCacheKey(oo)),this.removeTemporaryItem(this.generateCacheKey(ro)),this.removeTemporaryItem(this.generateCacheKey(ao)),this.setInteractionInProgress(!1)}cleanRequestByState(e){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e){const t=this.generateStateKey(e),n=this.temporaryCacheStorage.getItem(t);this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${n}`),this.resetRequestCache(n||a.EMPTY_STRING)}}cleanRequestByInteractionType(e){this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.temporaryCacheStorage.getKeys().forEach(t=>{if(-1===t.indexOf(Xr))return;const n=this.temporaryCacheStorage.getItem(t);if(!n)return;const r=Fi(this.cryptoImpl,n);r&&r.interactionType===e&&(this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${n}`),this.resetRequestCache(n))}),this.setInteractionInProgress(!1)}cacheCodeRequest(e){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");const t=Oa(JSON.stringify(e));this.setTemporaryCache(to,t,!0)}getCachedRequest(e){this.logger.trace("BrowserCacheManager.getCachedRequest called");const t=this.getTemporaryCache(to,!0);if(!t)throw ja(Jo);let n;try{n=JSON.parse(fi(t))}catch(e){throw this.logger.errorPii(`Attempted to parse: ${t}`),this.logger.error(`Parsing cached token request threw with error: ${e}`),ja(Xo)}if(this.removeTemporaryItem(this.generateCacheKey(to)),!n.authority){const t=this.generateAuthorityKey(e),r=this.getTemporaryCache(t);if(!r)throw ja(Zo);n.authority=r}return n}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(ao,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;return this.validateAndParseJson(e)||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){const t=this.getInteractionInProgress();return e?t===this.clientId:!!t}getInteractionInProgress(){const e=`${a.CACHE_PREFIX}.${no}`;return this.getTemporaryCache(e,!1)}setInteractionInProgress(e){const t=`${a.CACHE_PREFIX}.${no}`;if(e){if(this.getInteractionInProgress())throw ja(qo);this.setTemporaryCache(t,this.clientId,!1)}else e||this.getInteractionInProgress()!==this.clientId||this.removeTemporaryItem(t)}getLegacyLoginHint(){const e=this.getTemporaryCache(g);e&&(this.browserStorage.removeItem(g),this.logger.verbose("Cached ADAL id token retrieved."));const t=this.getTemporaryCache(p,!0);t&&(this.browserStorage.removeItem(this.generateCacheKey(p)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));const n=t||e;if(n){const e=We(n,fi);if(e.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),e.preferred_username;if(e.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),e.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null}updateCredentialCacheKey(e,t,n){const r=Je(t);if(e!==r){const o=this.getItem(e);if(o)return this.browserStorage.removeItem(e),this.setItem(r,o,n),this.logger.verbose(`Updated an outdated ${t.credentialType} cache key`),r;this.logger.error(`Attempted to update an outdated ${t.credentialType} cache key but no item matching the outdated key was found in storage`)}return e}async hydrateCache(e,t){const n=Xe(e.account?.homeAccountId,e.account?.environment,e.idToken,this.clientId,e.tenantId);let r;t.claims&&(r=await this.cryptoImpl.hashString(t.claims));const o={idToken:n,accessToken:Ze(e.account?.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?e.expiresOn.getTime()/1e3:0,e.extExpiresOn?e.extExpiresOn.getTime()/1e3:0,fi,void 0,e.tokenType,void 0,t.sshKid,t.claims,r)};return this.saveCacheRecord(o,e.correlationId)}async saveCacheRecord(e,t,n){try{await super.saveCacheRecord(e,t,n)}catch(e){if(e instanceof an&&this.performanceClient&&t)try{const e=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:e.refreshToken.length,cacheIdCount:e.idToken.length,cacheAtCount:e.accessToken.length},t)}catch(e){}throw e}}}const Hi="msal:initializeEnd",Ki="msal:loginStart",$i="msal:loginSuccess",Gi="msal:loginFailure",Wi="msal:acquireTokenStart",Vi="msal:acquireTokenSuccess",Qi="msal:acquireTokenFailure",Yi="msal:ssoSilentStart",Ji="msal:ssoSilentSuccess",Xi="msal:ssoSilentFailure",Zi="msal:acquireTokenByCodeFailure",es="msal:handleRedirectStart",ts="msal:handleRedirectEnd",ns="msal:popupOpened",rs="msal:logoutStart",os="msal:logoutSuccess",as="msal:logoutFailure",is="msal:logoutEnd",ss="msal:restoreFromBFCache";class cs{constructor(e){this.eventCallbacks=new Map,this.logger=e||new B({})}addEventCallback(e,t,n){if("undefined"!=typeof window){const r=n||Ha();return this.eventCallbacks.has(r)?(this.logger.error(`Event callback with id: ${r} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(r,[e,t||[]]),this.logger.verbose(`Event callback registered with id: ${r}`),r)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,t,n,r){if("undefined"!=typeof window){const o={eventType:e,interactionType:t||null,payload:n||null,error:r||null,timestamp:Date.now()};this.eventCallbacks.forEach(([t,n],r)=>{(0===n.length||n.includes(e))&&(this.logger.verbose(`Emitting event to callback ${r}: ${e}`),t.apply(null,[o]))})}}}class ls extends Q{constructor(e,t,n,r,o){super(e,t,n),this.name="ServerError",this.errorNo=r,this.status=o,Object.setPrototypeOf(this,ls.prototype)}}class us{static generateThrottlingStorageKey(e){return`${F}.${JSON.stringify(e)}`}static preProcess(e,t,n){const r=us.generateThrottlingStorageKey(t),o=e.getThrottlingCache(r);if(o){if(o.throttleTime<Date.now())return void e.removeItem(r,n);throw new ls(o.errorCodes?.join(" ")||a.EMPTY_STRING,o.errorMessage,o.subError)}}static postProcess(e,t,n,r){if(us.checkResponseStatus(n)||us.checkResponseForRetryAfter(n)){const o={throttleTime:us.calculateThrottleTime(parseInt(n.headers[l])),error:n.body.error,errorCodes:n.body.error_codes,errorMessage:n.body.error_description,subError:n.body.suberror};e.setThrottlingCache(us.generateThrottlingStorageKey(t),o,r)}}static checkResponseStatus(e){return 429===e.status||e.status>=500&&e.status<600}static checkResponseForRetryAfter(e){return!!e.headers&&e.headers.hasOwnProperty(l)&&(e.status<200||e.status>=300)}static calculateThrottleTime(e){const t=e<=0?0:e,n=Date.now()/1e3;return Math.floor(1e3*Math.min(n+(t||60),n+3600))}static removeThrottle(e,t,n,r){const o={clientId:t,authority:n.authority,scopes:n.scopes,homeAccountIdentifier:r,claims:n.claims,authenticationScheme:n.authenticationScheme,resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,sshKid:n.sshKid},a=this.generateThrottlingStorageKey(o);e.removeItem(a,n.correlationId)}}const ds="client_id",hs="redirect_uri",ps="response_type",fs="token_type",gs="req_cnf",ms="return_spa_code",vs="x-client-xtra-sku",ys="brk_client_id",bs="brk_redirect_uri";class xs{static validateRedirectUri(e){if(!e)throw qt(ft)}static validatePrompt(e){const t=[];for(const e in S)t.push(S[e]);if(t.indexOf(e)<0)throw qt(xt)}static validateClaims(e){try{JSON.parse(e)}catch(e){throw qt(wt)}}static validateCodeChallengeParams(e,t){if(!e||!t)throw qt(Tt);this.validateCodeChallengeMethod(t)}static validateCodeChallengeMethod(e){if([T.PLAIN,T.S256].indexOf(e)<0)throw qt(St)}}class ws{constructor(e,t){this.parameters=new Map,this.performanceClient=t,this.correlationId=e}addResponseTypeCode(){this.parameters.set(ps,encodeURIComponent(a.CODE_RESPONSE_TYPE))}addResponseTypeForTokenAndIdToken(){this.parameters.set(ps,encodeURIComponent(`${a.TOKEN_RESPONSE_TYPE} ${a.ID_TOKEN_RESPONSE_TYPE}`))}addResponseMode(e){this.parameters.set("response_mode",encodeURIComponent(e||j.QUERY))}addNativeBroker(){this.parameters.set("nativebroker",encodeURIComponent("1"))}addScopes(e,t=!0,n=i){!t||n.includes("openid")||e.includes("openid")||n.push("openid");const r=t?[...e||[],...n]:e||[],o=new Ft(r);this.parameters.set("scope",encodeURIComponent(o.printScopes()))}addClientId(e){this.parameters.set(ds,encodeURIComponent(e))}addRedirectUri(e){xs.validateRedirectUri(e),this.parameters.set(hs,encodeURIComponent(e))}addPostLogoutRedirectUri(e){xs.validateRedirectUri(e),this.parameters.set("post_logout_redirect_uri",encodeURIComponent(e))}addIdTokenHint(e){this.parameters.set("id_token_hint",encodeURIComponent(e))}addDomainHint(e){this.parameters.set("domain_hint",encodeURIComponent(e))}addLoginHint(e){this.parameters.set("login_hint",encodeURIComponent(e))}addCcsUpn(e){this.parameters.set(u,encodeURIComponent(`UPN:${e}`))}addCcsOid(e){this.parameters.set(u,encodeURIComponent(`Oid:${e.uid}@${e.utid}`))}addSid(e){this.parameters.set("sid",encodeURIComponent(e))}addClaims(e,t){const n=this.addClientCapabilitiesToClaims(e,t);xs.validateClaims(n),this.parameters.set("claims",encodeURIComponent(n))}addCorrelationId(e){this.parameters.set("client-request-id",encodeURIComponent(e))}addLibraryInfo(e){this.parameters.set("x-client-SKU",e.sku),this.parameters.set("x-client-VER",e.version),e.os&&this.parameters.set("x-client-OS",e.os),e.cpu&&this.parameters.set("x-client-CPU",e.cpu)}addApplicationTelemetry(e){e?.appName&&this.parameters.set("x-app-name",e.appName),e?.appVersion&&this.parameters.set("x-app-ver",e.appVersion)}addPrompt(e){xs.validatePrompt(e),this.parameters.set("prompt",encodeURIComponent(e))}addState(e){e&&this.parameters.set("state",encodeURIComponent(e))}addNonce(e){this.parameters.set("nonce",encodeURIComponent(e))}addCodeChallengeParams(e,t){if(xs.validateCodeChallengeParams(e,t),!e||!t)throw qt(Tt);this.parameters.set("code_challenge",encodeURIComponent(e)),this.parameters.set("code_challenge_method",encodeURIComponent(t))}addAuthorizationCode(e){this.parameters.set("code",encodeURIComponent(e))}addDeviceCode(e){this.parameters.set("device_code",encodeURIComponent(e))}addRefreshToken(e){this.parameters.set("refresh_token",encodeURIComponent(e))}addCodeVerifier(e){this.parameters.set("code_verifier",encodeURIComponent(e))}addClientSecret(e){this.parameters.set("client_secret",encodeURIComponent(e))}addClientAssertion(e){e&&this.parameters.set("client_assertion",encodeURIComponent(e))}addClientAssertionType(e){e&&this.parameters.set("client_assertion_type",encodeURIComponent(e))}addOboAssertion(e){this.parameters.set("assertion",encodeURIComponent(e))}addRequestTokenUse(e){this.parameters.set("requested_token_use",encodeURIComponent(e))}addGrantType(e){this.parameters.set("grant_type",encodeURIComponent(e))}addClientInfo(){this.parameters.set("client_info","1")}addExtraQueryParameters(e){Object.entries(e).forEach(([e,t])=>{!this.parameters.has(e)&&t&&this.parameters.set(e,t)})}addClientCapabilitiesToClaims(e,t){let n;if(e)try{n=JSON.parse(e)}catch(e){throw qt(wt)}else n={};return t&&t.length>0&&(n.hasOwnProperty(C)||(n[C]={}),n[C].xms_cc={values:t}),JSON.stringify(n)}addUsername(e){this.parameters.set("username",encodeURIComponent(e))}addPassword(e){this.parameters.set("password",encodeURIComponent(e))}addPopToken(e){e&&(this.parameters.set(fs,D.POP),this.parameters.set(gs,encodeURIComponent(e)))}addSshJwk(e){e&&(this.parameters.set(fs,D.SSH),this.parameters.set(gs,encodeURIComponent(e)))}addServerTelemetry(e){this.parameters.set("x-client-current-telemetry",e.generateCurrentRequestHeaderValue()),this.parameters.set("x-client-last-telemetry",e.generateLastRequestHeaderValue())}addThrottling(){this.parameters.set("x-ms-lib-capability","retry-after, h429")}addLogoutHint(e){this.parameters.set("logout_hint",encodeURIComponent(e))}addBrokerParameters(e){const t={};t[ys]=e.brokerClientId,t[bs]=e.brokerRedirectUri,this.addExtraQueryParameters(t)}createQueryString(){const e=new Array;return this.parameters.forEach((t,n)=>{e.push(`${n}=${t}`)}),function(e,t,n){if(!t)return;const r=e.get(ds);r&&e.has(ys)&&n?.addFields({embeddedClientId:r,embeddedRedirectUri:e.get(hs)},t)}(this.parameters,this.correlationId,this.performanceClient),e.join("&")}}async function ks(e,t,n,r,o,a,i){i?.addQueueMeasurement(vr,a);const s=Ci.transformCIAMAuthority(Si(e)),c=new Ci(s,t,n,r,o,a,i);try{return await wi(c.resolveEndpointsAsync.bind(c),yr,o,i,a)(),c}catch(e){throw He(te)}}class Cs{constructor(e,t){this.config=function({authOptions:e,systemOptions:t,loggerOptions:n,cacheOptions:r,storageInterface:o,networkInterface:a,cryptoInterface:i,clientCredentials:s,libraryInfo:c,telemetry:l,serverTelemetryManager:u,persistencePlugin:d,serializableCache:h}){const p={...dn,...n};return{authOptions:(f=e,{clientCapabilities:[],azureCloudOptions:mn,skipAuthorityMetadataCache:!1,instanceAware:!1,...f}),systemOptions:{...un,...t},loggerOptions:p,cacheOptions:{...hn,...r},storageInterface:o||new ln(e.clientId,Ke,new B(p)),networkInterface:a||pn,cryptoInterface:i||Ke,clientCredentials:s||gn,libraryInfo:{...fn,...c},telemetry:{...vn,...l},serverTelemetryManager:u||null,persistencePlugin:d||null,serializableCache:h||null};var f}(e),this.logger=new B(this.config.loggerOptions,$e,Ge),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=t}createTokenRequestHeaders(e){const t={};if(t[c]=a.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case zi:try{const n=Bt(e.credential);t[u]=`Oid:${n.uid}@${n.utid}`}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case Li:t[u]=`UPN: ${e.credential}`}return t}async executePostToTokenEndpoint(e,t,n,r,o,a){a&&this.performanceClient?.addQueueMeasurement(a,o);const i=await this.sendPostRequest(r,e,{body:t,headers:n},o);return this.config.serverTelemetryManager&&i.status<500&&429!==i.status&&this.config.serverTelemetryManager.clearTelemetryCache(),i}async sendPostRequest(e,t,n,r){let o;us.preProcess(this.cacheManager,e,r);try{o=await wi(this.networkClient.sendPostRequestAsync.bind(this.networkClient),Mn,this.logger,this.performanceClient,r)(t,n);const e=o.headers||{};this.performanceClient?.addFields({refreshTokenSize:o.body.refresh_token?.length||0,httpVerToken:e[h]||"",requestId:e[d]||""},r)}catch(e){if(e instanceof Ao){const t=e.responseHeaders;throw t&&this.performanceClient?.addFields({httpVerToken:t[h]||"",requestId:t[d]||"",contentTypeHeader:t[c]||void 0,contentLengthHeader:t["Content-Length"]||void 0,httpStatus:e.httpStatus},r),e.error}throw e instanceof Q?e:He(ne)}return us.postProcess(this.cacheManager,e,o,r),o}async updateAuthority(e,t){this.performanceClient?.addQueueMeasurement(cr,t);const n=`https://${e}/${this.authority.tenant}/`,r=await ks(n,this.networkClient,this.cacheManager,this.authority.options,this.logger,t,this.performanceClient);this.authority=r}createTokenQueryParameters(e){const t=new ws(e.correlationId,this.performanceClient);return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenQueryParameters&&t.addExtraQueryParameters(e.tokenQueryParameters),t.addCorrelationId(e.correlationId),t.createQueryString()}}class Ss{constructor(e,t){this.cryptoUtils=e,this.performanceClient=t}async generateCnf(e,t){this.performanceClient?.addQueueMeasurement(pr,e.correlationId);const n=await wi(this.generateKid.bind(this),pr,t,this.performanceClient,e.correlationId)(e),r=this.cryptoUtils.base64UrlEncode(JSON.stringify(n));return{kid:n.kid,reqCnfString:r}}async generateKid(e){return this.performanceClient?.addQueueMeasurement(fr,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:"sw"}}async signPopToken(e,t,n){return this.signPayload(e,t,n)}async signPayload(e,t,n,r){const{resourceRequestMethod:o,resourceRequestUri:a,shrClaims:i,shrNonce:s,shrOptions:c}=n,l=a?new Yt(a):void 0,u=l?.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:Qe(),m:o?.toUpperCase(),u:u?.HostNameAndPort,nonce:s||this.cryptoUtils.createNewGuid(),p:u?.AbsolutePath,q:u?.QueryString?[[],u.QueryString]:void 0,client_claims:i||void 0,...r},t,c,n.correlationId)}}class Ts{constructor(e,t){this.cache=e,this.hasChanged=t}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}class Is{constructor(e,t,n,r,o,a,i){this.clientId=e,this.cacheStorage=t,this.cryptoObj=n,this.logger=r,this.serializableCache=o,this.persistencePlugin=a,this.performanceClient=i}validateServerAuthorizationCodeResponse(e,t){if(!e.state||!t)throw e.state?He(se,"Cached State"):He(se,"Server State");let n,r;try{n=decodeURIComponent(e.state)}catch(t){throw He(ae,e.state)}try{r=decodeURIComponent(t)}catch(t){throw He(ae,e.state)}if(n!==r)throw He(ie);if(e.error||e.error_description||e.suberror){const t=function(e){const t=e.error_uri?.lastIndexOf("code=");return t&&t>=0?e.error_uri?.substring(t+5):void 0}(e);if(Oi(e.error,e.error_description,e.suberror))throw new Pi(e.error||"",e.error_description,e.suberror,e.timestamp||"",e.trace_id||"",e.correlation_id||"",e.claims||"",t);throw new ls(e.error||"",e.error_description,e.suberror,t)}}validateTokenResponse(e,t){if(e.error||e.error_description||e.suberror){const n=`Error(s): ${e.error_codes||a.NOT_AVAILABLE} - Timestamp: ${e.timestamp||a.NOT_AVAILABLE} - Description: ${e.error_description||a.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||a.NOT_AVAILABLE} - Trace ID: ${e.trace_id||a.NOT_AVAILABLE}`,r=e.error_codes?.length?e.error_codes[0]:void 0,o=new ls(e.error,n,e.suberror,r,e.status);if(t&&e.status&&e.status>=500&&e.status<=599)return void this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed.\n${o}`);if(t&&e.status&&e.status>=400&&e.status<=499)return void this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently available but is unable to refresh the access token.\n${o}`);if(Oi(e.error,e.error_description,e.suberror))throw new Pi(e.error,e.error_description,e.suberror,e.timestamp||a.EMPTY_STRING,e.trace_id||a.EMPTY_STRING,e.correlation_id||a.EMPTY_STRING,e.claims||a.EMPTY_STRING,r);throw o}}async handleServerTokenResponse(e,t,n,r,o,i,s,c,l){let u,d;if(this.performanceClient?.addQueueMeasurement(gr,e.correlation_id),e.id_token){if(u=We(e.id_token||a.EMPTY_STRING,this.cryptoObj.base64Decode),o&&o.nonce&&u.nonce!==o.nonce)throw He(ce);if(r.maxAge||0===r.maxAge){const e=u.auth_time;if(!e)throw He(le);Ve(e,r.maxAge)}}this.homeAccountIdentifier=Wt.generateHomeAccountId(e.client_info||a.EMPTY_STRING,t.authorityType,this.logger,this.cryptoObj,u),o&&o.state&&(d=Mi.parseRequestState(this.cryptoObj,o.state)),e.key_id=e.key_id||r.sshKid||void 0;const h=this.generateCacheRecord(e,t,n,r,u,i,o);let p;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),p=new Ts(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(p)),s&&!c&&h.account){const e=h.account.generateAccountKey();if(!this.cacheStorage.getAccount(e,r.correlationId,this.logger))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await Is.generateAuthenticationResult(this.cryptoObj,t,h,!1,r,u,d,void 0,l)}await this.cacheStorage.saveCacheRecord(h,r.correlationId,r.storeInCache)}finally{this.persistencePlugin&&this.serializableCache&&p&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(p))}return Is.generateAuthenticationResult(this.cryptoObj,t,h,!1,r,u,d,e,l)}generateCacheRecord(e,t,n,r,o,a,i){const s=t.getPreferredCache();if(!s)throw He(Ce);const c=Gt(o);let l,u;e.id_token&&o&&(l=Xe(this.homeAccountIdentifier,s,e.id_token,this.clientId,c||""),u=js(this.cacheStorage,t,this.homeAccountIdentifier,this.cryptoObj.base64Decode,r.correlationId,o,e.client_info,s,c,i,void 0,this.logger));let d=null;if(e.access_token){const o=e.scope?Ft.fromString(e.scope):new Ft(r.scopes||[]),i=("string"==typeof e.expires_in?parseInt(e.expires_in,10):e.expires_in)||0,l=("string"==typeof e.ext_expires_in?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,u=("string"==typeof e.refresh_in?parseInt(e.refresh_in,10):e.refresh_in)||void 0,h=n+i,p=h+l,f=u&&u>0?n+u:void 0;d=Ze(this.homeAccountIdentifier,s,e.access_token,this.clientId,c||t.tenant||"",o.printScopes(),h,p,this.cryptoObj.base64Decode,f,e.token_type,a,e.key_id,r.claims,r.requestedClaimsHash)}let h=null;if(e.refresh_token){let t;e.refresh_token_expires_in&&(t=n+("string"==typeof e.refresh_token_expires_in?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in)),h=et(this.homeAccountIdentifier,s,e.refresh_token,this.clientId,e.foci,a,t)}let p=null;return e.foci&&(p={clientId:this.clientId,environment:s,familyId:e.foci}),{account:u,idToken:l,accessToken:d,refreshToken:h,appMetadata:p}}static async generateAuthenticationResult(e,t,n,r,o,i,s,c,l){let u,d,h=a.EMPTY_STRING,p=[],f=null,g=a.EMPTY_STRING;if(n.accessToken){if(n.accessToken.tokenType!==D.POP||o.popKid)h=n.accessToken.secret;else{const t=new Ss(e),{secret:r,keyId:a}=n.accessToken;if(!a)throw He(Me);h=await t.signPopToken(r,a,o)}p=Ft.fromString(n.accessToken.target).asArray(),f=new Date(1e3*Number(n.accessToken.expiresOn)),u=new Date(1e3*Number(n.accessToken.extendedExpiresOn)),n.accessToken.refreshOn&&(d=new Date(1e3*Number(n.accessToken.refreshOn)))}n.appMetadata&&(g=n.appMetadata.familyId===P?P:"");const m=i?.oid||i?.sub||"",v=i?.tid||"";c?.spa_accountid&&n.account&&(n.account.nativeAccountId=c?.spa_accountid);const y=n.account?$t(n.account.getAccountInfo(),void 0,i,n.idToken?.secret):null;return{authority:t.canonicalAuthority,uniqueId:m,tenantId:v,scopes:p,account:y,idToken:n?.idToken?.secret||"",idTokenClaims:i||{},accessToken:h,fromCache:r,expiresOn:f,extExpiresOn:u,refreshOn:d,correlationId:o.correlationId,requestId:l||a.EMPTY_STRING,familyId:g,tokenType:n.accessToken?.tokenType||a.EMPTY_STRING,state:s?s.userRequestState:a.EMPTY_STRING,cloudGraphHostName:n.account?.cloudGraphHostName||a.EMPTY_STRING,msGraphHost:n.account?.msGraphHost||a.EMPTY_STRING,code:c?.spa_code,fromNativeBroker:!1}}}function js(e,t,n,r,o,a,i,s,c,l,u,d){d?.verbose("setCachedAccount called");const h=e.getAccountKeys().find(e=>e.startsWith(n));let p=null;h&&(p=e.getAccount(h,o,d));const f=p||Wt.createAccount({homeAccountId:n,idTokenClaims:a,clientInfo:i,environment:s,cloudGraphHostName:l?.cloud_graph_host_name,msGraphHost:l?.msgraph_host,nativeAccountId:u},t,r),g=f.tenantProfiles||[],m=c||f.realm;if(m&&!g.find(e=>e.tenantId===m)){const e=Kt(n,f.localAccountId,m,a);g.push(e)}return f.tenantProfiles=g,f}async function As(e,t,n){return"string"==typeof e?e:e({clientId:t,tokenEndpoint:n})}class Ns extends Cs{constructor(e,t){super(e,t),this.includeRedirectUri=!0,this.oidcDefaultScopes=this.config.authOptions.authority.options.OIDCOptions?.defaultScopes}async getAuthCodeUrl(e){this.performanceClient?.addQueueMeasurement(ar,e.correlationId);const t=await wi(this.createAuthCodeUrlQueryString.bind(this),hr,this.logger,this.performanceClient,e.correlationId)(e);return Yt.appendQueryString(this.authority.authorizationEndpoint,t)}async acquireToken(e,t){if(this.performanceClient?.addQueueMeasurement(lr,e.correlationId),!e.code)throw He(fe);const n=Qe(),r=await wi(this.executeTokenRequest.bind(this),ur,this.logger,this.performanceClient,e.correlationId)(this.authority,e),o=r.headers?.[d],a=new Is(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return a.validateTokenResponse(r.body),wi(a.handleServerTokenResponse.bind(a),gr,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,n,e,t,void 0,void 0,void 0,o)}handleFragmentResponse(e,t){if(new Is(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null).validateServerAuthorizationCodeResponse(e,t),!e.code)throw He(Pe);return e}getLogoutUri(e){if(!e)throw qt(Ct);const t=this.createLogoutUrlQueryString(e);return Yt.appendQueryString(this.authority.endSessionEndpoint,t)}async executeTokenRequest(e,t){this.performanceClient?.addQueueMeasurement(ur,t.correlationId);const n=this.createTokenQueryParameters(t),r=Yt.appendQueryString(e.tokenEndpoint,n),o=await wi(this.createTokenRequestBody.bind(this),dr,this.logger,this.performanceClient,t.correlationId)(t);let a;if(t.clientInfo)try{const e=Ut(t.clientInfo,this.cryptoUtils.base64Decode);a={credential:`${e.uid}.${e.utid}`,type:zi}}catch(e){this.logger.verbose("Could not parse client info for CCS Header: "+e)}const i=this.createTokenRequestHeaders(a||t.ccsCredential),s={clientId:t.tokenBodyParameters?.clientId||this.config.authOptions.clientId,authority:e.canonicalAuthority,scopes:t.scopes,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid};return wi(this.executePostToTokenEndpoint.bind(this),Ln,this.logger,this.performanceClient,t.correlationId)(r,o,i,s,t.correlationId,Ln)}async createTokenRequestBody(e){this.performanceClient?.addQueueMeasurement(dr,e.correlationId);const t=new ws(e.correlationId,this.performanceClient);if(t.addClientId(e.embeddedClientId||e.tokenBodyParameters?.[ds]||this.config.authOptions.clientId),this.includeRedirectUri?t.addRedirectUri(e.redirectUri):xs.validateRedirectUri(e.redirectUri),t.addScopes(e.scopes,!0,this.oidcDefaultScopes),t.addAuthorizationCode(e.code),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addThrottling(),this.serverTelemetryManager&&!yn(this.config)&&t.addServerTelemetry(this.serverTelemetryManager),e.codeVerifier&&t.addCodeVerifier(e.codeVerifier),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const n=this.config.clientCredentials.clientAssertion;t.addClientAssertion(await As(n.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),t.addClientAssertionType(n.assertionType)}if(t.addGrantType("authorization_code"),t.addClientInfo(),e.authenticationScheme===D.POP){const n=new Ss(this.cryptoUtils,this.performanceClient);let r;r=e.popKid?this.cryptoUtils.encodeKid(e.popKid):(await wi(n.generateCnf.bind(n),pr,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,t.addPopToken(r)}else if(e.authenticationScheme===D.SSH){if(!e.sshJwk)throw qt(Nt);t.addSshJwk(e.sshJwk)}let n;if((!Dt.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(e.claims,this.config.authOptions.clientCapabilities),e.clientInfo)try{const t=Ut(e.clientInfo,this.cryptoUtils.base64Decode);n={credential:`${t.uid}.${t.utid}`,type:zi}}catch(e){this.logger.verbose("Could not parse client info for CCS Header: "+e)}else n=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&n)switch(n.type){case zi:try{const e=Bt(n.credential);t.addCcsOid(e)}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case Li:t.addCcsUpn(n.credential)}return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&t.addExtraQueryParameters(e.tokenBodyParameters),!e.enableSpaAuthorizationCode||e.tokenBodyParameters&&e.tokenBodyParameters[ms]||t.addExtraQueryParameters({[ms]:"1"}),t.createQueryString()}async createAuthCodeUrlQueryString(e){const t=e.correlationId||this.config.cryptoInterface.createNewGuid();this.performanceClient?.addQueueMeasurement(hr,t);const n=new ws(t,this.performanceClient);n.addClientId(e.embeddedClientId||e.extraQueryParameters?.[ds]||this.config.authOptions.clientId);const r=[...e.scopes||[],...e.extraScopesToConsent||[]];if(n.addScopes(r,!0,this.oidcDefaultScopes),n.addRedirectUri(e.redirectUri),n.addCorrelationId(t),n.addResponseMode(e.responseMode),n.addResponseTypeCode(),n.addLibraryInfo(this.config.libraryInfo),yn(this.config)||n.addApplicationTelemetry(this.config.telemetry.application),n.addClientInfo(),e.codeChallenge&&e.codeChallengeMethod&&n.addCodeChallengeParams(e.codeChallenge,e.codeChallengeMethod),e.prompt&&n.addPrompt(e.prompt),e.domainHint&&n.addDomainHint(e.domainHint),e.prompt!==S.SELECT_ACCOUNT)if(e.sid&&e.prompt===S.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),n.addSid(e.sid);else if(e.account){const t=this.extractAccountSid(e.account);let r=this.extractLoginHint(e.account);if(r&&e.domainHint&&(this.logger.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),r=null),r){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),n.addLoginHint(r);try{const t=Bt(e.account.homeAccountId);n.addCcsOid(t)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(t&&e.prompt===S.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),n.addSid(t);try{const t=Bt(e.account.homeAccountId);n.addCcsOid(t)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),n.addLoginHint(e.loginHint),n.addCcsUpn(e.loginHint);else if(e.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),n.addLoginHint(e.account.username);try{const t=Bt(e.account.homeAccountId);n.addCcsOid(t)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),n.addLoginHint(e.loginHint),n.addCcsUpn(e.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");if(e.nonce&&n.addNonce(e.nonce),e.state&&n.addState(e.state),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&n.addClaims(e.claims,this.config.authOptions.clientCapabilities),e.embeddedClientId&&n.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),this.addExtraQueryParams(e,n),e.nativeBroker&&(n.addNativeBroker(),e.authenticationScheme===D.POP)){const t=new Ss(this.cryptoUtils);let r;r=e.popKid?this.cryptoUtils.encodeKid(e.popKid):(await wi(t.generateCnf.bind(t),pr,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,n.addPopToken(r)}return n.createQueryString()}createLogoutUrlQueryString(e){const t=new ws(e.correlationId,this.performanceClient);return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),this.addExtraQueryParams(e,t),t.createQueryString()}addExtraQueryParams(e,t){!(e.extraQueryParameters&&e.extraQueryParameters.hasOwnProperty("instance_aware"))&&this.config.authOptions.instanceAware&&(e.extraQueryParameters=e.extraQueryParameters||{},e.extraQueryParameters.instance_aware="true"),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters)}extractAccountSid(e){return e.idTokenClaims?.sid||null}extractLoginHint(e){return e.idTokenClaims?.login_hint||null}}class Es{constructor(e,t){this.cacheOutcome="0",this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||a.EMPTY_STRING,this.wrapperVer=e.wrapperVer||a.EMPTY_STRING,this.telemetryCacheKey=q.CACHE_KEY+N+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${q.VALUE_SEPARATOR}${this.cacheOutcome}`,t=[this.wrapperSKU,this.wrapperVer],n=this.getNativeBrokerErrorCode();n?.length&&t.push(`broker_error=${n}`);const r=t.join(q.VALUE_SEPARATOR),o=[e,this.getRegionDiscoveryFields()].join(q.VALUE_SEPARATOR);return[q.SCHEMA_VERSION,o,r].join(q.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),t=Es.maxErrorsToSend(e),n=e.failedRequests.slice(0,2*t).join(q.VALUE_SEPARATOR),r=e.errors.slice(0,t).join(q.VALUE_SEPARATOR),o=e.errors.length,a=[o,t<o?q.OVERFLOW_TRUE:q.OVERFLOW_FALSE].join(q.VALUE_SEPARATOR);return[q.SCHEMA_VERSION,e.cacheHits,n,r,a].join(q.CATEGORY_SEPARATOR)}cacheFailedRequest(e){const t=this.getLastRequests();t.errors.length>=q.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof Q?e.subError?t.errors.push(e.subError):e.errorCode?t.errors.push(e.errorCode):t.errors.push(e.toString()):t.errors.push(e.toString()):t.errors.push(q.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t,this.correlationId)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId),e.cacheHits}getLastRequests(){return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||{failedRequests:[],errors:[],cacheHits:0}}clearTelemetryCache(){const e=this.getLastRequests(),t=Es.maxErrorsToSend(e);if(t===e.errors.length)this.cacheManager.removeItem(this.telemetryCacheKey,this.correlationId);else{const n={failedRequests:e.failedRequests.slice(2*t),errors:e.errors.slice(t),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,n,this.correlationId)}}static maxErrorsToSend(e){let t,n=0,r=0;const o=e.errors.length;for(t=0;t<o;t++){const o=e.failedRequests[2*t]||a.EMPTY_STRING,i=e.failedRequests[2*t+1]||a.EMPTY_STRING,s=e.errors[t]||a.EMPTY_STRING;if(r+=o.toString().length+i.toString().length+s.length+3,!(r<q.MAX_LAST_HEADER_BYTES))break;n+=1}return n}getRegionDiscoveryFields(){const e=[];return e.push(this.regionUsed||a.EMPTY_STRING),e.push(this.regionSource||a.EMPTY_STRING),e.push(this.regionOutcome||a.EMPTY_STRING),e.join(",")}updateRegionDiscoveryMetadata(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome}setCacheOutcome(e){this.cacheOutcome=e}setNativeBrokerErrorCode(e){const t=this.getLastRequests();t.nativeBrokerErrorCode=e,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t,this.correlationId)}getNativeBrokerErrorCode(){return this.getLastRequests().nativeBrokerErrorCode}clearNativeBrokerErrorCode(){const e=this.getLastRequests();delete e.nativeBrokerErrorCode,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId)}static makeExtraSkuString(e){return function(e){const{skus:t,libraryName:n,libraryVersion:r,extensionName:o,extensionVersion:a}=e,i=new Map([[0,[n,r]],[2,[o,a]]]);let s=[];if(t?.length){if(s=t.split(","),s.length<4)return t}else s=Array.from({length:4},()=>"|");return i.forEach((e,t)=>{2===e.length&&e[0]?.length&&e[1]?.length&&function(e){const{skuArr:t,index:n,skuName:r,skuVersion:o}=e;n>=t.length||(t[n]=[r,o].join("|"))}({skuArr:s,index:t,skuName:e[0],skuVersion:e[1]})}),s.join(",")}(e)}}class _s{constructor(e,t,n,r,o,a,i,s,c){this.config=e,this.browserStorage=t,this.browserCrypto=n,this.networkClient=this.config.system.networkClient,this.eventHandler=o,this.navigationClient=a,this.nativeMessageHandler=s,this.correlationId=c||Ha(),this.logger=r.clone(Kr,ai,this.correlationId),this.performanceClient=i}async clearCacheOnLogout(e){if(e){Wt.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(this.correlationId),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null,this.correlationId));try{await this.browserStorage.removeAccount(Wt.generateAccountCacheKey(e),this.correlationId),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch(e){this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),await this.browserStorage.clear(this.correlationId),await this.browserCrypto.clearKeystore()}catch(e){this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const t=e||this.config.auth.redirectUri;return Yt.getAbsoluteUrl(t,Za())}initializeServerTelemetryManager(e,t){this.logger.verbose("initializeServerTelemetryManager called");const n={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Es(n,this.browserStorage)}async getDiscoveredAuthority(e){const{account:t}=e,n=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(Pn,this.correlationId);const r={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},o=e.requestAuthority||this.config.auth.authority,a=n?.length?"true"===n:this.config.auth.instanceAware,i=t&&a?this.config.auth.authority.replace(Yt.getDomainFromUrl(o),t.environment):o,s=Ci.generateAuthority(i,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),c=await wi(ks,vr,this.logger,this.performanceClient,this.correlationId)(s,this.config.system.networkClient,this.browserStorage,r,this.logger,this.correlationId,this.performanceClient);if(t&&!c.isAlias(t.environment))throw qt(Mt);return c}}async function Ps(e,t,n){e.addQueueMeasurement(Rr,n);const r=xi(Os,Mr,t,e,n)(e,t,n);return{verifier:r,challenge:await wi(Rs,zr,t,e,n)(r,e,t,n)}}function Os(e,t,n){try{const r=new Uint8Array(32);return xi(Ua,qr,t,e,n)(r),Pa(r)}catch(e){throw ja(Eo)}}async function Rs(e,t,n,r){t.addQueueMeasurement(zr,r);try{const o=await wi(Fa,Lr,n,t,r)(e,t,r);return Pa(new Uint8Array(o))}catch(e){throw ja(Eo)}}async function Ms(e,t,n,r){n.addQueueMeasurement(Wn,e.correlationId);const o=e.authority||t.auth.authority,a=[...e&&e.scopes||[]],i={...e,correlationId:e.correlationId,authority:o,scopes:a};if(i.authenticationScheme){if(i.authenticationScheme===D.SSH){if(!e.sshJwk)throw qt(Nt);if(!e.sshKid)throw qt(Et)}r.verbose(`Authentication Scheme set to "${i.authenticationScheme}" as configured in Auth request`)}else i.authenticationScheme=D.BEARER,r.verbose('Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request');return t.cache.claimsBasedCachingEnabled&&e.claims&&!Dt.isEmptyObj(e.claims)&&(i.requestedClaimsHash=await $a(e.claims)),i}async function zs(e,t,n,r,o){r.addQueueMeasurement(Vn,e.correlationId);const a=await wi(Ms,Wn,o,r,e.correlationId)(e,n,r,o);return{...e,...a,account:t,forceRefresh:e.forceRefresh||!1}}class Ls extends _s{async initializeAuthorizationCodeRequest(e){this.performanceClient.addQueueMeasurement(or,this.correlationId);const t=await wi(Ps,Rr,this.logger,this.performanceClient,this.correlationId)(this.performanceClient,this.logger,this.correlationId),n={...e,redirectUri:e.redirectUri,code:a.EMPTY_STRING,codeVerifier:t.verifier};return e.codeChallenge=t.challenge,e.codeChallengeMethod=a.S256_CODE_CHALLENGE_METHOD,n}initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e?.correlationId);const t={correlationId:this.correlationId||Ha(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const n=this.getLogoutHintFromIdTokenClaims(e.account);n&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),t.logoutHint=n)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return e&&null===e.postLogoutRedirectUri?this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",t.correlationId):e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",t.correlationId),t.postLogoutRedirectUri=Yt.getAbsoluteUrl(e.postLogoutRedirectUri,Za())):null===this.config.auth.postLogoutRedirectUri?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",t.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",t.correlationId),t.postLogoutRedirectUri=Yt.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,Za())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",t.correlationId),t.postLogoutRedirectUri=Yt.getAbsoluteUrl(Za(),Za())),t}getLogoutHintFromIdTokenClaims(e){const t=e.idTokenClaims;if(t){if(t.login_hint)return t.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(tr,this.correlationId);const t=await wi(this.getClientConfiguration.bind(this),nr,this.logger,this.performanceClient,this.correlationId)(e);return new Ns(t,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:t,requestAuthority:n,requestAzureCloudOptions:r,requestExtraQueryParameters:o,account:i}=e;this.performanceClient.addQueueMeasurement(nr,this.correlationId);const s=await wi(this.getDiscoveredAuthority.bind(this),Pn,this.logger,this.performanceClient,this.correlationId)({requestAuthority:n,requestAzureCloudOptions:r,requestExtraQueryParameters:o,account:i}),c=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:s,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:c.loggerCallback,piiLoggingEnabled:c.piiLoggingEnabled,logLevel:c.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:t,libraryInfo:{sku:Kr,version:ai,cpu:a.EMPTY_STRING,os:a.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,t){this.performanceClient.addQueueMeasurement(rr,this.correlationId);const n=this.getRedirectUri(e.redirectUri),r={interactionType:t},o=Mi.setRequestState(this.browserCrypto,e&&e.state||a.EMPTY_STRING,r),i={...await wi(Ms,Wn,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:n,state:o,nonce:e.nonce||Ha(),responseMode:this.config.auth.OIDCOptions.serverResponseType};if(e.loginHint||e.sid)return i;const s=e.account||this.browserStorage.getActiveAccount(this.correlationId);if(s&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${s.homeAccountId}`,this.correlationId),i.account=s),!i.loginHint&&!s){const e=this.browserStorage.getLegacyLoginHint();e&&(i.loginHint=e)}return i}}const qs="user_switch",Ds={[qs]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class Fs extends Q{constructor(e,t,n){super(e,t),Object.setPrototypeOf(this,Fs.prototype),this.name="NativeAuthError",this.ext=n}}function Us(e){return!(!e.ext||!e.ext.status||"PERSISTENT_ERROR"!==e.ext.status&&"DISABLED"!==e.ext.status)||!(!e.ext||!e.ext.error||-2147186943!==e.ext.error)||"ContentError"===e.errorCode}function Bs(e,t,n){if(n&&n.status)switch(n.status){case"ACCOUNT_UNAVAILABLE":return Ri(Ii);case"USER_INTERACTION_REQUIRED":return new Pi(e,t);case"USER_CANCEL":return ja(Uo);case"NO_NETWORK":return ja(oa)}return new Fs(e,Ds[e]||t,n)}class Hs extends Cs{constructor(e,t){super(e,t)}async acquireToken(e){this.performanceClient?.addQueueMeasurement(Dn,e.correlationId);const t=Qe(),n=await wi(this.executeTokenRequest.bind(this),qn,this.logger,this.performanceClient,e.correlationId)(e,this.authority),r=n.headers?.[d],o=new Is(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return o.validateTokenResponse(n.body),wi(o.handleServerTokenResponse.bind(o),gr,this.logger,this.performanceClient,e.correlationId)(n.body,this.authority,t,e,void 0,void 0,!0,e.forceCache,r)}async acquireTokenByRefreshToken(e){if(!e)throw qt(kt);if(this.performanceClient?.addQueueMeasurement(Un,e.correlationId),!e.account)throw He(we);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await wi(this.acquireTokenWithCachedRefreshToken.bind(this),Fn,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(t){const n=t instanceof Pi&&t.errorCode===Ti,r=t instanceof ls&&"invalid_grant"===t.errorCode&&"client_mismatch"===t.subError;if(n||r)return wi(this.acquireTokenWithCachedRefreshToken.bind(this),Fn,this.logger,this.performanceClient,e.correlationId)(e,!1);throw t}return wi(this.acquireTokenWithCachedRefreshToken.bind(this),Fn,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,t){this.performanceClient?.addQueueMeasurement(Fn,e.correlationId);const n=xi(this.cacheManager.getRefreshToken.bind(this.cacheManager),Or,this.logger,this.performanceClient,e.correlationId)(e.account,t,e.correlationId,void 0,this.performanceClient);if(!n)throw Ri(Ti);if(n.expiresOn&&Ye(n.expiresOn,e.refreshTokenExpirationOffsetSeconds||300))throw Ri(ji);const r={...e,refreshToken:n.secret,authenticationScheme:e.authenticationScheme||D.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:zi}};try{return await wi(this.acquireToken.bind(this),Dn,this.logger,this.performanceClient,e.correlationId)(r)}catch(t){if(t instanceof Pi&&t.subError===Ai){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const t=Je(n);this.cacheManager.removeRefreshToken(t,e.correlationId)}throw t}}async executeTokenRequest(e,t){this.performanceClient?.addQueueMeasurement(qn,e.correlationId);const n=this.createTokenQueryParameters(e),r=Yt.appendQueryString(t.tokenEndpoint,n),o=await wi(this.createTokenRequestBody.bind(this),Bn,this.logger,this.performanceClient,e.correlationId)(e),a=this.createTokenRequestHeaders(e.ccsCredential),i={clientId:e.tokenBodyParameters?.clientId||this.config.authOptions.clientId,authority:t.canonicalAuthority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid};return wi(this.executePostToTokenEndpoint.bind(this),zn,this.logger,this.performanceClient,e.correlationId)(r,o,a,i,e.correlationId,zn)}async createTokenRequestBody(e){this.performanceClient?.addQueueMeasurement(Bn,e.correlationId);const t=e.correlationId,n=new ws(t,this.performanceClient);if(n.addClientId(e.embeddedClientId||e.tokenBodyParameters?.[ds]||this.config.authOptions.clientId),e.redirectUri&&n.addRedirectUri(e.redirectUri),n.addScopes(e.scopes,!0,this.config.authOptions.authority.options.OIDCOptions?.defaultScopes),n.addGrantType("refresh_token"),n.addClientInfo(),n.addLibraryInfo(this.config.libraryInfo),n.addApplicationTelemetry(this.config.telemetry.application),n.addThrottling(),this.serverTelemetryManager&&!yn(this.config)&&n.addServerTelemetry(this.serverTelemetryManager),n.addRefreshToken(e.refreshToken),this.config.clientCredentials.clientSecret&&n.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const t=this.config.clientCredentials.clientAssertion;n.addClientAssertion(await As(t.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),n.addClientAssertionType(t.assertionType)}if(e.authenticationScheme===D.POP){const t=new Ss(this.cryptoUtils,this.performanceClient);let r;r=e.popKid?this.cryptoUtils.encodeKid(e.popKid):(await wi(t.generateCnf.bind(t),pr,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,n.addPopToken(r)}else if(e.authenticationScheme===D.SSH){if(!e.sshJwk)throw qt(Nt);n.addSshJwk(e.sshJwk)}if((!Dt.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&n.addClaims(e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case zi:try{const t=Bt(e.ccsCredential.credential);n.addCcsOid(t)}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case Li:n.addCcsUpn(e.ccsCredential.credential)}return e.embeddedClientId&&n.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&n.addExtraQueryParameters(e.tokenBodyParameters),n.createQueryString()}}class Ks extends Cs{constructor(e,t){super(e,t)}async acquireToken(e){try{const[t,n]=await this.acquireCachedToken({...e,scopes:e.scopes?.length?e.scopes:[...i]});return"4"===n&&(this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."),new Hs(this.config,this.performanceClient).acquireTokenByRefreshToken(e).catch(()=>{})),t}catch(t){if(t instanceof Be&&t.errorCode===Ne)return new Hs(this.config,this.performanceClient).acquireTokenByRefreshToken(e);throw t}}async acquireCachedToken(e){this.performanceClient?.addQueueMeasurement(Kn,e.correlationId);let t="0";if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!Dt.isEmptyObj(e.claims))throw this.setCacheOutcome("1",e.correlationId),He(Ne);if(!e.account)throw He(we);const n=e.account.tenantId||function(e){const t=new Yt(e).getUrlComponents(),n=t.PathSegments.slice(-1)[0]?.toLowerCase();switch(n){case x:case w:case k:return;default:return n}}(e.authority),r=this.cacheManager.getTokenKeys(),o=this.cacheManager.getAccessToken(e.account,e,r,n,this.performanceClient);if(!o)throw this.setCacheOutcome("2",e.correlationId),He(Ne);if(a=o.cachedAt,Number(a)>Qe()||Ye(o.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome("3",e.correlationId),He(Ne);var a;o.refreshOn&&Ye(o.refreshOn,0)&&(t="4");const i=e.authority||this.authority.getPreferredCache(),s={account:this.cacheManager.readAccountFromCache(e.account,e.correlationId),accessToken:o,idToken:this.cacheManager.getIdToken(e.account,e.correlationId,r,n,this.performanceClient),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(i)};return this.setCacheOutcome(t,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await wi(this.generateResultFromCacheRecord.bind(this),$n,this.logger,this.performanceClient,e.correlationId)(s,e),t]}setCacheOutcome(e,t){this.serverTelemetryManager?.setCacheOutcome(e),this.performanceClient?.addFields({cacheOutcome:e},t),"0"!==e&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,t){let n;if(this.performanceClient?.addQueueMeasurement($n,t.correlationId),e.idToken&&(n=We(e.idToken.secret,this.config.cryptoInterface.base64Decode)),t.maxAge||0===t.maxAge){const e=n?.auth_time;if(!e)throw He(le);Ve(e,t.maxAge)}return Is.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,t,n)}}class $s extends Ls{async acquireToken(e){this.performanceClient.addQueueMeasurement(An,e.correlationId);const t=this.initializeServerTelemetryManager(61),n=await wi(this.getClientConfiguration.bind(this),nr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),r=new Ks(n,this.performanceClient);this.logger.verbose("Silent auth client created");try{const t=(await wi(r.acquireCachedToken.bind(r),Kn,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),t}catch(e){throw e instanceof Ia&&e.errorCode===la&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),e}}logout(e){this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(t?.account)}}class Gs extends _s{constructor(e,t,n,r,o,a,i,s,c,l,u,d){super(e,t,n,r,o,a,s,c,d),this.apiId=i,this.accountId=l,this.nativeMessageHandler=c,this.nativeStorageManager=u,this.silentCacheClient=new $s(e,this.nativeStorageManager,n,r,o,a,s,c,d),this.serverTelemetryManager=this.initializeServerTelemetryManager(this.apiId);const h=this.nativeMessageHandler.getExtensionId()===Gr?"chrome":this.nativeMessageHandler.getExtensionId()?.length?"unknown":void 0;this.skus=Es.makeExtraSkuString({libraryName:Kr,libraryVersion:ai,extensionName:h,extensionVersion:this.nativeMessageHandler.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[vs]:this.skus}}async acquireToken(e){this.performanceClient.addQueueMeasurement(Rn,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const t=this.performanceClient.startMeasurement(Rn,e.correlationId),n=Qe();try{const r=await this.initializeNativeRequest(e);try{const e=await this.acquireTokensFromCache(this.accountId,r);return t.end({success:!0,isNativeBroker:!1,fromCache:!0}),e}catch(e){this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const{...o}=r,a={method:Vr,request:o},i=await this.nativeMessageHandler.sendMessage(a),s=this.validateNativeResponse(i);return await this.handleNativeResponse(s,r,n).then(e=>(t.end({success:!0,isNativeBroker:!0,requestId:e.requestId}),this.serverTelemetryManager.clearNativeBrokerErrorCode(),e)).catch(e=>{throw t.end({success:!1,errorCode:e.errorCode,subErrorCode:e.subError,isNativeBroker:!0}),e})}catch(e){throw e instanceof Fs&&this.serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode),e}}createSilentCacheRequest(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:Ft.fromString(e.scope).asArray(),account:t,forceRefresh:!1}}async acquireTokensFromCache(e,t){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),He(Se);const n=this.browserStorage.getBaseAccountInfo({nativeAccountId:e},t.correlationId);if(!n)throw He(Se);try{const e=this.createSilentCacheRequest(t,n),r=await this.silentCacheClient.acquireToken(e),o={...n,idTokenClaims:r?.idTokenClaims,idToken:r?.idToken};return{...r,account:o}}catch(e){throw e}}async acquireTokenRedirect(e,t){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...n}=e;delete n.onRedirectNavigate;const r=await this.initializeNativeRequest(n),o={method:Vr,request:r};try{const e=await this.nativeMessageHandler.sendMessage(o);this.validateNativeResponse(e)}catch(e){if(e instanceof Fs&&(this.serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode),Us(e)))throw e}this.browserStorage.setTemporaryCache(ao,JSON.stringify(r),!0);const a={apiId:ho,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},i=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);t.end({success:!0}),await this.navigationClient.navigateExternal(i,a)}async handleRedirectPromise(e,t){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const n=this.browserStorage.getCachedNativeRequest();if(!n)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&t&&e?.addFields({errorCode:"no_cached_request"},t),null;const{prompt:r,...o}=n;r&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(ao));const a={method:Vr,request:o},i=Qe();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const e=await this.nativeMessageHandler.sendMessage(a);this.validateNativeResponse(e);const t=this.handleNativeResponse(e,o,i);this.browserStorage.setInteractionInProgress(!1);const n=await t;return this.serverTelemetryManager.clearNativeBrokerErrorCode(),n}catch(e){throw this.browserStorage.setInteractionInProgress(!1),e}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,t,n){this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const r=We(e.id_token,fi),o=this.createHomeAccountIdentifier(e,r),a=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:t.accountId},this.correlationId)?.homeAccountId;if(o!==a&&e.account.id!==t.accountId)throw Bs(qs);const i=await this.getDiscoveredAuthority({requestAuthority:t.authority}),s=js(this.browserStorage,i,o,fi,this.correlationId,r,e.client_info,void 0,r.tid,void 0,e.account.id,this.logger),c=await this.generateAuthenticationResult(e,t,r,s,i.canonicalAuthority,n);return this.cacheAccount(s),this.cacheNativeTokens(e,t,o,r,e.access_token,c.tenantId,n),c}createHomeAccountIdentifier(e,t){return Wt.generateHomeAccountId(e.client_info||a.EMPTY_STRING,0,this.logger,this.browserCrypto,t)}generateScopes(e,t){return e.scope?Ft.fromString(e.scope):Ft.fromString(t.scope)}async generatePopAccessToken(e,t){if(t.tokenType===D.POP&&t.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const n=new Ss(this.browserCrypto),r={resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,shrNonce:t.shrNonce};if(!t.keyId)throw He(Me);return n.signPopToken(e.access_token,t.keyId,r)}return e.access_token}async generateAuthenticationResult(e,t,n,r,o,i){const s=this.addTelemetryFromNativeResponse(e),c=e.scope?Ft.fromString(e.scope):Ft.fromString(t.scope),l=e.account.properties||{},u=l.UID||n.oid||n.sub||a.EMPTY_STRING,d=l.TenantId||n.tid||a.EMPTY_STRING,h=$t(r.getAccountInfo(),void 0,n,e.id_token);h.nativeAccountId!==e.account.id&&(h.nativeAccountId=e.account.id);const p=await this.generatePopAccessToken(e,t),f=t.tokenType===D.POP?D.POP:D.BEARER;return{authority:o,uniqueId:u,tenantId:d,scopes:c.asArray(),account:h,idToken:e.id_token,idTokenClaims:n,accessToken:p,fromCache:!!s&&this.isResponseFromCache(s),expiresOn:new Date(1e3*Number(i+e.expires_in)),tokenType:f,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}cacheAccount(e){this.browserStorage.setAccount(e,this.correlationId),this.browserStorage.removeAccountContext(e,this.correlationId).catch(e=>{this.logger.error(`Error occurred while removing account context from browser storage. ${e}`)})}cacheNativeTokens(e,t,n,r,o,i,s){const c=Xe(n,t.authority,e.id_token||"",t.clientId,r.tid||""),l=s+(t.tokenType===D.POP?a.SHR_NONCE_VALIDITY:("string"==typeof e.expires_in?parseInt(e.expires_in,10):e.expires_in)||0),u=this.generateScopes(e,t),d={idToken:c,accessToken:Ze(n,t.authority,o,t.clientId,r.tid||i,u.printScopes(),l,0,fi,void 0,t.tokenType,void 0,t.keyId)};this.nativeStorageManager.saveCacheRecord(d,t.correlationId,t.storeInCache)}addTelemetryFromNativeResponse(e){const t=this.getMATSFromResponse(e);return t?(this.performanceClient.addFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:t.broker_version,matsAccountJoinOnStart:t.account_join_on_start,matsAccountJoinOnEnd:t.account_join_on_end,matsDeviceJoin:t.device_join,matsPromptBehavior:t.prompt_behavior,matsApiErrorCode:t.api_error_code,matsUiVisible:t.ui_visible,matsSilentCode:t.silent_code,matsSilentBiSubCode:t.silent_bi_sub_code,matsSilentMessage:t.silent_message,matsSilentStatus:t.silent_status,matsHttpStatus:t.http_status,matsHttpEventCount:t.http_event_count},this.correlationId),t):null}validateNativeResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw Y(G,"Response missing expected properties.")}getMATSFromResponse(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}catch(e){this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return void 0===e.is_cached?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const t=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:t,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const n=new Yt(t);n.validateAsUri();const{scopes:r,...o}=e,a=new Ft(r||[]);a.appendScopes(i);const s={...o,accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:a.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:(()=>{switch(this.apiId){case 863:case 61:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),S.NONE}if(e.prompt)switch(e.prompt){case S.NONE:case S.CONSENT:case S.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e.prompt;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e.prompt} is not compatible with native flow`),ja(ba)}else this.logger.trace("initializeNativeRequest: prompt was not provided")})(),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(s.signPopToken&&e.popKid)throw ja(wa);if(this.handleExtraBrokerParams(s),s.extraParameters=s.extraParameters||{},s.extraParameters.telemetry="MATS",e.authenticationScheme===D.POP){const t={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},n=new Ss(this.browserCrypto);let r;if(s.keyId)r=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:s.keyId})),s.signPopToken=!1;else{const o=await wi(n.generateCnf.bind(n),pr,this.logger,this.performanceClient,e.correlationId)(t,this.logger);r=o.reqCnfString,s.keyId=o.kid,s.signPopToken=!0}s.reqCnf=r}return this.addRequestSKUs(s),s}handleExtraBrokerParams(e){const t=e.extraParameters&&e.extraParameters.hasOwnProperty(ys)&&e.extraParameters.hasOwnProperty(bs)&&e.extraParameters.hasOwnProperty(ds);if(!e.embeddedClientId&&!t)return;let n="";const r=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,n=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[bs],n=e.extraParameters[ds]),e.extraParameters={child_client_id:n,child_redirect_uri:r},this.performanceClient?.addFields({embeddedClientId:n,embeddedRedirectUri:r},e.correlationId)}}class Ws{constructor(e,t,n,r){this.logger=e,this.handshakeTimeoutMs=t,this.extensionId=r,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=n,this.handshakeEvent=n.startMeasurement(Er)}async sendMessage(e){this.logger.trace("NativeMessageHandler - sendMessage called.");const t={channel:$r,extensionId:this.extensionId,responseId:Ha(),body:e};return this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii(`NativeMessageHandler - Sending request to browser extension: ${JSON.stringify(t)}`),this.messageChannel.port1.postMessage(t),new Promise((e,n)=>{this.resolvers.set(t.responseId,{resolve:e,reject:n})})}static async createProvider(e,t,n){e.trace("NativeMessageHandler - createProvider called.");try{const r=new Ws(e,t,n,Gr);return await r.sendHandshakeRequest(),r}catch(r){const o=new Ws(e,t,n);return await o.sendHandshakeRequest(),o}}async sendHandshakeRequest(){this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:$r,extensionId:this.extensionId,responseId:Ha(),body:{method:Wr}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=e=>{this.onChannelMessage(e)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((t,n)=>{this.handshakeResolvers.set(e.responseId,{resolve:t,reject:n}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),n(ja(ga)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window)return;const t=e.data;if(t.channel&&t.channel===$r&&(!t.extensionId||t.extensionId===this.extensionId)&&t.body.method===Wr){const e=this.handshakeResolvers.get(t.responseId);if(!e)return void this.logger.trace(`NativeMessageHandler.onWindowMessage - resolver can't be found for request ${t.responseId}`);this.logger.verbose(t.extensionId?`Extension with id: ${t.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),e.reject(ja(ma))}}onChannelMessage(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");const t=e.data,n=this.resolvers.get(t.responseId),r=this.handshakeResolvers.get(t.responseId);try{const e=t.body.method;if("Response"===e){if(!n)return;const e=t.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii(`NativeMessageHandler - Received response from browser extension: ${JSON.stringify(e)}`),"Success"!==e.status)n.reject(Bs(e.code,e.description,e.ext));else{if(!e.result)throw Y(G,"Event does not contain result.");e.result.code&&e.result.description?n.reject(Bs(e.result.code,e.result.description,e.result.ext)):n.resolve(e.result)}this.resolvers.delete(t.responseId)}else if("HandshakeResponse"===e){if(!r)return void this.logger.trace(`NativeMessageHandler.onChannelMessage - resolver can't be found for request ${t.responseId}`);clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=t.extensionId,this.extensionVersion=t.body.version,this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),r.resolve(),this.handshakeResolvers.delete(t.responseId)}}catch(t){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${t}`),this.logger.errorPii(`Unable to parse ${e}`),n?n.reject(t):r&&r.reject(t)}}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}static isNativeAvailable(e,t,n,r){if(t.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return t.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!n)return t.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(r)switch(r){case D.BEARER:case D.POP:return t.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return t.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0}}class Vs{constructor(e,t,n,r,o){this.authModule=e,this.browserStorage=t,this.authCodeRequest=n,this.logger=r,this.performanceClient=o}async handleCodeResponse(e,t){let n;this.performanceClient.addQueueMeasurement(sr,t.correlationId);try{n=this.authModule.handleFragmentResponse(e,t.state)}catch(e){throw e instanceof ls&&e.subError===Uo?ja(Uo):e}return wi(this.handleCodeResponseFromServer.bind(this),ir,this.logger,this.performanceClient,t.correlationId)(n,t)}async handleCodeResponseFromServer(e,t,n=!0){if(this.performanceClient.addQueueMeasurement(ir,t.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await wi(this.authModule.updateAuthority.bind(this.authModule),cr,this.logger,this.performanceClient,t.correlationId)(e.cloud_instance_host_name,t.correlationId),n&&(e.nonce=t.nonce||void 0),e.state=t.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const e=this.createCcsCredentials(t);e&&(this.authCodeRequest.ccsCredential=e)}return await wi(this.authModule.acquireToken.bind(this.authModule),lr,this.logger,this.performanceClient,t.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:zi}:e.loginHint?{credential:e.loginHint,type:Li}:null}}function Qs(e,t,n){const r=Qt(e);if(!r)throw Vt(e)?(n.error(`A ${t} is present in the iframe but it does not contain known properties. It's likely that the ${t} has been replaced by code running on the redirectUri page.`),n.errorPii(`The ${t} detected is: ${e}`),ja(Mo)):(n.error(`The request has returned to the redirectUri but a ${t} is not present. It's likely that the ${t} has been removed or the page has been redirected by code running on the redirectUri page.`),ja(Oo));return r}class Ys extends Ls{constructor(e,t,n,r,o,a,i,s,c,l){super(e,t,n,r,o,a,i,c,l),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=s}acquireToken(e){try{const t={popupName:this.generatePopupName(e.scopes||i,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,t)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),t.popup=this.openSizedPopup("about:blank",t),this.acquireTokenPopupAsync(e,t))}catch(e){return Promise.reject(e)}}logout(e){try{this.logger.verbose("logoutPopup called");const t=this.initializeLogoutRequest(e),n={popupName:this.generateLogoutPopupName(t),popupWindowAttributes:e?.popupWindowAttributes||{},popupWindowParent:e?.popupWindowParent??window},r=e&&e.authority,o=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(t,n,r,o)):(this.logger.verbose("asyncPopup set to false, opening popup"),n.popup=this.openSizedPopup("about:blank",n),this.logoutPopupAsync(t,n,r,o))}catch(e){return Promise.reject(e)}}async acquireTokenPopupAsync(e,t){this.logger.verbose("acquireTokenPopupAsync called");const n=this.initializeServerTelemetryManager(po),r=await wi(this.initializeAuthorizationRequest.bind(this),rr,this.logger,this.performanceClient,this.correlationId)(e,fo.Popup);oi(r.authority);try{const o=await wi(this.initializeAuthorizationCodeRequest.bind(this),or,this.logger,this.performanceClient,this.correlationId)(r),a=await wi(this.createAuthCodeClient.bind(this),tr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:r.authority,requestAzureCloudOptions:r.azureCloudOptions,requestExtraQueryParameters:r.extraQueryParameters,account:r.account}),i=Ws.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme);let s;i&&(s=this.performanceClient.startMeasurement(On,e.correlationId));const c=await a.getAuthCodeUrl({...r,nativeBroker:i}),l=new Vs(a,this.browserStorage,o,this.logger,this.performanceClient),u=this.initiateAuthRequest(c,t);this.eventHandler.emitEvent(ns,fo.Popup,{popupWindow:u},null);const d=await this.monitorPopupForHash(u,t.popupWindowParent),h=xi(Qs,mr,this.logger,this.performanceClient,this.correlationId)(d,this.config.auth.OIDCOptions.serverResponseType,this.logger);if(us.removeThrottle(this.browserStorage,this.config.auth.clientId,o),h.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),s&&s.end({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw ja(va);const e=new Gs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,po,this.performanceClient,this.nativeMessageHandler,h.accountId,this.nativeStorage,r.correlationId),{userRequestState:t}=Mi.parseRequestState(this.browserCrypto,r.state);return await e.acquireToken({...r,state:t,prompt:void 0})}return await l.handleCodeResponse(h,r)}catch(e){throw t.popup?.close(),e instanceof Q&&(e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e)),e}}async logoutPopupAsync(e,t,n,r){this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(rs,fo.Popup,e);const o=this.initializeServerTelemetryManager(962);try{await this.clearCacheOnLogout(e.account);const a=await wi(this.createAuthCodeClient.bind(this),tr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:o,requestAuthority:n,account:e.account||void 0});try{a.authority.endSessionEndpoint}catch{if(e.account?.homeAccountId&&e.postLogoutRedirectUri&&a.authority.protocolMode===K){if(this.browserStorage.removeAccount(e.account?.homeAccountId,this.correlationId),this.eventHandler.emitEvent(os,fo.Popup,e),r){const e={apiId:962,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},t=Yt.getAbsoluteUrl(r,Za());await this.navigationClient.navigateInternal(t,e)}return void t.popup?.close()}}const i=a.getLogoutUri(e);this.eventHandler.emitEvent(os,fo.Popup,e);const s=this.openPopup(i,t);if(this.eventHandler.emitEvent(ns,fo.Popup,{popupWindow:s},null),await this.monitorPopupForHash(s,t.popupWindowParent).catch(()=>{}),r){const e={apiId:962,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},t=Yt.getAbsoluteUrl(r,Za());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${t}`),await this.navigationClient.navigateInternal(t,e)}else this.logger.verbose("No main window navigation requested")}catch(e){throw t.popup?.close(),e instanceof Q&&(e.setCorrelationId(this.correlationId),o.cacheFailedRequest(e)),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(as,fo.Popup,null,e),this.eventHandler.emitEvent(is,fo.Popup),e}this.eventHandler.emitEvent(is,fo.Popup)}initiateAuthRequest(e,t){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,t);throw this.logger.error("Navigate url is empty"),ja(Po)}monitorPopupForHash(e,t){return new Promise((t,n)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const r=setInterval(()=>{if(e.closed)return this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(r),void n(ja(Uo));let o="";try{o=e.location.href}catch(e){}if(!o||"about:blank"===o)return;clearInterval(r);let a="";const i=this.config.auth.OIDCOptions.serverResponseType;e&&(a=i===I.QUERY?e.location.search:e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),t(a)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,t)})}openPopup(e,t){try{let n;if(t.popup?(n=t.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),n.location.assign(e)):void 0===t.popup&&(this.logger.verbosePii(`Opening popup window to: ${e}`),n=this.openSizedPopup(e,t)),!n)throw ja(Fo);return n.focus&&n.focus(),this.currentWindow=n,t.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),n}catch(e){throw this.logger.error("error opening popup "+e.message),this.browserStorage.setInteractionInProgress(!1),ja(Do)}}openSizedPopup(e,{popupName:t,popupWindowAttributes:n,popupWindowParent:r}){const o=r.screenLeft?r.screenLeft:r.screenX,a=r.screenTop?r.screenTop:r.screenY,i=r.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,s=r.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let c=n.popupSize?.width,l=n.popupSize?.height,u=n.popupPosition?.top,d=n.popupPosition?.left;return(!c||c<0||c>i)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),c=483),(!l||l<0||l>s)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),l=600),(!u||u<0||u>s)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),u=Math.max(0,s/2-300+a)),(!d||d<0||d>i)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),d=Math.max(0,i/2-241.5+o)),r.open(e,t,`width=${c}, height=${l}, top=${u}, left=${d}, scrollbars=yes`)}unloadWindow(e){this.browserStorage.cleanRequestByInteractionType(fo.Popup),this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,t){e.close(),t.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)}generatePopupName(e,t){return`${Hr}.${this.config.auth.clientId}.${e.join("-")}.${t}.${this.correlationId}`}generateLogoutPopupName(e){const t=e.account&&e.account.homeAccountId;return`${Hr}.${this.config.auth.clientId}.${t}.${this.correlationId}`}}class Js{constructor(e,t,n,r,o){this.authModule=e,this.browserStorage=t,this.authCodeRequest=n,this.logger=r,this.performanceClient=o}async initiateAuthRequest(e,t){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){t.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(Zr,t.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(oo,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest),this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const n={apiId:ho,timeout:t.redirectTimeout,noHistory:!1};return"function"==typeof t.onRedirectNavigate?(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),!1!==t.onRedirectNavigate(e)?(this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),void await t.navigationClient.navigateExternal(e,n)):void this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation")):(this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),void await t.navigationClient.navigateExternal(e,n))}throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),ja(Po)}async handleCodeResponse(e,t){this.logger.verbose("RedirectHandler.handleCodeResponse called"),this.browserStorage.setInteractionInProgress(!1);const n=this.browserStorage.generateStateKey(t),r=this.browserStorage.getTemporaryCache(n);if(!r)throw He(se,"Cached State");let o;try{o=this.authModule.handleFragmentResponse(e,r)}catch(e){throw e instanceof ls&&e.subError===Uo?ja(Uo):e}const a=this.browserStorage.generateNonceKey(r),i=this.browserStorage.getTemporaryCache(a);if(this.authCodeRequest.code=o.code,o.cloud_instance_host_name&&await wi(this.authModule.updateAuthority.bind(this.authModule),cr,this.logger,this.performanceClient,this.authCodeRequest.correlationId)(o.cloud_instance_host_name,this.authCodeRequest.correlationId),o.nonce=i||void 0,o.state=r,o.client_info)this.authCodeRequest.clientInfo=o.client_info;else{const e=this.checkCcsCredentials();e&&(this.authCodeRequest.ccsCredential=e)}const s=await this.authModule.acquireToken(this.authCodeRequest,o);return this.browserStorage.cleanRequestByState(t),s}checkCcsCredentials(){const e=this.browserStorage.getTemporaryCache(ro,!0);if(e)try{return JSON.parse(e)}catch(t){this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii(`Cache credential could not be parsed: ${e}`)}return null}}class Xs extends Ls{constructor(e,t,n,r,o,a,i,s,c,l){super(e,t,n,r,o,a,i,c,l),this.nativeStorage=s}async acquireToken(e){const t=await wi(this.initializeAuthorizationRequest.bind(this),rr,this.logger,this.performanceClient,this.correlationId)(e,fo.Redirect);this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||"",t.account||null);const n=this.initializeServerTelemetryManager(ho),r=e=>{e.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.cleanRequestByState(t.state),this.eventHandler.emitEvent(ss,fo.Redirect))};try{const o=await wi(this.initializeAuthorizationCodeRequest.bind(this),or,this.logger,this.performanceClient,this.correlationId)(t),a=await wi(this.createAuthCodeClient.bind(this),tr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),i=new Js(a,this.browserStorage,o,this.logger,this.performanceClient),s=await a.getAuthCodeUrl({...t,nativeBroker:Ws.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme)}),c=this.getRedirectStartPage(e.redirectStartPage);return this.logger.verbosePii(`Redirect start page: ${c}`),window.addEventListener("pageshow",r),await i.initiateAuthRequest(s,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:c,onRedirectNavigate:e.onRedirectNavigate||this.config.auth.onRedirectNavigate})}catch(e){throw e instanceof Q&&(e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e)),window.removeEventListener("pageshow",r),this.browserStorage.cleanRequestByState(t.state),e}}async handleRedirectPromise(e="",t){const n=this.initializeServerTelemetryManager(865);try{if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const[r,o]=this.getRedirectResponse(e||"");if(!r)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(fo.Redirect),"back_forward"!==function(){if("undefined"==typeof window||void 0===window.performance||"function"!=typeof window.performance.getEntriesByType)return;const e=window.performance.getEntriesByType("navigation"),t=e.length?e[0]:void 0;return t?.type}()?t.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const i=this.browserStorage.getTemporaryCache(Zr,!0)||a.EMPTY_STRING;if(Yt.removeHashFromUrl(i)===Yt.removeHashFromUrl(window.location.href)&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),i.indexOf("#")>-1&&function(e){const t=e.split("#");t.shift(),window.location.hash=t.length>0?t.join("#"):""}(i),await this.handleResponse(r,n);if(!this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(r,n);if(!Xa()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(eo,o,!0);const e={apiId:865,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let t=!0;if(i&&"null"!==i)this.logger.verbose(`Navigating to loginRequestUrl: ${i}`),t=await this.navigationClient.navigateInternal(i,e);else{const n=function(){const e=new Yt(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}();this.browserStorage.setTemporaryCache(Zr,n,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),t=await this.navigationClient.navigateInternal(n,e)}if(!t)return await this.handleResponse(r,n)}return null}catch(e){throw e instanceof Q&&(e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e)),this.browserStorage.cleanRequestByInteractionType(fo.Redirect),e}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let t=e;t||(t=this.config.auth.OIDCOptions.serverResponseType===I.QUERY?window.location.search:window.location.hash);let n=Qt(t);if(n){try{!function(e,t,n){if(!e.state)throw ja(Ro);const r=Fi(t,e.state);if(!r)throw ja(zo);if(r.interactionType!==n)throw ja(Lo)}(n,this.browserCrypto,fo.Redirect)}catch(e){return e instanceof Q&&this.logger.error(`Interaction type validation failed due to ${e.errorCode}: ${e.errorMessage}`),[null,""]}return(r=window).location.hash="","function"==typeof r.history.replaceState&&r.history.replaceState(null,"",`${r.location.origin}${r.location.pathname}${r.location.search}`),this.logger.verbose("Hash contains known properties, returning response hash"),[n,t]}var r;const o=this.browserStorage.getTemporaryCache(eo,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(eo)),o&&(n=Qt(o),n)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[n,o]):[null,""]}async handleResponse(e,t){const n=e.state;if(!n)throw ja(Ro);const r=this.browserStorage.getCachedRequest(n);if(this.logger.verbose("handleResponse called, retrieved cached request"),e.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw ja(va);const t=new Gs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,po,this.performanceClient,this.nativeMessageHandler,e.accountId,this.nativeStorage,r.correlationId),{userRequestState:o}=Mi.parseRequestState(this.browserCrypto,n);return t.acquireToken({...r,state:o,prompt:void 0}).finally(()=>{this.browserStorage.cleanRequestByState(n)})}const o=this.browserStorage.getCachedAuthority(n);if(!o)throw ja(Zo);const a=await wi(this.createAuthCodeClient.bind(this),tr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:o});return us.removeThrottle(this.browserStorage,this.config.auth.clientId,r),new Js(a,this.browserStorage,r,this.logger,this.performanceClient).handleCodeResponse(e,n)}async logout(e){this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e),n=this.initializeServerTelemetryManager(961);try{this.eventHandler.emitEvent(rs,fo.Redirect,e),await this.clearCacheOnLogout(t.account);const r={apiId:961,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},o=await wi(this.createAuthCodeClient.bind(this),tr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:e&&e.authority,requestExtraQueryParameters:e?.extraQueryParameters,account:e&&e.account||void 0});if(o.authority.protocolMode===K)try{o.authority.endSessionEndpoint}catch{if(t.account?.homeAccountId)return this.browserStorage.removeAccount(t.account?.homeAccountId,this.correlationId),void this.eventHandler.emitEvent(os,fo.Redirect,t)}const a=o.getLogoutUri(t);if(this.eventHandler.emitEvent(os,fo.Redirect,t),!e||"function"!=typeof e.onRedirectNavigate)return this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),void await this.navigationClient.navigateExternal(a,r);if(!1!==e.onRedirectNavigate(a))return this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),void await this.navigationClient.navigateExternal(a,r);this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation")}catch(e){throw e instanceof Q&&(e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e)),this.eventHandler.emitEvent(as,fo.Redirect,null,e),this.eventHandler.emitEvent(is,fo.Redirect),e}this.eventHandler.emitEvent(is,fo.Redirect)}getRedirectStartPage(e){const t=e||window.location.href;return Yt.getAbsoluteUrl(t,Za())}}async function Zs(e,t,n,r,o){if(t.addQueueMeasurement(Jn,r),!e)throw n.info("Navigate url is empty"),ja(Po);return o?wi(tc,Zn,n,t,r)(e,o,t,r):xi(nc,er,n,t,r)(e)}async function ec(e,t,n,r,o,a,i){return r.addQueueMeasurement(Xn,a),new Promise((r,a)=>{t<1e4&&o.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${t}ms) than the default (10000ms). This may result in timeouts.`);const s=window.setTimeout(()=>{window.clearInterval(c),a(ja(Ho))},t),c=window.setInterval(()=>{let t="";const n=e.contentWindow;try{t=n?n.location.href:""}catch(e){}if(!t||"about:blank"===t)return;let o="";n&&(o=i===I.QUERY?n.location.search:n.location.hash),window.clearTimeout(s),window.clearInterval(c),r(o)},n)}).finally(()=>{xi(oc,_r,o,r,a)(e)})}function tc(e,t,n,r){return n.addQueueMeasurement(Zn,r),new Promise((n,r)=>{const o=rc();window.setTimeout(()=>{o?(o.src=e,n(o)):r("Unable to load iframe")},t)})}function nc(e){const t=rc();return t.src=e,t}function rc(){const e=document.createElement("iframe");return e.className="msalSilentIframe",e.style.visibility="hidden",e.style.position="absolute",e.style.width=e.style.height="0",e.style.border="0",e.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(e),e}function oc(e){document.body===e.parentNode&&document.body.removeChild(e)}class ac extends Ls{constructor(e,t,n,r,o,a,i,s,c,l,u){super(e,t,n,r,o,a,s,l,u),this.apiId=i,this.nativeStorage=c}async acquireToken(e){this.performanceClient.addQueueMeasurement(Nn,e.correlationId),e.loginHint||e.sid||e.account&&e.account.username||this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const t={...e};t.prompt?t.prompt!==S.NONE&&t.prompt!==S.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${t.prompt} with ${S.NONE}`),t.prompt=S.NONE):t.prompt=S.NONE;const n=await wi(this.initializeAuthorizationRequest.bind(this),rr,this.logger,this.performanceClient,e.correlationId)(t,fo.Silent);oi(n.authority);const r=this.initializeServerTelemetryManager(this.apiId);let o;try{return o=await wi(this.createAuthCodeClient.bind(this),tr,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account}),await wi(this.silentTokenHelper.bind(this),Yn,this.logger,this.performanceClient,e.correlationId)(o,n)}catch(n){if(n instanceof Q&&(n.setCorrelationId(this.correlationId),r.cacheFailedRequest(n)),!(o&&n instanceof Q&&n.errorCode===Br))throw n;this.performanceClient.addFields({retryError:n.errorCode},this.correlationId);const a=await wi(this.initializeAuthorizationRequest.bind(this),rr,this.logger,this.performanceClient,e.correlationId)(t,fo.Silent);return await wi(this.silentTokenHelper.bind(this),Yn,this.logger,this.performanceClient,this.correlationId)(o,a)}}logout(){return Promise.reject(ja(Vo))}async silentTokenHelper(e,t){const n=t.correlationId;this.performanceClient.addQueueMeasurement(Yn,n);const r=await wi(this.initializeAuthorizationCodeRequest.bind(this),or,this.logger,this.performanceClient,n)(t),o=await wi(e.getAuthCodeUrl.bind(e),ar,this.logger,this.performanceClient,n)({...t,nativeBroker:Ws.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,t.authenticationScheme)}),a=new Vs(e,this.browserStorage,r,this.logger,this.performanceClient),i=await wi(Zs,Jn,this.logger,this.performanceClient,n)(o,this.performanceClient,this.logger,n,this.config.system.navigateFrameWait),s=this.config.auth.OIDCOptions.serverResponseType,c=await wi(ec,Xn,this.logger,this.performanceClient,n)(i,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,n,s),l=xi(Qs,mr,this.logger,this.performanceClient,this.correlationId)(c,s,this.logger);if(l.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw ja(va);const e=new Gs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,l.accountId,this.browserStorage,n),{userRequestState:r}=Mi.parseRequestState(this.browserCrypto,t.state);return wi(e.acquireToken.bind(e),Rn,this.logger,this.performanceClient,n)({...t,state:r,prompt:t.prompt||S.NONE})}return wi(a.handleCodeResponse.bind(a),sr,this.logger,this.performanceClient,n)(l,t)}}class ic extends Ls{async acquireToken(e){this.performanceClient.addQueueMeasurement(En,e.correlationId);const t=await wi(Ms,Wn,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),n={...e,...t};e.redirectUri&&(n.redirectUri=this.getRedirectUri(e.redirectUri));const r=this.initializeServerTelemetryManager(61),o=await this.createRefreshTokenClient({serverTelemetryManager:r,authorityUrl:n.authority,azureCloudOptions:n.azureCloudOptions,account:n.account});return wi(o.acquireTokenByRefreshToken.bind(o),Un,this.logger,this.performanceClient,e.correlationId)(n).catch(e=>{throw e.setCorrelationId(this.correlationId),r.cacheFailedRequest(e),e})}logout(){return Promise.reject(ja(Vo))}async createRefreshTokenClient(e){const t=await wi(this.getClientConfiguration.bind(this),nr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new Hs(t,this.performanceClient)}}class sc{constructor(e,t,n,r){this.isBrowserEnvironment="undefined"!=typeof window,this.config=e,this.storage=t,this.logger=n,this.cryptoObj=r}loadExternalTokens(e,t,n){if(!this.isBrowserEnvironment)throw ja(na);const r=e.correlationId||Ha(),o=t.id_token?We(t.id_token,fi):void 0,a={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},i=e.authority?new Ci(Ci.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,a,this.logger,e.correlationId||Ha()):void 0,s=this.loadAccount(e,n.clientInfo||t.client_info||"",r,o,i),c=this.loadIdToken(t,s.homeAccountId,s.environment,s.realm,r),l=this.loadAccessToken(e,t,s.homeAccountId,s.environment,s.realm,n,r),u=this.loadRefreshToken(t,s.homeAccountId,s.environment,r);return this.generateAuthenticationResult(e,{account:s,idToken:c,accessToken:l,refreshToken:u},o,i)}loadAccount(e,t,n,r,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const t=Wt.createFromAccountInfo(e.account);return this.storage.setAccount(t,n),t}if(!o||!t&&!r)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),ja(ca);const a=Wt.generateHomeAccountId(t,o.authorityType,this.logger,this.cryptoObj,r),i=r?.tid,s=js(this.storage,o,a,fi,n,r,t,o.hostnameAndPort,i,void 0,void 0,this.logger);return this.storage.setAccount(s,n),s}loadIdToken(e,t,n,r,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const a=Xe(t,n,e.id_token,this.config.auth.clientId,r);return this.storage.setIdTokenCredential(a,o),a}loadAccessToken(e,t,n,r,o,a,i){if(!t.access_token)return this.logger.verbose("TokenCache - no access token found in response"),null;if(!t.expires_in)return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;if(!(t.scope||e.scopes&&e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null;this.logger.verbose("TokenCache - loading access token");const s=t.scope?Ft.fromString(t.scope):new Ft(e.scopes),c=a.expiresOn||t.expires_in+(new Date).getTime()/1e3,l=a.extendedExpiresOn||(t.ext_expires_in||t.expires_in)+(new Date).getTime()/1e3,u=Ze(n,r,t.access_token,this.config.auth.clientId,o,s.printScopes(),c,l,fi);return this.storage.setAccessTokenCredential(u,i),u}loadRefreshToken(e,t,n,r){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=et(t,n,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return this.storage.setRefreshTokenCredential(o,r),o}generateAuthenticationResult(e,t,n,r){let o,a="",i=[],s=null;t?.accessToken&&(a=t.accessToken.secret,i=Ft.fromString(t.accessToken.target).asArray(),s=new Date(1e3*Number(t.accessToken.expiresOn)),o=new Date(1e3*Number(t.accessToken.extendedExpiresOn)));const c=t.account;return{authority:r?r.canonicalAuthority:"",uniqueId:t.account.localAccountId,tenantId:t.account.realm,scopes:i,account:c.getAccountInfo(),idToken:t.idToken?.secret||"",idTokenClaims:n||{},accessToken:a,fromCache:!0,expiresOn:s,correlationId:e.correlationId||"",requestId:"",extExpiresOn:o,familyId:t.refreshToken?.familyId||"",tokenType:t?.accessToken?.tokenType||"",state:e.state||"",cloudGraphHostName:c.cloudGraphHostName||"",msGraphHost:c.msGraphHost||"",fromNativeBroker:!1}}}class cc extends Ns{constructor(e){super(e),this.includeRedirectUri=!1}}class lc extends Ls{constructor(e,t,n,r,o,a,i,s,c,l){super(e,t,n,r,o,a,s,c,l),this.apiId=i}async acquireToken(e){if(!e.code)throw ja(ua);const t=await wi(this.initializeAuthorizationRequest.bind(this),rr,this.logger,this.performanceClient,e.correlationId)(e,fo.Silent),n=this.initializeServerTelemetryManager(this.apiId);try{const r={...t,code:e.code},o=await wi(this.getClientConfiguration.bind(this),nr,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:n,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),a=new cc(o);this.logger.verbose("Auth code client created");const i=new Vs(a,this.browserStorage,r,this.logger,this.performanceClient);return await wi(i.handleCodeResponseFromServer.bind(i),ir,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},t,!1)}catch(e){throw e instanceof Q&&(e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e)),e}}logout(){return Promise.reject(ja(Vo))}}function uc(e){const t=e?.idTokenClaims;return t?.tfp||t?.acr?"B2C":t?.tid?"9188040d-6c67-4c5b-b112-36a304b66dad"===t?.tid?"MSA":"AAD":void 0}function dc(e,t){try{ni(e)}catch(e){throw t.end({success:!1},e),e}}class hc{constructor(e){var t,n;this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new yi(this.logger,this.performanceClient):Ke,this.eventHandler=new cs(this.logger),this.browserStorage=this.isBrowserEnvironment?new Bi(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,function(e){const t=e.cloudDiscoveryMetadata;let n;if(t)try{n=JSON.parse(t)}catch(e){throw qt(It)}return{canonicalAuthority:e.authority?Si(e.authority):void 0,knownAuthorities:e.knownAuthorities,cloudDiscoveryMetadata:n}}(this.config.auth),this.performanceClient):(t=this.config.auth.clientId,n=this.logger,new Bi(t,{cacheLocation:Jr,temporaryCacheLocation:Jr,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1},Ke,n));const r={cacheLocation:Jr,temporaryCacheLocation:Jr,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new Bi(this.config.auth.clientId,r,this.browserCrypto,this.logger,void 0,this.performanceClient),this.tokenCache=new sc(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this),this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}static async createController(e,t){const n=new hc(e);return await n.initialize(t),n}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e){if(this.logger.trace("initialize called"),this.initialized)return void this.logger.info("initialize has already been called, exiting early.");if(!this.isBrowserEnvironment)return this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,void this.eventHandler.emitEvent(Hi);const t=e?.correlationId||this.getRequestCorrelationId(),n=this.config.system.allowNativeBroker,r=this.performanceClient.startMeasurement(Qn,t);if(this.eventHandler.emitEvent("msal:initializeStart"),n)try{this.nativeExtensionProvider=await Ws.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient)}catch(e){this.logger.verbose(e)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),await wi(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),Pr,this.logger,this.performanceClient,t)(this.performanceClient,t)),this.initialized=!0,this.eventHandler.emitEvent(Hi),r.end({allowNativeBroker:n,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),ti(this.initialized),this.isBrowserEnvironment){const t=e||"";let n=this.redirectResponse.get(t);return void 0===n?(n=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(t,n),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),n}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){const t=this.getAllAccounts(),n=this.browserStorage.getCachedNativeRequest(),r=n&&Ws.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!e,o=r?n?.correlationId:this.browserStorage.getTemporaryCache(oo,!0)||"",a=this.performanceClient.startMeasurement(Tn,o);let i;if(this.eventHandler.emitEvent(es,fo.Redirect),r&&this.nativeExtensionProvider){this.logger.trace("handleRedirectPromise - acquiring token from native platform");const e=new Gs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,865,this.performanceClient,this.nativeExtensionProvider,n.accountId,this.nativeInternalStorage,n.correlationId);i=wi(e.handleRedirectPromise.bind(e),Nr,this.logger,this.performanceClient,a.event.correlationId)(this.performanceClient,a.event.correlationId)}else{this.logger.trace("handleRedirectPromise - acquiring token from web flow");const t=this.createRedirectClient(o);i=wi(t.handleRedirectPromise.bind(t),Ar,this.logger,this.performanceClient,a.event.correlationId)(e,a)}return i.then(e=>(e?(t.length<this.getAllAccounts().length?(this.eventHandler.emitEvent($i,fo.Redirect,e),this.logger.verbose("handleRedirectResponse returned result, login success")):(this.eventHandler.emitEvent(Vi,fo.Redirect,e),this.logger.verbose("handleRedirectResponse returned result, acquire token success")),a.end({success:!0,accountType:uc(e.account)})):a.event.errorCode?a.end({success:!1}):a.discard(),this.eventHandler.emitEvent(ts,fo.Redirect),e)).catch(e=>{const n=e;throw t.length>0?this.eventHandler.emitEvent(Qi,fo.Redirect,null,n):this.eventHandler.emitEvent(Gi,fo.Redirect,null,n),this.eventHandler.emitEvent(ts,fo.Redirect),a.end({success:!1},n),e})}async acquireTokenRedirect(e){const t=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",t);const n=this.performanceClient.startMeasurement("acquireTokenPreRedirect",t);n.add({accountType:uc(e.account),scenarioId:e.scenarioId});const r=e.onRedirectNavigate;if(r)e.onRedirectNavigate=e=>{const t="function"==typeof r?r(e):void 0;return!1!==t?n.end({success:!0}):n.discard(),t};else{const e=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=t=>{const r="function"==typeof e?e(t):void 0;return!1!==r?n.end({success:!0}):n.discard(),r}}const o=this.getAllAccounts().length>0;try{let r;return ri(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),o?this.eventHandler.emitEvent(Wi,fo.Redirect,e):this.eventHandler.emitEvent(Ki,fo.Redirect,e),r=this.nativeExtensionProvider&&this.canUseNative(e)?new Gs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ho,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(e),this.nativeInternalStorage,t).acquireTokenRedirect(e,n).catch(n=>{if(n instanceof Fs&&Us(n))return this.nativeExtensionProvider=void 0,this.createRedirectClient(t).acquireToken(e);if(n instanceof Pi)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),n}):this.createRedirectClient(t).acquireToken(e),await r}catch(e){throw n.end({success:!1},e),o?this.eventHandler.emitEvent(Qi,fo.Redirect,null,e):this.eventHandler.emitEvent(Gi,fo.Redirect,null,e),e}}acquireTokenPopup(e){const t=this.getRequestCorrelationId(e),n=this.performanceClient.startMeasurement(Sn,t);n.add({scenarioId:e.scenarioId,accountType:uc(e.account)});try{this.logger.verbose("acquireTokenPopup called",t),dc(this.initialized,n),this.browserStorage.setInteractionInProgress(!0)}catch(e){return Promise.reject(e)}const r=this.getAllAccounts();let o;return r.length>0?this.eventHandler.emitEvent(Wi,fo.Popup,e):this.eventHandler.emitEvent(Ki,fo.Popup,e),o=this.canUseNative(e)?this.acquireTokenNative({...e,correlationId:t},po).then(e=>(this.browserStorage.setInteractionInProgress(!1),n.end({success:!0,isNativeBroker:!0,accountType:uc(e.account)}),e)).catch(n=>{if(n instanceof Fs&&Us(n))return this.nativeExtensionProvider=void 0,this.createPopupClient(t).acquireToken(e);if(n instanceof Pi)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),n}):this.createPopupClient(t).acquireToken(e),o.then(e=>(r.length<this.getAllAccounts().length?this.eventHandler.emitEvent($i,fo.Popup,e):this.eventHandler.emitEvent(Vi,fo.Popup,e),n.end({success:!0,accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length,accountType:uc(e.account)}),e)).catch(e=>(r.length>0?this.eventHandler.emitEvent(Qi,fo.Popup,null,e):this.eventHandler.emitEvent(Gi,fo.Popup,null,e),n.end({success:!1},e),Promise.reject(e)))}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){const t=this.getRequestCorrelationId(e),n={...e,prompt:e.prompt,correlationId:t};let r;return this.ssoSilentMeasurement=this.performanceClient.startMeasurement(_n,t),this.ssoSilentMeasurement?.add({scenarioId:e.scenarioId,accountType:uc(e.account)}),dc(this.initialized,this.ssoSilentMeasurement),this.ssoSilentMeasurement?.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",t),this.eventHandler.emitEvent(Yi,fo.Silent,n),r=this.canUseNative(n)?this.acquireTokenNative(n,863).catch(e=>{if(e instanceof Fs&&Us(e))return this.nativeExtensionProvider=void 0,this.createSilentIframeClient(n.correlationId).acquireToken(n);throw e}):this.createSilentIframeClient(n.correlationId).acquireToken(n),r.then(e=>(this.eventHandler.emitEvent(Ji,fo.Silent,e),this.ssoSilentMeasurement?.end({success:!0,isNativeBroker:e.fromNativeBroker,accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length,accountType:uc(e.account)}),e)).catch(e=>{throw this.eventHandler.emitEvent(Xi,fo.Silent,null,e),this.ssoSilentMeasurement?.end({success:!1},e),e}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const t=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",t);const n=this.performanceClient.startMeasurement(xn,t);dc(this.initialized,n),this.eventHandler.emitEvent("msal:acquireTokenByCodeStart",fo.Silent,e),n.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw ja(ha);if(e.code){const r=e.code;let o=this.hybridAuthCodeResponses.get(r);return o?(this.logger.verbose("Existing acquireTokenByCode request found",t),n.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",t),o=this.acquireTokenByCodeAsync({...e,correlationId:t}).then(e=>(this.eventHandler.emitEvent("msal:acquireTokenByCodeSuccess",fo.Silent,e),this.hybridAuthCodeResponses.delete(r),n.end({success:!0,isNativeBroker:e.fromNativeBroker,accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length,accountType:uc(e.account)}),e)).catch(e=>{throw this.hybridAuthCodeResponses.delete(r),this.eventHandler.emitEvent(Zi,fo.Silent,null,e),n.end({success:!1},e),e}),this.hybridAuthCodeResponses.set(r,o)),await o}if(e.nativeAccountId){if(this.canUseNative(e,e.nativeAccountId)){const r=await this.acquireTokenNative({...e,correlationId:t},866,e.nativeAccountId).catch(e=>{throw e instanceof Fs&&Us(e)&&(this.nativeExtensionProvider=void 0),e});return n.end({accountType:uc(r.account),success:!0}),r}throw ja(fa)}throw ja(da)}catch(e){throw this.eventHandler.emitEvent(Zi,fo.Silent,null,e),n.end({success:!1},e),e}}async acquireTokenByCodeAsync(e){this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(jr,e.correlationId),this.acquireTokenByCodeAsyncMeasurement?.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement);const t=this.createSilentAuthCodeClient(e.correlationId);return await t.acquireToken(e).then(e=>(this.acquireTokenByCodeAsyncMeasurement?.end({success:!0,fromCache:e.fromCache,isNativeBroker:e.fromNativeBroker}),e)).catch(e=>{throw this.acquireTokenByCodeAsyncMeasurement?.end({success:!1},e),e}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,t){switch(this.performanceClient.addQueueMeasurement(Hn,e.correlationId),t){case 0:case 1:case 2:const t=this.createSilentCacheClient(e.correlationId);return wi(t.acquireToken.bind(t),An,this.logger,this.performanceClient,e.correlationId)(e);default:throw He(Ne)}}async acquireTokenByRefreshToken(e,t){switch(this.performanceClient.addQueueMeasurement(wn,e.correlationId),t){case 0:case 2:case 3:case 4:const t=this.createSilentRefreshClient(e.correlationId);return wi(t.acquireToken.bind(t),En,this.logger,this.performanceClient,e.correlationId)(e);default:throw He(Ne)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(Gn,e.correlationId);const t=this.createSilentIframeClient(e.correlationId);return wi(t.acquireToken.bind(t),Nn,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const t=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),this.logoutRedirect({correlationId:t,...e})}async logoutRedirect(e){const t=this.getRequestCorrelationId(e);return ri(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),this.createRedirectClient(t).logout(e)}logoutPopup(e){try{const t=this.getRequestCorrelationId(e);return ni(this.initialized),this.browserStorage.setInteractionInProgress(!0),this.createPopupClient(t).logout(e)}catch(e){return Promise.reject(e)}}async clearCache(e){if(!this.isBrowserEnvironment)return void this.logger.info("in non-browser environment, returning early.");const t=this.getRequestCorrelationId(e);return this.createSilentCacheClient(t).logout(e)}getAllAccounts(e){const t=this.getRequestCorrelationId();return function(e,t,n,r,o){return e.verbose("getAllAccounts called"),n?t.getAllAccounts(r,o):[]}(this.logger,this.browserStorage,this.isBrowserEnvironment,t,e)}getAccount(e){const t=this.getRequestCorrelationId();return function(e,t,n,r){if(t.trace("getAccount called"),0===Object.keys(e).length)return t.warning("getAccount: No accountFilter provided"),null;const o=n.getAccountInfoFilteredBy(e,r);return o?(t.verbose("getAccount: Account matching provided filter found, returning"),o):(t.verbose("getAccount: No matching account found, returning null"),null)}(e,this.logger,this.browserStorage,t)}getAccountByUsername(e){const t=this.getRequestCorrelationId();return function(e,t,n,r){if(t.trace("getAccountByUsername called"),!e)return t.warning("getAccountByUsername: No username provided"),null;const o=n.getAccountInfoFilteredBy({username:e},r);return o?(t.verbose("getAccountByUsername: Account matching username found, returning"),t.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${e}`),o):(t.verbose("getAccountByUsername: No matching account found, returning null"),null)}(e,this.logger,this.browserStorage,t)}getAccountByHomeId(e){const t=this.getRequestCorrelationId();return function(e,t,n,r){if(t.trace("getAccountByHomeId called"),!e)return t.warning("getAccountByHomeId: No homeAccountId provided"),null;const o=n.getAccountInfoFilteredBy({homeAccountId:e},r);return o?(t.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),t.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${e}`),o):(t.verbose("getAccountByHomeId: No matching account found, returning null"),null)}(e,this.logger,this.browserStorage,t)}getAccountByLocalId(e){const t=this.getRequestCorrelationId();return function(e,t,n,r){if(t.trace("getAccountByLocalId called"),!e)return t.warning("getAccountByLocalId: No localAccountId provided"),null;const o=n.getAccountInfoFilteredBy({localAccountId:e},r);return o?(t.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),t.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${e}`),o):(t.verbose("getAccountByLocalId: No matching account found, returning null"),null)}(e,this.logger,this.browserStorage,t)}setActiveAccount(e){const t=this.getRequestCorrelationId();!function(e,t,n){t.setActiveAccount(e,n)}(e,this.browserStorage,t)}getActiveAccount(){const e=this.getRequestCorrelationId();return function(e,t){return e.getActiveAccount(t)}(this.browserStorage,e)}async hydrateCache(e,t){this.logger.verbose("hydrateCache called");const n=Wt.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return this.browserStorage.setAccount(n,e.correlationId),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,t)):this.browserStorage.hydrateCache(e,t)}async acquireTokenNative(e,t,n){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw ja(va);return new Gs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,t,this.performanceClient,this.nativeExtensionProvider,n||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e)}canUseNative(e,t){if(this.logger.trace("canUseNative called"),!Ws.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case S.NONE:case S.CONSENT:case S.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace(`canUseNative: prompt = ${e.prompt} is not compatible with native flow, returning false`),!1}return!(!t&&!this.getNativeAccountId(e)&&(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),1))}getNativeAccountId(e){const t=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return t&&t.nativeAccountId||""}createPopupClient(e){return new Ys(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createRedirectClient(e){return new Xs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentIframeClient(e){return new ac(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,863,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentCacheClient(e){return new $s(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentRefreshClient(e){return new ic(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentAuthCodeClient(e){return new lc(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,866,this.performanceClient,this.nativeExtensionProvider,e)}addEventCallback(e,t){return this.eventHandler.addEventCallback(e,t)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return ei(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){"undefined"!=typeof window&&(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))}disableAccountStorageEvents(){"undefined"!=typeof window&&(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))}handleAccountCacheChange(e){try{e.key?.includes(b)&&this.eventHandler.emitEvent("msal:activeAccountChanged");const t=e.newValue||e.oldValue;if(!t)return;const n=JSON.parse(t);if("object"!=typeof n||!Wt.isAccountEntity(n))return;const r=cn.toObject(new Wt,n).getAccountInfo();!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.eventHandler.emitEvent("msal:accountAdded",void 0,r)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.eventHandler.emitEvent("msal:accountRemoved",void 0,r))}catch(e){return}}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,t){this.browserStorage.setWrapperMetadata(e,t)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e?.correlationId?e.correlationId:this.isBrowserEnvironment?Ha():a.EMPTY_STRING}async loginRedirect(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",t),this.acquireTokenRedirect({correlationId:t,...e||Co})}loginPopup(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup({correlationId:t,...e||Co})}async acquireTokenSilent(e){const t=this.getRequestCorrelationId(e),n=this.performanceClient.startMeasurement(kn,t);n.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),dc(this.initialized,n),this.logger.verbose("acquireTokenSilent called",t);const r=e.account||this.getActiveAccount();if(!r)throw ja(Qo);n.add({accountType:uc(r)});const o={clientId:this.config.auth.clientId,authority:e.authority||a.EMPTY_STRING,scopes:e.scopes,homeAccountIdentifier:r.homeAccountId,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,shrOptions:e.shrOptions},i=JSON.stringify(o),s=this.activeSilentTokenRequests.get(i);if(void 0===s){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",t);const o=wi(this.acquireTokenSilentAsync.bind(this),Cn,this.logger,this.performanceClient,t)({...e,correlationId:t},r).then(t=>(this.activeSilentTokenRequests.delete(i),n.end({success:!0,fromCache:t.fromCache,isNativeBroker:t.fromNativeBroker,cacheLookupPolicy:e.cacheLookupPolicy,accessTokenSize:t.accessToken.length,idTokenSize:t.idToken.length}),t)).catch(e=>{throw this.activeSilentTokenRequests.delete(i),n.end({success:!1},e),e});return this.activeSilentTokenRequests.set(i,o),{...await o,state:e.state}}return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",t),n.discard(),{...await s,state:e.state}}async acquireTokenSilentAsync(e,t){const n=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(Cn,e.correlationId),this.eventHandler.emitEvent(Wi,fo.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",n);const r=await wi(zs,Vn,this.logger,this.performanceClient,e.correlationId)(e,t,this.config,this.performanceClient,this.logger),o=e.cacheLookupPolicy||0;return this.acquireTokenSilentNoIframe(r,o).catch(async e=>{const t=function(e,t){const n=!(e instanceof Pi&&e.subError!==Ai),r=e.errorCode===Br||e.errorCode===Ne,o=n&&r||e.errorCode===Ti||e.errorCode===ji,a=Io.includes(t);return o&&a}(e,o);if(t){if(this.activeIframeRequest){if(5!==o){const[t,n]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${n}`,r.correlationId);const a=this.performanceClient.startMeasurement("awaitConcurrentIframe",r.correlationId);a.add({awaitIframeCorrelationId:n});const i=await t;if(a.end({success:i}),i)return this.logger.verbose(`Parallel iframe request with correlationId: ${n} succeeded. Retrying cache and/or RT redemption`,r.correlationId),this.acquireTokenSilentNoIframe(r,o);throw this.logger.info(`Iframe request with correlationId: ${n} failed. Interaction is required.`),e}return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",r.correlationId),wi(this.acquireTokenBySilentIframe.bind(this),Gn,this.logger,this.performanceClient,r.correlationId)(r)}{let e;return this.activeIframeRequest=[new Promise(t=>{e=t}),r.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",r.correlationId),wi(this.acquireTokenBySilentIframe.bind(this),Gn,this.logger,this.performanceClient,r.correlationId)(r).then(t=>(e(!0),t)).catch(t=>{throw e(!1),t}).finally(()=>{this.activeIframeRequest=void 0})}}throw e}).then(t=>(this.eventHandler.emitEvent(Vi,fo.Silent,t),e.correlationId&&this.performanceClient.addFields({fromCache:t.fromCache,isNativeBroker:t.fromNativeBroker},e.correlationId),t)).catch(e=>{throw this.eventHandler.emitEvent(Qi,fo.Silent,null,e),e}).finally(()=>{document.removeEventListener("visibilitychange",n)})}async acquireTokenSilentNoIframe(e,t){return Ws.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,61).catch(async e=>{if(e instanceof Fs&&Us(e))throw this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,He(Ne);throw e})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),wi(this.acquireTokenFromCache.bind(this),Hn,this.logger,this.performanceClient,e.correlationId)(e,t).catch(n=>{if(1===t)throw n;return this.eventHandler.emitEvent("msal:acquireTokenFromNetworkStart",fo.Silent,e),wi(this.acquireTokenByRefreshToken.bind(this),wn,this.logger,this.performanceClient,e.correlationId)(e,t)}))}}class pc{static async createPublicClientApplication(e){const t=await async function(e){const t=new si(e);return await t.initialize(),hc.createController(t,void 0)}(e);return new pc(e,t)}constructor(e,t){this.controller=t||new hc(new si(e))}async initialize(e){return this.controller.initialize(e)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,t){return this.controller.addEventCallback(e,t)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,t){return this.controller.initializeWrapperLibrary(e,t)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,t){return this.controller.hydrateCache(e,t)}clearCache(e){return this.controller.clearCache(e)}}const fc={instance:{initialize:()=>Promise.reject(Ja(Wa)),acquireTokenPopup:()=>Promise.reject(Ja(Wa)),acquireTokenRedirect:()=>Promise.reject(Ja(Wa)),acquireTokenSilent:()=>Promise.reject(Ja(Wa)),acquireTokenByCode:()=>Promise.reject(Ja(Wa)),getAllAccounts:()=>[],getAccount:()=>null,getAccountByHomeId:()=>null,getAccountByUsername:()=>null,getAccountByLocalId:()=>null,handleRedirectPromise:()=>Promise.reject(Ja(Wa)),loginPopup:()=>Promise.reject(Ja(Wa)),loginRedirect:()=>Promise.reject(Ja(Wa)),logout:()=>Promise.reject(Ja(Wa)),logoutRedirect:()=>Promise.reject(Ja(Wa)),logoutPopup:()=>Promise.reject(Ja(Wa)),ssoSilent:()=>Promise.reject(Ja(Wa)),addEventCallback:()=>null,removeEventCallback:()=>{},addPerformanceCallback:()=>"",removePerformanceCallback:()=>!1,enableAccountStorageEvents:()=>{},disableAccountStorageEvents:()=>{},getTokenCache:()=>{throw Ja(Wa)},getLogger:()=>{throw Ja(Wa)},setLogger:()=>{},setActiveAccount:()=>{},getActiveAccount:()=>null,initializeWrapperLibrary:()=>{},setNavigationClient:()=>{},getConfiguration:()=>{throw Ja(Wa)},hydrateCache:()=>Promise.reject(Ja(Wa)),clearCache:()=>Promise.reject(Ja(Wa))},inProgress:ko,accounts:[],logger:new B({})},gc=r.createContext(fc);gc.Consumer;class mc{static getInteractionStatusFromEvent(e,t){switch(e.eventType){case Ki:return vo;case Yi:return xo;case Wi:if(e.interactionType===fo.Redirect||e.interactionType===fo.Popup)return bo;break;case es:return wo;case rs:return yo;case Ji:case Xi:if(t&&t!==xo)break;return ko;case is:if(t&&t!==yo)break;return ko;case ts:if(t&&t!==wo)break;return ko;case $i:case Gi:case Vi:case Qi:case ss:if(e.interactionType===fo.Redirect||e.interactionType===fo.Popup){if(t&&t!==vo&&t!==bo)break;return ko}}return null}}function vc(e,t){if(e.length!==t.length)return!1;const n=[...t];return e.every(e=>{const t=n.shift();return!(!e||!t)&&e.homeAccountId===t.homeAccountId&&e.localAccountId===t.localAccountId&&e.username===t.username})}const yc="2.2.0",bc="UNBLOCK_INPROGRESS",xc="EVENT",wc=(e,t)=>{const{type:n,payload:r}=t;let o=e.inProgress;switch(n){case bc:e.inProgress===mo&&(o=ko,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case xc:const t=r.message,a=mc.getInteractionStatusFromEvent(t,e.inProgress);a&&(r.logger.info(`MsalProvider - ${t.eventType} results in setting inProgress from ${e.inProgress} to ${a}`),o=a);break;default:throw new Error(`Unknown action type: ${n}`)}const a=r.instance.getAllAccounts();return o===e.inProgress||vc(a,e.accounts)?o!==e.inProgress?{...e,inProgress:o}:vc(a,e.accounts)?e:{...e,accounts:a}:{...e,inProgress:o,accounts:a}};function kc({instance:e,children:t}){(0,r.useEffect)(()=>{e.initializeWrapperLibrary("@azure/msal-react",yc)},[e]);const n=(0,r.useMemo)(()=>e.getLogger().clone("@azure/msal-react",yc),[e]),[o,a]=(0,r.useReducer)(wc,void 0,()=>({inProgress:mo,accounts:e.getAllAccounts()}));(0,r.useEffect)(()=>{const t=e.addEventCallback(t=>{a({payload:{instance:e,logger:n,message:t},type:xc})});return n.verbose(`MsalProvider - Registered event callback with id: ${t}`),e.initialize().then(()=>{e.handleRedirectPromise().catch(()=>{}).finally(()=>{a({payload:{instance:e,logger:n},type:bc})})}).catch(()=>{}),()=>{t&&(n.verbose(`MsalProvider - Removing event callback ${t}`),e.removeEventCallback(t))}},[e,n]);const i={instance:e,inProgress:o.inProgress,accounts:o.accounts,logger:n};return r.createElement(gc.Provider,{value:i},t)}var Cc="https://USIMClients.ciamlogin.com/".concat("891f98f1-ed34-42a1-9b6c-28b0554d92c2"),Sc="https://adsapi.usimdev.com",Tc=("".concat(Sc,"/api/auth/session"),"https://adpregist.usimdev.com"),Ic={auth:{clientId:"154c9111-14a0-4c0f-8132-7bc68254a74e",authority:Cc,redirectUri:window.location.origin,postLogoutRedirectUri:window.location.origin,knownAuthorities:["USIMClients.ciamlogin.com"],navigateToLoginRequestUrl:!0},cache:{cacheLocation:"sessionStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:function(e,t,n){if(!n)switch(e){case 0:console.error(t);break;case 1:console.warn(t);break;case 2:console.info(t);break;case 3:console.debug(t)}},logLevel:3}}},jc={scopes:["openid","profile","email"]},Ac=n(848);function Nc(e){return Nc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nc(e)}function Ec(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ec(Object(n),!0).forEach(function(t){Pc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ec(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Pc(e,t,n){return(t=function(e){var t=function(e){if("object"!=Nc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Nc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Nc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Rc(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Rc(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Rc(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,Rc(d,"constructor",l),Rc(l,"constructor",c),c.displayName="GeneratorFunction",Rc(l,o,"GeneratorFunction"),Rc(d),Rc(d,o,"Generator"),Rc(d,r,function(){return this}),Rc(d,"toString",function(){return"[object Generator]"}),(Oc=function(){return{w:a,m:h}})()}function Rc(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Rc=function(e,t,n,r){function a(t,n){Rc(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Rc(e,t,n,r)}function Mc(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function zc(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Mc(a,r,o,i,s,"next",e)}function s(e){Mc(a,r,o,i,s,"throw",e)}i(void 0)})}}function Lc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Dc=new pc(Ic),Fc=Dc.initialize(),Uc=(0,r.createContext)(null),Bc=function(){return(0,r.useContext)(Uc)},Hc="adp_session_token",Kc="adp_session_user";function $c(e){var t=e.children,n=(0,r.useContext)(gc),o=n.instance,a=(n.inProgress,n.accounts),i=Lc((0,r.useState)("authenticating"),2),s=i[0],c=i[1],l=Lc((0,r.useState)(null),2),u=l[0],d=l[1],h=Lc((0,r.useState)(null),2),p=h[0],f=h[1],g=Lc((0,r.useState)(null),2),m=g[0],v=g[1],y=(0,r.useRef)(!1),b=(0,r.useCallback)(function(){var e=zc(Oc().m(function e(t){var n,r,o,a,i,s;return Oc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!y.current){e.n=1;break}return e.a(2);case 1:return y.current=!0,console.log("[Auth] Exchanging JWT for session at","".concat(Sc,"/api/auth/session")),e.p=2,e.n=3,fetch("".concat(Sc,"/api/auth/session"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}});case 3:return n=e.v,e.n=4,n.json();case 4:r=e.v,console.log("[Auth] Session response:",n.status,r.ok),r.ok&&r.data?(o=r.data,a={sessionId:o.sessionId,userId:o.userId,email:o.userEmail,displayName:o.displayName,role:o.role,clientId:o.clientId,clientName:o.clientName,expiresAt:o.expiresAt,availableClients:o.availableClients||[]},d(o.sessionToken),f(a),sessionStorage.setItem(Hc,o.sessionToken),sessionStorage.setItem(Kc,JSON.stringify(a)),c("active"),console.log("[Auth] Session established for",o.userEmail,"| client:",o.clientName)):(i=r.error||"Session creation failed",console.warn("[Auth] Session exchange error:",i),/no client access|user not found|not registered/i.test(i)?c("needsRegistration"):(v(i),c("error"))),e.n=6;break;case 5:e.p=5,s=e.v,console.error("[Auth] Network error during session exchange:",s),v("Unable to connect to the server. Please try again."),c("error");case 6:return e.p=6,y.current=!1,e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(t){return e.apply(this,arguments)}}(),[]),x=(0,r.useCallback)(function(){var e=zc(Oc().m(function e(t){var n,r,o,a,i;return Oc().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,fetch("".concat(Sc,"/api/auth/me"),{headers:{Authorization:"Bearer ".concat(t)}});case 1:return n=e.v,e.n=2,n.json();case 2:if(!(r=e.v).ok||!r.data){e.n=3;break}return o=r.data,a={sessionId:o.sessionId,userId:o.userId,email:o.userEmail,displayName:o.displayName,role:o.role,clientId:o.clientId,clientName:o.clientName,expiresAt:o.expiresAt,availableClients:o.availableClients||[]},d(t),f(a),c("active"),console.log("[Auth] Session restored for",o.userEmail),e.a(2,!0);case 3:e.n=5;break;case 4:e.p=4,i=e.v,console.warn("[Auth] Session validation failed:",i.message);case 5:return e.a(2,!1)}},e,null,[[0,4]])}));return function(t){return e.apply(this,arguments)}}(),[]);(0,r.useEffect)(function(){var e=!1;function t(){return(t=zc(Oc().m(function t(){var n,r,a,i,s,l;return Oc().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.n=1,Fc;case 1:return t.p=1,t.n=2,o.handleRedirectPromise();case 2:if(!(n=t.v)||!n.idToken||e){t.n=4;break}return console.log("[Auth] MSAL redirect received, exchanging token"),t.n=3,b(n.idToken);case 3:return t.a(2);case 4:t.n=6;break;case 5:t.p=5,s=t.v,console.warn("[Auth] MSAL redirect error:",s);case 6:if(!e){t.n=7;break}return t.a(2);case 7:if(!(r=sessionStorage.getItem(Hc))){t.n=10;break}return t.n=8,x(r);case 8:if(!t.v){t.n=9;break}return t.a(2);case 9:sessionStorage.removeItem(Hc),sessionStorage.removeItem(Kc);case 10:if(!(a=o.getActiveAccount()||o.getAllAccounts()[0])){t.n=16;break}return t.p=11,t.n=12,o.acquireTokenSilent(_c(_c({},jc),{},{account:a}));case 12:if(null==(i=t.v)||!i.idToken||e){t.n=14;break}return t.n=13,b(i.idToken);case 13:return t.a(2);case 14:t.n=16;break;case 15:t.p=15,l=t.v,console.warn("[Auth] Silent token acquisition failed:",l.message);case 16:e||c("unauthenticated");case 17:return t.a(2)}},t,null,[[11,15],[1,5]])}))).apply(this,arguments)}return function(){t.apply(this,arguments)}(),function(){e=!0}},[o,b,x]);var w=(0,r.useCallback)(function(){c("authenticating"),o.loginRedirect(jc).catch(function(e){console.error("[Auth] Login redirect error:",e),c("unauthenticated")})},[o]),k=(0,r.useCallback)(zc(Oc().m(function e(){return Oc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!u){e.n=4;break}return e.p=1,e.n=2,fetch("".concat(Sc,"/api/auth/signoff"),{method:"POST",headers:{Authorization:"Bearer ".concat(u)}});case 2:e.n=4;break;case 3:e.p=3,e.v;case 4:sessionStorage.removeItem(Hc),sessionStorage.removeItem(Kc),d(null),f(null),c("unauthenticated"),o.logoutRedirect({postLogoutRedirectUri:window.location.origin});case 5:return e.a(2)}},e,null,[[1,3]])})),[o,u]),C=(0,r.useCallback)(function(){sessionStorage.clear(),v(null),c("unauthenticated"),o.logoutRedirect({postLogoutRedirectUri:window.location.origin}).catch(function(){c("unauthenticated")})},[o]),S=(0,r.useCallback)(function(){var e=zc(Oc().m(function e(t){var n,r,o,a;return Oc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(u){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,fetch("".concat(Sc,"/api/auth/switch-client"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(u)},body:JSON.stringify({clientId:t})});case 2:return n=e.v,e.n=3,n.json();case 3:(r=e.v).ok&&r.data&&(o=r.data,f(function(e){return _c(_c({},e),{},{clientId:o.clientId||e.clientId,clientName:o.clientName||e.clientName,role:o.role||e.role})}),sessionStorage.setItem(Kc,JSON.stringify(_c(_c({},p),o)))),e.n=5;break;case 4:e.p=4,a=e.v,console.error("[Auth] Switch client error:",a);case 5:return e.a(2)}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}(),[u,p]),T=(null==a?void 0:a[0])||null,I={authState:s,sessionToken:u,sessionUser:p,error:m,msalAccount:T,gatewayUrl:Sc,signIn:w,signOut:k,retrySignIn:C,switchClient:S,clearError:function(){v(null),c("unauthenticated")}};return(0,Ac.jsx)(Uc.Provider,{value:I,children:t})}function Gc(e){var t=e.children;return(0,Ac.jsx)(kc,{instance:Dc,children:(0,Ac.jsx)($c,{children:t})})}function Wc(){var e=Bc().signIn;return(0,Ac.jsxs)("div",{className:"landing-page",children:[(0,Ac.jsxs)("div",{className:"landing-header",children:[(0,Ac.jsxs)("div",{className:"landing-logo",children:[(0,Ac.jsx)("div",{className:"landing-logo-icon",children:(0,Ac.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,Ac.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})})}),(0,Ac.jsx)("span",{className:"landing-logo-text",children:"AdPlatform"})]}),(0,Ac.jsx)("button",{className:"btn btn-primary",onClick:e,children:"Sign In"})]}),(0,Ac.jsxs)("div",{className:"landing-hero",children:[(0,Ac.jsx)("h1",{children:"Take Control of Your Advertising"}),(0,Ac.jsx)("h2",{className:"landing-subtitle",children:"Launch and Manage Your Ad Campaigns"}),(0,Ac.jsx)("p",{children:"A simple, self-service platform to create, launch, and optimize campaigns across multiple channels — backed by expert guidance."}),(0,Ac.jsx)("button",{className:"btn btn-primary btn-lg",onClick:e,children:"Get Started"}),(0,Ac.jsxs)("div",{className:"landing-features",children:[(0,Ac.jsxs)("div",{className:"feature-card",children:[(0,Ac.jsx)("div",{className:"feature-card-icon",children:(0,Ac.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})}),(0,Ac.jsx)("h3",{children:"Campaign Management"}),(0,Ac.jsx)("p",{children:"Create and manage search, display, and video campaigns with an intuitive interface."})]}),(0,Ac.jsxs)("div",{className:"feature-card",children:[(0,Ac.jsx)("div",{className:"feature-card-icon",children:(0,Ac.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}),(0,Ac.jsx)("h3",{children:"Performance Reporting"}),(0,Ac.jsx)("p",{children:"Track impressions, clicks, conversions, and spend with real-time reporting dashboards."})]}),(0,Ac.jsxs)("div",{className:"feature-card",children:[(0,Ac.jsx)("div",{className:"feature-card-icon",children:(0,Ac.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})})}),(0,Ac.jsx)("h3",{children:"Managed by Experts"}),(0,Ac.jsx)("p",{children:"Your campaigns run under our agency account with professional oversight and support."})]})]})]})]})}function Vc(){return(0,r.useEffect)(function(){window.location.href=Tc},[]),(0,Ac.jsxs)("div",{className:"loading-screen",children:[(0,Ac.jsx)("div",{className:"loading-spinner"}),(0,Ac.jsx)("p",{children:"Redirecting to registration…"})]})}function Qc(e){var t=e.message,n=Bc(),r=n.clearError,o=n.retrySignIn;return(0,Ac.jsx)("div",{className:"status-page",children:(0,Ac.jsxs)("div",{className:"status-card",children:[(0,Ac.jsx)("div",{className:"status-icon error",children:"✕"}),(0,Ac.jsx)("h2",{children:"Sign-in Unsuccessful"}),(0,Ac.jsx)("p",{className:"error-text",children:t||"An unexpected error occurred during sign-in."}),(0,Ac.jsxs)("div",{className:"status-actions",children:[(0,Ac.jsx)("button",{className:"btn btn-primary btn-lg",onClick:r,children:"Try Again"}),(0,Ac.jsx)("button",{className:"btn btn-outline",onClick:o,children:"Sign in with Different Account"}),(0,Ac.jsx)("a",{href:Tc,className:"btn btn-outline",children:"Register for Access"})]})]})})}var Yc=[{id:"dashboard",label:"Dashboard",icon:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"},{id:"campaigns",label:"Campaigns",icon:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"},{id:"reporting",label:"Reporting",icon:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"},{id:"accounts",label:"Accounts",icon:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"},{id:"developer",label:"API Testing",icon:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"},{id:"settings",label:"Settings",icon:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z M15 12a3 3 0 11-6 0 3 3 0 016 0z"}];function Jc(e){var t=e.activeView,n=e.onNavigate,r=e.collapsed,o=e.onToggle;return(0,Ac.jsxs)("aside",{className:"sidebar ".concat(r?"collapsed":""),children:[(0,Ac.jsxs)("div",{className:"sidebar-header",children:[(0,Ac.jsxs)("div",{className:"logo",children:[(0,Ac.jsx)("div",{className:"logo-icon",children:(0,Ac.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,Ac.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})})}),!r&&(0,Ac.jsx)("span",{className:"logo-text",children:"AdPlatform"})]}),(0,Ac.jsx)("button",{className:"collapse-btn",onClick:o,title:r?"Expand":"Collapse",children:(0,Ac.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:r?(0,Ac.jsx)("path",{d:"M13 5l7 7-7 7M5 5l7 7-7 7"}):(0,Ac.jsx)("path",{d:"M11 19l-7-7 7-7M19 19l-7-7 7-7"})})})]}),(0,Ac.jsx)("nav",{className:"sidebar-nav",children:(0,Ac.jsxs)("div",{className:"nav-section",children:[!r&&(0,Ac.jsx)("span",{className:"nav-label",children:"Menu"}),(0,Ac.jsx)("ul",{className:"nav-list",children:Yc.map(function(e){return(0,Ac.jsx)("li",{children:(0,Ac.jsxs)("button",{className:"nav-item ".concat(t===e.id?"active":""),onClick:function(){return n(e.id)},title:e.label,children:[(0,Ac.jsx)("span",{className:"nav-icon",children:(0,Ac.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,Ac.jsx)("path",{d:e.icon})})}),!r&&(0,Ac.jsx)("span",{children:e.label})]})},e.id)})})]})}),(0,Ac.jsx)("div",{className:"sidebar-footer",children:!r&&(0,Ac.jsxs)("div",{className:"sidebar-brand",children:[(0,Ac.jsx)("span",{children:"Powered by"}),(0,Ac.jsx)("strong",{children:"USIM"})]})})]})}function Xc(e){return Xc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xc(e)}function Zc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return el(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(el(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,el(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,el(d,"constructor",l),el(l,"constructor",c),c.displayName="GeneratorFunction",el(l,o,"GeneratorFunction"),el(d),el(d,o,"Generator"),el(d,r,function(){return this}),el(d,"toString",function(){return"[object Generator]"}),(Zc=function(){return{w:a,m:h}})()}function el(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}el=function(e,t,n,r){function a(t,n){el(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},el(e,t,n,r)}function tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tl(Object(n),!0).forEach(function(t){rl(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rl(e,t,n){return(t=function(e){var t=function(e){if("object"!=Xc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Xc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ol(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function al(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){ol(a,r,o,i,s,"next",e)}function s(e){ol(a,r,o,i,s,"throw",e)}i(void 0)})}}function il(e){return sl.apply(this,arguments)}function sl(){return sl=al(Zc().m(function e(t){var n,r,o,a,i,s=arguments;return Zc().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},r=t.startsWith("http")?t:"".concat(Sc).concat(t),e.p=1,e.n=2,fetch(r,{method:n.method||"GET",headers:nl({"Content-Type":"application/json"},n.headers),body:n.body?JSON.stringify(n.body):void 0});case 2:return o=e.v,e.n=3,o.json().catch(function(){return null});case 3:return a=e.v,e.a(2,{ok:o.ok,status:o.status,data:a,error:o.ok?null:(null==a?void 0:a.message)||(null==a?void 0:a.error)||"HTTP ".concat(o.status)});case 4:return e.p=4,i=e.v,e.a(2,{ok:!1,status:0,data:null,error:i.message||"Network error"})}},e,null,[[1,4]])})),sl.apply(this,arguments)}function cl(e,t){return ll.apply(this,arguments)}function ll(){return ll=al(Zc().m(function e(t,n){var r,o,a,i,s,c,l,u,d,h,p,f=arguments;return Zc().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=f.length>2&&void 0!==f[2]?f[2]:{},a=(o=f.length>3&&void 0!==f[3]?f[3]:{}).sessionToken,i=o.tenantId,console.log("[API] callService:",t,n),s={"Content-Type":"application/json"},a&&(s.Authorization="Bearer ".concat(a)),(c=i||localStorage.getItem("adplatform_tenantId"))&&(s["X-Tenant-Id"]=c),l="".concat(Sc,"/api/execution/request"),u={provider:t,operation:n,payload:r},console.log("[API] Request URL:",l),console.log("[API] Request body:",u),e.p=1,e.n=2,fetch(l,{method:"POST",headers:s,body:JSON.stringify(u)});case 2:return d=e.v,console.log("[API] Response status:",d.status),e.n=3,d.json().catch(function(){return null});case 3:return h=e.v,e.a(2,{ok:d.ok&&!1!==(null==h?void 0:h.ok),status:d.status,data:h,error:d.ok?null:(null==h?void 0:h.message)||(null==h?void 0:h.error)||"HTTP ".concat(d.status)});case 4:return e.p=4,p=e.v,console.error("[API] Request error:",p),e.a(2,{ok:!1,status:0,data:null,error:p.message||"Network error"})}},e,null,[[1,4]])})),ll.apply(this,arguments)}function ul(){return dl.apply(this,arguments)}function dl(){return(dl=al(Zc().m(function e(){return Zc().w(function(e){for(;;)if(0===e.n)return e.a(2,il("/health"))},e)}))).apply(this,arguments)}function hl(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return pl(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(pl(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,pl(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,pl(d,"constructor",l),pl(l,"constructor",c),c.displayName="GeneratorFunction",pl(l,o,"GeneratorFunction"),pl(d),pl(d,o,"Generator"),pl(d,r,function(){return this}),pl(d,"toString",function(){return"[object Generator]"}),(hl=function(){return{w:a,m:h}})()}function pl(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}pl=function(e,t,n,r){function a(t,n){pl(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},pl(e,t,n,r)}function fl(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function gl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ml(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ml(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ml(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var vl=function(e){return null!=e?Number(e).toLocaleString():"—"},yl=function(e){return(e||"enabled").replace("CAMPAIGN_STATUS_","").toLowerCase()};function bl(e){var t,n=e.onNavigate,o=Bc().sessionToken,a=gl((0,r.useState)([]),2),i=a[0],s=a[1],c=gl((0,r.useState)(!0),2),l=c[0],u=c[1],d=gl((0,r.useState)({impressions:0,clicks:0,conversions:0,spend:0}),2),h=d[0],p=d[1];return(0,r.useEffect)(function(){function e(){var t;return t=hl().m(function e(){var t,n,r,a,i,c,l;return hl().w(function(e){for(;;)switch(e.n){case 0:return u(!0),e.n=1,cl("google","ListCampaigns",{},{sessionToken:o});case 1:(n=e.v).ok&&null!==(t=n.data)&&void 0!==t&&t.data&&(r=Array.isArray(n.data.data)?n.data.data:[],s(r),a=0,i=0,c=0,l=0,r.forEach(function(e){var t=e.metrics||{};a+=parseInt(t.impressions||0),i+=parseInt(t.clicks||0),c+=parseInt(t.conversions||0),l+=parseInt(t.costMicros||0)}),p({impressions:a,clicks:i,conversions:c,spend:l})),u(!1);case 2:return e.a(2)}},e)}),e=function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function i(e){fl(a,r,o,i,s,"next",e)}function s(e){fl(a,r,o,i,s,"throw",e)}i(void 0)})},e.apply(this,arguments)}o&&function(){e.apply(this,arguments)}()},[o]),(0,Ac.jsxs)("div",{children:[(0,Ac.jsxs)("div",{className:"view-header",children:[(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h1",{children:"Dashboard"}),(0,Ac.jsx)("p",{className:"view-subtitle",children:"Overview of your advertising performance"})]}),(0,Ac.jsxs)("button",{className:"btn btn-primary",onClick:function(){return n("campaigns")},children:[(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M12 5v14M5 12h14"})}),"New Campaign"]})]}),(0,Ac.jsxs)("div",{className:"stats-grid",children:[(0,Ac.jsxs)("div",{className:"stat-card",children:[(0,Ac.jsx)("div",{className:"stat-label",children:"Impressions"}),(0,Ac.jsx)("div",{className:"stat-value",children:l?"—":vl(h.impressions)})]}),(0,Ac.jsxs)("div",{className:"stat-card",children:[(0,Ac.jsx)("div",{className:"stat-label",children:"Clicks"}),(0,Ac.jsx)("div",{className:"stat-value text-blue",children:l?"—":vl(h.clicks)})]}),(0,Ac.jsxs)("div",{className:"stat-card",children:[(0,Ac.jsx)("div",{className:"stat-label",children:"Conversions"}),(0,Ac.jsx)("div",{className:"stat-value text-green",children:l?"—":vl(h.conversions)})]}),(0,Ac.jsxs)("div",{className:"stat-card",children:[(0,Ac.jsx)("div",{className:"stat-label",children:"Total Spend"}),(0,Ac.jsx)("div",{className:"stat-value",children:l?"—":(t=h.spend,t?"$"+(parseInt(t)/1e6).toFixed(2):"$0.00")})]})]}),(0,Ac.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"20px",marginBottom:"28px"},children:[(0,Ac.jsxs)("div",{className:"content-card",children:[(0,Ac.jsx)("div",{className:"content-card-header",children:(0,Ac.jsx)("h3",{children:"Quick Actions"})}),(0,Ac.jsx)("div",{className:"content-card-body padded",children:(0,Ac.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[(0,Ac.jsx)("button",{className:"btn btn-outline",onClick:function(){return n("campaigns")},children:"View All Campaigns"}),(0,Ac.jsx)("button",{className:"btn btn-outline",onClick:function(){return n("reporting")},children:"View Reports"}),(0,Ac.jsx)("button",{className:"btn btn-outline",onClick:function(){return n("accounts")},children:"Manage Accounts"})]})})]}),(0,Ac.jsxs)("div",{className:"content-card",children:[(0,Ac.jsx)("div",{className:"content-card-header",children:(0,Ac.jsx)("h3",{children:"Getting Started"})}),(0,Ac.jsx)("div",{className:"content-card-body padded",children:(0,Ac.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:["Link your Google Ads account","Create your first campaign","Set a daily budget","Review performance metrics"].map(function(e,t){return(0,Ac.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"14px"},children:[(0,Ac.jsx)("div",{style:{width:"24px",height:"24px",borderRadius:"50%",background:"var(--color-primary-light)",color:"var(--color-primary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"600",flexShrink:0},children:t+1}),(0,Ac.jsx)("span",{children:e})]},t)})})})]})]}),(0,Ac.jsxs)("div",{className:"content-card",children:[(0,Ac.jsxs)("div",{className:"content-card-header",children:[(0,Ac.jsx)("h3",{children:"Recent Campaigns"}),i.length>0&&(0,Ac.jsx)("button",{className:"btn btn-sm btn-outline",onClick:function(){return n("campaigns")},children:"View All"})]}),(0,Ac.jsx)("div",{className:"content-card-body",children:l?(0,Ac.jsx)("div",{className:"loading-placeholder padded",children:[1,2,3].map(function(e){return(0,Ac.jsx)("div",{className:"skeleton skeleton-row",style:{width:"".concat(100-15*e,"%")}},e)})}):0===i.length?(0,Ac.jsxs)("div",{className:"empty-state",children:[(0,Ac.jsx)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:(0,Ac.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})}),(0,Ac.jsx)("h3",{children:"No campaigns yet"}),(0,Ac.jsx)("p",{children:"Create your first campaign to get started"}),(0,Ac.jsx)("button",{className:"btn btn-primary btn-sm",onClick:function(){return n("campaigns")},children:"Create Campaign"})]}):i.slice(0,5).map(function(e,t){return(0,Ac.jsxs)("div",{className:"campaign-row",onClick:function(){return n("campaigns")},children:[(0,Ac.jsxs)("div",{className:"campaign-info",children:[(0,Ac.jsx)("span",{className:"campaign-name",children:e.name||"Campaign ".concat(t+1)}),(0,Ac.jsx)("span",{className:"campaign-type",children:(e.advertisingChannelType||"Search").replace("ADVERTISING_CHANNEL_TYPE_","")})]}),(0,Ac.jsx)("span",{className:"status-badge status-".concat(yl(e.status)),children:yl(e.status)})]},t)})})]})]})}function xl(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return wl(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(wl(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,wl(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,wl(d,"constructor",l),wl(l,"constructor",c),c.displayName="GeneratorFunction",wl(l,o,"GeneratorFunction"),wl(d),wl(d,o,"Generator"),wl(d,r,function(){return this}),wl(d,"toString",function(){return"[object Generator]"}),(xl=function(){return{w:a,m:h}})()}function wl(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}wl=function(e,t,n,r){function a(t,n){wl(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},wl(e,t,n,r)}function kl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Cl(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Sl(e){var t={"Content-Type":"application/json"};e&&(t.Authorization="Bearer ".concat(e));var n=localStorage.getItem("adplatform_tenantId");return n&&(t["X-Tenant-Id"]=n),t}function Tl(e,t,n,r){return Il.apply(this,arguments)}function Il(){var e;return e=xl().m(function e(t,n,r,o){var a,i,s,c;return xl().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,a={method:t,headers:Sl(o)},r&&"GET"!==t&&(a.body=JSON.stringify(r)),e.n=1,fetch("".concat(Sc).concat(n),a);case 1:return i=e.v,e.n=2,i.json().catch(function(){return null});case 2:return s=e.v,e.a(2,{ok:i.ok&&!1!==(null==s?void 0:s.ok),status:i.status,data:s,error:i.ok?null:(null==s?void 0:s.error)||(null==s?void 0:s.message)||"HTTP ".concat(i.status)});case 3:return e.p=3,c=e.v,e.a(2,{ok:!1,status:0,data:null,error:c.message})}},e,null,[[0,3]])}),Il=function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Cl(a,r,o,i,s,"next",e)}function s(e){Cl(a,r,o,i,s,"throw",e)}i(void 0)})},Il.apply(this,arguments)}function jl(e){var t=new URLSearchParams;Object.entries(e).forEach(function(e){var n,r,o=(r=2,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(n,r)||function(e,t){if(e){if("string"==typeof e)return kl(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kl(e,t):void 0}}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],i=o[1];null!=i&&t.set(a,String(i))});var n=t.toString();return n?"?"+n:""}function Al(e,t,n,r){return Tl("GET","/api/initiative".concat(jl({status:t,page:n,pageSize:r})),null,e)}function Nl(e,t,n){return Tl("PATCH","/api/initiative/".concat(e,"/status"),{status:t},n)}function El(e,t){return Tl("POST","/api/initiative/stage",e,t)}function _l(e,t){return Tl("GET","/api/initiative/".concat(e,"/billing"),null,t)}function Pl(e,t){return Tl("POST","/api/initiative/".concat(e,"/launch"),{},t)}function Ol(e,t){return Tl("GET","/api/initiative/".concat(e,"/channels"),null,t)}function Rl(e){return Tl("GET","/api/initiative/channels/available",null,e)}function Ml(e,t,n){return Tl("GET","/api/initiative/templates".concat(jl({businessCategory:t,objective:n})),null,e)}function zl(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Ll(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ll(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Ll(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,Ll(d,"constructor",l),Ll(l,"constructor",c),c.displayName="GeneratorFunction",Ll(l,o,"GeneratorFunction"),Ll(d),Ll(d,o,"Generator"),Ll(d,r,function(){return this}),Ll(d,"toString",function(){return"[object Generator]"}),(zl=function(){return{w:a,m:h}})()}function Ll(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ll=function(e,t,n,r){function a(t,n){Ll(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Ll(e,t,n,r)}function ql(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Dl(e){var t={"Content-Type":"application/json"};e&&(t.Authorization="Bearer ".concat(e));var n=localStorage.getItem("adplatform_tenantId");return n&&(t["X-Tenant-Id"]=n),t}function Fl(e,t,n,r){return Ul.apply(this,arguments)}function Ul(){var e;return e=zl().m(function e(t,n,r,o){var a,i,s,c;return zl().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,a={method:t,headers:Dl(o)},r&&"GET"!==t&&(a.body=JSON.stringify(r)),e.n=1,fetch("".concat(Sc).concat(n),a);case 1:return i=e.v,e.n=2,i.json().catch(function(){return null});case 2:return s=e.v,e.a(2,{ok:i.ok&&!1!==(null==s?void 0:s.ok),status:i.status,data:s,error:i.ok?null:(null==s?void 0:s.error)||(null==s?void 0:s.message)||"HTTP ".concat(i.status)});case 3:return e.p=3,c=e.v,e.a(2,{ok:!1,status:0,data:null,error:c.message})}},e,null,[[0,3]])}),Ul=function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){ql(a,r,o,i,s,"next",e)}function s(e){ql(a,r,o,i,s,"throw",e)}i(void 0)})},Ul.apply(this,arguments)}function Bl(e){return Fl("GET","/api/wizard/config",null,e)}function Hl(e,t,n){return Fl("POST","/api/wizard",{name:e,url:t},n)}function Kl(e,t){return Fl("GET","/api/wizard/".concat(e),null,t)}function $l(e,t,n){var r=new URLSearchParams;t&&r.set("status",t),n&&r.set("limit",String(n));var o=r.toString();return Fl("GET","/api/wizard".concat(o?"?"+o:""),null,e)}function Gl(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Fl("DELETE","/api/wizard/".concat(e).concat(n?"?force=true":""),null,t)}function Wl(e,t,n,r,o){return Fl("PUT","/api/wizard/".concat(e,"/step/").concat(t),{data:n,name:o},r)}function Vl(e,t){return cl("creative","AnalyzeUrl",{url:e},{sessionToken:t})}function Ql(e,t){return cl("creative","GenerateAssets",{analysis:e},{sessionToken:t})}function Yl(e,t){return cl("creative","GetImages",{analysis:e},{sessionToken:t})}function Jl(e,t){return cl("creative","CreateDraft",{url:e},{sessionToken:t})}function Xl(e,t,n,r,o){var a={businessCategory:e,objective:t};return n&&(a.ageSkew=n),r&&(a.marketScope=r),Fl("POST","/api/wizard/recommend",a,o)}function Zl(e,t){return cl("google","SearchGeoTargets",{query:e,countryCode:arguments.length>2&&void 0!==arguments[2]?arguments[2]:"US",maxResults:arguments.length>3&&void 0!==arguments[3]?arguments[3]:10},{sessionToken:t})}function eu(e){return eu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eu(e)}function tu(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return nu(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(nu(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,nu(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,nu(d,"constructor",l),nu(l,"constructor",c),c.displayName="GeneratorFunction",nu(l,o,"GeneratorFunction"),nu(d),nu(d,o,"Generator"),nu(d,r,function(){return this}),nu(d,"toString",function(){return"[object Generator]"}),(tu=function(){return{w:a,m:h}})()}function nu(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}nu=function(e,t,n,r){function a(t,n){nu(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},nu(e,t,n,r)}function ru(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function ou(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){ru(a,r,o,i,s,"next",e)}function s(e){ru(a,r,o,i,s,"throw",e)}i(void 0)})}}function au(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return iu(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?iu(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function iu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var su={draft:{label:"Draft",css:"status-draft",color:"gray"},staged:{label:"Ready to Launch",css:"status-staged",color:"blue"},pending:{label:"Launching",css:"status-pending",color:"blue"},submitted:{label:"In Review",css:"status-in-review",color:"blue"},pending_review:{label:"In Review",css:"status-in-review",color:"blue"},in_review:{label:"In Review",css:"status-in-review",color:"blue"},active:{label:"Active",css:"status-active",color:"green"},paused:{label:"Paused",css:"status-paused",color:"orange"},completed:{label:"Completed",css:"status-completed",color:"gray"},cancelled:{label:"Cancelled",css:"status-cancelled",color:"red"},error:{label:"Action Needed",css:"status-action-needed",color:"red"}},cu=["submitted","pending_review","in_review"];function lu(e){var t=(e.iniStatus||e.status||"draft").toLowerCase();if("staged"===t){var n=e.iniStartDate||e.startDate;if(n&&new Date(n)>new Date)return{label:"Scheduled",css:"status-scheduled",color:"blue"}}return su[t]||su.draft}function uu(e){return(e.iniStatus||e.status||"draft").toLowerCase()}function du(e){return cu.includes(e)}function hu(e){return e.iniInitiativeId||e.initiativeId||e.id}var pu=[{key:"all",label:"All"},{key:"active",label:"Active"},{key:"in_review",label:"In Review"},{key:"staged",label:"Ready"},{key:"paused",label:"Paused"},{key:"completed",label:"Completed"}],fu={active:["active"],in_review:["submitted","pending_review","in_review","pending"],staged:["staged"],paused:["paused"],completed:["completed","cancelled"]},gu=function(e){var t=parseFloat(e);return!t||isNaN(t)?"$0":t>=1e3?"$".concat((t/1e3).toFixed(t%1e3==0?0:1),"k"):"$".concat(t.toFixed(0))},mu=function(e){return e?new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—"},vu=function(e){if(!e)return"";var t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?"just now":t<3600?"".concat(Math.floor(t/60),"m ago"):t<86400?"".concat(Math.floor(t/3600),"h ago"):"".concat(Math.floor(t/86400),"d ago")},yu=function(e){return e?{awareness:"Brand Awareness",traffic:"Website Traffic",leads:"Lead Generation",sales:"Sales",conversions:"Conversions"}[e.toLowerCase()]||e.charAt(0).toUpperCase()+e.slice(1):"Campaign"},bu=function(e){return{google_ads:"Google Ads",google:"Google Ads",meta:"Meta",tiktok:"TikTok"}[(e||"").toLowerCase()]||e},xu={search:(0,Ac.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,Ac.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),calendar:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),(0,Ac.jsx)("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),(0,Ac.jsx)("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),(0,Ac.jsx)("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),dollar:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),(0,Ac.jsx)("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),play:(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:(0,Ac.jsx)("polygon",{points:"5,3 19,12 5,21"})}),pause:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,Ac.jsx)("rect",{x:"6",y:"4",width:"4",height:"16"}),(0,Ac.jsx)("rect",{x:"14",y:"4",width:"4",height:"16"})]}),rocket:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 00-2.91-.09z"}),(0,Ac.jsx)("path",{d:"M12 15l-3-3a22 22 0 012-3.95A12.88 12.88 0 0122 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 01-4 2z"}),(0,Ac.jsx)("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),(0,Ac.jsx)("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]}),eye:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}),copy:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),(0,Ac.jsx)("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),alert:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,Ac.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,Ac.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),pencil:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),(0,Ac.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),plus:(0,Ac.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,Ac.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),close:(0,Ac.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,Ac.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),chart:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),(0,Ac.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),(0,Ac.jsx)("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]}),x:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,Ac.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),check:(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("polyline",{points:"20 6 9 17 4 12"})}),clock:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,Ac.jsx)("polyline",{points:"12 6 12 12 16 14"})]})};function wu(e){var t=e.initiative,n=e.billing,r=e.loading,o=e.onConfirm,a=e.onCancel,i=(null==t?void 0:t.iniName)||(null==t?void 0:t.name)||"Campaign",s=parseFloat((null==t?void 0:t.iniBudget)||(null==t?void 0:t.totalBudget)||0);return(0,Ac.jsx)("div",{className:"modal-overlay",onClick:a,children:(0,Ac.jsxs)("div",{className:"modal-content launch-modal",onClick:function(e){return e.stopPropagation()},children:[(0,Ac.jsxs)("div",{className:"launch-modal-header",children:[(0,Ac.jsx)("div",{className:"launch-modal-icon",children:xu.rocket}),(0,Ac.jsx)("h3",{children:"Launch Campaign"}),(0,Ac.jsxs)("p",{children:["Ready to go live with ",(0,Ac.jsx)("strong",{children:i}),"?"]})]}),n&&(0,Ac.jsxs)("div",{className:"launch-modal-billing",children:[(0,Ac.jsxs)("div",{className:"billing-row",children:[(0,Ac.jsx)("span",{children:"Ad Spend"}),(0,Ac.jsxs)("span",{children:[gu(n.adSpend||s),"/mo"]})]}),n.managementFee>0&&(0,Ac.jsxs)("div",{className:"billing-row",children:[(0,Ac.jsx)("span",{children:"Management Fee"}),(0,Ac.jsxs)("span",{children:[gu(n.managementFee),"/mo"]})]}),(0,Ac.jsxs)("div",{className:"billing-row billing-total",children:[(0,Ac.jsx)("span",{children:"Total Monthly"}),(0,Ac.jsxs)("span",{children:[gu(n.totalCharge||s),"/mo"]})]})]}),!n&&(0,Ac.jsx)("div",{className:"launch-modal-billing",children:(0,Ac.jsxs)("div",{className:"billing-row billing-total",children:[(0,Ac.jsx)("span",{children:"Monthly Budget"}),(0,Ac.jsxs)("span",{children:[gu(s),"/mo"]})]})}),(0,Ac.jsxs)("div",{className:"launch-modal-actions",children:[(0,Ac.jsx)("button",{className:"btn btn-outline",onClick:a,disabled:r,children:"Cancel"}),(0,Ac.jsx)("button",{className:"btn btn-primary btn-launch",onClick:o,disabled:r,children:r?(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("span",{className:"mini-spinner"})," Launching…"]}):(0,Ac.jsxs)(Ac.Fragment,{children:[xu.rocket," Launch Now"]})})]})]})})}function ku(e){var t=e.initiative,n=e.channels,r=e.onClose,o=e.onAction,a=e.actionLoading;if(!t)return null;var i=lu(t),s=uu(t),c=parseFloat(t.iniBudget||t.totalBudget||0),l=hu(t),u=du(s);return(0,Ac.jsx)("div",{className:"detail-panel-overlay",onClick:r,children:(0,Ac.jsxs)("div",{className:"detail-panel",onClick:function(e){return e.stopPropagation()},children:[(0,Ac.jsxs)("div",{className:"detail-panel-header",children:[(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h3",{children:t.iniName||t.name||"Untitled"}),(0,Ac.jsx)("span",{className:"status-badge ".concat(i.css),children:i.label})]}),(0,Ac.jsx)("button",{className:"btn btn-ghost btn-icon",onClick:r,children:xu.close})]}),(0,Ac.jsxs)("div",{className:"detail-panel-body",children:[u&&(0,Ac.jsxs)("div",{className:"detail-notice notice-info",children:[(0,Ac.jsx)("span",{className:"notice-icon",children:xu.clock}),(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("strong",{children:"Under Review"}),(0,Ac.jsx)("p",{children:"This campaign has been submitted to the ad network and is awaiting approval. This typically takes 24–48 hours."})]})]}),(0,Ac.jsxs)("section",{className:"detail-section",children:[(0,Ac.jsx)("h4",{children:"Overview"}),(0,Ac.jsxs)("div",{className:"detail-grid",children:[(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Objective"}),(0,Ac.jsx)("span",{className:"detail-value",children:yu(t.iniObjective||t.objective)})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Budget"}),(0,Ac.jsxs)("span",{className:"detail-value",children:[gu(c),"/",t.iniBudgetPeriod||t.budgetPeriod||"month"]})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Start Date"}),(0,Ac.jsx)("span",{className:"detail-value",children:mu(t.iniStartDate||t.startDate)})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"End Date"}),(0,Ac.jsx)("span",{className:"detail-value",children:mu(t.iniEndDate||t.endDate)})]})]})]}),n&&n.length>0&&(0,Ac.jsxs)("section",{className:"detail-section",children:[(0,Ac.jsx)("h4",{children:"Channel Allocation"}),(0,Ac.jsx)("div",{className:"channel-allocation-list",children:n.map(function(e,t){var n=parseFloat(e.chcAllocPct||e.allocPct||0),r=c*(n/100),o=(e.chcStatus||e.status||"").toLowerCase(),a=su[o]||su.pending;return(0,Ac.jsxs)("div",{className:"channel-alloc-row",children:[(0,Ac.jsxs)("div",{className:"channel-alloc-info",children:[(0,Ac.jsx)("span",{className:"channel-alloc-name",children:bu(e.chcChannel||e.channel)}),(0,Ac.jsx)("span",{className:"status-badge-sm ".concat(a.css),children:a.label}),(0,Ac.jsx)("span",{className:"channel-alloc-budget",children:gu(r)})]}),(0,Ac.jsx)("div",{className:"channel-alloc-bar-track",children:(0,Ac.jsx)("div",{className:"channel-alloc-bar",style:{width:"".concat(Math.min(n,100),"%")}})}),(0,Ac.jsxs)("span",{className:"channel-alloc-pct",children:[n.toFixed(0),"%"]})]},t)})})]}),(0,Ac.jsxs)("section",{className:"detail-section",children:[(0,Ac.jsx)("h4",{children:"Timeline"}),(0,Ac.jsxs)("div",{className:"detail-timeline",children:[(0,Ac.jsxs)("div",{className:"timeline-item",children:[(0,Ac.jsx)("span",{className:"timeline-dot created"}),(0,Ac.jsxs)("span",{children:["Created ",mu(t.iniCreatedAt||t.createdAt)]})]}),u&&(0,Ac.jsxs)("div",{className:"timeline-item",children:[(0,Ac.jsx)("span",{className:"timeline-dot submitted"}),(0,Ac.jsx)("span",{children:"Submitted for review"})]}),("active"===s||"paused"===s||"completed"===s)&&(0,Ac.jsxs)("div",{className:"timeline-item",children:[(0,Ac.jsx)("span",{className:"timeline-dot launched"}),(0,Ac.jsxs)("span",{children:["Launched ",mu(t.iniStartDate||t.startDate)]})]}),"completed"===s&&(0,Ac.jsxs)("div",{className:"timeline-item",children:[(0,Ac.jsx)("span",{className:"timeline-dot completed"}),(0,Ac.jsxs)("span",{children:["Completed ",mu(t.iniEndDate||t.endDate)]})]})]})]}),(0,Ac.jsx)("section",{className:"detail-section",children:(0,Ac.jsxs)("div",{className:"detail-actions",children:["staged"===s&&(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsxs)("button",{className:"btn btn-primary",onClick:function(){return o("launch",t)},disabled:a===l,children:[xu.rocket," Launch Campaign"]}),(0,Ac.jsxs)("button",{className:"btn btn-ghost",onClick:function(){return o("cancel",t)},disabled:a===l,children:[xu.x," Cancel"]})]}),u&&(0,Ac.jsxs)("button",{className:"btn btn-outline btn-danger-outline",onClick:function(){return o("cancel",t)},disabled:a===l,children:[xu.x," Cancel Campaign"]}),"active"===s&&(0,Ac.jsxs)("button",{className:"btn btn-outline",onClick:function(){return o("pause",t)},children:[xu.pause," Pause Campaign"]}),"paused"===s&&(0,Ac.jsxs)("button",{className:"btn btn-primary",onClick:function(){return o("resume",t)},children:[xu.play," Resume Campaign"]}),("completed"===s||"cancelled"===s)&&(0,Ac.jsxs)("button",{className:"btn btn-outline",onClick:function(){return o("duplicate",t)},children:[xu.copy," Duplicate Campaign"]}),"error"===s&&(0,Ac.jsxs)("button",{className:"btn btn-primary",onClick:function(){return o("resolve",t)},children:[xu.alert," Resolve Issue"]})]})})]})]})})}function Cu(e){var t=e.onNavigate,n=Bc().sessionToken,o=au((0,r.useState)([]),2),a=o[0],i=o[1],s=au((0,r.useState)([]),2),c=s[0],l=s[1],u=au((0,r.useState)(!0),2),d=u[0],h=u[1],p=au((0,r.useState)("all"),2),f=p[0],g=p[1],m=au((0,r.useState)(""),2),v=m[0],y=m[1],b=au((0,r.useState)(null),2),x=b[0],w=b[1],k=au((0,r.useState)([]),2),C=k[0],S=k[1],T=au((0,r.useState)(null),2),I=T[0],j=T[1],A=au((0,r.useState)(null),2),N=A[0],E=A[1],_=au((0,r.useState)(null),2),P=_[0],O=_[1],R=au((0,r.useState)(!1),2),M=R[0],z=R[1],L=(0,r.useCallback)(ou(tu().m(function e(){var t,r,o,a,s,c,u,d,p,f;return tu().w(function(e){for(;;)switch(e.p=e.n){case 0:return h(!0),e.p=1,e.n=2,Promise.all([Al(n),$l(n,"draft",20)]);case 2:t=e.v,r=au(t,2),o=r[0],a=r[1],o.ok&&(u=(null===(s=o.data)||void 0===s?void 0:s.data)||(null===(c=o.data)||void 0===c?void 0:c.initiatives)||[],i(Array.isArray(u)?u:[])),a.ok&&(p=(null===(d=a.data)||void 0===d?void 0:d.data)||a.data||[],l(Array.isArray(p)?p:[])),e.n=4;break;case 3:e.p=3,f=e.v,console.error("Failed to load campaigns:",f);case 4:h(!1);case 5:return e.a(2)}},e,null,[[1,3]])})),[n]);(0,r.useEffect)(function(){n&&L()},[n,L]);var q=function(){var e=ou(tu().m(function e(t){var r,o,a,i,s;return tu().w(function(e){for(;;)switch(e.n){case 0:if(w(t),!(r=hu(t))){e.n=2;break}return e.n=1,Ol(r,n);case 1:(o=e.v).ok&&(s=(null===(a=o.data)||void 0===a?void 0:a.data)||(null===(i=o.data)||void 0===i?void 0:i.channels)||[],S(Array.isArray(s)?s:[]));case 2:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),D=function(){w(null),S([])},F=function(){var e=ou(tu().m(function e(t){var r,o,a;return tu().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=hu(t),E(t),O(null),e.p=1,e.n=2,_l(r,n);case 2:(a=e.v).ok&&null!==(o=a.data)&&void 0!==o&&o.billing&&O(a.data.billing),e.n=4;break;case 3:e.p=3,e.v;case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),U=function(){var e=ou(tu().m(function e(){var t,r,o,a,i;return tu().w(function(e){for(;;)switch(e.p=e.n){case 0:if(N){e.n=1;break}return e.a(2);case 1:return t=hu(N),z(!0),e.p=2,e.n=3,Pl(t,n);case 3:if(!((o=e.v).ok||null!==(r=o.data)&&void 0!==r&&r.channels)){e.n=5;break}return E(null),D(),e.n=4,L();case 4:e.n=6;break;case 5:alert(o.error||(null===(a=o.data)||void 0===a?void 0:a.error)||"Launch failed");case 6:e.n=8;break;case 7:e.p=7,i=e.v,alert("Launch error: "+i.message);case 8:z(!1);case 9:return e.a(2)}},e,null,[[2,7]])}));return function(){return e.apply(this,arguments)}}(),B=function(){var e=ou(tu().m(function e(r,o){var a,i;return tu().w(function(e){for(;;)switch(e.p=e.n){case 0:if(a=hu(o),j(a),e.p=1,"launch"!==r){e.n=2;break}return j(null),F(o),e.a(2);case 2:if("pause"!==r){e.n=5;break}return e.n=3,Nl(a,"paused",n);case 3:return e.n=4,L();case 4:D(),e.n=13;break;case 5:if("resume"!==r){e.n=8;break}return e.n=6,Nl(a,"active",n);case 6:return e.n=7,L();case 7:D(),e.n=13;break;case 8:if("cancel"!==r){e.n=12;break}if(!window.confirm("Cancel this campaign? This action cannot be undone.")){e.n=11;break}return e.n=9,Nl(a,"cancelled",n);case 9:return e.n=10,L();case 10:D();case 11:e.n=13;break;case 12:"duplicate"===r?null==t||t("wizard",{duplicateFrom:a}):"resolve"===r&&q(o);case 13:e.n=15;break;case 14:e.p=14,i=e.v,console.error("Action ".concat(r," failed:"),i);case 15:j(null);case 16:return e.a(2)}},e,null,[[1,14]])}));return function(t,n){return e.apply(this,arguments)}}(),H=function(e){var n=e.wizWizardId||e.wizardId||e.id;null==t||t("wizard",{wizardId:n})},K=function(){var e=ou(tu().m(function e(t,r){var o;return tu().w(function(e){for(;;)switch(e.n){case 0:if(t.stopPropagation(),!(o=r.wizWizardId||r.wizardId||r.id)||!window.confirm("Delete this draft?")){e.n=2;break}return e.n=1,Gl(o,n);case 1:return e.n=2,L();case 2:return e.a(2)}},e)}));return function(t,n){return e.apply(this,arguments)}}(),$=a.filter(function(e){var t,n=uu(e);if("all"!==f&&(null===(t=fu[f])||void 0===t||!t.includes(n)))return!1;if(v){var r=v.toLowerCase(),o=(e.iniName||e.name||"").toLowerCase(),a=(e.iniObjective||e.objective||"").toLowerCase(),i=lu(e);if(!o.includes(r)&&!a.includes(r)&&!i.label.toLowerCase().includes(r))return!1}return!0}),G={};return pu.forEach(function(e){"all"===e.key?G[e.key]=a.length:G[e.key]=a.filter(function(t){var n;return null===(n=fu[e.key])||void 0===n?void 0:n.includes(uu(t))}).length}),d?(0,Ac.jsx)("div",{className:"view-container",children:(0,Ac.jsx)("div",{style:{textAlign:"center",padding:"60px 0",color:"var(--color-text-muted)"},children:"Loading campaigns…"})}):(0,Ac.jsxs)("div",{className:"view-container",children:[(0,Ac.jsxs)("div",{className:"view-header",children:[(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h2",{children:"Campaigns"}),(0,Ac.jsx)("p",{className:"text-muted",children:"Manage your advertising campaigns across all channels"})]}),(0,Ac.jsxs)("button",{className:"btn btn-primary",onClick:function(){return null==t?void 0:t("wizard")},children:[xu.plus," New Campaign"]})]}),c.length>0&&(0,Ac.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,Ac.jsxs)("h4",{style:{fontSize:"13px",fontWeight:600,color:"var(--color-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:"10px"},children:["Drafts (",c.length,")"]}),(0,Ac.jsx)("div",{className:"draft-cards",children:c.map(function(e,t){return(0,Ac.jsxs)("div",{className:"draft-card",onClick:function(){return H(e)},children:[(0,Ac.jsx)("span",{style:{fontSize:"20px"},children:xu.pencil}),(0,Ac.jsxs)("div",{className:"draft-info",children:[(0,Ac.jsx)("span",{style:{fontWeight:600,fontSize:"13px"},children:e.wizName||e.name||"Draft ".concat(t+1)}),(0,Ac.jsx)("span",{style:{fontSize:"12px",color:"var(--color-text-muted)"},children:vu(e.wizUpdatedAt||e.updatedAt)})]}),(0,Ac.jsx)("button",{className:"btn btn-ghost btn-icon",onClick:function(t){return K(t,e)},title:"Delete draft",style:{marginLeft:"auto",fontSize:"12px",opacity:.5},children:"×"})]},t)})})]}),(0,Ac.jsxs)("div",{className:"campaigns-toolbar",children:[(0,Ac.jsx)("div",{className:"filter-tabs",children:pu.map(function(e){var t=G[e.key]||0,n=f===e.key;return 0!==t||"all"===e.key||n?(0,Ac.jsxs)("button",{className:"filter-tab".concat(n?" active":""),onClick:function(){return g(e.key)},children:[e.label,t>0&&(0,Ac.jsx)("span",{className:"tab-count",children:t})]},e.key):null})}),(0,Ac.jsxs)("div",{className:"search-box",children:[(0,Ac.jsx)("span",{className:"search-icon",children:xu.search}),(0,Ac.jsx)("input",{type:"text",className:"search-input",placeholder:"Search campaigns…",value:v,onChange:function(e){return y(e.target.value)}}),v&&(0,Ac.jsx)("button",{className:"search-clear",onClick:function(){return y("")},children:xu.x})]})]}),0===$.length?(0,Ac.jsxs)("div",{className:"campaigns-empty",children:[(0,Ac.jsx)("div",{className:"campaigns-empty-icon",children:xu.chart}),(0,Ac.jsx)("p",{className:"campaigns-empty-title",children:0===a.length?"No campaigns yet":"No campaigns match your filters"}),(0,Ac.jsx)("p",{className:"campaigns-empty-sub",children:0===a.length?"Create your first campaign to get started.":"Try adjusting your search or filter."})]}):(0,Ac.jsx)("div",{className:"campaign-cards",children:$.map(function(e,t){var n=lu(e),r=uu(e),o=hu(e),a=parseFloat(e.iniBudget||e.totalBudget||0),i=e.channels||e.channelSummary||[],s=du(r);return(0,Ac.jsxs)("div",{className:"campaign-card",onClick:function(){return q(e)},children:[(0,Ac.jsxs)("div",{className:"campaign-card-header",children:[(0,Ac.jsx)("span",{className:"campaign-card-title",children:e.iniName||e.name||"Untitled Campaign"}),(0,Ac.jsx)("span",{className:"status-badge ".concat(n.css),children:n.label})]}),(0,Ac.jsxs)("div",{className:"campaign-card-body",children:[(0,Ac.jsxs)("div",{className:"campaign-card-meta",children:[(0,Ac.jsxs)("span",{children:[xu.dollar," ",gu(a),"/",e.iniBudgetPeriod||e.budgetPeriod||"monthly"]}),(0,Ac.jsxs)("span",{children:[xu.calendar," ",mu(e.iniStartDate||e.startDate)]}),(e.iniObjective||e.objective)&&(0,Ac.jsx)("span",{children:yu(e.iniObjective||e.objective)})]}),Array.isArray(i)&&i.length>0&&(0,Ac.jsx)("div",{className:"campaign-card-channels",children:i.map(function(e,t){var n="string"==typeof e?e:e.chcChannel||e.channel||e.name,r="object"===eu(e)?e.chcAllocPct||e.allocPct:null;return(0,Ac.jsxs)("span",{className:"channel-pill",children:[bu(n),r?" ".concat(parseFloat(r).toFixed(0),"%"):""]},t)})}),(0,Ac.jsxs)("div",{className:"campaign-card-actions",children:["draft"===r&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:function(t){t.stopPropagation(),H(e)},children:[xu.pencil," Continue"]}),"staged"===r&&(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsxs)("button",{className:"btn btn-sm btn-primary",onClick:function(t){t.stopPropagation(),B("launch",e)},disabled:I===o,children:[xu.rocket," Launch"]}),(0,Ac.jsxs)("button",{className:"btn btn-sm btn-ghost",onClick:function(t){t.stopPropagation(),B("cancel",e)},children:[xu.x," Cancel"]})]}),s&&(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:function(t){t.stopPropagation(),q(e)},children:[xu.eye," View Details"]}),(0,Ac.jsxs)("button",{className:"btn btn-sm btn-ghost",onClick:function(t){t.stopPropagation(),B("cancel",e)},children:[xu.x," Cancel"]})]}),"active"===r&&(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:function(t){t.stopPropagation(),q(e)},children:[xu.chart," Performance"]}),(0,Ac.jsxs)("button",{className:"btn btn-sm btn-ghost",onClick:function(t){t.stopPropagation(),B("pause",e)},children:[xu.pause," Pause"]})]}),"paused"===r&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-primary",onClick:function(t){t.stopPropagation(),B("resume",e)},children:[xu.play," Resume"]}),"pending"===r&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:function(t){t.stopPropagation(),q(e)},children:[xu.eye," View Details"]}),("completed"===r||"cancelled"===r)&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:function(t){t.stopPropagation(),B("duplicate",e)},children:[xu.copy," Duplicate"]}),"error"===r&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-primary",onClick:function(t){t.stopPropagation(),B("resolve",e)},children:[xu.alert," Resolve"]})]})]})]},o||t)})}),x&&(0,Ac.jsx)(ku,{initiative:x,channels:C,onClose:D,onAction:B,actionLoading:I}),N&&(0,Ac.jsx)(wu,{initiative:N,billing:P,loading:M,onConfirm:U,onCancel:function(){E(null),O(null)}})]})}function Su(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Tu(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Tu(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Tu(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,Tu(d,"constructor",l),Tu(l,"constructor",c),c.displayName="GeneratorFunction",Tu(l,o,"GeneratorFunction"),Tu(d),Tu(d,o,"Generator"),Tu(d,r,function(){return this}),Tu(d,"toString",function(){return"[object Generator]"}),(Su=function(){return{w:a,m:h}})()}function Tu(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Tu=function(e,t,n,r){function a(t,n){Tu(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Tu(e,t,n,r)}function Iu(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function ju(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||Au(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Au(e,t){if(e){if("string"==typeof e)return Nu(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nu(e,t):void 0}}function Nu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Eu=function(e){return null!=e?Number(e).toLocaleString():"—"},_u=function(e){return e?"$"+(parseInt(e)/1e6).toFixed(2):"$0.00"},Pu=[{label:"Last 7 Days",days:7},{label:"Last 30 Days",days:30},{label:"Last 90 Days",days:90},{label:"This Month",days:"month"}];function Ou(){var e=Bc().sessionToken,t=ju((0,r.useState)([]),2),n=t[0],o=t[1],a=ju((0,r.useState)(!0),2),i=a[0],s=a[1],c=ju((0,r.useState)(1),2),l=c[0],u=c[1],d=ju((0,r.useState)("impressions"),2),h=d[0],p=d[1],f=ju((0,r.useState)("desc"),2),g=f[0],m=f[1];(0,r.useEffect)(function(){function t(){var n;return n=Su().m(function t(){var n,r;return Su().w(function(t){for(;;)switch(t.n){case 0:return s(!0),t.n=1,cl("google","ListCampaigns",{},{sessionToken:e});case 1:(r=t.v).ok&&null!==(n=r.data)&&void 0!==n&&n.data&&o(Array.isArray(r.data.data)?r.data.data:[]),s(!1);case 2:return t.a(2)}},t)}),t=function(){var e=this,t=arguments;return new Promise(function(r,o){var a=n.apply(e,t);function i(e){Iu(a,r,o,i,s,"next",e)}function s(e){Iu(a,r,o,i,s,"throw",e)}i(void 0)})},t.apply(this,arguments)}e&&function(){t.apply(this,arguments)}()},[e]);var v=n.reduce(function(e,t){var n=t.metrics||{};return e.impressions+=parseInt(n.impressions||0),e.clicks+=parseInt(n.clicks||0),e.conversions+=parseInt(n.conversions||0),e.cost+=parseInt(n.costMicros||0),e},{impressions:0,clicks:0,conversions:0,cost:0});v.ctr=v.impressions>0?(v.clicks/v.impressions*100).toFixed(2):"0.00",v.cpc=v.clicks>0?(v.cost/v.clicks/1e6).toFixed(2):"0.00";var y,b=(y=n,function(e){if(Array.isArray(e))return Nu(e)}(y)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(y)||Au(y)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).sort(function(e,t){var n,r,o=parseInt((null===(n=e.metrics)||void 0===n?void 0:n[h])||0),a=parseInt((null===(r=t.metrics)||void 0===r?void 0:r[h])||0);return"desc"===g?a-o:o-a}),x=function(e){h===e?m(function(e){return"desc"===e?"asc":"desc"}):(p(e),m("desc"))},w=function(e){return h===e?"desc"===g?" ↓":" ↑":""};return(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("div",{className:"view-header",children:(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h1",{children:"Reporting"}),(0,Ac.jsx)("p",{className:"view-subtitle",children:"Campaign performance overview"})]})}),(0,Ac.jsx)("div",{className:"preset-row",children:Pu.map(function(e,t){return(0,Ac.jsx)("button",{className:"btn btn-sm ".concat(l===t?"btn-primary":"btn-outline"),onClick:function(){return u(t)},children:e.label},t)})}),(0,Ac.jsx)("div",{className:"stats-grid",style:{gridTemplateColumns:"repeat(6, 1fr)"},children:[{label:"Impressions",value:Eu(v.impressions)},{label:"Clicks",value:Eu(v.clicks)},{label:"CTR",value:v.ctr+"%"},{label:"Avg CPC",value:"$"+v.cpc},{label:"Conversions",value:Eu(v.conversions)},{label:"Total Spend",value:_u(v.cost)}].map(function(e,t){return(0,Ac.jsxs)("div",{className:"stat-card",children:[(0,Ac.jsx)("div",{className:"stat-label",children:e.label}),(0,Ac.jsx)("div",{className:"stat-value",style:{fontSize:"22px"},children:i?"—":e.value})]},t)})}),(0,Ac.jsxs)("div",{className:"content-card",children:[(0,Ac.jsxs)("div",{className:"content-card-header",children:[(0,Ac.jsx)("h3",{children:"Campaign Breakdown"}),(0,Ac.jsxs)("span",{style:{fontSize:"13px",color:"var(--color-text-muted)"},children:[n.length," campaign",1!==n.length?"s":""]})]}),(0,Ac.jsx)("div",{className:"content-card-body",children:i?(0,Ac.jsx)("div",{className:"loading-placeholder padded",children:[1,2,3].map(function(e){return(0,Ac.jsx)("div",{className:"skeleton skeleton-row",style:{height:"52px",marginBottom:"8px"}},e)})}):0===n.length?(0,Ac.jsxs)("div",{className:"empty-state",children:[(0,Ac.jsx)("h3",{children:"No data available"}),(0,Ac.jsx)("p",{children:"Campaign data will appear here once campaigns are running."})]}):(0,Ac.jsxs)("table",{className:"data-table",children:[(0,Ac.jsx)("thead",{children:(0,Ac.jsxs)("tr",{children:[(0,Ac.jsx)("th",{children:"Campaign"}),(0,Ac.jsxs)("th",{style:{cursor:"pointer"},onClick:function(){return x("impressions")},children:["Impressions",w("impressions")]}),(0,Ac.jsxs)("th",{style:{cursor:"pointer"},onClick:function(){return x("clicks")},children:["Clicks",w("clicks")]}),(0,Ac.jsx)("th",{children:"CTR"}),(0,Ac.jsxs)("th",{style:{cursor:"pointer"},onClick:function(){return x("costMicros")},children:["Cost",w("costMicros")]}),(0,Ac.jsxs)("th",{style:{cursor:"pointer"},onClick:function(){return x("conversions")},children:["Conv.",w("conversions")]})]})}),(0,Ac.jsx)("tbody",{children:b.map(function(e,t){var n=e.metrics||{},r=parseInt(n.impressions||0),o=parseInt(n.clicks||0),a=r>0?(o/r*100).toFixed(2):"0.00";return(0,Ac.jsxs)("tr",{children:[(0,Ac.jsx)("td",{style:{fontWeight:500},children:e.name||"Campaign ".concat(t+1)}),(0,Ac.jsx)("td",{children:Eu(r)}),(0,Ac.jsx)("td",{children:Eu(o)}),(0,Ac.jsxs)("td",{children:[a,"%"]}),(0,Ac.jsx)("td",{children:_u(n.costMicros)}),(0,Ac.jsx)("td",{children:Eu(n.conversions)})]},t)})})]})})]})]})}function Ru(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Mu(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Mu(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Mu(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,Mu(d,"constructor",l),Mu(l,"constructor",c),c.displayName="GeneratorFunction",Mu(l,o,"GeneratorFunction"),Mu(d),Mu(d,o,"Generator"),Mu(d,r,function(){return this}),Mu(d,"toString",function(){return"[object Generator]"}),(Ru=function(){return{w:a,m:h}})()}function Mu(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Mu=function(e,t,n,r){function a(t,n){Mu(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Mu(e,t,n,r)}function zu(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Lu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qu(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qu(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Du(){var e=Bc(),t=e.sessionToken,n=e.sessionUser,o=Lu((0,r.useState)([]),2),a=o[0],i=o[1],s=Lu((0,r.useState)(!0),2),c=s[0],l=s[1],u=Lu((0,r.useState)(null),2),d=u[0],h=u[1];return(0,r.useEffect)(function(){function e(){var n;return n=Ru().m(function e(){var n,r;return Ru().w(function(e){for(;;)switch(e.n){case 0:return l(!0),e.n=1,cl("google","ListAccounts",{},{sessionToken:t});case 1:(r=e.v).ok&&null!==(n=r.data)&&void 0!==n&&n.data&&i(Array.isArray(r.data.data)?r.data.data:[]),l(!1);case 2:return e.a(2)}},e)}),e=function(){var e=this,t=arguments;return new Promise(function(r,o){var a=n.apply(e,t);function i(e){zu(a,r,o,i,s,"next",e)}function s(e){zu(a,r,o,i,s,"throw",e)}i(void 0)})},e.apply(this,arguments)}t&&function(){e.apply(this,arguments)}()},[t]),(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("div",{className:"view-header",children:(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h1",{children:"Accounts"}),(0,Ac.jsx)("p",{className:"view-subtitle",children:"Manage linked advertising accounts"})]})}),(0,Ac.jsx)("div",{className:"content-card",style:{marginBottom:"24px"},children:(0,Ac.jsx)("div",{className:"content-card-body padded",children:(0,Ac.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"20px"},children:[(0,Ac.jsx)("div",{style:{width:"56px",height:"56px",borderRadius:"50%",background:"var(--color-primary)",color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"20px",fontWeight:"600",flexShrink:0},children:((null==n?void 0:n.name)||(null==n?void 0:n.email)||"U").charAt(0).toUpperCase()}),(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("div",{style:{fontSize:"18px",fontWeight:"600"},children:(null==n?void 0:n.name)||"User"}),(0,Ac.jsx)("div",{style:{fontSize:"14px",color:"var(--color-text-muted)"},children:(null==n?void 0:n.email)||""}),(null==n?void 0:n.role)&&(0,Ac.jsx)("div",{style:{fontSize:"13px",color:"var(--color-primary)",marginTop:"4px"},children:n.role})]})]})})}),(0,Ac.jsxs)("div",{className:"content-card",children:[(0,Ac.jsxs)("div",{className:"content-card-header",children:[(0,Ac.jsx)("h3",{children:"Linked Accounts"}),(0,Ac.jsxs)("span",{style:{fontSize:"13px",color:"var(--color-text-muted)"},children:[a.length," account",1!==a.length?"s":""]})]}),(0,Ac.jsx)("div",{className:"content-card-body",children:c?(0,Ac.jsx)("div",{className:"loading-placeholder padded",children:[1,2].map(function(e){return(0,Ac.jsx)("div",{className:"skeleton skeleton-row",style:{height:"72px",marginBottom:"8px"}},e)})}):0===a.length?(0,Ac.jsxs)("div",{className:"empty-state",children:[(0,Ac.jsx)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:(0,Ac.jsx)("path",{d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"})}),(0,Ac.jsx)("h3",{children:"No linked accounts"}),(0,Ac.jsx)("p",{children:"Advertising accounts will appear here once linked to your profile."})]}):a.map(function(e,t){return(0,Ac.jsxs)("div",{className:"campaign-row",onClick:function(){return h(e)},children:[(0,Ac.jsxs)("div",{className:"campaign-info",children:[(0,Ac.jsx)("span",{className:"campaign-name",children:e.descriptiveName||e.name||"Account ".concat(t+1)}),(0,Ac.jsx)("span",{className:"campaign-type mono",children:e.id||e.customerId||"—"})]}),(0,Ac.jsx)("span",{className:"status-badge status-".concat((e.status||"active").toLowerCase()),children:(e.status||"Active").toLowerCase()})]},t)})})]}),d&&(0,Ac.jsxs)("div",{className:"detail-panel",children:[(0,Ac.jsxs)("div",{className:"detail-panel-header",children:[(0,Ac.jsx)("h3",{children:"Account Details"}),(0,Ac.jsx)("button",{className:"modal-close",onClick:function(){return h(null)},children:(0,Ac.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,Ac.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),(0,Ac.jsx)("div",{className:"detail-panel-body",children:(0,Ac.jsxs)("div",{className:"detail-section",children:[(0,Ac.jsx)("h4",{children:"Account Information"}),(0,Ac.jsxs)("div",{className:"detail-grid",children:[(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Name"}),(0,Ac.jsx)("span",{className:"detail-value",children:d.descriptiveName||d.name||"—"})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Account ID"}),(0,Ac.jsx)("span",{className:"detail-value mono",children:d.id||d.customerId||"—"})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Status"}),(0,Ac.jsx)("span",{className:"status-badge status-".concat((d.status||"active").toLowerCase()),children:d.status||"Active"})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Currency"}),(0,Ac.jsx)("span",{className:"detail-value",children:d.currencyCode||"USD"})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Timezone"}),(0,Ac.jsx)("span",{className:"detail-value",children:d.timeZone||"—"})]})]})]})})]})]})}function Fu(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Uu(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Uu(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Uu(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,Uu(d,"constructor",l),Uu(l,"constructor",c),c.displayName="GeneratorFunction",Uu(l,o,"GeneratorFunction"),Uu(d),Uu(d,o,"Generator"),Uu(d,r,function(){return this}),Uu(d,"toString",function(){return"[object Generator]"}),(Fu=function(){return{w:a,m:h}})()}function Uu(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Uu=function(e,t,n,r){function a(t,n){Uu(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Uu(e,t,n,r)}function Bu(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Hu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ku(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ku(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ku(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var $u=[{label:"Health Check",provider:"",operation:""},{label:"List Campaigns",provider:"google",operation:"ListCampaigns"},{label:"List Accounts",provider:"google",operation:"ListAccounts"},{label:"Get Stats",provider:"google",operation:"GetCampaignStats"},{label:"Account Info",provider:"google",operation:"GetAccountInfo"}];function Gu(){var e,t=Bc().sessionToken,n=Hu((0,r.useState)("google"),2),o=n[0],a=n[1],i=Hu((0,r.useState)("ListCampaigns"),2),s=i[0],c=i[1],l=Hu((0,r.useState)(""),2),u=l[0],d=l[1],h=Hu((0,r.useState)(null),2),p=h[0],f=h[1],g=Hu((0,r.useState)(!1),2),m=g[0],v=g[1],y=Hu((0,r.useState)(null),2),b=y[0],x=y[1],w=function(){var e,n=(e=Fu().m(function e(n){var r,a,i;return Fu().w(function(e){for(;;)switch(e.n){case 0:if(n.preventDefault(),v(!0),f(null),r=Date.now(),o){e.n=2;break}return e.n=1,ul();case 1:a=e.v,e.n=4;break;case 2:if(i={},u.trim())try{i=JSON.parse(u)}catch(e){i={rawParams:u}}return e.n=3,cl(o,s,i,{sessionToken:t});case 3:a=e.v;case 4:x(Date.now()-r),f(a),v(!1);case 5:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Bu(a,r,o,i,s,"next",e)}function s(e){Bu(a,r,o,i,s,"throw",e)}i(void 0)})});return function(e){return n.apply(this,arguments)}}();return(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("div",{className:"view-header",children:(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h1",{children:"API Testing"}),(0,Ac.jsx)("p",{className:"view-subtitle",children:"Test Gateway execution endpoints directly"})]})}),(0,Ac.jsx)("div",{className:"preset-row",children:$u.map(function(e,t){return(0,Ac.jsx)("button",{className:"btn btn-sm btn-outline",onClick:function(){return a((t=e).provider),c(t.operation),void d("");var t},children:e.label},t)})}),(0,Ac.jsx)("div",{className:"dev-form",children:(0,Ac.jsxs)("form",{onSubmit:w,children:[(0,Ac.jsxs)("div",{className:"form-row",children:[(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Provider"}),(0,Ac.jsx)("input",{className:"form-input",type:"text",value:o,onChange:function(e){return a(e.target.value)},placeholder:"google"})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Operation"}),(0,Ac.jsx)("input",{className:"form-input",type:"text",value:s,onChange:function(e){return c(e.target.value)},placeholder:"ListCampaigns"})]})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Additional Parameters (JSON)"}),(0,Ac.jsx)("textarea",{className:"form-input",rows:"3",value:u,onChange:function(e){return d(e.target.value)},placeholder:'{"customerId": "123-456-7890"}',style:{fontFamily:"var(--font-mono)",fontSize:"13px",resize:"vertical"}})]}),(0,Ac.jsxs)("div",{style:{display:"flex",gap:"12px",alignItems:"center"},children:[(0,Ac.jsx)("button",{className:"btn btn-primary",type:"submit",disabled:m,children:m?(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("span",{className:"btn-spinner"})," Sending..."]}):"Send Request"}),(0,Ac.jsxs)("span",{style:{fontSize:"13px",color:"var(--color-text-muted)"},children:["POST /api/execution/request • Authorization: Bearer ","<session_token>"]})]})]})}),p&&(0,Ac.jsxs)("div",{className:"dev-response",children:[(0,Ac.jsxs)("div",{className:"response-header",children:[(0,Ac.jsx)("div",{className:"status-dot ".concat(p.ok?"green":"red")}),(0,Ac.jsxs)("span",{children:["HTTP ",p.status]}),(null===(e=p.data)||void 0===e?void 0:e.correlationId)&&(0,Ac.jsx)("span",{className:"request-id",children:p.data.correlationId}),(0,Ac.jsxs)("span",{className:"elapsed",children:[b,"ms"]})]}),(0,Ac.jsx)("pre",{className:"response-body",children:JSON.stringify(p.data||p,null,2)})]})]})}function Wu(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Vu(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Vu(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Vu(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,Vu(d,"constructor",l),Vu(l,"constructor",c),c.displayName="GeneratorFunction",Vu(l,o,"GeneratorFunction"),Vu(d),Vu(d,o,"Generator"),Vu(d,r,function(){return this}),Vu(d,"toString",function(){return"[object Generator]"}),(Wu=function(){return{w:a,m:h}})()}function Vu(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Vu=function(e,t,n,r){function a(t,n){Vu(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Vu(e,t,n,r)}function Qu(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Yu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ju(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ju(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ju(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Xu=[{id:"general",label:"General"},{id:"connection",label:"Connection"},{id:"notifications",label:"Notifications"},{id:"security",label:"Security"}];function Zu(e){var t=e.onSignOut,n=Bc(),o=n.sessionUser,a=n.sessionToken,i=Yu((0,r.useState)("general"),2),s=i[0],c=i[1],l=Yu((0,r.useState)(localStorage.getItem("adplatform_tenantId")||""),2),u=l[0],d=l[1],h=Yu((0,r.useState)(null),2),p=h[0],f=h[1],g=Yu((0,r.useState)(!1),2),m=g[0],v=g[1],y=function(){var e,t=(e=Wu().m(function e(){var t;return Wu().w(function(e){for(;;)switch(e.n){case 0:return v(!0),f(null),e.n=1,ul();case 1:t=e.v,f(t),v(!1);case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Qu(a,r,o,i,s,"next",e)}function s(e){Qu(a,r,o,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}();return(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("div",{className:"view-header",children:(0,Ac.jsx)("h1",{children:"Settings"})}),(0,Ac.jsxs)("div",{className:"settings-layout",children:[(0,Ac.jsx)("nav",{className:"settings-nav",children:Xu.map(function(e){return(0,Ac.jsx)("button",{className:"settings-nav-item ".concat(s===e.id?"active":""),onClick:function(){return c(e.id)},children:e.label},e.id)})}),(0,Ac.jsxs)("div",{className:"settings-content",children:["general"===s&&(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsxs)("div",{className:"settings-section",children:[(0,Ac.jsx)("h3",{children:"Profile"}),(0,Ac.jsx)("div",{className:"setting-row",children:(0,Ac.jsxs)("div",{className:"setting-info",children:[(0,Ac.jsx)("div",{className:"setting-label",children:"Display Name"}),(0,Ac.jsx)("div",{className:"setting-desc",children:(null==o?void 0:o.name)||"Not set"})]})}),(0,Ac.jsx)("div",{className:"setting-row",children:(0,Ac.jsxs)("div",{className:"setting-info",children:[(0,Ac.jsx)("div",{className:"setting-label",children:"Email"}),(0,Ac.jsx)("div",{className:"setting-desc",children:(null==o?void 0:o.email)||"Not set"})]})}),(0,Ac.jsx)("div",{className:"setting-row",children:(0,Ac.jsxs)("div",{className:"setting-info",children:[(0,Ac.jsx)("div",{className:"setting-label",children:"Role"}),(0,Ac.jsx)("div",{className:"setting-desc",children:(null==o?void 0:o.role)||"User"})]})})]}),(0,Ac.jsxs)("div",{className:"settings-section",children:[(0,Ac.jsx)("h3",{children:"Tenant Configuration"}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Tenant ID (Google Ads Customer ID)"}),(0,Ac.jsxs)("div",{className:"input-row",children:[(0,Ac.jsx)("input",{className:"form-input",type:"text",value:u,onChange:function(e){return d(e.target.value)},placeholder:"e.g. 123-456-7890"}),(0,Ac.jsx)("button",{className:"btn btn-primary btn-sm",onClick:function(){u.trim()?localStorage.setItem("adplatform_tenantId",u.trim()):localStorage.removeItem("adplatform_tenantId")},children:"Save"})]}),(0,Ac.jsx)("div",{style:{fontSize:"13px",color:"var(--color-text-muted)",marginTop:"-12px"},children:"This ID is sent as X-Tenant-Id header with API requests."})]})]})]}),"connection"===s&&(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsxs)("div",{className:"settings-section",children:[(0,Ac.jsx)("h3",{children:"Gateway Connection"}),(0,Ac.jsx)("div",{className:"setting-row",children:(0,Ac.jsxs)("div",{className:"setting-info",children:[(0,Ac.jsx)("div",{className:"setting-label",children:"Gateway URL"}),(0,Ac.jsx)("div",{className:"setting-value",children:Sc})]})}),(0,Ac.jsxs)("div",{className:"setting-row",children:[(0,Ac.jsxs)("div",{className:"setting-info",children:[(0,Ac.jsx)("div",{className:"setting-label",children:"Connection Test"}),(0,Ac.jsx)("div",{className:"setting-desc",children:"Verify the gateway is reachable and responding."})]}),(0,Ac.jsx)("button",{className:"btn btn-sm btn-outline",onClick:y,disabled:m,children:m?"Testing…":"Test Connection"})]}),p&&(0,Ac.jsx)("div",{className:p.ok?"info-box":"error-box",style:{marginTop:"12px"},children:p.ok?"✓ Gateway is healthy and responding.":"✗ Connection failed: ".concat(p.error)})]}),(0,Ac.jsxs)("div",{className:"settings-section",children:[(0,Ac.jsx)("h3",{children:"Session Information"}),(0,Ac.jsxs)("div",{className:"session-info-detailed",children:[(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Session Token"}),(0,Ac.jsx)("span",{className:"detail-value mono",style:{wordBreak:"break-all",fontSize:"12px"},children:a?a.substring(0,32)+"…":"None"})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"User ID"}),(0,Ac.jsx)("span",{className:"detail-value mono",children:(null==o?void 0:o.userId)||"—"})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Client ID"}),(0,Ac.jsx)("span",{className:"detail-value mono",children:(null==o?void 0:o.clientId)||"—"})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Session ID"}),(0,Ac.jsx)("span",{className:"detail-value mono",children:(null==o?void 0:o.sessionId)||"—"})]})]})]})]}),"notifications"===s&&(0,Ac.jsxs)("div",{className:"settings-section",children:[(0,Ac.jsx)("h3",{children:"Notification Preferences"}),(0,Ac.jsxs)("div",{className:"setting-row",children:[(0,Ac.jsxs)("div",{className:"setting-info",children:[(0,Ac.jsx)("div",{className:"setting-label",children:"Campaign Alerts"}),(0,Ac.jsx)("div",{className:"setting-desc",children:"Receive alerts when campaigns need attention."})]}),(0,Ac.jsx)("span",{style:{fontSize:"13px",color:"var(--color-text-muted)"},children:"Coming soon"})]}),(0,Ac.jsxs)("div",{className:"setting-row",children:[(0,Ac.jsxs)("div",{className:"setting-info",children:[(0,Ac.jsx)("div",{className:"setting-label",children:"Budget Warnings"}),(0,Ac.jsx)("div",{className:"setting-desc",children:"Get notified when budgets are nearly exhausted."})]}),(0,Ac.jsx)("span",{style:{fontSize:"13px",color:"var(--color-text-muted)"},children:"Coming soon"})]}),(0,Ac.jsxs)("div",{className:"setting-row",children:[(0,Ac.jsxs)("div",{className:"setting-info",children:[(0,Ac.jsx)("div",{className:"setting-label",children:"Weekly Summary"}),(0,Ac.jsx)("div",{className:"setting-desc",children:"Receive a weekly performance summary email."})]}),(0,Ac.jsx)("span",{style:{fontSize:"13px",color:"var(--color-text-muted)"},children:"Coming soon"})]})]}),"security"===s&&(0,Ac.jsx)(Ac.Fragment,{children:(0,Ac.jsxs)("div",{className:"settings-section",children:[(0,Ac.jsx)("h3",{children:"Authentication"}),(0,Ac.jsxs)("div",{className:"setting-row",children:[(0,Ac.jsxs)("div",{className:"setting-info",children:[(0,Ac.jsx)("div",{className:"setting-label",children:"Sign Out"}),(0,Ac.jsx)("div",{className:"setting-desc",children:"End your current session and return to the login page."})]}),(0,Ac.jsx)("button",{className:"btn btn-sm btn-danger",onClick:t,children:"Sign Out"})]})]})})]})]})]})}function ed(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return td(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(td(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,td(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,td(d,"constructor",l),td(l,"constructor",c),c.displayName="GeneratorFunction",td(l,o,"GeneratorFunction"),td(d),td(d,o,"Generator"),td(d,r,function(){return this}),td(d,"toString",function(){return"[object Generator]"}),(ed=function(){return{w:a,m:h}})()}function td(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}td=function(e,t,n,r){function a(t,n){td(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},td(e,t,n,r)}function nd(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function rd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return od(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?od(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function od(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ad=(0,r.createContext)(null),id=function(){return(0,r.useContext)(ad)},sd=[{name:"awareness",objectiveId:1},{name:"traffic",objectiveId:2},{name:"leads",objectiveId:3},{name:"conversions",objectiveId:4},{name:"sales",objectiveId:5}],cd=[{name:"restaurant",categoryId:1,icon:"🍽️"},{name:"retail",categoryId:2,icon:"🛍️"},{name:"b2b services",categoryId:3,icon:"💼"},{name:"local services",categoryId:4,icon:"🏠"},{name:"health & wellness",categoryId:5,icon:"🏥"},{name:"general",categoryId:6,icon:"📦"}];function ld(e){return e?e.split(" ").map(function(e){return"&"===e?"&":"b2b"===e.toLowerCase()?"B2B":e.charAt(0).toUpperCase()+e.slice(1)}).join(" "):""}var ud={awareness:"Reach new audiences and build recognition",traffic:"Drive more visitors to your site",leads:"Get contact form submissions and signups",conversions:"Drive specific actions on your site",sales:"Drive purchases and revenue"},dd={awareness:"📣",traffic:"🌐",leads:"📋",conversions:"🎯",sales:"💰"},hd=(Object.fromEntries(["awareness","traffic","leads","conversions","sales"].map(function(e){return[e,ld(e)]})),Object.fromEntries(cd.map(function(e){return[e.name,ld(e.name)]})),[{channelType:"google_ads",displayName:"Google Ads",description:"Search, Display, Shopping & Performance Max",minMonthlyBudget:300,color:"#4285F4",isStub:!1},{channelType:"meta",displayName:"Meta Ads",description:"Facebook, Instagram, Messenger & Threads",minMonthlyBudget:250,color:"#0668E1",isStub:!0},{channelType:"tiktok",displayName:"TikTok Ads",description:"In-feed video ads across TikTok",minMonthlyBudget:200,color:"#000000",isStub:!0}]);function pd(e){var t=e.children,n=Bc().sessionToken,o=rd((0,r.useState)([]),2),a=o[0],i=o[1],s=rd((0,r.useState)([]),2),c=s[0],l=s[1],u=rd((0,r.useState)([]),2),d=u[0],h=u[1],p=rd((0,r.useState)(null),2),f=p[0],g=p[1],m=rd((0,r.useState)(!0),2),v=m[0],y=m[1];(0,r.useEffect)(function(){var e=!1;function t(){var r;return r=ed().m(function t(){var r,o,a,s,c;return ed().w(function(t){for(;;)switch(t.n){case 0:return y(!0),t.n=1,Promise.all([Bl(n),Rl(n)]);case 1:if(r=t.v,o=rd(r,2),a=o[0],s=o[1],!e){t.n=2;break}return t.a(2);case 2:a.ok&&a.data?(c=a.data,i(Array.isArray(c.categories)?c.categories:cd),l(Array.isArray(c.objectives)?c.objectives:sd)):(console.warn("Wizard config load failed, using fallbacks:",a.error),i(cd),l(sd)),s.ok&&s.data?(h(s.data.channels||hd),g(s.data.allocation||null)):(console.warn("Channels load failed, using fallbacks:",s.error),h(hd)),y(!1);case 3:return t.a(2)}},t)}),t=function(){var e=this,t=arguments;return new Promise(function(n,o){var a=r.apply(e,t);function i(e){nd(a,n,o,i,s,"next",e)}function s(e){nd(a,n,o,i,s,"throw",e)}i(void 0)})},t.apply(this,arguments)}return function(){t.apply(this,arguments)}(),function(){e=!0}},[n]);var b={categories:a,objectives:c,channels:d,allocationRules:f,loading:v,toDisplayLabel:ld,objectiveDescriptions:ud,objectiveIcons:dd,getChannelLabel:function(e){return function(e,t){if(!e)return"Unknown";var n=t.find(function(t){return t.channelType===e});return(null==n?void 0:n.displayName)||ld(e.replace(/_/g," "))}(e,d)},getChannelColor:function(e){return function(e,t){if(!e)return"#4F46E5";var n=t.find(function(t){return t.channelType===e});return(null==n?void 0:n.color)||"#4F46E5"}(e,d)}};return(0,Ac.jsx)(ad.Provider,{value:b,children:t})}function fd(e){return fd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fd(e)}function gd(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return md(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(md(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,md(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,md(d,"constructor",l),md(l,"constructor",c),c.displayName="GeneratorFunction",md(l,o,"GeneratorFunction"),md(d),md(d,o,"Generator"),md(d,r,function(){return this}),md(d,"toString",function(){return"[object Generator]"}),(gd=function(){return{w:a,m:h}})()}function md(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}md=function(e,t,n,r){function a(t,n){md(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},md(e,t,n,r)}function vd(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function yd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yd(Object(n),!0).forEach(function(t){xd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xd(e,t,n){return(t=function(e){var t=function(e){if("object"!=fd(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=fd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==fd(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return kd(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kd(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function kd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Cd=(0,r.memo)(function(e){var t=e.data,n=e.onChange,o=Bc().sessionToken,a=id(),i=a.categories,s=a.objectives,c=a.loading,l=a.toDisplayLabel,u=a.objectiveDescriptions,d=a.objectiveIcons,h=wd((0,r.useState)(!1),2),p=h[0],f=h[1],g=wd((0,r.useState)(null),2),m=g[0],v=g[1],y=bd({url:"",campaignName:"",objective:"",businessCategory:"",analysis:null},t),b=(0,r.useCallback)(function(e){n(bd(bd({},y),e))},[y,n]);r.useEffect(function(){if(!c&&i.length>0&&!y.businessCategory){var e=i.find(function(e){return"general"===e.name.toLowerCase()});e&&b({businessCategory:e.name})}},[c,i.length]);var x=function(){var e,t=(e=gd().m(function e(){var t,n,r,a,s,c;return gd().w(function(e){for(;;)switch(e.n){case 0:if(y.url){e.n=1;break}return e.a(2);case 1:return f(!0),v(null),e.n=2,Vl(y.url,o);case 2:(t=e.v).ok?(a=(null===(n=t.data)||void 0===n||null===(n=n.result)||void 0===n?void 0:n.data)||(null===(r=t.data)||void 0===r?void 0:r.data)||t.data,s=null!=a&&a.title?"".concat(a.title.slice(0,40)," Campaign"):y.campaignName,c=Td(null==a?void 0:a.inferredCategory,i),b({analysis:a,campaignName:y.campaignName||s,businessCategory:y.businessCategory||c})):v(t.error||"Failed to analyze URL"),f(!1);case 3:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){vd(a,r,o,i,s,"next",e)}function s(e){vd(a,r,o,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}();return(0,Ac.jsxs)("div",{className:"wizard-step-content",children:[(0,Ac.jsxs)("div",{className:"step-intro",children:[(0,Ac.jsx)("h2",{children:"What's your advertising goal?"}),(0,Ac.jsx)("p",{children:"Tell us about your business and what you want to achieve. We'll help you reach the right audience across multiple channels."})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Website URL"}),(0,Ac.jsxs)("div",{className:"url-input-row",children:[(0,Ac.jsx)("input",{className:"form-input",type:"url",placeholder:"https://yourwebsite.com",value:y.url,onChange:function(e){return b({url:e.target.value})}}),(0,Ac.jsx)("button",{className:"btn btn-primary",onClick:x,disabled:p||!y.url,children:p?(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("span",{className:"btn-spinner"})," Analyzing…"]}):y.analysis?"Re-analyze":"Analyze"})]}),m&&(0,Ac.jsx)("div",{className:"field-error",children:m})]}),y.analysis&&(0,Ac.jsxs)("div",{className:"analysis-card",children:[(0,Ac.jsxs)("div",{className:"analysis-card-header",children:[(0,Ac.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,Ac.jsx)("span",{children:"Site analyzed successfully"})]}),(0,Ac.jsxs)("div",{className:"analysis-card-body",children:[(0,Ac.jsxs)("div",{className:"analysis-detail",children:[(0,Ac.jsx)("span",{className:"analysis-label",children:"Title"}),(0,Ac.jsx)("span",{className:"analysis-value",children:y.analysis.title||"—"})]}),y.analysis.metaDescription&&(0,Ac.jsxs)("div",{className:"analysis-detail",children:[(0,Ac.jsx)("span",{className:"analysis-label",children:"Description"}),(0,Ac.jsx)("span",{className:"analysis-value",children:y.analysis.metaDescription})]})]})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Campaign Name"}),(0,Ac.jsx)("input",{className:"form-input",type:"text",placeholder:"e.g. Summer Sale 2025",value:y.campaignName,onChange:function(e){return b({campaignName:e.target.value})}}),(0,Ac.jsx)("span",{className:"field-hint",children:"A name to identify this initiative in your dashboard"})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Business Category"}),(0,Ac.jsx)("span",{className:"field-hint",style:{marginBottom:8,display:"block"},children:"This helps us recommend the best channel mix and budget allocation for your industry."}),c?(0,Ac.jsx)("div",{className:"skeleton",style:{height:48,borderRadius:8}}):(0,Ac.jsxs)("select",{className:"form-select form-select-lg",value:y.businessCategory,onChange:function(e){return b({businessCategory:e.target.value})},children:[(0,Ac.jsx)("option",{value:"",children:"Select your industry…"}),i.map(function(e){return(0,Ac.jsxs)("option",{value:e.name,children:[e.icon||"📦"," ",l(e.name)]},e.categoryId||e.name)})]})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Advertising Objective"}),c?(0,Ac.jsx)("div",{className:"loading-placeholder",children:(0,Ac.jsx)("div",{className:"objective-grid",children:[1,2,3,4,5].map(function(e){return(0,Ac.jsx)("div",{className:"skeleton",style:{height:80,borderRadius:10}},e)})})}):(0,Ac.jsx)("div",{className:"objective-grid",children:s.map(function(e){return(0,Ac.jsxs)("button",{className:"objective-card ".concat(y.objective===e.name?"selected":""),onClick:function(){return b({objective:e.name})},style:e.color?{"--objective-accent":e.color}:void 0,children:[(0,Ac.jsx)("span",{className:"objective-icon",children:d[e.name]||"🎯"}),(0,Ac.jsx)("span",{className:"objective-label",children:l(e.name)}),u[e.name]&&(0,Ac.jsx)("span",{className:"objective-desc",children:u[e.name]})]},e.objectiveId||e.name)})})]})]})});const Sd=Cd;function Td(e,t){if(!e||null==t||!t.length)return"";for(var n,r=e.toLowerCase(),o=function(){var e=i[a],n=e.regex,o=e.match;if(n.test(r)){var s=t.find(function(e){return e.name.toLowerCase().includes(o)});if(s)return{v:s.name}}},a=0,i=[{regex:/restaurant|food|dining|cafe|bar|bakery|pizza/i,match:"restaurant"},{regex:/retail|shop|store|ecommerce|fashion|boutique/i,match:"retail"},{regex:/b2b|saas|consult|agency|enterprise|software/i,match:"b2b services"},{regex:/plumb|electric|clean|landscap|repair|local|hvac/i,match:"local services"},{regex:/health|medical|dental|fitness|wellness|gym|therapy/i,match:"health"}];a<i.length;a++)if(n=o())return n.v;var s=t.find(function(e){return e.name.toLowerCase()===r||r.includes(e.name.toLowerCase())});if(s)return s.name;var c=t.find(function(e){return"general"===e.name.toLowerCase()});return c?c.name:""}function Id(e){return Id="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Id(e)}function jd(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Ad(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ad(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Ad(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,Ad(d,"constructor",l),Ad(l,"constructor",c),c.displayName="GeneratorFunction",Ad(l,o,"GeneratorFunction"),Ad(d),Ad(d,o,"Generator"),Ad(d,r,function(){return this}),Ad(d,"toString",function(){return"[object Generator]"}),(jd=function(){return{w:a,m:h}})()}function Ad(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ad=function(e,t,n,r){function a(t,n){Ad(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Ad(e,t,n,r)}function Nd(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Ed(e){return function(e){if(Array.isArray(e))return zd(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Md(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Pd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_d(Object(n),!0).forEach(function(t){Od(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Od(e,t,n){return(t=function(e){var t=function(e){if("object"!=Id(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Id(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Id(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||Md(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Md(e,t){if(e){if("string"==typeof e)return zd(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zd(e,t):void 0}}function zd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ld=[{id:"AGE_18_24",label:"18–24"},{id:"AGE_25_34",label:"25–34"},{id:"AGE_35_44",label:"35–44"},{id:"AGE_45_54",label:"45–54"},{id:"AGE_55_64",label:"55–64"},{id:"AGE_65_UP",label:"65+"}],qd=[{id:"MALE",label:"Male"},{id:"FEMALE",label:"Female"},{id:"UNDETERMINED",label:"All Genders"}],Dd=[{id:"TOP_10",label:"Top 10%"},{id:"TOP_11_20",label:"11–20%"},{id:"TOP_21_30",label:"21–30%"},{id:"TOP_31_40",label:"31–40%"},{id:"TOP_41_50",label:"41–50%"},{id:"LOWER_50",label:"Lower 50%"}];function Fd(e){var t=e.options,n=e.selected,r=e.onToggle;return(0,Ac.jsx)("div",{className:"chip-row",children:t.map(function(e){return(0,Ac.jsx)("button",{type:"button",className:"chip ".concat(n.includes(e.id)?"active":""),onClick:function(){return r(e.id)},children:e.label},e.id)})})}const Ud=(0,r.memo)(function(e){var t=e.data,n=e.onChange,o=Bc().sessionToken,a=Rd((0,r.useState)(""),2),i=a[0],s=a[1],c=Rd((0,r.useState)([]),2),l=c[0],u=c[1],d=Rd((0,r.useState)(!1),2),h=d[0],p=d[1],f=(0,r.useRef)(null),g=Pd({locations:[],demographics:{ageRanges:["AGE_25_34","AGE_35_44"],genders:["MALE","FEMALE"],incomes:[]},ageSkew:null,marketScope:"national"},t),m=(0,r.useCallback)(function(e){var t=Pd(Pd({},g),e);t.ageSkew=function(e){if(!e||0===e.length)return null;var t=["AGE_18_24","AGE_25_34"],n=["AGE_45_54","AGE_55_64","AGE_65_UP"],r=e.filter(function(e){return t.includes(e)}).length,o=e.filter(function(e){return n.includes(e)}).length;return r>0&&0===o?"young":o>0&&0===r?"mature":r>o?"young":o>r?"mature":null}(t.demographics.ageRanges),t.marketScope=function(e){if(!e||0===e.length)return"national";var t=e.map(function(e){return(e.type||"").toLowerCase()});if(t.some(function(e){return"country"===e}))return"national";var n=new Set;e.forEach(function(e){var t=(e.canonicalName||"").split(",").map(function(e){return e.trim()});t.length>=2&&n.add(t[t.length-2])});var r=t.filter(function(e){return["state","province","region"].includes(e)});return r.length>=2?"national":1===r.length?"regional":n.size<=1?"local":n.size<=3?"regional":"national"}(t.locations),n(t)},[g,n]),v=function(e,t){var n=g.demographics[e]||[];!function(e,t){m({demographics:Pd(Pd({},g.demographics),{},Od({},e,t))})}(e,n.includes(t)?n.filter(function(e){return e!==t}):[].concat(Ed(n),[t]))},y=function(){var e,t=(e=jd().m(function e(t){var n,r,a,i,s,c;return jd().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t&&!(t.length<2)){e.n=1;break}return u([]),e.a(2);case 1:return p(!0),e.p=2,e.n=3,Zl(t,o);case 3:(n=e.v).ok&&(s=(null===(r=n.data)||void 0===r||null===(r=r.result)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.results)||(null===(a=n.data)||void 0===a||null===(a=a.data)||void 0===a?void 0:a.results)||(null===(i=n.data)||void 0===i?void 0:i.results)||[],u(s)),e.n=5;break;case 4:e.p=4,c=e.v,console.warn("Geo search error:",c);case 5:p(!1);case 6:return e.a(2)}},e,null,[[2,4]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Nd(a,r,o,i,s,"next",e)}function s(e){Nd(a,r,o,i,s,"throw",e)}i(void 0)})});return function(e){return t.apply(this,arguments)}}(),b={ageSkew:{young:"Younger audience",mature:"Mature audience",null:"Balanced"},marketScope:{local:"Local market",regional:"Regional",national:"National"}};return(0,Ac.jsxs)("div",{className:"wizard-step-content",children:[(0,Ac.jsxs)("div",{className:"step-intro",children:[(0,Ac.jsx)("h2",{children:"Who is your audience?"}),(0,Ac.jsx)("p",{children:"Define your target market by location and demographics. This helps us recommend the best advertising channels for your campaign."})]}),(0,Ac.jsxs)("div",{className:"audience-section",children:[(0,Ac.jsxs)("h3",{children:[(0,Ac.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"}),(0,Ac.jsx)("circle",{cx:"12",cy:"10",r:"3"})]}),"Target Locations"]}),(0,Ac.jsxs)("div",{className:"geo-search-wrap",children:[(0,Ac.jsx)("input",{className:"form-input",placeholder:"Search cities, states, zip codes…",value:i,onChange:function(e){return t=e.target.value,s(t),clearTimeout(f.current),void(f.current=setTimeout(function(){return y(t)},400));var t}}),h&&(0,Ac.jsx)("span",{className:"geo-search-spinner",children:(0,Ac.jsx)("span",{className:"btn-spinner"})}),l.length>0&&(0,Ac.jsx)("div",{className:"geo-dropdown",children:l.map(function(e){return(0,Ac.jsxs)("button",{type:"button",className:"geo-result",onClick:function(){return function(e){g.locations.some(function(t){return t.id===e.id})||(m({locations:[].concat(Ed(g.locations),[{id:e.id,name:e.name,type:e.targetType||e.type||"Location",canonicalName:e.canonicalName}])}),s(""),u([]))}(e)},disabled:g.locations.some(function(t){return t.id===e.id}),children:[(0,Ac.jsx)("span",{className:"geo-result-name",children:e.name}),(0,Ac.jsx)("span",{className:"geo-result-type",children:e.targetType||e.type}),(0,Ac.jsx)("span",{className:"geo-result-canonical",children:e.canonicalName})]},e.id)})})]}),g.locations.length>0&&(0,Ac.jsx)("div",{className:"location-chips",children:g.locations.map(function(e){return(0,Ac.jsxs)("span",{className:"location-chip",children:[(0,Ac.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"}),(0,Ac.jsx)("circle",{cx:"12",cy:"10",r:"3"})]}),e.name,(0,Ac.jsx)("button",{type:"button",onClick:function(){return t=e.id,void m({locations:g.locations.filter(function(e){return e.id!==t})});var t},className:"chip-remove",children:"×"})]},e.id)})}),0===g.locations.length&&(0,Ac.jsx)("div",{className:"field-hint",style:{marginTop:8},children:"No locations selected — your campaign will target all regions (national scope)."})]}),(0,Ac.jsxs)("div",{className:"audience-section",children:[(0,Ac.jsxs)("h3",{children:[(0,Ac.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"}),(0,Ac.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,Ac.jsx)("path",{d:"M23 21v-2a4 4 0 00-3-3.87"}),(0,Ac.jsx)("path",{d:"M16 3.13a4 4 0 010 7.75"})]}),"Demographics"]}),(0,Ac.jsxs)("div",{className:"demo-group",children:[(0,Ac.jsx)("label",{children:"Age Ranges"}),(0,Ac.jsx)(Fd,{options:Ld,selected:g.demographics.ageRanges,onToggle:function(e){return v("ageRanges",e)}})]}),(0,Ac.jsxs)("div",{className:"demo-group",children:[(0,Ac.jsx)("label",{children:"Gender"}),(0,Ac.jsx)(Fd,{options:qd,selected:g.demographics.genders,onToggle:function(e){return v("genders",e)}})]}),(0,Ac.jsxs)("div",{className:"demo-group",children:[(0,Ac.jsxs)("label",{children:["Household Income ",(0,Ac.jsx)("span",{className:"optional-tag",children:"Optional"})]}),(0,Ac.jsx)(Fd,{options:Dd,selected:g.demographics.incomes,onToggle:function(e){return v("incomes",e)}})]})]}),(0,Ac.jsxs)("div",{className:"audience-profile-summary",children:[(0,Ac.jsxs)("h3",{children:[(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),"Audience Profile"]}),(0,Ac.jsx)("p",{className:"field-hint",children:"These signals will influence our channel recommendations in the next step."}),(0,Ac.jsxs)("div",{className:"profile-factors",children:[(0,Ac.jsxs)("div",{className:"profile-factor",children:[(0,Ac.jsx)("span",{className:"factor-label",children:"Age Profile"}),(0,Ac.jsx)("span",{className:"factor-value ".concat(g.ageSkew?"has-value":"neutral"),children:b.ageSkew[g.ageSkew]||"Balanced"})]}),(0,Ac.jsxs)("div",{className:"profile-factor",children:[(0,Ac.jsx)("span",{className:"factor-label",children:"Market Scope"}),(0,Ac.jsx)("span",{className:"factor-value has-value",children:b.marketScope[g.marketScope]||"National"})]})]})]})]})});function Bd(e){return Bd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bd(e)}function Hd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Kd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hd(Object(n),!0).forEach(function(t){$d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $d(e,t,n){return(t=function(e){var t=function(e){if("object"!=Bd(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Bd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Bd(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gd(e,t){if(e){if("string"==typeof e)return Wd(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wd(e,t):void 0}}function Wd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Vd={google_ads:(0,Ac.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"#4285F4",strokeWidth:"2"}),(0,Ac.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fontSize:"12",fontWeight:"bold",fill:"#4285F4",children:"G"})]}),meta:(0,Ac.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"#0668E1",strokeWidth:"2"}),(0,Ac.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fontSize:"12",fontWeight:"bold",fill:"#0668E1",children:"M"})]}),tiktok:(0,Ac.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"#000000",strokeWidth:"2"}),(0,Ac.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fontSize:"12",fontWeight:"bold",fill:"#000000",children:"T"})]})};const Qd=(0,r.memo)(function(e){var t,n,o=e.data,a=e.onChange,i=e.objectiveData,s=e.audienceData,c=id(),l=c.channels,u=c.allocationRules,d=c.loading,h=(t=(0,r.useState)(null),n=1,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(t,n)||Gd(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],p=Kd({selectedChannels:[]},o),f=(0,r.useCallback)(function(e){a(Kd(Kd({},p),e))},[p,a]),g=function(e){var t=p.selectedChannels,n=t.includes(e)?t.filter(function(t){return t!==e}):[].concat(function(e){return function(e){if(Array.isArray(e))return Wd(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Gd(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t),[e]);f({selectedChannels:n})},m=null==i?void 0:i.objective,v=p.selectedChannels.length,y=[];return null!=s&&s.marketScope&&"national"!==s.marketScope&&y.push(s.marketScope+" market"),null!=s&&s.ageSkew&&y.push("young"===s.ageSkew?"younger audience":"mature audience"),(0,Ac.jsxs)("div",{className:"wizard-step-content",children:[(0,Ac.jsxs)("div",{className:"step-intro",children:[(0,Ac.jsx)("h2",{children:"Where do you want to advertise?"}),(0,Ac.jsxs)("p",{children:["Select one or more advertising channels. Each channel reaches different audiences",m?" — all optimized for your ".concat(m," objective"):"",".",v>1?" We'll help you split your budget across ".concat(v," channels in the next step."):""]})]}),(m||y.length>0)&&(0,Ac.jsxs)("div",{className:"channel-context-bar",children:[(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),(0,Ac.jsxs)("span",{children:["Showing channels optimized for ",(0,Ac.jsx)("strong",{children:m||"general"}),y.length>0&&(0,Ac.jsxs)(Ac.Fragment,{children:[" with ",y.join(" and ")]}),(null==i?void 0:i.businessCategory)&&(0,Ac.jsxs)(Ac.Fragment,{children:[" in ",(0,Ac.jsx)("strong",{children:i.businessCategory})]})]})]}),h&&(0,Ac.jsx)("div",{className:"warning-box",style:{marginBottom:16},children:(0,Ac.jsx)("span",{children:"⚠️ Couldn't load live channel config — showing defaults. Your selections will still work."})}),d?(0,Ac.jsx)("div",{className:"loading-placeholder padded",children:[1,2,3].map(function(e){return(0,Ac.jsx)("div",{className:"skeleton skeleton-row",style:{height:120,marginBottom:16}},e)})}):(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("div",{className:"channel-grid",children:l.map(function(e){var t,n,r=(n=e.channelType,p.selectedChannels.includes(n)),o=function(e){return!m||!e.supportedObjectives||e.supportedObjectives.includes(m)}(e),a=function(e){return!!m&&({awareness:["meta","tiktok","google_ads"],traffic:["google_ads","meta"],leads:["google_ads","meta"],conversions:["google_ads","meta"],sales:["google_ads","meta"]}[m]||[]).includes(e)}(e.channelType),i=function(e){var t;return(null===(t={google_ads:{awareness:"Strong reach via Display & YouTube",traffic:"High-intent search traffic",leads:"Search captures active prospects",conversions:"Intent-driven conversion engine",sales:"Shopping & search drive purchases"},meta:{awareness:"Massive reach on Facebook & Instagram",traffic:"Visual storytelling drives clicks",leads:"Lead forms built into the platform",conversions:"Advanced pixel tracking & lookalikes",sales:"Shop integration & dynamic product ads"},tiktok:{awareness:"Viral potential with younger audiences",traffic:"Engaging video drives curiosity clicks",leads:"Growing lead gen capabilities",conversions:"Strong for impulse & discovery",sales:"TikTok Shop integration"}}[e])||void 0===t?void 0:t[m])||null}(e.channelType),s=r?e.color||"#4F46E5":"transparent";return(0,Ac.jsxs)("button",{className:"channel-card ".concat(r?"selected":""," ").concat(o?"":"unsupported"),style:{"--channel-color":e.color||"#4F46E5",borderColor:s},onClick:function(){return o&&g(e.channelType)},disabled:!o,children:[(0,Ac.jsxs)("div",{className:"channel-card-header",children:[(0,Ac.jsx)("div",{className:"channel-icon",children:Vd[e.channelType]||(0,Ac.jsx)("div",{className:"channel-icon-fallback",style:{background:e.color||"#4F46E5"},children:null===(t=e.displayName)||void 0===t?void 0:t.charAt(0)})}),(0,Ac.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a&&o&&(0,Ac.jsxs)("span",{className:"channel-rec-badge",children:[(0,Ac.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:(0,Ac.jsx)("path",{d:"M20 6L9 17l-5-5"})}),"Recommended"]}),(0,Ac.jsx)("div",{className:"channel-card-check",children:r?(0,Ac.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:(0,Ac.jsx)("path",{d:"M20 6L9 17l-5-5"})}):(0,Ac.jsx)("div",{className:"check-empty"})})]})]}),(0,Ac.jsxs)("div",{className:"channel-card-body",children:[(0,Ac.jsxs)("div",{className:"channel-name",children:[e.displayName,e.isStub&&(0,Ac.jsx)("span",{className:"stub-badge",children:"Preview"})]}),(0,Ac.jsx)("div",{className:"channel-desc",children:e.description}),i&&(0,Ac.jsxs)("div",{className:"channel-strength",children:[(0,Ac.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z"})}),i]})]}),(0,Ac.jsxs)("div",{className:"channel-card-footer",children:[(0,Ac.jsxs)("span",{className:"channel-min-budget",children:["Min $",e.minMonthlyBudget||0,"/mo"]}),!o&&(0,Ac.jsxs)("span",{className:"channel-unsupported-label",children:["Not available for ",m]})]})]},e.channelType)})}),v>0&&(0,Ac.jsxs)("div",{className:"channel-summary",children:[(0,Ac.jsx)("div",{className:"channel-summary-chips",children:p.selectedChannels.map(function(e){var t=l.find(function(t){return t.channelType===e});return(0,Ac.jsxs)("span",{className:"channel-chip",style:{borderColor:(null==t?void 0:t.color)||"#4F46E5"},children:[(null==t?void 0:t.displayName)||e,(0,Ac.jsx)("button",{onClick:function(){return g(e)},className:"chip-remove",children:"×"})]},e)})}),(0,Ac.jsxs)("div",{className:"channel-summary-info",children:[1===v?"Single-channel campaign":"Multi-channel campaign across ".concat(v," platforms"),v>1&&u&&(0,Ac.jsxs)("span",{className:"channel-summary-note",children:[" ","· Minimum total budget: $",u.minMultiChannelMonthlyBudget,"/mo"]})]})]}),0===v&&(0,Ac.jsxs)("div",{className:"channel-empty-hint",children:[(0,Ac.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,Ac.jsx)("span",{children:"Select at least one channel to continue"})]})]})]})});function Yd(e){return Yd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yd(e)}function Jd(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Xd(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Xd(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Xd(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,Xd(d,"constructor",l),Xd(l,"constructor",c),c.displayName="GeneratorFunction",Xd(l,o,"GeneratorFunction"),Xd(d),Xd(d,o,"Generator"),Xd(d,r,function(){return this}),Xd(d,"toString",function(){return"[object Generator]"}),(Jd=function(){return{w:a,m:h}})()}function Xd(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Xd=function(e,t,n,r){function a(t,n){Xd(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Xd(e,t,n,r)}function Zd(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function eh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function th(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?eh(Object(n),!0).forEach(function(t){nh(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function nh(e,t,n){return(t=function(e){var t=function(e){if("object"!=Yd(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Yd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Yd(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return oh(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oh(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function oh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ah=function(){return(new Date).toISOString().split("T")[0]};const ih=(0,r.memo)(function(e){var t,n=e.data,o=e.onChange,a=e.channelData,i=e.objectiveData,s=e.audienceData,c=Bc().sessionToken,l=id(),u=l.getChannelLabel,d=l.getChannelColor,h=l.channels,p=l.allocationRules,f=rh((0,r.useState)([]),2),g=f[0],m=f[1],v=rh((0,r.useState)(!1),2),y=(v[0],v[1]),b=rh((0,r.useState)(!1),2),x=b[0],w=b[1],k=(null==a?void 0:a.selectedChannels)||[],C=k.length>1,S=th({totalBudget:"",budgetPeriod:"monthly",startDate:ah(),endDate:(t=new Date,t.setDate(t.getDate()+30),t.toISOString().split("T")[0]),hasEndDate:!0,allocationStrategy:"manual",allocations:{}},n),T=(0,r.useCallback)(function(e){o(th(th({},S),e))},[S,o]);(0,r.useEffect)(function(){var e=S.allocations||{},t={};if(k.some(function(t){return!(t in e)})||k.length!==Object.keys(e).length){var n=k.length>0?Math.floor(100/k.length):100,r=100-n*k.length;k.forEach(function(o,a){t[o]=e[o]||n+(0===a?r:0)}),T({allocations:t})}},[k.join(",")]),(0,r.useEffect)(function(){function e(){return e=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Zd(a,r,o,i,s,"next",e)}function s(e){Zd(a,r,o,i,s,"throw",e)}i(void 0)})}}(Jd().m(function e(){var t,n,r,o,a,l,u,d,h,p,f;return Jd().w(function(e){for(;;)switch(e.n){case 0:if(y(!0),t=(null==s?void 0:s.ageSkew)||null,n=(null==s?void 0:s.marketScope)||null,!t&&!n){e.n=2;break}return e.n=1,Xl(null==i?void 0:i.businessCategory,null==i?void 0:i.objective,t,n,c);case 1:if(!(o=e.v).ok||null===(r=o.data)||void 0===r||!r.channels){e.n=2;break}return l=o.data.channels||(null===(a=o.data.data)||void 0===a?void 0:a.channels)||[],u=l.map(function(e){return{channelType:e.channelType,allocationPct:e.recommendedPct,minBudgetRequired:e.minBudgetRequired,rationale:e.baseRationale,adjustments:e.adjustments}}),m(u),y(!1),e.a(2);case 2:return e.n=3,Ml(c,null==i?void 0:i.businessCategory,null==i?void 0:i.objective);case 3:(d=e.v).ok&&(f=(null===(h=d.data)||void 0===h?void 0:h.data)||(null===(p=d.data)||void 0===p?void 0:p.templates)||[],m(Array.isArray(f)?f:[])),y(!1);case 4:return e.a(2)}},e)})),e.apply(this,arguments)}C&&function(){e.apply(this,arguments)}()},[c,null==i?void 0:i.businessCategory,null==i?void 0:i.objective,C,null==s?void 0:s.ageSkew,null==s?void 0:s.marketScope]);var I=parseFloat(S.totalBudget)||0,j=Object.values(S.allocations).reduce(function(e,t){return e+(t||0)},0),A=Math.abs(j-100)<.01,N=S.hasEndDate&&S.startDate&&S.endDate?Math.max(1,Math.ceil((new Date(S.endDate)-new Date(S.startDate))/864e5)):30,E="daily"===S.budgetPeriod?30*I:I,_="daily"===S.budgetPeriod?I:I/30,P=function(e,t){var n=Math.max(0,Math.min(100,parseInt(t)||0));T({allocations:th(th({},S.allocations),{},nh({},e,n))})},O="daily"===S.budgetPeriod?[25,50,100,250]:[500,1e3,2500,5e3];return(0,Ac.jsxs)("div",{className:"wizard-step-content",children:[(0,Ac.jsxs)("div",{className:"step-intro",children:[(0,Ac.jsxs)("h2",{children:["Set your budget",C?" & allocation":""]}),(0,Ac.jsx)("p",{children:C?"Choose your total budget and how to split it across ".concat(k.length," channels."):"Choose how much you want to spend and how long your campaign should run."})]}),k.length>0&&(0,Ac.jsxs)("div",{className:"budget-channels-bar",children:[(0,Ac.jsxs)("div",{className:"budget-channels-label",children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.14 0"})}),(0,Ac.jsxs)("span",{children:["Your selected channel",k.length>1?"s":""]})]}),(0,Ac.jsx)("div",{className:"budget-channels-list",children:k.map(function(e){var t,n=u(e),r=d(e),o=(null==h||null===(t=h.find(function(t){return t.channelType===e}))||void 0===t?void 0:t.minMonthlyBudget)||0;return(0,Ac.jsxs)("span",{className:"budget-channel-tag",style:{borderColor:r},children:[(0,Ac.jsx)("span",{className:"budget-ch-dot",style:{background:r}}),n,o>0&&(0,Ac.jsxs)("span",{className:"budget-ch-min",children:["$",o,"/mo min"]})]},e)})}),C&&(null==p?void 0:p.minMultiChannelMonthlyBudget)&&(0,Ac.jsxs)("div",{className:"budget-channels-note",children:["Combined minimum: $",p.minMultiChannelMonthlyBudget,"/mo for multi-channel campaigns"]})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Budget Period"}),(0,Ac.jsxs)("div",{className:"period-toggle",children:[(0,Ac.jsx)("button",{className:"toggle-btn ".concat("monthly"===S.budgetPeriod?"active":""),onClick:function(){return T({budgetPeriod:"monthly",totalBudget:""})},children:"Monthly"}),(0,Ac.jsx)("button",{className:"toggle-btn ".concat("daily"===S.budgetPeriod?"active":""),onClick:function(){return T({budgetPeriod:"daily",totalBudget:""})},children:"Daily"})]})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsxs)("label",{children:["Total ","daily"===S.budgetPeriod?"Daily":"Monthly"," Budget"]}),(0,Ac.jsxs)("div",{className:"budget-input-wrap",children:[(0,Ac.jsx)("span",{className:"budget-prefix",children:"$"}),(0,Ac.jsx)("input",{className:"form-input budget-input",type:"number",min:"1",step:"1",placeholder:"daily"===S.budgetPeriod?"50":"1500",value:S.totalBudget,onChange:function(e){return T({totalBudget:e.target.value})}}),(0,Ac.jsxs)("span",{className:"budget-suffix",children:["/ ","daily"===S.budgetPeriod?"day":"month"]})]}),(0,Ac.jsx)("div",{className:"budget-presets",children:O.map(function(e){return(0,Ac.jsxs)("button",{className:"preset-chip ".concat(parseFloat(S.totalBudget)===e?"active":""),onClick:function(){return T({totalBudget:String(e)})},children:["$",e.toLocaleString()]},e)})})]}),I>0&&(0,Ac.jsx)("div",{className:"estimate-banner",children:(0,Ac.jsxs)("div",{className:"estimate-row",children:[(0,Ac.jsx)("span",{children:"daily"===S.budgetPeriod?"~$".concat(E.toLocaleString()," / month"):"~$".concat(_.toFixed(2)," / day")}),S.hasEndDate&&(0,Ac.jsxs)("strong",{children:["$",(_*N).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})," estimated total (",N," days)"]})]})}),C&&I>0&&(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[(0,Ac.jsx)("label",{style:{margin:0},children:"Channel Allocation"}),g.length>0&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:function(){return w(!x)},children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),x?"Hide":"Get"," Recommendation"]})]}),x&&g.length>0&&(0,Ac.jsxs)("div",{className:"recommendation-box",children:[(0,Ac.jsxs)("div",{className:"recommendation-header",children:[(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),(0,Ac.jsxs)("span",{children:["Recommended split for ",(0,Ac.jsx)("strong",{children:(null==i?void 0:i.businessCategory)||"your"})," + ",(0,Ac.jsx)("strong",{children:(null==i?void 0:i.objective)||"general"}),(null==s?void 0:s.ageSkew)&&(0,Ac.jsxs)(Ac.Fragment,{children:[" · ",(0,Ac.jsxs)("em",{children:[s.ageSkew," audience"]})]}),(null==s?void 0:s.marketScope)&&(0,Ac.jsxs)(Ac.Fragment,{children:[" · ",(0,Ac.jsxs)("em",{children:[s.marketScope," market"]})]})]})]}),(0,Ac.jsx)("div",{className:"recommendation-channels",children:g.filter(function(e){return k.includes(e.channelType||e.atlChannelType)}).map(function(e){var t=e.channelType||e.atlChannelType;return(0,Ac.jsxs)("div",{className:"rec-channel",children:[(0,Ac.jsx)("span",{className:"rec-dot",style:{background:d(t)}}),(0,Ac.jsx)("span",{children:u(t)}),(0,Ac.jsxs)("strong",{children:[e.allocationPct||e.atlAllocationPct,"%"]})]},t)})}),(0,Ac.jsx)("button",{className:"btn btn-sm btn-primary",onClick:function(){return e=g,t={},k.forEach(function(n){var r=e.find(function(e){return(e.channelType||e.atlChannelType)===n});t[n]=r?parseFloat(r.allocationPct||r.atlAllocationPct||0):0}),T({allocations:t,allocationStrategy:"template"}),void w(!1);var e,t},children:"Apply Recommendation"})]}),(0,Ac.jsx)("div",{className:"allocation-sliders",children:k.map(function(e){var t=S.allocations[e]||0,n=I*t/100,r=d(e);return(0,Ac.jsxs)("div",{className:"allocation-row",children:[(0,Ac.jsxs)("div",{className:"allocation-label",children:[(0,Ac.jsx)("span",{className:"alloc-dot",style:{background:r}}),(0,Ac.jsx)("span",{className:"alloc-name",children:u(e)})]}),(0,Ac.jsxs)("div",{className:"allocation-controls",children:[(0,Ac.jsx)("input",{type:"range",min:"0",max:"100",value:t,onChange:function(t){return P(e,t.target.value)},className:"alloc-slider",style:{"--slider-color":r}}),(0,Ac.jsxs)("div",{className:"alloc-values",children:[(0,Ac.jsx)("input",{type:"number",className:"alloc-pct-input",value:t,min:"0",max:"100",onChange:function(t){return P(e,t.target.value)}}),(0,Ac.jsx)("span",{className:"alloc-pct-sign",children:"%"}),(0,Ac.jsxs)("span",{className:"alloc-amount",children:["$",n.toFixed(0),"/","daily"===S.budgetPeriod?"day":"mo"]})]})]})]},e)})}),(0,Ac.jsx)("div",{className:"allocation-balance ".concat(A?"balanced":"unbalanced"),children:A?(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M20 6L9 17l-5-5"})})," Allocations total 100%"]}):(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})," Allocations total ",j,"% — must equal 100%"]})}),(0,Ac.jsx)("div",{className:"allocation-bar",children:k.map(function(e){var t=S.allocations[e]||0;return(0,Ac.jsx)("div",{className:"alloc-bar-segment",style:{width:"".concat(t,"%"),background:d(e)},title:"".concat(u(e),": ").concat(t,"%")},e)})})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Schedule"}),(0,Ac.jsxs)("div",{className:"form-row",children:[(0,Ac.jsxs)("div",{className:"form-group",style:{marginBottom:0},children:[(0,Ac.jsx)("label",{className:"field-sub-label",children:"Start Date"}),(0,Ac.jsx)("input",{className:"form-input",type:"date",value:S.startDate,min:ah(),onChange:function(e){return T({startDate:e.target.value})}})]}),(0,Ac.jsxs)("div",{className:"form-group",style:{marginBottom:0},children:[(0,Ac.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,Ac.jsx)("label",{className:"field-sub-label",children:"End Date"}),(0,Ac.jsxs)("label",{className:"toggle-label",children:[(0,Ac.jsx)("input",{type:"checkbox",checked:S.hasEndDate,onChange:function(e){return T({hasEndDate:e.target.checked})}}),(0,Ac.jsx)("span",{className:"toggle-text",children:S.hasEndDate?"Set":"No end date"})]})]}),(0,Ac.jsx)("input",{className:"form-input",type:"date",value:S.endDate,min:S.startDate||ah(),disabled:!S.hasEndDate,onChange:function(e){return T({endDate:e.target.value})}})]})]})]})]})});function sh(e){return sh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sh(e)}function ch(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return lh(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(lh(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,lh(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,lh(d,"constructor",l),lh(l,"constructor",c),c.displayName="GeneratorFunction",lh(l,o,"GeneratorFunction"),lh(d),lh(d,o,"Generator"),lh(d,r,function(){return this}),lh(d,"toString",function(){return"[object Generator]"}),(ch=function(){return{w:a,m:h}})()}function lh(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}lh=function(e,t,n,r){function a(t,n){lh(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},lh(e,t,n,r)}function uh(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function dh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dh(Object(n),!0).forEach(function(t){ph(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ph(e,t,n){return(t=function(e){var t=function(e){if("object"!=sh(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=sh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==sh(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fh(e){return function(e){if(Array.isArray(e))return vh(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||mh(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||mh(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mh(e,t){if(e){if("string"==typeof e)return vh(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vh(e,t):void 0}}function vh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function yh(e){var t=e.items,n=e.maxLen,o=e.type,a=e.onUpdate,i=gh((0,r.useState)(null),2),s=i[0],c=i[1],l=gh((0,r.useState)(""),2),u=l[0],d=l[1],h=function(){if(null!==s){var e=fh(t);e[s]=hh(hh({},e[s]),{},{text:u,charCount:u.length}),a(e),c(null)}};return(0,Ac.jsxs)("div",{className:"asset-editor",children:[t.map(function(e,r){var i;return(0,Ac.jsx)("div",{className:"asset-row ".concat(s===r?"editing":""),children:s===r?(0,Ac.jsxs)("div",{className:"asset-edit-row",children:[(0,Ac.jsx)("input",{className:"form-input",value:u,maxLength:n,onChange:function(e){return d(e.target.value)},onKeyDown:function(e){return"Enter"===e.key&&h()},autoFocus:!0}),(0,Ac.jsxs)("span",{className:"char-counter ".concat(u.length>n?"over":""),children:[u.length,"/",n]}),(0,Ac.jsx)("button",{className:"btn btn-sm btn-primary",onClick:h,children:"Save"}),(0,Ac.jsx)("button",{className:"btn btn-sm btn-outline",onClick:function(){return c(null)},children:"Cancel"})]}):(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("span",{className:"asset-text",children:e.text||(0,Ac.jsxs)("em",{className:"text-muted",children:["Empty ",o]})}),(0,Ac.jsxs)("span",{className:"char-counter",children:[e.charCount||(null===(i=e.text)||void 0===i?void 0:i.length)||0,"/",n]}),(0,Ac.jsx)("button",{className:"asset-action",onClick:function(){return function(e){var n;c(e),d((null===(n=t[e])||void 0===n?void 0:n.text)||"")}(r)},title:"Edit",children:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),(0,Ac.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]})}),(0,Ac.jsx)("button",{className:"asset-action danger",onClick:function(){return function(e){a(t.filter(function(t,n){return n!==e}))}(r)},title:"Remove",children:(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]})},r)}),(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline add-asset-btn",onClick:function(){a([].concat(fh(t),[{text:"",charCount:0}])),c(t.length),d("")},children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M12 5v14M5 12h14"})}),"Add ",o]})]})}const bh=(0,r.memo)(function(e){var t,n,o=e.data,a=e.onChange,i=e.businessData,s=Bc().sessionToken,c=gh((0,r.useState)(!1),2),l=c[0],u=c[1],d=gh((0,r.useState)(""),2),h=d[0],p=d[1],f=gh((0,r.useState)(null),2),g=f[0],m=f[1],v=hh({headlines:[],descriptions:[],images:[],analysis:(null==i?void 0:i.analysis)||null,source:null,imageSource:null},o),y=(0,r.useCallback)(function(e){a(hh(hh({},v),e))},[v,a]),b=v.headlines.length>0||v.images.length>0,x=null==i?void 0:i.url,w=function(){var e,t=(e=ch().m(function e(){var t,n,r,o,a,i,c,l,d,h,f,g,b;return ch().w(function(e){for(;;)switch(e.p=e.n){case 0:if(x||v.analysis){e.n=1;break}return e.a(2);case 1:if(u(!0),m(null),e.p=2,!x){e.n=4;break}return p("Analyzing website and generating creative…"),e.n=3,Jl(x,s);case 3:(t=e.v).ok?(o=(null===(n=t.data)||void 0===n||null===(n=n.result)||void 0===n?void 0:n.data)||(null===(r=t.data)||void 0===r?void 0:r.data)||t.data,y({headlines:(null==o?void 0:o.headlines)||[],descriptions:(null==o?void 0:o.descriptions)||[],images:(null==o?void 0:o.images)||[],analysis:(null==o?void 0:o.analysis)||v.analysis,source:(null==o?void 0:o.source)||"generated",imageSource:(null==o?void 0:o.imageSource)||"generated"})):m(t.error||"Failed to generate creative"),e.n=7;break;case 4:if(!v.analysis){e.n=7;break}return p("Generating ad copy…"),e.n=5,Ql(v.analysis,s);case 5:return(a=e.v).ok&&(l=(null===(i=a.data)||void 0===i||null===(i=i.result)||void 0===i?void 0:i.data)||(null===(c=a.data)||void 0===c?void 0:c.data)||a.data,y({headlines:(null==l?void 0:l.headlines)||[],descriptions:(null==l?void 0:l.descriptions)||[]})),p("Finding images…"),e.n=6,Yl(v.analysis,s);case 6:(d=e.v).ok&&(g=(null===(h=d.data)||void 0===h||null===(h=h.result)||void 0===h?void 0:h.data)||(null===(f=d.data)||void 0===f?void 0:f.data)||d.data,y({images:(null==g?void 0:g.images)||[]}));case 7:e.n=9;break;case 8:e.p=8,b=e.v,m(b.message||"Generation failed");case 9:p(""),u(!1);case 10:return e.a(2)}},e,null,[[2,8]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){uh(a,r,o,i,s,"next",e)}function s(e){uh(a,r,o,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}();return(0,Ac.jsxs)("div",{className:"wizard-step-content",children:[(0,Ac.jsxs)("div",{className:"step-intro",children:[(0,Ac.jsx)("h2",{children:"Create your ad"}),(0,Ac.jsx)("p",{children:"Generate headlines, descriptions, and images for your campaign — or write your own."})]}),x&&(0,Ac.jsx)("div",{className:"generate-bar ".concat(b?"has-assets":"empty"),children:(0,Ac.jsxs)("div",{className:"generate-bar-content",children:[(0,Ac.jsx)("div",{className:"generate-bar-icon",children:l?(0,Ac.jsx)("span",{className:"btn-spinner",style:{width:24,height:24}}):b?(0,Ac.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M1 4v6h6M23 20v-6h-6"}),(0,Ac.jsx)("path",{d:"M20.49 9A9 9 0 005.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 013.51 15"})]}):(0,Ac.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})})}),(0,Ac.jsxs)("div",{className:"generate-bar-text",children:[(0,Ac.jsx)("strong",{children:l?h||"Generating…":b?"Regenerate creative":"Generate from your website"}),!l&&!b&&(0,Ac.jsx)("span",{children:"AI will analyze your site and create ad copy + find matching images"}),!l&&b&&(0,Ac.jsx)("span",{children:"Create a fresh set of headlines, descriptions, and images"})]}),(0,Ac.jsx)("button",{className:"btn btn-primary",onClick:w,disabled:l,children:l?"Working…":b?"Regenerate":"Generate"})]})}),g&&(0,Ac.jsx)("div",{className:"error-box",children:g}),(0,Ac.jsxs)("div",{className:"creative-section",children:[(0,Ac.jsxs)("div",{className:"creative-section-header",children:[(0,Ac.jsx)("h3",{children:"Headlines"}),(0,Ac.jsxs)("span",{className:"asset-count",children:[v.headlines.length," / 15 max"]})]}),(0,Ac.jsxs)("p",{className:"creative-section-hint",children:["Short, punchy text shown at the top of your ad. Max ",30," characters each."]}),(0,Ac.jsx)(yh,{items:v.headlines,maxLen:30,type:"headline",onUpdate:function(e){return y({headlines:e})}})]}),(0,Ac.jsxs)("div",{className:"creative-section",children:[(0,Ac.jsxs)("div",{className:"creative-section-header",children:[(0,Ac.jsx)("h3",{children:"Descriptions"}),(0,Ac.jsxs)("span",{className:"asset-count",children:[v.descriptions.length," / 4 max"]})]}),(0,Ac.jsxs)("p",{className:"creative-section-hint",children:["Longer text that appears below the headline. Max ",90," characters each."]}),(0,Ac.jsx)(yh,{items:v.descriptions,maxLen:90,type:"description",onUpdate:function(e){return y({descriptions:e})}})]}),(0,Ac.jsxs)("div",{className:"creative-section",children:[(0,Ac.jsxs)("div",{className:"creative-section-header",children:[(0,Ac.jsx)("h3",{children:"Images"}),(0,Ac.jsxs)("span",{className:"asset-count",children:[v.images.length," image",1!==v.images.length?"s":""]})]}),v.images.length>0?(0,Ac.jsx)("div",{className:"image-grid",children:v.images.map(function(e,t){return(0,Ac.jsxs)("div",{className:"image-thumb",children:[(0,Ac.jsx)("img",{src:e.url,alt:e.altText||"Image ".concat(t+1),loading:"lazy",onError:function(e){e.target.style.display="none"}}),(0,Ac.jsxs)("div",{className:"image-thumb-meta",children:[(0,Ac.jsx)("span",{className:"orientation-tag",children:e.orientation}),e.width&&(0,Ac.jsxs)("span",{className:"dim-tag",children:[e.width,"×",e.height]})]}),(0,Ac.jsx)("button",{className:"image-remove",onClick:function(){return y({images:v.images.filter(function(e,n){return n!==t})})},title:"Remove image",children:(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]},e.imageId||t)})}):(0,Ac.jsxs)("div",{className:"empty-images",children:[(0,Ac.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[(0,Ac.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,Ac.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,Ac.jsx)("path",{d:"M21 15l-5-5L5 21"})]}),(0,Ac.jsx)("span",{children:x?'Click "Generate" above to find images for your ad':"No images added yet"})]})]}),v.headlines.length>0&&(0,Ac.jsxs)("div",{className:"creative-section",children:[(0,Ac.jsxs)("div",{className:"creative-section-header",children:[(0,Ac.jsx)("h3",{children:"Ad Preview"}),(0,Ac.jsx)("span",{className:"asset-count",style:{fontStyle:"italic"},children:"Approximate appearance"})]}),(0,Ac.jsxs)("div",{className:"ad-preview-card",children:[(0,Ac.jsxs)("div",{className:"ad-preview-label",children:["Ad · ",null!=i&&i.url?new URL(i.url).hostname:"yoursite.com"]}),(0,Ac.jsx)("div",{className:"ad-preview-headline",children:(null===(t=v.headlines[0])||void 0===t?void 0:t.text)||"Your Headline"}),(0,Ac.jsx)("div",{className:"ad-preview-desc",children:(null===(n=v.descriptions[0])||void 0===n?void 0:n.text)||"Your description will appear here."})]})]})]})});function xh(e){return xh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xh(e)}function wh(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return kh(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(kh(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,kh(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,kh(d,"constructor",l),kh(l,"constructor",c),c.displayName="GeneratorFunction",kh(l,o,"GeneratorFunction"),kh(d),kh(d,o,"Generator"),kh(d,r,function(){return this}),kh(d,"toString",function(){return"[object Generator]"}),(wh=function(){return{w:a,m:h}})()}function kh(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}kh=function(e,t,n,r){function a(t,n){kh(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},kh(e,t,n,r)}function Ch(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Sh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ch(Object(n),!0).forEach(function(t){Th(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ch(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Th(e,t,n){return(t=function(e){var t=function(e){if("object"!=xh(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=xh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xh(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ih(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function jh(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Ih(a,r,o,i,s,"next",e)}function s(e){Ih(a,r,o,i,s,"throw",e)}i(void 0)})}}function Ah(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Nh(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nh(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Eh={submitted:"✓",pending_review:"⏳",error:"✗",pending:"…"},_h={submitted:"Submitted",pending_review:"Queued for Review",error:"Failed",pending:"Pending"},Ph={AGE_18_24:"18–24",AGE_25_34:"25–34",AGE_35_44:"35–44",AGE_45_54:"45–54",AGE_55_64:"55–64",AGE_65_UP:"65+"},Oh={MALE:"Male",FEMALE:"Female",UNDETERMINED:"All Genders"},Rh={local:"Local",regional:"Regional",national:"National"},Mh={young:"Younger",mature:"Mature"};function zh(e){var t=e.title,n=e.icon,r=e.children,o=e.onEdit;return(0,Ac.jsxs)("div",{className:"review-section",children:[(0,Ac.jsxs)("div",{className:"review-section-header",children:[(0,Ac.jsxs)("div",{className:"review-section-title",children:[(0,Ac.jsx)("span",{className:"review-icon",children:n}),(0,Ac.jsx)("h3",{children:t})]}),o&&(0,Ac.jsx)("button",{className:"btn btn-sm btn-outline",onClick:o,children:"Edit"})]}),(0,Ac.jsx)("div",{className:"review-section-body",children:r})]})}function Lh(e){var t=e.label,n=e.value,r=e.mono;return(0,Ac.jsxs)("div",{className:"review-row",children:[(0,Ac.jsx)("span",{className:"review-label",children:t}),(0,Ac.jsx)("span",{className:"review-value ".concat(r?"mono":""),children:n||"—"})]})}var qh=(0,r.memo)(function(e){var t,n,o,a,i,s,c,l,u,d,h,p=e.stepData,f=e.onGoToStep,g=Bc().sessionToken,m=id(),v=m.toDisplayLabel,y=m.getChannelLabel,b=m.getChannelColor,x=Ah((0,r.useState)("review"),2),w=x[0],k=x[1],C=Ah((0,r.useState)(null),2),S=C[0],T=C[1],I=Ah((0,r.useState)(null),2),j=I[0],A=I[1],N=Ah((0,r.useState)(null),2),E=N[0],_=N[1],P=Ah((0,r.useState)(null),2),O=P[0],R=P[1],M=Ah((0,r.useState)(!1),2),z=M[0],L=M[1],q=Ah((0,r.useState)(!1),2),D=q[0],F=q[1],U=(null==p?void 0:p[1])||{},B=(null==p?void 0:p[2])||{},H=(null==p?void 0:p[3])||{},K=(null==p?void 0:p[4])||{},$=(null==p?void 0:p[5])||{},G=H.selectedChannels||[],W=G.length>1,V=parseFloat(K.totalBudget)||0,Q=K.allocations||{},Y=v(U.objective),J=v(U.businessCategory),X=function(e){var t=parseFloat(e);return isNaN(t)?"—":"$".concat(t.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}))},Z=[];if(U.campaignName||Z.push({step:1,msg:"Campaign name is required"}),U.objective||Z.push({step:1,msg:"Objective is required"}),0===G.length&&Z.push({step:3,msg:"Select at least one channel"}),(!V||V<=0)&&Z.push({step:4,msg:"Budget must be set"}),W){var ee=Object.values(Q).reduce(function(e,t){return e+(t||0)},0);Math.abs(ee-100)>.01&&Z.push({step:4,msg:"Channel allocations must total 100%"})}var te=function(){var e=jh(wh().m(function e(){var t,n,r,o,a,i,s;return wh().w(function(e){for(;;)switch(e.n){case 0:if(!(Z.length>0)){e.n=1;break}return e.a(2);case 1:return T(null),k("staging"),r=G.map(function(e){return{channelType:e,allocationPct:W?Q[e]||0:100}}),o=Sh({name:U.campaignName,objective:U.objective,totalBudget:V,budgetPeriod:K.budgetPeriod||"monthly",startDate:K.startDate,endDate:K.hasEndDate?K.endDate:null,allocationStrategy:K.allocationStrategy||"manual",businessCategory:U.businessCategory,channels:r,ageSkew:B.ageSkew||null,marketScope:B.marketScope||null,locations:B.locations||[],demographics:B.demographics||{}},j?{initiativeId:j}:{}),e.n=2,El(o,g);case 2:if((a=e.v).ok){e.n=3;break}return k("error"),T(a.error||(null===(i=a.data)||void 0===i?void 0:i.error)||"Failed to stage initiative"),e.a(2);case 3:if(s=null===(t=a.data)||void 0===t?void 0:t.initiativeId){e.n=4;break}return k("error"),T("Initiative staged but no ID returned"),e.a(2);case 4:A(s),_((null===(n=a.data)||void 0===n?void 0:n.billing)||null),F(!1),L(!0),k("confirm");case 5:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),ne=function(){var e=jh(wh().m(function e(){var t,n,r,o;return wh().w(function(e){for(;;)switch(e.n){case 0:return L(!1),T(null),k("launching"),e.n=1,Pl(j,g);case 1:(n=e.v).ok||null!==(t=n.data)&&void 0!==t&&t.channels?(R(n.data),k("done")):(R(n.data),k("done"),null!==(r=n.data)&&void 0!==r&&null!==(r=r.channels)&&void 0!==r&&r.length||T(n.error||(null===(o=n.data)||void 0===o?void 0:o.error)||"Launch failed — campaigns saved but not dispatched"));case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();if("done"===w){var re=(null==O?void 0:O.channels)||[],oe=re.filter(function(e){return"submitted"===e.status||"pending_review"===e.status}).length,ae=re.filter(function(e){return"error"===e.status}).length;return(0,Ac.jsx)("div",{className:"wizard-step-content",children:(0,Ac.jsxs)("div",{className:"submit-success",children:[(0,Ac.jsx)("div",{className:"success-icon",children:0===ae?(0,Ac.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),(0,Ac.jsx)("path",{d:"M22 4L12 14.01l-3-3"})]}):oe>0?(0,Ac.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,Ac.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,Ac.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):(0,Ac.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,Ac.jsx)("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),(0,Ac.jsx)("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})}),(0,Ac.jsx)("h2",{children:0===ae?"Campaign ".concat(W?"Initiative ":"","Launched!"):oe>0?"Partially Launched":"Launch Failed"}),(0,Ac.jsx)("p",{children:0===ae?'Your campaign "'.concat(U.campaignName,'" has been submitted').concat(W?" across ".concat(G.length," channels"):"","."):oe>0?"".concat(oe," of ").concat(re.length," channels submitted successfully."):"All channel dispatches failed. Your campaign has been saved — you can retry from the Campaigns view."}),re.length>0&&(0,Ac.jsx)("div",{className:"launch-results",children:re.map(function(e,t){return(0,Ac.jsxs)("div",{className:"launch-result-row ".concat(e.status),children:[(0,Ac.jsx)("span",{className:"launch-ch-dot",style:{background:b(e.channelType)}}),(0,Ac.jsx)("span",{className:"launch-ch-name",children:y(e.channelType)}),(0,Ac.jsxs)("span",{className:"launch-status ".concat(e.status),children:[Eh[e.status]||"?"," ",_h[e.status]||e.status]}),e.error&&(0,Ac.jsx)("span",{className:"launch-error",children:e.error})]},t)})})]})})}if("staging"===w)return(0,Ac.jsx)("div",{className:"wizard-step-content",children:(0,Ac.jsxs)("div",{className:"phase-loading",children:[(0,Ac.jsx)("div",{className:"loading-spinner"}),(0,Ac.jsx)("h3",{children:"Preparing your campaign…"}),(0,Ac.jsx)("p",{children:"Calculating fees and validating configuration"})]})});if("launching"===w)return(0,Ac.jsx)("div",{className:"wizard-step-content",children:(0,Ac.jsxs)("div",{className:"phase-loading",children:[(0,Ac.jsx)("div",{className:"loading-spinner"}),(0,Ac.jsx)("h3",{children:"Launching campaign…"}),(0,Ac.jsxs)("p",{children:["Submitting to ",W?"".concat(G.length," ad networks"):"ad network"]})]})});var ie=(null===(t=B.locations)||void 0===t?void 0:t.length)>0?B.locations.map(function(e){return e.name}).join(", "):"All regions (national)",se=(null===(n=B.demographics)||void 0===n||null===(n=n.ageRanges)||void 0===n?void 0:n.length)>0?B.demographics.ageRanges.map(function(e){return Ph[e]||e}).join(", "):"All ages",ce=(null===(o=B.demographics)||void 0===o||null===(o=o.genders)||void 0===o?void 0:o.length)>0?B.demographics.genders.map(function(e){return Oh[e]||e}).join(", "):"All genders";return(0,Ac.jsxs)("div",{className:"wizard-step-content",children:[(0,Ac.jsxs)("div",{className:"step-intro",children:[(0,Ac.jsx)("h2",{children:"Review your campaign"}),(0,Ac.jsx)("p",{children:"Double-check everything below before launching."})]}),Z.length>0&&(0,Ac.jsx)("div",{className:"issues-box",children:Z.map(function(e,t){return(0,Ac.jsxs)("div",{className:"issue-row",onClick:function(){return f(e.step)},children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,Ac.jsx)("span",{children:e.msg}),(0,Ac.jsx)("span",{className:"issue-fix",children:"Fix →"})]},t)})}),S&&(0,Ac.jsx)("div",{className:"error-box",children:S}),(0,Ac.jsxs)("div",{className:"review-grid",children:[(0,Ac.jsxs)("div",{className:"review-grid-col",children:[(0,Ac.jsxs)(zh,{title:"Campaign",icon:"🎯",onEdit:function(){return f(1)},children:[(0,Ac.jsx)(Lh,{label:"Name",value:U.campaignName}),(0,Ac.jsx)(Lh,{label:"Objective",value:Y}),(0,Ac.jsx)(Lh,{label:"Category",value:J})]}),(0,Ac.jsxs)(zh,{title:"Audience",icon:"👥",onEdit:function(){return f(2)},children:[(0,Ac.jsx)(Lh,{label:"Locations",value:ie}),(0,Ac.jsx)(Lh,{label:"Age",value:se}),(0,Ac.jsx)(Lh,{label:"Gender",value:ce}),(0,Ac.jsxs)("div",{className:"review-factors",style:{marginTop:8},children:[(0,Ac.jsx)("span",{className:"review-factor-chip",children:Rh[B.marketScope]||"National"}),(0,Ac.jsx)("span",{className:"review-factor-chip",children:B.ageSkew?Mh[B.ageSkew]:"Balanced"})]})]})]}),(0,Ac.jsxs)("div",{className:"review-grid-col",children:[(0,Ac.jsx)(zh,{title:"Channels",icon:"📡",onEdit:function(){return f(3)},children:(0,Ac.jsx)("div",{className:"review-channels",children:G.map(function(e){return(0,Ac.jsxs)("span",{className:"review-channel-chip",style:{borderColor:b(e)},children:[(0,Ac.jsx)("span",{className:"review-ch-dot",style:{background:b(e)}}),y(e),W&&(0,Ac.jsxs)("span",{style:{marginLeft:"auto",fontSize:12,color:"var(--color-text-muted)"},children:[Q[e]||0,"%"]})]},e)})})}),(0,Ac.jsxs)(zh,{title:"Budget",icon:"💰",onEdit:function(){return f(4)},children:[(0,Ac.jsx)(Lh,{label:"daily"===K.budgetPeriod?"Daily":"Monthly",value:X(V)}),(0,Ac.jsx)(Lh,{label:"Start",value:K.startDate}),K.hasEndDate&&(0,Ac.jsx)(Lh,{label:"End",value:K.endDate})]}),(0,Ac.jsx)(zh,{title:"Creative",icon:"🖼️",onEdit:function(){return f(5)},children:(null===(a=$.headlines)||void 0===a?void 0:a.length)>0||(null===(i=$.descriptions)||void 0===i?void 0:i.length)>0?(0,Ac.jsxs)("div",{className:"review-creative-summary",children:[(0,Ac.jsxs)("span",{children:[(null===(s=$.headlines)||void 0===s?void 0:s.length)||0," headline",1!==((null===(c=$.headlines)||void 0===c?void 0:c.length)||0)?"s":""]}),(0,Ac.jsx)("span",{className:"review-dot-sep",children:"·"}),(0,Ac.jsxs)("span",{children:[(null===(l=$.descriptions)||void 0===l?void 0:l.length)||0," description",1!==((null===(u=$.descriptions)||void 0===u?void 0:u.length)||0)?"s":""]}),(0,Ac.jsx)("span",{className:"review-dot-sep",children:"·"}),(0,Ac.jsxs)("span",{children:[(null===(d=$.images)||void 0===d?void 0:d.length)||0," image",1!==((null===(h=$.images)||void 0===h?void 0:h.length)||0)?"s":""]})]}):(0,Ac.jsx)("div",{className:"review-empty-note",children:"No creative assets added yet"})})]})]}),(0,Ac.jsxs)("div",{className:"submit-bar",children:[(0,Ac.jsxs)("div",{className:"submit-bar-info",children:[(0,Ac.jsx)("strong",{children:"Ready to launch?"}),(0,Ac.jsxs)("span",{children:["Your campaign will be submitted"," to ".concat(W?G.map(function(e){return y(e)}).join(" and "):y(G[0])," for review.")]})]}),(0,Ac.jsxs)("button",{className:"btn btn-primary btn-lg",onClick:te,disabled:Z.length>0,children:[(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})," ","Launch Campaign"]})]}),z&&E&&(0,Ac.jsx)(Fh,{campaignName:U.campaignName,objectiveLabel:Y,billing:E,selectedChannels:G,isMultiChannel:W,termsAccepted:D,onToggleTerms:function(){return F(!D)},onConfirm:ne,onCancel:function(){L(!1),k("review")},formatBudget:X,getChannelLabel:y,getChannelColor:b})]})});const Dh=qh;function Fh(e){var t=e.campaignName,n=e.objectiveLabel,r=e.billing,o=(e.selectedChannels,e.isMultiChannel),a=e.termsAccepted,i=e.onToggleTerms,s=e.onConfirm,c=e.onCancel,l=e.formatBudget,u=e.getChannelLabel,d=e.getChannelColor,h="daily"===r.budgetPeriod?"day":"month",p=(100*(r.marginRate||0)).toFixed(0),f=r.channels||[];return(0,Ac.jsx)("div",{className:"confirm-overlay",onClick:c,children:(0,Ac.jsxs)("div",{className:"confirm-modal",onClick:function(e){return e.stopPropagation()},children:[(0,Ac.jsxs)("div",{className:"confirm-header",children:[(0,Ac.jsx)("div",{className:"confirm-icon-wrap",children:(0,Ac.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"#d97706",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),(0,Ac.jsx)("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),(0,Ac.jsx)("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}),(0,Ac.jsx)("h2",{children:"Confirm Campaign Launch"})]}),(0,Ac.jsxs)("p",{className:"confirm-subtitle",children:["You are about to launch ",(0,Ac.jsx)("strong",{children:t}),". By proceeding, you authorize AdPlatform to charge your payment method on file for the advertising spend and management fees described below."]}),(0,Ac.jsxs)("div",{className:"confirm-billing",children:[(0,Ac.jsxs)("div",{className:"confirm-billing-row",children:[(0,Ac.jsx)("span",{children:"Campaign objective"}),(0,Ac.jsx)("span",{children:n})]}),(0,Ac.jsxs)("div",{className:"confirm-billing-row",children:[(0,Ac.jsx)("span",{children:"Ad spend"}),(0,Ac.jsxs)("span",{children:[l(r.adSpend)," / ",h]})]}),o&&f.map(function(e,t){return(0,Ac.jsxs)("div",{className:"confirm-billing-row confirm-billing-sub",children:[(0,Ac.jsxs)("span",{children:[(0,Ac.jsx)("span",{className:"confirm-ch-dot",style:{background:d(e.channelType)}}),u(e.channelType)," (",e.allocationPct,"%)"]}),(0,Ac.jsxs)("span",{children:[l(e.adSpend)," / ",h]})]},t)}),(0,Ac.jsxs)("div",{className:"confirm-billing-row",children:[(0,Ac.jsxs)("span",{children:["Management fee (",p,"%)"]}),(0,Ac.jsxs)("span",{children:[l(r.managementFee)," / ",h]})]}),o&&f.map(function(e,t){return(0,Ac.jsxs)("div",{className:"confirm-billing-row confirm-billing-sub",children:[(0,Ac.jsxs)("span",{children:[(0,Ac.jsx)("span",{className:"confirm-ch-dot",style:{background:d(e.channelType)}}),u(e.channelType)]}),(0,Ac.jsxs)("span",{children:[l(e.managementFee)," / ",h]})]},"fee-".concat(t))}),r.platformFee>0&&(0,Ac.jsxs)("div",{className:"confirm-billing-row",children:[(0,Ac.jsx)("span",{children:"Platform fee"}),(0,Ac.jsxs)("span",{children:[l(r.platformFee)," / ",h]})]}),(0,Ac.jsxs)("div",{className:"confirm-billing-row confirm-billing-total",children:[(0,Ac.jsx)("span",{children:"Total recurring charge"}),(0,Ac.jsxs)("span",{className:"confirm-amount",children:[l(r.totalCharge)," / ",h]})]})]}),(0,Ac.jsxs)("div",{className:"confirm-note",children:["Ad spend will be billed to your payment method on file. Actual ad network charges may vary based on delivery and auction dynamics. Management fees are calculated at ",p,"% of ad spend",r.minManagementFee>0&&" (".concat(l(r.minManagementFee),"/mo minimum)"),". You can pause or cancel campaigns at any time from the Campaigns dashboard.","client"===r.pricingSource&&(0,Ac.jsxs)("span",{className:"confirm-pricing-source",title:"This client has a negotiated rate",children:[" ","— Custom rate applied"]})]}),(0,Ac.jsxs)("label",{className:"confirm-terms",children:[(0,Ac.jsx)("input",{type:"checkbox",checked:a,onChange:i}),(0,Ac.jsxs)("span",{children:["I authorize AdPlatform to charge up to ",(0,Ac.jsxs)("strong",{children:[l(r.totalCharge)," / ",h]})," to my payment method on file. I understand that ad networks may take up to 48 hours to review and approve my campaigns, and that actual delivery and charges may vary."]})]}),(0,Ac.jsxs)("div",{className:"confirm-actions",children:[(0,Ac.jsx)("button",{className:"btn btn-outline",onClick:c,children:"Cancel"}),(0,Ac.jsxs)("button",{className:"btn btn-primary btn-lg",onClick:s,disabled:!a,children:[(0,Ac.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("rect",{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2"}),(0,Ac.jsx)("line",{x1:"1",y1:"10",x2:"23",y2:"10"})]})," ","Confirm & Launch"]})]})]})})}function Uh(e){return Uh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uh(e)}function Bh(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Hh(l,"_invoke",function(n,r,o){var a,s,c,l=0,u=o||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!d&&l&&!o&&t<u.length;t++){var o,a=u[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw d=!0,r}return function(o,u,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),s=u,c=f;(t=s<2?e:c)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Hh(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Hh(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,Hh(d,"constructor",l),Hh(l,"constructor",c),c.displayName="GeneratorFunction",Hh(l,o,"GeneratorFunction"),Hh(d),Hh(d,o,"Generator"),Hh(d,r,function(){return this}),Hh(d,"toString",function(){return"[object Generator]"}),(Bh=function(){return{w:a,m:h}})()}function Hh(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Hh=function(e,t,n,r){function a(t,n){Hh(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Hh(e,t,n,r)}function Kh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kh(Object(n),!0).forEach(function(t){Gh(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Gh(e,t,n){return(t=function(e){var t=function(e){if("object"!=Uh(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Uh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Uh(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wh(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Vh(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Wh(a,r,o,i,s,"next",e)}function s(e){Wh(a,r,o,i,s,"throw",e)}i(void 0)})}}function Qh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yh(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yh(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Jh=[{num:1,key:"objective",label:"Objective",icon:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},{num:2,key:"audience",label:"Audience",icon:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"},{num:3,key:"channels",label:"Channels",icon:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.14 0M1.394 9.393c5.857-5.858 15.355-5.858 21.213 0"},{num:4,key:"budget",label:"Budget",icon:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},{num:5,key:"creative",label:"Creative",icon:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"},{num:6,key:"review",label:"Review",icon:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"}];function Xh(e){var t,n,o=e.onClose,a=e.wizardId,i=Bc().sessionToken,s=Qh((0,r.useState)(1),2),c=s[0],l=s[1],u=Qh((0,r.useState)(a||null),2),d=u[0],h=u[1],p=Qh((0,r.useState)({1:{},2:{},3:{},4:{},5:{}}),2),f=p[0],g=p[1],m=(0,r.useRef)(null),v=(0,r.useRef)(d);v.current=d,(0,r.useEffect)(function(){a&&i&&Vh(Bh().m(function e(){var t,n,r,o,s;return Bh().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Kl(a,i);case 1:(t=e.v).ok&&t.data&&(n=t.data.data||t.data,r={1:{},2:{},3:{},4:{},5:{}},(n.wizStepData||n.stepData)&&(o="string"==typeof(n.wizStepData||n.stepData)?JSON.parse(n.wizStepData||n.stepData):n.wizStepData||n.stepData,Object.assign(r,o)),(n.wizName||n.name)&&(r[1]=$h($h({},r[1]),{},{campaignName:n.wizName||n.name})),(n.wizUrl||n.url)&&(r[1]=$h($h({},r[1]),{},{url:n.wizUrl||n.url})),g(r),s=parseInt(n.wizCurrentStep||n.currentStep)||1,l(Math.min(Math.max(s,1),Jh.length)));case 2:return e.a(2)}},e)}))()},[a,i]);var y=(0,r.useCallback)(function(){var e=Vh(Bh().m(function e(t,n,r){var o,a,s,c,l,u,d,p,f,g,m;return Bh().w(function(e){for(;;)switch(e.p=e.n){case 0:if(i){e.n=1;break}return e.a(2);case 1:if(e.p=1,o=v.current){e.n=3;break}return c=(null===(a=r[1])||void 0===a?void 0:a.campaignName)||"Untitled Campaign",l=(null===(s=r[1])||void 0===s?void 0:s.url)||"",e.n=2,Hl(c,l,i);case 2:(u=e.v).ok&&(o=(null===(d=u.data)||void 0===d||null===(d=d.data)||void 0===d?void 0:d.wizardId)||(null===(p=u.data)||void 0===p?void 0:p.wizardId)||(null===(f=u.data)||void 0===f?void 0:f.id))&&(h(o),v.current=o);case 3:if(!o){e.n=4;break}return e.n=4,Wl(o,t,r,i,null===(g=r[1])||void 0===g?void 0:g.campaignName);case 4:e.n=6;break;case 5:e.p=5,m=e.v,console.warn("Auto-save failed:",m);case 6:return e.a(2)}},e,null,[[1,5]])}));return function(t,n,r){return e.apply(this,arguments)}}(),[i]),b=(0,r.useCallback)(function(e,t){g(function(n){var r=$h($h({},n),{},Gh({},e,t));return m.current&&clearTimeout(m.current),m.current=setTimeout(function(){return y(e,t,r)},1500),r})},[y]),x=function(e){var t;l(e),v.current&&i&&e<=5&&Wl(v.current,e,f,i,null===(t=f[1])||void 0===t?void 0:t.campaignName).catch(function(){})},w=(null===(t=f[1])||void 0===t?void 0:t.campaignName)||"New Campaign",k=(null===(n=f[3])||void 0===n||null===(n=n.selectedChannels)||void 0===n?void 0:n.length)||0;return(0,Ac.jsx)(pd,{children:(0,Ac.jsxs)("div",{className:"wizard-wrapper",children:[(0,Ac.jsxs)("div",{className:"wizard-header",children:[(0,Ac.jsxs)("div",{className:"wizard-header-left",children:[(0,Ac.jsx)("button",{className:"wizard-back-btn",onClick:o,title:"Exit wizard",children:(0,Ac.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})}),(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h2",{className:"wizard-title",children:w}),(0,Ac.jsx)("span",{className:"wizard-subtitle",children:k>1?"Multi-channel Campaign · ".concat(k," channels"):"Campaign Wizard"})]})]}),(0,Ac.jsx)("div",{className:"wizard-header-right",children:(0,Ac.jsx)("span",{className:"status-badge status-active",children:"draft"})})]}),(0,Ac.jsxs)("div",{className:"wizard-rail",children:[Jh.map(function(e){var t=c===e.num,n=e.num<Jh.length&&function(e){var t,n=f[e];switch(e){case 1:return!(null==n||!n.campaignName||null==n||!n.objective);case 2:return!0;case 3:return!!((null==n||null===(t=n.selectedChannels)||void 0===t?void 0:t.length)>0);case 4:var r;if(!((null==n?void 0:n.totalBudget)&&parseFloat(n.totalBudget)>0))return!1;if(((null===(r=f[3])||void 0===r||null===(r=r.selectedChannels)||void 0===r?void 0:r.length)||0)>1){var o=Object.values((null==n?void 0:n.allocations)||{}).reduce(function(e,t){return e+(t||0)},0);return Math.abs(o-100)<.01}return!0;case 5:var a,i,s=(null==n||null===(a=n.headlines)||void 0===a?void 0:a.length)>0,c=(null==n||null===(i=n.descriptions)||void 0===i?void 0:i.length)>0;return s||c;default:return!1}}(e.num),r=e.num<c;return(0,Ac.jsxs)("button",{className:"wizard-rail-step ".concat(t?"active":""," ").concat(n?"complete":""," ").concat(r?"past":""),onClick:function(){return x(e.num)},children:[(0,Ac.jsx)("div",{className:"rail-step-indicator",children:n?(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:(0,Ac.jsx)("path",{d:"M20 6L9 17l-5-5"})}):(0,Ac.jsx)("span",{children:e.num})}),(0,Ac.jsx)("span",{className:"rail-step-label",children:e.label})]},e.num)}),(0,Ac.jsx)("div",{className:"wizard-rail-progress",style:{width:"".concat((c-1)/(Jh.length-1)*100,"%")}})]}),(0,Ac.jsxs)("div",{className:"wizard-body",children:[1===c&&(0,Ac.jsx)(Sd,{data:f[1],onChange:function(e){return b(1,e)}}),2===c&&(0,Ac.jsx)(Ud,{data:f[2],onChange:function(e){return b(2,e)}}),3===c&&(0,Ac.jsx)(Qd,{data:f[3],onChange:function(e){return b(3,e)},objectiveData:f[1],audienceData:f[2]}),4===c&&(0,Ac.jsx)(ih,{data:f[4],onChange:function(e){return b(4,e)},channelData:f[3],objectiveData:f[1],audienceData:f[2]}),5===c&&(0,Ac.jsx)(bh,{data:f[5],onChange:function(e){return b(5,e)},businessData:f[1]}),6===c&&(0,Ac.jsx)(Dh,{stepData:f,onGoToStep:x})]}),c<Jh.length&&(0,Ac.jsxs)("div",{className:"wizard-footer",children:[(0,Ac.jsxs)("button",{className:"btn btn-outline",onClick:function(){return x(Math.max(c-1,1))},disabled:1===c,children:[(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),"Back"]}),(0,Ac.jsxs)("div",{className:"wizard-footer-center",children:["Step ",c," of ",Jh.length]}),(0,Ac.jsxs)("button",{className:"btn btn-primary",onClick:function(){return x(Math.min(c+1,Jh.length))},disabled:3===c&&0===k,children:[5===c?"Review Campaign":"Continue",(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M5 12h14M12 5l7 7-7 7"})})]})]})]})})}function Zh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ep(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ep(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ep(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var tp={dashboard:"Dashboard",campaigns:"Campaigns",reporting:"Reporting",accounts:"Accounts",developer:"API Testing",settings:"Settings",wizard:"Campaign Wizard"};function np(){var e,t=Bc(),n=t.sessionUser,o=t.signOut,a=Zh((0,r.useState)("dashboard"),2),i=a[0],s=a[1],c=Zh((0,r.useState)(!1),2),l=c[0],u=c[1],d=Zh((0,r.useState)(!1),2),h=d[0],p=d[1],f=Zh((0,r.useState)(null),2),g=f[0],m=f[1],v=(0,r.useCallback)(function(e,t){"wizard"===e&&m((null==t?void 0:t.wizardId)||null),s(e)},[]);return(0,Ac.jsxs)("div",{className:"platform ".concat(l?"sidebar-collapsed":""),children:[(0,Ac.jsx)(Jc,{activeView:i,onNavigate:v,collapsed:l,onToggle:function(){return u(!l)}}),(0,Ac.jsxs)("div",{className:"main-area",children:[(0,Ac.jsxs)("header",{className:"top-bar",children:[(0,Ac.jsxs)("nav",{className:"breadcrumb",children:[(0,Ac.jsx)("span",{className:"breadcrumb-item",children:"AdPlatform"}),(0,Ac.jsx)("span",{className:"breadcrumb-separator",children:"/"}),(0,Ac.jsx)("span",{className:"breadcrumb-current",children:tp[i]})]}),(0,Ac.jsxs)("div",{className:"top-bar-actions",children:[(null==n?void 0:n.clientName)&&(0,Ac.jsx)("span",{className:"client-badge",children:n.clientName}),(0,Ac.jsxs)("div",{className:"user-menu",children:[(0,Ac.jsxs)("button",{className:"user-menu-trigger",onClick:function(){return p(!h)},children:[(0,Ac.jsx)("div",{className:"user-avatar",children:(e=(null==n?void 0:n.name)||(null==n?void 0:n.email),e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase().slice(0,2):"U")}),(0,Ac.jsx)("span",{className:"user-name",children:(null==n?void 0:n.name)||(null==n?void 0:n.email)||"User"}),(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M6 9l6 6 6-6"})})]}),h&&(0,Ac.jsxs)("div",{className:"user-dropdown",children:[(0,Ac.jsxs)("button",{className:"user-dropdown-item",onClick:function(){v("settings"),p(!1)},children:[(0,Ac.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}),"Settings"]}),(0,Ac.jsx)("div",{className:"user-dropdown-divider"}),(0,Ac.jsxs)("button",{className:"user-dropdown-item danger",onClick:function(){o(),p(!1)},children:[(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4M16 17l5-5-5-5M21 12H9"})}),"Sign Out"]})]})]})]})]}),(0,Ac.jsx)("main",{className:"content-area",children:function(){switch(i){case"wizard":return(0,Ac.jsx)(Xh,{wizardId:g,onClose:function(){return v("campaigns")}});case"campaigns":return(0,Ac.jsx)(Cu,{onNavigate:v});case"reporting":return(0,Ac.jsx)(Ou,{});case"accounts":return(0,Ac.jsx)(Du,{});case"developer":return(0,Ac.jsx)(Gu,{});case"settings":return(0,Ac.jsx)(Zu,{onSignOut:o});default:return(0,Ac.jsx)(bl,{onNavigate:v})}}()})]})]})}function rp(){var e=Bc(),t=e.authState,n=e.error;switch(t){case"active":return(0,Ac.jsx)(np,{});case"needsRegistration":return(0,Ac.jsx)(Vc,{});case"error":return(0,Ac.jsx)(Qc,{message:n});case"authenticating":return(0,Ac.jsxs)("div",{className:"loading-screen",children:[(0,Ac.jsx)("div",{className:"loading-spinner"}),(0,Ac.jsx)("p",{children:"Signing in…"})]});default:return(0,Ac.jsx)(Wc,{})}}function op(){return(0,Ac.jsx)(Gc,{children:(0,Ac.jsx)(rp,{})})}var ap=n(72),ip=n.n(ap),sp=n(825),cp=n.n(sp),lp=n(659),up=n.n(lp),dp=n(56),hp=n.n(dp),pp=n(159),fp=n.n(pp),gp=n(113),mp=n.n(gp),vp=n(877),yp={};yp.styleTagTransform=mp(),yp.setAttributes=hp(),yp.insert=up().bind(null,"head"),yp.domAPI=cp(),yp.insertStyleElement=fp(),ip()(vp.A,yp),vp.A&&vp.A.locals&&vp.A.locals;var bp=n(767),xp={};xp.styleTagTransform=mp(),xp.setAttributes=hp(),xp.insert=up().bind(null,"head"),xp.domAPI=cp(),xp.insertStyleElement=fp(),ip()(bp.A,xp),bp.A&&bp.A.locals&&bp.A.locals;var wp=n(671),kp={};kp.styleTagTransform=mp(),kp.setAttributes=hp(),kp.insert=up().bind(null,"head"),kp.domAPI=cp(),kp.insertStyleElement=fp(),ip()(wp.A,kp),wp.A&&wp.A.locals&&wp.A.locals,(0,o.H)(document.getElementById("root")).render((0,Ac.jsx)(op,{}))})(); |