PageSourceSearch

https://workflowcapture.ai/assets/index-CytqHqx-.js

js workflowcapture.ai collected 2026-10-02 01:12:15 UTC 1,884,953 bytes, 531 lines download raw bytes

vendor: 8,108 bytes, line 1
1function qI(t,e){for(var s=0;s<e.length;s++){const r=e[s];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function s(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=s(i);fetch(i.href,a)}})();function LE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var F0={exports:{}},Th={};var zC;function WI(){if(zC)return Th;zC=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function s(r,i,a){var l=null;if(a!==void 0&&(l=""+a),i.key!==void 0&&(l=""+i.key),"key"in i){a={};for(var d in i)d!=="key"&&(a[d]=i[d])}else a=i;return i=a.ref,{$$typeof:t,type:r,key:l,ref:i!==void 0?i:null,props:a}}return Th.Fragment=e,Th.jsx=s,Th.jsxs=s,Th}var VC;function GI(){return VC||(VC=1,F0.exports=WI()),F0.exports}var n=GI(),U0={exports:{}},Eh={},H0={exports:{}},q0={};var FC;function KI(){return FC||(FC=1,(function(t){function e(q,W){var ie=q.length;q.push(W);e:for(;0<ie;){var he=ie-1>>>1,se=q[he];if(0<i(se,W))q[he]=W,q[ie]=se,ie=he;else break e}}function s(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var W=q[0],ie=q.pop();if(ie!==W){q[0]=ie;e:for(var he=0,se=q.length,B=se>>>1;he<B;){var le=2*(he+1)-1,pe=q[le],Oe=le+1,Se=q[Oe];if(0>i(pe,ie))Oe<se&&0>i(Se,pe)?(q[he]=Se,q[Oe]=ie,he=Oe):(q[he]=pe,q[le]=ie,he=le);else if(Oe<se&&0>i(Se,ie))q[he]=Se,q[Oe]=ie,he=Oe;else break e}}return W}function i(q,W){var ie=q.sortIndex-W.sortIndex;return ie!==0?ie:q.id-W.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var l=Date,d=l.now();t.unstable_now=function(){return l.now()-d}}var u=[],m=[],p=1,x=null,g=3,b=!1,v=!1,k=!1,N=!1,S=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function _(q){for(var W=s(m);W!==null;){if(W.callback===null)r(m);else if(W.startTime<=q)r(m),W.sortIndex=W.expirationTime,e(u,W);else break;W=s(m)}}function T(q){if(k=!1,_(q),!v)if(s(u)!==null)v=!0,$||($=!0,U());else{var W=s(m);W!==null&&ne(T,W.startTime-q)}}var $=!1,L=-1,M=5,I=-1;function z(){return N?!0:!(t.unstable_now()-I<M)}function ae(){if(N=!1,$){var q=t.unstable_now();I=q;var W=!0;try{e:{v=!1,k&&(k=!1,A(L),L=-1),b=!0;var ie=g;try{t:{for(_(q),x=s(u);x!==null&&!(x.expirationTime>q&&z());){var he=x.callback;if(typeof he=="function"){x.callback=null,g=x.priorityLevel;var se=he(x.expirationTime<=q);if(q=t.unstable_now(),typeof se=="function"){x.callback=se,_(q),W=!0;break t}x===s(u)&&r(u),_(q)}else r(u);x=s(u)}if(x!==null)W=!0;else{var B=s(m);B!==null&&ne(T,B.startTime-q),W=!1}}break e}finally{x=null,g=ie,b=!1}W=void 0}}finally{W?U():$=!1}}}var U;if(typeof E=="function")U=function(){E(ae)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,P=Y.port2;Y.port1.onmessage=ae,U=function(){P.postMessage(null)}}else U=function(){S(ae,0)};function ne(q,W){L=S(function(){q(t.unstable_now())},W)}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(q){q.callback=null},t.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<q?Math.floor(1e3/q):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(q){switch(g){case 1:case 2:case 3:var W=3;break;default:W=g}var ie=g;g=W;try{return q()}finally{g=ie}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(q,W){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ie=g;g=q;try{return W()}finally{g=ie}},t.unstable_scheduleCallback=function(q,W,ie){var he=t.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?he+ie:he):ie=he,q){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=ie+se,q={id:p++,callback:W,priorityLevel:q,startTime:ie,expirationTime:se,sortIndex:-1},ie>he?(q.sortIndex=ie,e(m,q),s(u)===null&&q===s(m)&&(k?(A(L),L=-1):k=!0,ne(T,ie-he))):(q.sortIndex=se,e(u,q),v||b||(v=!0,$||($=!0,U()))),q},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(q){var W=g;return function(){var ie=g;g=W;try{return q.apply(this,arguments)}finally{g=ie}}}})(q0)),q0}var UC;function YI(){return UC||(UC=1,H0.exports=KI()),H0.exports}var W0={exports:{}},ct={};var HC;function QI(){if(HC)return ct;HC=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),g=Symbol.iterator;function b(B){return B===null||typeof B!="object"?null:(B=g&&B[g]||B["@@iterator"],typeof B=="function"?B:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,N={};function S(B,le,pe){this.props=B,this.context=le,this.refs=N,this.updater=pe||v}S.prototype.isReactComponent={},S.prototype.setState=function(B,le){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,le,"setState")},S.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function A(){}A.prototype=S.prototype;function E(B,le,pe){this.props=B,this.context=le,this.refs=N,this.updater=pe||v}var _=E.prototype=new A;_.constructor=E,k(_,S.prototype),_.isPureReactComponent=!0;var T=Array.isArray;function $(){}var L={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function I(B,le,pe){var Oe=pe.ref;return{$$typeof:t,type:B,key:le,ref:Oe!==void 0?Oe:null,props:pe}}function z(B,le){return I(B.type,le,B.props)}function ae(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function U(B){var le={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(pe){return le[pe]})}var Y=/\/+/g;function P(B,le){return typeof B=="object"&&B!==null&&B.key!=null?U(""+B.key):le.toString(36)}function ne(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then($,$):(B.status="pending",B.then(function(le){B.status==="pending"&&(B.status="fulfilled",B.value=le)},function(le){B.status==="pending"&&(B.status="rejected",B.reason=le)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function q(B,le,pe,Oe,Se){var D=typeof B;(D==="undefined"||D==="boolean")&&(B=null);var V=!1;if(B===null)V=!0;else switch(D){case"bigint":case"string":case"number":V=!0;break;case"object":switch(B.$$typeof){case t:case e:V=!0;break;case p:return V=B._init,q(V(B._payload),le,pe,Oe,Se)}}if(V)return Se=Se(B),V=Oe===""?"."+P(B,0):Oe,T(Se)?(pe="",V!=null&&(pe=V.replace(Y,"$&/")+"/"),q(Se,le,pe,"",function(Me){return Me}
vendor: 11,441 bytes, line 1
1)):Se!=null&&(ae(Se)&&(Se=z(Se,pe+(Se.key==null||B&&B.key===Se.key?"":(""+Se.key).replace(Y,"$&/")+"/")+V)),le.push(Se)),1;V=0;var ge=Oe===""?".":Oe+":";if(T(B))for(var ue=0;ue<B.length;ue++)Oe=B[ue],D=ge+P(Oe,ue),V+=q(Oe,le,pe,D,Se);else if(ue=b(B),typeof ue=="function")for(B=ue.call(B),ue=0;!(Oe=B.next()).done;)Oe=Oe.value,D=ge+P(Oe,ue++),V+=q(Oe,le,pe,D,Se);else if(D==="object"){if(typeof B.then=="function")return q(ne(B),le,pe,Oe,Se);throw le=String(B),Error("Objects are not valid as a React child (found: "+(le==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":le)+"). If you meant to render a collection of children, use an array instead.")}return V}function W(B,le,pe){if(B==null)return B;var Oe=[],Se=0;return q(B,Oe,"","",function(D){return le.call(pe,D,Se++)}),Oe}function ie(B){if(B._status===-1){var le=B._result;le=le(),le.then(function(pe){(B._status===0||B._status===-1)&&(B._status=1,B._result=pe)},function(pe){(B._status===0||B._status===-1)&&(B._status=2,B._result=pe)}),B._status===-1&&(B._status=0,B._result=le)}if(B._status===1)return B._result.default;throw B._result}var he=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var le=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(le))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},se={map:W,forEach:function(B,le,pe){W(B,function(){le.apply(this,arguments)},pe)},count:function(B){var le=0;return W(B,function(){le++}),le},toArray:function(B){return W(B,function(le){return le})||[]},only:function(B){if(!ae(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return ct.Activity=x,ct.Children=se,ct.Component=S,ct.Fragment=s,ct.Profiler=i,ct.PureComponent=E,ct.StrictMode=r,ct.Suspense=u,ct.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,ct.__COMPILER_RUNTIME={__proto__:null,c:function(B){return L.H.useMemoCache(B)}},ct.cache=function(B){return function(){return B.apply(null,arguments)}},ct.cacheSignal=function(){return null},ct.cloneElement=function(B,le,pe){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var Oe=k({},B.props),Se=B.key;if(le!=null)for(D in le.key!==void 0&&(Se=""+le.key),le)!M.call(le,D)||D==="key"||D==="__self"||D==="__source"||D==="ref"&&le.ref===void 0||(Oe[D]=le[D]);var D=arguments.length-2;if(D===1)Oe.children=pe;else if(1<D){for(var V=Array(D),ge=0;ge<D;ge++)V[ge]=arguments[ge+2];Oe.children=V}return I(B.type,Se,Oe)},ct.createContext=function(B){return B={$$typeof:l,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:a,_context:B},B},ct.createElement=function(B,le,pe){var Oe,Se={},D=null;if(le!=null)for(Oe in le.key!==void 0&&(D=""+le.key),le)M.call(le,Oe)&&Oe!=="key"&&Oe!=="__self"&&Oe!=="__source"&&(Se[Oe]=le[Oe]);var V=arguments.length-2;if(V===1)Se.children=pe;else if(1<V){for(var ge=Array(V),ue=0;ue<V;ue++)ge[ue]=arguments[ue+2];Se.children=ge}if(B&&B.defaultProps)for(Oe in V=B.defaultProps,V)Se[Oe]===void 0&&(Se[Oe]=V[Oe]);return I(B,D,Se)},ct.createRef=function(){return{current:null}},ct.forwardRef=function(B){return{$$typeof:d,render:B}},ct.isValidElement=ae,ct.lazy=function(B){return{$$typeof:p,_payload:{_status:-1,_result:B},_init:ie}},ct.memo=function(B,le){return{$$typeof:m,type:B,compare:le===void 0?null:le}},ct.startTransition=function(B){var le=L.T,pe={};L.T=pe;try{var Oe=B(),Se=L.S;Se!==null&&Se(pe,Oe),typeof Oe=="object"&&Oe!==null&&typeof Oe.then=="function"&&Oe.then($,he)}catch(D){he(D)}finally{le!==null&&pe.types!==null&&(le.types=pe.types),L.T=le}},ct.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},ct.use=function(B){return L.H.use(B)},ct.useActionState=function(B,le,pe){return L.H.useActionState(B,le,pe)},ct.useCallback=function(B,le){return L.H.useCallback(B,le)},ct.useContext=function(B){return L.H.useContext(B)},ct.useDebugValue=function(){},ct.useDeferredValue=function(B,le){return L.H.useDeferredValue(B,le)},ct.useEffect=function(B,le){return L.H.useEffect(B,le)},ct.useEffectEvent=function(B){return L.H.useEffectEvent(B)},ct.useId=function(){return L.H.useId()},ct.useImperativeHandle=function(B,le,pe){return L.H.useImperativeHandle(B,le,pe)},ct.useInsertionEffect=function(B,le){return L.H.useInsertionEffect(B,le)},ct.useLayoutEffect=function(B,le){return L.H.useLayoutEffect(B,le)},ct.useMemo=function(B,le){return L.H.useMemo(B,le)},ct.useOptimistic=function(B,le){return L.H.useOptimistic(B,le)},ct.useReducer=function(B,le,pe){return L.H.useReducer(B,le,pe)},ct.useRef=function(B){return L.H.useRef(B)},ct.useState=function(B){return L.H.useState(B)},ct.useSyncExternalStore=function(B,le,pe){return L.H.useSyncExternalStore(B,le,pe)},ct.useTransition=function(){return L.H.useTransition()},ct.version="19.2.5",ct}var qC;function Qm(){return qC||(qC=1,W0.exports=QI()),W0.exports}var G0={exports:{}},Dn={};var WC;function JI(){if(WC)return Dn;WC=1;var t=Qm();function e(u){var m="https://react.dev/errors/"+u;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)m+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+u+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={d:{f:s,r:function(){throw Error(e(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},i=Symbol.for("react.portal");function a(u,m,p){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:x==null?null:""+x,children:u,containerInfo:m,implementation:p}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(u,m){if(u==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Dn.createPortal=function(u,m){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(e(299));return a(u,m,null,p)},Dn.flushSync=function(u){var m=l.T,p=r.p;try{if(l.T=null,r.p=2,u)return u()}finally{l.T=m,r.p=p,r.d.f()}},Dn.preconnect=function(u,m){typeof u=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(u,m))},Dn.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},Dn.preinit=function(u,m){if(typeof u=="string"&&m&&typeof m.as=="string"){var p=m.as,x=d(p,m.crossOrigin),g=typeof m.integrity=="string"?m.integrity:void 0,b=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;p==="style"?r.d.S(u,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:x,integrity:g,fetchPriority:b}):p==="script"&&r.d.X(u,{crossOrigin:x,integrity:g,fetchPriority:b,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Dn.preinitModule=function(u,m){if(typeof u=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var p=d(m.as,m.crossOrigin);r.d.M(u,{crossOrigin:p,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(u)},Dn.preload=function(u,m){if(typeof u=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var p=m.as,x=d(p,m.crossOrigin);r.d.L(u,p,{crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Dn.preloadModule=function(u,m){if(typeof u=="string")if(m){var p=d(m.as,m.crossOrigin);r.d.m(u,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:p,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(u)},Dn.requestFormReset=function(u){r.d.r(u)},Dn.unstable_batchedUpdates=function(u,m){return u(m)},Dn.useFormState=function(u,m,p){return l.H.useFormState(u,m,p)},Dn.useFormStatus=function(){return l.H.useHostTransitionStatus()},Dn.version="19.2.5",Dn}var GC;function $E(){if(GC)return G0.exports;GC=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),G0.exports=JI(),G0.exports}var KC;function XI(){if(KC)return Eh;KC=1;var t=YI(),e=Qm(),s=$E();function r(o){var c="https://react.dev/errors/"+o;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)c+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+o+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function a(o){var c=o,h=o;if(o.alternate)for(;c.return;)c=c.return;else{o=c;do c=o,(c.flags&4098)!==0&&(h=c.return),o=c.return;while(o)}return c.tag===3?h:null}function l(o){if(o.tag===13){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function d(o){if(o.tag===31){var c=o.memoizedState;if(c===null&&(o=o.alternate,o!==null&&(c=o.memoizedState)),c!==null)return c.dehydrated}return null}function u(o){if(a(o)!==o)throw Error(r(188))}function m(o){var c=o.alternate;if(!c){if(c=a(o),c===null)throw Error(r(188));return c!==o?null:o}for(var h=o,f=c;;){var y=h.return;if(y===null)break;var w=y.alternate;if(w===null){if(f=y.return,f!==null){h=f;continue}break}if(y.child===w.child){for(w=y.child;w;){if(w===h)return u(y),o;if(w===f)return u(y),c;w=w.sibling}throw Error(r(188))}if(h.return!==f.return)h=y,f=w;else{for(var C=!1,O=y.child;O;){if(O===h){C=!0,h=y,f=w;break}if(O===f){C=!0,f=y,h=w;break}O=O.sibling}if(!C){for(O=w.child;O;){if(O===h){C=!0,h=w,f=y;break}if(O===f){C=!0,f=w,h=y;break}O=O.sibling}if(!C)throw Error(r(189))}}if(h.alternate!==f)throw Error(r(190))}if(h.tag!==3)throw Error(r(188));return h.stateNode.current===h?o:c}function p(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o;for(o=o.child;o!==null;){if(c=p(o),c!==null)return c;o=o.sibling}return null}var x=Object.assign,g=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),E=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function U(o){return o===null||typeof o!="object"?null:(o=ae&&o[ae]||o["@@iterator"],typeof o=="function"?o:null)}var Y=Symbol.for("react.client.reference");function P(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===Y?null:o.displayName||o.name||null;
vendor: 11,653 bytes, lines 1-8
1if(typeof o=="string")return o;switch(o){case k:return"Fragment";case S:return"Profiler";case N:return"StrictMode";case T:return"Suspense";case $:return"SuspenseList";case I:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case v:return"Portal";case E:return o.displayName||"Context";case A:return(o._context.displayName||"Context")+".Consumer";case _:var c=o.render;return o=o.displayName,o||(o=c.displayName||c.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case L:return c=o.displayName||null,c!==null?c:P(o.type)||"Memo";case M:c=o._payload,o=o._init;try{return P(o(c))}catch{}}return null}var ne=Array.isArray,q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},he=[],se=-1;function B(o){return{current:o}}function le(o){0>se||(o.current=he[se],he[se]=null,se--)}function pe(o,c){se++,he[se]=o.current,o.current=c}var Oe=B(null),Se=B(null),D=B(null),V=B(null);function ge(o,c){switch(pe(D,c),pe(Se,o),pe(Oe,null),c.nodeType){case 9:case 11:o=(o=c.documentElement)&&(o=o.namespaceURI)?cC(o):0;break;default:if(o=c.tagName,c=c.namespaceURI)c=cC(c),o=dC(c,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}le(Oe),pe(Oe,o)}function ue(){le(Oe),le(Se),le(D)}function Me(o){o.memoizedState!==null&&pe(V,o);var c=Oe.current,h=dC(c,o.type);c!==h&&(pe(Se,o),pe(Oe,h))}function We(o){Se.current===o&&(le(Oe),le(Se)),V.current===o&&(le(V),Nh._currentValue=ie)}var _e,Re;function ze(o){if(_e===void 0)try{throw Error()}catch(h){var c=h.stack.trim().match(/\n( *(at )?)/);_e=c&&c[1]||"",Re=-1<h.stack.indexOf(`
2    at`)?" (<anonymous>)":-1<h.stack.indexOf("@")?"@unknown:0:0":""}return`
3`+_e+o+Re}var Fe=!1;function Kt(o,c){if(!o||Fe)return"";Fe=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(c){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(de){var re=de}Reflect.construct(o,[],ye)}else{try{ye.call()}catch(de){re=de}o.call(ye.prototype)}}else{try{throw Error()}catch(de){re=de}(ye=o())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(de){if(de&&re&&typeof de.stack=="string")return[de.stack,re.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=f.DetermineComponentFrameRoot(),C=w[0],O=w[1];if(C&&O){var H=C.split(`
4`),te=O.split(`
5`);for(y=f=0;f<H.length&&!H[f].includes("DetermineComponentFrameRoot");)f++;for(;y<te.length&&!te[y].includes("DetermineComponentFrameRoot");)y++;if(f===H.length||y===te.length)for(f=H.length-1,y=te.length-1;1<=f&&0<=y&&H[f]!==te[y];)y--;for(;1<=f&&0<=y;f--,y--)if(H[f]!==te[y]){if(f!==1||y!==1)do if(f--,y--,0>y||H[f]!==te[y]){var me=`
6`+H[f].replace(" at new "," at ");return o.displayName&&me.includes("<anonymous>")&&(me=me.replace("<anonymous>",o.displayName)),me}while(1<=f&&0<=y);break}}}finally{Fe=!1,Error.prepareStackTrace=h}return(h=o?o.displayName||o.name:"")?ze(h):""}function us(o,c){switch(o.tag){case 26:case 27:case 5:return ze(o.type);case 16:return ze("Lazy");case 13:return o.child!==c&&c!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return Kt(o.type,!1);case 11:return Kt(o.type.render,!1);case 1:return Kt(o.type,!0);case 31:return ze("Activity");default:return""}}function ht(o){try{var c="",h=null;do c+=us(o,h),h=o,o=o.return;while(o);return c}catch(f){return`
7Error generating stack: `+f.message+`
8`+f.stack}}var is=Object.prototype.hasOwnProperty,Yt=t.unstable_scheduleCallback,un=t.unstable_cancelCallback,Di=t.unstable_shouldYield,Il=t.unstable_requestPaint,js=t.unstable_now,Pi=t.unstable_getCurrentPriorityLevel,nr=t.unstable_ImmediatePriority,Tn=t.unstable_UserBlockingPriority,xr=t.unstable_NormalPriority,Ll=t.unstable_LowPriority,pa=t.unstable_IdlePriority,Ii=t.log,Vn=t.unstable_setDisableYieldValue,Ks=null,we=null;function Rs(o){if(typeof Ii=="function"&&Vn(o),we&&typeof we.setStrictMode=="function")try{we.setStrictMode(Ks,o)}catch{}}var Zt=Math.clz32?Math.clz32:Pu,$l=Math.log,fa=Math.LN2;function Pu(o){return o>>>=0,o===0?32:31-($l(o)/fa|0)|0}var Li=256,gr=262144,hs=4194304;function Ys(o){var c=o&42;if(c!==0)return c;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function $r(o,c,h){var f=o.pendingLanes;if(f===0)return 0;var y=0,w=o.suspendedLanes,C=o.pingedLanes;o=o.warmLanes;var O=f&134217727;return O!==0?(f=O&~w,f!==0?y=Ys(f):(C&=O,C!==0?y=Ys(C):h||(h=O&~o,h!==0&&(y=Ys(h))))):(O=f&~w,O!==0?y=Ys(O):C!==0?y=Ys(C):h||(h=f&~o,h!==0&&(y=Ys(h)))),y===0?0:c!==0&&c!==y&&(c&w)===0&&(w=y&-y,h=c&-c,w>=h||w===32&&(h&4194048)!==0)?c:y}function xa(o,c){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&c)===0}function Qt(o,c){switch(o){case 1:case 2:case 4:case 8:case 64:return c+250;case 16:case 32: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 c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Br(){var o=hs;return hs<<=1,(hs&62914560)===0&&(hs=4194304),o}function go(o){for(var c=[],h=0;31>h;h++)c.push(o);return c}function hi(o,c){o.pendingLanes|=c,c!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function bo(o,c,h,f,y,w){var C=o.pendingLanes;o.pendingLanes=h,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=h,o.entangledLanes&=h,o.errorRecoveryDisabledLanes&=h,o.shellSuspendCounter=0;var O=o.entanglements,H=o.expirationTimes,te=o.hiddenUpdates;for(h=C&~h;0<h;){var me=31-Zt(h),ye=1<<me;O[me]=0,H[me]=-1;var re=te[me];if(re!==null)for(te[me]=null,me=0;me<re.length;me++){var de=re[me];de!==null&&(de.lane&=-536870913)}h&=~ye}f!==0&&yo(o,f,0),w!==0&&y===0&&o.tag!==0&&(o.suspendedLanes|=w&~(C&~c))}function yo(o,c,h){o.pendingLanes|=c,o.suspendedLanes&=~c;var f=31-Zt(c);o.entangledLanes|=c,o.entanglements[f]=o.entanglements[f]|1073741824|h&261930}function vo(o,c){var h=o.entangledLanes|=c;for(o=o.entanglements;h;){var f=31-Zt(h),y=1<<f;y&c|o[f]&c&&(o[f]|=c),h&=~y}}function Bl(o,c){var h=c&-c;return h=(h&42)!==0?1:nn(h),(h&(o.suspendedLanes|c))!==0?0:h}function nn(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function rr(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function Fn(){var o=W.p;return o!==0?o:(o=window.event,o===void 0?32:RC(o.type))}function hn(o,c){var h=W.p;try{return W.p=o,c()}finally{W.p=h}}var Un=Math.random().toString(36).slice(2),ms="__reactFiber$"+Un,Jt="__reactProps$"+Un,En="__reactContainer$"+Un,ps="__reactEvents$"+Un,$i="__reactListeners$"+Un,zl="__reactHandles$"+Un,ga="__reactResources$"+Un,rn="__reactMarker$"+Un;function Ue(o){delete o[ms],delete o[Jt],delete o[ps],delete o[$i],delete o[zl]}function F(o){var c=o[ms];if(c)return c;for(var h=o.parentNode;h;){if(c=h[En]||h[ms]){if(h=c.alternate,c.child!==null||h!==null&&h.child!==null)for(o=gC(o);o!==null;){if(h=o[ms])return h;o=gC(o)}return c}o=h,h=o.parentNode}return null}function fe(o){if(o=o[ms]||o[En]){var c=o.tag;if(c===5||c===6||c===13||c===31||c===26||c===27||c===3)return o}return null}function Ie(o){var c=o.tag;if(c===5||c===26||c===27||c===6)return o.stateNode;throw Error(r(33))}function Et(o){var c=o[ga];return c||(c=o[ga]={hoistableStyles:new Map,hoistableScripts:new Map}),c}function lt(o){o[rn]=!0}var as=new Set,fs={};function Ut(o,c){Ds(o,c),Ds(o+"Capture",c)}function Ds(o,c){for(fs[o]=c,o=0;o<c.length;o++)as.add(c[o])}var wo=RegExp("^[: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]*$"),xs={},ba={};function nd(o){return is.call(ba,o)?!0:is.call(xs,o)?!1:wo.test(o)?ba[o]=!0:(xs[o]=!0,!1)}function jo(o,c,h){if(nd(c))if(h===null)o.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":o.removeAttribute(c);return;case"boolean":var f=c.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){o.removeAttribute(c);return}}o.setAttribute(c,""+h)}}function Vl(o,c,h){if(h===null)o.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(c);return}o.setAttribute(c,""+h)}}function mi(o,c,h,f){if(f===null)o.removeAttribute(h);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(h);return}o.setAttributeNS(c,h,""+f)}}function br(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function xp(o){var c=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function gp(o,c,h){var f=Object.getOwnPropertyDescriptor(o.constructor.prototype,c);if(!o.hasOwnProperty(c)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var y=f.get,w=f.set;return Object.defineProperty(o,c,{configurable:!0,get:function(){return y.call(this)},set:function(C){h=""+C,w.call(this,C)}}),Object.defineProperty(o,c,{enumerable:f.enumerable}),{getValue:function(){return h},setValue:function(C){h=""+C},stopTracking:function(){o._valueTracker=null,delete o[c]}}}}function Bi(o){if(!o._valueTracker){var c=xp(o)?"checked":"value";o._valueTracker=gp(o,c,""+o[c])}}function bp(o){if(!o)return!1;var c=o._valueTracker;if(!c)return!0;var h=c.getValue(),f="";return o&&(f=xp(o)?o.checked?"true":"false":o.value),o=f,o!==h?(c.setValue(o),!0):!1}function ya(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var Iu=/[\n"\\]/g;function An(o){return o.replace(Iu,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function zi(o,c,h,f,y,w,C,O){o.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?o.type=C:o.removeAttribute("type"),c!=null?C==="number"?(c===0&&o.value===""||o.value!=c)&&(o.value=""+br(c)):o.value!==""+br(c)&&(o.value=""+br(c)):C!=="submit"&&C!=="reset"||o.removeAttribute("value"),c!=null?Fl(o,C,br(c)):h!=null?Fl(o,C,br(h)):f!=null&&o.removeAttribute("value"),y==null&&w!=null&&(o.defaultChecked=!!w),y!=null&&(o.checked=y&&t
vendor: 5,691 bytes, line 8
8ypeof y!="function"&&typeof y!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?o.name=""+br(O):o.removeAttribute("name")}function va(o,c,h,f,y,w,C,O){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.type=w),c!=null||h!=null){if(!(w!=="submit"&&w!=="reset"||c!=null)){Bi(o);return}h=h!=null?""+br(h):"",c=c!=null?""+br(c):h,O||c===o.value||(o.value=c),o.defaultValue=c}f=f??y,f=typeof f!="function"&&typeof f!="symbol"&&!!f,o.checked=O?o.checked:!!f,o.defaultChecked=!!f,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(o.name=C),Bi(o)}function Fl(o,c,h){c==="number"&&ya(o.ownerDocument)===o||o.defaultValue===""+h||(o.defaultValue=""+h)}function wa(o,c,h,f){if(o=o.options,c){c={};for(var y=0;y<h.length;y++)c["$"+h[y]]=!0;for(h=0;h<o.length;h++)y=c.hasOwnProperty("$"+o[h].value),o[h].selected!==y&&(o[h].selected=y),y&&f&&(o[h].defaultSelected=!0)}else{for(h=""+br(h),c=null,y=0;y<o.length;y++){if(o[y].value===h){o[y].selected=!0,f&&(o[y].defaultSelected=!0);return}c!==null||o[y].disabled||(c=o[y])}c!==null&&(c.selected=!0)}}function Fb(o,c,h){if(c!=null&&(c=""+br(c),c!==o.value&&(o.value=c),h==null)){o.defaultValue!==c&&(o.defaultValue=c);return}o.defaultValue=h!=null?""+br(h):""}function rd(o,c,h,f){if(c==null){if(f!=null){if(h!=null)throw Error(r(92));if(ne(f)){if(1<f.length)throw Error(r(93));f=f[0]}h=f}h==null&&(h=""),c=h}h=br(c),o.defaultValue=h,f=o.textContent,f===h&&f!==""&&f!==null&&(o.value=f),Bi(o)}function zr(o,c){if(c){var h=o.firstChild;if(h&&h===o.lastChild&&h.nodeType===3){h.nodeValue=c;return}}o.textContent=c}var yp=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function vp(o,c,h){var f=c.indexOf("--")===0;h==null||typeof h=="boolean"||h===""?f?o.setProperty(c,""):c==="float"?o.cssFloat="":o[c]="":f?o.setProperty(c,h):typeof h!="number"||h===0||yp.has(c)?c==="float"?o.cssFloat=h:o[c]=(""+h).trim():o[c]=h+"px"}function Ul(o,c,h){if(c!=null&&typeof c!="object")throw Error(r(62));if(o=o.style,h!=null){for(var f in h)!h.hasOwnProperty(f)||c!=null&&c.hasOwnProperty(f)||(f.indexOf("--")===0?o.setProperty(f,""):f==="float"?o.cssFloat="":o[f]="");for(var y in c)f=c[y],c.hasOwnProperty(y)&&h[y]!==f&&vp(o,y,f)}else for(var w in c)c.hasOwnProperty(w)&&vp(o,w,c[w])}function Lu(o){if(o.indexOf("-")===-1)return!1;switch(o){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 $u=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode
8-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Ub=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Vi(o){return Ub.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Mn(){}var ja=null;function id(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Na=null,ka=null;function Sa(o){var c=fe(o);if(c&&(o=c.stateNode)){var h=o[Jt]||null;e:switch(o=c.stateNode,c.type){case"input":if(zi(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name),c=h.name,h.type==="radio"&&c!=null){for(h=o;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll('input[name="'+An(""+c)+'"][type="radio"]'),c=0;c<h.length;c++){var f=h[c];if(f!==o&&f.form===o.form){var y=f[Jt]||null;if(!y)throw Error(r(90));zi(f,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(c=0;c<h.length;c++)f=h[c],f.form===o.form&&bp(f)}break e;case"textarea":Fb(o,h.value,h.defaultValue);break e;case"select":c=h.value,c!=null&&wa(o,!!h.multiple,c,!1)}}}var ad=!1;function Hl(o,c,h){if(ad)return o(c,h);ad=!0;try{var f=o(c);return f}finally{if(ad=!1,(Na!==null||ka!==null)&&(lf(),Na&&(c=Na,o=ka,ka=Na=null,Sa(c),o)))for(c=0;c<o.length;c++)Sa(o[c])}}function ql(o,c){var h=o.stateNode;if(h===null)return null;var f=h[Jt]||null;if(f===null)return null;h=f[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(o=o.type,f=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!f;break e;default:o=!1}if(o)return null;if(h&&typeof h!="function")throw Error(r(231,c,typeof h));return h}var Vr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wl=!1;if(Vr)try{var Ca={};Object.defineProperty(Ca,"passive",{get:function(){Wl=!0}}),window.addEventListener("test",Ca,Ca),window.removeEventListener("test",Ca,Ca)}catch{Wl=!1}var pi=null,Fi=null,_n=null;function wp(){if(_n)return _n;var o,c=Fi,h=c.length,f,y="value"in pi?pi.value:pi.textContent,w=y.length;for(o=0;o<h&&c[o]===y[o];o++);var C=h-o;for(f=1;f<=C&&c[h-f]===y[w-f];f++);return _n=y.slice(o,1<f?1-f:void 0)}function Gl(o){var c=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&c===13&&(o=13)):o=c,o===10&&(o=13),32<=o||o===13?o:0}function od(){return!0}function Bu(){return!1}function an(o){function c(h,f,y,w,C){this._reactName=h,this._targetInst=y,this.type=f,this.nativeEvent=w,this.target=C,this.currentTarget=null;for(var O in o)o.hasOwnProperty(O)&&(h=o[O],this[O]=h?h(w):w[O]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?od:Bu,this.isPropagationStopped=Bu,this}return x(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=od)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=od)},persist:function(){},isPersistent:od}),c}var Ta={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ld=an(Ta),Ea=x({},Ta,{view:0,detail:0}),Hb=an(Ea),zu,cd,Kl,Yl=x({},Ea,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ve,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Kl&&(Kl&&o.type==="mousemove"?(zu=o.screenX-Kl.screenX,cd=o.screenY-Kl.screenY):cd=zu=0,Kl=o),zu)},movementY:function(o){return"movementY"in o?o.movementY:cd}}),jp=an(Yl),On=x({},Yl,{dataTransfer:0}),No=an(On),Vu=x({},Ea,{relatedTarget:0}),Ui=an(Vu),Fu=x({},Ta,{animationName:0,elapsedTime:0,pseudoElement:0}),qb=an(Fu),Wb=x({},Ta,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),Np=an(Wb),kp=x({},Ta,{data:0}),Sp=an(kp),R={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},be={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"},ce={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function J(o){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(o):(o=ce[o])?!!c[o]:!1}function ve(){return J}var X=x({}
vendor: 5,269 bytes, line 8
8,Ea,{key:function(o){if(o.key){var c=R[o.key]||o.key;if(c!=="Unidentified")return c}return o.type==="keypress"?(o=Gl(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?be[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ve,charCode:function(o){return o.type==="keypress"?Gl(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Gl(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),Ee=an(X),De=x({},Yl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rt=an(De),oe=x({},Ea,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ve}),kt=an(oe),Xt=x({},Ta,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fr=an(Xt),Hn=x({},Yl,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),ko=an(Hn),Rn=x({},Ta,{newState:0,oldState:0}),Gb=an(Rn),Kb=[9,13,27,32],Uu=Vr&&"CompositionEvent"in window,Hu=null;Vr&&"documentMode"in document&&(Hu=document.documentMode);var pP=Vr&&"TextEvent"in window&&!Hu,fk=Vr&&(!Uu||Hu&&8<Hu&&11>=Hu),xk=" ",gk=!1;function bk(o,c){switch(o){case"keyup":return Kb.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yk(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var dd=!1;function fP(o,c){switch(o){case"compositionend":return yk(c);case"keypress":return c.which!==32?null:(gk=!0,xk);case"textInput":return o=c.data,o===xk&&gk?null:o;default:return null}}function xP(o,c){if(dd)return o==="compositionend"||!Uu&&bk(o,c)?(o=wp(),_n=Fi=pi=null,dd=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return fk&&c.locale!=="ko"?null:c.data;default:return null}}var gP={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 vk(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c==="input"?!!gP[o.type]:c==="textarea"}function wk(o,c,h,f){Na?ka?ka.push(f):ka=[f]:Na=f,c=ff(c,"onChange"),0<c.length&&(h=new ld("onChange","change",null,h,f),o.push({event:h,listeners:c}))}var qu=null,Wu=null;function bP(o){nC(o,0)}function Cp(o){var c=Ie(o);if(bp(c))return o}function jk(o,c){if(o==="change")return c}var Nk=!1;if(Vr){var Yb;if(Vr){var Qb="oninput"in document;if(!Qb){var kk=document.createElement("div");kk.setAttribute("oninput","return;"),Qb=typeof kk.oninput=="function"}Yb=Qb}else Yb=!1;Nk=Yb&&(!document.documentMode||9<document.documentMode)}function Sk(){qu&&(qu.detachEvent("onpropertychange",Ck),Wu=qu=null)}function Ck(o){if(o.propertyName==="value"&&Cp(Wu)){var c=[];wk(c,Wu,o,id(o)),Hl(bP,c)}}function yP(o,c,h){o==="focusin"?(Sk(),qu=c,Wu=h,qu.attachEvent("onpropertychange",Ck)):o==="focusout"&&Sk()}function vP(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Cp(Wu)}function wP(o,c){if(o==="click")return Cp(c)}function jP(o,c){if(o==="input"||o==="change")return Cp(c)}function NP(o,c){return o===c&&(o!==0||1/o===1/c)||o!==o&&c!==c}var yr=typeof Object.is=="function"?Object.is:NP;function Gu(o,c){if(yr(o,c))return!0;if(typeof o!="object"||o===null||typeof c!="object"||c===null)return!1;var h=Object.keys(o),f=Object.keys(c);if(h.length!==f.length)return!1;for(f=0;f<h.length;f++){var y=h[f];if(!is.call(c,y)||!yr(o[y],c[y]))return!1}return!0}function Tk(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Ek(o,c){var h=Tk(o);o=0;for(var f;h;){if(h.nodeType===3){if(f=o+h.textContent.length,o<=c&&f>=c)return{node:h,offset:c-o};o=f}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=Tk(h)}}function Ak(o,c){return o&&c?o===c?!0:o&&o.nodeType===3?!1:c&&c.nodeType===3?Ak(o,c.parentNode):"contains"in o?o.contains(c):o.compareDocumentPosition?!!(o.compareDocumentPosition(c)&16):!1:!1}function Mk(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var c=ya(o.document);c instanceof o.HTMLIFrameElement;){try{var h=typeof c.contentWindow.location.href=="string"}catch{h=!1}if(h)o=c.contentWindow;else break;c=ya(o.document)}return c}function Jb(o){var c=o&&o.nodeName&&o.nodeName.toLowerCase();return c&&(c==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||c==="textarea"||o.contentEditable==="true")}var kP=Vr&&"documentMode"in document&&11>=document.documentMode,ud=null,Xb=null,Ku=null,Zb=!1;function _k(o,c,h){var f=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Zb||ud==null||ud!==ya(f)||(f=ud,"selectionStart"in f&&Jb(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focu
vendor: 11,775 bytes, line 8
8sNode:f.focusNode,focusOffset:f.focusOffset}),Ku&&Gu(Ku,f)||(Ku=f,f=ff(Xb,"onSelect"),0<f.length&&(c=new ld("onSelect","select",null,c,h),o.push({event:c,listeners:f}),c.target=ud)))}function Ql(o,c){var h={};return h[o.toLowerCase()]=c.toLowerCase(),h["Webkit"+o]="webkit"+c,h["Moz"+o]="moz"+c,h}var hd={animationend:Ql("Animation","AnimationEnd"),animationiteration:Ql("Animation","AnimationIteration"),animationstart:Ql("Animation","AnimationStart"),transitionrun:Ql("Transition","TransitionRun"),transitionstart:Ql("Transition","TransitionStart"),transitioncancel:Ql("Transition","TransitionCancel"),transitionend:Ql("Transition","TransitionEnd")},ey={},Ok={};Vr&&(Ok=document.createElement("div").style,"AnimationEvent"in window||(delete hd.animationend.animation,delete hd.animationiteration.animation,delete hd.animationstart.animation),"TransitionEvent"in window||delete hd.transitionend.transition);function Jl(o){if(ey[o])return ey[o];if(!hd[o])return o;var c=hd[o],h;for(h in c)if(c.hasOwnProperty(h)&&h in Ok)return ey[o]=c[h];return o}var Rk=Jl("animationend"),Dk=Jl("animationiteration"),Pk=Jl("animationstart"),SP=Jl("transitionrun"),CP=Jl("transitionstart"),TP=Jl("transitioncancel"),Ik=Jl("transitionend"),Lk=new Map,ty="abort auxClick beforeToggle 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(" ");ty.push("scrollEnd");function fi(o,c){Lk.set(o,c),Ut(c,[o])}var Tp=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var c=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(c))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Ur=[],md=0,sy=0;function Ep(){for(var o=md,c=sy=md=0;c<o;){var h=Ur[c];Ur[c++]=null;var f=Ur[c];Ur[c++]=null;var y=Ur[c];Ur[c++]=null;var w=Ur[c];if(Ur[c++]=null,f!==null&&y!==null){var C=f.pending;C===null?y.next=y:(y.next=C.next,C.next=y),f.pending=y}w!==0&&$k(h,y,w)}}function Ap(o,c,h,f){Ur[md++]=o,Ur[md++]=c,Ur[md++]=h,Ur[md++]=f,sy|=f,o.lanes|=f,o=o.alternate,o!==null&&(o.lanes|=f)}function ny(o,c,h,f){return Ap(o,c,h,f),Mp(o)}function Xl(o,c){return Ap(o,null,null,c),Mp(o)}function $k(o,c,h){o.lanes|=h;var f=o.alternate;f!==null&&(f.lanes|=h);for(var y=!1,w=o.return;w!==null;)w.childLanes|=h,f=w.alternate,f!==null&&(f.childLanes|=h),w.tag===22&&(o=w.stateNode,o===null||o._visibility&1||(y=!0)),o=w,w=w.return;return o.tag===3?(w=o.stateNode,y&&c!==null&&(y=31-Zt(h),o=w.hiddenUpdates,f=o[y],f===null?o[y]=[c]:f.push(c),c.lane=h|536870912),w):null}function Mp(o){if(50<xh)throw xh=0,h0=null,Error(r(185));for(var c=o.return;c!==null;)o=c,c=o.return;return o.tag===3?o.stateNode:null}var pd={};function EP(o,c,h,f){this.tag=o,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vr(o,c,h,f){return new EP(o,c,h,f)}function ry(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Aa(o,c){var h=o.alternate;return h===null?(h=vr(o.tag,c,o.key,o.mode),h.elementType=o.elementType,h.type=o.type,h.stateNode=o.stateNode,h.alternate=o,o.alternate=h):(h.pendingProps=c,h.type=o.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=o.flags&65011712,h.childLanes=o.childLanes,h.lanes=o.lanes,h.child=o.child,h.memoizedProps=o.memoizedProps,h.memoizedState=o.memoizedState,h.updateQueue=o.updateQueue,c=o.dependencies,h.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},h.sibling=o.sibling,h.index=o.index,h.ref=o.ref,h.refCleanup=o.refCleanup,h}function Bk(o,c){o.flags&=65011714;var h=o.alternate;return h===null?(o.childLanes=0,o.lanes=c,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=h.childLanes,o.lanes=h.lanes,o.child=h.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=h.memoizedProps,o.memoizedState=h.memoizedState,o.updateQueue=h.updateQueue,o.type=h.type,c=h.dependencies,o.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),o}function _p(o,c,h,f,y,w){var C=0;if(f=o,typeof o=="function")ry(o)&&(C=1);else if(typeof o=="string")C=RI(o,h,Oe.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case I:return o=vr(31,h,c,y),o.elementType=I,o.lanes=w,o;case k:return Zl(h.children,y,w,c);case N:C=8,y|=24;break;case S:return o=vr(12,h,c,y|2),o.elementType=S,o.lanes=w,o;case T:return o=vr(13,h,c,y),o.elementType=T,o.lanes=w,o;case $:return o=vr(19,h,c,y),o.elementType=$,o.lanes=w,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case E:C=10;break e;case A:C=9;break e;case _:C=11;break e;case L:C=14;break e;case M:C=16,f=null;break e}C=29,h=Error(r(130,o===null?"null":typeof o,"")),f=null}return c=vr(C,h,c,y),c.elementType=o,c.type=f,c.lanes=w,c}function Zl(o,c,h,f){return o=vr(7,o,f,c),o.lanes=h,o}function iy(o,c,h){return o=vr(6,o,null,c),o.lanes=h,o}function zk(o){var c=vr(18,null,null,0);return c.stateNode=o,c}function ay(o,c,h){return c=vr(4,o.children!==null?o.children:[],o.key,c),c.lanes=h,c.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},c}var Vk=new WeakMap;function Hr(o,c){if(typeof o=="object"&&o!==null){var h=Vk.get(o);return h!==void 0?h:(c={value:o,source:c,stack:ht(c)},Vk.set(o,c),c)}return{value:o,source:c,stack:ht(c)}}var fd=[],xd=0,Op=null,Yu=0,qr=[],Wr=0,So=null,Hi=1,qi="";function Ma(o,c){fd[xd++]=Yu,fd[xd++]=Op,Op=o,Yu=c}function Fk(o,c,h){qr[Wr++]=Hi,qr[Wr++]=qi,qr[Wr++]=So,So=o;var f=Hi;o=qi;var y=32-Zt(f)-1;f&=~(1<<y),h+=1;var w=32-Zt(c)+y;if(30<w){var C=y-y%5;w=(f&(1<<C)-1).toString(32),f>>=C,y-=C,Hi=1<<32-Zt(c)+y|h<<y|f,qi=w+o}else Hi=1<<w|h<<y|f,qi=o}function oy(o){o.return!==null&&(Ma(o,1),Fk(o,1,0))}function ly(o){for(;o===Op;)Op=fd[--xd],fd[xd]=null,Yu=fd[--xd],fd[xd]=null;for(;o===So;)So=qr[--Wr],qr[Wr]=null,qi=qr[--Wr],qr[Wr]=null,Hi=qr[--Wr],qr[Wr]=null}function Uk(o,c){qr[Wr++]=Hi,qr[Wr++]=qi,qr[Wr++]=So,Hi=c.id,qi=c.overflow,So=o}var mn=null,es=null,At=!1,Co=null,Gr=!1,cy=Error(r(519));function To(o){var c=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Qu(Hr(c,o)),cy}function Hk(o){var c=o.stateNode,h=o.type,f=o.memoizedProps;switch(c[ms]=o,c[Jt]=f,h){case"dialog":Nt("cancel",c),Nt("close",c);break;case"iframe":case"object":case"embed":Nt("load",c);break;case"video":case"audio":for(h=0;h<bh.length;h++)Nt(bh[h],c);break;case"source":Nt("error",c);break;case"img":case"image":case"link":Nt("error",c),Nt("load",c);break;case"details":Nt("toggle",c);break;case"input":Nt("invalid",c),va(c,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Nt("invalid",c);break;case"textarea":Nt("invalid",c),rd(c,f.value,f.defaultValue,f.children)}h=f.children,typeof h!="string"&&typeof h!="number"&&typeof h!="bigint"||c.textContent===""+h||f.suppressHydrationWarning===!0||oC(c.textContent,h)?(f.popover!=null&&(Nt("beforetoggle",c),Nt("toggle",c)),f.onScroll!=null&&Nt("scroll",c),f.onScrollEnd!=null&&Nt("scrollend",c),f.onClick!=null&&(c.onclick=Mn),c=!0):c=!1,c||To(o,!0)}function qk(o){for(mn=o.return;mn;)switch(mn.tag){case 5:case 31:case 13:Gr=!1;return;case 27:case 3:Gr=!0;return;default:mn=mn.return}}function gd(o){if(o!==mn)return!1;if(!At)return qk(o),At=!0,!1;var c=o.tag,h;if((h=c!==3&&c!==27)&&((h=c===5)&&(h=o.type,h=!(h!=="form"&&h!=="button")||T0(o.type,o.memoizedProps)),h=!h),h&&es&&To(o),qk(o),c===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));es=xC(o)}else if(c===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));es=xC(o)}else c===27?(c=es,Vo(o.type)?(o=O0,O0=null,es=o):es=c):es=mn?Yr(o.stateNode.nextSibling):null;return!0}function ec(){es=mn=null,At=!1}function dy(){var o=Co;return o!==null&&(lr===null?lr=o:lr.push.apply(lr,o),Co=null),o}function Qu(o){Co===null?Co=[o]:Co.push(o)}var uy=B(null),tc=null,_a=null;function Eo(o,c,h){pe(uy,c._currentValue),c._currentValue=h}function Oa(o){o._currentValue=uy.current,le(uy)}function hy(o,c,h){for(;o!==null;){var f=o.alternate;if((o.childLanes&c)!==c?(o.childLanes|=c,f!==null&&(f.childLanes|=c)):f!==null&&(f.childLanes&c)!==c&&(f.childLanes|=c),o===h)break;o=o.return}}function my(o,c,h,f){var y=o.child;for(y!==null&&(y.return=o);y!==null;){var w=y.dependencies;if(w!==null){var C=y.child;w=w.firstContext;e:for(;w!==null;){var O=w;w=y;for(var H=0;H<c.length;H++)if(O.context===c[H]){w.lanes|=h,O=w.alternate,O!==null&&(O.lanes|=h),hy(w.return,h,o),f||(C=null);break e}w=O.next}}else if(y.tag===18){if(C=y.return,C===null)throw Error(r(341));C.lanes|=h,w=C.alternate,w!==null&&(w.lanes|=h),hy(C,h,o),C=null}else C=y.child;if(C!==null)C.return=y;else for(C=y;C!==null;){if(C===o){C=null;break}if(y=C.sibling,y!==null){y.return=C.return,C=y;break}C=C.return}y=C}}function bd(o,c,h,f){o=null;for(var y=c,w=!1;y!==null;){if(!w){if((y.flags&524288)!==0)w=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var C=y.alternate;if(C===null)throw Error(r(387));if(C=C.memoizedProps,C!==null){var O=y.type;yr(y.pendingProps.value,C.value)||(o!==null?o.push(O):o=[O])}}else if(y===V.current){if(C=y.alternate,C===null)throw Error(r(387));C.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(o!==null?o.push(Nh):o=[Nh])}y=y.return}o!==null&&my(c,o,h,f),c.flags|=262144}function Rp(o){for(o=o.firstContext;o!==null;){if(!yr(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function sc(o){tc=o,_a=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function pn(o){return Wk(tc,o)}function Dp(o,c){return tc===null&&sc(o),Wk(o,c)}function Wk(o,c){var h=c._currentValue;if(c={context:c,memoizedValue:h,next:null},_a===null){if(o===null)throw Error(r(308));_a=c,o.dependencies={lanes:0,firstContext:c},o.flags|=524288}else _a=_a.next=c;return h}var AP=typeof AbortController<"u"?AbortController:function(){var o=[],c=this.signal={aborted:!1,addEventListener:function(h,f){o.push(f)}};this.abort=function(){c.aborted=!0,o.forEach(function(h){return h()})}},MP=t.unstable_scheduleCallback,_P=t.unstable_NormalPriority,$s={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function py(){return{controller:new AP,data:new Map,refCount:0}}function Ju(o){o.refCount--,o.refCount===0&&MP(_P,function(){o.controller.abort()})}var Xu=null,fy=0,yd=0,vd=null;function OP(o,c){if(Xu===null){var h=Xu=[];fy=0,yd=b0(),vd={status:"pending",value:void 0,then:function(f){h.push(f)}}}return fy++,c.then(Gk,Gk),c}function Gk(){if(--fy===0&&Xu!==null){vd!==null&&(vd.status="fulfilled");var o=Xu;Xu=null,yd=0,vd=null;for(var c=0;c<o.length;c++)(0,o[c])()}}function RP(o,c){var h=[],f={status:"pending",value:null,reason:null,then:function(y){h.push(y)}};return o.then(function(){f.status="fulfilled",f.value=c;for(var y=0;
vendor: 10,721 bytes, line 8
8y<h.length;y++)(0,h[y])(c)},function(y){for(f.status="rejected",f.reason=y,y=0;y<h.length;y++)(0,h[y])(void 0)}),f}var Kk=q.S;q.S=function(o,c){_S=js(),typeof c=="object"&&c!==null&&typeof c.then=="function"&&OP(o,c),Kk!==null&&Kk(o,c)};var nc=B(null);function xy(){var o=nc.current;return o!==null?o:Ht.pooledCache}function Pp(o,c){c===null?pe(nc,nc.current):pe(nc,c.pool)}function Yk(){var o=xy();return o===null?null:{parent:$s._currentValue,pool:o}}var wd=Error(r(460)),gy=Error(r(474)),Ip=Error(r(542)),Lp={then:function(){}};function Qk(o){return o=o.status,o==="fulfilled"||o==="rejected"}function Jk(o,c,h){switch(h=o[h],h===void 0?o.push(c):h!==c&&(c.then(Mn,Mn),c=h),c.status){case"fulfilled":return c.value;case"rejected":throw o=c.reason,Zk(o),o;default:if(typeof c.status=="string")c.then(Mn,Mn);else{if(o=Ht,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=c,o.status="pending",o.then(function(f){if(c.status==="pending"){var y=c;y.status="fulfilled",y.value=f}},function(f){if(c.status==="pending"){var y=c;y.status="rejected",y.reason=f}})}switch(c.status){case"fulfilled":return c.value;case"rejected":throw o=c.reason,Zk(o),o}throw ic=c,wd}}function rc(o){try{var c=o._init;return c(o._payload)}catch(h){throw h!==null&&typeof h=="object"&&typeof h.then=="function"?(ic=h,wd):h}}var ic=null;function Xk(){if(ic===null)throw Error(r(459));var o=ic;return ic=null,o}function Zk(o){if(o===wd||o===Ip)throw Error(r(483))}var jd=null,Zu=0;function $p(o){var c=Zu;return Zu+=1,jd===null&&(jd=[]),Jk(jd,o,c)}function eh(o,c){c=c.props.ref,o.ref=c!==void 0?c:null}function Bp(o,c){throw c.$$typeof===g?Error(r(525)):(o=Object.prototype.toString.call(c),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":o)))}function e2(o){function c(Q,K){if(o){var ee=Q.deletions;ee===null?(Q.deletions=[K],Q.flags|=16):ee.push(K)}}function h(Q,K){if(!o)return null;for(;K!==null;)c(Q,K),K=K.sibling;return null}function f(Q){for(var K=new Map;Q!==null;)Q.key!==null?K.set(Q.key,Q):K.set(Q.index,Q),Q=Q.sibling;return K}function y(Q,K){return Q=Aa(Q,K),Q.index=0,Q.sibling=null,Q}function w(Q,K,ee){return Q.index=ee,o?(ee=Q.alternate,ee!==null?(ee=ee.index,ee<K?(Q.flags|=67108866,K):ee):(Q.flags|=67108866,K)):(Q.flags|=1048576,K)}function C(Q){return o&&Q.alternate===null&&(Q.flags|=67108866),Q}function O(Q,K,ee,xe){return K===null||K.tag!==6?(K=iy(ee,Q.mode,xe),K.return=Q,K):(K=y(K,ee),K.return=Q,K)}function H(Q,K,ee,xe){var Je=ee.type;return Je===k?me(Q,K,ee.props.children,xe,ee.key):K!==null&&(K.elementType===Je||typeof Je=="object"&&Je!==null&&Je.$$typeof===M&&rc(Je)===K.type)?(K=y(K,ee.props),eh(K,ee),K.return=Q,K):(K=_p(ee.type,ee.key,ee.props,null,Q.mode,xe),eh(K,ee),K.return=Q,K)}function te(Q,K,ee,xe){return K===null||K.tag!==4||K.stateNode.containerInfo!==ee.containerInfo||K.stateNode.implementation!==ee.implementation?(K=ay(ee,Q.mode,xe),K.return=Q,K):(K=y(K,ee.children||[]),K.return=Q,K)}function me(Q,K,ee,xe,Je){return K===null||K.tag!==7?(K=Zl(ee,Q.mode,xe,Je),K.return=Q,K):(K=y(K,ee),K.return=Q,K)}function ye(Q,K,ee){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=iy(""+K,Q.mode,ee),K.return=Q,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case b:return ee=_p(K.type,K.key,K.props,null,Q.mode,ee),eh(ee,K),ee.return=Q,ee;case v:return K=ay(K,Q.mode,ee),K.return=Q,K;case M:return K=rc(K),ye(Q,K,ee)}if(ne(K)||U(K))return K=Zl(K,Q.mode,ee,null),K.return=Q,K;if(typeof K.then=="function")return ye(Q,$p(K),ee);if(K.$$typeof===E)return ye(Q,Dp(Q,K),ee);Bp(Q,K)}return null}function re(Q,K,ee,xe){var Je=K!==null?K.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Je!==null?null:O(Q,K,""+ee,xe);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case b:return ee.key===Je?H(Q,K,ee,xe):null;case v:return ee.key===Je?te(Q,K,ee,xe):null;case M:return ee=rc(ee),re(Q,K,ee,xe)}if(ne(ee)||U(ee))return Je!==null?null:me(Q,K,ee,xe,null);if(typeof ee.then=="function")return re(Q,K,$p(ee),xe);if(ee.$$typeof===E)return re(Q,K,Dp(Q,ee),xe);Bp(Q,ee)}return null}function de(Q,K,ee,xe,Je){if(typeof xe=="string"&&xe!==""||typeof xe=="number"||typeof xe=="bigint")return Q=Q.get(ee)||null,O(K,Q,""+xe,Je);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case b:return Q=Q.get(xe.key===null?ee:xe.key)||null,H(K,Q,xe,Je);case v:return Q=Q.get(xe.key===null?ee:xe.key)||null,te(K,Q,xe,Je);case M:return xe=rc(xe),de(Q,K,ee,xe,Je)}if(ne(xe)||U(xe))return Q=Q.get(ee)||null,me(K,Q,xe,Je,null);if(typeof xe.then=="function")return de(Q,K,ee,$p(xe),Je);if(xe.$$typeof===E)return de(Q,K,ee,Dp(K,xe),Je);Bp(K,xe)}return null}function qe(Q,K,ee,xe){for(var Je=null,Rt=null,Ke=K,mt=K=0,Ct=null;Ke!==null&&mt<ee.length;mt++){Ke.index>mt?(Ct=Ke,Ke=null):Ct=Ke.sibling;var Dt=re(Q,Ke,ee[mt],xe);if(Dt===null){Ke===null&&(Ke=Ct);break}o&&Ke&&Dt.alternate===null&&c(Q,Ke),K=w(Dt,K,mt),Rt===null?Je=Dt:Rt.sibling=Dt,Rt=Dt,Ke=Ct}if(mt===ee.length)return h(Q,Ke),At&&Ma(Q,mt),Je;if(Ke===null){for(;mt<ee.length;mt++)Ke=ye(Q,ee[mt],xe),Ke!==null&&(K=w(Ke,K,mt),Rt===null?Je=Ke:Rt.sibling=Ke,Rt=Ke);return At&&Ma(Q,mt),Je}for(Ke=f(Ke);mt<ee.length;mt++)Ct=de(Ke,Q,mt,ee[mt],xe),Ct!==null&&(o&&Ct.alternate!==null&&Ke.delete(Ct.key===null?mt:Ct.key),K=w(Ct,K,mt),Rt===null?Je=Ct:Rt.sibling=Ct,Rt=Ct);return o&&Ke.forEach(function(Wo){return c(Q,Wo)}),At&&Ma(Q,mt),Je}function Ze(Q,K,ee,xe){if(ee==null)throw Error(r(151));for(var Je=null,Rt=null,Ke=K,mt=K=0,Ct=null,Dt=ee.next();Ke!==null&&!Dt.done;mt++,Dt=ee.next()){Ke.index>mt?(Ct=Ke,Ke=null):Ct=Ke.sibling;var Wo=re(Q,Ke,Dt.value,xe);if(Wo===null){Ke===null&&(Ke=Ct);break}o&&Ke&&Wo.alternate===null&&c(Q,Ke),K=w(Wo,K,mt),Rt===null?Je=Wo:Rt.sibling=Wo,Rt=Wo,Ke=Ct}if(Dt.done)return h(Q,Ke),At&&Ma(Q,mt),Je;if(Ke===null){for(;!Dt.done;mt++,Dt=ee.next())Dt=ye(Q,Dt.value,xe),Dt!==null&&(K=w(Dt,K,mt),Rt===null?Je=Dt:Rt.sibling=Dt,Rt=Dt);return At&&Ma(Q,mt),Je}for(Ke=f(Ke);!Dt.done;mt++,Dt=ee.next())Dt=de(Ke,Q,mt,Dt.value,xe),Dt!==null&&(o&&Dt.alternate!==null&&Ke.delete(Dt.key===null?mt:Dt.key),K=w(Dt,K,mt),Rt===null?Je=Dt:Rt.sibling=Dt,Rt=Dt);return o&&Ke.forEach(function(HI){return c(Q,HI)}),At&&Ma(Q,mt),Je}function Vt(Q,K,ee,xe){if(typeof ee=="object"&&ee!==null&&ee.type===k&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case b:e:{for(var Je=ee.key;K!==null;){if(K.key===Je){if(Je=ee.type,Je===k){if(K.tag===7){h(Q,K.sibling),xe=y(K,ee.props.children),xe.return=Q,Q=xe;break e}}else if(K.elementType===Je||typeof Je=="object"&&Je!==null&&Je.$$typeof===M&&rc(Je)===K.type){h(Q,K.sibling),xe=y(K,ee.props),eh(xe,ee),xe.return=Q,Q=xe;break e}h(Q,K);break}else c(Q,K);K=K.sibling}ee.type===k?(xe=Zl(ee.props.children,Q.mode,xe,ee.key),xe.return=Q,Q=xe):(xe=_p(ee.type,ee.key,ee.props,null,Q.mode,xe),eh(xe,ee),xe.return=Q,Q=xe)}return C(Q);case v:e:{for(Je=ee.key;K!==null;){if(K.key===Je)if(K.tag===4&&K.stateNode.containerInfo===ee.containerInfo&&K.stateNode.implementation===ee.implementation){h(Q,K.sibling),xe=y(K,ee.children||[]),xe.return=Q,Q=xe;break e}else{h(Q,K);break}else c(Q,K);K=K.sibling}xe=ay(ee,Q.mode,xe),xe.return=Q,Q=xe}return C(Q);case M:return ee=rc(ee),Vt(Q,K,ee,xe)}if(ne(ee))return qe(Q,K,ee,xe);if(U(ee)){if(Je=U(ee),typeof Je!="function")throw Error(r(150));return ee=Je.call(ee),Ze(Q,K,ee,xe)}if(typeof ee.then=="function")return Vt(Q,K,$p(ee),xe);if(ee.$$typeof===E)return Vt(Q,K,Dp(Q,ee),xe);Bp(Q,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,K!==null&&K.tag===6?(h(Q,K.sibling),xe=y(K,ee),xe.return=Q,Q=xe):(h(Q,K),xe=iy(ee,Q.mode,xe),xe.return=Q,Q=xe),C(Q)):h(Q,K)}return function(Q,K,ee,xe){try{Zu=0;var Je=Vt(Q,K,ee,xe);return jd=null,Je}catch(Ke){if(Ke===wd||Ke===Ip)throw Ke;var Rt=vr(29,Ke,null,Q.mode);return Rt.lanes=xe,Rt.return=Q,Rt}}}var ac=e2(!0),t2=e2(!1),Ao=!1;function by(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yy(o,c){o=o.updateQueue,c.updateQueue===o&&(c.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Mo(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function _o(o,c,h){var f=o.updateQueue;if(f===null)return null;if(f=f.shared,(Pt&2)!==0){var y=f.pending;return y===null?c.next=c:(c.next=y.next,y.next=c),f.pending=c,c=Mp(o),$k(o,null,h),c}return Ap(o,f,c,h),Mp(o)}function th(o,c,h){if(c=c.updateQueue,c!==null&&(c=c.shared,(h&4194048)!==0)){var f=c.lanes;f&=o.pendingLanes,h|=f,c.lanes=h,vo(o,h)}}function vy(o,c){var h=o.updateQueue,f=o.alternate;if(f!==null&&(f=f.updateQueue,h===f)){var y=null,w=null;if(h=h.firstBaseUpdate,h!==null){do{var C={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};w===null?y=w=C:w=w.next=C,h=h.next}while(h!==null);w===null?y=w=c:w=w.next=c}else y=w=c;h={baseState:f.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:f.shared,callbacks:f.callbacks},o.updateQueue=h;return}o=h.lastBaseUpdate,o===null?h.firstBaseUpdate=c:o.next=c,h.lastBaseUpdate=c}var wy=!1;function sh(){if(wy){var o=vd;if(o!==null)throw o}}function nh(o,c,h,f){wy=!1;var y=o.updateQueue;Ao=!1;var w=y.firstBaseUpdate,C=y.lastBaseUpdate,O=y.shared.pending;if(O!==null){y.shared.pending=null;var H=O,te=H.next;H.next=null,C===null?w=te:C.next=te,C=H;var me=o.alternate;me!==null&&(me=me.updateQueue,O=me.lastBaseUpdate,O!==C&&(O===null?me.firstBaseUpdate=te:O.next=te,me.lastBaseUpdate=H))}if(w!==null){var ye=y.baseState;C=0,me=te=H=null,O=w;do{var re=O.lane&-536870913,de=re!==O.lane;if(de?(St&re)===re:(f&re)===re){re!==0&&re===yd&&(wy=!0),me!==null&&(me=me.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var qe=o,Ze=O;re=c;var Vt=h;switch(Ze.tag){case 1:if(qe=Ze.payload,typeof qe=="function"){ye=qe.call(Vt,ye,re);break e}ye=qe;break e;case 3:qe.flags=qe.flags&-65537|128;case 0:if(qe=Ze.payload,re=typeof qe=="function"?qe.call(Vt,ye,re):qe,re==null)break e;ye=x({},ye,re);break e;case 2:Ao=!0}}re=O.callback,re!==null&&(o.flags|=64,de&&(o.flags|=8192),de=y.callbacks,de===null?y.callbacks=[re]:de.push(re))}else de={lane:re,tag:O.tag,payload:O.payload,callback:O.callback,next:null},me===null?(te=me=de,H=ye):me=me.next=de,C|=re;if(O=O.next,O===null){if(O=y.shared.pending,O===null)break;de=O,O=de.next,de.next=null,y.lastBaseUpdate=de,y.shared.pending=null}}while(!0);me===null&&(H=ye),y.baseState=H,y.firstBaseUpdate=te,y.lastBaseUpdate=me,w===null&&(y.shared.lanes=0),Io|=C,o.lanes=C,o.memoizedState=ye}}function s2(o,c){if(typeof o!="function")throw Error(r(191,o));o.call(c)}function n2(o,c){var h=o.callbacks;
vendor: 5,030 bytes, line 8
8if(h!==null)for(o.callbacks=null,o=0;o<h.length;o++)s2(h[o],c)}var Nd=B(null),zp=B(0);function r2(o,c){o=Va,pe(zp,o),pe(Nd,c),Va=o|c.baseLanes}function jy(){pe(zp,Va),pe(Nd,Nd.current)}function Ny(){Va=zp.current,le(Nd),le(zp)}var wr=B(null),Kr=null;function Oo(o){var c=o.alternate;pe(Ps,Ps.current&1),pe(wr,o),Kr===null&&(c===null||Nd.current!==null||c.memoizedState!==null)&&(Kr=o)}function ky(o){pe(Ps,Ps.current),pe(wr,o),Kr===null&&(Kr=o)}function i2(o){o.tag===22?(pe(Ps,Ps.current),pe(wr,o),Kr===null&&(Kr=o)):Ro()}function Ro(){pe(Ps,Ps.current),pe(wr,wr.current)}function jr(o){le(wr),Kr===o&&(Kr=null),le(Ps)}var Ps=B(0);function Vp(o){for(var c=o;c!==null;){if(c.tag===13){var h=c.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||M0(h)||_0(h)))return c}else if(c.tag===19&&(c.memoizedProps.revealOrder==="forwards"||c.memoizedProps.revealOrder==="backwards"||c.memoizedProps.revealOrder==="unstable_legacy-backwards"||c.memoizedProps.revealOrder==="together")){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Ra=0,dt=null,Bt=null,Bs=null,Fp=!1,kd=!1,oc=!1,Up=0,rh=0,Sd=null,DP=0;function Ns(){throw Error(r(321))}function Sy(o,c){if(c===null)return!1;for(var h=0;h<c.length&&h<o.length;h++)if(!yr(o[h],c[h]))return!1;return!0}function Cy(o,c,h,f,y,w){return Ra=w,dt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,q.H=o===null||o.memoizedState===null?F2:Vy,oc=!1,w=h(f,y),oc=!1,kd&&(w=o2(c,h,f,y)),a2(o),w}function a2(o){q.H=oh;var c=Bt!==null&&Bt.next!==null;if(Ra=0,Bs=Bt=dt=null,Fp=!1,rh=0,Sd=null,c)throw Error(r(300));o===null||zs||(o=o.dependencies,o!==null&&Rp(o)&&(zs=!0))}function o2(o,c,h,f){dt=o;var y=0;do{if(kd&&(Sd=null),rh=0,kd=!1,25<=y)throw Error(r(301));if(y+=1,Bs=Bt=null,o.updateQueue!=null){var w=o.updateQueue;w.lastEffect=null,w.events=null,w.stores=null,w.memoCache!=null&&(w.memoCache.index=0)}q.H=U2,w=c(h,f)}while(kd);return w}function PP(){var o=q.H,c=o.useState()[0];return c=typeof c.then=="function"?ih(c):c,o=o.useState()[0],(Bt!==null?Bt.memoizedState:null)!==o&&(dt.flags|=1024),c}function Ty(){var o=Up!==0;return Up=0,o}function Ey(o,c,h){c.updateQueue=o.updateQueue,c.flags&=-2053,o.lanes&=~h}function Ay(o){if(Fp){for(o=o.memoizedState;o!==null;){var c=o.queue;c!==null&&(c.pending=null),o=o.next}Fp=!1}Ra=0,Bs=Bt=dt=null,kd=!1,rh=Up=0,Sd=null}function qn(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bs===null?dt.memoizedState=Bs=o:Bs=Bs.next=o,Bs}function Is(){if(Bt===null){var o=dt.alternate;o=o!==null?o.memoizedState:null}else o=Bt.next;var c=Bs===null?dt.memoizedState:Bs.next;if(c!==null)Bs=c,Bt=o;else{if(o===null)throw dt.alternate===null?Error(r(467)):Error(r(310));Bt=o,o={memoizedState:Bt.memoizedState,baseState:Bt.baseState,baseQueue:Bt.baseQueue,queue:Bt.queue,next:null},Bs===null?dt.memoizedState=Bs=o:Bs=Bs.next=o}return Bs}function Hp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ih(o){var c=rh;return rh+=1,Sd===null&&(Sd=[]),o=Jk(Sd,o,c),c=dt,(Bs===null?c.memoizedState:Bs.next)===null&&(c=c.alternate,q.H=c===null||c.memoizedState===null?F2:Vy),o}function qp(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return ih(o);if(o.$$typeof===E)return pn(o)}throw Error(r(438,String(o)))}function My(o){var c=null,h=dt.updateQueue;if(h!==null&&(c=h.memoCache),c==null){var f=dt.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(c={data:f.data.map(function(y){return y.slice()}),index:0})))}if(c==null&&(c={data:[],index:0}),h===null&&(h=Hp(),dt.updateQueue=h),h.memoCache=c,h=c.data[c.index],h===void 0)for(h=c.data[c.index]=Array(o),f=0;f<o;f++)h[f]=z;return c.index++,h}function Da(o,c){return typeof c=="function"?c(o):c}function Wp(o){var c=Is();return _y(c,Bt,o)}function _y(o,c,h){var f=o.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=h;var y=o.baseQueue,w=f.pending;if(w!==null){if(y!==null){var C=y.next;y.next=w.next,w.next=C}c.baseQueue=y=w,f.pending=null}if(w=o.baseState,y===null)o.memoizedState=w;else{c=y.next;var O=C=null,H=null,te=c,me=!1;do{var ye=te.lane&-536870913;if(ye!==te.lane?(St&ye)===ye:(Ra&ye)===ye){var re=te.revertLane;if(re===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),ye===yd&&(me=!0);else if((Ra&re)===re){te=te.next,re===yd&&(me=!0);continue}else ye={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},H===null?(O=H=ye,C=w):H=H.next=ye,dt.lanes|=re,Io|=re;ye=te.action,oc&&h(w,ye),w=te.hasEagerState?te.eagerState:h(w,ye)}else re={lane:ye,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},H===null?(O=H=re,C=w):H=H.next=re,dt.lanes|=ye,Io|=ye;te=te.next}
vendor: 4,369 bytes, line 8
8while(te!==null&&te!==c);if(H===null?C=w:H.next=O,!yr(w,o.memoizedState)&&(zs=!0,me&&(h=vd,h!==null)))throw h;o.memoizedState=w,o.baseState=C,o.baseQueue=H,f.lastRenderedState=w}return y===null&&(f.lanes=0),[o.memoizedState,f.dispatch]}function Oy(o){var c=Is(),h=c.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=o;var f=h.dispatch,y=h.pending,w=c.memoizedState;if(y!==null){h.pending=null;var C=y=y.next;do w=o(w,C.action),C=C.next;while(C!==y);yr(w,c.memoizedState)||(zs=!0),c.memoizedState=w,c.baseQueue===null&&(c.baseState=w),h.lastRenderedState=w}return[w,f]}function l2(o,c,h){var f=dt,y=Is(),w=At;if(w){if(h===void 0)throw Error(r(407));h=h()}else h=c();var C=!yr((Bt||y).memoizedState,h);if(C&&(y.memoizedState=h,zs=!0),y=y.queue,Py(u2.bind(null,f,y,o),[o]),y.getSnapshot!==c||C||Bs!==null&&Bs.memoizedState.tag&1){if(f.flags|=2048,Cd(9,{destroy:void 0},d2.bind(null,f,y,h,c),null),Ht===null)throw Error(r(349));w||(Ra&127)!==0||c2(f,c,h)}return h}function c2(o,c,h){o.flags|=16384,o={getSnapshot:c,value:h},c=dt.updateQueue,c===null?(c=Hp(),dt.updateQueue=c,c.stores=[o]):(h=c.stores,h===null?c.stores=[o]:h.push(o))}function d2(o,c,h,f){c.value=h,c.getSnapshot=f,h2(c)&&m2(o)}function u2(o,c,h){return h(function(){h2(c)&&m2(o)})}function h2(o){var c=o.getSnapshot;o=o.value;try{var h=c();return!yr(o,h)}catch{return!0}}function m2(o){var c=Xl(o,2);c!==null&&cr(c,o,2)}function Ry(o){var c=qn();if(typeof o=="function"){var h=o;if(o=h(),oc){Rs(!0);try{h()}finally{Rs(!1)}}}return c.memoizedState=c.baseState=o,c.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Da,lastRenderedState:o},c}function p2(o,c,h,f){return o.baseState=h,_y(o,Bt,typeof f=="function"?f:Da)}function IP(o,c,h,f,y){if(Yp(o))throw Error(r(485));if(o=c.action,o!==null){var w={payload:y,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){w.listeners.push(C)}};q.T!==null?h(!0):w.isTransition=!1,f(w),h=c.pending,h===null?(w.next=c.pending=w,f2(c,w)):(w.next=h.next,c.pending=h.next=w)}}function f2(o,c){var h=c.action,f=c.payload,y=o.state;if(c.isTransition){var w=q.T,C={};q.T=C;try{var O=h(y,f),H=q.S;H!==null&&H(C,O),x2(o,c,O)}catch(te){Dy(o,c,te)}finally{w!==null&&C.types!==null&&(w.types=C.types),q.T=w}}else try{w=h(y,f),x2(o,c,w)}catch(te){Dy(o,c,te)}}function x2(o,c,h){h!==null&&typeof h=="object"&&typeof h.then=="function"?h.then(function(f){g2(o,c,f)},function(f){return Dy(o,c,f)}):g2(o,c,h)}function g2(o,c,h){c.status="fulfilled",c.value=h,b2(c),o.state=h,c=o.pending,c!==null&&(h=c.next,h===c?o.pending=null:(h=h.next,c.next=h,f2(o,h)))}function Dy(o,c,h){var f=o.pending;if(o.pending=null,f!==null){f=f.next;do c.status="rejected",c.reason=h,b2(c),c=c.next;while(c!==f)}o.action=null}function b2(o){o=o.listeners;for(var c=0;c<o.length;c++)(0,o[c])()}function y2(o,c){return c}function v2(o,c){if(At){var h=Ht.formState;if(h!==null){e:{var f=dt;if(At){if(es){t:{for(var y=es,w=Gr;y.nodeType!==8;){if(!w){y=null;break t}if(y=Yr(y.nextSibling),y===null){y=null;break t}}w=y.data,y=w==="F!"||w==="F"?y:null}if(y){es=Yr(y.nextSibling),f=y.data==="F!";break e}}To(f)}f=!1}f&&(c=h[0])}}return h=qn(),h.memoizedState=h.baseState=c,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:y2,lastRenderedState:c},h.queue=f,h=B2.bind(null,dt,f),f.dispatch=h,f=Ry(!1),w=zy.bind(null,dt,!1,f.queue),f=qn(),y={state:c,dispatch:null,action:o,pending:null},f.queue=y,h=IP.bind(null,dt,y,w,h),y.dispatch=h,f.memoizedState=o,[c,h,!1]}function w2(o){var c=Is();return j2(c,Bt,o)}function j2(o,c,h){if(c=_y(o,c,y2)[0],o=Wp(Da)[0],typeof c=="object"&&c!==null&&typeof c.then=="function")try{var f=ih(c)}catch(C){throw C===wd?Ip:C}else f=c;c=Is();var y=c.queue,w=y.dispatch;return h!==c.memoizedState&&(dt.flags|=2048,Cd(9,{destroy:void 0},LP.bind(null,y,h),null)),[f,w,o]}function LP(o,c){o.action=c}function N2(o){var c=Is(),h=Bt;if(h!==null)return j2(c,h,o);Is(),c=c.memoizedState,h=Is();var f=h.queue.dispatch;return h.memoizedState=o,[c,f,!1]}function Cd(o,c,h,f){return o={tag:o,create:h,deps:f,inst:c,next:null},c=dt.updateQueue,c===null&&(c=Hp(),dt.updateQueue=c),h=c.lastEffect,h===null?c.lastEffect=o.next=o:(f=h.next,h.next=o,o.next=f,c.lastEffect=o),o}function k2(){return Is().memoizedState}function Gp(o,c,h,f){var y=qn();dt.flags|=o,y.memoizedState=Cd(1|c,{destroy:void 0},h,f===void 0?null:f)}
vendor: 5,153 bytes, line 8
8function Kp(o,c,h,f){var y=Is();f=f===void 0?null:f;var w=y.memoizedState.inst;Bt!==null&&f!==null&&Sy(f,Bt.memoizedState.deps)?y.memoizedState=Cd(c,w,h,f):(dt.flags|=o,y.memoizedState=Cd(1|c,w,h,f))}function S2(o,c){Gp(8390656,8,o,c)}function Py(o,c){Kp(2048,8,o,c)}function $P(o){dt.flags|=4;var c=dt.updateQueue;if(c===null)c=Hp(),dt.updateQueue=c,c.events=[o];else{var h=c.events;h===null?c.events=[o]:h.push(o)}}function C2(o){var c=Is().memoizedState;return $P({ref:c,nextImpl:o}),function(){if((Pt&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}function T2(o,c){return Kp(4,2,o,c)}function E2(o,c){return Kp(4,4,o,c)}function A2(o,c){if(typeof c=="function"){o=o();var h=c(o);return function(){typeof h=="function"?h():c(null)}}if(c!=null)return o=o(),c.current=o,function(){c.current=null}}function M2(o,c,h){h=h!=null?h.concat([o]):null,Kp(4,4,A2.bind(null,c,o),h)}function Iy(){}function _2(o,c){var h=Is();c=c===void 0?null:c;var f=h.memoizedState;return c!==null&&Sy(c,f[1])?f[0]:(h.memoizedState=[o,c],o)}function O2(o,c){var h=Is();c=c===void 0?null:c;var f=h.memoizedState;if(c!==null&&Sy(c,f[1]))return f[0];if(f=o(),oc){Rs(!0);try{o()}finally{Rs(!1)}}return h.memoizedState=[f,c],f}function Ly(o,c,h){return h===void 0||(Ra&1073741824)!==0&&(St&261930)===0?o.memoizedState=c:(o.memoizedState=h,o=RS(),dt.lanes|=o,Io|=o,h)}function R2(o,c,h,f){return yr(h,c)?h:Nd.current!==null?(o=Ly(o,h,f),yr(o,c)||(zs=!0),o):(Ra&42)===0||(Ra&1073741824)!==0&&(St&261930)===0?(zs=!0,o.memoizedState=h):(o=RS(),dt.lanes|=o,Io|=o,c)}function D2(o,c,h,f,y){var w=W.p;W.p=w!==0&&8>w?w:8;var C=q.T,O={};q.T=O,zy(o,!1,c,h);try{var H=y(),te=q.S;if(te!==null&&te(O,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var me=RP(H,f);ah(o,c,me,Sr(o))}else ah(o,c,f,Sr(o))}catch(ye){ah(o,c,{then:function(){},status:"rejected",reason:ye},Sr())}finally{W.p=w,C!==null&&O.types!==null&&(C.types=O.types),q.T=C}}function BP(){}function $y(o,c,h,f){if(o.tag!==5)throw Error(r(476));var y=P2(o).queue;D2(o,y,c,ie,h===null?BP:function(){return I2(o),h(f)})}function P2(o){var c=o.memoizedState;if(c!==null)return c;c={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Da,lastRenderedState:ie},next:null};var h={};return c.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Da,lastRenderedState:h},next:null},o.memoizedState=c,o=o.alternate,o!==null&&(o.memoizedState=c),c}function I2(o){var c=P2(o);c.next===null&&(c=o.alternate.memoizedState),ah(o,c.next.queue,{},Sr())}function By(){return pn(Nh)}function L2(){return Is().memoizedState}function $2(){return Is().memoizedState}function zP(o){for(var c=o.return;c!==null;){switch(c.tag){case 24:case 3:var h=Sr();o=Mo(h);var f=_o(c,o,h);f!==null&&(cr(f,c,h),th(f,c,h)),c={cache:py()},o.payload=c;return}c=c.return}}function VP(o,c,h){var f=Sr();h={lane:f,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Yp(o)?z2(c,h):(h=ny(o,c,h,f),h!==null&&(cr(h,o,f),V2(h,c,f)))}function B2(o,c,h){var f=Sr();ah(o,c,h,f)}function ah(o,c,h,f){var y={lane:f,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(Yp(o))z2(c,y);else{var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=c.lastRenderedReducer,w!==null))try{var C=c.lastRenderedState,O=w(C,h);if(y.hasEagerState=!0,y.eagerState=O,yr(O,C))return Ap(o,c,y,0),Ht===null&&Ep(),!1}catch{}if(h=ny(o,c,y,f),h!==null)return cr(h,o,f),V2(h,c,f),!0}return!1}function zy(o,c,h,f){if(f={lane:2,revertLane:b0(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Yp(o)){if(c)throw Error(r(479))}else c=ny(o,h,f,2),c!==null&&cr(c,o,2)}function Yp(o){var c=o.alternate;return o===dt||c!==null&&c===dt}function z2(o,c){kd=Fp=!0;var h=o.pending;h===null?c.next=c:(c.next=h.next,h.next=c),o.pending=c}function V2(o,c,h){if((h&4194048)!==0){var f=c.lanes;f&=o.pendingLanes,h|=f,c.lanes=h,vo(o,h)}}var oh={readContext:pn,use:qp,useCallback:Ns,useContext:Ns,useEffect:Ns,useImperativeHandle:Ns,useLayoutEffect:Ns,useInsertionEffect:Ns,useMemo:Ns,useReducer:Ns,useRef:Ns,useState:Ns,useDebugValue:Ns,useDeferredValue:Ns,useTransition:Ns,useSyncExternalStore:Ns,useId:Ns,useHostTransitionStatus:Ns,useFormState:Ns,useActionState:Ns,useOptimistic:Ns,useMemoCache:Ns,useCacheRefresh:Ns};oh.useEffectEvent=Ns;var F2={readContext:pn,use:qp,useCallback:function(o,c){return qn().memoizedState=[o,c===void 0?null:c],o},useContext:pn,useEffect:S2,useImperativeHandle:function(o,c,h){h=h!=null?h.concat([o]):null,Gp(4194308,4,A2.bind(null,c,o),h)},useLayoutEffect:function(o,c){return Gp(4194308,4,o,c)},useInsertionEffect:function(o,c){Gp(4,2,o,c)},useMemo:function(o,c){var h=qn();c=c===void 0?null:c;var f=o();if(oc){Rs(!0);try{o()}finally{Rs(!1)}}return h.memoizedState=[f,c],f},useReducer:function(o,c,h){var f=qn();if(h!==void 0){var y=h(c);if(oc){Rs(!0);try{h(c)}finally{Rs(!1)}}}else y=c;return f.memoizedState=f.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},f.queue=o,o=o.dispatch=VP.bind(null,dt,o),[f.memoizedState,o]}
vendor: 4,979 bytes, line 8
8,useRef:function(o){var c=qn();return o={current:o},c.memoizedState=o},useState:function(o){o=Ry(o);var c=o.queue,h=B2.bind(null,dt,c);return c.dispatch=h,[o.memoizedState,h]},useDebugValue:Iy,useDeferredValue:function(o,c){var h=qn();return Ly(h,o,c)},useTransition:function(){var o=Ry(!1);return o=D2.bind(null,dt,o.queue,!0,!1),qn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,c,h){var f=dt,y=qn();if(At){if(h===void 0)throw Error(r(407));h=h()}else{if(h=c(),Ht===null)throw Error(r(349));(St&127)!==0||c2(f,c,h)}y.memoizedState=h;var w={value:h,getSnapshot:c};return y.queue=w,S2(u2.bind(null,f,w,o),[o]),f.flags|=2048,Cd(9,{destroy:void 0},d2.bind(null,f,w,h,c),null),h},useId:function(){var o=qn(),c=Ht.identifierPrefix;if(At){var h=qi,f=Hi;h=(f&~(1<<32-Zt(f)-1)).toString(32)+h,c="_"+c+"R_"+h,h=Up++,0<h&&(c+="H"+h.toString(32)),c+="_"}else h=DP++,c="_"+c+"r_"+h.toString(32)+"_";return o.memoizedState=c},useHostTransitionStatus:By,useFormState:v2,useActionState:v2,useOptimistic:function(o){var c=qn();c.memoizedState=c.baseState=o;var h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return c.queue=h,c=zy.bind(null,dt,!0,h),h.dispatch=c,[o,c]},useMemoCache:My,useCacheRefresh:function(){return qn().memoizedState=zP.bind(null,dt)},useEffectEvent:function(o){var c=qn(),h={impl:o};return c.memoizedState=h,function(){if((Pt&2)!==0)throw Error(r(440));return h.impl.apply(void 0,arguments)}}},Vy={readContext:pn,use:qp,useCallback:_2,useContext:pn,useEffect:Py,useImperativeHandle:M2,useInsertionEffect:T2,useLayoutEffect:E2,useMemo:O2,useReducer:Wp,useRef:k2,useState:function(){return Wp(Da)},useDebugValue:Iy,useDeferredValue:function(o,c){var h=Is();return R2(h,Bt.memoizedState,o,c)},useTransition:function(){var o=Wp(Da)[0],c=Is().memoizedState;return[typeof o=="boolean"?o:ih(o),c]},useSyncExternalStore:l2,useId:L2,useHostTransitionStatus:By,useFormState:w2,useActionState:w2,useOptimistic:function(o,c){var h=Is();return p2(h,Bt,o,c)},useMemoCache:My,useCacheRefresh:$2};Vy.useEffectEvent=C2;var U2={readContext:pn,use:qp,useCallback:_2,useContext:pn,useEffect:Py,useImperativeHandle:M2,useInsertionEffect:T2,useLayoutEffect:E2,useMemo:O2,useReducer:Oy,useRef:k2,useState:function(){return Oy(Da)},useDebugValue:Iy,useDeferredValue:function(o,c){var h=Is();return Bt===null?Ly(h,o,c):R2(h,Bt.memoizedState,o,c)},useTransition:function(){var o=Oy(Da)[0],c=Is().memoizedState;return[typeof o=="boolean"?o:ih(o),c]},useSyncExternalStore:l2,useId:L2,useHostTransitionStatus:By,useFormState:N2,useActionState:N2,useOptimistic:function(o,c){var h=Is();return Bt!==null?p2(h,Bt,o,c):(h.baseState=o,[o,h.queue.dispatch])},useMemoCache:My,useCacheRefresh:$2};U2.useEffectEvent=C2;function Fy(o,c,h,f){c=o.memoizedState,h=h(f,c),h=h==null?c:x({},c,h),o.memoizedState=h,o.lanes===0&&(o.updateQueue.baseState=h)}var Uy={enqueueSetState:function(o,c,h){o=o._reactInternals;var f=Sr(),y=Mo(f);y.payload=c,h!=null&&(y.callback=h),c=_o(o,y,f),c!==null&&(cr(c,o,f),th(c,o,f))},enqueueReplaceState:function(o,c,h){o=o._reactInternals;var f=Sr(),y=Mo(f);y.tag=1,y.payload=c,h!=null&&(y.callback=h),c=_o(o,y,f),c!==null&&(cr(c,o,f),th(c,o,f))},enqueueForceUpdate:function(o,c){o=o._reactInternals;var h=Sr(),f=Mo(h);f.tag=2,c!=null&&(f.callback=c),c=_o(o,f,h),c!==null&&(cr(c,o,h),th(c,o,h))}};function H2(o,c,h,f,y,w,C){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(f,w,C):c.prototype&&c.prototype.isPureReactComponent?!Gu(h,f)||!Gu(y,w):!0}function q2(o,c,h,f){o=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(h,f),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(h,f),c.state!==o&&Uy.enqueueReplaceState(c,c.state,null)}function lc(o,c){var h=c;if("ref"in c){h={};for(var f in c)f!=="ref"&&(h[f]=c[f])}if(o=o.defaultProps){h===c&&(h=x({},h));for(var y in o)h[y]===void 0&&(h[y]=o[y])}return h}function W2(o){Tp(o)}function G2(o){console.error(o)}function K2(o){Tp(o)}function Qp(o,c){try{var h=o.onUncaughtError;h(c.value,{componentStack:c.stack})}catch(f){setTimeout(function(){throw f})}}function Y2(o,c,h){try{var f=o.onCaughtError;f(h.value,{componentStack:h.stack,errorBoundary:c.tag===1?c.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Hy(o,c,h){return h=Mo(h),h.tag=3,h.payload={element:null},h.callback=function(){Qp(o,c)},h}function Q2(o){return o=Mo(o),o.tag=3,o}function J2(o,c,h,f){var y=h.type.getDerivedStateFromError;if(typeof y=="function"){var w=f.value;o.payload=function(){return y(w)},o.callback=function(){Y2(c,h,f)}}var C=h.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(o.callback=function(){Y2(c,h,f),typeof y!="function"&&(Lo===null?Lo=new Set([this]):Lo.add(this));var O=f.stack;this.componentDidCatch(f.value,{componentStack:O!==null?O:""})})}function FP(o,c,h,f,y){if(h.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(c=
vendor: 10,527 bytes, line 8
8h.alternate,c!==null&&bd(c,h,y,!0),h=wr.current,h!==null){switch(h.tag){case 31:case 13:return Kr===null?cf():h.alternate===null&&ks===0&&(ks=3),h.flags&=-257,h.flags|=65536,h.lanes=y,f===Lp?h.flags|=16384:(c=h.updateQueue,c===null?h.updateQueue=new Set([f]):c.add(f),f0(o,f,y)),!1;case 22:return h.flags|=65536,f===Lp?h.flags|=16384:(c=h.updateQueue,c===null?(c={transitions:null,markerInstances:null,retryQueue:new Set([f])},h.updateQueue=c):(h=c.retryQueue,h===null?c.retryQueue=new Set([f]):h.add(f)),f0(o,f,y)),!1}throw Error(r(435,h.tag))}return f0(o,f,y),cf(),!1}if(At)return c=wr.current,c!==null?((c.flags&65536)===0&&(c.flags|=256),c.flags|=65536,c.lanes=y,f!==cy&&(o=Error(r(422),{cause:f}),Qu(Hr(o,h)))):(f!==cy&&(c=Error(r(423),{cause:f}),Qu(Hr(c,h))),o=o.current.alternate,o.flags|=65536,y&=-y,o.lanes|=y,f=Hr(f,h),y=Hy(o.stateNode,f,y),vy(o,y),ks!==4&&(ks=2)),!1;var w=Error(r(520),{cause:f});if(w=Hr(w,h),fh===null?fh=[w]:fh.push(w),ks!==4&&(ks=2),c===null)return!0;f=Hr(f,h),h=c;do{switch(h.tag){case 3:return h.flags|=65536,o=y&-y,h.lanes|=o,o=Hy(h.stateNode,f,o),vy(h,o),!1;case 1:if(c=h.type,w=h.stateNode,(h.flags&128)===0&&(typeof c.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Lo===null||!Lo.has(w))))return h.flags|=65536,y&=-y,h.lanes|=y,y=Q2(y),J2(y,o,h,f),vy(h,y),!1}h=h.return}while(h!==null);return!1}var qy=Error(r(461)),zs=!1;function fn(o,c,h,f){c.child=o===null?t2(c,null,h,f):ac(c,o.child,h,f)}function X2(o,c,h,f,y){h=h.render;var w=c.ref;if("ref"in f){var C={};for(var O in f)O!=="ref"&&(C[O]=f[O])}else C=f;return sc(c),f=Cy(o,c,h,C,w,y),O=Ty(),o!==null&&!zs?(Ey(o,c,y),Pa(o,c,y)):(At&&O&&oy(c),c.flags|=1,fn(o,c,f,y),c.child)}function Z2(o,c,h,f,y){if(o===null){var w=h.type;return typeof w=="function"&&!ry(w)&&w.defaultProps===void 0&&h.compare===null?(c.tag=15,c.type=w,eS(o,c,w,f,y)):(o=_p(h.type,null,f,c,c.mode,y),o.ref=c.ref,o.return=c,c.child=o)}if(w=o.child,!Zy(o,y)){var C=w.memoizedProps;if(h=h.compare,h=h!==null?h:Gu,h(C,f)&&o.ref===c.ref)return Pa(o,c,y)}return c.flags|=1,o=Aa(w,f),o.ref=c.ref,o.return=c,c.child=o}function eS(o,c,h,f,y){if(o!==null){var w=o.memoizedProps;if(Gu(w,f)&&o.ref===c.ref)if(zs=!1,c.pendingProps=f=w,Zy(o,y))(o.flags&131072)!==0&&(zs=!0);else return c.lanes=o.lanes,Pa(o,c,y)}return Wy(o,c,h,f,y)}function tS(o,c,h,f){var y=f.children,w=o!==null?o.memoizedState:null;if(o===null&&c.stateNode===null&&(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((c.flags&128)!==0){if(w=w!==null?w.baseLanes|h:h,o!==null){for(f=c.child=o.child,y=0;f!==null;)y=y|f.lanes|f.childLanes,f=f.sibling;f=y&~w}else f=0,c.child=null;return sS(o,c,w,h,f)}if((h&536870912)!==0)c.memoizedState={baseLanes:0,cachePool:null},o!==null&&Pp(c,w!==null?w.cachePool:null),w!==null?r2(c,w):jy(),i2(c);else return f=c.lanes=536870912,sS(o,c,w!==null?w.baseLanes|h:h,h,f)}else w!==null?(Pp(c,w.cachePool),r2(c,w),Ro(),c.memoizedState=null):(o!==null&&Pp(c,null),jy(),Ro());return fn(o,c,y,h),c.child}function lh(o,c){return o!==null&&o.tag===22||c.stateNode!==null||(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.sibling}function sS(o,c,h,f,y){var w=xy();return w=w===null?null:{parent:$s._currentValue,pool:w},c.memoizedState={baseLanes:h,cachePool:w},o!==null&&Pp(c,null),jy(),i2(c),o!==null&&bd(o,c,f,!0),c.childLanes=y,null}function Jp(o,c){return c=Zp({mode:c.mode,children:c.children},o.mode),c.ref=o.ref,o.child=c,c.return=o,c}function nS(o,c,h){return ac(c,o.child,null,h),o=Jp(c,c.pendingProps),o.flags|=2,jr(c),c.memoizedState=null,o}function UP(o,c,h){var f=c.pendingProps,y=(c.flags&128)!==0;if(c.flags&=-129,o===null){if(At){if(f.mode==="hidden")return o=Jp(c,f),c.lanes=536870912,lh(null,o);if(ky(c),(o=es)?(o=fC(o,Gr),o=o!==null&&o.data==="&"?o:null,o!==null&&(c.memoizedState={dehydrated:o,treeContext:So!==null?{id:Hi,overflow:qi}:null,retryLane:536870912,hydrationErrors:null},h=zk(o),h.return=c,c.child=h,mn=c,es=null)):o=null,o===null)throw To(c);return c.lanes=536870912,null}return Jp(c,f)}var w=o.memoizedState;if(w!==null){var C=w.dehydrated;if(ky(c),y)if(c.flags&256)c.flags&=-257,c=nS(o,c,h);else if(c.memoizedState!==null)c.child=o.child,c.flags|=128,c=null;else throw Error(r(558));else if(zs||bd(o,c,h,!1),y=(h&o.childLanes)!==0,zs||y){if(f=Ht,f!==null&&(C=Bl(f,h),C!==0&&C!==w.retryLane))throw w.retryLane=C,Xl(o,C),cr(f,o,C),qy;cf(),c=nS(o,c,h)}else o=w.treeContext,es=Yr(C.nextSibling),mn=c,At=!0,Co=null,Gr=!1,o!==null&&Uk(c,o),c=Jp(c,f),c.flags|=4096;return c}return o=Aa(o.child,{mode:f.mode,children:f.children}),o.ref=c.ref,c.child=o,o.return=c,o}function Xp(o,c){var h=c.ref;if(h===null)o!==null&&o.ref!==null&&(c.flags|=4194816);else{if(typeof h!="function"&&typeof h!="object")throw Error(r(284));(o===null||o.ref!==h)&&(c.flags|=4194816)}}function Wy(o,c,h,f,y){return sc(c),h=Cy(o,c,h,f,void 0,y),f=Ty(),o!==null&&!zs?(Ey(o,c,y),Pa(o,c,y)):(At&&f&&oy(c),c.flags|=1,fn(o,c,h,y),c.child)}function rS(o,c,h,f,y,w){return sc(c),c.updateQueue=null,h=o2(c,f,h,y),a2(o),f=Ty(),o!==null&&!zs?(Ey(o,c,w),Pa(o,c,w)):(At&&f&&oy(c),c.flags|=1,fn(o,c,h,w),c.child)}function iS(o,c,h,f,y){if(sc(c),c.stateNode===null){var w=pd,C=h.contextType;typeof C=="object"&&C!==null&&(w=pn(C)),w=new h(f,w),c.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=Uy,c.stateNode=w,w._reactInternals=c,w=c.stateNode,w.props=f,w.state=c.memoizedState,w.refs={},by(c),C=h.contextType,w.context=typeof C=="object"&&C!==null?pn(C):pd,w.state=c.memoizedState,C=h.getDerivedStateFromProps,typeof C=="function"&&(Fy(c,h,C,f),w.state=c.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(C=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),C!==w.state&&Uy.enqueueReplaceState(w,w.state,null),nh(c,f,w,y),sh(),w.state=c.memoizedState),typeof w.componentDidMount=="function"&&(c.flags|=4194308),f=!0}else if(o===null){w=c.stateNode;var O=c.memoizedProps,H=lc(h,O);w.props=H;var te=w.context,me=h.contextType;C=pd,typeof me=="object"&&me!==null&&(C=pn(me));var ye=h.getDerivedStateFromProps;me=typeof ye=="function"||typeof w.getSnapshotBeforeUpdate=="function",O=c.pendingProps!==O,me||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(O||te!==C)&&q2(c,w,f,C),Ao=!1;var re=c.memoizedState;w.state=re,nh(c,f,w,y),sh(),te=c.memoizedState,O||re!==te||Ao?(typeof ye=="function"&&(Fy(c,h,ye,f),te=c.memoizedState),(H=Ao||H2(c,h,H,f,re,te,C))?(me||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(c.flags|=4194308)):(typeof w.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=f,c.memoizedState=te),w.props=f,w.state=te,w.context=C,f=H):(typeof w.componentDidMount=="function"&&(c.flags|=4194308),f=!1)}else{w=c.stateNode,yy(o,c),C=c.memoizedProps,me=lc(h,C),w.props=me,ye=c.pendingProps,re=w.context,te=h.contextType,H=pd,typeof te=="object"&&te!==null&&(H=pn(te)),O=h.getDerivedStateFromProps,(te=typeof O=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(C!==ye||re!==H)&&q2(c,w,f,H),Ao=!1,re=c.memoizedState,w.state=re,nh(c,f,w,y),sh();var de=c.memoizedState;C!==ye||re!==de||Ao||o!==null&&o.dependencies!==null&&Rp(o.dependencies)?(typeof O=="function"&&(Fy(c,h,O,f),de=c.memoizedState),(me=Ao||H2(c,h,me,f,re,de,H)||o!==null&&o.dependencies!==null&&Rp(o.dependencies))?(te||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(f,de,H),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(f,de,H)),typeof w.componentDidUpdate=="function"&&(c.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof w.componentDidUpdate!="function"||C===o.memoizedProps&&re===o.memoizedState||(c.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||C===o.memoizedProps&&re===o.memoizedState||(c.flags|=1024),c.memoizedProps=f,c.memoizedState=de),w.props=f,w.state=de,w.context=H,f=me):(typeof w.componentDidUpdate!="function"||C===o.memoizedProps&&re===o.memoizedState||(c.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||C===o.memoizedProps&&re===o.memoizedState||(c.flags|=1024),f=!1)}return w=f,Xp(o,c),f=(c.flags&128)!==0,w||f?(w=c.stateNode,h=f&&typeof h.getDerivedStateFromError!="function"?null:w.render(),c.flags|=1,o!==null&&f?(c.child=ac(c,o.child,null,y),c.child=ac(c,null,h,y)):fn(o,c,h,y),c.memoizedState=w.state,o=c.child):o=Pa(o,c,y),o}function aS(o,c,h,f){return ec(),c.flags|=256,fn(o,c,h,f),c.child}var Gy={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ky(o){return{baseLanes:o,cachePool:Yk()}}function Yy(o,c,h){return o=o!==null?o.childLanes&~h:0,c&&(o|=kr),o}function oS(o,c,h){var f=c.pendingProps,y=!1,w=(c.flags&128)!==0,C;if((C=w)||(C=o!==null&&o.memoizedState===null?!1:(Ps.current&2)!==0),C&&(y=!0,c.flags&=-129),C=(c.flags&32)!==0,c.flags&=-33,o===null){if(At){if(y?Oo(c):Ro(),(o=es)?(o=fC(o,Gr),o=o!==null&&o.data!=="&"?o:null,o!==null&&(c.memoizedState={dehydrated:o,treeContext:So!==null?{id:Hi,overflow:qi}:null,retryLane:536870912,hydrationErrors:null},h=zk(o),h.return=c,c.child=h,mn=c,es=null)):o=null,o===null)throw To(c);return _0(o)?c.lanes=32:c.lanes=536870912,null}var O=f.children;return f=f.fallback,y?(Ro(),y=c.mode,O=Zp({mode:"hidden",children:O},y),f=Zl(f,y,h,null),O.return=c,f.return=c,O.sibling=f,c.child=O,f=c.child,f.memoizedState=Ky(h),f.childLanes=Yy(o,C,h),c.memoizedState=Gy,lh(null,f)):(Oo(c),Qy(c,O))}var H=o.memoizedState;if(H!==null&&(O=H.dehydrated,O!==null)){if(w)c.flags&256?(Oo(c),c.flags&=-257,c=Jy(o,c,h)):c.memoizedState!==null?(Ro(),c.child=o.child,c.flags|=128,c=null):(Ro(),O=f.fallback,y=c.mode,f=Zp({mode:"visible",children:f.children},y),O=Zl(O,y,h,null),O.flags|=2,f.return=c,O.return=c,f.sibling=O,c.child=f,ac(c,o.child,null,h),f=c.child,f.memoizedState=Ky(h),f.childLanes=Yy(o,C,h),c.memoizedState=Gy,c=lh(null,f));
vendor: 5,598 bytes, line 8
8else if(Oo(c),_0(O)){if(C=O.nextSibling&&O.nextSibling.dataset,C)var te=C.dgst;C=te,f=Error(r(419)),f.stack="",f.digest=C,Qu({value:f,source:null,stack:null}),c=Jy(o,c,h)}else if(zs||bd(o,c,h,!1),C=(h&o.childLanes)!==0,zs||C){if(C=Ht,C!==null&&(f=Bl(C,h),f!==0&&f!==H.retryLane))throw H.retryLane=f,Xl(o,f),cr(C,o,f),qy;M0(O)||cf(),c=Jy(o,c,h)}else M0(O)?(c.flags|=192,c.child=o.child,c=null):(o=H.treeContext,es=Yr(O.nextSibling),mn=c,At=!0,Co=null,Gr=!1,o!==null&&Uk(c,o),c=Qy(c,f.children),c.flags|=4096);return c}return y?(Ro(),O=f.fallback,y=c.mode,H=o.child,te=H.sibling,f=Aa(H,{mode:"hidden",children:f.children}),f.subtreeFlags=H.subtreeFlags&65011712,te!==null?O=Aa(te,O):(O=Zl(O,y,h,null),O.flags|=2),O.return=c,f.return=c,f.sibling=O,c.child=f,lh(null,f),f=c.child,O=o.child.memoizedState,O===null?O=Ky(h):(y=O.cachePool,y!==null?(H=$s._currentValue,y=y.parent!==H?{parent:H,pool:H}:y):y=Yk(),O={baseLanes:O.baseLanes|h,cachePool:y}),f.memoizedState=O,f.childLanes=Yy(o,C,h),c.memoizedState=Gy,lh(o.child,f)):(Oo(c),h=o.child,o=h.sibling,h=Aa(h,{mode:"visible",children:f.children}),h.return=c,h.sibling=null,o!==null&&(C=c.deletions,C===null?(c.deletions=[o],c.flags|=16):C.push(o)),c.child=h,c.memoizedState=null,h)}function Qy(o,c){return c=Zp({mode:"visible",children:c},o.mode),c.return=o,o.child=c}function Zp(o,c){return o=vr(22,o,null,c),o.lanes=0,o}function Jy(o,c,h){return ac(c,o.child,null,h),o=Qy(c,c.pendingProps.children),o.flags|=2,c.memoizedState=null,o}function lS(o,c,h){o.lanes|=c;var f=o.alternate;f!==null&&(f.lanes|=c),hy(o.return,c,h)}function Xy(o,c,h,f,y,w){var C=o.memoizedState;C===null?o.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:f,tail:h,tailMode:y,treeForkCount:w}:(C.isBackwards=c,C.rendering=null,C.renderingStartTime=0,C.last=f,C.tail=h,C.tailMode=y,C.treeForkCount=w)}function cS(o,c,h){var f=c.pendingProps,y=f.revealOrder,w=f.tail;f=f.children;var C=Ps.current,O=(C&2)!==0;if(O?(C=C&1|2,c.flags|=128):C&=1,pe(Ps,C),fn(o,c,f,h),f=At?Yu:0,!O&&o!==null&&(o.flags&128)!==0)e:for(o=c.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&lS(o,h,c);else if(o.tag===19)lS(o,h,c);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===c)break e;for(;o.sibling===null;){if(o.return===null||o.return===c)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(y){case"forwards":for(h=c.child,y=null;h!==null;)o=h.alternate,o!==null&&Vp(o)===null&&(y=h),h=h.sibling;h=y,h===null?(y=c.child,c.child=null):(y=h.sibling,h.sibling=null),Xy(c,!1,y,h,w,f);break;case"backwards":case"unstable_legacy-backwards":for(h=null,y=c.child,c.child=null;y!==null;){if(o=y.alternate,o!==null&&Vp(o)===null){c.child=y;break}o=y.sibling,y.sibling=h,h=y,y=o}Xy(c,!0,h,null,w,f);break;case"together":Xy(c,!1,null,null,void 0,f);break;default:c.memoizedState=null}return c.child}function Pa(o,c,h){if(o!==null&&(c.dependencies=o.dependencies),Io|=c.lanes,(h&c.childLanes)===0)if(o!==null){if(bd(o,c,h,!1),(h&c.childLanes)===0)return null}else return null;if(o!==null&&c.child!==o.child)throw Error(r(153));if(c.child!==null){for(o=c.child,h=Aa(o,o.pendingProps),c.child=h,h.return=c;o.sibling!==null;)o=o.sibling,h=h.sibling=Aa(o,o.pendingProps),h.return=c;h.sibling=null}return c.child}function Zy(o,c){return(o.lanes&c)!==0?!0:(o=o.dependencies,!!(o!==null&&Rp(o)))}function HP(o,c,h){switch(c.tag){case 3:ge(c,c.stateNode.containerInfo),Eo(c,$s,o.memoizedState.cache),ec();break;case 27:case 5:Me(c);break;case 4:ge(c,c.stateNode.containerInfo);break;case 10:Eo(c,c.type,c.memoizedProps.value);break;case 31:if(c.memoizedState!==null)return c.flags|=128,ky(c),null;break;case 13:var f=c.memoizedState;if(f!==null)return f.dehydrated!==null?(Oo(c),c.flags|=128,null):(h&c.child.childLanes)!==0?oS(o,c,h):(Oo(c),o=Pa(o,c,h),o!==null?o.sibling:null);Oo(c);break;case 19:var y=(o.flags&128)!==0;if(f=(h&c.childLanes)!==0,f||(bd(o,c,h,!1),f=(h&c.childLanes)!==0),y){if(f)return cS(o,c,h);c.flags|=128}if(y=c.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),pe(Ps,Ps.current),f)break;return null;case 22:return c.lanes=0,tS(o,c,h,c.pendingProps);case 24:Eo(c,$s,o.memoizedState.cache)}return Pa(o,c,h)}function dS(o,c,h){if(o!==null)if(o.memoizedProps!==c.pendingProps)zs=!0;else{if(!Zy(o,h)&&(c.flags&128)===0)return zs=!1,HP(o,c,h);zs=(o.flags&131072)!==0}else zs=!1,At&&(c.flags&1048576)!==0&&Fk(c,Yu,c.index);switch(c.lanes=0,c.tag){case 16:e:{var f=c.pendingProps;if(o=rc(c.elementType),c.type=o,typeof o=="function")ry(o)?(f=lc(o,f),c.tag=1,c=iS(null,c,o,f,h)):(c.tag=0,c=Wy(null,c,o,f,h));else{if(o!=null){var y=o.$$typeof;if(y===_){c.tag=11,c=X2(null,c,o,f,h);break e}else if(y===L){c.tag=14,c=Z2(null,c,o,f,h);break e}}throw c=P(o)||o,Error(r(306,c,""))}}return c;case 0:return Wy(o,c,c.type,c.pendingProps,h);case 1:return f=c.type,y=lc(f,c.pendingProps),iS(o,c,f,y,h);case 3:e:{if(ge(c,c.stateNode.containerInfo),o===null)throw Error(r(387));f=c.pendingProps;var w=c.memoizedState;y=w.element,yy(o,c),nh(c,f,null,h);var C=c.memoizedState;if(f=C.cache,Eo(c,$s,f),f!==w.cache&&my(c,[$s],h,!0),sh(),f=C.element,w.isDehydrated)if(w={element:f,isDehydrated:!1,cache:C.cache},c.updateQueue.baseState=w,c.memoizedState=w,c.flags&256){c=aS(o,c,f,h);break e}else if(f!==y){y=Hr(Error(r(424)),c),Qu(y),c=aS(o,c,f,h);break e}else for(o=c.stateNode.containerInfo,o.nodeType===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,es=Yr(o.firstChild),mn=c,At=!0,Co=null,Gr=!0,h=t2(c,null,f,h),c.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling;else{if(ec(),f===y){c=Pa(o,c,h);break e}fn(o,c,f,h)}c=c.child}return c;
vendor: 5,064 bytes, line 8
8case 26:return Xp(o,c),o===null?(h=wC(c.type,null,c.pendingProps,null))?c.memoizedState=h:At||(h=c.type,o=c.pendingProps,f=xf(D.current).createElement(h),f[ms]=c,f[Jt]=o,xn(f,h,o),lt(f),c.stateNode=f):c.memoizedState=wC(c.type,o.memoizedProps,c.pendingProps,o.memoizedState),null;case 27:return Me(c),o===null&&At&&(f=c.stateNode=bC(c.type,c.pendingProps,D.current),mn=c,Gr=!0,y=es,Vo(c.type)?(O0=y,es=Yr(f.firstChild)):es=y),fn(o,c,c.pendingProps.children,h),Xp(o,c),o===null&&(c.flags|=4194304),c.child;case 5:return o===null&&At&&((y=f=es)&&(f=vI(f,c.type,c.pendingProps,Gr),f!==null?(c.stateNode=f,mn=c,es=Yr(f.firstChild),Gr=!1,y=!0):y=!1),y||To(c)),Me(c),y=c.type,w=c.pendingProps,C=o!==null?o.memoizedProps:null,f=w.children,T0(y,w)?f=null:C!==null&&T0(y,C)&&(c.flags|=32),c.memoizedState!==null&&(y=Cy(o,c,PP,null,null,h),Nh._currentValue=y),Xp(o,c),fn(o,c,f,h),c.child;case 6:return o===null&&At&&((o=h=es)&&(h=wI(h,c.pendingProps,Gr),h!==null?(c.stateNode=h,mn=c,es=null,o=!0):o=!1),o||To(c)),null;case 13:return oS(o,c,h);case 4:return ge(c,c.stateNode.containerInfo),f=c.pendingProps,o===null?c.child=ac(c,null,f,h):fn(o,c,f,h),c.child;case 11:return X2(o,c,c.type,c.pendingProps,h);case 7:return fn(o,c,c.pendingProps,h),c.child;case 8:return fn(o,c,c.pendingProps.children,h),c.child;case 12:return fn(o,c,c.pendingProps.children,h),c.child;case 10:return f=c.pendingProps,Eo(c,c.type,f.value),fn(o,c,f.children,h),c.child;case 9:return y=c.type._context,f=c.pendingProps.children,sc(c),y=pn(y),f=f(y),c.flags|=1,fn(o,c,f,h),c.child;case 14:return Z2(o,c,c.type,c.pendingProps,h);case 15:return eS(o,c,c.type,c.pendingProps,h);case 19:return cS(o,c,h);case 31:return UP(o,c,h);case 22:return tS(o,c,h,c.pendingProps);case 24:return sc(c),f=pn($s),o===null?(y=xy(),y===null&&(y=Ht,w=py(),y.pooledCache=w,w.refCount++,w!==null&&(y.pooledCacheLanes|=h),y=w),c.memoizedState={parent:f,cache:y},by(c),Eo(c,$s,y)):((o.lanes&h)!==0&&(yy(o,c),nh(c,null,null,h),sh()),y=o.memoizedState,w=c.memoizedState,y.parent!==f?(y={parent:f,cache:f},c.memoizedState=y,c.lanes===0&&(c.memoizedState=c.updateQueue.baseState=y),Eo(c,$s,f)):(f=w.cache,Eo(c,$s,f),f!==y.cache&&my(c,[$s],h,!0))),fn(o,c,c.pendingProps.children,h),c.child;case 29:throw c.pendingProps}throw Error(r(156,c.tag))}function Ia(o){o.flags|=4}function e0(o,c,h,f,y){if((c=(o.mode&32)!==0)&&(c=!1),c){if(o.flags|=16777216,(y&335544128)===y)if(o.stateNode.complete)o.flags|=8192;else if(LS())o.flags|=8192;else throw ic=Lp,gy}else o.flags&=-16777217}function uS(o,c){if(c.type!=="stylesheet"||(c.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!CC(c))if(LS())o.flags|=8192;else throw ic=Lp,gy}function ef(o,c){c!==null&&(o.flags|=4),o.flags&16384&&(c=o.tag!==22?Br():536870912,o.lanes|=c,Md|=c)}function ch(o,c){if(!At)switch(o.tailMode){case"hidden":c=o.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?o.tail=null:h.sibling=null;break;case"collapsed":h=o.tail;for(var f=null;h!==null;)h.alternate!==null&&(f=h),h=h.sibling;f===null?c||o.tail===null?o.tail=null:o.tail.sibling=null:f.sibling=null}}function ts(o){var c=o.alternate!==null&&o.alternate.child===o.child,h=0,f=0;if(c)for(var y=o.child;y!==null;)h|=y.lanes|y.childLanes,f|=y.subtreeFlags&65011712,f|=y.flags&65011712,y.return=o,y=y.sibling;else for(y=o.child;y!==null;)h|=y.lanes|y.childLanes,f|=y.subtreeFlags,f|=y.flags,y.return=o,y=y.sibling;return o.subtreeFlags|=f,o.childLanes=h,c}function qP(o,c,h){var f=c.pendingProps;switch(ly(c),c.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ts(c),null;case 1:return ts(c),null;case 3:return h=c.stateNode,f=null,o!==null&&(f=o.memoizedState.cache),c.memoizedState.cache!==f&&(c.flags|=2048),Oa($s),ue(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(o===null||o.child===null)&&(gd(c)?Ia(c):o===null||o.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,dy())),ts(c),null;case 26:var y=c.type,w=c.memoizedState;return o===null?(Ia(c),w!==null?(ts(c),uS(c,w)):(ts(c),e0(c,y,null,f,h))):w?w!==o.memoizedState?(Ia(c),ts(c),uS(c,w)):(ts(c),c.flags&=-16777217):(o=o.memoizedProps,o!==f&&Ia(c),ts(c),e0(c,y,o,f,h)),null;case 27:if(We(c),h=D.current,y=c.type,o!==null&&c.stateNode!=null)o.memoizedProps!==f&&Ia(c);else{if(!f){if(c.stateNode===null)throw Error(r(166));return ts(c),null}o=Oe.current,gd(c)?Hk(c):(o=bC(y,f,h),c.stateNode=o,Ia(c))}return ts(c),null;case 5:if(We(c),y=c.type,o!==null&&c.stateNode!=null)o.memoizedProps!==f&&Ia(c);else{if(!f){if(c.stateNode===null)throw Error(r(166));return ts(c),null}if(w=Oe.current,gd(c))Hk(c);else{var C=xf(D.current);switch(w){case 1:w=C.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:w=C.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":w=C.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":w=C.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":w=C.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;
vendor: 26,902 bytes, line 8
8case"select":w=typeof f.is=="string"?C.createElement("select",{is:f.is}):C.createElement("select"),f.multiple?w.multiple=!0:f.size&&(w.size=f.size);break;default:w=typeof f.is=="string"?C.createElement(y,{is:f.is}):C.createElement(y)}}w[ms]=c,w[Jt]=f;e:for(C=c.child;C!==null;){if(C.tag===5||C.tag===6)w.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===c)break e;for(;C.sibling===null;){if(C.return===null||C.return===c)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}c.stateNode=w;e:switch(xn(w,y,f),y){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Ia(c)}}return ts(c),e0(c,c.type,o===null?null:o.memoizedProps,c.pendingProps,h),null;case 6:if(o&&c.stateNode!=null)o.memoizedProps!==f&&Ia(c);else{if(typeof f!="string"&&c.stateNode===null)throw Error(r(166));if(o=D.current,gd(c)){if(o=c.stateNode,h=c.memoizedProps,f=null,y=mn,y!==null)switch(y.tag){case 27:case 5:f=y.memoizedProps}o[ms]=c,o=!!(o.nodeValue===h||f!==null&&f.suppressHydrationWarning===!0||oC(o.nodeValue,h)),o||To(c,!0)}else o=xf(o).createTextNode(f),o[ms]=c,c.stateNode=o}return ts(c),null;case 31:if(h=c.memoizedState,o===null||o.memoizedState!==null){if(f=gd(c),h!==null){if(o===null){if(!f)throw Error(r(318));if(o=c.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[ms]=c}else ec(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;ts(c),o=!1}else h=dy(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=h),o=!0;if(!o)return c.flags&256?(jr(c),c):(jr(c),null);if((c.flags&128)!==0)throw Error(r(558))}return ts(c),null;case 13:if(f=c.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=gd(c),f!==null&&f.dehydrated!==null){if(o===null){if(!y)throw Error(r(318));if(y=c.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[ms]=c}else ec(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;ts(c),y=!1}else y=dy(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return c.flags&256?(jr(c),c):(jr(c),null)}return jr(c),(c.flags&128)!==0?(c.lanes=h,c):(h=f!==null,o=o!==null&&o.memoizedState!==null,h&&(f=c.child,y=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(y=f.alternate.memoizedState.cachePool.pool),w=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(w=f.memoizedState.cachePool.pool),w!==y&&(f.flags|=2048)),h!==o&&h&&(c.child.flags|=8192),ef(c,c.updateQueue),ts(c),null);case 4:return ue(),o===null&&j0(c.stateNode.containerInfo),ts(c),null;case 10:return Oa(c.type),ts(c),null;case 19:if(le(Ps),f=c.memoizedState,f===null)return ts(c),null;if(y=(c.flags&128)!==0,w=f.rendering,w===null)if(y)ch(f,!1);else{if(ks!==0||o!==null&&(o.flags&128)!==0)for(o=c.child;o!==null;){if(w=Vp(o),w!==null){for(c.flags|=128,ch(f,!1),o=w.updateQueue,c.updateQueue=o,ef(c,o),c.subtreeFlags=0,o=h,h=c.child;h!==null;)Bk(h,o),h=h.sibling;return pe(Ps,Ps.current&1|2),At&&Ma(c,f.treeForkCount),c.child}o=o.sibling}f.tail!==null&&js()>af&&(c.flags|=128,y=!0,ch(f,!1),c.lanes=4194304)}else{if(!y)if(o=Vp(w),o!==null){if(c.flags|=128,y=!0,o=o.updateQueue,c.updateQueue=o,ef(c,o),ch(f,!0),f.tail===null&&f.tailMode==="hidden"&&!w.alternate&&!At)return ts(c),null}else 2*js()-f.renderingStartTime>af&&h!==536870912&&(c.flags|=128,y=!0,ch(f,!1),c.lanes=4194304);f.isBackwards?(w.sibling=c.child,c.child=w):(o=f.last,o!==null?o.sibling=w:c.child=w,f.last=w)}return f.tail!==null?(o=f.tail,f.rendering=o,f.tail=o.sibling,f.renderingStartTime=js(),o.sibling=null,h=Ps.current,pe(Ps,y?h&1|2:h&1),At&&Ma(c,f.treeForkCount),o):(ts(c),null);case 22:case 23:return jr(c),Ny(),f=c.memoizedState!==null,o!==null?o.memoizedState!==null!==f&&(c.flags|=8192):f&&(c.flags|=8192),f?(h&536870912)!==0&&(c.flags&128)===0&&(ts(c),c.subtreeFlags&6&&(c.flags|=8192)):ts(c),h=c.updateQueue,h!==null&&ef(c,h.retryQueue),h=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),f=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(f=c.memoizedState.cachePool.pool),f!==h&&(c.flags|=2048),o!==null&&le(nc),null;case 24:return h=null,o!==null&&(h=o.memoizedState.cache),c.memoizedState.cache!==h&&(c.flags|=2048),Oa($s),ts(c),null;case 25:return null;case 30:return null}throw Error(r(156,c.tag))}function WP(o,c){switch(ly(c),c.tag){case 1:return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 3:return Oa($s),ue(),o=c.flags,(o&65536)!==0&&(o&128)===0?(c.flags=o&-65537|128,c):null;case 26:case 27:case 5:return We(c),null;case 31:if(c.memoizedState!==null){if(jr(c),c.alternate===null)throw Error(r(340));ec()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 13:if(jr(c),o=c.memoizedState,o!==null&&o.dehydrated!==null){if(c.alternate===null)throw Error(r(340));ec()}return o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 19:return le(Ps),null;case 4:return ue(),null;case 10:return Oa(c.type),null;case 22:case 23:return jr(c),Ny(),o!==null&&le(nc),o=c.flags,o&65536?(c.flags=o&-65537|128,c):null;case 24:return Oa($s),null;case 25:return null;default:return null}}function hS(o,c){switch(ly(c),c.tag){case 3:Oa($s),ue();break;case 26:case 27:case 5:We(c);break;case 4:ue();break;case 31:c.memoizedState!==null&&jr(c);break;case 13:jr(c);break;case 19:le(Ps);break;case 10:Oa(c.type);break;case 22:case 23:jr(c),Ny(),o!==null&&le(nc);break;case 24:Oa($s)}}function dh(o,c){try{var h=c.updateQueue,f=h!==null?h.lastEffect:null;if(f!==null){var y=f.next;h=y;do{if((h.tag&o)===o){f=void 0;var w=h.create,C=h.inst;f=w(),C.destroy=f}h=h.next}while(h!==y)}}catch(O){Lt(c,c.return,O)}}function Do(o,c,h){try{var f=c.updateQueue,y=f!==null?f.lastEffect:null;if(y!==null){var w=y.next;f=w;do{if((f.tag&o)===o){var C=f.inst,O=C.destroy;if(O!==void 0){C.destroy=void 0,y=c;var H=h,te=O;try{te()}catch(me){Lt(y,H,me)}}}f=f.next}while(f!==w)}}catch(me){Lt(c,c.return,me)}}function mS(o){var c=o.updateQueue;if(c!==null){var h=o.stateNode;try{n2(c,h)}catch(f){Lt(o,o.return,f)}}}function pS(o,c,h){h.props=lc(o.type,o.memoizedProps),h.state=o.memoizedState;try{h.componentWillUnmount()}catch(f){Lt(o,c,f)}}function uh(o,c){try{var h=o.ref;if(h!==null){switch(o.tag){case 26:case 27:case 5:var f=o.stateNode;break;case 30:f=o.stateNode;break;default:f=o.stateNode}typeof h=="function"?o.refCleanup=h(f):h.current=f}}catch(y){Lt(o,c,y)}}function Wi(o,c){var h=o.ref,f=o.refCleanup;if(h!==null)if(typeof f=="function")try{f()}catch(y){Lt(o,c,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(y){Lt(o,c,y)}else h.current=null}function fS(o){var c=o.type,h=o.memoizedProps,f=o.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":h.autoFocus&&f.focus();break e;case"img":h.src?f.src=h.src:h.srcSet&&(f.srcset=h.srcSet)}}catch(y){Lt(o,o.return,y)}}function t0(o,c,h){try{var f=o.stateNode;pI(f,o.type,h,c),f[Jt]=c}catch(y){Lt(o,o.return,y)}}function xS(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Vo(o.type)||o.tag===4}function s0(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||xS(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Vo(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function n0(o,c,h){var f=o.tag;if(f===5||f===6)o=o.stateNode,c?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(o,c):(c=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,c.appendChild(o),h=h._reactRootContainer,h!=null||c.onclick!==null||(c.onclick=Mn));else if(f!==4&&(f===27&&Vo(o.type)&&(h=o.stateNode,c=null),o=o.child,o!==null))for(n0(o,c,h),o=o.sibling;o!==null;)n0(o,c,h),o=o.sibling}function tf(o,c,h){var f=o.tag;if(f===5||f===6)o=o.stateNode,c?h.insertBefore(o,c):h.appendChild(o);else if(f!==4&&(f===27&&Vo(o.type)&&(h=o.stateNode),o=o.child,o!==null))for(tf(o,c,h),o=o.sibling;o!==null;)tf(o,c,h),o=o.sibling}function gS(o){var c=o.stateNode,h=o.memoizedProps;try{for(var f=o.type,y=c.attributes;y.length;)c.removeAttributeNode(y[0]);xn(c,f,h),c[ms]=o,c[Jt]=h}catch(w){Lt(o,o.return,w)}}var La=!1,Vs=!1,r0=!1,bS=typeof WeakSet=="function"?WeakSet:Set,on=null;function GP(o,c){if(o=o.containerInfo,S0=Nf,o=Mk(o),Jb(o)){if("selectionStart"in o)var h={start:o.selectionStart,end:o.selectionEnd};else e:{h=(h=o.ownerDocument)&&h.defaultView||window;var f=h.getSelection&&h.getSelection();if(f&&f.rangeCount!==0){h=f.anchorNode;var y=f.anchorOffset,w=f.focusNode;f=f.focusOffset;try{h.nodeType,w.nodeType}catch{h=null;break e}var C=0,O=-1,H=-1,te=0,me=0,ye=o,re=null;t:for(;;){for(var de;ye!==h||y!==0&&ye.nodeType!==3||(O=C+y),ye!==w||f!==0&&ye.nodeType!==3||(H=C+f),ye.nodeType===3&&(C+=ye.nodeValue.length),(de=ye.firstChild)!==null;)re=ye,ye=de;for(;;){if(ye===o)break t;if(re===h&&++te===y&&(O=C),re===w&&++me===f&&(H=C),(de=ye.nextSibling)!==null)break;ye=re,re=ye.parentNode}ye=de}h=O===-1||H===-1?null:{start:O,end:H}}else h=null}h=h||{start:0,end:0}}else h=null;for(C0={focusedElem:o,selectionRange:h},Nf=!1,on=c;on!==null;)if(c=on,o=c.child,(c.subtreeFlags&1028)!==0&&o!==null)o.return=c,on=o;else for(;on!==null;){switch(c=on,w=c.alternate,o=c.flags,c.tag){case 0:if((o&4)!==0&&(o=c.updateQueue,o=o!==null?o.events:null,o!==null))for(h=0;h<o.length;h++)y=o[h],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&w!==null){o=void 0,h=c,y=w.memoizedProps,w=w.memoizedState,f=h.stateNode;try{var qe=lc(h.type,y);o=f.getSnapshotBeforeUpdate(qe,w),f.__reactInternalSnapshotBeforeUpdate=o}catch(Ze){Lt(h,h.return,Ze)}}break;case 3:if((o&1024)!==0){if(o=c.stateNode.containerInfo,h=o.nodeType,h===9)A0(o);else if(h===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":A0(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=c.sibling,o!==null){o.return=c.return,on=o;break}on=c.return}}function yS(o,c,h){var f=h.flags;switch(h.tag){case 0:case 11:case 15:Ba(o,h),f&4&&dh(5,h);break;case 1:if(Ba(o,h),f&4)if(o=h.stateNode,c===null)try{o.componentDidMount()}catch(C){Lt(h,h.return,C)}else{var y=lc(h.type,c.memoizedProps);c=c.memoizedState;try{o.componentDidUpdate(y,c,o.__reactInternalSnapshotBeforeUpdate)}catch(C){Lt(h,h.return,C)}}f&64&&mS(h),f&512&&uh(h,h.return);break;case 3:if(Ba(o,h),f&64&&(o=h.updateQueue,o!==null)){if(c=null,h.child!==null)switch(h.child.tag){case 27:case 5:c=h.child.stateNode;break;case 1:c=h.child.stateNode}try{n2(o,c)}catch(C){Lt(h,h.return,C)}}break;case 27:c===null&&f&4&&gS(h);case 26:case 5:Ba(o,h),c===null&&f&4&&fS(h),f&512&&uh(h,h.return);break;case 12:Ba(o,h);break;case 31:Ba(o,h),f&4&&jS(o,h);break;case 13:Ba(o,h),f&4&&NS(o,h),f&64&&(o=h.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(h=sI.bind(null,h),jI(o,h))));break;case 22:if(f=h.memoizedState!==null||La,!f){c=c!==null&&c.memoizedState!==null||Vs,y=La;var w=Vs;La=f,(Vs=c)&&!w?za(o,h,(h.subtreeFlags&8772)!==0):Ba(o,h),La=y,Vs=w}break;case 30:break;default:Ba(o,h)}}function vS(o){var c=o.alternate;c!==null&&(o.alternate=null,vS(c)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(c=o.stateNode,c!==null&&Ue(c)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var ls=null,ir=!1;function $a(o,c,h){for(h=h.child;h!==null;)wS(o,c,h),h=h.sibling}function wS(o,c,h){if(we&&typeof we.onCommitFiberUnmount=="function")try{we.onCommitFiberUnmount(Ks,h)}catch{}switch(h.tag){case 26:Vs||Wi(h,c),$a(o,c,h),h.memoizedState?h.memoizedState.count--:h.stateNode&&(h=h.stateNode,h.parentNode.removeChild(h));break;case 27:Vs||Wi(h,c);var f=ls,y=ir;Vo(h.type)&&(ls=h.stateNode,ir=!1),$a(o,c,h),vh(h.stateNode),ls=f,ir=y;break;case 5:Vs||Wi(h,c);case 6:if(f=ls,y=ir,ls=null,$a(o,c,h),ls=f,ir=y,ls!==null)if(ir)try{(ls.nodeType===9?ls.body:ls.nodeName==="HTML"?ls.ownerDocument.body:ls).removeChild(h.stateNode)}catch(w){Lt(h,c,w)}else try{ls.removeChild(h.stateNode)}catch(w){Lt(h,c,w)}break;case 18:ls!==null&&(ir?(o=ls,mC(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,h.stateNode),$d(o)):mC(ls,h.stateNode));break;case 4:f=ls,y=ir,ls=h.stateNode.containerInfo,ir=!0,$a(o,c,h),ls=f,ir=y;break;case 0:case 11:case 14:case 15:Do(2,h,c),Vs||Do(4,h,c),$a(o,c,h);break;case 1:Vs||(Wi(h,c),f=h.stateNode,typeof f.componentWillUnmount=="function"&&pS(h,c,f)),$a(o,c,h);break;case 21:$a(o,c,h);break;case 22:Vs=(f=Vs)||h.memoizedState!==null,$a(o,c,h),Vs=f;break;default:$a(o,c,h)}}function jS(o,c){if(c.memoizedState===null&&(o=c.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{$d(o)}catch(h){Lt(c,c.return,h)}}}function NS(o,c){if(c.memoizedState===null&&(o=c.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{$d(o)}catch(h){Lt(c,c.return,h)}}function KP(o){switch(o.tag){case 31:case 13:case 19:var c=o.stateNode;return c===null&&(c=o.stateNode=new bS),c;case 22:return o=o.stateNode,c=o._retryCache,c===null&&(c=o._retryCache=new bS),c;default:throw Error(r(435,o.tag))}}function sf(o,c){var h=KP(o);c.forEach(function(f){if(!h.has(f)){h.add(f);var y=nI.bind(null,o,f);f.then(y,y)}})}function ar(o,c){var h=c.deletions;if(h!==null)for(var f=0;f<h.length;f++){var y=h[f],w=o,C=c,O=C;e:for(;O!==null;){switch(O.tag){case 27:if(Vo(O.type)){ls=O.stateNode,ir=!1;break e}break;case 5:ls=O.stateNode,ir=!1;break e;case 3:case 4:ls=O.stateNode.containerInfo,ir=!0;break e}O=O.return}if(ls===null)throw Error(r(160));wS(w,C,y),ls=null,ir=!1,w=y.alternate,w!==null&&(w.return=null),y.return=null}if(c.subtreeFlags&13886)for(c=c.child;c!==null;)kS(c,o),c=c.sibling}var xi=null;function kS(o,c){var h=o.alternate,f=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:ar(c,o),or(o),f&4&&(Do(3,o,o.return),dh(3,o),Do(5,o,o.return));break;case 1:ar(c,o),or(o),f&512&&(Vs||h===null||Wi(h,h.return)),f&64&&La&&(o=o.updateQueue,o!==null&&(f=o.callbacks,f!==null&&(h=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=h===null?f:h.concat(f))));break;case 26:var y=xi;if(ar(c,o),or(o),f&512&&(Vs||h===null||Wi(h,h.return)),f&4){var w=h!==null?h.memoizedState:null;if(f=o.memoizedState,h===null)if(f===null)if(o.stateNode===null){e:{f=o.type,h=o.memoizedProps,y=y.ownerDocument||y;t:switch(f){case"title":w=y.getElementsByTagName("title")[0],(!w||w[rn]||w[ms]||w.namespaceURI==="http://www.w3.org/2000/svg"||w.hasAttribute("itemprop"))&&(w=y.createElement(f),y.head.insertBefore(w,y.querySelector("head > title"))),xn(w,f,h),w[ms]=o,lt(w),f=w;break e;case"link":var C=kC("link","href",y).get(f+(h.href||""));if(C){for(var O=0;O<C.length;O++)if(w=C[O],w.getAttribute("href")===(h.href==null||h.href===""?null:h.href)&&w.getAttribute("rel")===(h.rel==null?null:h.rel)&&w.getAttribute("title")===(h.title==null?null:h.title)&&w.getAttribute("crossorigin")===(h.crossOrigin==null?null:h.crossOrigin)){C.splice(O,1);break t}}w=y.createElement(f),xn(w,f,h),y.head.appendChild(w);break;case"meta":if(C=kC("meta","content",y).get(f+(h.content||""))){for(O=0;O<C.length;O++)if(w=C[O],w.getAttribute("content")===(h.content==null?null:""+h.content)&&w.getAttribute("name")===(h.name==null?null:h.name)&&w.getAttribute("property")===(h.property==null?null:h.property)&&w.getAttribute("http-equiv")===(h.httpEquiv==null?null:h.httpEquiv)&&w.getAttribute("charset")===(h.charSet==null?null:h.charSet)){C.splice(O,1);break t}}w=y.createElement(f),xn(w,f,h),y.head.appendChild(w);break;default:throw Error(r(468,f))}w[ms]=o,lt(w),f=w}o.stateNode=f}else SC(y,o.type,o.stateNode);else o.stateNode=NC(y,f,o.memoizedProps);else w!==f?(w===null?h.stateNode!==null&&(h=h.stateNode,h.parentNode.removeChild(h)):w.count--,f===null?SC(y,o.type,o.stateNode):NC(y,f,o.memoizedProps)):f===null&&o.stateNode!==null&&t0(o,o.memoizedProps,h.memoizedProps)}break;case 27:ar(c,o),or(o),f&512&&(Vs||h===null||Wi(h,h.return)),h!==null&&f&4&&t0(o,o.memoizedProps,h.memoizedProps);break;case 5:if(ar(c,o),or(o),f&512&&(Vs||h===null||Wi(h,h.return)),o.flags&32){y=o.stateNode;try{zr(y,"")}catch(qe){Lt(o,o.return,qe)}}f&4&&o.stateNode!=null&&(y=o.memoizedProps,t0(o,y,h!==null?h.memoizedProps:y)),f&1024&&(r0=!0);break;case 6:if(ar(c,o),or(o),f&4){if(o.stateNode===null)throw Error(r(162));f=o.memoizedProps,h=o.stateNode;try{h.nodeValue=f}catch(qe){Lt(o,o.return,qe)}}break;case 3:if(yf=null,y=xi,xi=gf(c.containerInfo),ar(c,o),xi=y,or(o),f&4&&h!==null&&h.memoizedState.isDehydrated)try{$d(c.containerInfo)}catch(qe){Lt(o,o.return,qe)}r0&&(r0=!1,SS(o));break;case 4:f=xi,xi=gf(o.stateNode.containerInfo),ar(c,o),or(o),xi=f;break;case 12:ar(c,o),or(o);break;case 31:ar(c,o),or(o),f&4&&(f=o.updateQueue,f!==null&&(o.updateQueue=null,sf(o,f)));break;case 13:ar(c,o),or(o),o.child.flags&8192&&o.memoizedState!==null!=(h!==null&&h.memoizedState!==null)&&(rf=js()),f&4&&(f=o.updateQueue,f!==null&&(o.updateQueue=null,sf(o,f)));break;case 22:y=o.memoizedState!==null;var H=h!==null&&h.memoizedState!==null,te=La,me=Vs;if(La=te||y,Vs=me||H,ar(c,o),Vs=me,La=te,or(o),f&8192)e:for(c=o.stateNode,c._visibility=y?c._visibility&-2:c._visibility|1,y&&(h===null||H||La||Vs||cc(o)),h=null,c=o;;){if(c.tag===5||c.tag===26){if(h===null){H=h=c;try{if(w=H.stateNode,y)C=w.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{O=H.stateNode;var ye=H.memoizedProps.style,re=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;O.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(qe){Lt(H,H.return,qe)}}}else if(c.tag===6){if(h===null){H=c;try{H.stateNode.nodeValue=y?"":H.memoizedProps}catch(qe){Lt(H,H.return,qe)}}}else if(c.tag===18){if(h===null){H=c;try{var de=H.stateNode;y?pC(de,!0):pC(H.stateNode,!1)}catch(qe){Lt(H,H.return,qe)}}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===o)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===o)break e;for(;c.sibling===null;){if(c.return===null||c.return===o)break e;h===c&&(h=null),c=c.return}h===c&&(h=null),c.sibling.return=c.return,c=c.sibling}f&4&&(f=o.updateQueue,f!==null&&(h=f.retryQueue,h!==null&&(f.retryQueue=null,sf(o,h))));break;case 19:ar(c,o),or(o),f&4&&(f=o.updateQueue,f!==null&&(o.updateQueue=null,sf(o,f)));break;case 30:break;case 21:break;default:ar(c,o),or(o)}}function or(o){var c=o.flags;if(c&2){try{for(var h,f=o.return;f!==null;){if(xS(f)){h=f;break}f=f.return}if(h==null)throw Error(r(160));switch(h.tag){case 27:var y=h.stateNode,w=s0(o);tf(o,w,y);break;case 5:var C=h.stateNode;h.flags&32&&(zr(C,""),h.flags&=-33);var O=s0(o);tf(o,O,C);break;case 3:case 4:var H=h.stateNode.containerInfo,te=s0(o);n0(o,te,H);break;default:throw Error(r(161))}}catch(me){Lt(o,o.return,me)}o.flags&=-3}c&4096&&(o.flags&=-4097)}function SS(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var c=o;SS(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),o=o.sibling}}function Ba(o,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)yS(o,c.alternate,c),c=c.sibling}function cc(o){for(o=o.child;o!==null;){var c=o;switch(c.tag){case 0:case 11:case 14:case 15:Do(4,c,c.return),cc(c);break;case 1:Wi(c,c.return);var h=c.stateNode;typeof h.componentWillUnmount=="function"&&pS(c,c.return,h),cc(c);break;case 27:vh(c.stateNode);case 26:case 5:Wi(c,c.return),cc(c);break;case 22:c.memoizedState===null&&cc(c);break;case 30:cc(c);break;default:cc(c)}o=o.sibling}}function za(o,c,h){for(h=h&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var f=c.alternate,y=o,w=c,C=w.flags;switch(w.tag){case 0:case 11:case 15:za(y,w,h),dh(4,w);break;case 1:if(za(y,w,h),f=w,y=f.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(te){Lt(f,f.return,te)}if(f=w,y=f.updateQueue,y!==null){var O=f.stateNode;try{var H=y.shared.hiddenCallbacks;if(H!==null)for(y.shared.hiddenCallbacks=null,y=0;y<H.length;y++)s2(H[y],O)}catch(te){Lt(f,f.return,te)}}h&&C&64&&mS(w),uh(w,w.return);break;case 27:gS(w);case 26:case 5:za(y,w,h),h&&f===null&&C&4&&fS(w),uh(w,w.return);break;case 12:za(y,w,h);break;case 31:za(y,w,h),h&&C&4&&jS(y,w);break;case 13:za(y,w,h),h&&C&4&&NS(y,w);break;case 22:w.memoizedState===null&&za(y,w,h),uh(w,w.return);break;case 30:break;default:za(y,w,h)}c=c.sibling}}function i0(o,c){var h=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),o=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(o=c.memoizedState.cachePool.pool),o!==h&&(o!=null&&o.refCount++,h!=null&&Ju(h))}function a0(o,c){o=null,c.alternate!==null&&(o=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==o&&(c.refCount++,o!=null&&Ju(o))}function gi(o,c,h,f){if(c.subtreeFlags&10256)for(c=c.child;c!==null;)CS(o,c,h,f),c=c.sibling}function CS(o,c,h,f){var y=c.flags;switch(c.tag){case 0:case 11:case 15:gi(o,c,h,f),y&2048&&dh(9,c);break;case 1:gi(o,c,h,f);break;case 3:gi(o,c,h,f),y&2048&&(o=null,c.alternate!==null&&(o=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==o&&(c.refCount++,o!=null&&Ju(o)));break;case 12:if(y&2048){gi(o,c,h,f),o=c.stateNode;try{var w=c.memoizedProps,C=w.id,O=w.onPostCommit;typeof O=="function"&&O(C,c.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(H){Lt(c,c.return,H)}}else gi(o,c,h,f);break;case 31:gi(o,c,h,f);break;case 13:gi(o,c,h,f);break;case 23:break;case 22:w=c.stateNode,C=c.alternate,c.memoizedState!==null?w._visibility&2?gi(o,c,h,f):hh(o,c):w._visibility&2?gi(o,c,h,f):(w._visibility|=2,Td(o,c,h,f,(c.subtreeFlags&10256)!==0||!1)),y&2048&&i0(C,c);break;case 24:gi(o,c,h,f),y&2048&&a0(c.alternate,c);break;default:gi(o,c,h,f)}}function Td(o,c,h,f,y){for(y=y&&((c.subtreeFlags&10256)!==0||!1),c=c.child;c!==null;){var w=o,C=c,O=h,H=f,te=C.flags;switch(C.tag){case 0:case 11:case 15:Td(w,C,O,H,y),dh(8,C);break;case 23:break;case 22:var me=C.stateNode;C.memoizedState!==null?me._visibility&2?Td(w,C,O,H,y):hh(w,C):(me._visibility|=2,Td(w,C,O,H,y)),y&&te&2048&&i0(C.alternate,C);break;case 24:Td(w,C,O,H,y),y&&te&2048&&a0(C.alternate,C);break;default:Td(w,C,O,H,y)}c=c.sibling}}function hh(o,c){if(c.subtreeFlags&10256)for(c=c.child;c!==null;){var h=o,f=c,y=f.flags;switch(f.tag){case 22:hh(h,f),y&2048&&i0(f.alternate,f);break;case 24:hh(h,f),y&2048&&a0(f.alternate,f);break;default:hh(h,f)}c=c.sibling}}var mh=8192;function Ed(o,c,h){if(o.subtreeFlags&mh)for(o=o.child;o!==null;)TS(o,c,h),o=o.sibling}function TS(o,c,h){switch(o.tag){case 26:Ed(o,c,h),o.flags&mh&&o.memoizedState!==null&&DI(h,xi,o.memoizedState,o.memoizedProps);break;case 5:Ed(o,c,h);break;case 3:case 4:var f=xi;xi=gf(o.stateNode.containerInfo),Ed(o,c,h),xi=f;break;case 22:o.memoizedState===null&&(f=o.alternate,f!==null&&f.memoizedState!==null?(f=mh,mh=16777216,Ed(o,c,h),mh=f):Ed(o,c,h));break;default:Ed(o,c,h)}}function ES(o){var c=o.alternate;if(c!==null&&(o=c.child,o!==null)){c.child=null;do c=o.sibling,o.sibling=null,o=c;while(o!==null)}}function ph(o){var c=o.deletions;if((o.flags&16)!==0){if(c!==null)for(var h=0;h<c.length;h++){var f=c[h];on=f,MS(f,o)}ES(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)AS(o),o=o.sibling}function AS(o){switch(o.tag){case 0:case 11:case 15:ph(o),o.flags&2048&&Do(9,o,o.return);break;case 3:ph(o);break;case 12:ph(o);break;case 22:var c=o.stateNode;o.memoizedState!==null&&c._visibility&2&&(o.return===null||o.return.tag!==13)?(c._visibility&=-3,nf(o)):ph(o);break;default:ph(o)}}function nf(o){var c=o.deletions;if((o.flags&16)!==0){if(c!==null)for(var h=0;h<c.length;h++){var f=c[h];on=f,MS(f,o)}ES(o)}for(o=o.child;o!==null;){switch(c=o,c.tag){case 0:case 11:case 15:Do(8,c,c.return),nf(c);break;case 22:h=c.stateNode,h._visibility&2&&(h._visibility&=-3,nf(c));break;default:nf(c)}o=o.sibling}}function MS(o,c){for(;on!==null;){var h=on;switch(h.tag){case 0:case 11:case 15:Do(8,h,c);break;case 23:case 22:if(h.memoizedState!==null&&h.memoizedState.cachePool!==null){var f=h.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Ju(h.memoizedState.cache)}if(f=h.child,f!==null)f.return=h,on=f;else e:for(h=o;on!==null;){f=on;var y=f.sibling,w=f.return;if(vS(f),f===h){on=null;break e}if(y!==null){y.return=w,on=y;break e}on=w}}}var YP={getCacheForType:function(o){var c=pn($s),h=c.data.get(o);return h===void 0&&(h=o(),c.data.set(o,h)),h},cacheSignal:function(){return pn($s).controller.signal}},QP=typeof WeakMap=="function"?WeakMap:Map,Pt=0,Ht=null,jt=null,St=0,It=0,Nr=null,Po=!1,Ad=!1,o0=!1,Va=0,ks=0,Io=0,dc=0,l0=0,kr=0,Md=0,fh=null,lr=null,c0=!1,rf=0,_S=0,af=1/0,of=null,Lo=null,Qs=0,$o=null,_d=null,Fa=0,d0=0,u0=null,OS=null,xh=0,h0=null;function Sr(){return(Pt&2)!==0&&St!==0?St&-St:q.T!==null?b0():Fn()}function RS(){if(kr===0)if((St&536870912)===0||At){var o=gr;gr<<=1,(gr&3932160)===0&&(gr=262144),kr=o}else kr=536870912;return o=wr.current,o!==null&&(o.flags|=32),kr}function cr(o,c,h){(o===Ht&&(It===2||It===9)||o.cancelPendingCommit!==null)&&(Od(o,0),Bo(o,St,kr,!1)),hi(o,h),((Pt&2)===0||o!==Ht)&&(o===Ht&&((Pt&2)===0&&(dc|=h),ks===4&&Bo(o,St,kr,!1)),Gi(o))}function DS(o,c,h){if((Pt&6)!==0)throw Error(r(327));var f=!h&&(c&127)===0&&(c&o.expiredLanes)===0||xa(o,c),y=f?ZP(o,c):p0(o,c,!0),w=f;do{if(y===0){Ad&&!f&&Bo(o,c,0,!1);break}else{if(h=o.current.alternate,w&&!JP(h)){y=p0(o,c,!1),w=!1;continue}if(y===2){if(w=c,o.errorRecoveryDisabledLanes&w)var C=0;else C=o.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){c=C;e:{var O=o;y=fh;var H=O.current.memoizedState.isDehydrated;if(H&&(Od(O,C).flags|=256),C=p0(O,C,!1),C!==2){if(o0&&!H){O.errorRecoveryDisabledLanes|=w,dc|=w,y=4;break e}w=lr,lr=y,w!==null&&(lr===null?lr=w:lr.push.apply(lr,w))}y=C}if(w=!1,y!==2)continue}}if(y===1){Od(o,0),Bo(o,c,0,!0);break}e:{switch(f=o,w=y,w){case 0:case 1:throw Error(r(345));case 4:if((c&4194048)!==c)break;case 6:Bo(f,c,kr,!Po);break e;case 2:lr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((c&62914560)===c&&(y=rf+300-js(),10<y)){if(Bo(f,c,kr,!Po),$r(f,0,!0)!==0)break e;Fa=c,f.timeoutHandle=uC(PS.bind(null,f,h,lr,of,c0,c,kr,dc,Md,Po,w,"Throttled",-0,0),y);break e}PS(f,h,lr,of,c0,c,kr,dc,Md,Po,w,null,-0,0)}}break}while(!0);Gi(o)}function PS(o,c,h,f,y,w,C,O,H,te,me,ye,re,de){if(o.timeoutHandle=-1,ye=c.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Mn},TS(c,w,ye);var qe=(w&62914560)===w?rf-js():(w&4194048)===w?_S-js():0;if(qe=PI(ye,qe),qe!==null){Fa=w,o.cancelPendingCommit=qe(US.bind(null,o,c,w,h,f,y,C,O,H,me,ye,null,re,de)),Bo(o,w,C,!te);return}}US(o,c,w,h,f,y,C,O,H)}function JP(o){for(var c=o;;){var h=c.tag;if((h===0||h===11||h===15)&&c.flags&16384&&(h=c.updateQueue,h!==null&&(h=h.stores,h!==null)))for(var f=0;f<h.length;f++){var y=h[f],w=y.getSnapshot;y=y.value;
vendor: 14,670 bytes, line 8
8try{if(!yr(w(),y))return!1}catch{return!1}}if(h=c.child,c.subtreeFlags&16384&&h!==null)h.return=c,c=h;else{if(c===o)break;for(;c.sibling===null;){if(c.return===null||c.return===o)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function Bo(o,c,h,f){c&=~l0,c&=~dc,o.suspendedLanes|=c,o.pingedLanes&=~c,f&&(o.warmLanes|=c),f=o.expirationTimes;for(var y=c;0<y;){var w=31-Zt(y),C=1<<w;f[w]=-1,y&=~C}h!==0&&yo(o,h,c)}function lf(){return(Pt&6)===0?(gh(0),!1):!0}function m0(){if(jt!==null){if(It===0)var o=jt.return;else o=jt,_a=tc=null,Ay(o),jd=null,Zu=0,o=jt;for(;o!==null;)hS(o.alternate,o),o=o.return;jt=null}}function Od(o,c){var h=o.timeoutHandle;h!==-1&&(o.timeoutHandle=-1,gI(h)),h=o.cancelPendingCommit,h!==null&&(o.cancelPendingCommit=null,h()),Fa=0,m0(),Ht=o,jt=h=Aa(o.current,null),St=c,It=0,Nr=null,Po=!1,Ad=xa(o,c),o0=!1,Md=kr=l0=dc=Io=ks=0,lr=fh=null,c0=!1,(c&8)!==0&&(c|=c&32);var f=o.entangledLanes;if(f!==0)for(o=o.entanglements,f&=c;0<f;){var y=31-Zt(f),w=1<<y;c|=o[y],f&=~w}return Va=c,Ep(),h}function IS(o,c){dt=null,q.H=oh,c===wd||c===Ip?(c=Xk(),It=3):c===gy?(c=Xk(),It=4):It=c===qy?8:c!==null&&typeof c=="object"&&typeof c.then=="function"?6:1,Nr=c,jt===null&&(ks=1,Qp(o,Hr(c,o.current)))}function LS(){var o=wr.current;return o===null?!0:(St&4194048)===St?Kr===null:(St&62914560)===St||(St&536870912)!==0?o===Kr:!1}function $S(){var o=q.H;return q.H=oh,o===null?oh:o}function BS(){var o=q.A;return q.A=YP,o}function cf(){ks=4,Po||(St&4194048)!==St&&wr.current!==null||(Ad=!0),(Io&134217727)===0&&(dc&134217727)===0||Ht===null||Bo(Ht,St,kr,!1)}function p0(o,c,h){var f=Pt;Pt|=2;var y=$S(),w=BS();(Ht!==o||St!==c)&&(of=null,Od(o,c)),c=!1;var C=ks;e:do try{if(It!==0&&jt!==null){var O=jt,H=Nr;switch(It){case 8:m0(),C=6;break e;case 3:case 2:case 9:case 6:wr.current===null&&(c=!0);var te=It;if(It=0,Nr=null,Rd(o,O,H,te),h&&Ad){C=0;break e}break;default:te=It,It=0,Nr=null,Rd(o,O,H,te)}}XP(),C=ks;break}catch(me){IS(o,me)}while(!0);return c&&o.shellSuspendCounter++,_a=tc=null,Pt=f,q.H=y,q.A=w,jt===null&&(Ht=null,St=0,Ep()),C}function XP(){for(;jt!==null;)zS(jt)}function ZP(o,c){var h=Pt;Pt|=2;var f=$S(),y=BS();Ht!==o||St!==c?(of=null,af=js()+500,Od(o,c)):Ad=xa(o,c);e:do try{if(It!==0&&jt!==null){c=jt;var w=Nr;t:switch(It){case 1:It=0,Nr=null,Rd(o,c,w,1);break;case 2:case 9:if(Qk(w)){It=0,Nr=null,VS(c);break}c=function(){It!==2&&It!==9||Ht!==o||(It=7),Gi(o)},w.then(c,c);break e;case 3:It=7;break e;case 4:It=5;break e;case 7:Qk(w)?(It=0,Nr=null,VS(c)):(It=0,Nr=null,Rd(o,c,w,7));break;case 5:var C=null;switch(jt.tag){case 26:C=jt.memoizedState;case 5:case 27:var O=jt;if(C?CC(C):O.stateNode.complete){It=0,Nr=null;var H=O.sibling;if(H!==null)jt=H;else{var te=O.return;te!==null?(jt=te,df(te)):jt=null}break t}}It=0,Nr=null,Rd(o,c,w,5);break;case 6:It=0,Nr=null,Rd(o,c,w,6);break;case 8:m0(),ks=6;break e;default:throw Error(r(462))}}eI();break}catch(me){IS(o,me)}while(!0);return _a=tc=null,q.H=f,q.A=y,Pt=h,jt!==null?0:(Ht=null,St=0,Ep(),ks)}function eI(){for(;jt!==null&&!Di();)zS(jt)}function zS(o){var c=dS(o.alternate,o,Va);o.memoizedProps=o.pendingProps,c===null?df(o):jt=c}function VS(o){var c=o,h=c.alternate;switch(c.tag){case 15:case 0:c=rS(h,c,c.pendingProps,c.type,void 0,St);break;case 11:c=rS(h,c,c.pendingProps,c.type.render,c.ref,St);break;case 5:Ay(c);default:hS(h,c),c=jt=Bk(c,Va),c=dS(h,c,Va)}o.memoizedProps=o.pendingProps,c===null?df(o):jt=c}function Rd(o,c,h,f){_a=tc=null,Ay(c),jd=null,Zu=0;var y=c.return;try{if(FP(o,y,c,h,St)){ks=1,Qp(o,Hr(h,o.current)),jt=null;return}}catch(w){if(y!==null)throw jt=y,w;ks=1,Qp(o,Hr(h,o.current)),jt=null;return}c.flags&32768?(At||f===1?o=!0:Ad||(St&536870912)!==0?o=!1:(Po=o=!0,(f===2||f===9||f===3||f===6)&&(f=wr.current,f!==null&&f.tag===13&&(f.flags|=16384))),FS(c,o)):df(c)}function df(o){var c=o;do{if((c.flags&32768)!==0){FS(c,Po);return}o=c.return;var h=qP(c.alternate,c,Va);if(h!==null){jt=h;return}if(c=c.sibling,c!==null){jt=c;return}jt=c=o}while(c!==null);ks===0&&(ks=5)}function FS(o,c){do{var h=WP(o.alternate,o);if(h!==null){h.flags&=32767,jt=h;return}if(h=o.return,h!==null&&(h.flags|=32768,h.subtreeFlags=0,h.deletions=null),!c&&(o=o.sibling,o!==null)){jt=o;return}jt=o=h}while(o!==null);ks=6,jt=null}function US(o,c,h,f,y,w,C,O,H){o.cancelPendingCommit=null;do uf();while(Qs!==0);if((Pt&6)!==0)throw Error(r(327));if(c!==null){if(c===o.current)throw Error(r(177));if(w=c.lanes|c.childLanes,w|=sy,bo(o,h,w,C,O,H),o===Ht&&(jt=Ht=null,St=0),_d=c,$o=o,Fa=h,d0=w,u0=y,OS=f,(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,rI(xr,function(){return KS(),null})):(o.callbackNode=null,o.callbackPriority=0),f=(c.flags&13878)!==0,(c.subtreeFlags&13878)!==0||f){f=q.T,q.T=null,y=W.p,W.p=2,C=Pt,Pt|=4;try{GP(o,c,h)}finally{Pt=C,W.p=y,q.T=f}}Qs=1,HS(),qS(),WS()}}function HS(){if(Qs===1){Qs=0;var o=$o,c=_d,h=(c.flags&13878)!==0;if((c.subtreeFlags&13878)!==0||h){h=q.T,q.T=null;var f=W.p;W.p=2;var y=Pt;Pt|=4;try{kS(c,o);var w=C0,C=Mk(o.containerInfo),O=w.focusedElem,H=w.selectionRange;if(C!==O&&O&&O.ownerDocument&&Ak(O.ownerDocument.documentElement,O)){if(H!==null&&Jb(O)){var te=H.start,me=H.end;if(me===void 0&&(me=te),"selectionStart"in O)O.selectionStart=te,O.selectionEnd=Math.min(me,O.value.length);else{var ye=O.ownerDocument||document,re=ye&&ye.defaultView||window;if(re.getSelection){var de=re.getSelection(),qe=O.textContent.length,Ze=Math.min(H.start,qe),Vt=H.end===void 0?Ze:Math.min(H.end,qe);!de.extend&&Ze>Vt&&(C=Vt,Vt=Ze,Ze=C);var Q=Ek(O,Ze),K=Ek(O,Vt);if(Q&&K&&(de.rangeCount!==1||de.anchorNode!==Q.node||de.anchorOffset!==Q.offset||de.focusNode!==K.node||de.focusOffset!==K.offset)){var ee=ye.createRange();ee.setStart(Q.node,Q.offset),de.removeAllRanges(),Ze>Vt?(de.addRange(ee),de.extend(K.node,K.offset)):(ee.setEnd(K.node,K.offset),de.addRange(ee))}}}}for(ye=[],de=O;de=de.parentNode;)de.nodeType===1&&ye.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<ye.length;O++){var xe=ye[O];xe.element.scrollLeft=xe.left,xe.element.scrollTop=xe.top}}Nf=!!S0,C0=S0=null}finally{Pt=y,W.p=f,q.T=h}}o.current=c,Qs=2}}function qS(){if(Qs===2){Qs=0;var o=$o,c=_d,h=(c.flags&8772)!==0;if((c.subtreeFlags&8772)!==0||h){h=q.T,q.T=null;var f=W.p;W.p=2;var y=Pt;Pt|=4;try{yS(o,c.alternate,c)}finally{Pt=y,W.p=f,q.T=h}}Qs=3}}function WS(){if(Qs===4||Qs===3){Qs=0,Il();var o=$o,c=_d,h=Fa,f=OS;(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?Qs=5:(Qs=0,_d=$o=null,GS(o,o.pendingLanes));var y=o.pendingLanes;if(y===0&&(Lo=null),rr(h),c=c.stateNode,we&&typeof we.onCommitFiberRoot=="function")try{we.onCommitFiberRoot(Ks,c,void 0,(c.current.flags&128)===128)}catch{}if(f!==null){c=q.T,y=W.p,W.p=2,q.T=null;try{for(var w=o.onRecoverableError,C=0;C<f.length;C++){var O=f[C];w(O.value,{componentStack:O.stack})}}finally{q.T=c,W.p=y}}(Fa&3)!==0&&uf(),Gi(o),y=o.pendingLanes,(h&261930)!==0&&(y&42)!==0?o===h0?xh++:(xh=0,h0=o):xh=0,gh(0)}}function GS(o,c){(o.pooledCacheLanes&=c)===0&&(c=o.pooledCache,c!=null&&(o.pooledCache=null,Ju(c)))}function uf(){return HS(),qS(),WS(),KS()}function KS(){if(Qs!==5)return!1;var o=$o,c=d0;d0=0;var h=rr(Fa),f=q.T,y=W.p;try{W.p=32>h?32:h,q.T=null,h=u0,u0=null;var w=$o,C=Fa;if(Qs=0,_d=$o=null,Fa=0,(Pt&6)!==0)throw Error(r(331));var O=Pt;if(Pt|=4,AS(w.current),CS(w,w.current,C,h),Pt=O,gh(0,!1),we&&typeof we.onPostCommitFiberRoot=="function")try{we.onPostCommitFiberRoot(Ks,w)}catch{}return!0}finally{W.p=y,q.T=f,GS(o,c)}}function YS(o,c,h){c=Hr(h,c),c=Hy(o.stateNode,c,2),o=_o(o,c,2),o!==null&&(hi(o,2),Gi(o))}function Lt(o,c,h){if(o.tag===3)YS(o,o,h);else for(;c!==null;){if(c.tag===3){YS(c,o,h);break}else if(c.tag===1){var f=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Lo===null||!Lo.has(f))){o=Hr(h,o),h=Q2(2),f=_o(c,h,2),f!==null&&(J2(h,f,c,o),hi(f,2),Gi(f));break}}c=c.return}}function f0(o,c,h){var f=o.pingCache;if(f===null){f=o.pingCache=new QP;var y=new Set;f.set(c,y)}else y=f.get(c),y===void 0&&(y=new Set,f.set(c,y));y.has(h)||(o0=!0,y.add(h),o=tI.bind(null,o,c,h),c.then(o,o))}function tI(o,c,h){var f=o.pingCache;f!==null&&f.delete(c),o.pingedLanes|=o.suspendedLanes&h,o.warmLanes&=~h,Ht===o&&(St&h)===h&&(ks===4||ks===3&&(St&62914560)===St&&300>js()-rf?(Pt&2)===0&&Od(o,0):l0|=h,Md===St&&(Md=0)),Gi(o)}function QS(o,c){c===0&&(c=Br()),o=Xl(o,c),o!==null&&(hi(o,c),Gi(o))}function sI(o){var c=o.memoizedState,h=0;c!==null&&(h=c.retryLane),QS(o,h)}function nI(o,c){var h=0;switch(o.tag){case 31:case 13:var f=o.stateNode,y=o.memoizedState;y!==null&&(h=y.retryLane);break;case 19:f=o.stateNode;break;case 22:f=o.stateNode._retryCache;break;default:throw Error(r(314))}f!==null&&f.delete(c),QS(o,h)}function rI(o,c){return Yt(o,c)}var hf=null,Dd=null,x0=!1,mf=!1,g0=!1,zo=0;function Gi(o){o!==Dd&&o.next===null&&(Dd===null?hf=Dd=o:Dd=Dd.next=o),mf=!0,x0||(x0=!0,aI())}function gh(o,c){if(!g0&&mf){g0=!0;do for(var h=!1,f=hf;f!==null;){if(o!==0){var y=f.pendingLanes;if(y===0)var w=0;else{var C=f.suspendedLanes,O=f.pingedLanes;w=(1<<31-Zt(42|o)+1)-1,w&=y&~(C&~O),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(h=!0,eC(f,w))}else w=St,w=$r(f,f===Ht?w:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(w&3)===0||xa(f,w)||(h=!0,eC(f,w));f=f.next}while(h);g0=!1}}function iI(){JS()}function JS(){mf=x0=!1;var o=0;zo!==0&&xI()&&(o=zo);for(var c=js(),h=null,f=hf;f!==null;){var y=f.next,w=XS(f,c);w===0?(f.next=null,h===null?hf=y:h.next=y,y===null&&(Dd=h)):(h=f,(o!==0||(w&3)!==0)&&(mf=!0)),f=y}Qs!==0&&Qs!==5||gh(o),zo!==0&&(zo=0)}function XS(o,c){for(var h=o.suspendedLanes,f=o.pingedLanes,y=o.expirationTimes,w=o.pendingLanes&-62914561;0<w;){var C=31-Zt(w),O=1<<C,H=y[C];H===-1?((O&h)===0||(O&f)!==0)&&(y[C]=Qt(O,c)):H<=c&&(o.expiredLanes|=O),w&=~O}if(c=Ht,h=St,h=$r(o,o===c?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),f=o.callbackNode,h===0||o===c&&(It===2||It===9)||o.cancelPendingCommit!==null)return f!==null&&f!==null&&un(f),o.callbackNode=null,o.callbackPriority=0;if((h&3)===0||xa(o,h)){if(c=h&-h,c===o.callbackPriority)return c;switch(f!==null&&un(f),rr(h)){case 2:case 8:h=Tn;break;case 32:h=xr;break;case 268435456:h=pa;break;default:h=xr}return f=ZS.bind(null,o),h=Yt(h,f),o.callbackPriority=c,o.callbackNode=h,c}return f!==null&&f!==null&&un(f),o.callbackPriority=2,o.callbackNode=null,2}function ZS(o,c){if(Qs!==0&&Qs!==5)return o.callbackNode=null,o.callbackPriority=0,null;var h=o.callbackNode;if(uf()&&o.callbackNode!==h)return null;var f=St;return f=$r(o,o===Ht?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),f===0?null:(DS(o,f,c),XS(o,js()),o.callbackNode!=null&&o.callbackNode===h?ZS.bind(null,o):null)}function eC(o,c){if(uf())return null;DS(o,c,!0)}function aI(){bI(function(){(Pt&6)!==0?Yt(nr,iI):JS()})}function b0(){if(zo===0){var o=yd;o===0&&(o=Li,Li<<=1,(Li&261888)===0&&(Li=256)),zo=o}return zo}function tC(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Vi(""+o)}function sC(o,c){var h=c.ownerDocument.createElement("input");return h.name=c.name,h.value=c.value,o.id&&h.setAttribute("form",o.id),c.parentNode.insertBefore(h,c),o=new FormData(o),h.parentNode.removeChild(h),o}function oI(o,c,h,f,y){if(c==="submit"&&h&&h.stateNode===y){var w=tC((y[Jt]||null).action),C=f.submitter;C&&(c=(c=C[Jt]||null)?tC(c.formAction):C.getAttribute("formAction"),c!==null&&(w=c,C=null));var O=new ld("action","action",null,f,y);o.push({event:O,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(zo!==0){var H=C?sC(y,C):new FormData(y);$y(h,{pending:!0,data:H,method:y.method,action:w},null,H)}}else typeof w=="function"&&(O.preventDefault(),H=C?sC(y,C):new FormData(y),$y(h,{pending:!0,data:H,method:y.method,action:w},w,H))},currentTarget:y}]})}}for(var y0=0;y0<ty.length;y0++){var v0=ty[y0],lI=v0.toLowerCase(),cI=v0[0].toUpperCase()+v0.slice(1);fi(lI,"on"+cI)}fi(Rk,"onAnimationEnd"),fi(Dk,"onAnimationIteration"),fi(Pk,"onAnimationStart"),fi("dblclick","onDoubleClick"),fi("focusin","onFocus"),fi("focusout","onBlur"),fi(SP,"onTransitionRun"),fi(CP,"onTransitionStart"),fi(TP,"onTransitionCancel"),fi(Ik,"onTransitionEnd"),Ds("onMouseEnter",["mouseout","mouseover"]),Ds("onMouseLeave",["mouseout","mouseover"]),Ds("onPointerEnter",["pointerout","pointerover"]),Ds("onPointerLeave",["pointerout","pointerover"]),Ut("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ut("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ut("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ut("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ut("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ut("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bh="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(" "),dI=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bh));function nC(o,c){c=(c&4)!==0;for(var h=0;h<o.length;h++){var f=o[h],y=f.event;f=f.listeners;e:{var w=void 0;if(c)for(var C=f.length-1;0<=C;C--){var O=f[C],H=O.instance,te=O.currentTarget;if(O=O.listener,H!==w&&y.isPropagationStopped())break e;w=O,y.currentTarget=te;try{w(y)}catch(me){Tp(me)}y.currentTarget=null,w=H}else for(C=0;C<f.length;C++){if(O=f[C],H=O.instance,te=O.currentTarget,O=O.listener,H!==w&&y.isPropagationStopped())break e;w=O,y.currentTarget=te;try{w(y)}catch(me){Tp(me)}y.currentTarget=null,w=H}}}}function Nt(o,c){var h=c[ps];h===void 0&&(h=c[ps]=new Set);var f=o+"__bubble";h.has(f)||(rC(c,o,2,!1),h.add(f))}function w0(o,c,h){var f=0;c&&(f|=4),rC(h,o,f,c)}var pf="_reactListening"+Math.random().toString(36).slice(2);function j0(o){if(!o[pf]){o[pf]=!0,as.forEach(function(h){h!=="selectionchange"&&(dI.has(h)||w0(h,!1,o),w0(h,!0,o))});var c=o.nodeType===9?o:o.ownerDocument;c===null||c[pf]||(c[pf]=!0,w0("selectionchange",!1,c))}}function rC(o,c,h,f){switch(RC(c)){case 2:var y=$I;break;case 8:y=BI;break;default:y=L0}h=y.bind(null,c,h,o),y=void 0,!Wl||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(y=!0),f?y!==void 0?o.addEventListener(c,h,{capture:!0,passive:y}):o.addEventListener(c,h,!0):y!==void 0?o.addEventListener(c,h,{passive:y}):o.addEventListener(c,h,!1)}function N0(o,c,h,f,y){var w=f;if((c&1)===0&&(c&2)===0&&f!==null)e:for(;;){if(f===null)return;var C=f.tag;if(C===3||C===4){var O=f.stateNode.containerInfo;
vendor: 2,751 bytes, line 8
8if(O===y)break;if(C===4)for(C=f.return;C!==null;){var H=C.tag;if((H===3||H===4)&&C.stateNode.containerInfo===y)return;C=C.return}for(;O!==null;){if(C=F(O),C===null)return;if(H=C.tag,H===5||H===6||H===26||H===27){f=w=C;continue e}O=O.parentNode}}f=f.return}Hl(function(){var te=w,me=id(h),ye=[];e:{var re=Lk.get(o);if(re!==void 0){var de=ld,qe=o;switch(o){case"keypress":if(Gl(h)===0)break e;case"keydown":case"keyup":de=Ee;break;case"focusin":qe="focus",de=Ui;break;case"focusout":qe="blur",de=Ui;break;case"beforeblur":case"afterblur":de=Ui;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=jp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=No;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=kt;break;case Rk:case Dk:case Pk:de=qb;break;case Ik:de=Fr;break;case"scroll":case"scrollend":de=Hb;break;case"wheel":de=ko;break;case"copy":case"cut":case"paste":de=Np;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=rt;break;case"toggle":case"beforetoggle":de=Gb}var Ze=(c&4)!==0,Vt=!Ze&&(o==="scroll"||o==="scrollend"),Q=Ze?re!==null?re+"Capture":null:re;Ze=[];for(var K=te,ee;K!==null;){var xe=K;if(ee=xe.stateNode,xe=xe.tag,xe!==5&&xe!==26&&xe!==27||ee===null||Q===null||(xe=ql(K,Q),xe!=null&&Ze.push(yh(K,xe,ee))),Vt)break;K=K.return}0<Ze.length&&(re=new de(re,qe,null,h,me),ye.push({event:re,listeners:Ze}))}}if((c&7)===0){e:{if(re=o==="mouseover"||o==="pointerover",de=o==="mouseout"||o==="pointerout",re&&h!==ja&&(qe=h.relatedTarget||h.fromElement)&&(F(qe)||qe[En]))break e;if((de||re)&&(re=me.window===me?me:(re=me.ownerDocument)?re.defaultView||re.parentWindow:window,de?(qe=h.relatedTarget||h.toElement,de=te,qe=qe?F(qe):null,qe!==null&&(Vt=a(qe),Ze=qe.tag,qe!==Vt||Ze!==5&&Ze!==27&&Ze!==6)&&(qe=null)):(de=null,qe=te),de!==qe)){if(Ze=jp,xe="onMouseLeave",Q="onMouseEnter",K="mouse",(o==="pointerout"||o==="pointerover")&&(Ze=rt,xe="onPointerLeave",Q="onPointerEnter",K="pointer"),Vt=de==null?re:Ie(de),ee=qe==null?re:Ie(qe),re=new Ze(xe,K+"leave",de,h,me),re.target=Vt,re.relatedTarget=ee,xe=null,F(me)===te&&(Ze=new Ze(Q,K+"enter",qe,h,me),Ze.target=ee,Ze.relatedTarget=Vt,xe=Ze),Vt=xe,de&&qe)t:{for(Ze=uI,Q=de,K=qe,ee=0,xe=Q;xe;xe=Ze(xe))ee++;xe=0;for(var Je=K;Je;Je=Ze(Je))xe++;for(;0<ee-xe;)Q=Ze(Q),ee--;for(;0<xe-ee;)K=Ze(K),xe--;for(;ee--;){if(Q===K||K!==null&&Q===K.alternate){Ze=Q;break t}Q=Ze(Q),K=Ze(K)}Ze=null}else Ze=null;de!==null&&iC(ye,re,de,Ze,!1),qe!==null&&Vt!==null&&iC(ye,Vt,qe,Ze,!0)}}
vendor: 1,860 bytes, line 8
8e:{if(re=te?Ie(te):window,de=re.nodeName&&re.nodeName.toLowerCase(),de==="select"||de==="input"&&re.type==="file")var Rt=jk;else if(vk(re))if(Nk)Rt=jP;else{Rt=vP;var Ke=yP}else de=re.nodeName,!de||de.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?te&&Lu(te.elementType)&&(Rt=jk):Rt=wP;if(Rt&&(Rt=Rt(o,te))){wk(ye,Rt,h,me);break e}Ke&&Ke(o,re,te),o==="focusout"&&te&&re.type==="number"&&te.memoizedProps.value!=null&&Fl(re,"number",re.value)}switch(Ke=te?Ie(te):window,o){case"focusin":(vk(Ke)||Ke.contentEditable==="true")&&(ud=Ke,Xb=te,Ku=null);break;case"focusout":Ku=Xb=ud=null;break;case"mousedown":Zb=!0;break;case"contextmenu":case"mouseup":case"dragend":Zb=!1,_k(ye,h,me);break;case"selectionchange":if(kP)break;case"keydown":case"keyup":_k(ye,h,me)}var mt;if(Uu)e:{switch(o){case"compositionstart":var Ct="onCompositionStart";break e;case"compositionend":Ct="onCompositionEnd";break e;case"compositionupdate":Ct="onCompositionUpdate";break e}Ct=void 0}else dd?bk(o,h)&&(Ct="onCompositionEnd"):o==="keydown"&&h.keyCode===229&&(Ct="onCompositionStart");Ct&&(fk&&h.locale!=="ko"&&(dd||Ct!=="onCompositionStart"?Ct==="onCompositionEnd"&&dd&&(mt=wp()):(pi=me,Fi="value"in pi?pi.value:pi.textContent,dd=!0)),Ke=ff(te,Ct),0<Ke.length&&(Ct=new Sp(Ct,o,null,h,me),ye.push({event:Ct,listeners:Ke}),mt?Ct.data=mt:(mt=yk(h),mt!==null&&(Ct.data=mt)))),(mt=pP?fP(o,h):xP(o,h))&&(Ct=ff(te,"onBeforeInput"),0<Ct.length&&(Ke=new Sp("onBeforeInput","beforeinput",null,h,me),ye.push({event:Ke,listeners:Ct}),Ke.data=mt)),oI(ye,o,te,h,me)}nC(ye,c)})}function yh(o,c,h){return{instance:o,listener:c,currentTarget:h}}function ff(o,c){for(var h=c+"Capture",f=[];o!==null;){var y=o,w=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||w===null||(y=ql(o,h),y!=null&&f.unshift(yh(o,y,w)),y=ql(o,c),y!=null&&f.push(yh(o,y,w))),o.tag===3)return f;o=o.return}return[]}
vendor: 6,905 bytes, lines 8-9
8function uI(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function iC(o,c,h,f,y){for(var w=c._reactName,C=[];h!==null&&h!==f;){var O=h,H=O.alternate,te=O.stateNode;if(O=O.tag,H!==null&&H===f)break;O!==5&&O!==26&&O!==27||te===null||(H=te,y?(te=ql(h,w),te!=null&&C.unshift(yh(h,te,H))):y||(te=ql(h,w),te!=null&&C.push(yh(h,te,H)))),h=h.return}C.length!==0&&o.push({event:c,listeners:C})}var hI=/\r\n?/g,mI=/\u0000|\uFFFD/g;function aC(o){return(typeof o=="string"?o:""+o).replace(hI,`
9`).replace(mI,"")}function oC(o,c){return c=aC(c),aC(o)===c}function zt(o,c,h,f,y,w){switch(h){case"children":typeof f=="string"?c==="body"||c==="textarea"&&f===""||zr(o,f):(typeof f=="number"||typeof f=="bigint")&&c!=="body"&&zr(o,""+f);break;case"className":Vl(o,"class",f);break;case"tabIndex":Vl(o,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Vl(o,h,f);break;case"style":Ul(o,f,w);break;case"data":if(c!=="object"){Vl(o,"data",f);break}case"src":case"href":if(f===""&&(c!=="a"||h!=="href")){o.removeAttribute(h);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){o.removeAttribute(h);break}f=Vi(""+f),o.setAttribute(h,f);break;case"action":case"formAction":if(typeof f=="function"){o.setAttribute(h,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof w=="function"&&(h==="formAction"?(c!=="input"&&zt(o,c,"name",y.name,y,null),zt(o,c,"formEncType",y.formEncType,y,null),zt(o,c,"formMethod",y.formMethod,y,null),zt(o,c,"formTarget",y.formTarget,y,null)):(zt(o,c,"encType",y.encType,y,null),zt(o,c,"method",y.method,y,null),zt(o,c,"target",y.target,y,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){o.removeAttribute(h);break}f=Vi(""+f),o.setAttribute(h,f);break;case"onClick":f!=null&&(o.onclick=Mn);break;case"onScroll":f!=null&&Nt("scroll",o);break;case"onScrollEnd":f!=null&&Nt("scrollend",o);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(h=f.__html,h!=null){if(y.children!=null)throw Error(r(60));o.innerHTML=h}}break;case"multiple":o.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":o.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){o.removeAttribute("xlink:href");break}h=Vi(""+f),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?o.setAttribute(h,""+f):o.removeAttribute(h);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?o.setAttribute(h,""):o.removeAttribute(h);break;case"capture":case"download":f===!0?o.setAttribute(h,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?o.setAttribute(h,f):o.removeAttribute(h);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?o.setAttribute(h,f):o.removeAttribute(h);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?o.removeAttribute(h):o.setAttribute(h,f);break;case"popover":Nt("beforetoggle",o),Nt("toggle",o),jo(o,"popover",f);break;case"xlinkActuate":mi(o,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":mi(o,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":mi(o,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":mi(o,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":mi(o,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":mi(o,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":mi(o,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":mi(o,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":mi(o,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":jo(o,"is",f);break;case"innerText":case"textContent":break;default:(!(2<h.length)||h[0]!=="o"&&h[0]!=="O"||h[1]!=="n"&&h[1]!=="N")&&(h=$u.get(h)||h,jo(o,h,f))}}function k0(o,c,h,f,y,w){switch(h){case"style":Ul(o,f,w);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(h=f.__html,h!=null){if(y.children!=null)throw Error(r(60));o.innerHTML=h}}break;case"children":typeof f=="string"?zr(o,f):(typeof f=="number"||typeof f=="bigint")&&zr(o,""+f);break;case"onScroll":f!=null&&Nt("scroll",o);break;case"onScrollEnd":f!=null&&Nt("scrollend",o);break;case"onClick":f!=null&&(o.onclick=Mn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!fs.hasOwnProperty(h))e:{if(h[0]==="o"&&h[1]==="n"&&(y=h.endsWith("Capture"),c=h.slice(2,y?h.length-7:void 0),w=o[Jt]||null,w=w!=null?w[h]:null,typeof w=="function"&&o.removeEventListener(c,w,y),typeof f=="function")){typeof w!="function"&&w!==null&&(h in o?o[h]=null:o.hasAttribute(h)&&o.removeAttribute(h)),o.addEventListener(c,f,y);break e}h in o?o[h]=f:f===!0?o.setAttribute(h,""):jo(o,h,f)}}}function xn(o,c,h){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Nt("error",o),Nt("load",o);var f=!1,y=!1,w;for(w in h)if(h.hasOwnProperty(w)){var C=h[w];if(C!=null)switch(w){case"src":f=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,c));default:zt(o,c,w,C,h,null)}}y&&zt(o,c,"srcSet",h.srcSet,h,null),f&&zt(o,c,"src",h.src,h,null);return;case"input":Nt("invalid",o);var O=w=C=y=null,H=null,te=null;for(f in h)if(h.hasOwnProperty(f)){var me=h[f];if(me!=null)switch(f){case"name":y=me;break;case"type":C=me;break;case"checked":H=me;break;case"defaultChecked":te=me;break;case"value":w=me;break;case"defaultValue":O=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(r(137,c));break;default:zt(o,c,f,me,h,null)}}va(o,w,O,H,te,C,y,!1);return;case"select":Nt("invalid",o),f=C=w=null;
vendor: 4,878 bytes, line 9
9for(y in h)if(h.hasOwnProperty(y)&&(O=h[y],O!=null))switch(y){case"value":w=O;break;case"defaultValue":C=O;break;case"multiple":f=O;default:zt(o,c,y,O,h,null)}c=w,h=C,o.multiple=!!f,c!=null?wa(o,!!f,c,!1):h!=null&&wa(o,!!f,h,!0);return;case"textarea":Nt("invalid",o),w=y=f=null;for(C in h)if(h.hasOwnProperty(C)&&(O=h[C],O!=null))switch(C){case"value":f=O;break;case"defaultValue":y=O;break;case"children":w=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(r(91));break;default:zt(o,c,C,O,h,null)}rd(o,f,y,w);return;case"option":for(H in h)h.hasOwnProperty(H)&&(f=h[H],f!=null)&&(H==="selected"?o.selected=f&&typeof f!="function"&&typeof f!="symbol":zt(o,c,H,f,h,null));return;case"dialog":Nt("beforetoggle",o),Nt("toggle",o),Nt("cancel",o),Nt("close",o);break;case"iframe":case"object":Nt("load",o);break;case"video":case"audio":for(f=0;f<bh.length;f++)Nt(bh[f],o);break;case"image":Nt("error",o),Nt("load",o);break;case"details":Nt("toggle",o);break;case"embed":case"source":case"link":Nt("error",o),Nt("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in h)if(h.hasOwnProperty(te)&&(f=h[te],f!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,c));default:zt(o,c,te,f,h,null)}return;default:if(Lu(c)){for(me in h)h.hasOwnProperty(me)&&(f=h[me],f!==void 0&&k0(o,c,me,f,h,void 0));return}}for(O in h)h.hasOwnProperty(O)&&(f=h[O],f!=null&&zt(o,c,O,f,h,null))}function pI(o,c,h,f){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,w=null,C=null,O=null,H=null,te=null,me=null;for(de in h){var ye=h[de];if(h.hasOwnProperty(de)&&ye!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":H=ye;default:f.hasOwnProperty(de)||zt(o,c,de,null,f,ye)}}for(var re in f){var de=f[re];if(ye=h[re],f.hasOwnProperty(re)&&(de!=null||ye!=null))switch(re){case"type":w=de;break;case"name":y=de;break;case"checked":te=de;break;case"defaultChecked":me=de;break;case"value":C=de;break;case"defaultValue":O=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,c));break;default:de!==ye&&zt(o,c,re,de,f,ye)}}zi(o,C,O,H,te,me,w,y);return;case"select":de=C=O=re=null;for(w in h)if(H=h[w],h.hasOwnProperty(w)&&H!=null)switch(w){case"value":break;case"multiple":de=H;default:f.hasOwnProperty(w)||zt(o,c,w,null,f,H)}for(y in f)if(w=f[y],H=h[y],f.hasOwnProperty(y)&&(w!=null||H!=null))switch(y){case"value":re=w;break;case"defaultValue":O=w;break;case"multiple":C=w;default:w!==H&&zt(o,c,y,w,f,H)}c=O,h=C,f=de,re!=null?wa(o,!!h,re,!1):!!f!=!!h&&(c!=null?wa(o,!!h,c,!0):wa(o,!!h,h?[]:"",!1));return;case"textarea":de=re=null;for(O in h)if(y=h[O],h.hasOwnProperty(O)&&y!=null&&!f.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:zt(o,c,O,null,f,y)}for(C in f)if(y=f[C],w=h[C],f.hasOwnProperty(C)&&(y!=null||w!=null))switch(C){case"value":re=y;break;case"defaultValue":de=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(r(91));break;default:y!==w&&zt(o,c,C,y,f,w)}Fb(o,re,de);return;case"option":for(var qe in h)re=h[qe],h.hasOwnProperty(qe)&&re!=null&&!f.hasOwnProperty(qe)&&(qe==="selected"?o.selected=!1:zt(o,c,qe,null,f,re));for(H in f)re=f[H],de=h[H],f.hasOwnProperty(H)&&re!==de&&(re!=null||de!=null)&&(H==="selected"?o.selected=re&&typeof re!="function"&&typeof re!="symbol":zt(o,c,H,re,f,de));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ze in h)re=h[Ze],h.hasOwnProperty(Ze)&&re!=null&&!f.hasOwnProperty(Ze)&&zt(o,c,Ze,null,f,re);for(te in f)if(re=f[te],de=h[te],f.hasOwnProperty(te)&&re!==de&&(re!=null||de!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,c));break;default:zt(o,c,te,re,f,de)}return;default:if(Lu(c)){for(var Vt in h)re=h[Vt],h.hasOwnProperty(Vt)&&re!==void 0&&!f.hasOwnProperty(Vt)&&k0(o,c,Vt,void 0,f,re);for(me in f)re=f[me],de=h[me],!f.hasOwnProperty(me)||re===de||re===void 0&&de===void 0||k0(o,c,me,re,f,de);return}}for(var Q in h)re=h[Q],h.hasOwnProperty(Q)&&re!=null&&!f.hasOwnProperty(Q)&&zt(o,c,Q,null,f,re);for(ye in f)re=f[ye],de=h[ye],!f.hasOwnProperty(ye)||re===de||re==null&&de==null||zt(o,c,ye,re,f,de)}function lC(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function fI(){if(typeof performance.getEntriesByType=="function"){for(var o=0,c=0,h=performance.getEntriesByType("resource"),f=0;f<h.length;f++){var y=h[f],w=y.transferSize,C=y.initiatorType,O=y.duration;if(w&&O&&lC(C)){for(C=0,O=y.responseEnd,f+=1;f<h.length;f++){var H=h[f],te=H.startTime;if(te>O)break;var me=H.transferSize,ye=H.initiatorType;
vendor: 12,374 bytes, line 9
9me&&lC(ye)&&(H=H.responseEnd,C+=me*(H<O?1:(O-te)/(H-te)))}if(--f,c+=8*(w+C)/(y.duration/1e3),o++,10<o)break}}if(0<o)return c/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var S0=null,C0=null;function xf(o){return o.nodeType===9?o:o.ownerDocument}function cC(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function dC(o,c){if(o===0)switch(c){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&c==="foreignObject"?0:o}function T0(o,c){return o==="textarea"||o==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.children=="bigint"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var E0=null;function xI(){var o=window.event;return o&&o.type==="popstate"?o===E0?!1:(E0=o,!0):(E0=null,!1)}var uC=typeof setTimeout=="function"?setTimeout:void 0,gI=typeof clearTimeout=="function"?clearTimeout:void 0,hC=typeof Promise=="function"?Promise:void 0,bI=typeof queueMicrotask=="function"?queueMicrotask:typeof hC<"u"?function(o){return hC.resolve(null).then(o).catch(yI)}:uC;function yI(o){setTimeout(function(){throw o})}function Vo(o){return o==="head"}function mC(o,c){var h=c,f=0;do{var y=h.nextSibling;if(o.removeChild(h),y&&y.nodeType===8)if(h=y.data,h==="/$"||h==="/&"){if(f===0){o.removeChild(y),$d(c);return}f--}else if(h==="$"||h==="$?"||h==="$~"||h==="$!"||h==="&")f++;else if(h==="html")vh(o.ownerDocument.documentElement);else if(h==="head"){h=o.ownerDocument.head,vh(h);for(var w=h.firstChild;w;){var C=w.nextSibling,O=w.nodeName;w[rn]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&w.rel.toLowerCase()==="stylesheet"||h.removeChild(w),w=C}}else h==="body"&&vh(o.ownerDocument.body);h=y}while(h);$d(c)}function pC(o,c){var h=o;o=0;do{var f=h.nextSibling;if(h.nodeType===1?c?(h._stashedDisplay=h.style.display,h.style.display="none"):(h.style.display=h._stashedDisplay||"",h.getAttribute("style")===""&&h.removeAttribute("style")):h.nodeType===3&&(c?(h._stashedText=h.nodeValue,h.nodeValue=""):h.nodeValue=h._stashedText||""),f&&f.nodeType===8)if(h=f.data,h==="/$"){if(o===0)break;o--}else h!=="$"&&h!=="$?"&&h!=="$~"&&h!=="$!"||o++;h=f}while(h)}function A0(o){var c=o.firstChild;for(c&&c.nodeType===10&&(c=c.nextSibling);c;){var h=c;switch(c=c.nextSibling,h.nodeName){case"HTML":case"HEAD":case"BODY":A0(h),Ue(h);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(h.rel.toLowerCase()==="stylesheet")continue}o.removeChild(h)}}function vI(o,c,h,f){for(;o.nodeType===1;){var y=h;if(o.nodeName.toLowerCase()!==c.toLowerCase()){if(!f&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(f){if(!o[rn])switch(c){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(w=o.getAttribute("rel"),w==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(w!==y.rel||o.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||o.getAttribute("title")!==(y.title==null?null:y.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(w=o.getAttribute("src"),(w!==(y.src==null?null:y.src)||o.getAttribute("type")!==(y.type==null?null:y.type)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&w&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(c==="input"&&o.type==="hidden"){var w=y.name==null?null:""+y.name;if(y.type==="hidden"&&o.getAttribute("name")===w)return o}else return o;if(o=Yr(o.nextSibling),o===null)break}return null}function wI(o,c,h){if(c==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!h||(o=Yr(o.nextSibling),o===null))return null;return o}function fC(o,c){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!c||(o=Yr(o.nextSibling),o===null))return null;return o}function M0(o){return o.data==="$?"||o.data==="$~"}function _0(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function jI(o,c){var h=o.ownerDocument;if(o.data==="$~")o._reactRetry=c;else if(o.data!=="$?"||h.readyState!=="loading")c();else{var f=function(){c(),h.removeEventListener("DOMContentLoaded",f)};h.addEventListener("DOMContentLoaded",f),o._reactRetry=f}}function Yr(o){for(;o!=null;o=o.nextSibling){var c=o.nodeType;if(c===1||c===3)break;if(c===8){if(c=o.data,c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"||c==="F!"||c==="F")break;if(c==="/$"||c==="/&")return null}}return o}var O0=null;function xC(o){o=o.nextSibling;for(var c=0;o;){if(o.nodeType===8){var h=o.data;if(h==="/$"||h==="/&"){if(c===0)return Yr(o.nextSibling);c--}else h!=="$"&&h!=="$!"&&h!=="$?"&&h!=="$~"&&h!=="&"||c++}o=o.nextSibling}return null}function gC(o){o=o.previousSibling;for(var c=0;o;){if(o.nodeType===8){var h=o.data;if(h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"){if(c===0)return o;c--}else h!=="/$"&&h!=="/&"||c++}o=o.previousSibling}return null}function bC(o,c,h){switch(c=xf(h),o){case"html":if(o=c.documentElement,!o)throw Error(r(452));return o;case"head":if(o=c.head,!o)throw Error(r(453));return o;case"body":if(o=c.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function vh(o){for(var c=o.attributes;c.length;)o.removeAttributeNode(c[0]);Ue(o)}var Qr=new Map,yC=new Set;function gf(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var Ua=W.d;W.d={f:NI,r:kI,D:SI,C:CI,L:TI,m:EI,X:MI,S:AI,M:_I};function NI(){var o=Ua.f(),c=lf();return o||c}function kI(o){var c=fe(o);c!==null&&c.tag===5&&c.type==="form"?I2(c):Ua.r(o)}var Pd=typeof document>"u"?null:document;function vC(o,c,h){var f=Pd;if(f&&typeof c=="string"&&c){var y=An(c);y='link[rel="'+o+'"][href="'+y+'"]',typeof h=="string"&&(y+='[crossorigin="'+h+'"]'),yC.has(y)||(yC.add(y),o={rel:o,crossOrigin:h,href:c},f.querySelector(y)===null&&(c=f.createElement("link"),xn(c,"link",o),lt(c),f.head.appendChild(c)))}}function SI(o){Ua.D(o),vC("dns-prefetch",o,null)}function CI(o,c){Ua.C(o,c),vC("preconnect",o,c)}function TI(o,c,h){Ua.L(o,c,h);var f=Pd;if(f&&o&&c){var y='link[rel="preload"][as="'+An(c)+'"]';c==="image"&&h&&h.imageSrcSet?(y+='[imagesrcset="'+An(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(y+='[imagesizes="'+An(h.imageSizes)+'"]')):y+='[href="'+An(o)+'"]';var w=y;switch(c){case"style":w=Id(o);break;case"script":w=Ld(o)}Qr.has(w)||(o=x({rel:"preload",href:c==="image"&&h&&h.imageSrcSet?void 0:o,as:c},h),Qr.set(w,o),f.querySelector(y)!==null||c==="style"&&f.querySelector(wh(w))||c==="script"&&f.querySelector(jh(w))||(c=f.createElement("link"),xn(c,"link",o),lt(c),f.head.appendChild(c)))}}function EI(o,c){Ua.m(o,c);var h=Pd;if(h&&o){var f=c&&typeof c.as=="string"?c.as:"script",y='link[rel="modulepreload"][as="'+An(f)+'"][href="'+An(o)+'"]',w=y;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=Ld(o)}if(!Qr.has(w)&&(o=x({rel:"modulepreload",href:o},c),Qr.set(w,o),h.querySelector(y)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(jh(w)))return}f=h.createElement("link"),xn(f,"link",o),lt(f),h.head.appendChild(f)}}}function AI(o,c,h){Ua.S(o,c,h);var f=Pd;if(f&&o){var y=Et(f).hoistableStyles,w=Id(o);c=c||"default";var C=y.get(w);if(!C){var O={loading:0,preload:null};if(C=f.querySelector(wh(w)))O.loading=5;else{o=x({rel:"stylesheet",href:o,"data-precedence":c},h),(h=Qr.get(w))&&R0(o,h);var H=C=f.createElement("link");lt(H),xn(H,"link",o),H._p=new Promise(function(te,me){H.onload=te,H.onerror=me}),H.addEventListener("load",function(){O.loading|=1}),H.addEventListener("error",function(){O.loading|=2}),O.loading|=4,bf(C,c,f)}C={type:"stylesheet",instance:C,count:1,state:O},y.set(w,C)}}}function MI(o,c){Ua.X(o,c);var h=Pd;if(h&&o){var f=Et(h).hoistableScripts,y=Ld(o),w=f.get(y);w||(w=h.querySelector(jh(y)),w||(o=x({src:o,async:!0},c),(c=Qr.get(y))&&D0(o,c),w=h.createElement("script"),lt(w),xn(w,"link",o),h.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},f.set(y,w))}}function _I(o,c){Ua.M(o,c);var h=Pd;if(h&&o){var f=Et(h).hoistableScripts,y=Ld(o),w=f.get(y);w||(w=h.querySelector(jh(y)),w||(o=x({src:o,async:!0,type:"module"},c),(c=Qr.get(y))&&D0(o,c),w=h.createElement("script"),lt(w),xn(w,"link",o),h.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},f.set(y,w))}}function wC(o,c,h,f){var y=(y=D.current)?gf(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(c=Id(h.href),h=Et(y).hoistableStyles,f=h.get(c),f||(f={type:"style",instance:null,count:0,state:null},h.set(c,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){o=Id(h.href);var w=Et(y).hoistableStyles,C=w.get(o);if(C||(y=y.ownerDocument||y,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(o,C),(w=y.querySelector(wh(o)))&&!w._p&&(C.instance=w,C.state.loading=5),Qr.has(o)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},Qr.set(o,h),w||OI(y,o,h,C.state))),c&&f===null)throw Error(r(528,""));return C}if(c&&f!==null)throw Error(r(529,""));return null;case"script":return c=h.async,h=h.src,typeof h=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=Ld(h),h=Et(y).hoistableScripts,f=h.get(c),f||(f={type:"script",instance:null,count:0,state:null},h.set(c,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Id(o){return'href="'+An(o)+'"'}function wh(o){return'link[rel="stylesheet"]['+o+"]"}function jC(o){return x({},o,{"data-precedence":o.precedence,precedence:null})}function OI(o,c,h,f){o.querySelector('link[rel="preload"][as="style"]['+c+"]")?f.loading=1:(c=o.createElement("link"),f.preload=c,c.addEventListener("load",function(){return f.loading|=1}),c.addEventListener("error",function(){return f.loading|=2}),xn(c,"link",h),lt(c),o.head.appendChild(c))}function Ld(o){return'[src="'+An(o)+'"]'}function jh(o){return"script[async]"+o}function NC(o,c,h){if(c.count++,c.instance===null)switch(c.type){case"style":var f=o.querySelector('style[data-href~="'+An(h.href)+'"]');if(f)return c.instance=f,lt(f),f;var y=x({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return f=(o.ownerDocument||o).createElement("style"),lt(f),xn(f,"style",y),bf(f,h.precedence,o),c.instance=f;case"stylesheet":y=Id(h.href);var w=o.querySelector(wh(y));if(w)return c.state.loading|=4,c.instance=w,lt(w),w;f=jC(h),(y=Qr.get(y))&&R0(f,y),w=(o.ownerDocument||o).createElement("link"),lt(w);var C=w;return C._p=new Promise(function(O,H){C.onload=O,C.onerror=H}),xn(w,"link",f),c.state.loading|=4,bf(w,h.precedence,o),c.instance=w;case"script":return w=Ld(h.src),(y=o.querySelector(jh(w)))?(c.instance=y,lt(y),y):(f=h,(y=Qr.get(w))&&(f=x({},h),D0(f,y)),o=o.ownerDocument||o,y=o.createElement("script"),lt(y),xn(y,"link",f),o.head.appendChild(y),c.instance=y);case"void":return null;default:throw Error(r(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(f=c.instance,c.state.loading|=4,bf(f,h.precedence,o));return c.instance}function bf(o,c,h){for(var f=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=f.length?f[f.length-1]:null,w=y,C=0;C<f.length;C++){var O=f[C];if(O.dataset.precedence===c)w=O;else if(w!==y)break}w?w.parentNode.insertBefore(o,w.nextSibling):(c=h.nodeType===9?h.head:h,c.insertBefore(o,c.firstChild))}function R0(o,c){o.crossOrigin==null&&(o.crossOrigin=c.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=c.referrerPolicy),o.title==null&&(o.title=c.title)}function D0(o,c){o.crossOrigin==null&&(o.crossOrigin=c.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=c.referrerPolicy),o.integrity==null&&(o.integrity=c.integrity)}var yf=null;function kC(o,c,h){if(yf===null){var f=new Map,y=yf=new Map;y.set(h,f)}else y=yf,f=y.get(h),f||(f=new Map,y.set(h,f));if(f.has(o))return f;for(f.set(o,null),h=h.getElementsByTagName(o),y=0;
vendor: 4,472 bytes, line 9
9y<h.length;y++){var w=h[y];if(!(w[rn]||w[ms]||o==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var C=w.getAttribute(c)||"";C=o+C;var O=f.get(C);O?O.push(w):f.set(C,[w])}}return f}function SC(o,c,h){o=o.ownerDocument||o,o.head.insertBefore(h,c==="title"?o.querySelector("head > title"):null)}function RI(o,c,h){if(h===1||c.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;return c.rel==="stylesheet"?(o=c.disabled,typeof c.precedence=="string"&&o==null):!0;case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function CC(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function DI(o,c,h,f){if(h.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var y=Id(f.href),w=c.querySelector(wh(y));if(w){c=w._p,c!==null&&typeof c=="object"&&typeof c.then=="function"&&(o.count++,o=vf.bind(o),c.then(o,o)),h.state.loading|=4,h.instance=w,lt(w);return}w=c.ownerDocument||c,f=jC(f),(y=Qr.get(y))&&R0(f,y),w=w.createElement("link"),lt(w);var C=w;C._p=new Promise(function(O,H){C.onload=O,C.onerror=H}),xn(w,"link",f),h.instance=w}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(h,c),(c=h.state.preload)&&(h.state.loading&3)===0&&(o.count++,h=vf.bind(o),c.addEventListener("load",h),c.addEventListener("error",h))}}var P0=0;function PI(o,c){return o.stylesheets&&o.count===0&&jf(o,o.stylesheets),0<o.count||0<o.imgCount?function(h){var f=setTimeout(function(){if(o.stylesheets&&jf(o,o.stylesheets),o.unsuspend){var w=o.unsuspend;o.unsuspend=null,w()}},6e4+c);0<o.imgBytes&&P0===0&&(P0=62500*fI());var y=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&jf(o,o.stylesheets),o.unsuspend)){var w=o.unsuspend;o.unsuspend=null,w()}},(o.imgBytes>P0?50:800)+c);return o.unsuspend=h,function(){o.unsuspend=null,clearTimeout(f),clearTimeout(y)}}:null}function vf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)jf(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var wf=null;function jf(o,c){o.stylesheets=null,o.unsuspend!==null&&(o.count++,wf=new Map,c.forEach(II,o),wf=null,vf.call(o))}function II(o,c){if(!(c.state.loading&4)){var h=wf.get(o);if(h)var f=h.get(null);else{h=new Map,wf.set(o,h);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<y.length;w++){var C=y[w];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(h.set(C.dataset.precedence,C),f=C)}f&&h.set(null,f)}y=c.instance,C=y.getAttribute("data-precedence"),w=h.get(C)||f,w===f&&h.set(null,y),h.set(C,y),this.count++,f=vf.bind(this),y.addEventListener("load",f),y.addEventListener("error",f),w?w.parentNode.insertBefore(y,w.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(y,o.firstChild)),c.state.loading|=4}}var Nh={$$typeof:E,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function LI(o,c,h,f,y,w,C,O,H){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=go(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=go(0),this.hiddenUpdates=go(null),this.identifierPrefix=f,this.onUncaughtError=y,this.onCaughtError=w,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function TC(o,c,h,f,y,w,C,O,H,te,me,ye){return o=new LI(o,c,h,C,H,te,me,ye,O),c=1,w===!0&&(c|=24),w=vr(3,null,null,c),o.current=w,w.stateNode=o,c=py(),c.refCount++,o.pooledCache=c,c.refCount++,w.memoizedState={element:f,isDehydrated:h,cache:c},by(w),o}function EC(o){return o?(o=pd,o):pd}function AC(o,c,h,f,y,w){y=EC(y),f.context===null?f.context=y:f.pendingContext=y,f=Mo(c),f.payload={element:h},w=w===void 0?null:w,w!==null&&(f.callback=w),h=_o(o,f,c),h!==null&&(cr(h,o,c),th(h,o,c))}
vendor: 4,169 bytes, line 9
9function MC(o,c){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var h=o.retryLane;o.retryLane=h!==0&&h<c?h:c}}function I0(o,c){MC(o,c),(o=o.alternate)&&MC(o,c)}function _C(o){if(o.tag===13||o.tag===31){var c=Xl(o,67108864);c!==null&&cr(c,o,67108864),I0(o,67108864)}}function OC(o){if(o.tag===13||o.tag===31){var c=Sr();c=nn(c);var h=Xl(o,c);h!==null&&cr(h,o,c),I0(o,c)}}var Nf=!0;function $I(o,c,h,f){var y=q.T;q.T=null;var w=W.p;try{W.p=2,L0(o,c,h,f)}finally{W.p=w,q.T=y}}function BI(o,c,h,f){var y=q.T;q.T=null;var w=W.p;try{W.p=8,L0(o,c,h,f)}finally{W.p=w,q.T=y}}function L0(o,c,h,f){if(Nf){var y=$0(f);if(y===null)N0(o,c,f,kf,h),DC(o,f);else if(VI(y,o,c,h,f))f.stopPropagation();else if(DC(o,f),c&4&&-1<zI.indexOf(o)){for(;y!==null;){var w=fe(y);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var C=Ys(w.pendingLanes);if(C!==0){var O=w;for(O.pendingLanes|=2,O.entangledLanes|=2;C;){var H=1<<31-Zt(C);O.entanglements[1]|=H,C&=~H}Gi(w),(Pt&6)===0&&(af=js()+500,gh(0))}}break;case 31:case 13:O=Xl(w,2),O!==null&&cr(O,w,2),lf(),I0(w,2)}if(w=$0(f),w===null&&N0(o,c,f,kf,h),w===y)break;y=w}y!==null&&f.stopPropagation()}else N0(o,c,f,null,h)}}function $0(o){return o=id(o),B0(o)}var kf=null;function B0(o){if(kf=null,o=F(o),o!==null){var c=a(o);if(c===null)o=null;else{var h=c.tag;if(h===13){if(o=l(c),o!==null)return o;o=null}else if(h===31){if(o=d(c),o!==null)return o;o=null}else if(h===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;o=null}else c!==o&&(o=null)}}return kf=o,null}function RC(o){switch(o){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Pi()){case nr:return 2;case Tn:return 8;case xr:case Ll:return 32;case pa:return 268435456;default:return 32}default:return 32}}var z0=!1,Fo=null,Uo=null,Ho=null,kh=new Map,Sh=new Map,qo=[],zI="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".split(" ");function DC(o,c){switch(o){case"focusin":case"focusout":Fo=null;break;case"dragenter":case"dragleave":Uo=null;break;case"mouseover":case"mouseout":Ho=null;break;case"pointerover":case"pointerout":kh.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":Sh.delete(c.pointerId)}}function Ch(o,c,h,f,y,w){return o===null||o.nativeEvent!==w?(o={blockedOn:c,domEventName:h,eventSystemFlags:f,nativeEvent:w,targetContainers:[y]},c!==null&&(c=fe(c),c!==null&&_C(c)),o):(o.eventSystemFlags|=f,c=o.targetContainers,y!==null&&c.indexOf(y)===-1&&c.push(y),o)}function VI(o,c,h,f,y){switch(c){case"focusin":return Fo=Ch(Fo,o,c,h,f,y),!0;case"dragenter":return Uo=Ch(Uo,o,c,h,f,y),!0;case"mouseover":return Ho=Ch(Ho,o,c,h,f,y),!0;case"pointerover":var w=y.pointerId;return kh.set(w,Ch(kh.get(w)||null,o,c,h,f,y)),!0;case"gotpointercapture":return w=y.pointerId,Sh.set(w,Ch(Sh.get(w)||null,o,c,h,f,y)),!0}return!1}function PC(o){var c=F(o.target);if(c!==null){var h=a(c);
vendor: 1,071 bytes, line 9
9if(h!==null){if(c=h.tag,c===13){if(c=l(h),c!==null){o.blockedOn=c,hn(o.priority,function(){OC(h)});return}}else if(c===31){if(c=d(h),c!==null){o.blockedOn=c,hn(o.priority,function(){OC(h)});return}}else if(c===3&&h.stateNode.current.memoizedState.isDehydrated){o.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Sf(o){if(o.blockedOn!==null)return!1;for(var c=o.targetContainers;0<c.length;){var h=$0(o.nativeEvent);if(h===null){h=o.nativeEvent;var f=new h.constructor(h.type,h);ja=f,h.target.dispatchEvent(f),ja=null}else return c=fe(h),c!==null&&_C(c),o.blockedOn=h,!1;c.shift()}return!0}function IC(o,c,h){Sf(o)&&h.delete(c)}function FI(){z0=!1,Fo!==null&&Sf(Fo)&&(Fo=null),Uo!==null&&Sf(Uo)&&(Uo=null),Ho!==null&&Sf(Ho)&&(Ho=null),kh.forEach(IC),Sh.forEach(IC)}function Cf(o,c){o.blockedOn===c&&(o.blockedOn=null,z0||(z0=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,FI)))}var Tf=null;function LC(o){Tf!==o&&(Tf=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Tf===o&&(Tf=null);for(var c=0;c<o.length;
9c+=3){var h=o[c],f=o[c+1],y=o[c+2];if(typeof f!="function"){if(B0(f||h)===null)continue;break}var w=fe(h);w!==null&&(o.splice(c,3),c-=3,$y(w,{pending:!0,data:y,method:h.method,action:f},f,y))}}))}function $d(o){function c(H){return Cf(H,o)}Fo!==null&&Cf(Fo,o),Uo!==null&&Cf(Uo,o),Ho!==null&&Cf(Ho,o),kh.forEach(c),Sh.forEach(c);for(var h=0;h<qo.length;h++){var f=qo[h];f.blockedOn===o&&(f.blockedOn=null)}for(;0<qo.length&&(h=qo[0],h.blockedOn===null);)PC(h),h.blockedOn===null&&qo.shift();if(h=(o.ownerDocument||o).$$reactFormReplay,h!=null)for(f=0;f<h.length;f+=3){var y=h[f],w=h[f+1],C=y[Jt]||null;if(typeof w=="function")C||LC(h);else if(C){var O=null;if(w&&w.hasAttribute("formAction")){if(y=w,C=w[Jt]||null)O=C.formAction;else if(B0(y)!==null)continue}else O=C.action;typeof O=="function"?h[f+1]=O:(h.splice(f,3),f-=3),LC(h)}}}function $C(){function o(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(C){return y=C})},focusReset:"manual",scroll:"manual"})}function c(){y!==null&&(y(),y=null),f||setTimeout(h,20)}function h(){if(!f&&!navigation.transition){var w=navigation.currentEntry;w&&w.url!=null&&navigation.navigate(w.url,{state:w.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,y=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",c),navigation.addEventListener("navigateerror",c),setTimeout(h,100),function(){f=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",c),navigation.removeEventListener("navigateerror",c),y!==null&&(y(),y=null)}}}function V0(o){this._internalRoot=o}Ef.prototype.render=V0.prototype.render=function(o){var c=this._internalRoot;if(c===null)throw Error(r(409));var h=c.current,f=Sr();AC(h,f,o,c,null,null)},Ef.prototype.unmount=V0.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var c=o.containerInfo;AC(o.current,2,null,o,null,null),lf(),c[En]=null}};function Ef(o){this._internalRoot=o}Ef.prototype.unstable_scheduleHydration=function(o){if(o){var c=Fn();o={blockedOn:null,target:o,priority:c};for(var h=0;h<qo.length&&c!==0&&c<qo[h].priority;h++);qo.splice(h,0,o),h===0&&PC(o)}};var BC=e.version;if(BC!=="19.2.5")throw Error(r(527,BC,"19.2.5"));W.findDOMNode=function(o){var c=o._reactInternals;if(c===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=m(c),o=o!==null?p(o):null,o=o===null?null:o.stateNode,o};var UI={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Af=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Af.isDisabled&&Af.supportsFiber)try{Ks=Af.inject(UI),we=Af}catch{}}return Eh.createRoot=function(o,c){if(!i(o))throw Error(r(299));var h=!1,f="",y=W2,w=G2,C=K2;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(f=c.identifierPrefix),c.onUncaughtError!==void 0&&(y=c.onUncaughtError),c.onCaughtError!==void 0&&(w=c.onCaughtError),c.onRecoverableError!==void 0&&(C=c.onRecoverableError)),c=TC(o,1,!1,null,null,h,f,null,y,w,C,$C),o[En]=c.current,j0(o),new V0(c)},Eh.hydrateRoot=function(o,c,h){if(!i(o))throw Error(r(299));var f=!1,y="",w=W2,C=G2,O=K2,H=null;return h!=null&&(h.unstable_strictMode===!0&&(f=!0),h.identifierPrefix!==void 0&&(y=h.identifierPrefix),h.onUncaughtError!==void 0&&(w=h.onUncaughtError),h.onCaughtError!==void 0&&(C=h.onCaughtError),h.onRecoverableError!==void 0&&(O=h.onRecoverableError),h.formState!==void 0&&(H=h.formState)),c=TC(o,1,!0,c,h??null,f,y,H,w,C,O,$C),c.context=EC(null),h=c.current,f=Sr(),f=nn(f),y=Mo(f),y.callback=null,_o(h,y,f),h=f,c.current.lanes=h,hi(c,h),Gi(c),o[En]=c.current,j0(o),new Ef(c)},Eh.version="19.2.5",Eh}var YC;function ZI(){if(YC)return U0.exports;YC=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),U0.exports=XI(),U0.exports}var eL=ZI();function tL(t,e){if(t instanceof RegExp)return{keys:!1,pattern:t};var s,r,i,a,l=[],d="",u=t.split("/");for(u[0]||u.shift();i=u.shift();)s=i[0],s==="*"?(l.push(s),d+=i[1]==="?"?"(?:/(.*))?":"/(.*)"):s===":"?(r=i.indexOf("?",1),a=i.indexOf(".",1),l.push(i.substring(1,~r?r:~a?a:i.length)),d+=~r&&!~a?"(?:/([^/]+?))?":"/([^/]+?)",~a&&(d+=(~r?"?":"")+"\\"+i.substring(a))):d+="/"+i;return{keys:l,pattern:new RegExp("^"+d+(e?"(?=$|/)":"/?$"),"i")}}var j=Qm();const Kn=LE(j),X1=qI({__proto__:null,default:Kn},[j]);var K0={exports:{}},Y0={};var QC;function sL(){if(QC)return Y0;QC=1;var t=Qm();function e(x,g){return x===g&&(x!==0||1/x===1/g)||x!==x&&g!==g}var s=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,a=t.useLayoutEffect,l=t.useDebugValue;function d(x,g){var b=g(),v=r({inst:{value:b,getSnapshot:g}}),k=v[0].inst,N=v[1];return a(function(){k.value=b,k.getSnapshot=g,u(k)&&N({inst:k})},[x,b,g]),i(function(){return u(k)&&N({inst:k}),x(function(){u(k)&&N({inst:k})})},[x]),l(b),b}function u(x){var g=x.getSnapshot;x=x.value;try{var b=g();return!s(x,b)}catch{return!0}}function m(x,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:d;return Y0.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,Y0}var JC;
9function BE(){return JC||(JC=1,K0.exports=sL()),K0.exports}var Z1=BE();const nL=X1.useInsertionEffect,rL=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",zE=rL?j.useLayoutEffect:j.useEffect,iL=nL||zE,ej=t=>{const e=j.useRef([t,(...s)=>e[0](...s)]).current;return iL(()=>{e[0]=t}),e[1]},aL="popstate",tj="pushState",sj="replaceState",oL="hashchange",XC=[aL,tj,sj,oL],lL=t=>{for(const e of XC)addEventListener(e,t);return()=>{for(const e of XC)removeEventListener(e,t)}},VE=(t,e)=>Z1.useSyncExternalStore(lL,t,e),ZC=()=>location.search,cL=({ssrSearch:t}={})=>VE(ZC,t!=null?()=>t:ZC),e5=()=>location.pathname,dL=({ssrPath:t}={})=>VE(e5,t!=null?()=>t:e5),uL=(t,{replace:e=!1,state:s=null}={})=>history[e?sj:tj](s,"",t),hL=(t={})=>[dL(t),uL],t5=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[t5]>"u"){for(const t of[tj,sj]){const e=history[t];history[t]=function(){const s=e.apply(this,arguments),r=new Event(t);return r.arguments=arguments,dispatchEvent(r),s}}Object.defineProperty(window,t5,{value:!0})}const mL=(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())?"~"+e:e.slice(t.length)||"/",FE=(t="")=>t==="/"?"":t,pL=(t,e)=>t[0]==="~"?t.slice(1):FE(e)+t,fL=(t="",e)=>mL(bw(FE(t)),bw(e)),xL=t=>t[0]==="?"?t.slice(1):t,bw=t=>{try{return decodeURI(t)}catch{return t}},gL=t=>bw(xL(t)),UE={hook:hL,searchHook:cL,parser:tL,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:t=>t,aroundNav:(t,e,s)=>t(e,s)},HE=j.createContext(UE),El=()=>j.useContext(HE),qE={},WE=j.createContext(qE),bL=()=>j.useContext(WE),Jm=t=>{const[e,s]=t.hook(t);return[fL(t.base,e),ej((r,i)=>t.aroundNav(s,pL(r,t.base),i))]},Al=()=>Jm(El()),nj=()=>{const t=El();return gL(t.searchHook(t))},rj=(t,e,s,r)=>{const{pattern:i,keys:a}=e instanceof RegExp?{keys:!1,pattern:e}:t(e||"*",r),l=i.exec(s)||[],[d,...u]=l;return d!==void 0?[!0,(()=>{const m=a!==!1?Object.fromEntries(a.map((x,g)=>[x,u[g]])):l.groups;let p={...u};return m&&Object.assign(p,m),p})(),...r?[d]:[]]:[!1,null]},yL=t=>rj(El().parser,t,Al()[0]),GE=({children:t,...e})=>{const s=El(),r=e.hook?UE:s;let i=r;const[a,l=e.ssrSearch??""]=e.ssrPath?.split("?")??[];a&&(e.ssrSearch=l,e.ssrPath=a),e.hrefs=e.hrefs??e.hook?.hrefs,e.searchHook=e.searchHook??e.hook?.searchHook;let d=j.useRef({}),u=d.current,m=u;for(let p in r){const x=p==="base"?r[p]+(e[p]??""):e[p]??r[p];u===m&&x!==m[p]&&(d.current=m={...m}),m[p]=x,(x!==r[p]||x!==i[p])&&(i=m)}return j.createElement(HE.Provider,{value:i,children:t})},s5=({children:t,component:e},s)=>e?j.createElement(e,{params:s}):typeof t=="function"?t(s):t,vL=t=>{let e=j.useRef(qE);const s=e.current;return e.current=Object.keys(t).length!==Object.keys(s).length||Object.entries(t).some(([r,i])=>i!==s[r])?t:s},tt=({path:t,nest:e,match:s,...r})=>{const i=El(),[a]=Jm(i),[l,d,u]=s??rj(i.parser,t,a,e),m=vL({...bL(),...d});if(!l)return null;const p=u?j.createElement(GE,{base:u},s5(r,m)):s5(r,m);return j.createElement(WE.Provider,{value:m,children:p})},Ae=j.forwardRef((t,e)=>{const s=El(),[r,i]=Jm(s),{to:a="",href:l=a,onClick:d,asChild:u,children:m,className:p,replace:x,state:g,transition:b,...v}=t,k=ej(S=>{S.ctrlKey||S.metaKey||S.altKey||S.shiftKey||S.button!==0||(d?.(S),S.defaultPrevented||(S.preventDefault(),i(l,t)))}),N=s.hrefs(l[0]==="~"?l.slice(1):s.base+l,s);return u&&j.isValidElement(m)?j.cloneElement(m,{onClick:k,href:N}):j.createElement("a",{...v,onClick:k,href:N,className:p?.call?p(r===l):p,children:m,ref:e})}),KE=t=>Array.isArray(t)?t.flatMap(e=>KE(e&&e.type===j.Fragment?e.props.children:e)):[t],ij=({children:t,location:e})=>{const s=El(),[r]=Jm(s);for(const i of KE(t)){let a=0;if(j.isValidElement(i)&&(a=rj(s.parser,i.props.path,e||r,i.props.nest))[0])return j.cloneElement(i,{match:a})}return null},Q0=t=>{const{to:e,href:s=e}=t,r=El(),[,i]=Jm(r),a=ej(()=>i(e||s,t)),{ssrContext:l}=r;return zE(()=>{a()},[]),l&&(l.redirectTo=e),null};var Eu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}
vendor: 25,485 bytes, line 9
9,wL=class extends Eu{#e;#t;#s;constructor(){super(),this.#s=t=>{if(typeof window<"u"&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#s=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},aj=new wL,jL={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},NL=class{#e=jL;#t=!1;setTimeoutProvider(t){this.#e=t}setTimeout(t,e){return this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},vc=new NL;function kL(t){setTimeout(t,0)}var SL=typeof window>"u"||"Deno"in globalThis;function Gn(){}function CL(t,e){return typeof t=="function"?t(e):t}function yw(t){return typeof t=="number"&&t>=0&&t!==1/0}function YE(t,e){return Math.max(t+(e||0)-Date.now(),0)}function cl(t,e){return typeof t=="function"?t(e):t}function Tr(t,e){return typeof t=="function"?t(e):t}function n5(t,e){const{type:s="all",exact:r,fetchStatus:i,predicate:a,queryKey:l,stale:d}=t;if(l){if(r){if(e.queryHash!==oj(l,e.options))return!1}else if(!xm(e.queryKey,l))return!1}if(s!=="all"){const u=e.isActive();if(s==="active"&&!u||s==="inactive"&&u)return!1}return!(typeof d=="boolean"&&e.isStale()!==d||i&&i!==e.state.fetchStatus||a&&!a(e))}function r5(t,e){const{exact:s,status:r,predicate:i,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(s){if(Bc(e.options.mutationKey)!==Bc(a))return!1}else if(!xm(e.options.mutationKey,a))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function oj(t,e){return(e?.queryKeyHashFn||Bc)(t)}function Bc(t){return JSON.stringify(t,(e,s)=>vw(s)?Object.keys(s).sort().reduce((r,i)=>(r[i]=s[i],r),{}):s)}function xm(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(s=>xm(t[s],e[s])):!1}var TL=Object.prototype.hasOwnProperty;function QE(t,e,s=0){if(t===e)return t;if(s>500)return e;const r=i5(t)&&i5(e);if(!r&&!(vw(t)&&vw(e)))return e;const a=(r?t:Object.keys(t)).length,l=r?e:Object.keys(e),d=l.length,u=r?new Array(d):{};let m=0;for(let p=0;p<d;p++){const x=r?p:l[p],g=t[x],b=e[x];if(g===b){u[x]=g,(r?p<a:TL.call(t,x))&&m++;continue}if(g===null||b===null||typeof g!="object"||typeof b!="object"){u[x]=b;continue}const v=QE(g,b,s+1);u[x]=v,v===g&&m++}return a===d&&m===a?t:u}function Rx(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function i5(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function vw(t){if(!a5(t))return!1;const e=t.constructor;if(e===void 0)return!0;const s=e.prototype;return!(!a5(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function a5(t){return Object.prototype.toString.call(t)==="[object Object]"}function EL(t){return new Promise(e=>{vc.setTimeout(e,t)})}function ww(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?QE(t,e):e}function AL(t,e,s=0){const r=[...t,e];return s&&r.length>s?r.slice(1):r}function ML(t,e,s=0){const r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}var lj=Symbol();function JE(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===lj?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function cj(t,e){return typeof t=="function"?t(...e):!!t}function _L(t,e,s){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??=e(),r||(r=!0,i.aborted?s():i.addEventListener("abort",s,{once:!0})),i)}),t}var gm=(()=>{let t=()=>SL;return{isServer(){return t()},setIsServer(e){t=e}}})();function jw(){let t,e;const s=new Promise((i,a)=>{t=i,e=a});s.status="pending",s.catch(()=>{});function r(i){Object.assign(s,i),delete s.resolve,delete s.reject}return s.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},s.reject=i=>{r({status:"rejected",reason:i}),e(i)},s}var OL=kL;function RL(){let t=[],e=0,s=d=>{d()},r=d=>{d()},i=OL;const a=d=>{e?t.push(d):i(()=>{s(d)})},l=()=>{const d=t;t=[],d.length&&i(()=>{r(()=>{d.forEach(u=>{s(u)})})})};return{batch:d=>{let u;e++;try{u=d()}finally{e--,e||l()}return u},batchCalls:d=>(...u)=>{a(()=>{d(...u)})},schedule:a,setNotifyFunction:d=>{s=d},setBatchNotifyFunction:d=>{r=d},setScheduler:d=>{i=d}}}var en=RL(),DL=class extends Eu{#e=!0;#t;#s;constructor(){super(),this.#s=t=>{if(typeof window<"u"&&window.addEventListener){const e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#t||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#s=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(s=>{s(t)}))}isOnline(){return this.#e}},Dx=new DL;function PL(t){return Math.min(1e3*2**t,3e4)}function XE(t){return(t??"online")==="online"?Dx.isOnline():!0}var Nw=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function ZE(t){let e=!1,s=0,r;const i=jw(),a=()=>i.status!=="pending",l=k=>{if(!a()){const N=new Nw(k);g(N),t.onCancel?.(N)}},d=()=>{e=!0},u=()=>{e=!1},m=()=>aj.isFocused()&&(t.networkMode==="always"||Dx.isOnline())&&t.canRun(),p=()=>XE(t.networkMode)&&t.canRun(),x=k=>{a()||(r?.(),i.resolve(k))},g=k=>{a()||(r?.(),i.reject(k))},b=()=>new Promise(k=>{r=N=>{(a()||m())&&k(N)},t.onPause?.()}).then(()=>{r=void 0,a()||t.onContinue?.()}),v=()=>{if(a())return;let k;const N=s===0?t.initialPromise:void 0;try{k=N??t.fn()}catch(S){k=Promise.reject(S)}Promise.resolve(k).then(x).catch(S=>{if(a())return;const A=t.retry??(gm.isServer()?0:3),E=t.retryDelay??PL,_=typeof E=="function"?E(s,S):E,T=A===!0||typeof A=="number"&&s<A||typeof A=="function"&&A(s,S);if(e||!T){g(S);return}s++,t.onFail?.(s,S),EL(_).then(()=>m()?void 0:b()).then(()=>{e?g(S):v()})})};return{promise:i,status:()=>i.status,cancel:l,continue:()=>(r?.(),i),cancelRetry:d,continueRetry:u,canStart:p,start:()=>(p()?v():b().then(v),i)}}var eA=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),yw(this.gcTime)&&(this.#e=vc.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(gm.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(vc.clearTimeout(this.#e),this.#e=void 0)}};function IL(t){return{onFetch:(e,s)=>{const r=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],l=e.state.data?.pageParams||[];let d={pages:[],pageParams:[]},u=0;const m=async()=>{let p=!1;const x=v=>{_L(v,()=>e.signal,()=>p=!0)},g=JE(e.options,e.fetchOptions),b=async(v,k,N)=>{if(p)return Promise.reject(e.signal.reason);if(k==null&&v.pages.length)return Promise.resolve(v);const A=(()=>{const $={client:e.client,queryKey:e.queryKey,pageParam:k,direction:N?"backward":"forward",meta:e.options.meta};return x($),$})(),E=await g(A),{maxPages:_}=e.options,T=N?ML:AL;return{pages:T(v.pages,E,_),pageParams:T(v.pageParams,k,_)}};if(i&&a.length){const v=i==="backward",k=v?LL:o5,N={pages:a,pageParams:l},S=k(r,N);d=await b(N,S,v)}else{const v=t??a.length;do{const k=u===0?l[0]??r.initialPageParam:o5(r,d);if(u>0&&k==null)break;d=await b(d,k),u++}while(u<v)}return d};e.options.persister?e.fetchFn=()=>e.options.persister?.(m,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=m}}}function o5(t,{pages:e,pageParams:s}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,s[r],s):void 0}function LL(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var $L=class extends eA{#e;#t;#s;#n;#i;#r;#o;#a;constructor(t){super(),this.#a=!1,this.#o=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#i=t.client,this.#n=this.#i.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=c5(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#r?.promise}setOptions(t){if(this.options={...this.#o,...t},t?._type&&(this.#e=t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=c5(this.options);e.data!==void 0&&(this.setState(l5(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(t,e){const s=ww(this.state.data,t,this.options);return this.#l({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t){this.#l({type:"setState",state:t})}cancel(t){const e=this.#r?.promise;return this.#r?.cancel(t),e?e.then(Gn).catch(Gn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Tr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===lj||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>cl(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!YE(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#r&&(this.#a||this.#d()?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}#d(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(t&&this.setOptions(t),!this.options.queryFn){const u=this.observers.find(m=>m.options.queryFn);u&&this.setOptions(u.options)}const s=new AbortController,r=u=>{Object.defineProperty(u,"signal",{enumerable:!0,get:()=>(this.#a=!0,s.signal)})},i=()=>{const u=JE(this.options,e),p=(()=>{const x={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(x),x})();return this.#a=!1,this.options.persister?this.options.persister(u,p,this):u(p)},l=(()=>{const u={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(u),u})();(this.#e==="infinite"?IL(this.options.pages):this.options.behavior)?.onFetch(l,this),this.#s=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==l.fetchOptions?.meta)&&this.#l({type:"fetch",meta:l.fetchOptions?.meta}),this.#r=ZE({initialPromise:e?.initialPromise,fn:l.fetchFn,onCancel:u=>{u instanceof Nw&&u.revert&&this.setState({...this.#s,fetchStatus:"idle"}),s.abort()},onFail:(u,m)=>{this.#l({type:"failed",failureCount:u,error:m})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0});try{const u=await this.#r.start();if(u===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(u),this.#n.config.onSuccess?.(u,this),this.#n.config.onSettled?.(u,this.state.error,this),u}catch(u){if(u instanceof Nw){if(u.silent)return this.#r.promise;if(u.revert){if(this.state.data===void 0)throw u;return this.state.data}}throw this.#l({type:"error",error:u}),this.#n.config.onError?.(u,this),this.#n.config.onSettled?.(this.state.data,u,this),u}finally{this.scheduleGc()}}#l(t){const e=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...tA(s.data,this.options),fetchMeta:t.meta??null};case"success":const r={...s,...l5(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#s=t.manual?r:void 0,r;case"error":const i=t.error;return{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=e(this.state),en.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:t})})}};function tA(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:XE(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function l5(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function c5(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,r=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var BL=class extends Eu{constructor(t,e){super(),this.options=e,this.#e=t,this.#a=null,this.#o=jw(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#s=void 0;#n=void 0;#i;#r;#o;#a;#d;#l;#p;#u;#h;#c;#f=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),d5(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return kw(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return kw(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#w(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Tr(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#t.setOptions(this.options),e._defaulted&&!Rx(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&u5(this.#t,s,this.options,e)&&this.#m(),this.updateResult(),r&&(this.#t!==s||Tr(this.options.enabled,this.#t)!==Tr(e.enabled,this.#t)||cl(this.options.staleTime,this.#t)!==cl(e.staleTime,this.#t))&&this.#x();const i=this.#g();r&&(this.#t!==s||Tr(this.options.enabled,this.#t)!==Tr(e.enabled,this.#t)||i!==this.#c)&&this.#b(i)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),s=this.createResult(e,t);return VL(this,s)&&(this.#n=s,this.#r=this.options,this.#i=this.#t.state),s}getCurrentResult(){return this.#n}trackResult(t,e){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){this.#f.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),s=this.#e.getQueryCache().build(this.#e,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#m({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#m(t){this.#j();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(Gn)),e}#x(){this.#v();const t=cl(this.options.staleTime,this.#t);if(gm.isServer()||this.#n.isStale||!yw(t))return;const s=YE(this.#n.dataUpdatedAt,t)+1;this.#u=vc.setTimeout(()=>{this.#n.isStale||this.updateResult()},s)}#g(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#b(t){this.#w(),this.#c=t,!(gm.isServer()||Tr(this.options.enabled,this.#t)===!1||!yw(this.#c)||this.#c===0)&&(this.#h=vc.setInterval(()=>{(this.options.refetchIntervalInBackground||aj.isFocused())&&this.#m()},this.#c))}#y(){this.#x(),this.#b(this.#g())}#v(){this.#u!==void 0&&(vc.clearTimeout(this.#u),this.#u=void 0)}#w(){this.#h!==void 0&&(vc.clearInterval(this.#h),this.#h=void 0)}createResult(t,e){const s=this.#t,r=this.options,i=this.#n,a=this.#i,l=this.#r,u=t!==s?t.state:this.#s,{state:m}=t;let p={...m},x=!1,g;if(e._optimisticResults){const M=this.hasListeners(),I=!M&&d5(t,e),z=M&&u5(t,s,e,r);(I||z)&&(p={...p,...tA(m.data,t.options)}),e._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:b,errorUpdatedAt:v,status:k}=p;g=p.data;let N=!1;if(e.placeholderData!==void 0&&g===void 0&&k==="pending"){let M;i?.isPlaceholderData&&e.placeholderData===l?.placeholderData?(M=i.data,N=!0):M=typeof e.placeholderData=="function"?e.placeholderData(this.#p?.state.data,this.#p):e.placeholderData,M!==void 0&&(k="success",g=ww(i?.data,M,e),x=!0)}if(e.select&&g!==void 0&&!N)if(i&&g===a?.data&&e.select===this.#d)g=this.#l;else try{this.#d=e.select,g=e.select(g),g=ww(i?.data,g,e),this.#l=g,this.#a=null}catch(M){this.#a=M}this.#a&&(b=this.#a,g=this.#l,v=Date.now(),k="error");const S=p.fetchStatus==="fetching",A=k==="pending",E=k==="error",_=A&&S,T=g!==void 0,L={status:k,fetchStatus:p.fetchStatus,isPending:A,isSuccess:k==="success",isError:E,isInitialLoading:_,isLoading:_,data:g,dataUpdatedAt:p.dataUpdatedAt,error:b,errorUpdatedAt:v,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:p.dataUpdateCount>u.dataUpdateCount||p.errorUpdateCount>u.errorUpdateCount,isFetching:S,isRefetching:S&&!A,isLoadingError:E&&!T,isPaused:p.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:E&&T,isStale:dj(t,e),refetch:this.refetch,promise:this.#o,isEnabled:Tr(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const M=L.data!==void 0,I=L.status==="error"&&!M,z=Y=>{I?Y.reject(L.error):M&&Y.resolve(L.data)},ae=()=>{const Y=this.#o=L.promise=jw();z(Y)},U=this.#o;switch(U.status){case"pending":t.queryHash===s.queryHash&&z(U);break;case"fulfilled":(I||L.data!==U.value)&&ae();break;case"rejected":(!I||L.error!==U.reason)&&ae();break}}return L}updateResult(){const t=this.#n,e=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#r=this.options,this.#i.data!==void 0&&(this.#p=this.#t),Rx(e,t))return;this.#n=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#f.size)return!0;const a=new Set(i??this.#f);return this.options.throwOnError&&a.add("error"),Object.keys(this.#n).some(l=>{const d=l;return this.#n[d]!==t[d]&&a.has(d)})};this.#N({listeners:s()})}#j(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#s=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#N(t){en.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function zL(t,e){return Tr(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&Tr(e.retryOnMount,t)===!1)}function d5(t,e){return zL(t,e)||t.state.data!==void 0&&kw(t,e,e.refetchOnMount)}function kw(t,e,s){if(Tr(e.enabled,t)!==!1&&cl(e.staleTime,t)!=="static"){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&dj(t,e)}return!1}function u5(t,e,s,r){return(t!==e||Tr(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&dj(t,s)}function dj(t,e){return Tr(e.enabled,t)!==!1&&t.isStaleByTime(cl(e.staleTime,t))}function VL(t,e){return!Rx(t.getCurrentResult(),e)}var FL=class extends eA{#e;#t;#s;#n;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#t=[],this.state=t.state||sA(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#i({type:"continue"})},s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=ZE({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(a,l)=>{this.#i({type:"failed",failureCount:a,error:l})},onPause:()=>{this.#i({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});const r=this.state.status==="pending",i=!this.#n.canStart();try{if(r)e();else{this.#i({type:"pending",variables:t,isPaused:i}),this.#s.config.onMutate&&await this.#s.config.onMutate(t,this,s);const l=await this.options.onMutate?.(t,s);l!==this.state.context&&this.#i({type:"pending",context:l,variables:t,isPaused:i})}const a=await this.#n.start();return await this.#s.config.onSuccess?.(a,t,this.state.context,this,s),await this.options.onSuccess?.(a,t,this.state.context,s),await this.#s.config.onSettled?.(a,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(a,null,t,this.state.context,s),this.#i({type:"success",data:a}),a}catch(a){try{await this.#s.config.onError?.(a,t,this.state.context,this,s)}catch(l){Promise.reject(l)}try{await this.options.onError?.(a,t,this.state.context,s)}catch(l){Promise.reject(l)}try{await this.#s.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,s)}catch(l){Promise.reject(l)}try{await this.options.onSettled?.(void 0,a,t,this.state.context,s)}catch(l){Promise.reject(l)}throw this.#i({type:"error",error:a}),a}finally{this.#s.runNext(this)}}#i(t){const e=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),en.batch(()=>{this.#t.forEach(s=>{s.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function sA(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var UL=class extends Eu{constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#s=0}#e;#t;#s;build(t,e,s){const r=new FL({client:t,mutationCache:this,mutationId:++this.#s,options:t.defaultMutationOptions(e),state:s});return this.add(r),r}add(t){this.#e.add(t);const e=Mf(t);if(typeof e=="string"){const s=this.#t.get(e);s?s.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){const e=Mf(t);if(typeof e=="string"){const s=this.#t.get(e);if(s)if(s.length>1){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}else s[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=Mf(t);if(typeof e=="string"){const r=this.#t.get(e)?.find(i=>i.state.status==="pending");return!r||r===t}else return!0}runNext(t){const e=Mf(t);return typeof e=="string"?this.#t.get(e)?.find(r=>
9r!==t&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){en.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){const e={exact:!0,...t};return this.getAll().find(s=>r5(e,s))}findAll(t={}){return this.getAll().filter(e=>r5(t,e))}notify(t){en.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return en.batch(()=>Promise.all(t.map(e=>e.continue().catch(Gn))))}};function Mf(t){return t.options.scope?.id}var HL=class extends Eu{#e;#t=void 0;#s;#n;constructor(e,s){super(),this.#e=e,this.setOptions(s),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const s=this.options;this.options=this.#e.defaultMutationOptions(e),Rx(this.options,s)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),s?.mutationKey&&this.options.mutationKey&&Bc(s.mutationKey)!==Bc(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#r(e)}getCurrentResult(){return this.#t}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#i(),this.#r()}mutate(e,s){return this.#n=s,this.#s?.removeObserver(this),this.#s=this.#e.getMutationCache().build(this.#e,this.options),this.#s.addObserver(this),this.#s.execute(e)}#i(){const e=this.#s?.state??sA();this.#t={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#r(e){en.batch(()=>{if(this.#n&&this.hasListeners()){const s=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#n.onSuccess?.(e.data,s,r,i)}catch(a){Promise.reject(a)}try{this.#n.onSettled?.(e.data,null,s,r,i)}catch(a){Promise.reject(a)}}else if(e?.type==="error"){try{this.#n.onError?.(e.error,s,r,i)}catch(a){Promise.reject(a)}try{this.#n.onSettled?.(void 0,e.error,s,r,i)}catch(a){Promise.reject(a)}}}this.listeners.forEach(s=>{s(this.#t)})})}},qL=class extends Eu{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,s){const r=e.queryKey,i=e.queryHash??oj(r,e);let a=this.get(i);return a||(a=new $L({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(a)),a}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#e.get(t.queryHash);
vendor: 5,322 bytes, line 9
9e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){en.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(s=>n5(e,s))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(s=>n5(t,s)):e}notify(t){en.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){en.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){en.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},WL=class{#e;#t;#s;#n;#i;#r;#o;#a;constructor(t={}){this.#e=t.queryCache||new qL,this.#t=t.mutationCache||new UL,this.#s=t.defaultOptions||{},this.#n=new Map,this.#i=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#o=aj.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=Dx.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#r--,this.#r===0&&(this.#o?.(),this.#o=void 0,this.#a?.(),this.#a=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#e.build(this,e),r=s.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(cl(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:s})=>{const r=s.data;return[e,r]})}setQueryData(t,e,s){const r=this.defaultQueryOptions({queryKey:t}),a=this.#e.get(r.queryHash)?.state.data,l=CL(e,a);if(l!==void 0)return this.#e.build(this,r).setData(l,{...s,manual:!0})}setQueriesData(t,e,s){return en.batch(()=>this.#e.findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){const e=this.#e;en.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){const s=this.#e;return en.batch(()=>(s.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},r=en.batch(()=>this.#e.findAll(t).map(i=>i.cancel(s)));return Promise.all(r).then(Gn).catch(Gn)}invalidateQueries(t,e={}){return en.batch(()=>(this.#e.findAll(t).forEach(s=>{s.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},r=en.batch(()=>this.#e.findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let a=i.fetch(void 0,s);return s.throwOnError||(a=a.catch(Gn)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Gn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const s=this.#e.build(this,e);return s.isStaleByTime(cl(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Gn).catch(Gn)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Gn).catch(Gn)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return Dx.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#s}setDefaultOptions(t){this.#s=t}setQueryDefaults(t,e){this.#n.set(Bc(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#n.values()],s={};return e.forEach(r=>{xm(t,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(t,e){this.#i.set(Bc(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#i.values()],s={};return e.forEach(r=>{xm(t,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#s.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=oj(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===lj&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#s.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},nA=j.createContext(void 0),nb=t=>{const e=j.useContext(nA);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},GL=({client:t,children:e})=>(j.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),n.jsx(nA.Provider,{value:t,children:e})),rA=j.createContext(!1),KL=()=>j.useContext(rA);rA.Provider;function YL(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var QL=j.createContext(YL()),JL=()=>j.useContext(QL),XL=(t,e,s)=>{const r=s?.state.error&&typeof t.throwOnError=="function"?cj(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOn
9Mount=!1))},ZL=t=>{j.useEffect(()=>{t.clearReset()},[t])},e7=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||cj(s,[t.error,r])),t7=t=>{if(t.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},s7=(t,e)=>t.isLoading&&t.isFetching&&!e,n7=(t,e)=>t?.suspense&&e.isPending,h5=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function r7(t,e,s){const r=KL(),i=JL(),a=nb(),l=a.defaultQueryOptions(t);a.getDefaultOptions().queries?._experimental_beforeQuery?.(l);const d=a.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",t7(l),XL(l,i,d),ZL(i);const u=!a.getQueryCache().get(l.queryHash),[m]=j.useState(()=>new e(a,l)),p=m.getOptimisticResult(l),x=!r&&t.subscribed!==!1;if(j.useSyncExternalStore(j.useCallback(g=>{const b=x?m.subscribe(en.batchCalls(g)):Gn;return m.updateResult(),b},[m,x]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),j.useEffect(()=>{m.setOptions(l)},[l,m]),n7(l,p))throw h5(l,m,i);if(e7({result:p,errorResetBoundary:i,throwOnError:l.throwOnError,query:d,suspense:l.suspense}))throw p.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(l,p),l.experimental_prefetchInRender&&!gm.isServer()&&s7(p,r)&&(u?h5(l,m,i):d?.promise)?.catch(Gn).finally(()=>{m.updateResult()}),l.notifyOnChangeProps?p:m.trackResult(p)}function ds(t,e){return r7(t,BL)}function Mt(t,e){const s=nb(),[r]=j.useState(()=>new HL(s,t));j.useEffect(()=>{r.setOptions(t)},[r,t]);const i=j.useSyncExternalStore(j.useCallback(l=>r.subscribe(en.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=j.useCallback((l,d)=>{r.mutate(l,d).catch(Gn)},[r]);if(i.error&&cj(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}async function i7(t){if(!t.ok){const e=await t.text()||t.statusText;throw new Error(`${t.status}: ${e}`)}}const a7=({on401:t})=>async({queryKey:e})=>{const s=await fetch(e.join("/"),{credentials:"include"});return await i7(s),await s.json()},Wt=new WL({defaultOptions:{queries:{queryFn:a7({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!1,staleTime:1/0,retry:!1},mutations:{retry:!1}}}),o7=1,l7=1e6;let J0=0;function c7(){return J0=(J0+1)%Number.MAX_SAFE_INTEGER,J0.toString()}const X0=new Map,m5=t=>{if(X0.has(t))return;const e=setTimeout(()=>{X0.delete(t),Jh({type:"REMOVE_TOAST",toastId:t})},l7);X0.set(t,e)},d7=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,o7)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(s=>s.id===e.toast.id?{...s,...e.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=e;return s?m5(s):t.toasts.forEach(r=>{m5(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===s||s===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(s=>s.id!==e.toastId)}}},px=[];let fx={toasts:[]};function Jh(t){fx=d7(fx,t),px.forEach(e=>{e(fx)})}function u7({...t}){const e=c7(),s=i=>Jh({type:"UPDATE_TOAST",toast:{...i,id:e}}),r=()=>Jh({type:"DISMISS_TOAST",toastId:e});return Jh({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:s}}function h7(){const[t,e]=j.useState(fx);return j.useEffect(()=>(px.push(e),()=>{const s=px.indexOf(e);s>-1&&px.splice(s,1)}),[t]),{...t,toast:u7,dismiss:s=>Jh({type:"DISMISS_TOAST",toastId:s})}}var rb=$E();const iA=LE(rb);function tn(t,e,{checkForDefaultPrevented:s=!0}={}){return function(i){if(t?.(i),s===!1||!i.defaultPrevented)return e?.(i)}}function p5(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function ib(...t){return e=>{let s=!1;const r=t.map(i=>{const a=p5(i,e);return!s&&typeof a=="function"&&(s=!0),a});if(s)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():p5(t[i],null)}}}}function Ai(...t){return j.useCallback(ib(...t),t)}function ab(t,e=[]){let s=[];function r(a,l){const d=j.createContext(l),u=s.length;s=[...s,l];const m=x=>{const{scope:g,children:b,...v}=x,k=g?.[t]?.[u]||d,N=j.useMemo(()=>v,Object.values(v));return n.jsx(k.Provider,{value:N,children:b})};m.displayName=a+"Provider";function p(x,g){const b=g?.[t]?.[u]||d,v=j.useContext(b);if(v)return v;if(l!==void 0)return l;throw new Error(`\`${x}\` must be used within \`${a}\``)}return[m,p]}const i=()=>{const a=s.map(l=>j.createContext(l));return function(d){const u=d?.[t]||a;return j.useMemo(()=>({[`__scope${t}`]:{...d,[t]:u}}),[d,u])}};return i.scopeName=t,[r,m7(i,...e)]}function m7(...t){const e=t[0];if(t.length===1)return e;const s=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const l=r.reduce((d,{useScope:u,scopeName:m})=>{const x=u(a)[`__scope${m}`];return{...d,...x}},{});return j.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return s.scopeName=e.scopeName,s}function f5(t){const e=p7(t),s=j.forwardRef((r,i)=>{const{children:a,...l}=r,d=j.Children.toArray(a),u=d.find(x7);if(u){const m=u.props.children,p=d.map(x=>x===u?j.Children.count(m)>1?j.Children.only(null):j.isValidElement(m)?m.props.children:null:x);return n.jsx(e,{...l,ref:i,children:j.isValidElement(m)?j.cloneElement(m,void 0,p):null})}return n.jsx(e,{...l,ref:i,children:a})});return s.displayName=`${t}.Slot`,s}function p7(t){const e=j.forwardRef((s,r)=>{const{children:i,...a}=s;if(j.isValidElement(i)){const l=b7(i),d=g7(a,i.props);return i.type!==j.Fragment&&(d.ref=r?ib(r,l):l),j.cloneElement(i,d)}return j.Children.count(i)>1?j.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var f7=Symbol("radix.slottable");function x7(t){return j.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===f7}function g7(t,e){const s={...e};for(const r in e){const i=t[r],a=e[r];/^on[A-Z]/.test(r)?i&&a?s[r]=(...d)=>{const u=a(...d);return i(...d),u}:i&&(s[r]=i):r==="style"?s[r]={...i,...a}
vendor: 4,295 bytes, line 9
9:r==="className"&&(s[r]=[i,a].filter(Boolean).join(" "))}return{...t,...s}}function b7(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}function y7(t){const e=t+"CollectionProvider",[s,r]=ab(e),[i,a]=s(e,{collectionRef:{current:null},itemMap:new Map}),l=k=>{const{scope:N,children:S}=k,A=Kn.useRef(null),E=Kn.useRef(new Map).current;return n.jsx(i,{scope:N,itemMap:E,collectionRef:A,children:S})};l.displayName=e;const d=t+"CollectionSlot",u=f5(d),m=Kn.forwardRef((k,N)=>{const{scope:S,children:A}=k,E=a(d,S),_=Ai(N,E.collectionRef);return n.jsx(u,{ref:_,children:A})});m.displayName=d;const p=t+"CollectionItemSlot",x="data-radix-collection-item",g=f5(p),b=Kn.forwardRef((k,N)=>{const{scope:S,children:A,...E}=k,_=Kn.useRef(null),T=Ai(N,_),$=a(p,S);return Kn.useEffect(()=>($.itemMap.set(_,{ref:_,...E}),()=>{$.itemMap.delete(_)})),n.jsx(g,{[x]:"",ref:T,children:A})});b.displayName=p;function v(k){const N=a(t+"CollectionConsumer",k);return Kn.useCallback(()=>{const A=N.collectionRef.current;if(!A)return[];const E=Array.from(A.querySelectorAll(`[${x}]`));return Array.from(N.itemMap.values()).sort(($,L)=>E.indexOf($.ref.current)-E.indexOf(L.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:l,Slot:m,ItemSlot:b},v,r]}function v7(t){const e=w7(t),s=j.forwardRef((r,i)=>{const{children:a,...l}=r,d=j.Children.toArray(a),u=d.find(N7);if(u){const m=u.props.children,p=d.map(x=>x===u?j.Children.count(m)>1?j.Children.only(null):j.isValidElement(m)?m.props.children:null:x);return n.jsx(e,{...l,ref:i,children:j.isValidElement(m)?j.cloneElement(m,void 0,p):null})}return n.jsx(e,{...l,ref:i,children:a})});return s.displayName=`${t}.Slot`,s}function w7(t){const e=j.forwardRef((s,r)=>{const{children:i,...a}=s;if(j.isValidElement(i)){const l=S7(i),d=k7(a,i.props);return i.type!==j.Fragment&&(d.ref=r?ib(r,l):l),j.cloneElement(i,d)}return j.Children.count(i)>1?j.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var j7=Symbol("radix.slottable");function N7(t){return j.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===j7}function k7(t,e){const s={...e};for(const r in e){const i=t[r],a=e[r];/^on[A-Z]/.test(r)?i&&a?s[r]=(...d)=>{const u=a(...d);return i(...d),u}:i&&(s[r]=i):r==="style"?s[r]={...i,...a}:r==="className"&&(s[r]=[i,a].filter(Boolean).join(" "))}return{...t,...s}}function S7(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var C7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pr=C7.reduce((t,e)=>{const s=v7(`Primitive.${e}`),r=j.forwardRef((i,a)=>{const{asChild:l,...d}=i,u=l?s:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(u,{...d,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function aA(t,e){t&&rb.flushSync(()=>t.dispatchEvent(e))}function fl(t){const e=j.useRef(t);return j.useEffect(()=>{e.current=t}),j.useMemo(()=>(...s)=>e.current?.(...s),[])}function T7(t,e=globalThis?.document){const s=fl(t);j.useEffect(()=>{const r=i=>{i.key==="Escape"&&s(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[s,e])}var E7="DismissableLayer",Sw="dismissableLayer.update",A7="dismissableLayer.pointerDownOutside",M7="dismissableLayer.focusOutside",x5,oA=j.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),uj=j.forwardRef((t,e)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:l,onDismiss:d,...u}=t,m=j.useContext(oA),[p,x]=j.useState(null),g=p?.ownerDocument??globalThis?.document,[,b]=j.useState({}),v=Ai(e,L=>x(L)),k=Array.from(m.layers),[N]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),S=k.indexOf(N),A=p?k.indexOf(p):-1,E=m.layersWithOutsidePointerEventsDisabled.size>0,_=A>=S,T=O7(L=>{const M=L.target,I=[...m.branches].some(z=>
vendor: 4,689 bytes, line 9
9z.contains(M));!_||I||(i?.(L),l?.(L),L.defaultPrevented||d?.())},g),$=R7(L=>{const M=L.target;[...m.branches].some(z=>z.contains(M))||(a?.(L),l?.(L),L.defaultPrevented||d?.())},g);return T7(L=>{A===m.layers.size-1&&(r?.(L),!L.defaultPrevented&&d&&(L.preventDefault(),d()))},g),j.useEffect(()=>{if(p)return s&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(x5=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(p)),m.layers.add(p),g5(),()=>{s&&m.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=x5)}},[p,g,s,m]),j.useEffect(()=>()=>{p&&(m.layers.delete(p),m.layersWithOutsidePointerEventsDisabled.delete(p),g5())},[p,m]),j.useEffect(()=>{const L=()=>b({});return document.addEventListener(Sw,L),()=>document.removeEventListener(Sw,L)},[]),n.jsx(pr.div,{...u,ref:v,style:{pointerEvents:E?_?"auto":"none":void 0,...t.style},onFocusCapture:tn(t.onFocusCapture,$.onFocusCapture),onBlurCapture:tn(t.onBlurCapture,$.onBlurCapture),onPointerDownCapture:tn(t.onPointerDownCapture,T.onPointerDownCapture)})});uj.displayName=E7;var _7="DismissableLayerBranch",lA=j.forwardRef((t,e)=>{const s=j.useContext(oA),r=j.useRef(null),i=Ai(e,r);return j.useEffect(()=>{const a=r.current;if(a)return s.branches.add(a),()=>{s.branches.delete(a)}},[s.branches]),n.jsx(pr.div,{...t,ref:i})});lA.displayName=_7;function O7(t,e=globalThis?.document){const s=fl(t),r=j.useRef(!1),i=j.useRef(()=>{});return j.useEffect(()=>{const a=d=>{if(d.target&&!r.current){let u=function(){cA(A7,s,m,{discrete:!0})};const m={originalEvent:d};d.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=u,e.addEventListener("click",i.current,{once:!0})):u()}else e.removeEventListener("click",i.current);r.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",a),e.removeEventListener("click",i.current)}},[e,s]),{onPointerDownCapture:()=>r.current=!0}}function R7(t,e=globalThis?.document){const s=fl(t),r=j.useRef(!1);return j.useEffect(()=>{const i=a=>{a.target&&!r.current&&cA(M7,s,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,s]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function g5(){const t=new CustomEvent(Sw);document.dispatchEvent(t)}function cA(t,e,s,{discrete:r}){const i=s.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:s});e&&i.addEventListener(t,e,{once:!0}),r?aA(i,a):i.dispatchEvent(a)}var D7=uj,P7=lA,xl=globalThis?.document?j.useLayoutEffect:()=>{},I7="Portal",hj=j.forwardRef((t,e)=>{const{container:s,...r}=t,[i,a]=j.useState(!1);xl(()=>a(!0),[]);const l=s||i&&globalThis?.document?.body;return l?iA.createPortal(n.jsx(pr.div,{...r,ref:e}),l):null});hj.displayName=I7;function L7(t,e){return j.useReducer((s,r)=>e[s][r]??s,t)}var ob=t=>{const{present:e,children:s}=t,r=$7(e),i=typeof s=="function"?s({present:r.isPresent}):j.Children.only(s),a=Ai(r.ref,B7(i));return typeof s=="function"||r.isPresent?j.cloneElement(i,{ref:a}):null};ob.displayName="Presence";function $7(t){const[e,s]=j.useState(),r=j.useRef(null),i=j.useRef(t),a=j.useRef("none"),l=t?"mounted":"unmounted",[d,u]=L7(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return j.useEffect(()=>{const m=_f(r.current);a.current=d==="mounted"?m:"none"},[d]),xl(()=>{const m=r.current,p=i.current;if(p!==t){const g=a.current,b=_f(m);t?u("MOUNT"):b==="none"||m?.display==="none"?u("UNMOUNT"):u(p&&g!==b?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,u]),xl(()=>{if(e){let m;const p=e.ownerDocument.defaultView??window,x=b=>{const k=_f(r.current).includes(CSS.escape(b.animationName));if(b.target===e&&k&&(u("ANIMATION_END"),!i.current)){const N=e.style.animationFillMode;e.style.animationFillMode="forwards",m=p.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=N)})}},g=b=>{b.target===e&&(a.current=_f(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",x),e.addEventListener("animationend",x),()=>{p.clearTimeout(m),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",x),e.removeEventListener("animationend",x)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:j.useCallback(m=>{r.current=m?getComputedStyle(m):null,s(m)},[])}}function _f(t){return t?.animationName||"none"}function B7(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.
9isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var z7=X1[" useInsertionEffect ".trim().toString()]||xl;function V7({prop:t,defaultProp:e,onChange:s=()=>{},caller:r}){const[i,a,l]=F7({defaultProp:e,onChange:s}),d=t!==void 0,u=d?t:i;{const p=j.useRef(t!==void 0);j.useEffect(()=>{const x=p.current;x!==d&&console.warn(`${r} is changing from ${x?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=d},[d,r])}const m=j.useCallback(p=>{if(d){const x=U7(p)?p(t):p;x!==t&&l.current?.(x)}else a(p)},[d,t,a,l]);return[u,m]}function F7({defaultProp:t,onChange:e}){const[s,r]=j.useState(t),i=j.useRef(s),a=j.useRef(e);return z7(()=>{a.current=e},[e]),j.useEffect(()=>{i.current!==s&&(a.current?.(s),i.current=s)},[s,i]),[s,r,a]}function U7(t){return typeof t=="function"}var H7=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),q7="VisuallyHidden",lb=j.forwardRef((t,e)=>n.jsx(pr.span,{...t,ref:e,style:{...H7,...t.style}}));lb.displayName=q7;var W7=lb,mj="ToastProvider",[pj,G7,K7]=y7("Toast"),[dA]=ab("Toast",[K7]),[Y7,cb]=dA(mj),uA=t=>{const{__scopeToast:e,label:s="Notification",duration:r=5e3,swipeDirection:i="right",swipeThreshold:a=50,children:l}=t,[d,u]=j.useState(null),[m,p]=j.useState(0),x=j.useRef(!1),g=j.useRef(!1);return s.trim()||console.error(`Invalid prop \`label\` supplied to \`${mj}\`. Expected non-empty \`string\`.`),n.jsx(pj.Provider,{scope:e,children:n.jsx(Y7,{scope:e,label:s,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:m,viewport:d,onViewportChange:u,onToastAdd:j.useCallback(()=>p(b=>b+1),[]),onToastRemove:j.useCallback(()=>p(b=>b-1),[]),isFocusedToastEscapeKeyDownRef:x,isClosePausedRef:g,children:l})})};uA.displayName=mj;var hA="ToastViewport",Q7=["F8"],Cw="toast.viewportPause",Tw="toast.viewportResume",mA=j.forwardRef((t,e)=>{const{__scopeToast:s,hotkey:r=Q7,label:i="Notifications ({hotkey})",...a}=t,l=cb(hA,s),d=G7(s),u=j.useRef(null),m=j.useRef(null),p=j.useRef(null),x=j.useRef(null),g=Ai(e,x,l.onViewportChange),b=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=l.toastCount>0;j.useEffect(()=>{const N=S=>{r.length!==0&&r.every(E=>S[E]||S.code===E)&&x.current?.focus()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[r]),j.useEffect(()=>{const N=u.current,S=x.current;if(v&&N&&S){const A=()=>{if(!l.isClosePausedRef.current){const $=new CustomEvent(Cw);S.dispatchEvent($),l.isClosePausedRef.current=!0}},E=()=>{if(l.isClosePausedRef.current){const $=new CustomEvent(Tw);S.dispatchEvent($),l.isClosePausedRef.current=!1}},_=$=>{!N.contains($.relatedTarget)&&E()},T=()=>{N.contains(document.activeElement)||E()};return N.addEventListener("focusin",A),N.addEventListener("focusout",_),N.addEventListener("pointermove",A),N.addEventListener("pointerleave",T),window.addEventListener("blur",A),window.addEventListener("focus",E),()=>{N.removeEventListener("focusin",A),N.removeEventListener("focusout",_),N.removeEventListener("pointermove",A),N.removeEventListener("pointerleave",T),window.removeEventListener("blur",A),window.removeEventListener("focus",E)}}},[v,l.isClosePausedRef]);const k=j.useCallback(({tabbingDirection:N})=>{const A=d().map(E=>{const _=E.ref.current,T=[_,...c8(_)];return N==="forwards"?T:T.reverse()});return(N==="forwards"?A.reverse():A).flat()},[d]);return j.useEffect(()=>{const N=x.current;if(N){const S=A=>{const E=A.altKey||A.ctrlKey||A.metaKey;if(A.key==="Tab"&&!E){const T=document.activeElement,$=A.shiftKey;if(A.target===N&&$){m.current?.focus();return}const I=k({tabbingDirection:$?"backwards":"forwards"}),z=I.findIndex(ae=>ae===T);Z0(I.slice(z+1))?A.preventDefault():$?m.current?.focus():p.current?.focus()}};return N.addEventListener("keydown",S),()=>N.removeEventListener("keydown",S)}},[d,k]),n.jsxs(P7,{ref:u,role:"region","aria-label":i.replace("{hotkey}",b),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&n.jsx(Ew,{ref:m,onFocusFromOutsideViewport:()=>{const N=k({tabbingDirection:"forwards"});Z0(N)}}),n.jsx(pj.Slot,{scope:s,children:n.jsx(pr.ol,{tabIndex:-1,...a,ref:g})}),v&&n.jsx(Ew,{ref:p,onFocusFromOutsideViewport:()=>{const N=k({tabbingDirection:"backwards"});Z0(N)}})]})});mA.displayName=hA;var pA="ToastFocusProxy",Ew=j.forwardRef((t,e)=>{const{__scopeToast:s,onFocusFromOutsideViewport:r,...i}=t,a=cb(pA,s);return n.jsx(lb,{tabIndex:0,...i,ref:e,style:{position:"fixed"},onFocus:l=>{const d=l.relatedTarget;!a.viewport?.contains(d)&&r()}})});Ew.displayName=pA;var Xm="Toast",J7="toast.swipeStart",X7="toast.swipeMove",Z7="toast.swipeCancel",e8="toast.swipeEnd",fA=j.forwardRef((t,e)=>{const{forceMount:s,open:r,defaultOpen:i,onOpenChange:a,...l}=t,[d,u]=V7({prop:r,defaultProp:i??!0,onChange:a,caller:Xm});return n.jsx(ob,{present:s||d,children:n.jsx(n8,{open:d,...l,ref:e,onClose:()=>u(!1),onPause:fl(t.onPause),onResume:fl(t.onResume),onSwipeStart:tn(t.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:tn(t.onSwipeMove,m=>{const{x:p,y:x}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","move"),m.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${p}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${x}px`)}),onSwipeCancel:tn(t.onSwipeCancel,m=>{m.currentTarget.setAttribute("data-swipe","cancel"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:tn(t.onSwipeEnd,m=>{const{x:p,y:x}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","end"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${p}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${x}px`),u(!1)})})})});fA.displayName=Xm;var[t8,s8]=dA(Xm,{onClose(){}}),n8=j.forwardRef((t,e)=>{const{__scopeToast:s,type:r="foreground",duration:i,open:a,onClose:l,onEscapeKeyDown:d,onPause:u,onResume:m,onSwipeStart:p,onSwipeMove:x,onSwipeCancel:g,onSwipeEnd:b,...v}=t,k=cb(Xm,s),[N,S]=j.useState(null),A=Ai(e,P=>S(P)),E=j.useRef(null),_=j.useRef(null),T=i||k.duration,$=j.useRef(0),L=j.useRef(T),M=j.useRef(0),{onToastAdd:I,onToastRemove:z}=k,ae=fl(()=>{N?.contains(document.activeElement)&&k.viewport?.focus(),l()}),U=j.useCallback(P=>
9{!P||P===1/0||(window.clearTimeout(M.current),$.current=new Date().getTime(),M.current=window.setTimeout(ae,P))},[ae]);j.useEffect(()=>{const P=k.viewport;if(P){const ne=()=>{U(L.current),m?.()},q=()=>{const W=new Date().getTime()-$.current;L.current=L.current-W,window.clearTimeout(M.current),u?.()};return P.addEventListener(Cw,q),P.addEventListener(Tw,ne),()=>{P.removeEventListener(Cw,q),P.removeEventListener(Tw,ne)}}},[k.viewport,T,u,m,U]),j.useEffect(()=>{a&&!k.isClosePausedRef.current&&U(T)},[a,T,k.isClosePausedRef,U]),j.useEffect(()=>(I(),()=>z()),[I,z]);const Y=j.useMemo(()=>N?jA(N):null,[N]);return k.viewport?n.jsxs(n.Fragment,{children:[Y&&n.jsx(r8,{__scopeToast:s,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:Y}),n.jsx(t8,{scope:s,onClose:ae,children:rb.createPortal(n.jsx(pj.ItemSlot,{scope:s,children:n.jsx(D7,{asChild:!0,onEscapeKeyDown:tn(d,()=>{k.isFocusedToastEscapeKeyDownRef.current||ae(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:n.jsx(pr.li,{tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":k.swipeDirection,...v,ref:A,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:tn(t.onKeyDown,P=>{P.key==="Escape"&&(d?.(P.nativeEvent),P.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,ae()))}),onPointerDown:tn(t.onPointerDown,P=>{P.button===0&&(E.current={x:P.clientX,y:P.clientY})}),onPointerMove:tn(t.onPointerMove,P=>{if(!E.current)return;const ne=P.clientX-E.current.x,q=P.clientY-E.current.y,W=!!_.current,ie=["left","right"].includes(k.swipeDirection),he=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,se=ie?he(0,ne):0,B=ie?0:he(0,q),le=P.pointerType==="touch"?10:2,pe={x:se,y:B},Oe={originalEvent:P,delta:pe};W?(_.current=pe,Of(X7,x,Oe,{discrete:!1})):b5(pe,k.swipeDirection,le)?(_.current=pe,Of(J7,p,Oe,{discrete:!1}),P.target.setPointerCapture(P.pointerId)):(Math.abs(ne)>le||Math.abs(q)>le)&&(E.current=null)}),onPointerUp:tn(t.onPointerUp,P=>{const ne=_.current,q=P.target;if(q.hasPointerCapture(P.pointerId)&&q.releasePointerCapture(P.pointerId),_.current=null,E.current=null,ne){const W=P.currentTarget,ie={originalEvent:P,delta:ne};b5(ne,k.swipeDirection,k.swipeThreshold)?Of(e8,b,ie,{discrete:!0}):Of(Z7,g,ie,{discrete:!0}),W.addEventListener("click",he=>he.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),r8=t=>{const{__scopeToast:e,children:s,...r}=t,i=cb(Xm,e),[a,l]=j.useState(!1),[d,u]=j.useState(!1);return o8(()=>l(!0)),j.useEffect(()=>{const m=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(m)},[]),d?null:n.jsx(hj,{asChild:!0,children:n.jsx(lb,{...r,children:a&&n.jsxs(n.Fragment,{children:[i.label," ",s]})})})},i8="ToastTitle",xA=j.forwardRef((t,e)=>{const{__scopeToast:s,...r}=t;return n.jsx(pr.div,{...r,ref:e})});xA.displayName=i8;var a8="ToastDescription",gA=j.forwardRef((t,e)=>{const{__scopeToast:s,...r}=t;return n.jsx(pr.div,{...r,ref:e})});gA.displayName=a8;var bA="ToastAction",yA=j.forwardRef((t,e)=>{const{altText:s,...r}=t;return s.trim()?n.jsx(wA,{altText:s,asChild:!0,children:n.jsx(fj,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${bA}\`. Expected non-empty \`string\`.`),null)});yA.displayName=bA;var vA="ToastClose",fj=j.forwardRef((t,e)=>{const{__scopeToast:s,...r}=t,i=s8(vA,s);return n.jsx(wA,{asChild:!0,children:n.jsx(pr.button,{type:"button",...r,ref:e,onClick:tn(t.onClick,i.onClose)})})});fj.displayName=vA;var wA=j.forwardRef((t,e)=>{const{__scopeToast:s,altText:r,...i}=t;return n.jsx(pr.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...i,ref:e})});function jA(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),l8(r)){const i=r.ariaHidden||r.hidden||r.style.display==="none",a=r.dataset.radixToastAnnounceExclude==="";if(!i)if(a){const l=r.dataset.radixToastAnnounceAlt;l&&e.push(l)}else e.push(...jA(r))}}),e}function Of(t,e,s,{discrete:r}){const i=s.originalEvent.currentTarget,a=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:s});e&&i.addEventListener(t,e,{once:!0}),r?aA(i,a):i.dispatchEvent(a)}var b5=(t,e,s=0)=>{const r=Math.abs(t.x),i=Math.abs(t.y),a=r>i;return e==="left"||e==="right"?a&&r>s:!a&&i>s};function o8(t=()=>{}){const e=fl(t);xl(()=>{let s=0,r=0;return s=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(s),window.cancelAnimationFrame(r)}},[e])}function l8(t){return t.nodeType===t.ELEMENT_NODE}function c8(t){const e=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)e.push(s.currentNode);return e}function Z0(t){const e=document.activeElement;return t.some(s=>s===e?!0:(s.focus(),document.activeElement!==e))}var d8=uA,NA=mA,kA=fA,SA=xA,CA=gA,TA=yA,EA=fj;function AA(t){var e,s,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(s=AA(t[e]))&&(r&&(r+=" "),r+=s)}else for(s in t)t[s]&&(r&&(r+=" "),r+=s);return r}function MA(){for(var t,e,s=0,r="",i=arguments.length;s<i;s++)(t=arguments[s])&&(e=AA(t))&&(r&&(r+=" "),r+=e);return r}const y5=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,v5=MA,_A=(t,e)=>s=>{var r;if(e?.variants==null)return v5(t,s?.class,s?.className);const{variants:i,defaultVariants:a}=e,l=Object.keys(i).map(m=>{const p=s?.[m],x=a?.[m];if(p===null)return null;const g=y5(p)||y5(x);return i[m][g]}),d=s&&Object.entries(s).reduce((m,p)=>{let[x,g]=p;return g===void 0||(m[x]=g),m},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((m,p)=>{let{class:x,className:g,...b}=p;return Object.entries(b).every(v=>{let[k,N]=v;return Array.isArray(N)?N.includes({...a,...d}[k]):{...a,...d}[k]===N})?[...m,x,g]:m},[]);return v5(t,l,u,s?.class,s?.className)};const u8=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),h8=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,s,r)=>r?r.toUpperCase():s.toLowerCase()),w5=t=>{const e=h8(t);return e.charAt(0).toUpperCase()+e.slice(1)},OA=(...t)=>t.filter((e,s,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===s).join(" ").trim(),m8=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var p8={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const f8=j.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:i="",children:a,iconNode:l,...d},u)=>j.createElement("svg",{ref:u,...p8,width:e,height:e,stroke:t,strokeWidth:r?Number(s)*24/Number(e):s,className:OA("lucide",i),...!a&&!m8(d)&&{"aria-hidden":"true"},...d},[...l.map(([m,p])=>j.createElement(m,p)),...Array.isArray(a)?a:[a]]));const ke=(t,e)=>{const s=j.forwardRef(({className:r,...i},a)=>j.createElement(f8,{ref:a,iconNode:e,className:OA(`lucide-${u8(w5(t))}`,`lucide-${t}`,r),...i}));return s.displayName=w5(t),s};const x8=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l
9-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],hu=ke("activity",x8);const g8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14.31 8 5.74 9.94",key:"1y6ab4"}],["path",{d:"M9.69 8h11.48",key:"1wxppr"}],["path",{d:"m7.38 12 5.74-9.94",key:"1grp0k"}],["path",{d:"M9.69 16 3.95 6.06",key:"libnyf"}],["path",{d:"M14.31 16H2.83",key:"x5fava"}],["path",{d:"m16.62 12-5.74 9.94",key:"1vwawt"}]],RA=ke("aperture",g8);const b8=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],DA=ke("arrow-down",b8);const y8=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],kn=ke("arrow-right",y8);const v8=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],xj=ke("arrow-up",v8);const w8=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],j8=ke("bell",w8);const N8=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],k8=ke("book-open",N8);const S8=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],C8=ke("bookmark",S8);const T8=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Zd=ke("bot",T8);const E8=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],A8=ke("boxes",E8);const M8=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],PA=ke("building-2",M8);const _8=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],db=ke("check",_8);const O8=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],mo=ke("chevron-down",O8);const R8=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],D8=ke("chevron-left",R8);const P8=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],no=ke("chevron-right",P8);const I8=[["path",{d:"M10.88 21.94 15.46 14",key:"xkve6t"}],["path",{d:"M21.17 8H12",key:"19dcdn"}],["path",{d:"M3.95 6.06 8.54 14",key:"g8jz9m"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],ii=ke("chromium",I8);const L8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Aw=ke("circle-alert",L8);const $8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],vs=ke("circle-check",$8);const B8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],gj=ke("circle-question-mark",B8);const z8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],IA=ke("circle-x",z8);const V8=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],F8=ke("clipboard-check",V8);const U8=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],LA=ke("clock",U8);const H8=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}
9]],q8=ke("code-xml",H8);const W8=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],j5=ke("copy",W8);const G8=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],K8=ke("credit-card",G8);const Y8=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],$A=ke("database",Y8);const Q8=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],bj=ke("dollar-sign",Q8);const J8=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],na=ke("download",J8);const X8=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Px=ke("external-link",X8);const Z8=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],e9=ke("eye-off",Z8);const t9=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ix=ke("eye",t9);const s9=[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]],BA=ke("file-audio",s9);const n9=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]],r9=ke("file-check",n9);const i9=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],Mw=ke("file-code-2",i9);const a9=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],zA=ke("file-code",a9);const o9=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],l9=ke("file-json",o9);const c9=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]],d9=ke("file-search",c9);const u9=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],h9=ke("file-spreadsheet",u9);const m9=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Mi=ke("file-text",m9);const p9=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]],VA=ke("file-type-2",p9);const f9=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],FA=ke("folder-open",f9);const x9=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],g9=ke("funnel",x9);const b9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],_w=ke("globe",b9);const y9=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],UA=ke("graduation-cap",y9);const v9=[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]],w9=ke("hourglass",v9);
9const j9=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],HA=ke("house",j9);const N9=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],N5=ke("inbox",N9);const k9=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],yj=ke("key-round",k9);const S9=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],C9=ke("layout-dashboard",S9);const T9=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],E9=ke("life-buoy",T9);const A9=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],qA=ke("lightbulb",A9);const M9=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Xh=ke("loader-circle",M9);const _9=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],O9=ke("log-out",_9);const R9=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],po=ke("lock",R9);const D9=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Zm=ke("mail",D9);const P9=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],I9=ke("menu",P9);const L9=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],$9=ke("message-circle",L9);const B9=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],z9=ke("message-square-plus",B9);const V9=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],F9=ke("message-square",V9);const U9=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],oo=ke("mic",U9);const H9=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],q9=ke("minimize-2",H9);const W9=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],gl=ke("mouse-pointer-click",W9);const G9=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],K9=ke("network",G9);const Y9=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],WA=ke("paperclip",Y9);const Q9=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],J9=ke("pause",Q9);const X9=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ub=ke("pencil",X9);const Z9=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],e$=ke("play",Z9);const t$=[["path",{d:"M12 22v-5",key:"1ega77"}
9],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],s$=ke("plug",t$);const n$=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bm=ke("plus",n$);const r$=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],i$=ke("power",r$);const a$=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],o$=ke("quote",a$);const l$=[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]],c$=ke("receipt",l$);const d$=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],hb=ke("refresh-cw",d$);const u$=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],h$=ke("repeat",u$);const m$=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],GA=ke("route",m$);const p$=[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]],KA=ke("scale",p$);const f$=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],YA=ke("search",f$);const x$=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Lx=ke("send",x$);const g$=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ym=ke("settings",g$);const b$=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],vj=ke("shield-check",b$);const y$=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],QA=ke("shield",y$);const v$=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],JA=ke("sliders-horizontal",v$);const w$=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}
vendor: 6,324 bytes, line 9
9],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],lo=ke("sparkles",w$);const j$=[["path",{d:"M18 21a6 6 0 0 0-12 0",key:"kaz2du"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],N$=ke("square-user-round",j$);const k$=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],k5=ke("star",k$);const S$=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ep=ke("trash-2",S$);const C$=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],$x=ke("trending-up",C$);const T$=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],oi=ke("triangle-alert",T$);const E$=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],A$=ke("type",E$);const M$=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],_$=ke("upload",M$);const O$=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],R$=ke("user-check",O$);const D$=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],XA=ke("user-plus",D$);const P$=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],ZA=ke("users-round",P$);const I$=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],wj=ke("users",I$);const L$=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],$$=ke("user",L$);const B$=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],eM=ke("volume-2",B$);const z$=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],V$=ke("webhook",z$);const F$=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],tM=ke("workflow",F$);const U$=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ro=ke("x",U$);const H$=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],q$=ke("zap",H$),W$=(t,e)=>{const s=new Array(t.length+e.length);for(let r=0;r<t.length;r++)s[r]=t[r];for(let r=0;r<e.length;r++)s[t.length+r]=e[r];return s},G$=(t,e)=>({classGroupId:t,validator:e}),sM=(t=new Map,e=null,s)=>({nextPart:t,validators:e,classGroupId:s}),Bx="-",S5=[],K$="arbitrary..",Y$=t=>{const e=J$(t),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return Q$(l);const d=l.split(Bx),u=d[0]===""&&d.length>1?1:0;return nM(d,u,e)},getConflictingClassGroupIds:(l,d)=>{if(d){const u=r[l],m=s[l];return u?m?W$(m,u):u:m||S5}return s[l]||S5}}},nM=(t,e,s)=>{if(t.length-e===0)return s.classGroupId;const i=t[e],a=s.nextPart.get(i);if(a){const m=nM(t,e+1,a);if(m)return m}const l=s.validators;if(l===null)return;const d=e===0?t.join(Bx):t.slice(e).join(Bx),u=l.length;for(let m=0;m<u;m++){const p=l[m];if(p.validator(d))return p.classGroupId}},Q$=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),s=e.indexOf(":"),r=e.slice(0,s);return r?K$+r:void 0})(),J$=t=>{const{theme:e,classGroups:s}=t;return X$(s,e)},X$=(t,e)=>{const s=sM();for(const r in t){const i=t[r];jj(i,s,r,e)}return s},jj=(t,e,s,r)=>{const i=t.length;for(let a=0;a<i;a++){const l=t[a];Z$(l,e,s,r)}},Z$=(t,e,s,r)=>{if(typeof t=="string"){eB(t,e,s);return}if(typeof t=="function"){tB(t,e,s,r);return}sB(t,e,s,r)},eB=(t,e,s)=>{const r=t===""?e:rM(e,t);r.classGroupId=s},tB=(t,e,s,r)=>{if(nB(t)){jj(t(r),e,s,r);return}e.validators===null&&(e.validators=[]),e.validators.push(G$(s,t))},sB=(t,e,s,r)=>{const i=Object.entries(t),a=i.length;for(let l=0;l<a;l++){const[d,u]=i[l];jj(u,rM(e,d),s,r)}},rM=(t,e)=>{let s=t;const r=e.split(Bx),i=r.length;for(let a=0;a<i;a++){const l=r[a];let d=s.nextPart.get(l);d||(d=sM(),s.nextPart.set(l,d)),s=d}return s},nB=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,rB=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,s=Object.create(null),r=Object.create(null);const i=(a,l)=>{s[a]=l,e++,e>t&&(e=0,r=s,s=Object.create(null))};return{get(a){let l=s[a];if(l!==void 0)return l;if((l=r[a])!==void 0)return i(a,l),l},set(a,l){a in s?s[a]=l:i(a,l)}}},Ow="!",C5=":",iB=[],T5=(t,e,s,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:s,maybePostfixModifierPosition:r,isExternal:i}),aB=t=>{const{prefix:e,experimentalParseClassName:s}=t;let r=i=>{const a=[];let l=0,d=0,u=0,m;const p=i.length;for(let k=0;k<p;k++){const N=i[k];
vendor: 6,458 bytes, line 9
9if(l===0&&d===0){if(N===C5){a.push(i.slice(u,k)),u=k+1;continue}if(N==="/"){m=k;continue}}N==="["?l++:N==="]"?l--:N==="("?d++:N===")"&&d--}const x=a.length===0?i:i.slice(u);let g=x,b=!1;x.endsWith(Ow)?(g=x.slice(0,-1),b=!0):x.startsWith(Ow)&&(g=x.slice(1),b=!0);const v=m&&m>u?m-u:void 0;return T5(a,b,g,v)};if(e){const i=e+C5,a=r;r=l=>l.startsWith(i)?a(l.slice(i.length)):T5(iB,!1,l,void 0,!0)}if(s){const i=r;r=a=>s({className:a,parseClassName:i})}return r},oB=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((s,r)=>{e.set(s,1e6+r)}),s=>{const r=[];let i=[];for(let a=0;a<s.length;a++){const l=s[a],d=l[0]==="[",u=e.has(l);d||u?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(l)):i.push(l)}return i.length>0&&(i.sort(),r.push(...i)),r}},lB=t=>({cache:rB(t.cacheSize),parseClassName:aB(t),sortModifiers:oB(t),postfixLookupClassGroupIds:cB(t),...Y$(t)}),cB=t=>{const e=Object.create(null),s=t.postfixLookupClassGroups;if(s)for(let r=0;r<s.length;r++)e[s[r]]=!0;return e},dB=/\s+/,uB=(t,e)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:l}=e,d=[],u=t.trim().split(dB);let m="";for(let p=u.length-1;p>=0;p-=1){const x=u[p],{isExternal:g,modifiers:b,hasImportantModifier:v,baseClassName:k,maybePostfixModifierPosition:N}=s(x);if(g){m=x+(m.length>0?" "+m:m);continue}let S=!!N,A;if(S){const L=k.substring(0,N);A=r(L);const M=A&&l[A]?r(k):void 0;M&&M!==A&&(A=M,S=!1)}else A=r(k);if(!A){if(!S){m=x+(m.length>0?" "+m:m);continue}if(A=r(k),!A){m=x+(m.length>0?" "+m:m);continue}S=!1}const E=b.length===0?"":b.length===1?b[0]:a(b).join(":"),_=v?E+Ow:E,T=_+A;if(d.indexOf(T)>-1)continue;d.push(T);const $=i(A,S);for(let L=0;L<$.length;++L){const M=$[L];d.push(_+M)}m=x+(m.length>0?" "+m:m)}return m},hB=(...t)=>{let e=0,s,r,i="";for(;e<t.length;)(s=t[e++])&&(r=iM(s))&&(i&&(i+=" "),i+=r);return i},iM=t=>{if(typeof t=="string")return t;let e,s="";for(let r=0;r<t.length;r++)t[r]&&(e=iM(t[r]))&&(s&&(s+=" "),s+=e);return s},mB=(t,...e)=>{let s,r,i,a;const l=u=>{const m=e.reduce((p,x)=>x(p),t());return s=lB(m),r=s.cache.get,i=s.cache.set,a=d,d(u)},d=u=>{const m=r(u);if(m)return m;const p=uB(u,s);return i(u,p),p};return a=l,(...u)=>a(hB(...u))},pB=[],Js=t=>{const e=s=>s[t]||pB;return e.isThemeGetter=!0,e},aM=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,oM=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fB=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,xB=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gB=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,bB=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,yB=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,vB=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Go=t=>fB.test(t),vt=t=>!!t&&!Number.isNaN(Number(t)),Ki=t=>!!t&&Number.isInteger(Number(t)),ev=t=>t.endsWith("%")&&vt(t.slice(0,-1)),Ha=t=>xB.test(t),lM=()=>!0,wB=t=>gB.test(t)&&!bB.test(t),Nj=()=>!1,jB=t=>yB.test(t),NB=t=>vB.test(t),kB=t=>!Ve(t)&&!He(t),SB=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),CB=t=>Ml(t,uM,Nj),Ve=t=>aM.test(t),uc=t=>Ml(t,hM,wB),E5=t=>Ml(t,DB,vt),TB=t=>Ml(t,pM,lM),EB=t=>Ml(t,mM,Nj),A5=t=>Ml(t,cM,Nj),AB=t=>Ml(t,dM,NB),Rf=t=>Ml(t,fM,jB),He=t=>oM.test(t),Ah=t=>Qc(t,hM),MB=t=>Qc(t,mM),M5=t=>Qc(t,cM),_B=t=>Qc(t,uM),OB=t=>Qc(t,dM),Df=t=>Qc(t,fM,!0),RB=t=>Qc(t,pM,!0),Ml=(t,e,s)=>{const r=aM.exec(t);return r?r[1]?e(r[1]):s(r[2]):!1},Qc=(t,e,s=!1)=>{const r=oM.exec(t);return r?r[1]?e(r[1]):s:!1},cM=t=>t==="position"||t==="percentage",dM=t=>t==="image"||t==="url",uM=t=>t==="length"||t==="size"||t==="bg-size",hM=t=>t==="length",DB=t=>t==="number",mM=t=>t==="family-name",pM=t=>t==="number"||t==="weight",fM=t=>t==="shadow",PB=()=>{const t=Js("color"),e=Js("font"),s=Js("text"),r=Js("font-weight"),i=Js("tracking"),a=Js("leading"),l=Js("breakpoint"),d=Js("container"),u=Js("spacing"),m=Js("radius"),p=Js("shadow"),x=Js("inset-shadow"),g=Js("text-shadow"),b=Js("drop-shadow"),v=Js("blur"),k=Js("perspective"),N=Js("aspect"),S=Js("ease"),A=Js("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[..._(),He,Ve],$=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],M=()=>[He,Ve,u],I=()=>[Go,"full","auto",...M()],z=()=>[Ki,"none","subgrid",He,Ve],ae=()=>["auto",{span:["full",Ki,He,Ve]},Ki,He,Ve],U=()=>[Ki,"auto",He,Ve],Y=()=>["auto","min","max","fr",He,Ve],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ne=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...M()],W=()=>[Go,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],ie=()=>[Go,"screen","full","dvw","lvw","svw","min","max","fit",...M()],he=()=>[Go,"screen","full","lh","dvh","lvh","svh","min","max","fit",...M()],se=()=>[t,He,Ve],B=()=>[..._(),M5,A5,{position:[He,Ve]}],le=()=>["no-repeat",{repeat:["","x","y","space","round"]}],pe=()=>["auto","cover","contain",_B,CB,{size:[He,Ve]}],Oe=()=>[ev,Ah,uc],Se=()=>["","none","full",m,He,Ve],D=()=>["",vt,Ah,uc],V=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[vt,ev,M5,A5],Me=()=>["","none",v,He,Ve],We=()=>["none",vt,He,Ve],_e=()=>["none",vt,He,Ve],Re=()=>[vt,He,Ve],ze=()=>[Go,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ha],breakpoint:[Ha],color:[lM],container:[Ha],"drop-shadow":[Ha],ease:["in","out","in-out"],font:[kB],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ha],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ha],shadow:[Ha],spacing:["px",vt],text:[Ha],"text-shadow":[Ha],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Go,Ve,He,N]}],container:["container"],"container-type":[{"@container":["","normal","size",He,Ve]}
vendor: 6,140 bytes, line 9
9],"container-named":[SB],columns:[{columns:[vt,Ve,He,d]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Ki,"auto",He,Ve]}],basis:[{basis:[Go,"full","auto",d,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[vt,Go,"auto","initial","none",Ve]}],grow:[{grow:["",vt,He,Ve]}],shrink:[{shrink:["",vt,He,Ve]}],order:[{order:[Ki,"first","last","none",He,Ve]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:ae()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:ae()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Y()}],"auto-rows":[{"auto-rows":Y()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...ne(),"normal"]}],"justify-self":[{"justify-self":["auto",...ne()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...ne(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ne(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...ne(),"baseline"]}],"place-self":[{"place-self":["auto",...ne()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pbs:[{pbs:M()}],pbe:[{pbe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...ie()]}],"min-inline-size":[{"min-inline":["auto",...ie()]}],"max-inline-size":[{"max-inline":["none",...ie()]}],"block-size":[{block:["auto",...he()]}],"min-block-size":[{"min-block":["auto",...he()]}],"max-block-size":[{"max-block":["none",...he()]}],w:[{w:[d,"screen",...W()]}],"min-w":[{"min-w":[d,"screen","none",...W()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[l]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",s,Ah,uc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,RB,TB]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ev,Ve]}],"font-family":[{font:[MB,EB,e]}],"font-features":[{"font-features":[Ve]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,He,Ve]}],"line-clamp":[{"line-clamp":[vt,"none",He,E5]}],leading:[{leading:[a,...M()]}],"list-image":[{"list-image":["none",He,Ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",He,Ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:se()}],"text-color":[{text:se()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[vt,"from-font","auto",He,uc]}],"text-decoration-color":[{decoration:se()}],"underline-offset":[{"underline-offset":[vt,"auto",He,Ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"tab-size":[{tab:[Ki,He,Ve]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",He,Ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",He,Ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:B()}],"bg-repeat":[{bg:le()}],"bg-size":[{bg:pe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ki,He,Ve],radial:["",He,Ve],conic:[Ki,He,Ve]},OB,AB]}],"bg-color":[{bg:se()}],"gradient-from-pos":[{from:Oe()}
9],"gradient-via-pos":[{via:Oe()}],"gradient-to-pos":[{to:Oe()}],"gradient-from":[{from:se()}],"gradient-via":[{via:se()}],"gradient-to":[{to:se()}],rounded:[{rounded:Se()}],"rounded-s":[{"rounded-s":Se()}],"rounded-e":[{"rounded-e":Se()}],"rounded-t":[{"rounded-t":Se()}],"rounded-r":[{"rounded-r":Se()}],"rounded-b":[{"rounded-b":Se()}],"rounded-l":[{"rounded-l":Se()}],"rounded-ss":[{"rounded-ss":Se()}],"rounded-se":[{"rounded-se":Se()}],"rounded-ee":[{"rounded-ee":Se()}],"rounded-es":[{"rounded-es":Se()}],"rounded-tl":[{"rounded-tl":Se()}],"rounded-tr":[{"rounded-tr":Se()}],"rounded-br":[{"rounded-br":Se()}],"rounded-bl":[{"rounded-bl":Se()}],"border-w":[{border:D()}],"border-w-x":[{"border-x":D()}],"border-w-y":[{"border-y":D()}],"border-w-s":[{"border-s":D()}],"border-w-e":[{"border-e":D()}],"border-w-bs":[{"border-bs":D()}],"border-w-be":[{"border-be":D()}],"border-w-t":[{"border-t":D()}],"border-w-r":[{"border-r":D()}],"border-w-b":[{"border-b":D()}],"border-w-l":[{"border-l":D()}],"divide-x":[{"divide-x":D()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":D()}
vendor: 5,605 bytes, line 9
9],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:se()}],"border-color-x":[{"border-x":se()}],"border-color-y":[{"border-y":se()}],"border-color-s":[{"border-s":se()}],"border-color-e":[{"border-e":se()}],"border-color-bs":[{"border-bs":se()}],"border-color-be":[{"border-be":se()}],"border-color-t":[{"border-t":se()}],"border-color-r":[{"border-r":se()}],"border-color-b":[{"border-b":se()}],"border-color-l":[{"border-l":se()}],"divide-color":[{divide:se()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[vt,He,Ve]}],"outline-w":[{outline:["",vt,Ah,uc]}],"outline-color":[{outline:se()}],shadow:[{shadow:["","none",p,Df,Rf]}],"shadow-color":[{shadow:se()}],"inset-shadow":[{"inset-shadow":["none",x,Df,Rf]}],"inset-shadow-color":[{"inset-shadow":se()}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:se()}],"ring-offset-w":[{"ring-offset":[vt,uc]}],"ring-offset-color":[{"ring-offset":se()}],"inset-ring-w":[{"inset-ring":D()}],"inset-ring-color":[{"inset-ring":se()}],"text-shadow":[{"text-shadow":["none",g,Df,Rf]}],"text-shadow-color":[{"text-shadow":se()}],opacity:[{opacity:[vt,He,Ve]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[vt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":se()}],"mask-image-linear-to-color":[{"mask-linear-to":se()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":se()}],"mask-image-t-to-color":[{"mask-t-to":se()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":se()}],"mask-image-r-to-color":[{"mask-r-to":se()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":se()}],"mask-image-b-to-color":[{"mask-b-to":se()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":se()}],"mask-image-l-to-color":[{"mask-l-to":se()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":se()}],"mask-image-x-to-color":[{"mask-x-to":se()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":se()}],"mask-image-y-to-color":[{"mask-y-to":se()}],"mask-image-radial":[{"mask-radial":[He,Ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":se()}],"mask-image-radial-to-color":[{"mask-radial-to":se()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[vt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":se()}],"mask-image-conic-to-color":[{"mask-conic-to":se()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:B()}],"mask-repeat":[{mask:le()}],"mask-size":[{mask:pe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",He,Ve]}],filter:[{filter:["","none",He,Ve]}],blur:[{blur:Me()}],brightness:[{brightness:[vt,He,Ve]}],contrast:[{contrast:[vt,He,Ve]}],"drop-shadow":[{"drop-shadow":["","none",b,Df,Rf]}],"drop-shadow-color":[{"drop-shadow":se()}],grayscale:[{grayscale:["",vt,He,Ve]}],"hue-rotate":[{"hue-rotate":[vt,He,Ve]}],invert:[{invert:["",vt,He,Ve]}],saturate:[{saturate:[vt,He,Ve]}],sepia:[{sepia:["",vt,He,Ve]}],"backdrop-filter":[{"backdrop-filter":["","none",He,Ve]}],"backdrop-blur":[{"backdrop-blur":Me()}],"backdrop-brightness":[{"backdrop-brightness":[vt,He,Ve]}],"backdrop-contrast":[{"backdrop-contrast":[vt,He,Ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",vt,He,Ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[vt,He,Ve]}],"backdrop-invert":[{"backdrop-invert":["",vt,He,Ve]}],"backdrop-opacity":[{"backdrop-opacity":[vt,He,Ve]}],"backdrop-saturate":[{"backdrop-saturate":[vt,He,Ve]}],"backdrop-sepia":[{"backdrop-sepia":["",vt,He,Ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",He,Ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[vt,"initial",He,Ve]}],ease:[{ease:["linear","initial",S,He,Ve]}],delay:[{delay:[vt,He,Ve]}],animate:[{animate:["none",A,He,Ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,He,Ve]}],"perspective-origin":[{"perspective-origin":T()}
9],rotate:[{rotate:We()}],"rotate-x":[{"rotate-x":We()}],"rotate-y":[{"rotate-y":We()}],"rotate-z":[{"rotate-z":We()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":["scale-3d"],skew:[{skew:Re()}],"skew-x":[{"skew-x":Re()}],"skew-y":[{"skew-y":Re()}],transform:[{transform:[He,Ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ze()}],"translate-x":[{"translate-x":ze()}],"translate-y":[{"translate-y":ze()}],"translate-z":[{"translate-z":ze()}],"translate-none":["translate-none"],zoom:[{zoom:[Ki,He,Ve]}],accent:[{accent:se()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:se()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",He,Ve]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":se()}],"scrollbar-track-color":[{"scrollbar-track":se()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mbs":[{"scroll-mbs":M()}],"scroll-mbe":[{"scroll-mbe":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pbs":[{"scroll-pbs":M()}],"scroll-pbe":[{"scroll-pbe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",He,Ve]}],fill:[{fill:["none",...se()]}],"stroke-w":[{stroke:[vt,Ah,uc,E5]}],stroke:[{stroke:["none",...se()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},IB=mB(PB);function _l(...t){return IB(MA(t))}const LB=d8,xM=j.forwardRef(({className:t,...e},s)=>n.jsx(NA,{ref:s,className:_l("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));xM.displayName=NA.displayName;const $B=_A("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),gM=j.forwardRef(({className:t,variant:e,...s},r)=>n.jsx(kA,{ref:r,className:_l($B({variant:e}),t),...s}));gM.displayName=kA.displayName;const BB=j.forwardRef(({className:t,...e},s)=>n.jsx(TA,{ref:s,className:_l("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));BB.displayName=TA.displayName;const bM=j.forwardRef(({className:t,...e},s)=>n.jsx(EA,{ref:s,className:_l("absolute right-2 top-2 rounded-md p-1 text-foreground
vendor: 4,309 bytes, line 9
9/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:n.jsx(ro,{className:"h-4 w-4"})}));bM.displayName=EA.displayName;const yM=j.forwardRef(({className:t,...e},s)=>n.jsx(SA,{ref:s,className:_l("text-sm font-semibold",t),...e}));yM.displayName=SA.displayName;const vM=j.forwardRef(({className:t,...e},s)=>n.jsx(CA,{ref:s,className:_l("text-sm opacity-90",t),...e}));vM.displayName=CA.displayName;function zB(){const{toasts:t}=h7();return n.jsxs(LB,{children:[t.map(function({id:e,title:s,description:r,action:i,...a}){return n.jsxs(gM,{...a,children:[n.jsxs("div",{className:"grid gap-1",children:[s&&n.jsx(yM,{children:s}),r&&n.jsx(vM,{children:r})]}),i,n.jsx(bM,{})]},e)}),n.jsx(xM,{})]})}const VB=["top","right","bottom","left"],bl=Math.min,Er=Math.max,zx=Math.round,Pf=Math.floor,ra=t=>({x:t,y:t}),FB={left:"right",right:"left",bottom:"top",top:"bottom"};function Rw(t,e,s){return Er(t,bl(e,s))}function co(t,e){return typeof t=="function"?t(e):t}function uo(t){return t.split("-")[0]}function Au(t){return t.split("-")[1]}function kj(t){return t==="x"?"y":"x"}function Sj(t){return t==="y"?"height":"width"}function sa(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function Cj(t){return kj(sa(t))}function UB(t,e,s){s===void 0&&(s=!1);const r=Au(t),i=Cj(t),a=Sj(i);let l=i==="x"?r===(s?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(l=Vx(l)),[l,Vx(l)]}function HB(t){const e=Vx(t);return[Dw(t),e,Dw(e)]}function Dw(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const _5=["left","right"],O5=["right","left"],qB=["top","bottom"],WB=["bottom","top"];function GB(t,e,s){switch(t){case"top":case"bottom":return s?e?O5:_5:e?_5:O5;case"left":case"right":return e?qB:WB;default:return[]}}function KB(t,e,s,r){const i=Au(t);let a=GB(uo(t),s==="start",r);return i&&(a=a.map(l=>l+"-"+i),e&&(a=a.concat(a.map(Dw)))),a}function Vx(t){const e=uo(t);return FB[e]+t.slice(e.length)}function YB(t){return{top:0,right:0,bottom:0,left:0,...t}}function wM(t){return typeof t!="number"?YB(t):{top:t,right:t,bottom:t,left:t}}function Fx(t){const{x:e,y:s,width:r,height:i}=t;return{width:r,height:i,top:s,left:e,right:e+r,bottom:s+i,x:e,y:s}}function R5(t,e,s){let{reference:r,floating:i}=t;const a=sa(e),l=Cj(e),d=Sj(l),u=uo(e),m=a==="y",p=r.x+r.width/2-i.width/2,x=r.y+r.height/2-i.height/2,g=r[d]/2-i[d]/2;let b;switch(u){case"top":b={x:p,y:r.y-i.height};break;case"bottom":b={x:p,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:x};break;case"left":b={x:r.x-i.width,y:x};break;default:b={x:r.x,y:r.y}}switch(Au(e)){case"start":b[l]-=g*(s&&m?-1:1);break;case"end":b[l]+=g*(s&&m?-1:1);break}return b}async function QB(t,e){var s;e===void 0&&(e={});const{x:r,y:i,platform:a,rects:l,elements:d,strategy:u}=t,{boundary:m="clippingAncestors",rootBoundary:p="viewport",elementContext:x="floating",altBoundary:g=!1,padding:b=0}=co(e,t),v=wM(b),N=d[g?x==="floating"?"reference":"floating":x],S=Fx(await a.getClippingRect({element:(s=await(a.isElement==null?void 0:a.isElement(N)))==null||s?N:N.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(d.floating)),boundary:m,rootBoundary:p,strategy:u})),A=x==="floating"?{x:r,y:i,width:l.floating.width,height:l.floating.height}:l.reference,E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d.floating)),_=await(a.isElement==null?void 0:a.isElement(E))?await(a.getScale==null?void 0:a.getScale(E))||{x:1,y:1}:{x:1,y:1},T=Fx(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:A,offsetParent:E,strategy:u}):A);return{top:(S.top-T.top+v.top)/_.y,bottom:(T.bottom-S.bottom+v.bottom)/_.y,left:(S.left-T.left+v.left)/_.x,right:(T.right-S.right+v.right)/_.x}}const JB=50,XB=async(t,e,s)=>{const{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:l}=s,d=l.detectOverflow?l:{...l,detectOverflow:QB},u=await(l.isRTL==null?void 0:l.isRTL(e));let m=await l.getElementRects({reference:t,floating:e,strategy:i}
vendor: 5,520 bytes, line 9
9),{x:p,y:x}=R5(m,r,u),g=r,b=0;const v={};for(let k=0;k<a.length;k++){const N=a[k];if(!N)continue;const{name:S,fn:A}=N,{x:E,y:_,data:T,reset:$}=await A({x:p,y:x,initialPlacement:r,placement:g,strategy:i,middlewareData:v,rects:m,platform:d,elements:{reference:t,floating:e}});p=E??p,x=_??x,v[S]={...v[S],...T},$&&b<JB&&(b++,typeof $=="object"&&($.placement&&(g=$.placement),$.rects&&(m=$.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:i}):$.rects),{x:p,y:x}=R5(m,g,u)),k=-1)}return{x:p,y:x,placement:g,strategy:i,middlewareData:v}},ZB=t=>({name:"arrow",options:t,async fn(e){const{x:s,y:r,placement:i,rects:a,platform:l,elements:d,middlewareData:u}=e,{element:m,padding:p=0}=co(t,e)||{};if(m==null)return{};const x=wM(p),g={x:s,y:r},b=Cj(i),v=Sj(b),k=await l.getDimensions(m),N=b==="y",S=N?"top":"left",A=N?"bottom":"right",E=N?"clientHeight":"clientWidth",_=a.reference[v]+a.reference[b]-g[b]-a.floating[v],T=g[b]-a.reference[b],$=await(l.getOffsetParent==null?void 0:l.getOffsetParent(m));let L=$?$[E]:0;(!L||!await(l.isElement==null?void 0:l.isElement($)))&&(L=d.floating[E]||a.floating[v]);const M=_/2-T/2,I=L/2-k[v]/2-1,z=bl(x[S],I),ae=bl(x[A],I),U=z,Y=L-k[v]-ae,P=L/2-k[v]/2+M,ne=Rw(U,P,Y),q=!u.arrow&&Au(i)!=null&&P!==ne&&a.reference[v]/2-(P<U?z:ae)-k[v]/2<0,W=q?P<U?P-U:P-Y:0;return{[b]:g[b]+W,data:{[b]:ne,centerOffset:P-ne-W,...q&&{alignmentOffset:W}},reset:q}}}),ez=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var s,r;const{placement:i,middlewareData:a,rects:l,initialPlacement:d,platform:u,elements:m}=e,{mainAxis:p=!0,crossAxis:x=!0,fallbackPlacements:g,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:k=!0,...N}=co(t,e);if((s=a.arrow)!=null&&s.alignmentOffset)return{};const S=uo(i),A=sa(d),E=uo(d)===d,_=await(u.isRTL==null?void 0:u.isRTL(m.floating)),T=g||(E||!k?[Vx(d)]:HB(d)),$=v!=="none";!g&&$&&T.push(...KB(d,k,v,_));const L=[d,...T],M=await u.detectOverflow(e,N),I=[];let z=((r=a.flip)==null?void 0:r.overflows)||[];if(p&&I.push(M[S]),x){const P=UB(i,l,_);I.push(M[P[0]],M[P[1]])}if(z=[...z,{placement:i,overflows:I}],!I.every(P=>P<=0)){var ae,U;const P=(((ae=a.flip)==null?void 0:ae.index)||0)+1,ne=L[P];if(ne&&(!(x==="alignment"?A!==sa(ne):!1)||z.every(ie=>sa(ie.placement)===A?ie.overflows[0]>0:!0)))return{data:{index:P,overflows:z},reset:{placement:ne}};let q=(U=z.filter(W=>W.overflows[0]<=0).sort((W,ie)=>W.overflows[1]-ie.overflows[1])[0])==null?void 0:U.placement;if(!q)switch(b){case"bestFit":{var Y;const W=(Y=z.filter(ie=>{if($){const he=sa(ie.placement);return he===A||he==="y"}return!0}).map(ie=>[ie.placement,ie.overflows.filter(he=>he>0).reduce((he,se)=>he+se,0)]).sort((ie,he)=>ie[1]-he[1])[0])==null?void 0:Y[0];W&&(q=W);break}case"initialPlacement":q=d;break}if(i!==q)return{reset:{placement:q}}}return{}}}};function D5(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function P5(t){return VB.some(e=>t[e]>=0)}const tz=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:s,platform:r}=e,{strategy:i="referenceHidden",...a}=co(t,e);switch(i){case"referenceHidden":{const l=await r.detectOverflow(e,{...a,elementContext:"reference"}),d=D5(l,s.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:P5(d)}}}case"escaped":{const l=await r.detectOverflow(e,{...a,altBoundary:!0}),d=D5(l,s.floating);return{data:{escapedOffsets:d,escaped:P5(d)}}}default:return{}}}}},jM=new Set(["left","top"]);async function sz(t,e){const{placement:s,platform:r,elements:i}=t,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),l=uo(s),d=Au(s),u=sa(s)==="y",m=jM.has(l)?-1:1,p=a&&u?-1:1,x=co(e,t);let{mainAxis:g,crossAxis:b,alignmentAxis:v}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return d&&typeof v=="number"&&(b=d==="end"?v*-1:v),u?{x:b*p,y:g*m}:{x:g*m,y:b*p}}const nz=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var s,r;const{x:i,y:a,placement:l,middlewareData:d}=e,u=await sz(e,t);return l===((s=d.offset)==null?void 0:s.placement)&&(r=d.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:a+u.y,data:{...u,placement:l}}}}},rz=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:s,y:r,placement:i,platform:a}=e,{mainAxis:l=!0,crossAxis:d=!1,limiter:u={fn:S=>{let{x:A,y:E}=S;return{x:A,y:E}}},...m}=co(t,e),p={x:s,y:r},x=await a.detectOverflow(e,m),g=sa(uo(i)),b=kj(g);let v=p[b],k=p[g];if(l){const S=b==="y"?"top":"left",A=b==="y"?"bottom":"right",E=v+x[S],_=v-x[A];v=Rw(E,v,_)}if(d){const S=g==="y"?"top":"left",A=g==="y"?"bottom":"right",E=k+x[S],_=k-x[A];k=Rw(E,k,_)}const N=u.fn({...e,[b]:v,[g]:k});return{...N,data:{x:N.x-s,y:N.y-r,enabled:{[b]:l,[g]:d}}}}}},iz=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:s,y:r,placement:i,rects:a,middlewareData:l}=e,{offset:d=0,mainAxis:u=!0,crossAxis:m=!0}=co(t,e),p={x:s,y:r},x=sa(i),g=kj(x);let b=p[g],v=p[x];const k=co(d,e),N=typeof k=="number"?{mainAxis:k,crossAxis:0}:{mainAxis:0,crossAxis:0,...k};if(u){const E=g==="y"?"height":"width",_=a.reference[g]-a.floating[E]+N.mainAxis,T=a.reference[g]+a.reference[E]-N.mainAxis;b<_?b=_:b>T&&(b=T)}if(m){var S,A;const E=g==="y"?"width":"height",_=jM.has(uo(i)),T=a.reference[x]-a.floating[E]+(_&&((S=l.offset)==null?void 0:S[x])||0)+(_?0:N.crossAxis),$=a.reference[x]+a.reference[E]+(_?0:((A=l.offset)==null?void 0:A[x])||0)-(_?N.crossAxis:0);v<T?v=T:v>$&&(v=$)}
9return{[g]:b,[x]:v}}}},az=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var s,r;const{placement:i,rects:a,platform:l,elements:d}=e,{apply:u=()=>{},...m}=co(t,e),p=await l.detectOverflow(e,m),x=uo(i),g=Au(i),b=sa(i)==="y",{width:v,height:k}=a.floating;let N,S;x==="top"||x==="bottom"?(N=x,S=g===(await(l.isRTL==null?void 0:l.isRTL(d.floating))?"start":"end")?"left":"right"):(S=x,N=g==="end"?"top":"bottom");const A=k-p.top-p.bottom,E=v-p.left-p.right,_=bl(k-p[N],A),T=bl(v-p[S],E),$=!e.middlewareData.shift;let L=_,M=T;if((s=e.middlewareData.shift)!=null&&s.enabled.x&&(M=E),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(L=A),$&&!g){const z=Er(p.left,0),ae=Er(p.right,0),U=Er(p.top,0),Y=Er(p.bottom,0);b?M=v-2*(z!==0||ae!==0?z+ae:Er(p.left,p.right)):L=k-2*(U!==0||Y!==0?U+Y:Er(p.top,p.bottom))}await u({...e,availableWidth:M,availableHeight:L});const I=await l.getDimensions(d.floating);return v!==I.width||k!==I.height?{reset:{rects:!0}}:{}}}};function mb(){return typeof window<"u"}function Mu(t){return NM(t)?(t.nodeName||"").toLowerCase():"#document"}function _r(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function ma(t){var e;return(e=(NM(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function NM(t){return mb()?t instanceof Node||t instanceof _r(t).Node:!1}function _i(t){return mb()?t instanceof Element||t instanceof _r(t).Element:!1}function fo(t){return mb()?t instanceof HTMLElement||t instanceof _r(t).HTMLElement:!1}function I5(t){return!mb()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof _r(t).ShadowRoot}function tp(t){const{overflow:e,overflowX:s,overflowY:r,display:i}=Oi(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+s)&&i!=="inline"&&i!=="contents"}function oz(t){return/^(table|td|th)$/.test(Mu(t))}function pb(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const lz=/transform|translate|scale|rotate|perspective|filter/,cz=/paint|layout|strict|content/,hc=t=>!!t&&t!=="none";let tv;function Tj(t){const e=_i(t)?Oi(t):t;return hc(e.transform)||hc(e.translate)||hc(e.scale)||hc(e.rotate)||hc(e.perspective)||!Ej()&&(hc(e.backdropFilter)||hc(e.filter))||lz.test(e.willChange||"")||cz.test(e.contain||"")}function dz(t){let e=yl(t);for(;fo(e)&&!mu(e);){if(Tj(e))return e;if(pb(e))return null;e=yl(e)}return null}function Ej(){return tv==null&&(tv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),tv}function mu(t){return/^(html|body|#document)$/.test(Mu(t))}function Oi(t){return _r(t).getComputedStyle(t)}function fb(t){return _i(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function yl(t){if(Mu(t)==="html")return t;const e=t.assignedSlot||t.parentNode||I5(t)&&t.host||ma(t);return I5(e)?e.host:e}function kM(t){const e=yl(t);return mu(e)?t.ownerDocument?t.ownerDocument.body:t.body:fo(e)&&tp(e)?e:kM(e)}function vm(t,e,s){var r;e===void 0&&(e=[]),s===void 0&&(s=!0);const i=kM(t),a=i===((r=t.ownerDocument)==null?void 0:r.body),l=_r(i);if(a){const d=Pw(l);return e.concat(l,l.visualViewport||[],tp(i)?i:[],d&&s?vm(d):[])}else return e.concat(i,vm(i,[],s))}function Pw(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function SM(t){const e=Oi(t);let s=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=fo(t),a=i?t.offsetWidth:s,l=i?t.offsetHeight:r,d=zx(s)!==a||zx(r)!==l;return d&&(s=a,r=l),{width:s,height:r,$:d}}function Aj(t){return _i(t)?t:t.contextElement}function au(t){const e=Aj(t);if(!fo(e))return ra(1);const s=e.getBoundingClientRect(),{width:r,height:i,$:a}=SM(e);let l=(a?zx(s.width):s.width)/r,d=(a?zx(s.height):s.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!d||!Number.isFinite(d))&&(d=1),{x:l,y:d}}const uz=ra(0);function CM(t){const e=_r(t);
vendor: 6,082 bytes, line 9
9return!Ej()||!e.visualViewport?uz:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function hz(t,e,s){return e===void 0&&(e=!1),!s||e&&s!==_r(t)?!1:e}function zc(t,e,s,r){e===void 0&&(e=!1),s===void 0&&(s=!1);const i=t.getBoundingClientRect(),a=Aj(t);let l=ra(1);e&&(r?_i(r)&&(l=au(r)):l=au(t));const d=hz(a,s,r)?CM(a):ra(0);let u=(i.left+d.x)/l.x,m=(i.top+d.y)/l.y,p=i.width/l.x,x=i.height/l.y;if(a){const g=_r(a),b=r&&_i(r)?_r(r):r;let v=g,k=Pw(v);for(;k&&r&&b!==v;){const N=au(k),S=k.getBoundingClientRect(),A=Oi(k),E=S.left+(k.clientLeft+parseFloat(A.paddingLeft))*N.x,_=S.top+(k.clientTop+parseFloat(A.paddingTop))*N.y;u*=N.x,m*=N.y,p*=N.x,x*=N.y,u+=E,m+=_,v=_r(k),k=Pw(v)}}return Fx({width:p,height:x,x:u,y:m})}function xb(t,e){const s=fb(t).scrollLeft;return e?e.left+s:zc(ma(t)).left+s}function TM(t,e){const s=t.getBoundingClientRect(),r=s.left+e.scrollLeft-xb(t,s),i=s.top+e.scrollTop;return{x:r,y:i}}function mz(t){let{elements:e,rect:s,offsetParent:r,strategy:i}=t;const a=i==="fixed",l=ma(r),d=e?pb(e.floating):!1;if(r===l||d&&a)return s;let u={scrollLeft:0,scrollTop:0},m=ra(1);const p=ra(0),x=fo(r);if((x||!x&&!a)&&((Mu(r)!=="body"||tp(l))&&(u=fb(r)),x)){const b=zc(r);m=au(r),p.x=b.x+r.clientLeft,p.y=b.y+r.clientTop}const g=l&&!x&&!a?TM(l,u):ra(0);return{width:s.width*m.x,height:s.height*m.y,x:s.x*m.x-u.scrollLeft*m.x+p.x+g.x,y:s.y*m.y-u.scrollTop*m.y+p.y+g.y}}function pz(t){return Array.from(t.getClientRects())}function fz(t){const e=ma(t),s=fb(t),r=t.ownerDocument.body,i=Er(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=Er(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-s.scrollLeft+xb(t);const d=-s.scrollTop;return Oi(r).direction==="rtl"&&(l+=Er(e.clientWidth,r.clientWidth)-i),{width:i,height:a,x:l,y:d}}const L5=25;function xz(t,e){const s=_r(t),r=ma(t),i=s.visualViewport;let a=r.clientWidth,l=r.clientHeight,d=0,u=0;if(i){a=i.width,l=i.height;const p=Ej();(!p||p&&e==="fixed")&&(d=i.offsetLeft,u=i.offsetTop)}const m=xb(r);if(m<=0){const p=r.ownerDocument,x=p.body,g=getComputedStyle(x),b=p.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-x.clientWidth-b);v<=L5&&(a-=v)}else m<=L5&&(a+=m);return{width:a,height:l,x:d,y:u}}function gz(t,e){const s=zc(t,!0,e==="fixed"),r=s.top+t.clientTop,i=s.left+t.clientLeft,a=fo(t)?au(t):ra(1),l=t.clientWidth*a.x,d=t.clientHeight*a.y,u=i*a.x,m=r*a.y;return{width:l,height:d,x:u,y:m}}function $5(t,e,s){let r;if(e==="viewport")r=xz(t,s);else if(e==="document")r=fz(ma(t));else if(_i(e))r=gz(e,s);else{const i=CM(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Fx(r)}function EM(t,e){const s=yl(t);return s===e||!_i(s)||mu(s)?!1:Oi(s).position==="fixed"||EM(s,e)}function bz(t,e){const s=e.get(t);if(s)return s;let r=vm(t,[],!1).filter(d=>_i(d)&&Mu(d)!=="body"),i=null;const a=Oi(t).position==="fixed";let l=a?yl(t):t;for(;_i(l)&&!mu(l);){const d=Oi(l),u=Tj(l);!u&&d.position==="fixed"&&(i=null),(a?!u&&!i:!u&&d.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||tp(l)&&!u&&EM(t,l))?r=r.filter(p=>p!==l):i=d,l=yl(l)}return e.set(t,r),r}function yz(t){let{element:e,boundary:s,rootBoundary:r,strategy:i}=t;const l=[...s==="clippingAncestors"?pb(e)?[]:bz(e,this._c):[].concat(s),r],d=$5(e,l[0],i);let u=d.top,m=d.right,p=d.bottom,x=d.left;for(let g=1;g<l.length;g++){const b=$5(e,l[g],i);u=Er(b.top,u),m=bl(b.right,m),p=bl(b.bottom,p),x=Er(b.left,x)}return{width:m-x,height:p-u,x,y:u}}function vz(t){const{width:e,height:s}=SM(t);return{width:e,height:s}}function wz(t,e,s){const r=fo(e),i=ma(e),a=s==="fixed",l=zc(t,!0,a,e);let d={scrollLeft:0,scrollTop:0};const u=ra(0);function m(){u.x=xb(i)}if(r||!r&&!a)if((Mu(e)!=="body"||tp(i))&&(d=fb(e)),r){const b=zc(e,!0,a,e);u.x=b.x+e.clientLeft,u.y=b.y+e.clientTop}else i&&m();a&&!r&&i&&m();const p=i&&!r&&!a?TM(i,d):ra(0),x=l.left+d.scrollLeft-u.x-p.x,g=l.top+d.scrollTop-u.y-p.y;return{x,y:g,width:l.width,height:l.height}}function sv(t){return Oi(t).position==="static"}function B5(t,e){if(!fo(t)||Oi(t).position==="fixed")return null;if(e)return e(t);let s=t.offsetParent;return ma(t)===s&&(s=s.ownerDocument.body),s}function AM(t,e){const s=_r(t);if(pb(t))return s;if(!fo(t)){let i=yl(t);for(;i&&!mu(i);){if(_i(i)&&!sv(i))return i;i=yl(i)}return s}let r=B5(t,e);for(;r&&oz(r)&&sv(r);)r=B5(r,e);return r&&mu(r)&&sv(r)&&!Tj(r)?s:r||dz(t)||s}const jz=async function(t){const e=this.getOffsetParent||AM,s=this.getDimensions,r=await s(t.floating);return{reference:wz(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Nz(t){return Oi(t).direction==="rtl"}const kz={convertOffsetParentRelativeRectToViewportRelativeRect:mz,getDocumentElement:ma,getClippingRect:yz,getOffsetParent:AM,getElementRects:jz,getClientRects:pz,getDimensions:vz,getScale:au,isElement:_i,isRTL:Nz};function MM(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Sz(t,e){let s=null,r;const i=ma(t);function a(){var d;clearTimeout(r),(d=s)==null||d.disconnect(),s=null}function l(d,u){d===void 0&&(d=!1),u===void 0&&(u=1),a();const m=t.getBoundingClientRect(),{left:p,top:x,width:g,height:b}=m;if(d||e(),!g||!b)return;const v=Pf(x),k=Pf(i.clientWidth-(p+g)),N=Pf(i.clientHeight-(x+b)),S=Pf(p),E={rootMargin:-v+"px "+-k+"px "+-N+"px "+-S+"px",threshold:Er(0,bl(1,u))||1};let _=!0;function T($){const L=$[0].intersectionRatio;if(L!==u){if(!_)return l();L?l(!1,L):r=setTimeout(()=>{l(!1,1e-7)},1e3)}L===1&&!MM(m,t.getBoundingClientRect())&&l(),_=!1}try{s=new IntersectionObserver(T,{...E,root:i.ownerDocument})}catch{s=new IntersectionObserver(T,E)}s.observe(t)}return l(!0),a}function Cz(t,e,s,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,m=Aj(t),p=i||a?[...m?vm(m):[],...e?vm(e):[]]:[];p.forEach(S=>{i&&S.addEventListener("scroll",s,{passive:!0}),a&&S.addEventListener("resize",s)});const x=m&&d?Sz(m,s):null;let g=-1,b=null;
vendor: 2,217 bytes, line 9
9l&&(b=new ResizeObserver(S=>{let[A]=S;A&&A.target===m&&b&&e&&(b.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=b)==null||E.observe(e)})),s()}),m&&!u&&b.observe(m),e&&b.observe(e));let v,k=u?zc(t):null;u&&N();function N(){const S=zc(t);k&&!MM(k,S)&&s(),k=S,v=requestAnimationFrame(N)}return s(),()=>{var S;p.forEach(A=>{i&&A.removeEventListener("scroll",s),a&&A.removeEventListener("resize",s)}),x?.(),(S=b)==null||S.disconnect(),b=null,u&&cancelAnimationFrame(v)}}const Tz=nz,Ez=rz,Az=ez,Mz=az,_z=tz,z5=ZB,Oz=iz,Rz=(t,e,s)=>{const r=new Map,i={platform:kz,...s},a={...i.platform,_c:r};return XB(t,e,{...i,platform:a})};var Dz=typeof document<"u",Pz=function(){},xx=Dz?j.useLayoutEffect:Pz;function Ux(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let s,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(s=t.length,s!==e.length)return!1;for(r=s;r--!==0;)if(!Ux(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),s=i.length,s!==Object.keys(e).length)return!1;for(r=s;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=s;r--!==0;){const a=i[r];if(!(a==="_owner"&&t.$$typeof)&&!Ux(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function _M(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function V5(t,e){const s=_M(t);return Math.round(e*s)/s}function nv(t){const e=j.useRef(t);return xx(()=>{e.current=t}),e}function Iz(t){t===void 0&&(t={});const{placement:e="bottom",strategy:s="absolute",middleware:r=[],platform:i,elements:{reference:a,floating:l}={},transform:d=!0,whileElementsMounted:u,open:m}=t,[p,x]=j.useState({x:0,y:0,strategy:s,placement:e,middlewareData:{},isPositioned:!1}),[g,b]=j.useState(r);Ux(g,r)||b(r);const[v,k]=j.useState(null),[N,S]=j.useState(null),A=j.useCallback(ie=>{ie!==$.current&&($.current=ie,k(ie))},[]),E=j.useCallback(ie=>{ie!==L.current&&(L.current=ie,S(ie))},[]),_=a||v,T=l||N,$=j.useRef(null),L=j.useRef(null),M=j.useRef(p),I=u!=null,z=nv(u),ae=nv(i),U=nv(m),Y=j.useCallback(()=>{if(!$.current||!L.current)return;const ie={placement:e,strategy:s,middleware:g};ae.current&&(ie.platform=ae.current),Rz($.current,L.current,ie).then(
vendor: 5,007 bytes, line 9
9he=>{const se={...he,isPositioned:U.current!==!1};P.current&&!Ux(M.current,se)&&(M.current=se,rb.flushSync(()=>{x(se)}))})},[g,e,s,ae,U]);xx(()=>{m===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,x(ie=>({...ie,isPositioned:!1})))},[m]);const P=j.useRef(!1);xx(()=>(P.current=!0,()=>{P.current=!1}),[]),xx(()=>{if(_&&($.current=_),T&&(L.current=T),_&&T){if(z.current)return z.current(_,T,Y);Y()}},[_,T,Y,z,I]);const ne=j.useMemo(()=>({reference:$,floating:L,setReference:A,setFloating:E}),[A,E]),q=j.useMemo(()=>({reference:_,floating:T}),[_,T]),W=j.useMemo(()=>{const ie={position:s,left:0,top:0};if(!q.floating)return ie;const he=V5(q.floating,p.x),se=V5(q.floating,p.y);return d?{...ie,transform:"translate("+he+"px, "+se+"px)",..._M(q.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:he,top:se}},[s,d,q.floating,p.x,p.y]);return j.useMemo(()=>({...p,update:Y,refs:ne,elements:q,floatingStyles:W}),[p,Y,ne,q,W])}const Lz=t=>{function e(s){return{}.hasOwnProperty.call(s,"current")}return{name:"arrow",options:t,fn(s){const{element:r,padding:i}=typeof t=="function"?t(s):t;return r&&e(r)?r.current!=null?z5({element:r.current,padding:i}).fn(s):{}:r?z5({element:r,padding:i}).fn(s):{}}}},$z=(t,e)=>{const s=Tz(t);return{name:s.name,fn:s.fn,options:[t,e]}},Bz=(t,e)=>{const s=Ez(t);return{name:s.name,fn:s.fn,options:[t,e]}},zz=(t,e)=>({fn:Oz(t).fn,options:[t,e]}),Vz=(t,e)=>{const s=Az(t);return{name:s.name,fn:s.fn,options:[t,e]}},Fz=(t,e)=>{const s=Mz(t);return{name:s.name,fn:s.fn,options:[t,e]}},Uz=(t,e)=>{const s=_z(t);return{name:s.name,fn:s.fn,options:[t,e]}},Hz=(t,e)=>{const s=Lz(t);return{name:s.name,fn:s.fn,options:[t,e]}};var qz="Arrow",OM=j.forwardRef((t,e)=>{const{children:s,width:r=10,height:i=5,...a}=t;return n.jsx(pr.svg,{...a,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?s:n.jsx("polygon",{points:"0,0 30,0 15,10"})})});OM.displayName=qz;var Wz=OM;function Gz(t){const[e,s]=j.useState(void 0);return xl(()=>{if(t){s({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const a=i[0];let l,d;if("borderBoxSize"in a){const u=a.borderBoxSize,m=Array.isArray(u)?u[0]:u;l=m.inlineSize,d=m.blockSize}else l=t.offsetWidth,d=t.offsetHeight;s({width:l,height:d})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else s(void 0)},[t]),e}var RM="Popper",[DM,PM]=ab(RM),[gle,IM]=DM(RM),LM="PopperAnchor",$M=j.forwardRef((t,e)=>{const{__scopePopper:s,virtualRef:r,...i}=t,a=IM(LM,s),l=j.useRef(null),d=Ai(e,l),u=j.useRef(null);return j.useEffect(()=>{const m=u.current;u.current=r?.current||l.current,m!==u.current&&a.onAnchorChange(u.current)}),r?null:n.jsx(pr.div,{...i,ref:d})});$M.displayName=LM;var Mj="PopperContent",[Kz,Yz]=DM(Mj),BM=j.forwardRef((t,e)=>{const{__scopePopper:s,side:r="bottom",sideOffset:i=0,align:a="center",alignOffset:l=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:m=[],collisionPadding:p=0,sticky:x="partial",hideWhenDetached:g=!1,updatePositionStrategy:b="optimized",onPlaced:v,...k}=t,N=IM(Mj,s),[S,A]=j.useState(null),E=Ai(e,V=>A(V)),[_,T]=j.useState(null),$=Gz(_),L=$?.width??0,M=$?.height??0,I=r+(a!=="center"?"-"+a:""),z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},ae=Array.isArray(m)?m:[m],U=ae.length>0,Y={padding:z,boundary:ae.filter(Jz),altBoundary:U},{refs:P,floatingStyles:ne,placement:q,isPositioned:W,middlewareData:ie}=Iz({strategy:"fixed",placement:I,whileElementsMounted:(...V)=>Cz(...V,{animationFrame:b==="always"}),elements:{reference:N.anchor},middleware:[$z({mainAxis:i+M,alignmentAxis:l}),u&&Bz({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?zz():void 0,...Y}),u&&Vz({...Y}),Fz({...Y,apply:({elements:V,rects:ge,availableWidth:ue,availableHeight:Me})=>{const{width:We,height:_e}=ge.reference,Re=V.floating.style;Re.setProperty("--radix-popper-available-width",`${ue}px`),Re.setProperty("--radix-popper-available-height",`${Me}px`),Re.setProperty("--radix-popper-anchor-width",`${We}px`),Re.setProperty("--radix-popper-anchor-height",`${_e}px`)}}),_&&Hz({element:_,padding:d}),Xz({arrowWidth:L,arrowHeight:M}),g&&Uz({strategy:"referenceHidden",...Y})]}),[he,se]=FM(q),B=fl(v);xl(()=>{W&&B?.()},[W,B]);const le=ie.arrow?.x,pe=ie.arrow?.y,Oe=ie.arrow?.centerOffset!==0,[Se,D]=j.useState();return xl(()=>{S&&D(window.getComputedStyle(S).zIndex)},[S]),n.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...ne,transform:W?ne.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Se,"--radix-popper-transform-origin":[ie.transformOrigin?.x,ie.transformOrigin?.y].join(" "),...ie.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:n.jsx(Kz,{scope:s,placedSide:he,onArrowChange:T,arrowX:le,arrowY:pe,shouldHideArrow:Oe,children:n.jsx(pr.div,{"data-side":he,"data-align":se,...k,ref:E,style:{...k.style,animation:W?void 0:"none"}})})})});BM.displayName=Mj;var zM="PopperArrow",Qz={top:"bottom",right:"left",bottom:"top",left:"r
9ight"},VM=j.forwardRef(function(e,s){const{__scopePopper:r,...i}=e,a=Yz(zM,r),l=Qz[a.placedSide];return n.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:n.jsx(Wz,{...i,ref:s,style:{...i.style,display:"block"}})})});VM.displayName=zM;function Jz(t){return t!==null}var Xz=t=>({name:"transformOrigin",options:t,fn(e){const{placement:s,rects:r,middlewareData:i}=e,l=i.arrow?.centerOffset!==0,d=l?0:t.arrowWidth,u=l?0:t.arrowHeight,[m,p]=FM(s),x={start:"0%",center:"50%",end:"100%"}[p],g=(i.arrow?.x??0)+d/2,b=(i.arrow?.y??0)+u/2;let v="",k="";return m==="bottom"?(v=l?x:`${g}px`,k=`${-u}px`):m==="top"?(v=l?x:`${g}px`,k=`${r.floating.height+u}px`):m==="right"?(v=`${-u}px`,k=l?x:`${b}px`):m==="left"&&(v=`${r.floating.width+u}px`,k=l?x:`${b}px`),{data:{x:v,y:k}}}});function FM(t){const[e,s="center"]=t.split("-");return[e,s]}var Zz=$M,eV=BM,tV=VM,sV=Symbol("radix.slottable");function nV(t){const e=({children:s})=>n.jsx(n.Fragment,{children:s});return e.displayName=`${t}.Slottable`,e.__radixId=sV,e}var[gb]=ab("Tooltip",[PM]),_j=PM(),UM="TooltipProvider",rV=700,F5="tooltip.open",[iV,HM]=gb(UM),qM=t=>{const{__scopeTooltip:e,delayDuration:s=rV,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=t,l=j.useRef(!0),d=j.useRef(!1),u=j.useRef(0);return j.useEffect(()=>{const m=u.current;return()=>window.clearTimeout(m)},[]),n.jsx(iV,{scope:e,isOpenDelayedRef:l,delayDuration:s,onOpen:j.useCallback(()=>{window.clearTimeout(u.current),l.current=!1},[]),onClose:j.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:d,onPointerInTransitChange:j.useCallback(m=>{d.current=m},[]),disableHoverableContent:i,children:a})};qM.displayName=UM;var WM="Tooltip",[ble,sp]=gb(WM),Iw="TooltipTrigger",aV=j.forwardRef((t,e)=>{const{__scopeTooltip:s,...r}=t,i=sp(Iw,s),a=HM(Iw,s),l=_j(s),d=j.useRef(null),u=Ai(e,d,i.onTriggerChange),m=j.useRef(!1),p=j.useRef(!1),x=j.useCallback(()=>m.current=!1,[]);return j.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),n.jsx(Zz,{asChild:!0,...l,children:n.jsx(pr.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:u,onPointerMove:tn(t.onPointerMove,g=>{g.pointerType!=="touch"&&!p.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),p.current=!0)}),onPointerLeave:tn(t.onPointerLeave,()=>{i.onTriggerLeave(),p.current=!1}),onPointerDown:tn(t.onPointerDown,()=>{i.open&&i.onClose(),m.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:tn(t.onFocus,()=>{m.current||i.onOpen()}),onBlur:tn(t.onBlur,i.onClose),onClick:tn(t.onClick,i.onClose)})})});aV.displayName=Iw;var Oj="TooltipPortal",[oV,lV]=gb(Oj,{forceMount:void 0}),GM=t=>{const{__scopeTooltip:e,forceMount:s,children:r,container:i}=t,a=sp(Oj,e);return n.jsx(oV,{scope:e,forceMount:s,children:n.jsx(ob,{present:s||a.open,children:n.jsx(hj,{asChild:!0,container:i,children:r})})})};GM.displayName=Oj;var pu="TooltipContent",KM=j.forwardRef((t,e)=>{const s=lV(pu,t.__scopeTooltip),{forceMount:r=s.forceMount,side:i="top",...a}=t,l=sp(pu,t.__scopeTooltip);return n.jsx(ob,{present:r||l.open,children:l.disableHoverableContent?n.jsx(YM,{side:i,...a,ref:e}):n.jsx(cV,{side:i,...a,ref:e})})}),cV=j.forwardRef((t,e)=>{const s=sp(pu,t.__scopeTooltip),r=HM(pu,t.__scopeTooltip),i=j.useRef(null),a=Ai(e,i),[l,d]=j.useState(null),{trigger:u,onClose:m}=s,p=i.current,{onPointerInTransitChange:x}=r,g=j.useCallback(()=>{d(null),x(!1)},[x]),b=j.useCallback((v,k)=>{const N=v.currentTarget,S={x:v.clientX,y:v.clientY},A=pV(S,N.getBoundingClientRect()),E=fV(S,A),_=xV(k.getBoundingClientRect()),T=bV([...E,..._]);d(T),x(!0)},[x]);return j.useEffect(()=>()=>g(),[g]),j.useEffect(()=>{if(u&&p){const v=N=>b(N,p),k=N=>b(N,u);return u.addEventListener("pointerleave",v),p.addEventListener("pointerleave",k),()=>{u.removeEventListener("pointerleave",v),p.removeEventListener("pointerleave",k)}}},[u,p,b,g]),j.useEffect(()=>{if(l){const v=k=>{const N=k.target,S={x:k.clientX,y:k.clientY},A=u?.contains(N)||p?.contains(N),E=!gV(S,l);A?g():E&&(g(),m())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}}
9,[u,p,l,m,g]),n.jsx(YM,{...t,ref:a})}),[dV,uV]=gb(WM,{isInside:!1}),hV=nV("TooltipContent"),YM=j.forwardRef((t,e)=>{const{__scopeTooltip:s,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:l,...d}=t,u=sp(pu,s),m=_j(s),{onClose:p}=u;return j.useEffect(()=>(document.addEventListener(F5,p),()=>document.removeEventListener(F5,p)),[p]),j.useEffect(()=>{if(u.trigger){const x=g=>{g.target?.contains(u.trigger)&&p()};return window.addEventListener("scroll",x,{capture:!0}),()=>window.removeEventListener("scroll",x,{capture:!0})}},[u.trigger,p]),n.jsx(uj,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:x=>x.preventDefault(),onDismiss:p,children:n.jsxs(eV,{"data-state":u.stateAttribute,...m,...d,ref:e,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[n.jsx(hV,{children:r}),n.jsx(dV,{scope:s,isInside:!0,children:n.jsx(W7,{id:u.contentId,role:"tooltip",children:i||r})})]})})});KM.displayName=pu;var QM="TooltipArrow",mV=j.forwardRef((t,e)=>{const{__scopeTooltip:s,...r}=t,i=_j(s);return uV(QM,s).isInside?null:n.jsx(tV,{...i,...r,ref:e})});mV.displayName=QM;function pV(t,e){const s=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),a=Math.abs(e.left-t.x);switch(Math.min(s,r,i,a)){case a:return"left";case i:return"right";case s:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function fV(t,e,s=5){const r=[];switch(e){case"top":r.push({x:t.x-s,y:t.y+s},{x:t.x+s,y:t.y+s});break;case"bottom":r.push({x:t.x-s,y:t.y-s},{x:t.x+s,y:t.y-s});break;case"left":r.push({x:t.x+s,y:t.y-s},{x:t.x+s,y:t.y+s});break;case"right":r.push({x:t.x-s,y:t.y-s},{x:t.x-s,y:t.y+s});break}return r}function xV(t){const{top:e,right:s,bottom:r,left:i}=t;return[{x:i,y:e},{x:s,y:e},{x:s,y:r},{x:i,y:r}]}function gV(t,e){const{x:s,y:r}=t;let i=!1;for(let a=0,l=e.length-1;a<e.length;l=a++){const d=e[a],u=e[l],m=d.x,p=d.y,x=u.x,g=u.y;p>r!=g>r&&s<(x-m)*(r-p)/(g-p)+m&&(i=!i)}return i}function bV(t){const e=t.slice();return e.sort((s,r)=>s.x<r.x?-1:s.x>r.x?1:s.y<r.y?-1:s.y>r.y?1:0),yV(e)}function yV(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const a=e[e.length-1],l=e[e.length-2];if((a.x-l.x)*(i.y-l.y)>=(a.y-l.y)*(i.x-l.x))e.pop();else break}e.push(i)}e.pop();const s=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;s.length>=2;){const a=s[s.length-1],l=s[s.length-2];if((a.x-l.x)*(i.y-l.y)>=(a.y-l.y)*(i.x-l.x))s.pop();else break}s.push(i)}return s.pop(),e.length===1&&s.length===1&&e[0].x===s[0].x&&e[0].y===s[0].y?e:e.concat(s)}var vV=qM,wV=GM,JM=KM;const jV=vV,NV=j.forwardRef(({className:t,sideOffset:e=4,...s},r)=>n.jsx(wV,{children:n.jsx(JM,{ref:r,sideOffset:e,className:_l("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...s})}));NV.displayName=JM.displayName;const kV=j.createContext(void 0);function SV({children:t}){return n.jsx(kV.Provider,{value:{theme:"light",toggleTheme:()=>{},isDark:!1},children:t})}const Rj=j.createContext({});function Dj(t){const e=j.useRef(null);return e.current===null&&(e.current=t()),e.current}const CV=typeof window<"u",XM=CV?j.useLayoutEffect:j.useEffect,bb=j.createContext(null);function Pj(t,e){t.indexOf(e)===-1&&t.push(e)}function Hx(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}const la=(t,e,s)=>s>e?e:s<t?t:s;let Ij=()=>{};const vl={},ZM=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function e_(t){return typeof t=="object"&&t!==null}const t_=t=>/^0[^.\s]+$/u.test(t);function s_(t){let e;return()=>(e===void 0&&(e=t()),e)}const li=t=>t,TV=(t,e)=>s=>e(t(s)),np=(...t)=>t.reduce(TV),wm=(t,e,s)=>{const r=e-t;return r===0?1:(s-t)/r};class Lj{constructor(){this.subscriptions=[]}add(e){return Pj(this.subscriptions,e),()=>Hx(this.subscriptions,e)}notify(e,s,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,s,r);else for(let a=0;a<i;a++){const l=this.subscriptions[a];l&&l(e,s,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Or=t=>t*1e3,ai=t=>t/1e3;function n_(t,e){return e?t*(1e3/e):0}const r_=(t,e,s)=>(((1-3*s+3*e)*t+(3*s-6*e))*t+3*e)*t,EV=1e-7,AV=12;function MV(t,e,s,r,i){let a,l,d=0;do l=e+(s-e)/2,a=r_(l,r,i)-t,a>0?s=l:e=l;
vendor: 56,971 bytes, line 9
9while(Math.abs(a)>EV&&++d<AV);return l}function rp(t,e,s,r){if(t===e&&s===r)return li;const i=a=>MV(a,0,1,t,s);return a=>a===0||a===1?a:r_(i(a),e,r)}const i_=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,a_=t=>e=>1-t(1-e),o_=rp(.33,1.53,.69,.99),$j=a_(o_),l_=i_($j),c_=t=>t>=1?1:(t*=2)<1?.5*$j(t):.5*(2-Math.pow(2,-10*(t-1))),Bj=t=>1-Math.sin(Math.acos(t)),d_=a_(Bj),u_=i_(Bj),_V=rp(.42,0,1,1),OV=rp(0,0,.58,1),h_=rp(.42,0,.58,1),RV=t=>Array.isArray(t)&&typeof t[0]!="number",m_=t=>Array.isArray(t)&&typeof t[0]=="number",DV={linear:li,easeIn:_V,easeInOut:h_,easeOut:OV,circIn:Bj,circInOut:u_,circOut:d_,backIn:$j,backInOut:l_,backOut:o_,anticipate:c_},PV=t=>typeof t=="string",U5=t=>{if(m_(t)){Ij(t.length===4);const[e,s,r,i]=t;return rp(e,s,r,i)}else if(PV(t))return DV[t];return t},If=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function IV(t,e){let s=new Set,r=new Set,i=!1,a=!1;const l=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function u(p){l.has(p)&&(m.schedule(p),t()),p(d)}const m={schedule:(p,x=!1,g=!1)=>{const v=g&&i?s:r;return x&&l.add(p),v.add(p),p},cancel:p=>{r.delete(p),l.delete(p)},process:p=>{if(d=p,i){a=!0;return}i=!0;const x=s;s=r,r=x,s.forEach(u),s.clear(),i=!1,a&&(a=!1,m.process(p))}};return m}const LV=40;function p_(t,e){let s=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>s=!0,l=If.reduce((E,_)=>(E[_]=IV(a),E),{}),{setup:d,read:u,resolveKeyframes:m,preUpdate:p,update:x,preRender:g,render:b,postRender:v}=l,k=()=>{const E=vl.useManualTiming,_=E?i.timestamp:performance.now();s=!1,E||(i.delta=r?1e3/60:Math.max(Math.min(_-i.timestamp,LV),1)),i.timestamp=_,i.isProcessing=!0,d.process(i),u.process(i),m.process(i),p.process(i),x.process(i),g.process(i),b.process(i),v.process(i),i.isProcessing=!1,s&&e&&(r=!1,t(k))},N=()=>{s=!0,r=!0,i.isProcessing||t(k)};return{schedule:If.reduce((E,_)=>{const T=l[_];return E[_]=($,L=!1,M=!1)=>(s||N(),T.schedule($,L,M)),E},{}),cancel:E=>{for(let _=0;_<If.length;_++)l[If[_]].cancel(E)},state:i,steps:l}}const{schedule:Gt,cancel:wl,state:wn,steps:rv}=p_(typeof requestAnimationFrame<"u"?requestAnimationFrame:li,!0);let gx;function $V(){gx=void 0}const Qn={now:()=>(gx===void 0&&Qn.set(wn.isProcessing||vl.useManualTiming?wn.timestamp:performance.now()),gx),set:t=>{gx=t,queueMicrotask($V)}},f_=t=>e=>typeof e=="string"&&e.startsWith(t),x_=f_("--"),BV=f_("var(--"),zj=t=>BV(t)?zV.test(t.split("/*")[0].trim()):!1,zV=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function H5(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const _u={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},jm={..._u,transform:t=>la(0,1,t)},Lf={..._u,default:1},Zh=t=>Math.round(t*1e5)/1e5,Vj=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function VV(t){return t==null}const FV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Fj=(t,e)=>s=>!!(typeof s=="string"&&FV.test(s)&&s.startsWith(t)||e&&!VV(s)&&Object.prototype.hasOwnProperty.call(s,e)),g_=(t,e,s)=>r=>{if(typeof r!="string")return r;const[i,a,l,d]=r.match(Vj);return{[t]:parseFloat(i),[e]:parseFloat(a),[s]:parseFloat(l),alpha:d!==void 0?parseFloat(d):1}},UV=t=>la(0,255,t),iv={..._u,transform:t=>Math.round(UV(t))},wc={test:Fj("rgb","red"),parse:g_("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:r=1})=>"rgba("+iv.transform(t)+", "+iv.transform(e)+", "+iv.transform(s)+", "+Zh(jm.transform(r))+")"};function HV(t){let e="",s="",r="",i="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),e+=e,s+=s,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const Lw={test:Fj("#"),parse:HV,transform:wc.transform},ip=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Jo=ip("deg"),ia=ip("%"),Ge=ip("px"),qV=ip("vh"),WV=ip("vw"),q5={...ia,parse:t=>ia.parse(t)/100,transform:t=>ia.transform(t*100)},eu={test:Fj("hsl","hue"),parse:g_("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:r=1})=>"hsla("+Math.round(t)+", "+ia.transform(Zh(e))+", "+ia.transform(Zh(s))+", "+Zh(jm.transform(r))+")"},Fs={test:t=>wc.test(t)||Lw.test(t)||eu.test(t),parse:t=>wc.test(t)?wc.parse(t):eu.test(t)?eu.parse(t):Lw.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?wc.transform(t):eu.transform(t),getAnimatableNone:t=>{const e=Fs.parse(t);return e.alpha=0,Fs.transform(e)}},GV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function KV(t){return isNaN(t)&&typeof t=="string"&&(t.match(Vj)?.length||0)+(t.match(GV)?.length||0)>0}const b_="number",y_="color",YV="var",QV="var(",W5="${}",JV=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function fu(t){const e=t.toString(),s=[],r={color:[],number:[],var:[]},i=[];let a=0;const d=e.replace(JV,u=>(Fs.test(u)?(r.color.push(a),i.push(y_),s.push(Fs.parse(u))):u.startsWith(QV)?(r.var.push(a),i.push(YV),s.push(u)):(r.number.push(a),i.push(b_),s.push(parseFloat(u))),++a,W5)).split(W5);return{values:s,split:d,indexes:r,types:i}}function XV(t){return fu(t).values}function v_({split:t,types:e}){const s=t.length;return r=>{let i="";for(let a=0;a<s;a++)if(i+=t[a],r[a]!==void 0){const l=e[a];l===b_?i+=Zh(r[a]):l===y_?i+=Fs.transform(r[a]):i+=r[a]}return i}}function ZV(t){return v_(fu(t))}const eF=t=>typeof t=="number"?0:Fs.test(t)?Fs.getAnimatableNone(t):t,tF=(t,e)=>typeof t=="number"?e?.trim().endsWith("/")?t:0:eF(t);function sF(t){const e=fu(t);return v_(e)(e.values.map((r,i)=>tF(r,e.split[i])))}const Ti={test:KV,parse:XV,createTransformer:ZV,getAnimatableNone:sF};function av(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+(e-t)*6*s:s<1/2?e:s<2/3?t+(e-t)*(2/3-s)*6:t}function nF({hue:t,saturation:e,lightness:s,alpha:r}){t/=360,e/=100,s/=100;let i=0,a=0,l=0;if(!e)i=a=l=s;else{const d=s<.5?s*(1+e):s+e-s*e,u=2*s-d;i=av(u,d,t+1/3),a=av(u,d,t),l=av(u,d,t-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(l*255),alpha:r}}function qx(t,e){return s=>s>0?e:t}const ns=(t,e,s)=>t+(e-t)*s,ov=(t,e,s)=>{const r=t*t,i=s*(e*e-r)+r;return i<0?0:Math.sqrt(i)},rF=[Lw,wc,eu],iF=t=>rF.find(e=>e.test(t));function G5(t){const e=iF(t);if(!e)return!1;let s=e.parse(t);return e===eu&&(s=nF(s)),s}const K5=(t,e)=>{const s=G5(t),r=G5(e);if(!s||!r)return qx(t,e);const i={...s};return a=>(i.red=ov(s.red,r.red,a),i.green=ov(s.green,r.green,a),i.blue=ov(s.blue,r.blue,a),i.alpha=ns(s.alpha,r.alpha,a),wc.transform(i))},$w=new Set(["none","hidden"]);function aF(t,e){return $w.has(t)?s=>s<=0?t:e:s=>s>=1?e:t}function oF(t,e){return s=>ns(t,e,s)}function Uj(t){return typeof t=="number"?oF:typeof t=="string"?zj(t)?qx:Fs.test(t)?K5:dF:Array.isArray(t)?w_:typeof t=="object"?Fs.test(t)?K5:lF:qx}function w_(t,e){const s=[...t],r=s.length,i=t.map((a,l)=>Uj(a)(a,e[l]));return a=>{for(let l=0;l<r;l++)s[l]=i[l](a);return s}}function lF(t,e){const s={...t,...e},r={};for(const i in s)t[i]!==void 0&&e[i]!==void 0&&(r[i]=Uj(t[i])(t[i],e[i]));return i=>{for(const a in r)s[a]=r[a](i);return s}}function cF(t,e){const s=[],r={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const a=e.types[i],l=t.indexes[a][r[a]],d=t.values[l]??0;s[i]=d,r[a]++}return s}const dF=(t,e)=>{const s=Ti.createTransformer(e),r=fu(t),i=fu(e);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?$w.has(t)&&!i.values.length||$w.has(e)&&!r.values.length?aF(t,e):np(w_(cF(r,i),i.values),s):qx(t,e)};function j_(t,e,s){return typeof t=="number"&&typeof e=="number"&&typeof s=="number"?ns(t,e,s):Uj(t)(t,e)}const uF=t=>{const e=({timestamp:s})=>t(s);return{start:(s=!0)=>Gt.update(e,s),stop:()=>wl(e),now:()=>wn.isProcessing?wn.timestamp:Qn.now()}},N_=(t,e,s=10)=>{let r="";const i=Math.max(Math.round(e/s),2);for(let a=0;a<i;a++)r+=Math.round(t(a/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Wx=2e4;function Hj(t){let e=0;const s=50;let r=t.next(e);for(;!r.done&&e<Wx;)e+=s,r=t.next(e);return e>=Wx?1/0:e}function hF(t,e=100,s){const r=s({...t,keyframes:[0,e]}),i=Math.min(Hj(r),Wx);return{type:"keyframes",ease:a=>r.next(i*a).value/e,duration:ai(i)}}const Es={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Bw(t,e){return t*Math.sqrt(1-e*e)}const mF=12;function pF(t,e,s){let r=s;for(let i=1;i<mF;i++)r=r-t(r)/e(r);return r}const lv=.001;function fF({duration:t=Es.duration,bounce:e=Es.bounce,velocity:s=Es.velocity,mass:r=Es.mass}){let i,a,l=1-e;l=la(Es.minDamping,Es.maxDamping,l),t=la(Es.minDuration,Es.maxDuration,ai(t)),l<1?(i=m=>{const p=m*l,x=p*t,g=p-s,b=Bw(m,l),v=Math.exp(-x);return lv-g/b*v},a=m=>{const x=m*l*t,g=x*s+s,b=Math.pow(l,2)*Math.pow(m,2)*t,v=Math.exp(-x),k=Bw(Math.pow(m,2),l);return(-i(m)+lv>0?-1:1)*((g-b)*v)/k}):(i=m=>{const p=Math.exp(-m*t),x=(m-s)*t+1;return-lv+p*x},a=m=>{const p=Math.exp(-m*t),x=(s-m)*(t*t);return p*x});const d=5/t,u=pF(i,a,d);if(t=Or(t),isNaN(u))return{stiffness:Es.stiffness,damping:Es.damping,duration:t};{const m=Math.pow(u,2)*r;return{stiffness:m,damping:l*2*Math.sqrt(r*m),duration:t}}}const xF=["duration","bounce"],gF=["stiffness","damping","mass"];function Y5(t,e){return e.some(s=>t[s]!==void 0)}function bF(t){let e={velocity:Es.velocity,stiffness:Es.stiffness,damping:Es.damping,mass:Es.mass,isResolvedFromDuration:!1,...t};if(!Y5(t,gF)&&Y5(t,xF))if(e.velocity=0,t.visualDuration){const s=t.visualDuration,r=2*Math.PI/(s*1.2),i=r*r,a=2*la(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:Es.mass,stiffness:i,damping:a}}else{const s=fF({...t,velocity:0});e={...e,...s,mass:Es.mass},e.isResolvedFromDuration=!0}return e}function Gx(t=Es.visualDuration,e=Es.bounce){const s=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:i}=s;const a=s.keyframes[0],l=s.keyframes[s.keyframes.length-1],d={done:!1,value:a},{stiffness:u,damping:m,mass:p,duration:x,velocity:g,isResolvedFromDuration:b}=bF({...s,velocity:-ai(s.velocity||0)}),v=g||0,k=m/(2*Math.sqrt(u*p)),N=l-a,S=ai(Math.sqrt(u/p)),A=Math.abs(N)<5;r||(r=A?Es.restSpeed.granular:Es.restSpeed.default),i||(i=A?Es.restDelta.granular:Es.restDelta.default);let E,_,T,$,L,M;if(k<1)T=Bw(S,k),$=(v+k*S*N)/T,E=z=>{const ae=Math.exp(-k*S*z);return l-ae*($*Math.sin(T*z)+N*Math.cos(T*z))},L=k*S*$+N*T,M=k*S*N-$*T,_=z=>Math.exp(-k*S*z)*(L*Math.sin(T*z)+M*Math.cos(T*z));else if(k===1){E=ae=>l-Math.exp(-S*ae)*(N+(v+S*N)*ae);const z=v+S*N;_=ae=>Math.exp(-S*ae)*(S*z*ae-v)}else{const z=S*Math.sqrt(k*k-1);E=P=>{const ne=Math.exp(-k*S*P),q=Math.min(z*P,300);return l-ne*((v+k*S*N)*Math.sinh(q)+z*N*Math.cosh(q))/z};const ae=(v+k*S*N)/z,U=k*S*ae-N*z,Y=k*S*N-ae*z;_=P=>{const ne=Math.exp(-k*S*P),q=Math.min(z*P,300);return ne*(U*Math.sinh(q)+Y*Math.cosh(q))}}const I={calculatedDuration:b&&x||null,velocity:z=>Or(_(z)),next:z=>{if(!b&&k<1){const U=Math.exp(-k*S*z),Y=Math.sin(T*z),P=Math.cos(T*z),ne=l-U*($*Y+N*P),q=Or(U*(L*Y+M*P));return d.done=Math.abs(q)<=r&&Math.abs(l-ne)<=i,d.value=d.done?l:ne,d}const ae=E(z);if(b)d.done=z>=x;else{const U=Or(_(z));d.done=Math.abs(U)<=r&&Math.abs(l-ae)<=i}return d.value=d.done?l:ae,d},toString:()=>{const z=Math.min(Hj(I),Wx),ae=N_(U=>I.next(z*U).value,z,30);return z+"ms "+ae},toTransition:()=>{}};return I}Gx.applyToOptions=t=>{const e=hF(t,100,Gx);return t.ease=e.ease,t.duration=Or(e.duration),t.type="keyframes",t};const yF=5;function k_(t,e,s){const r=Math.max(e-yF,0);return n_(s-t(r),e-r)}function zw({keyframes:t,velocity:e=0,power:s=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:l,min:d,max:u,restDelta:m=.5,restSpeed:p}){const x=t[0],g={done:!1,value:x},b=M=>d!==void 0&&M<d||u!==void 0&&M>u,v=M=>d===void 0?u:u===void 0||Math.abs(d-M)<Math.abs(u-M)?d:u;let k=s*e;const N=x+k,S=l===void 0?N:l(N);S!==N&&(k=S-x);const A=M=>-k*Math.exp(-M/r),E=M=>S+A(M),_=M=>{const I=A(M),z=E(M);g.done=Math.abs(I)<=m,g.value=g.done?S:z};let T,$;const L=M=>{b(g.value)&&(T=M,$=Gx({keyframes:[g.value,v(g.value)],velocity:k_(E,M,g.value),damping:i,stiffness:a,restDelta:m,restSpeed:p}))};return L(0),{calculatedDuration:null,next:M=>{let I=!1;return!$&&T===void 0&&(I=!0,_(M),L(M)),T!==void 0&&M>=T?$.next(M-T):(!I&&_(M),g)}}}function vF(t,e,s){const r=[],i=s||vl.mix||j_,a=t.length-1;for(let l=0;l<a;l++){let d=i(t[l],t[l+1]);if(e){const u=Array.isArray(e)?e[l]||li:e;d=np(u,d)}r.push(d)}return r}function wF(t,e,{clamp:s=!0,ease:r,mixer:i}={}){const a=t.length;if(Ij(a===e.length),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const l=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),e=[...e].reverse());const d=vF(e,r,i),u=d.length,m=p=>{if(l&&p<t[0])return e[0];let x=0;if(u>1)for(;x<t.length-2&&!(p<t[x+1]);x++);const g=wm(t[x],t[x+1],p);return d[x](g)};return s?p=>m(la(t[0],t[a-1],p)):m}function jF(t,e){const s=t[t.length-1];for(let r=1;r<=e;r++){const i=wm(0,e,r);t.push(ns(s,1,i))}}function NF(t){const e=[0];return jF(e,t.length-1),e}function kF(t,e){return t.map(s=>s*e)}function SF(t,e){return t.map(()=>e||h_).splice(0,t.length-1)}function em({duration:t=300,keyframes:e,times:s,ease:r="easeInOut"}){const i=RV(r)?r.map(U5):U5(r),a={done:!1,value:e[0]},l=kF(s&&s.length===e.length?s:NF(e),t),d=wF(l,e,{ease:Array.isArray(i)?i:SF(e,i)});return{calculatedDuration:t,next:u=>(a.value=d(u),a.done=u>=t,a)}}const CF=t=>t!==null;function yb(t,{repeat:e,repeatType:s="loop"},r,i=1){const a=t.filter(CF),d=i<0||e&&s!=="loop"&&e%2===1?0:a.length-1;return!d||r===void 0?a[d]:r}const TF={decay:zw,inertia:zw,tween:em,keyframes:em,spring:Gx};function S_(t){typeof t.type=="string"&&(t.type=TF[t.type])}class qj{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,s){return this.finished.then(e,s)}}const EF=t=>t/100;class Kx extends qj{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:s}=this.options;s&&s.updatedAt!==Qn.now()&&this.tick(Qn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;S_(e);const{type:s=em,repeat:r=0,repeatDelay:i=0,repeatType:a,velocity:l=0}=e;let{keyframes:d}=e;const u=s||em;u!==em&&typeof d[0]!="number"&&(this.mixKeyframes=np(EF,j_(d[0],d[1])),d=[0,100]);const m=u({...e,keyframes:d});a==="mirror"&&(this.mirroredGenerator=u({...e,keyframes:[...d].reverse(),velocity:-l})),m.calculatedDuration===null&&(m.calculatedDuration=Hj(m));const{calculatedDuration:p}=m;this.calculatedDuration=p,this.resolvedDuration=p+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=m}updateTime(e){const s=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=s}tick(e,s=!1){const{generator:r,totalDuration:i,mixKeyframes:a,mirroredGenerator:l,resolvedDuration:d,calculatedDuration:u}=this;if(this.startTime===null)return r.next(0);const{delay:m=0,keyframes:p,repeat:x,repeatType:g,repeatDelay:b,type:v,onUpdate:k,finalKeyframe:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),s?this.currentTime=e:this.updateTime(e);const S=this.currentTime-m*(this.playbackSpeed>=0?1:-1),A=this.playbackSpeed>=0?S<0:S>i;this.currentTime=Math.max(S,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let E=this.currentTime,_=r;if(x){const M=Math.min(this.currentTime,i)/d;let I=Math.floor(M),z=M%1;!z&&M>=1&&(z=1),z===1&&I--,I=Math.min(I,x+1),I%2&&(g==="reverse"?(z=1-z,b&&(z-=b/d)):g==="mirror"&&(_=l)),E=la(0,1,z)*d}let T;A?(this.delayState.value=p[0],T=this.delayState):T=_.next(E),a&&!A&&(T.value=a(T.value));let{done:$}=T;!A&&u!==null&&($=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const L=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&$);return L&&v!==zw&&(T.value=yb(p,this.options,N,this.speed)),k&&k(T.value),L&&this.finish(),T}then(e,s){return this.finished.then(e,s)}get duration(){return ai(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ai(e)}get time(){return ai(this.currentTime)}set time(e){e=Or(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const s=this.generator.next(e).value;return k_(r=>this.generator.next(r).value,e,s)}get speed(){return this.playbackSpeed}set speed(e){const s=this.playbackSpeed!==e;s&&this.driver&&this.updateTime(Qn.now()),this.playbackSpeed=e,s&&this.driver&&(this.time=ai(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=uF,startTime:s}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=s??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Qn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function AF(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const jc=t=>t*180/Math.PI,Vw=t=>{const e=jc(Math.atan2(t[1],t[0]));return Fw(e)},MF={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Vw,rotateZ:Vw,skewX:t=>jc(Math.atan(t[1])),skewY:t=>jc(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Fw=t=>(t=t%360,t<0&&(t+=360),t),Q5=Vw,J5=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),X5=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),_F={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:J5,scaleY:X5,scale:t=>(J5(t)+X5(t))/2,rotateX:t=>Fw(jc(Math.atan2(t[6],t[5]))),rotateY:t=>Fw(jc(Math.atan2(-t[2],t[0]))),rotateZ:Q5,rotate:Q5,skewX:t=>jc(Math.atan(t[4])),skewY:t=>jc(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Uw(t){return t.includes("scale")?1:0}function Hw(t,e){if(!t||t==="none")return Uw(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(s)r=_F,i=s;else{const d=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=MF,i=d}if(!i)return Uw(e);const a=r[e],l=i[1].split(",").map(RF);return typeof a=="function"?a(l):l[a]}const OF=(t,e)=>{const{transform:s="none"}=getComputedStyle(t);return Hw(s,e)};function RF(t){return parseFloat(t.trim())}const Ou=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ru=new Set(Ou),Z5=t=>t===_u||t===Ge,DF=new Set(["x","y","z"]),PF=Ou.filter(t=>!DF.has(t));function IF(t){const e=[];return PF.forEach(s=>{const r=t.getValue(s);r!==void 0&&(e.push([s,r.get()]),r.set(s.startsWith("scale")?1:0))}),e}const rl={width:({x:t},{paddingLeft:e="0",paddingRight:s="0",boxSizing:r})=>{const i=t.max-t.min;return r==="border-box"?i:i-parseFloat(e)-parseFloat(s)},height:({y:t},{paddingTop:e="0",paddingBottom:s="0",boxSizing:r})=>{const i=t.max-t.min;return r==="border-box"?i:i-parseFloat(e)-parseFloat(s)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Hw(e,"x"),y:(t,{transform:e})=>Hw(e,"y")};rl.translateX=rl.x;rl.translateY=rl.y;const Mc=new Set;let qw=!1,Ww=!1,Gw=!1;function C_(){if(Ww){const t=Array.from(Mc).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),s=new Map;e.forEach(r=>{const i=IF(r);i.length&&(s.set(r,i),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const i=s.get(r);i&&i.forEach(([a,l])=>{r.getValue(a)?.set(l)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Ww=!1,qw=!1,Mc.forEach(t=>t.complete(Gw)),Mc.clear()}function T_(){Mc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Ww=!0)})}function LF(){Gw=!0,T_(),C_(),Gw=!1}class Wj{constructor(e,s,r,i,a,l=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=s,this.name=r,this.motionValue=i,this.element=a,this.isAsync=l}scheduleResolve(){this.state="scheduled",this.isAsync?(Mc.add(this),qw||(qw=!0,Gt.read(T_),Gt.resolveKeyframes(C_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:s,element:r,motionValue:i}=this;if(e[0]===null){const a=i?.get(),l=e[e.length-1];if(a!==void 0)e[0]=a;else if(r&&s){const d=r.readValue(s,l);d!=null&&(e[0]=d)}e[0]===void 0&&(e[0]=l),i&&a===void 0&&i.set(e[0])}AF(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Mc.delete(this)}cancel(){this.state==="scheduled"&&(Mc.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const $F=t=>t.startsWith("--");function E_(t,e,s){$F(e)?t.style.setProperty(e,s):t.style[e]=s}const BF={};function A_(t,e){const s=s_(t);return()=>BF[e]??s()}const zF=A_(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),M_=A_(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Hh=([t,e,s,r])=>`cubic-bezier(${t}, ${e}, ${s}, ${r})`,e3={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Hh([0,.65,.55,1]),circOut:Hh([.55,0,1,.45]),backIn:Hh([.31,.01,.66,-.59]),backOut:Hh([.33,1.53,.69,.99])};function __(t,e){if(t)return typeof t=="function"?M_()?N_(t,e):"ease-out":m_(t)?Hh(t):Array.isArray(t)?t.map(s=>__(s,e)||e3.easeOut):e3[t]}function VF(t,e,s,{delay:r=0,duration:i=300,repeat:a=0,repeatType:l="loop",ease:d="easeOut",times:u}={},m=void 0){const p={[e]:s};u&&(p.offset=u);const x=__(d,i);Array.isArray(x)&&(p.easing=x);const g={delay:r,duration:i,easing:Array.isArray(x)?"linear":x,fill:"both",iterations:a+1,direction:l==="reverse"?"alternate":"normal"};return m&&(g.pseudoElement=m),t.animate(p,g)}function O_(t){return typeof t=="function"&&"applyToOptions"in t}function FF({type:t,...e}){return O_(t)&&M_()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class R_ extends qj{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:s,name:r,keyframes:i,pseudoElement:a,allowFlatten:l=!1,finalKeyframe:d,onComplete:u}=e;this.isPseudoElement=!!a,this.allowFlatten=l,this.options=e,Ij(typeof e.type!="string");const m=FF(e);this.animation=VF(s,r,i,m,a),m.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const p=yb(i,this.options,d,this.speed);this.updateMotionValue&&this.updateMotionValue(p),E_(s,r,p),this.animation.cancel()}u?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return ai(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+ai(e)}get time(){return ai(Number(this.animation.currentTime)||0)}set time(e){const s=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Or(e),s&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:s,rangeEnd:r,observe:i}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&zF()?(this.animation.timeline=e,s&&(this.animation.rangeStart=s),r&&(this.animation.rangeEnd=r),li):i(this)}}const D_={anticipate:c_,backInOut:l_,circInOut:u_};function UF(t){return t in D_}function HF(t){typeof t.ease=="string"&&UF(t.ease)&&(t.ease=D_[t.ease])}const cv=10;class qF extends R_{constructor(e){HF(e),S_(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:s,onUpdate:r,onComplete:i,element:a,...l}=this.options;if(!s)return;if(e!==void 0){s.set(e);return}const d=new Kx({...l,autoplay:!1}),u=Math.max(cv,Qn.now()-this.startTime),m=la(0,cv,u-cv),p=d.sample(u).value,{name:x}=this.options;a&&x&&E_(a,x,p),s.setWithVelocity(d.sample(Math.max(0,u-m)).value,p,m),d.stop()}}const t3=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ti.test(t)||t==="0")&&!t.startsWith("url("));function WF(t){const e=t[0];if(t.length===1)return!0;for(let s=0;s<t.length;s++)if(t[s]!==e)return!0}function GF(t,e,s,r){const i=t[0];if(i===null)return!1;if(e==="display"||e==="visibility")return!0;const a=t[t.length-1],l=t3(i,e),d=t3(a,e);return!l||!d?!1:WF(t)||(s==="spring"||O_(s))&&r}function Kw(t){t.duration=0,t.type="keyframes"}const P_=new Set(["opacity","clipPath","filter","transform"]),KF=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function YF(t){for(let e=0;e<t.length;e++)if(typeof t[e]=="string"&&KF.test(t[e]))return!0;return!1}const QF=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),JF=s_(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function XF(t){const{motionValue:e,name:s,repeatDelay:r,repeatType:i,damping:a,type:l,keyframes:d}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:p}=e.owner.getProps();return JF()&&s&&(P_.has(s)||QF.has(s)&&YF(d))&&(s!=="transform"||!p)&&!m&&!r&&i!=="mirror"&&a!==0&&l!=="inertia"}const ZF=40;class eU extends qj{constructor({autoplay:e=!0,delay:s=0,type:r="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:l="loop",keyframes:d,name:u,motionValue:m,element:p,...x}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Qn.now();const g={autoplay:e,delay:s,type:r,repeat:i,repeatDelay:a,repeatType:l,name:u,motionValue:m,element:p,...x},b=p?.KeyframeResolver||Wj;this.keyframeResolver=new b(d,(v,k,N)=>this.onKeyframesResolved(v,k,g,!N),u,m,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,s,r,i){this.keyframeResolver=void 0;const{name:a,type:l,velocity:d,delay:u,isHandoff:m,onUpdate:p}=r;this.resolvedAt=Qn.now();let x=!0;GF(e,a,l,d)||(x=!1,(vl.instantAnimations||!u)&&p?.(yb(e,r,s)),e[0]=e[e.length-1],Kw(r),r.repeat=0);const b={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>ZF?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:s,...r,keyframes:e},v=x&&!m&&XF(b),k=b.motionValue?.owner?.current;let N;if(v)try{N=new qF({...b,element:k})}catch{N=new Kx(b)}else N=new Kx(b);N.finished.then(()=>{this.notifyFinished()}).catch(li),this.pendingTimeline&&(this.stopTimeline=N.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=N}get finished(){return this._animation?this.animation.finished:this._finished}then(e,s){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),LF()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function I_(t,e,s,r=0,i=1){const a=Array.from(t).sort((m,p)=>m.sortNodePosition(p)).indexOf(e),l=t.size,d=(l-1)*r;return typeof s=="function"?s(a,l):i===1?a*r:d-a*r}const tU=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function sU(t){const e=tU.exec(t);if(!e)return[,];const[,s,r,i]=e;return[`--${s??r}`,i]}function L_(t,e,s=1){const[r,i]=sU(t);if(!r)return;const a=window.getComputedStyle(e).getPropertyValue(r);if(a){const l=a.trim();return ZM(l)?parseFloat(l):l}return zj(i)?L_(i,e,s+1):i}const nU={type:"spring",stiffness:500,damping:25,restSpeed:10},rU=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),iU={type:"keyframes",duration:.8},aU={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},oU=(t,{keyframes:e})=>e.length>2?iU:Ru.has(t)?t.startsWith("scale")?rU(e[1]):nU:aU;function $_(t,e){if(t?.inherit&&e){const{inherit:s,...r}=t;return{...e,...r}}return t}function Gj(t,e){const s=t?.[e]??t?.default??t;return s!==t?$_(s,t):s}const lU=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function cU(t){for(const e in t)if(!lU.has(e))return!0;return!1}const Kj=(t,e,s,r={},i,a)=>l=>{const d=Gj(r,t)||{},u=d.delay||r.delay||0;let{elapsed:m=0}=r;m=m-Or(u);const p={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:e.getVelocity(),...d,delay:-m,onUpdate:g=>{e.set(g),d.onUpdate&&d.onUpdate(g)},onComplete:()=>{l(),d.onComplete&&d.onComplete()},name:t,motionValue:e,element:a?void 0:i};cU(d)||Object.assign(p,oU(t,p)),p.duration&&(p.duration=Or(p.duration)),p.repeatDelay&&(p.repeatDelay=Or(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let x=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(Kw(p),p.delay===0&&(x=!0)),(vl.instantAnimations||vl.skipAnimations||i?.shouldSkipAnimations)&&(x=!0,Kw(p),p.delay=0),p.allowFlatten=!d.type&&!d.ease,x&&!a&&e.get()!==void 0){const g=yb(p.keyframes,d);if(g!==void 0){Gt.update(()=>{p.onUpdate(g),p.onComplete()});return}}return d.isSync?new Kx(p):new eU(p)};function s3(t){const e=[{},{}];return t?.values.forEach((s,r)=>{e[0][r]=s.get(),e[1][r]=s.getVelocity()}),e}function Yj(t,e,s,r){if(typeof e=="function"){const[i,a]=s3(r);e=e(s!==void 0?s:t.custom,i,a)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,a]=s3(r);e=e(s!==void 0?s:t.custom,i,a)}return e}function _c(t,e,s){const r=t.getProps();return Yj(r,e,s!==void 0?s:r.custom,t)}const B_=new Set(["width","height","top","left","right","bottom",...Ou]),n3=30,dU=t=>!isNaN(parseFloat(t));class uU{constructor(e,s={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const i=Qn.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=s.owner}setCurrent(e){this.current=e,this.updatedAt=Qn.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=dU(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,s){this.events[e]||(this.events[e]=new Lj);const r=this.events[e].add(s);return e==="change"?()=>{r(),Gt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,s){this.passiveEffect=e,this.stopPassiveEffect=s}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,s,r){this.set(s),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,s=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,s&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Qn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>n3)return 0;const s=Math.min(this.updatedAt-this.prevUpdatedAt,n3);return n_(parseFloat(this.current)-parseFloat(this.prevFrameValue),s)}start(e){return this.stop(),new Promise(s=>{this.hasAnimated=!0,this.animation=e(s),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function xu(t,e){return new uU(t,e)}const Yw=t=>Array.isArray(t);function hU(t,e,s){t.hasValue(e)?t.getValue(e).set(s):t.addValue(e,xu(s))}function mU(t){return Yw(t)?t[t.length-1]||0:t}function pU(t,e){const s=_c(t,e);let{transitionEnd:r={},transition:i={},...a}=s||{};a={...a,...r};for(const l in a){const d=mU(a[l]);hU(t,l,d)}}const Sn=t=>!!(t&&t.getVelocity);function fU(t){return!!(Sn(t)&&t.add)}function Qw(t,e){const s=t.getValue("willChange");if(fU(s))return s.add(e);if(!s&&vl.WillChange){const r=new vl.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function Qj(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const xU="framerAppearId",z_="data-"+Qj(xU);function V_(t){return t.props[z_]}function gU({protectedKeys:t,needsAnimating:e},s){const r=t.hasOwnProperty(s)&&e[s]!==!0;return e[s]=!1,r}function F_(t,e,{delay:s=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:l,...d}=e;const u=t.getDefaultTransition();a=a?$_(a,u):u;const m=a?.reduceMotion;r&&(a=r);const p=[],x=i&&t.animationState&&t.animationState.getState()[i];for(const g in d){const b=t.getValue(g,t.latestValues[g]??null),v=d[g];if(v===void 0||x&&gU(x,g))continue;const k={delay:s,...Gj(a||{},g)},N=b.get();if(N!==void 0&&!b.isAnimating()&&!Array.isArray(v)&&v===N&&!k.velocity){Gt.update(()=>b.set(v));continue}let S=!1;if(window.MotionHandoffAnimation){const _=V_(t);if(_){const T=window.MotionHandoffAnimation(_,g,Gt);T!==null&&(k.startTime=T,S=!0)}}Qw(t,g);const A=m??t.shouldReduceMotion;b.start(Kj(g,b,v,A&&B_.has(g)?{type:!1}:k,t,S));const E=b.animation;E&&p.push(E)}if(l){const g=()=>Gt.update(()=>{l&&pU(t,l)});p.length?Promise.all(p).then(g):g()}return p}function Jw(t,e,s={}){const r=_c(t,e,s.type==="exit"?t.presenceContext?.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=r||{};s.transitionOverride&&(i=s.transitionOverride);const a=r?()=>Promise.all(F_(t,r,s)):()=>Promise.resolve(),l=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:m=0,staggerChildren:p,staggerDirection:x}=i;return bU(t,e,u,m,p,x,s)}:()=>Promise.resolve(),{when:d}=i;if(d){const[u,m]=d==="beforeChildren"?[a,l]:[l,a];return u().then(()=>m())}else return Promise.all([a(),l(s.delay)])}function bU(t,e,s=0,r=0,i=0,a=1,l){const d=[];for(const u of t.variantChildren)u.notify("AnimationStart",e),d.push(Jw(u,e,{...l,delay:s+(typeof r=="function"?0:r)+I_(t.variantChildren,u,r,i,a)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(d)}function yU(t,e,s={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const i=e.map(a=>Jw(t,a,s));r=Promise.all(i)}else if(typeof e=="string")r=Jw(t,e,s);else{const i=typeof e=="function"?_c(t,e,s.custom):e;r=Promise.all(F_(t,i,s))}return r.then(()=>{t.notify("AnimationComplete",e)})}const vU={test:t=>t==="auto",parse:t=>t},U_=t=>e=>e.test(t),H_=[_u,Ge,ia,Jo,WV,qV,vU],r3=t=>H_.find(U_(t));function wU(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||t_(t):!0}const jU=new Set(["brightness","contrast","saturate","opacity"]);function NU(t){const[e,s]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=s.match(Vj)||[];if(!r)return t;const i=s.replace(r,"");let a=jU.has(e)?1:0;return r!==s&&(a*=100),e+"("+a+i+")"}const kU=/\b([a-z-]*)\(.*?\)/gu,Xw={...Ti,getAnimatableNone:t=>{const e=t.match(kU);return e?e.map(NU).join(" "):t}},Zw={...Ti,getAnimatableNone:t=>{const e=Ti.parse(t);return Ti.createTransformer(t)(e.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},i3={..._u,transform:Math.round},SU={rotate:Jo,rotateX:Jo,rotateY:Jo,rotateZ:Jo,scale:Lf,scaleX:Lf,scaleY:Lf,scaleZ:Lf,skew:Jo,skewX:Jo,skewY:Jo,distance:Ge,translateX:Ge,translateY:Ge,translateZ:Ge,x:Ge,y:Ge,z:Ge,perspective:Ge,transformPerspective:Ge,opacity:jm,originX:q5,originY:q5,originZ:Ge},Jj={borderWidth:Ge,borderTopWidth:Ge,borderRightWidth:Ge,borderBottomWidth:Ge,borderLeftWidth:Ge,borderRadius:Ge,borderTopLeftRadius:Ge,borderTopRightRadius:Ge,borderBottomRightRadius:Ge,borderBottomLeftRadius:Ge,width:Ge,maxWidth:Ge,height:Ge,maxHeight:Ge,top:Ge,right:Ge,bottom:Ge,left:Ge,inset:Ge,insetBlock:Ge,insetBlockStart:Ge,insetBlockEnd:Ge,insetInline:Ge,insetInlineStart:Ge,insetInlineEnd:Ge,padding:Ge,paddingTop:Ge,paddingRight:Ge,paddingBottom:Ge,paddingLeft:Ge,paddingBlock:Ge,paddingBlockStart:Ge,paddingBlockEnd:Ge,paddingInline:Ge,paddingInlineStart:Ge,paddingInlineEnd:Ge,margin:Ge,marginTop:Ge,marginRight:Ge,marginBottom:Ge,marginLeft:Ge,marginBlock:Ge,marginBlockStart:Ge,marginBlockEnd:Ge,marginInline:Ge,marginInlineStart:Ge,marginInlineEnd:Ge,fontSize:Ge,backgroundPositionX:Ge,backgroundPositionY:Ge,...SU,zIndex:i3,fillOpacity:jm,strokeOpacity:jm,numOctaves:i3},CU={...Jj,color:Fs,backgroundColor:Fs,outlineColor:Fs,fill:Fs,stroke:Fs,borderColor:Fs,borderTopColor:Fs,borderRightColor:Fs,borderBottomColor:Fs,borderLeftColor:Fs,filter:Xw,WebkitFilter:Xw,mask:Zw,WebkitMask:Zw},q_=t=>CU[t],TU=new Set([Xw,Zw]);function W_(t,e){let s=q_(t);return TU.has(s)||(s=Ti),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const EU=new Set(["auto","none","0"]);function AU(t,e,s){let r=0,i;for(;r<t.length&&!i;){const a=t[r];typeof a=="string"&&!EU.has(a)&&fu(a).values.length&&(i=t[r]),r++}if(i&&s)for(const a of e)t[a]=W_(s,i)}class MU extends Wj{constructor(e,s,r,i,a){super(e,s,r,i,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:s,name:r}=this;if(!s||!s.current)return;super.readKeyframes();for(let p=0;p<e.length;p++){let x=e[p];if(typeof x=="string"&&(x=x.trim(),zj(x))){const g=L_(x,s.current);g!==void 0&&(e[p]=g),p===e.length-1&&(this.finalKeyframe=x)}}if(this.resolveNoneKeyframes(),!B_.has(r)||e.length!==2)return;const[i,a]=e,l=r3(i),d=r3(a),u=H5(i),m=H5(a);if(u!==m&&rl[r]){this.needsMeasurement=!0;return}if(l!==d)if(Z5(l)&&Z5(d))for(let p=0;p<e.length;p++){const x=e[p];typeof x=="string"&&(e[p]=parseFloat(x))}else rl[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:s}=this,r=[];for(let i=0;i<e.length;i++)(e[i]===null||wU(e[i]))&&r.push(i);r.length&&AU(e,r,s)}measureInitialState(){const{element:e,unresolvedKeyframes:s,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=rl[r](e.measureViewportBox(),window.getComputedStyle(e.current)),s[0]=this.measuredOrigin;const i=s[s.length-1];i!==void 0&&e.getValue(r,i).jump(i,!1)}measureEndState(){const{element:e,name:s,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const i=e.getValue(s);i&&i.jump(this.measuredOrigin,!1);const a=r.length-1,l=r[a];r[a]=rl[s](e.measureViewportBox(),window.getComputedStyle(e.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),this.removedTransforms?.length&&this.removedTransforms.forEach(([d,u])=>{e.getValue(d).set(u)}),this.resolveNoneKeyframes()}}function G_(t,e,s){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const i=s?.[t]??r.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(r=>r!=null)}const K_=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function bx(t){return e_(t)&&"offsetHeight"in t&&!("ownerSVGElement"in t)}const{schedule:Xj}=p_(queueMicrotask,!1),wi={x:!1,y:!1};function Y_(){return wi.x||wi.y}function _U(t){return t==="x"||t==="y"?wi[t]?null:(wi[t]=!0,()=>{wi[t]=!1}):wi.x||wi.y?null:(wi.x=wi.y=!0,()=>{wi.x=wi.y=!1})}function Q_(t,e){const s=G_(t),r=new AbortController,i={passive:!0,...e,signal:r.signal};return[s,i,()=>r.abort()]}function OU(t){return!(t.pointerType==="touch"||Y_())}function RU(t,e,s={}){const[r,i,a]=Q_(t,s);return r.forEach(l=>{let d=!1,u=!1,m;const p=()=>{l.removeEventListener("pointerleave",v)},x=N=>{m&&(m(N),m=void 0),p()},g=N=>{d=!1,window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g),u&&(u=!1,x(N))},b=()=>{d=!0,window.addEventListener("pointerup",g,i),window.addEventListener("pointercancel",g,i)},v=N=>{if(N.pointerType!=="touch"){if(d){u=!0;return}x(N)}},k=N=>{if(!OU(N))return;u=!1;const S=e(l,N);typeof S=="function"&&(m=S,l.addEventListener("pointerleave",v,i))};l.addEventListener("pointerenter",k,i),l.addEventListener("pointerdown",b,i)}),a}const J_=(t,e)=>e?t===e?!0:J_(t,e.parentElement):!1,Zj=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,DU=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function PU(t){return DU.has(t.tagName)||t.isContentEditable===!0}const IU=new Set(["INPUT","SELECT","TEXTAREA"]);function LU(t){return IU.has(t.tagName)||t.isContentEditable===!0}const yx=new WeakSet;function a3(t){return e=>{e.key==="Enter"&&t(e)}}function dv(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const $U=(t,e)=>{const s=t.currentTarget;if(!s)return;const r=a3(()=>{if(yx.has(s))return;dv(s,"down");const i=a3(()=>{dv(s,"up")}),a=()=>dv(s,"cancel");s.addEventListener("keyup",i,e),s.addEventListener("blur",a,e)});s.addEventListener("keydown",r,e),s.addEventListener("blur",()=>s.removeEventListener("keydown",r),e)};function o3(t){return Zj(t)&&!Y_()}const l3=new WeakSet;function BU(t,e,s={}){const[r,i,a]=Q_(t,s),l=d=>{const u=d.currentTarget;if(!o3(d)||l3.has(d))return;yx.add(u),s.stopPropagation&&l3.add(d);const m=e(u,d),p=(b,v)=>{window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",g),yx.has(u)&&yx.delete(u),o3(b)&&typeof m=="function"&&m(b,{success:v})},x=b=>{p(b,u===window||u===document||s.useGlobalTarget||J_(u,b.target))},g=b=>{p(b,!1)};window.addEventListener("pointerup",x,i),window.addEventListener("pointercancel",g,i)};return r.forEach(d=>{(s.useGlobalTarget?window:d).addEventListener("pointerdown",l,i),bx(d)&&(d.addEventListener("focus",m=>$U(m,i)),!PU(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),a}function eN(t){return e_(t)&&"ownerSVGElement"in t}const vx=new WeakMap;let wx;const X_=(t,e,s)=>(r,i)=>i&&i[0]?i[0][t+"Size"]:eN(r)&&"getBBox"in r?r.getBBox()[e]:r[s],zU=X_("inline","width","offsetWidth"),VU=X_("block","height","offsetHeight");function FU({target:t,borderBoxSize:e}){vx.get(t)?.forEach(s=>{s(t,{get width(){return zU(t,e)},get height(){return VU(t,e)}})})}function UU(t){t.forEach(FU)}function HU(){typeof ResizeObserver>"u"||(wx=new ResizeObserver(UU))}function qU(t,e){wx||HU();const s=G_(t);return s.forEach(r=>{let i=vx.get(r);i||(i=new Set,vx.set(r,i)),i.add(e),wx?.observe(r)}),()=>{s.forEach(r=>{const i=vx.get(r);i?.delete(e),i?.size||wx?.unobserve(r)})}}const jx=new Set;let tu;function WU(){tu=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};jx.forEach(e=>e(t))},window.addEventListener("resize",tu)}function GU(t){return jx.add(t),tu||WU(),()=>{jx.delete(t),!jx.size&&typeof tu=="function"&&(window.removeEventListener("resize",tu),tu=void 0)}}function c3(t,e){return typeof t=="function"?GU(t):qU(t,e)}function KU(t){return eN(t)&&t.tagName==="svg"}const YU=[...H_,Fs,Ti],QU=t=>YU.find(U_(t)),d3=()=>({translate:0,scale:1,origin:0,originPoint:0}),su=()=>({x:d3(),y:d3()}),u3=()=>({min:0,max:0}),Zs=()=>({x:u3(),y:u3()}),JU=new WeakMap;function vb(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Nm(t){return typeof t=="string"||Array.isArray(t)}const tN=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],sN=["initial",...tN];function wb(t){return vb(t.animate)||sN.some(e=>Nm(t[e]))}function Z_(t){return!!(wb(t)||t.variants)}function XU(t,e,s){for(const r in e){const i=e[r],a=s[r];if(Sn(i))t.addValue(r,i);else if(Sn(a))t.addValue(r,xu(i,{owner:t}));else if(a!==i)if(t.hasValue(r)){const l=t.getValue(r);l.liveStyle===!0?l.jump(i):l.hasAnimated||l.set(i)}else{const l=t.getStaticValue(r);t.addValue(r,xu(l!==void 0?l:i,{owner:t}))}}for(const r in s)e[r]===void 0&&t.removeValue(r);return e}const Yx={current:null},nN={current:!1},ZU=typeof window<"u";function eO(){if(nN.current=!0,!!ZU)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Yx.current=t.matches;t.addEventListener("change",e),e()}else Yx.current=!1}const h3=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Qx={};function tO(t){Qx=t}function eH(){return Qx}class tH{scrapeMotionValuesFromProps(e,s,r){return{}}constructor({parent:e,props:s,presenceContext:r,reducedMotionConfig:i,skipAnimations:a,blockInitialAnimation:l,visualState:d},u={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Wj,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const b=Qn.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,Gt.render(this.render,!1,!0))};const{latestValues:m,renderState:p}=d;this.latestValues=m,this.baseTarget={...m},this.initialValues=s.initial?{...m}:{},this.renderState=p,this.parent=e,this.props=s,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=a,this.options=u,this.blockInitialAnimation=!!l,this.isControllingVariants=wb(s),this.isVariantNode=Z_(s),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:x,...g}=this.scrapeMotionValuesFromProps(s,{},this);for(const b in g){const v=g[b];m[b]!==void 0&&Sn(v)&&v.set(m[b])}}mount(e){if(this.hasBeenMounted)for(const s in this.initialValues)this.values.get(s)?.jump(this.initialValues[s]),this.latestValues[s]=this.initialValues[s];this.current=e,JU.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,r)=>this.bindToMotionValue(r,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(nN.current||eO(),this.shouldReduceMotion=Yx.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),wl(this.notifyUpdate),wl(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const s=this.features[e];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,s){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),s.accelerate&&P_.has(e)&&this.current instanceof HTMLElement){const{factory:l,keyframes:d,times:u,ease:m,duration:p}=s.accelerate,x=new R_({element:this.current,name:e,keyframes:d,times:u,ease:m,duration:Or(p)}),g=l(x);this.valueSubscriptions.set(e,()=>{g(),x.cancel()});return}const r=Ru.has(e);r&&this.onBindTransform&&this.onBindTransform();const i=s.on("change",l=>{this.latestValues[e]=l,this.props.onUpdate&&Gt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,s)),this.valueSubscriptions.set(e,()=>{i(),a&&a(),s.owner&&s.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Qx){const s=Qx[e];if(!s)continue;const{isEnabled:r,Feature:i}=s;if(!this.features[e]&&i&&r(this.props)&&(this.features[e]=new i(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Zs()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,s){this.latestValues[e]=s}update(e,s){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=s;for(let r=0;r<h3.length;r++){const i=h3[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const a="on"+i,l=e[a];l&&(this.propEventSubscriptions[i]=this.on(i,l))}this.prevMotionValues=XU(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const s=this.getClosestVariantNode();if(s)return s.variantChildren&&s.variantChildren.add(e),()=>s.variantChildren.delete(e)}addValue(e,s){const r=this.values.get(e);s!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,s),this.values.set(e,s),this.latestValues[e]=s.get())}removeValue(e){this.values.delete(e);const s=this.valueSubscriptions.get(e);s&&(s(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,s){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&s!==void 0&&(r=xu(s===null?void 0:s,{owner:this}),this.addValue(e,r)),r}readValue(e,s){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(ZM(r)||t_(r))?r=parseFloat(r):!QU(r)&&Ti.test(s)&&(r=W_(e,s)),this.setBaseTarget(e,Sn(r)?r.get():r)),Sn(r)?r.get():r}setBaseTarget(e,s){this.baseTarget[e]=s}getBaseTarget(e){const{initial:s}=this.props;let r;if(typeof s=="string"||typeof s=="object"){const a=Yj(this.props,s,this.presenceContext?.custom);a&&(r=a[e])}if(s&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Sn(i)?i:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,s){return this.events[e]||(this.events[e]=new Lj),this.events[e].add(s)}notify(e,...s){this.events[e]&&this.events[e].notify(...s)}scheduleRenderMicrotask(){Xj.render(this.render)}}class sO extends tH{constructor(){super(...arguments),this.KeyframeResolver=MU}sortInstanceNodePosition(e,s){return e.compareDocumentPosition(s)&2?1:-1}getBaseTargetFromProps(e,s){const r=e.style;return r?r[s]:void 0}removeValueFromRenderState(e,{vars:s,style:r}){delete s[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Sn(e)&&(this.childSubscription=e.on("change",s=>{this.current&&(this.current.textContent=`${s}`)}))}}class Ol{constructor(e){this.isMounted=!1,this.node=e}update(){}}function nO({top:t,left:e,right:s,bottom:r}){return{x:{min:e,max:s},y:{min:t,max:r}}}function sH({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function nH(t,e){if(!e)return t;const s=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:s.y,left:s.x,bottom:r.y,right:r.x}}function uv(t){return t===void 0||t===1}function e1({scale:t,scaleX:e,scaleY:s}){return!uv(t)||!uv(e)||!uv(s)}function bc(t){return e1(t)||rO(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function rO(t){return m3(t.x)||m3(t.y)}function m3(t){return t&&t!=="0%"}function Jx(t,e,s){const r=t-s,i=e*r;return s+i}function p3(t,e,s,r,i){return i!==void 0&&(t=Jx(t,i,r)),Jx(t,s,r)+e}function t1(t,e=0,s=1,r,i){t.min=p3(t.min,e,s,r,i),t.max=p3(t.max,e,s,r,i)}function iO(t,{x:e,y:s}){t1(t.x,e.translate,e.scale,e.originPoint),t1(t.y,s.translate,s.scale,s.originPoint)}const f3=.999999999999,x3=1.0000000000001;function rH(t,e,s,r=!1){const i=s.length;if(!i)return;e.x=e.y=1;let a,l;for(let d=0;d<i;d++){a=s[d],l=a.projectionDelta;const{visualElement:u}=a.options;u&&u.props.style&&u.props.style.display==="contents"||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(ea(t.x,-a.scroll.offset.x),ea(t.y,-a.scroll.offset.y)),l&&(e.x*=l.x.scale,e.y*=l.y.scale,iO(t,l)),r&&bc(a.latestValues)&&Nx(t,a.latestValues,a.layout?.layoutBox))}e.x<x3&&e.x>f3&&(e.x=1),e.y<x3&&e.y>f3&&(e.y=1)}function ea(t,e){t.min+=e,t.max+=e}function g3(t,e,s,r,i=.5){const a=ns(t.min,t.max,i);t1(t,e,s,a,r)}function b3(t,e){return typeof t=="string"?parseFloat(t)/100*(e.max-e.min):t}function Nx(t,e,s){const r=s??t;g3(t.x,b3(e.x,r.x),e.scaleX,e.scale,e.originX),g3(t.y,b3(e.y,r.y),e.scaleY,e.scale,e.originY)}function aO(t,e){return nO(nH(t.getBoundingClientRect(),e))}function iH(t,e,s){const r=aO(t,s),{scroll:i}=e;return i&&(ea(r.x,i.offset.x),ea(r.y,i.offset.y)),r}const aH={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},oH=Ou.length;function lH(t,e,s){let r="",i=!0;for(let a=0;a<oH;
vendor: 4,224 bytes, line 9
9a++){const l=Ou[a],d=t[l];if(d===void 0)continue;let u=!0;if(typeof d=="number")u=d===(l.startsWith("scale")?1:0);else{const m=parseFloat(d);u=l.startsWith("scale")?m===1:m===0}if(!u||s){const m=K_(d,Jj[l]);if(!u){i=!1;const p=aH[l]||l;r+=`${p}(${m}) `}s&&(e[l]=m)}}return r=r.trim(),s?r=s(e,i?"":r):i&&(r="none"),r}function rN(t,e,s){const{style:r,vars:i,transformOrigin:a}=t;let l=!1,d=!1;for(const u in e){const m=e[u];if(Ru.has(u)){l=!0;continue}else if(x_(u)){i[u]=m;continue}else{const p=K_(m,Jj[u]);u.startsWith("origin")?(d=!0,a[u]=p):r[u]=p}}if(e.transform||(l||s?r.transform=lH(e,t.transform,s):r.transform&&(r.transform="none")),d){const{originX:u="50%",originY:m="50%",originZ:p=0}=a;r.transformOrigin=`${u} ${m} ${p}`}}function oO(t,{style:e,vars:s},r,i){const a=t.style;let l;for(l in e)a[l]=e[l];i?.applyProjectionStyles(a,r);for(l in s)a.setProperty(l,s[l])}function y3(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Mh={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Ge.test(t))t=parseFloat(t);else return t;const s=y3(t,e.target.x),r=y3(t,e.target.y);return`${s}% ${r}%`}},cH={correct:(t,{treeScale:e,projectionDelta:s})=>{const r=t,i=Ti.parse(t);if(i.length>5)return r;const a=Ti.createTransformer(t),l=typeof i[0]!="number"?1:0,d=s.x.scale*e.x,u=s.y.scale*e.y;i[0+l]/=d,i[1+l]/=u;const m=ns(d,u,.5);return typeof i[2+l]=="number"&&(i[2+l]/=m),typeof i[3+l]=="number"&&(i[3+l]/=m),a(i)}},s1={borderRadius:{...Mh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Mh,borderTopRightRadius:Mh,borderBottomLeftRadius:Mh,borderBottomRightRadius:Mh,boxShadow:cH};function lO(t,{layout:e,layoutId:s}){return Ru.has(t)||t.startsWith("origin")||(e||s!==void 0)&&(!!s1[t]||t==="opacity")}function iN(t,e,s){const r=t.style,i=e?.style,a={};if(!r)return a;for(const l in r)(Sn(r[l])||i&&Sn(i[l])||lO(l,t)||s?.getValue(l)?.liveStyle!==void 0)&&(a[l]=r[l]);return a}function dH(t){return window.getComputedStyle(t)}class uH extends sO{constructor(){super(...arguments),this.type="html",this.renderInstance=oO}readValueFromInstance(e,s){if(Ru.has(s))return this.projection?.isProjecting?Uw(s):OF(e,s);{const r=dH(e),i=(x_(s)?r.getPropertyValue(s):r[s])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:s}){return aO(e,s)}build(e,s,r){rN(e,s,r.transformTemplate)}scrapeMotionValuesFromProps(e,s,r){return iN(e,s,r)}}const hH={offset:"stroke-dashoffset",array:"stroke-dasharray"},mH={offset:"strokeDashoffset",array:"strokeDasharray"};function pH(t,e,s=1,r=0,i=!0){t.pathLength=1;const a=i?hH:mH;t[a.offset]=`${-r}`,t[a.array]=`${e} ${s}`}const fH=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function cO(t,{attrX:e,attrY:s,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:l=0,...d},u,m,p){if(rN(t,d,m),u){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:x,style:g}=t;x.transform&&(g.transform=x.transform,delete x.transform),(g.transform||x.transformOrigin)&&(g.transformOrigin=x.transformOrigin??"50% 50%",delete x.transformOrigin),g.transform&&(g.transformBox=p?.transformBox??"fill-box",delete x.transformBox);for(const b of fH)x[b]!==void 0&&(g[b]=x[b],delete x[b]);e!==void 0&&(x.x=e),s!==void 0&&(x.y=s),r!==void 0&&(x.scale=r),i!==void 0&&pH(x,i,a,l,!1)}const dO=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),uO=t=>typeof t=="string"&&t.toLowerCase()==="svg";function xH(t,e,s,r){oO(t,e,void 0,r);for(const i in e.attrs)t.setAttribute(dO.has(i)?i:Qj(i),e.attrs[i])}function hO(t,e,s){const r=iN(t,e,s);for(const i in t)if(Sn(t[i])||Sn(e[i])){const a=Ou.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[a]=t[i]}return r}class gH extends sO{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Zs}getBaseTargetFromProps(e,s){return e[s]}
vendor: 30,646 bytes, line 9
9readValueFromInstance(e,s){if(Ru.has(s)){const r=q_(s);return r&&r.default||0}return s=dO.has(s)?s:Qj(s),e.getAttribute(s)}scrapeMotionValuesFromProps(e,s,r){return hO(e,s,r)}build(e,s,r){cO(e,s,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,s,r,i){xH(e,s,r,i)}mount(e){this.isSVGTag=uO(e.tagName),super.mount(e)}}const bH=sN.length;function mO(t){if(!t)return;if(!t.isControllingVariants){const s=t.parent?mO(t.parent)||{}:{};return t.props.initial!==void 0&&(s.initial=t.props.initial),s}const e={};for(let s=0;s<bH;s++){const r=sN[s],i=t.props[r];(Nm(i)||i===!1)&&(e[r]=i)}return e}function pO(t,e){if(!Array.isArray(e))return!1;const s=e.length;if(s!==t.length)return!1;for(let r=0;r<s;r++)if(e[r]!==t[r])return!1;return!0}const yH=[...tN].reverse(),vH=tN.length;function wH(t){return e=>Promise.all(e.map(({animation:s,options:r})=>yU(t,s,r)))}function jH(t){let e=wH(t),s=v3(),r=!0,i=!1;const a=m=>(p,x)=>{const g=_c(t,x,m==="exit"?t.presenceContext?.custom:void 0);if(g){const{transition:b,transitionEnd:v,...k}=g;p={...p,...k,...v}}return p};function l(m){e=m(t)}function d(m){const{props:p}=t,x=mO(t.parent)||{},g=[],b=new Set;let v={},k=1/0;for(let S=0;S<vH;S++){const A=yH[S],E=s[A],_=p[A]!==void 0?p[A]:x[A],T=Nm(_),$=A===m?E.isActive:null;$===!1&&(k=S);let L=_===x[A]&&_!==p[A]&&T;if(L&&(r||i)&&t.manuallyAnimateOnMount&&(L=!1),E.protectedKeys={...v},!E.isActive&&$===null||!_&&!E.prevProp||vb(_)||typeof _=="boolean")continue;if(A==="exit"&&E.isActive&&$!==!0){E.prevResolvedValues&&(v={...v,...E.prevResolvedValues});continue}const M=NH(E.prevProp,_);let I=M||A===m&&E.isActive&&!L&&T||S>k&&T,z=!1;const ae=Array.isArray(_)?_:[_];let U=ae.reduce(a(A),{});$===!1&&(U={});const{prevResolvedValues:Y={}}=E,P={...Y,...U},ne=ie=>{I=!0,b.has(ie)&&(z=!0,b.delete(ie)),E.needsAnimating[ie]=!0;const he=t.getValue(ie);he&&(he.liveStyle=!1)};for(const ie in P){const he=U[ie],se=Y[ie];if(v.hasOwnProperty(ie))continue;let B=!1;Yw(he)&&Yw(se)?B=!pO(he,se):B=he!==se,B?he!=null?ne(ie):b.add(ie):he!==void 0&&b.has(ie)?ne(ie):E.protectedKeys[ie]=!0}E.prevProp=_,E.prevResolvedValues=U,E.isActive&&(v={...v,...U}),(r||i)&&t.blockInitialAnimation&&(I=!1);const q=L&&M;I&&(!q||z)&&g.push(...ae.map(ie=>{const he={type:A};if(typeof ie=="string"&&(r||i)&&!q&&t.manuallyAnimateOnMount&&t.parent){const{parent:se}=t,B=_c(se,ie);if(se.enteringChildren&&B){const{delayChildren:le}=B.transition||{};he.delay=I_(se.enteringChildren,t,le)}}return{animation:ie,options:he}}))}if(b.size){const S={};if(typeof p.initial!="boolean"){const A=_c(t,Array.isArray(p.initial)?p.initial[0]:p.initial);A&&A.transition&&(S.transition=A.transition)}b.forEach(A=>{const E=t.getBaseTarget(A),_=t.getValue(A);_&&(_.liveStyle=!0),S[A]=E??null}),g.push({animation:S})}let N=!!g.length;return r&&(p.initial===!1||p.initial===p.animate)&&!t.manuallyAnimateOnMount&&(N=!1),r=!1,i=!1,N?e(g):Promise.resolve()}function u(m,p){if(s[m].isActive===p)return Promise.resolve();t.variantChildren?.forEach(g=>g.animationState?.setActive(m,p)),s[m].isActive=p;const x=d(m);for(const g in s)s[g].protectedKeys={};return x}return{animateChanges:d,setActive:u,setAnimateFunction:l,getState:()=>s,reset:()=>{s=v3(),i=!0}}}function NH(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!pO(e,t):!1}function mc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function v3(){return{animate:mc(!0),whileInView:mc(),whileHover:mc(),whileTap:mc(),whileDrag:mc(),whileFocus:mc(),exit:mc()}}function n1(t,e){t.min=e.min,t.max=e.max}function bi(t,e){n1(t.x,e.x),n1(t.y,e.y)}function w3(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const fO=1e-4,kH=1-fO,SH=1+fO,xO=.01,CH=0-xO,TH=0+xO;function Jn(t){return t.max-t.min}function EH(t,e,s){return Math.abs(t-e)<=s}function j3(t,e,s,r=.5){t.origin=r,t.originPoint=ns(e.min,e.max,t.origin),t.scale=Jn(s)/Jn(e),t.translate=ns(s.min,s.max,t.origin)-t.originPoint,(t.scale>=kH&&t.scale<=SH||isNaN(t.scale))&&(t.scale=1),(t.translate>=CH&&t.translate<=TH||isNaN(t.translate))&&(t.translate=0)}function tm(t,e,s,r){j3(t.x,e.x,s.x,r?r.originX:void 0),j3(t.y,e.y,s.y,r?r.originY:void 0)}function N3(t,e,s,r=0){const i=r?ns(s.min,s.max,r):s.min;t.min=i+e.min,t.max=t.min+Jn(e)}function AH(t,e,s,r){N3(t.x,e.x,s.x,r?.x),N3(t.y,e.y,s.y,r?.y)}function k3(t,e,s,r=0){const i=r?ns(s.min,s.max,r):s.min;t.min=e.min-i,t.max=t.min+Jn(e)}function Xx(t,e,s,r){k3(t.x,e.x,s.x,r?.x),k3(t.y,e.y,s.y,r?.y)}function S3(t,e,s,r,i){return t-=e,t=Jx(t,1/s,r),i!==void 0&&(t=Jx(t,1/i,r)),t}function MH(t,e=0,s=1,r=.5,i,a=t,l=t){if(ia.test(e)&&(e=parseFloat(e),e=ns(l.min,l.max,e/100)-l.min),typeof e!="number")return;let d=ns(a.min,a.max,r);t===a&&(d-=e),t.min=S3(t.min,e,s,d,i),t.max=S3(t.max,e,s,d,i)}function C3(t,e,[s,r,i],a,l){MH(t,e[s],e[r],e[i],e.scale,a,l)}const _H=["x","scaleX","originX"],OH=["y","scaleY","originY"];function T3(t,e,s,r){C3(t.x,e,_H,s?s.x:void 0,r?r.x:void 0),C3(t.y,e,OH,s?s.y:void 0,r?r.y:void 0)}function E3(t){return t.translate===0&&t.scale===1}function gO(t){return E3(t.x)&&E3(t.y)}function A3(t,e){return t.min===e.min&&t.max===e.max}function RH(t,e){return A3(t.x,e.x)&&A3(t.y,e.y)}function M3(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function bO(t,e){return M3(t.x,e.x)&&M3(t.y,e.y)}function _3(t){return Jn(t.x)/Jn(t.y)}function O3(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function Qi(t){return[t("x"),t("y")]}function DH(t,e,s){let r="";const i=t.x.translate/e.x,a=t.y.translate/e.y,l=s?.z||0;if((i||a||l)&&(r=`translate3d(${i}px, ${a}px, ${l}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),s){const{transformPerspective:m,rotate:p,rotateX:x,rotateY:g,skewX:b,skewY:v}=s;m&&(r=`perspective(${m}px) ${r}`),p&&(r+=`rotate(${p}deg) `),x&&(r+=`rotateX(${x}deg) `),g&&(r+=`rotateY(${g}deg) `),b&&(r+=`skewX(${b}deg) `),v&&(r+=`skewY(${v}deg) `)}const d=t.x.scale*e.x,u=t.y.scale*e.y;return(d!==1||u!==1)&&(r+=`scale(${d}, ${u})`),r||"none"}const yO=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],PH=yO.length,R3=t=>typeof t=="string"?parseFloat(t):t,D3=t=>typeof t=="number"||Ge.test(t);function IH(t,e,s,r,i,a){i?(t.opacity=ns(0,s.opacity??1,LH(r)),t.opacityExit=ns(e.opacity??1,0,$H(r))):a&&(t.opacity=ns(e.opacity??1,s.opacity??1,r));for(let l=0;l<PH;l++){const d=yO[l];let u=P3(e,d),m=P3(s,d);if(u===void 0&&m===void 0)continue;u||(u=0),m||(m=0),u===0||m===0||D3(u)===D3(m)?(t[d]=Math.max(ns(R3(u),R3(m),r),0),(ia.test(m)||ia.test(u))&&(t[d]+="%")):t[d]=m}(e.rotate||s.rotate)&&(t.rotate=ns(e.rotate||0,s.rotate||0,r))}function P3(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const LH=vO(0,.5,d_),$H=vO(.5,.95,li);function vO(t,e,s){return r=>r<t?0:r>e?1:s(wm(t,e,r))}function BH(t,e,s){const r=Sn(t)?t:xu(t);return r.start(Kj("",r,e,s)),r.animation}function km(t,e,s,r={passive:!0}){return t.addEventListener(e,s,r),()=>t.removeEventListener(e,s)}const zH=(t,e)=>t.depth-e.depth;class VH{constructor(){this.children=[],this.isDirty=!1}add(e){Pj(this.children,e),this.isDirty=!0}remove(e){Hx(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(zH),this.isDirty=!1,this.children.forEach(e)}}function FH(t,e){const s=Qn.now(),r=({timestamp:i})=>{const a=i-s;a>=e&&(wl(r),t(a-e))};return Gt.setup(r,!0),()=>wl(r)}function kx(t){return Sn(t)?t.get():t}class UH{constructor(){this.members=[]}add(e){Pj(this.members,e);for(let s=this.members.length-1;s>=0;s--){const r=this.members[s];if(r===e||r===this.lead||r===this.prevLead)continue;const i=r.instance;(!i||i.isConnected===!1)&&!r.snapshot&&(Hx(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(Hx(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const s=this.members[this.members.length-1];s&&this.promote(s)}}relegate(e){for(let s=this.members.indexOf(e)-1;s>=0;s--){const r=this.members[s];if(r.isPresent!==!1&&r.instance?.isConnected!==!1)return this.promote(r),!0}return!1}promote(e,s){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:i}=r.options,{layoutDependency:a}=e.options;(i===void 0||i!==a)&&(e.resumeFrom=r,s&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const Sx={hasAnimatedSinceResize:!0,hasEverUpdated:!1},hv=["","X","Y","Z"],HH=1e3;let qH=0;function mv(t,e,s,r){const{latestValues:i}=e;i[t]&&(s[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function wO(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const s=V_(e);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:i,layoutId:a}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",Gt,!(i||a))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&wO(r)}function jO({attachResizeListener:t,defaultParent:e,measureScroll:s,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(l={},d=e?.()){this.id=qH++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(KH),this.nodes.forEach(eq),this.nodes.forEach(tq),this.nodes.forEach(YH)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new VH)}addEventListener(l,d){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new Lj),this.eventHandlers.get(l).add(d)}notifyListeners(l,...d){const u=this.eventHandlers.get(l);u&&u.notify(...d)}hasListeners(l){return this.eventHandlers.has(l)}mount(l){if(this.instance)return;this.isSVG=eN(l)&&!KU(l),this.instance=l;const{layoutId:d,layout:u,visualElement:m}=this.options;if(m&&!m.current&&m.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(u||d)&&(this.isLayoutDirty=!0),t){let p,x=0;const g=()=>this.root.updateBlockedByResize=!1;Gt.read(()=>{x=window.innerWidth}),t(l,()=>{const b=window.innerWidth;b!==x&&(x=b,this.root.updateBlockedByResize=!0,p&&p(),p=FH(g,250),Sx.hasAnimatedSinceResize&&(Sx.hasAnimatedSinceResize=!1,this.nodes.forEach($3)))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&m&&(d||u)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:x,hasRelativeLayoutChanged:g,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||m.getDefaultTransition()||aq,{onLayoutAnimationStart:k,onLayoutAnimationComplete:N}=m.getProps(),S=!this.targetLayout||!bO(this.targetLayout,b),A=!x&&g;if(this.options.layoutRoot||this.resumeFrom||A||x&&(S||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const E={...Gj(v,"layout"),onPlay:k,onComplete:N};(m.shouldReduceMotion||this.options.layoutRoot)&&(E.delay=0,E.type=!1),this.startAnimation(E),this.setAnimationOrigin(p,A)}else x||$3(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),wl(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(sq),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&wO(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const x=this.path[p];x.shouldResetTransform=!0,(typeof x.latestValues.x=="string"||typeof x.latestValues.y=="string")&&(x.isLayoutDirty=!0),x.updateScroll("snapshot"),x.options.layoutRoot&&x.willUpdate(!1)}const{layoutId:d,layout:u}=this.options;if(d===void 0&&!u)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const u=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),u&&this.nodes.forEach(JH),this.nodes.forEach(I3);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(L3);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(XH),this.nodes.forEach(ZH),this.nodes.forEach(WH),this.nodes.forEach(GH)):this.nodes.forEach(L3),this.clearAllSnapshots();const d=Qn.now();wn.delta=la(0,1e3/60,d-wn.timestamp),wn.timestamp=d,wn.isProcessing=!0,rv.update.process(wn),rv.preRender.process(wn),rv.render.process(wn),wn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Xj.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(QH),this.sharedNodes.forEach(nq)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Gt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Gt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Jn(this.snapshot.measuredBox.x)&&!Jn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u<this.path.length;u++)this.path[u].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Zs()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(d=!1),d&&this.instance){const u=r(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:u,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!i)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!gO(this.projectionDelta),u=this.getTransformTemplate(),m=u?u(this.latestValues,""):void 0,p=m!==this.prevTransformTemplateValue;l&&this.instance&&(d||bc(this.latestValues)||p)&&(i(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const d=this.measurePageBox();let u=this.removeElementScroll(d);return l&&(u=this.removeTransform(u)),oq(u),{animationId:this.root.animationId,measuredBox:d,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:l}=this.options;if(!l)return Zs();const d=l.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(lq))){const{scroll:m}=this.root;m&&(ea(d.x,m.offset.x),ea(d.y,m.offset.y))}return d}removeElementScroll(l){const d=Zs();if(bi(d,l),this.scroll?.wasRoot)return d;for(let u=0;u<this.path.length;u++){const m=this.path[u],{scroll:p,options:x}=m;m!==this.root&&p&&x.layoutScroll&&(p.wasRoot&&bi(d,l),ea(d.x,p.offset.x),ea(d.y,p.offset.y))}return d}applyTransform(l,d=!1,u){const m=u||Zs();bi(m,l);for(let p=0;p<this.path.length;p++){const x=this.path[p];!d&&x.options.layoutScroll&&x.scroll&&x!==x.root&&(ea(m.x,-x.scroll.offset.x),ea(m.y,-x.scroll.offset.y)),bc(x.latestValues)&&Nx(m,x.latestValues,x.layout?.layoutBox)}return bc(this.latestValues)&&Nx(m,this.latestValues,this.layout?.layoutBox),m}removeTransform(l){const d=Zs();bi(d,l);for(let u=0;u<this.path.length;u++){const m=this.path[u];if(!bc(m.latestValues))continue;let p;m.instance&&(e1(m.latestValues)&&m.updateSnapshot(),p=Zs(),bi(p,m.measurePageBox())),T3(d,m.latestValues,m.snapshot?.layoutBox,p)}return bc(this.latestValues)&&T3(d,this.latestValues),d}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==wn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){const d=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=d.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=d.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=d.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==d;if(!(l||u&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:x}=this.options;if(!this.layout||!(p||x))return;this.resolvedRelativeTargetAt=wn.timestamp;const g=this.getClosestProjectingParent();g&&this.linkedParentVersion!==g.layoutVersion&&!g.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&g&&g.layout?this.createRelativeTarget(g,this.layout.layoutBox,g.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Zs(),this.targetWithTransforms=Zs()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),AH(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):bi(this.target,this.layout.layoutBox),iO(this.target,this.targetDelta)):bi(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?this.createRelativeTarget(g,this.target,g.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||e1(this.parent.latestValues)||rO(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(l,d,u){this.relativeParent=l,this.linkedParentVersion=l.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Zs(),this.relativeTargetOrigin=Zs(),Xx(this.relativeTargetOrigin,d,u,this.options.layoutAnchor||void 0),bi(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const l=this.getLead(),d=!!this.resumingFrom||this!==l;let u=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(u=!1),d&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===wn.timestamp&&(u=!1),u)return;const{layout:m,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(m||p))return;bi(this.layoutCorrected,this.layout.layoutBox);const x=this.treeScale.x,g=this.treeScale.y;rH(this.layoutCorrected,this.treeScale,this.path,d),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=Zs());const{target:b}=l;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(w3(this.prevProjectionDelta.x,this.projectionDelta.x),w3(this.prevProjectionDelta.y,this.projectionDelta.y)),tm(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==x||this.treeScale.y!==g||!O3(this.projectionDelta.x,this.prevProjectionDelta.x)||!O3(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){if(this.options.visualElement?.scheduleRender(),l){const d=this.getStack();d&&d.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=su(),this.projectionDelta=su(),this.projectionDeltaWithTransform=su()}setAnimationOrigin(l,d=!1){const u=this.snapshot,m=u?u.latestValues:{},p={...this.latestValues},x=su();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const g=Zs(),b=u?u.source:void 0,v=this.layout?this.layout.source:void 0,k=b!==v,N=this.getStack(),S=!N||N.members.length<=1,A=!!(k&&!S&&this.options.crossfade===!0&&!this.path.some(iq));this.animationProgress=0;let E;this.mixTargetDelta=_=>{const T=_/1e3;B3(x.x,l.x,T),B3(x.y,l.y,T),this.setTargetDelta(x),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Xx(g,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),rq(this.relativeTarget,this.relativeTargetOrigin,g,T),E&&RH(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Zs()),bi(E,this.relativeTarget)),k&&(this.animationValues=p,IH(p,m,this.latestValues,T,A,S)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(wl(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Gt.update(()=>{Sx.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=xu(0)),this.motionValue.jump(0,!1),this.currentAnimation=BH(this.motionValue,[0,1e3],{...l,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),l.onUpdate&&l.onUpdate(d)},onStop:()=>{},onComplete:()=>{l.onComplete&&l.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(HH),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:d,target:u,layout:m,latestValues:p}=l;if(!(!d||!u||!m)){if(this!==l&&this.layout&&m&&NO(this.options.animationType,this.layout.layoutBox,m.layoutBox)){u=this.target||Zs();const x=Jn(this.layout.layoutBox.x);u.x.min=l.target.x.min,u.x.max=u.x.min+x;const g=Jn(this.layout.layoutBox.y);u.y.min=l.target.y.min,u.y.max=u.y.min+g}bi(d,u),Nx(d,p),tm(this.projectionDeltaWithTransform,this.layoutCorrected,d,p)}}registerSharedNode(l,d){this.sharedNodes.has(l)||this.sharedNodes.set(l,new UH),this.sharedNodes.get(l).add(d);const m=d.options.initialPromotionConfig;d.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(d):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){const{layoutId:l}=this.options;return l?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:l}=this.options;return l?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:d,preserveFollowOpacity:u}={}){const m=this.getStack();m&&m.promote(this,u),l&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let d=!1;const{latestValues:u}=l;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(d=!0),!d)return;const m={};u.z&&mv("z",l,m,this.animationValues);for(let p=0;p<hv.length;p++)mv(`rotate${hv[p]}`,l,m,this.animationValues),mv(`skew${hv[p]}`,l,m,this.animationValues);l.render();for(const p in m)l.setStaticValue(p,m[p]),this.animationValues&&(this.animationValues[p]=m[p]);l.scheduleRender()}applyProjectionStyles(l,d){if(!this.instance||this.isSVG)return;if(!this.isVisible){l.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,l.visibility="",l.opacity="",l.pointerEvents=kx(d?.pointerEvents)||"",l.transform=u?u(this.latestValues,""):"none";return}const m=this.getLead();if(!this.projectionDelta||!this.layout||!m.target){this.options.layoutId&&(l.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,l.pointerEvents=kx(d?.pointerEvents)||""),this.hasProjected&&!bc(this.latestValues)&&(l.transform=u?u({},""):"none",this.hasProjected=!1);return}l.visibility="";const p=m.animationValues||m.latestValues;this.applyTransformsToTarget();let x=DH(this.projectionDeltaWithTransform,this.treeScale,p);u&&(x=u(p,x)),l.transform=x;const{x:g,y:b}=this.projectionDelta;l.transformOrigin=`${g.origin*100}% ${b.origin*100}% 0`,m.animationValues?l.opacity=m===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:l.opacity=m===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const v in s1){if(p[v]===void 0)continue;const{correct:k,applyTo:N,isCSSVariable:S}=s1[v],A=x==="none"?p[v]:k(p[v],m);if(N){const E=N.length;for(let _=0;_<E;_++)l[N[_]]=A}else S?this.options.visualElement.renderState.vars[v]=A:l[v]=A}this.options.layoutId&&(l.pointerEvents=m===this?kx(d?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>l.currentAnimation?.stop()),this.root.nodes.forEach(I3),this.root.sharedNodes.clear()}}}function WH(t){t.updateLayout()}function GH(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=t.layout,{animationType:i}=t.options,a=e.source!==t.layout.source;if(i==="size")Qi(p=>{const x=a?e.measuredBox[p]:e.layoutBox[p],g=Jn(x);x.min=s[p].min,x.max=x.min+g});else if(i==="x"||i==="y"){const p=i==="x"?"y":"x";n1(a?e.measuredBox[p]:e.layoutBox[p],s[p])}else NO(i,e.layoutBox,s)&&Qi(p=>{const x=a?e.measuredBox[p]:e.layoutBox[p],g=Jn(s[p]);x.max=x.min+g,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+g)});const l=su();tm(l,s,e.layoutBox);const d=su();a?tm(d,t.applyTransform(r,!0),e.measuredBox):tm(d,s,e.layoutBox);const u=!gO(l);let m=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:x,layout:g}=p;if(x&&g){const b=t.options.layoutAnchor||void 0,v=Zs();Xx(v,e.layoutBox,x.layoutBox,b);const k=Zs();Xx(k,s,g.layoutBox,b),bO(v,k)||(m=!0),p.options.layoutRoot&&(t.relativeTarget=k,t.relativeTargetOrigin=v,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:e,delta:d,layoutDelta:l,hasLayoutChanged:u,hasRelativeLayoutChanged:m})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function KH(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function YH(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function QH(t){t.clearSnapshot()}function I3(t){t.clearMeasurements()}function JH(t){t.isLayoutDirty=!0,t.updateLayout()}function L3(t){t.isLayoutDirty=!1}function XH(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function ZH(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function $3(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function eq(t){t.resolveTargetDelta()}function tq(t){t.calcProjection()}
vendor: 9,137 bytes, lines 9-17
9function sq(t){t.resetSkewAndRotation()}function nq(t){t.removeLeadSnapshot()}function B3(t,e,s){t.translate=ns(e.translate,0,s),t.scale=ns(e.scale,1,s),t.origin=e.origin,t.originPoint=e.originPoint}function z3(t,e,s,r){t.min=ns(e.min,s.min,r),t.max=ns(e.max,s.max,r)}function rq(t,e,s,r){z3(t.x,e.x,s.x,r),z3(t.y,e.y,s.y,r)}function iq(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const aq={duration:.45,ease:[.4,0,.1,1]},V3=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),F3=V3("applewebkit/")&&!V3("chrome/")?Math.round:li;function U3(t){t.min=F3(t.min),t.max=F3(t.max)}function oq(t){U3(t.x),U3(t.y)}function NO(t,e,s){return t==="position"||t==="preserve-aspect"&&!EH(_3(e),_3(s),.2)}function lq(t){return t!==t.root&&t.scroll?.wasRoot}const cq=jO({attachResizeListener:(t,e)=>km(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),pv={current:void 0},kO=jO({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!pv.current){const t=new cq({});t.mount(window),t.setOptions({layoutScroll:!0}),pv.current=t}return pv.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),aN=j.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function H3(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function dq(...t){return e=>{let s=!1;const r=t.map(i=>{const a=H3(i,e);return!s&&typeof a=="function"&&(s=!0),a});if(s)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():H3(t[i],null)}}}}function uq(...t){return j.useCallback(dq(...t),t)}class hq extends j.Component{getSnapshotBeforeUpdate(e){const s=this.props.childRef.current;if(bx(s)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=s.offsetParent,i=bx(r)&&r.offsetWidth||0,a=bx(r)&&r.offsetHeight||0,l=getComputedStyle(s),d=this.props.sizeRef.current;d.height=parseFloat(l.height),d.width=parseFloat(l.width),d.top=s.offsetTop,d.left=s.offsetLeft,d.right=i-d.width-d.left,d.bottom=a-d.height-d.top}return null}componentDidUpdate(){}render(){return this.props.children}}function mq({children:t,isPresent:e,anchorX:s,anchorY:r,root:i,pop:a}){const l=j.useId(),d=j.useRef(null),u=j.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:m}=j.useContext(aN),p=t.props?.ref??t?.ref,x=uq(d,p);return j.useInsertionEffect(()=>{const{width:g,height:b,top:v,left:k,right:N,bottom:S}=u.current;if(e||a===!1||!d.current||!g||!b)return;const A=s==="left"?`left: ${k}`:`right: ${N}`,E=r==="bottom"?`bottom: ${S}`:`top: ${v}`;d.current.dataset.motionPopId=l;const _=document.createElement("style");m&&(_.nonce=m);const T=i??document.head;return T.appendChild(_),_.sheet&&_.sheet.insertRule(`
10          [data-motion-pop-id="${l}"] {
11            position: absolute !important;
12            width: ${g}px !important;
13            height: ${b}px !important;
14            ${A}px !important;
15            ${E}px !important;
16          }
17        `),()=>{d.current?.removeAttribute("data-motion-pop-id"),T.contains(_)&&T.removeChild(_)}},[e]),n.jsx(hq,{isPresent:e,childRef:d,sizeRef:u,pop:a,children:a===!1?t:j.cloneElement(t,{ref:x})})}const pq=({children:t,initial:e,isPresent:s,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:l,anchorX:d,anchorY:u,root:m})=>{const p=Dj(fq),x=j.useId();let g=!0,b=j.useMemo(()=>(g=!1,{id:x,initial:e,isPresent:s,custom:i,onExitComplete:v=>{p.set(v,!0);for(const k of p.values())if(!k)return;r&&r()},register:v=>(p.set(v,!1),()=>p.delete(v))}),[s,p,r]);return a&&g&&(b={...b}),j.useMemo(()=>{p.forEach((v,k)=>p.set(k,!1))},[s]),j.useEffect(()=>{!s&&!p.size&&r&&r()},[s]),t=n.jsx(mq,{pop:l==="popLayout",isPresent:s,anchorX:d,anchorY:u,root:m,children:t}),n.jsx(bb.Provider,{value:b,children:t})};function fq(){return new Map}function SO(t=!0){const e=j.useContext(bb);if(e===null)return[!0,null];const{isPresent:s,onExitComplete:r,register:i}=e,a=j.useId();j.useEffect(()=>{if(t)return i(a)},[t]);const l=j.useCallback(()=>t&&r&&r(a),[a,r,t]);return!s&&r?[!1,l]:[!0]}const $f=t=>t.key||"";function q3(t){const e=[];return j.Children.forEach(t,s=>{j.isValidElement(s)&&e.push(s)}),e}const Rr=({children:t,custom:e,initial:s=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a="sync",propagate:l=!1,anchorX:d="left",anchorY:u="top",root:m})=>{const[p,x]=SO(l),g=j.useMemo(()=>q3(t),[t]),b=l&&!p?[]:g.map($f),v=j.useRef(!0),k=j.useRef(g),N=Dj(()=>new Map),S=j.useRef(new Set),[A,E]=j.useState(g),[_,T]=j.useState(g);XM(()=>{v.current=!1,k.current=g;for(let M=0;M<_.length;M++){const I=$f(_[M]);b.includes(I)?(N.delete(I),S.current.delete(I)):N.get(I)!==!0&&N.set(I,!1)}},[_,b.length,b.join("-")]);const $=[];if(g!==A){let M=[...g];for(let I=0;I<_.length;I++){const z=_[I],ae=$f(z);b.includes(ae)||(M.splice(I,0,z),$.push(z))}return a==="wait"&&$.length&&(M=$),T(q3(M)),E(g),null}const{forceRender:L}=j.useContext(Rj);return n.jsx(n.Fragment,{children:_.map(M=>{const I=$f(M),z=l&&!p?!1:g===_||b.includes(I),ae=()=>{if(S.current.has(I))return;if(N.has(I))S.current.add(I),N.set(I,!0);else return;let U=!0;N.forEach(Y=>{Y||(U=!1)}),U&&(L?.(),T(k.current),l&&x?.(),r&&r())};return n.jsx(pq,{isPresent:z,initial:!v.current||s?void 0:!1,custom:e,presenceAffectsLayout:i,mode:a,root:m,onExitComplete:z?void 0:ae,anchorX:d,anchorY:u,children:M},I)})})},CO=j.createContext({strict:!1}),W3={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let G3=!1;function xq(){if(G3)return;const t={};for(const e in W3)t[e]={isEnabled:s=>W3[e].some(r=>!!s[r])};tO(t),G3=!0}function TO(){return xq(),eH()}function gq(t){const e=TO();for(const s in t)e[s]={...e[s],...t[s]};tO(e)}const bq=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Zx(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||bq.has(t)}let EO=t=>!Zx(t);function yq(t){typeof t=="function"&&(EO=e=>e.startsWith("on")?!Zx(e):t(e))}try{yq(require("@emotion/is-prop-valid").default)}catch{}function vq(t,e,s){const r={};for(const i in t)i==="values"&&typeof t.values=="object"||Sn(t[i])||(EO(i)||s===!0&&Zx(i)||!e&&!Zx(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}const jb=j.createContext({});function wq(t,e){if(wb(t)){const{initial:s,animate:r}=t;return{initial:s===!1||Nm(s)?s:void 0,animate:Nm(r)?r:void 0}}return t.inherit!==!1?e:{}}function jq(t){const{initial:e,animate:s}=wq(t,j.useContext(jb));return j.useMemo(()=>({initial:e,animate:s}),[K3(e),K3(s)])}function K3(t){return Array.isArray(t)?t.join(" "):t}const oN=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function AO(t,e,s){for(const r in e)!Sn(e[r])&&!lO(r,s)&&(t[r]=e[r])}function Nq({transformTemplate:t},e){return j.useMemo(()=>{const s=oN();return rN(s,e,t),Object.assign({},s.vars,s.style)},[e])}function kq(t,e){const s=t.style||{},r={};return AO(r,s,t),Object.assign(r,Nq(t,e)),r}function Sq(t,e){const s={},r=kq(t,e);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=r,s}const MO=()=>({...oN(),attrs:{}});function Cq(t,e,s,r){const i=j.useMemo(()=>{const a=MO();return cO(a,e,uO(r),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};AO(a,t.style,t),i.style={...a,...i.style}}return i}const Tq=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function lN(t){return typeof t!="string"||t.includes("-")?!1:!!(Tq.indexOf(t)>-1||/[A-Z]/u.test(t))}function Eq(t,e,s,{latestValues:r},i,a=!1,l){const u=(l??lN(t)?Cq:Sq)(e,r,i,t),m=vq(e,typeof t=="string",a),p=t!==j.Fragment?{...m,...u,ref:s}:{},{children:x}=e,g=j.useMemo(()=>Sn(x)?x.get():x,[x]);return j.createElement(t,{...p,children:g})}function Aq({scrapeMotionValuesFromProps:t,createRenderState:e},s,r,i){return{latestValues:Mq(s,r,i,t),renderState:e()}}function Mq(t,e,s,r){const i={}
vendor: 22,129 bytes, line 17
17,a=r(t,{});for(const g in a)i[g]=kx(a[g]);let{initial:l,animate:d}=t;const u=wb(t),m=Z_(t);e&&m&&!u&&t.inherit!==!1&&(l===void 0&&(l=e.initial),d===void 0&&(d=e.animate));let p=s?s.initial===!1:!1;p=p||l===!1;const x=p?d:l;if(x&&typeof x!="boolean"&&!vb(x)){const g=Array.isArray(x)?x:[x];for(let b=0;b<g.length;b++){const v=Yj(t,g[b]);if(v){const{transitionEnd:k,transition:N,...S}=v;for(const A in S){let E=S[A];if(Array.isArray(E)){const _=p?E.length-1:0;E=E[_]}E!==null&&(i[A]=E)}for(const A in k)i[A]=k[A]}}}return i}const _O=t=>(e,s)=>{const r=j.useContext(jb),i=j.useContext(bb),a=()=>Aq(t,e,r,i);return s?a():Dj(a)},_q=_O({scrapeMotionValuesFromProps:iN,createRenderState:oN}),Oq=_O({scrapeMotionValuesFromProps:hO,createRenderState:MO}),Rq=Symbol.for("motionComponentSymbol");function Dq(t,e,s){const r=j.useRef(s);j.useInsertionEffect(()=>{r.current=s});const i=j.useRef(null);return j.useCallback(a=>{a&&t.onMount?.(a);const l=r.current;if(typeof l=="function")if(a){const d=l(a);typeof d=="function"&&(i.current=d)}else i.current?(i.current(),i.current=null):l(a);else l&&(l.current=a);e&&(a?e.mount(a):e.unmount())},[e])}const OO=j.createContext({});function qd(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function Pq(t,e,s,r,i,a){const{visualElement:l}=j.useContext(jb),d=j.useContext(CO),u=j.useContext(bb),m=j.useContext(aN),p=m.reducedMotion,x=m.skipAnimations,g=j.useRef(null),b=j.useRef(!1);r=r||d.renderer,!g.current&&r&&(g.current=r(t,{visualState:e,parent:l,props:s,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:p,skipAnimations:x,isSVG:a}),b.current&&g.current&&(g.current.manuallyAnimateOnMount=!0));const v=g.current,k=j.useContext(OO);v&&!v.projection&&i&&(v.type==="html"||v.type==="svg")&&Iq(g.current,s,i,k);const N=j.useRef(!1);j.useInsertionEffect(()=>{v&&N.current&&v.update(s,u)});const S=s[z_],A=j.useRef(!!S&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(S)&&window.MotionHasOptimisedAnimation?.(S));return XM(()=>{b.current=!0,v&&(N.current=!0,window.MotionIsMounted=!0,v.updateFeatures(),v.scheduleRenderMicrotask(),A.current&&v.animationState&&v.animationState.animateChanges())}),j.useEffect(()=>{v&&(!A.current&&v.animationState&&v.animationState.animateChanges(),A.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(S)}),A.current=!1),v.enteringChildren=void 0)}),v}function Iq(t,e,s,r){const{layoutId:i,layout:a,drag:l,dragConstraints:d,layoutScroll:u,layoutRoot:m,layoutAnchor:p,layoutCrossfade:x}=e;t.projection=new s(t.latestValues,e["data-framer-portal-id"]?void 0:RO(t.parent)),t.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!l||d&&qd(d),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,crossfade:x,layoutScroll:u,layoutRoot:m,layoutAnchor:p})}function RO(t){if(t)return t.options.allowProjection!==!1?t.projection:RO(t.parent)}function fv(t,{forwardMotionProps:e=!1,type:s}={},r,i){r&&gq(r);const a=s?s==="svg":lN(t),l=a?Oq:_q;function d(m,p){let x;const g={...j.useContext(aN),...m,layoutId:Lq(m)},{isStatic:b}=g,v=jq(m),k=l(m,b);if(!b&&typeof window<"u"){$q();const N=Bq(g);x=N.MeasureLayout,v.visualElement=Pq(t,k,g,i,N.ProjectionNode,a)}return n.jsxs(jb.Provider,{value:v,children:[x&&v.visualElement?n.jsx(x,{visualElement:v.visualElement,...g}):null,Eq(t,m,Dq(k,v.visualElement,p),k,b,e,a)]})}d.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const u=j.forwardRef(d);return u[Rq]=t,u}function Lq({layoutId:t}){const e=j.useContext(Rj).id;return e&&t!==void 0?e+"-"+t:t}function $q(t,e){j.useContext(CO).strict}function Bq(t){const e=TO(),{drag:s,layout:r}=e;if(!s&&!r)return{};const i={...s,...r};return{MeasureLayout:s?.isEnabled(t)||r?.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function zq(t,e){if(typeof Proxy>"u")return fv;const s=new Map,r=(a,l)=>fv(a,l,t,e),i=(a,l)=>r(a,l);return new Proxy(i,{get:(a,l)=>l==="create"?r:(s.has(l)||s.set(l,fv(l,void 0,t,e)),s.get(l))})}const Vq=(t,e)=>e.isSVG??lN(t)?new gH(e):new uH(e,{allowProjection:t!==j.Fragment});class Fq extends Ol{constructor(e){super(e),e.animationState||(e.animationState=jH(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();vb(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:s}=this.node.prevProps||{};e!==s&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Uq=0;class Hq extends Ol{constructor(){super(...arguments),this.id=Uq++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:s}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&r===!1){if(this.isExitComplete){const{initial:a,custom:l}=this.node.getProps();if(typeof a=="string"){const d=_c(this.node,a,l);if(d){const{transition:u,transitionEnd:m,...p}=d;for(const x in p)this.node.getValue(x)?.jump(p[x])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const i=this.node.animationState.setActive("exit",!e);s&&!e&&i.then(()=>{this.isExitComplete=!0,s(this.id)})}mount(){const{register:e,onExitComplete:s}=this.node.presenceContext||{};s&&s(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const qq={animation:{Feature:Fq},exit:{Feature:Hq}};function ap(t){return{point:{x:t.pageX,y:t.pageY}}}const Wq=t=>e=>Zj(e)&&t(e,ap(e));function sm(t,e,s,r){return km(t,e,Wq(s),r)}const DO=({current:t})=>t?t.ownerDocument.defaultView:null,Y3=(t,e)=>Math.abs(t-e);function Gq(t,e){const s=Y3(t.x,e.x),r=Y3(t.y,e.y);return Math.sqrt(s**2+r**2)}const Q3=new Set(["auto","scroll"]);class PO{constructor(e,s,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:a=!1,distanceThreshold:l=3,element:d}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=b=>{this.handleScroll(b.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Bf(this.lastRawMoveEventInfo,this.transformPagePoint));const b=xv(this.lastMoveEventInfo,this.history),v=this.startEvent!==null,k=Gq(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!v&&!k)return;const{point:N}=b,{timestamp:S}=wn;this.history.push({...N,timestamp:S});const{onStart:A,onMove:E}=this.handlers;v||(A&&A(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),E&&E(this.lastMoveEvent,b)},this.handlePointerMove=(b,v)=>{this.lastMoveEvent=b,this.lastRawMoveEventInfo=v,this.lastMoveEventInfo=Bf(v,this.transformPagePoint),Gt.update(this.updatePoint,!0)},this.handlePointerUp=(b,v)=>{this.end();const{onEnd:k,onSessionEnd:N,resumeAnimation:S}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&S&&S(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const A=xv(b.type==="pointercancel"?this.lastMoveEventInfo:Bf(v,this.transformPagePoint),this.history);this.startEvent&&k&&k(b,A),N&&N(b,A)},!Zj(e))return;this.dragSnapToOrigin=a,this.handlers=s,this.transformPagePoint=r,this.distanceThreshold=l,this.contextWindow=i||window;const u=ap(e),m=Bf(u,this.transformPagePoint),{point:p}=m,{timestamp:x}=wn;this.history=[{...p,timestamp:x}];const{onSessionStart:g}=s;g&&g(e,xv(m,this.history)),this.removeListeners=np(sm(this.contextWindow,"pointermove",this.handlePointerMove),sm(this.contextWindow,"pointerup",this.handlePointerUp),sm(this.contextWindow,"pointercancel",this.handlePointerUp)),d&&this.startScrollTracking(d)}startScrollTracking(e){let s=e.parentElement;for(;s;){const r=getComputedStyle(s);(Q3.has(r.overflowX)||Q3.has(r.overflowY))&&this.scrollPositions.set(s,{x:s.scrollLeft,y:s.scrollTop}),s=s.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const s=this.scrollPositions.get(e);if(!s)return;const r=e===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a={x:i.x-s.x,y:i.y-s.y};a.x===0&&a.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(e,i),Gt.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),wl(this.updatePoint)}}function Bf(t,e){return e?{point:e(t.point)}:t}function J3(t,e){return{x:t.x-e.x,y:t.y-e.y}}function xv({point:t},e){return{point:t,delta:J3(t,IO(e)),offset:J3(t,Kq(e)),velocity:Yq(e,.1)}}function Kq(t){return t[0]}function IO(t){return t[t.length-1]}function Yq(t,e){if(t.length<2)return{x:0,y:0};let s=t.length-1,r=null;const i=IO(t);for(;s>=0&&(r=t[s],!(i.timestamp-r.timestamp>Or(e)));)s--;if(!r)return{x:0,y:0};r===t[0]&&t.length>2&&i.timestamp-r.timestamp>Or(e)*2&&(r=t[1]);const a=ai(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const l={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function Qq(t,{min:e,max:s},r){return e!==void 0&&t<e?t=r?ns(e,t,r.min):Math.max(t,e):s!==void 0&&t>s&&(t=r?ns(s,t,r.max):Math.min(t,s)),t}function X3(t,e,s){return{min:e!==void 0?t.min+e:void 0,max:s!==void 0?t.max+s-(t.max-t.min):void 0}}function Jq(t,{top:e,left:s,bottom:r,right:i}){return{x:X3(t.x,s,i),y:X3(t.y,e,r)}}function Z3(t,e){let s=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([s,r]=[r,s]),{min:s,max:r}}function Xq(t,e){return{x:Z3(t.x,e.x),y:Z3(t.y,e.y)}}function Zq(t,e){let s=.5;const r=Jn(t),i=Jn(e);return i>r?s=wm(e.min,e.max-r,t.min):r>i&&(s=wm(t.min,t.max-i,e.min)),la(0,1,s)}function eW(t,e){const s={};return e.min!==void 0&&(s.min=e.min-t.min),e.max!==void 0&&(s.max=e.max-t.min),s}const r1=.35;function tW(t=r1){return t===!1?t=0:t===!0&&(t=r1),{x:eT(t,"left","right"),y:eT(t,"top","bottom")}}function eT(t,e,s){return{min:tT(t,e),max:tT(t,s)}}function tT(t,e){return typeof t=="number"?t:t[e]||0}const sW=new WeakMap;class nW{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Zs(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:s=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const a=x=>{s&&this.snapToCursor(ap(x).point),this.stopAnimation()},l=(x,g)=>{const{drag:b,dragPropagation:v,onDragStart:k}=this.getProps();if(b&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=_U(b),!this.openDragLock))return;this.latestPointerEvent=x,this.latestPanInfo=g,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Qi(S=>{let A=this.getAxisMotionValue(S).get()||0;if(ia.test(A)){const{projection:E}=this.visualElement;if(E&&E.layout){const _=E.layout.layoutBox[S];_&&(A=Jn(_)*(parseFloat(A)/100))}}this.originPoint[S]=A}),k&&Gt.update(()=>k(x,g),!1,!0),Qw(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},d=(x,g)=>{this.latestPointerEvent=x,this.latestPanInfo=g;const{dragPropagation:b,dragDirectionLock:v,onDirectionLock:k,onDrag:N}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:S}=g;if(v&&this.currentDirection===null){this.currentDirection=iW(S),this.currentDirection!==null&&k&&k(this.currentDirection);return}this.updateAxis("x",g.point,S),this.updateAxis("y",g.point,S),this.visualElement.render(),N&&Gt.update(()=>N(x,g),!1,!0)},u=(x,g)=>{this.latestPointerEvent=x,this.latestPanInfo=g,this.stop(x,g),this.latestPointerEvent=null,this.latestPanInfo=null},m=()=>{const{dragSnapToOrigin:x}=this.getProps();(x||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new PO(e,{onSessionStart:a,onStart:l,onMove:d,onSessionEnd:u,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:r,contextWindow:DO(this.visualElement),element:this.visualElement.current})}stop(e,s){const r=e||this.latestPointerEvent,i=s||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!i||!r)return;const{velocity:l}=i;this.startAnimation(l);const{onDragEnd:d}=this.getProps();d&&Gt.postRender(()=>d(r,i))}cancel(){this.isDragging=!1;const{projection:e,animationState:s}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),s&&s.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,s,r){const{drag:i}=this.getProps();if(!r||!zf(e,i,this.currentDirection))return;const a=this.getAxisMotionValue(e);let l=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(l=Qq(l,this.constraints[e],this.elastic[e])),a.set(l)}resolveConstraints(){const{dragConstraints:e,dragElastic:s}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;e&&qd(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=Jq(r.layoutBox,e):this.constraints=!1,this.elastic=tW(s),i!==this.constraints&&!qd(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&Qi(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=eW(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:s}=this.getProps();if(!e||!qd(e))return!1;const r=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const a=iH(r,i.root,this.visualElement.getTransformPagePoint());let l=Xq(i.layout.layoutBox,a);if(s){const d=s(sH(l));this.hasMutatedConstraints=!!d,d&&(l=nO(d))}return l}startAnimation(e){const{drag:s,dragMomentum:r,dragElastic:i,dragTransition:a,dragSnapToOrigin:l,onDragTransitionEnd:d}=this.getProps(),u=this.constraints||{},m=Qi(p=>{if(!zf(p,s,this.currentDirection))return;let x=u&&u[p]||{};(l===!0||l===p)&&(x={min:0,max:0});const g=i?200:1e6,b=i?40:1e7,v={type:"inertia",velocity:r?e[p]:0,bounceStiffness:g,bounceDamping:b,timeConstant:750,restDelta:1,restSpeed:10,...a,...x};return this.startAxisValueAnimation(p,v)});return Promise.all(m).then(d)}startAxisValueAnimation(e,s){const r=this.getAxisMotionValue(e);return Qw(this.visualElement,e),r.start(Kj(e,r,0,s,this.visualElement,!1))}stopAnimation(){Qi(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const s=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),i=r[s];return i||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Qi(s=>{const{drag:r}=this.getProps();if(!zf(s,r,this.currentDirection))return;const{projection:i}=this.visualElement,a=this.getAxisMotionValue(s);if(i&&i.layout){const{min:l,max:d}=i.layout.layoutBox[s],u=a.get()||0;a.set(e[s]-ns(l,d,.5)+u)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:s}=this.getProps(),{projection:r}=this.visualElement;if(!qd(s)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Qi(l=>{const d=this.getAxisMotionValue(l);if(d&&this.constraints!==!1){const u=d.get();i[l]=Zq({min:u,max:u},this.constraints[l])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),Qi(l=>{if(!zf(l,e,null))return;const d=this.getAxisMotionValue(l),{min:u,max:m}=this.constraints[l];d.set(ns(u,m,i[l]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;sW.set(this.visualElement,this);const e=this.visualElement.current,s=sm(e,"pointerdown",m=>{const{drag:p,dragListener:x=!0}=this.getProps(),g=m.target,b=g!==e&&LU(g);p&&x&&!b&&this.start(m)});let r;const i=()=>{const{dragConstraints:m}=this.getProps();qd(m)&&m.current&&(this.constraints=this.resolveRefConstraints(),r||(r=rW(e,m.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,l=a.addEventListener("measure",i);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),Gt.read(i);const d=km(window,"resize",()=>this.scalePositionWithinConstraints()),u=a.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:p})=>{this.isDragging&&p&&(Qi(x=>{const g=this.getAxisMotionValue(x);g&&(this.originPoint[x]+=m[x].translate,g.set(g.get()+m[x].translate))}),this.visualElement.render())}));return()=>{d(),s(),l(),u&&u(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:s=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:a=!1,dragElastic:l=r1,dragMomentum:d=!0}=e;return{...e,drag:s,dragDirectionLock:r,dragPropagation:i,dragConstraints:a,dragElastic:l,dragMomentum:d}}}function sT(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function rW(t,e,s){const r=c3(t,sT(s)),i=c3(e,sT(s));return()=>{r(),i()}}function zf(t,e,s){return(e===!0||e===t)&&(s===null||s===t)}function iW(t,e=10){let s=null;return Math.abs(t.y)>e?s="y":Math.abs(t.x)>e&&(s="x"),s}class aW extends Ol{constructor(e){super(e),this.removeGroupControls=li,this.removeListeners=li,this.controls=new nW(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||li}update(){const{dragControls:e}=this.node.getProps(),{dragControls:s}=this.node.prevProps||{};e!==s&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const gv=t=>(e,s)=>{t&&Gt.update(()=>t(e,s),!1,!0)};class oW extends Ol{constructor(){super(...arguments),this.removePointerDownListener=li}onPointerDown(e){this.session=new PO(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:DO(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:s,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:gv(e),onStart:gv(s),onMove:gv(r),onEnd:(a,l)=>{delete this.session,i&&Gt.postRender(()=>i(a,l))}}}mount(){this.removePointerDownListener=sm(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let bv=!1;class lW extends j.Component{componentDidMount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:r,layoutId:i}=this.props,{projection:a}=e;a&&(s.group&&s.group.add(a),r&&r.register&&i&&r.register(a),bv&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Sx.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:s,visualElement:r,drag:i,isPresent:a}=this.props,{projection:l}=r;return l&&(l.isPresent=a,e.layoutDependency!==s&&l.setOptions({...l.options,layoutDependency:s}),bv=!0,i||e.layoutDependency!==s||s===void 0||e.isPresent!==a?l.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?l.promote():l.relegate()||Gt.postRender(()=>{const d=l.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:s}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=s,r.root.didUpdate(),Xj.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:s,switchLayoutGroup:r}=this.props,{projection:i}=e;bv=!0,i&&(i.scheduleCheckAfterUnmount(),s&&s.group&&s.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function LO(t){const[e,s]=SO(),r=j.useContext(Rj);return n.jsx(lW,{...t,layoutGroup:r,switchLayoutGroup:j.useContext(OO),isPresent:e,safeToRemove:s})}const cW={pan:{Feature:oW},drag:{Feature:aW,ProjectionNode:kO,MeasureLayout:LO}};function nT(t,e,s){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",s==="Start");const i="onHover"+s,a=r[i];a&&Gt.postRender(()=>a(e,ap(e)))}class dW extends Ol{mount(){const{current:e}=this.node;e&&(this.unmount=RU(e,(s,r)=>(nT(this.node,r,"Start"),i=>nT(this.node,i,"End"))))}unmount(){}}class uW extends Ol{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=np(km(this.node.current,"focus",()=>this.onFocus()),km(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function rT(t,e,s){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",s==="Start");const i="onTap"+(s==="End"?"":s),a=r[i];a&&Gt.postRender(()=>a(e,ap(e)))}class hW extends Ol{mount(){const{current:e}=this.node;if(!e)return;
17const{globalTapTarget:s,propagate:r}=this.node.props;this.unmount=BU(e,(i,a)=>(rT(this.node,a,"Start"),(l,{success:d})=>rT(this.node,l,d?"End":"Cancel")),{useGlobalTarget:s,stopPropagation:r?.tap===!1})}unmount(){}}const i1=new WeakMap,yv=new WeakMap,mW=t=>{const e=i1.get(t.target);e&&e(t)},pW=t=>{t.forEach(mW)};function fW({root:t,...e}){const s=t||document;yv.has(s)||yv.set(s,{});const r=yv.get(s),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(pW,{root:t,...e})),r[i]}function xW(t,e,s){const r=fW(e);return i1.set(t,s),r.observe(t),()=>{i1.delete(t),r.unobserve(t)}}const gW={some:0,all:1};class bW extends Ol{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:s,margin:r,amount:i="some",once:a}=e,l={root:s?s.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:gW[i]},d=u=>{const{isIntersecting:m}=u;if(this.isInView===m||(this.isInView=m,a&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:p,onViewportLeave:x}=this.node.getProps(),g=m?p:x;g&&g(u)};this.stopObserver=xW(this.node.current,l,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:s}=this.node;["amount","margin","root"].some(yW(e,s))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function yW({viewport:t={}},{viewport:e={}}={}){return s=>t[s]!==e[s]}const vW={inView:{Feature:bW},tap:{Feature:hW},focus:{Feature:uW},hover:{Feature:dW}},wW={layout:{ProjectionNode:kO,MeasureLayout:LO}},jW={...qq,...vW,...cW,...wW},G=zq(jW,Vq);function op(){!nN.current&&eO();const[t]=j.useState(Yx.current);return t}const yt={hidden:{opacity:0,y:24},visible:{opacity:1,y:0,transition:{duration:.6}}},Pn={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.08}}};function Cx(){return n.jsxs("div",{className:"min-h-screen bg-[#f4f1eb] text-ink font-sans antialiased","data-testid":"page-workflow-capture-splash",children:[n.jsx("nav",{className:"fixed top-0 w-full z-50 bg-olive-dark/90 backdrop-blur-xl border-b border-white/10",children:n.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-3 sm:py-4 flex justify-between items-center",children:[n.jsxs("a",{href:"#top",className:"flex items-center gap-2","data-testid":"link-brand",children:[n.jsx("div",{className:"w-8 h-8 bg-white/10 border border-white/15 rounded-lg flex items-center justify-center",children:n.jsx(ii,{className:"w-4 h-4 text-cream"})}),n.jsx("span",{className:"font-black text-xl sm:text-2xl text-white",children:"Workflow Capture"})]}),n.jsxs("div",{className:"hidden md:flex items-center gap-7 text-sm",children:[n.jsx("a",{href:"#how",className:"text-white/75 hover:text-white font-medium transition-colors",children:"How it works"}),n.jsx("a",{href:"#outputs",className:"text-white/75 hover:text-white font-medium transition-colors",children:"Outputs"}),n.jsx("a",{href:"#usecases",className:"text-white/75 hover:text-white font-medium transition-colors",children:"Use cases"}),n.jsx("a",{href:"#security",className:"text-white/75 hover:text-white font-medium transition-colors",children:"Security"}),n.jsx("a",{href:"#pricing",className:"text-white/75 hover:text-white font-medium transition-colors",children:"Pricing"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("a",{href:"/signin",className:"inline-flex items-center px-3 sm:px-4 py-2 rounded-full text-white/80 hover:text-white font-semibold transition-all text-xs sm:text-sm","data-testid":"button-nav-signin",children:"Sign in"}),n.jsxs("a",{href:"/signup?plan=free",className:"inline-flex items-center px-4 py-2 rounded-full bg-white text-olive-dark hover:bg-cream font-semibold transition-all text-xs sm:text-sm","data-testid":"button-nav-cta",children:["Start Free",n.jsx(kn,{className:"ml-1 w-4 h-4"})]})]})]})}),n.jsxs("section",{id:"top",className:"relative overflow-hidden",style:{background:"radial-gradient(circle at 82% 18%, rgba(255,255,255,0.08), transparent 30%), linear-gradient(135deg, #184832 0%, #20543a 46%, #2f6148 100%)"},children:[n.jsx("div",{className:"absolute pointer-events-none hidden lg:block",style:{right:"275px",top:"70px",width:"420px",height:"310px",borderRadius:"50%",background:"rgba(255,255,255,0.06)",filter:"blur(24px)",zIndex:0}}),n.jsx("div",{className:"absolute pointer-events-none hidden lg:block",style:{right:"188px",to
17p:"-246px",width:"560px",height:"890px",borderRadius:"999px",border:"54px solid rgba(255,255,255,0.10)",transform:"rotate(18deg)",zIndex:0}}),n.jsx("div",{className:"max-w-[1220px] mx-auto px-4 sm:px-6 pt-24 sm:pt-32 lg:pt-40 pb-24 sm:pb-32 lg:pb-44 relative z-10",children:n.jsxs(G.div,{initial:"hidden",animate:"visible",variants:Pn,className:"grid lg:grid-cols-12 gap-10 lg:gap-12 items-start",children:[n.jsxs("div",{className:"lg:col-span-7",children:[n.jsxs(G.div,{variants:yt,className:"inline-flex items-center gap-2 bg-white/10 border border-white/15 text-white/90 px-4 py-1.5 rounded-full text-xs font-semibold mb-7",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cream animate-pulse"}),"Workflow intelligence capture for enterprise"]}),n.jsxs(G.h1,{variants:yt,className:"font-serif text-[2rem] leading-[1.1] sm:text-5xl sm:leading-[1.05] lg:text-6xl text-white mb-5 sm:mb-6 tracking-tight",children:["Capture how work gets done. Turn it into ",n.jsx("span",{className:"text-cream",children:"SOPs, training, scripts, and approved AI-ready workflows."})]}),n.jsx(G.p,{variants:yt,className:"text-base sm:text-lg text-white/75 max-w-2xl mb-8 leading-relaxed",children:"Workflow Capture records browser actions and voice narration as your team works, then converts that knowledge into clear documentation, training guides, and AI-agent scripts."}),n.jsx(G.div,{variants:yt,className:"flex flex-wrap items-center gap-3 mb-7",children:n.jsxs("a",{href:"/signup?plan=free",className:"inline-flex items-center gap-2 bg-white hover:bg-cream text-olive-dark px-7 py-3.5 rounded-full font-semibold transition-all text-sm shadow-md","data-testid":"link-hero-cta",children:["Start Free",n.jsx(kn,{className:"w-4 h-4"})]})}),n.jsxs(G.div,{variants:yt,className:"flex flex-wrap items-center gap-x-5 gap-y-2 text-xs text-white/70",children:[n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(vs,{className:"w-3.5 h-3.5 text-cream"})," No screen recording"]}),n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(vs,{className:"w-3.5 h-3.5 text-cream"})," Password fields excluded"]}),n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(vs,{className:"w-3.5 h-3.5 text-cream"})," Review before sending"]}),n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(vs,{className:"w-3.5 h-3.5 text-cream"})," Built for enterprise workflows"]})]})]}),n.jsxs("div",{className:"lg:col-span-5 space-y-4 relative z-10",children:[n.jsxs(G.div,{variants:yt,className:"rounded-[26px] p-6 text-white",style:{background:"rgba(255,255,255,0.10)",border:"1px solid rgba(255,255,255,0.20)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[n.jsx("div",{className:"text-sm font-semibold mb-4 text-white/95",children:"First workflow proof"}),n.jsx("div",{className:"space-y-3 text-sm",children:[{label:"Capture method",value:"3"},{label:"Generated outputs",value:"SOP"},{label:"Review required",value:"Yes"},{label:"Export destinations",value:"6"}].map((t,e)=>n.jsxs("div",{className:"flex items-center justify-between border-t border-white/10 pt-3 first:border-t-0 first:pt-0",children:[n.jsx("span",{className:"text-white/70",children:t.label}),n.jsx("span",{className:"font-semibold text-cream",children:t.value})]},e))})]}),n.jsxs(G.div,{variants:yt,className:"rounded-[26px] p-6 text-white",style:{background:"rgba(255,255,255,0.10)",border:"1px solid rgba(255,255,255,0.20)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[n.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[n.jsx("div",{className:"w-9 h-9 rounded-full bg-white/15 border border-white/20 flex items-center justify-center shrink-0",children:n.jsx(lo,{className:"w-4 h-4 text-cream"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white/95",children:"Betty can help"}),n.jsx("div",{className:"text-xs text-white/65 mt-0.5",children:"Capture, upload, or describe from memory"})]})]}),n.jsx("div",{className:"bg-white text-ink rounded-2xl px-4 py-3 text-sm leading-relaxed mb-4 shadow-sm",children:"“I onboard new clients with the same 8-step process every time.”"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:["Describe process","Upload SOP","Create AI script"].map(t=>n.jsx("span",{className:"text-[11px] font-semibold px-3 py-1.5 rounded-full bg-white/10 border border-white/20 text-white/90",children:t},t))})]})]})]})})]}),n.jsx("section",{className:"relative -mt-16 sm:-mt-24 lg:-mt-36 px-4 z-20 pb-12 sm:pb-16 lg:pb-24",children:n.jsx("div",{className:"max-w-[1130px] mx-auto",children:n.jsx(NW,{})})}),n.jsx("section",{className:"py-16 sm:py-20 px-4",children:n.jsxs("div",{className:"max-w-6xl mx-auto",children:[n.jsxs(G.div,{initial:"visible",animate:"visible",variants:Pn,className:"grid lg:grid-cols-2 gap-10 mb-12",children:[n.jsx(G.h2,{variants:yt,className:"font-serif text-3xl sm:text-5xl text-ink tracking-tight leading-[1.05]",children:"From one work session to reusable operational knowledge."}),n.jsx(G.p,{variants:yt,className:"text-warm-gray text-base sm:text-lg leading-relaxed self-end",children:"Workflow Capture is more than a recorder. It creates structured assets your team can review, train from, export, or hand to an AI employee."})]}),n.jsxs(G.div,{initial:"visible",animate:"visible",variants:Pn,className:"grid grid-cols-1 lg:grid-cols-12 gap-5 auto-rows-fr",children:[n.jsxs(G.div,{variants:yt,className:"lg:col-span-7 lg:row-span-2 bg-[#fbfaf6] rounded-[22px] border border-[#ddd9d1] p-7 sm:p-9 flex flex-col",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-[#e7f1e9] text-olive-dark text-xs font-bold mb-5 self-start",children:"01"}),n.jsx("h3",{className:"font-serif text-2xl sm:text-3xl text-ink mb-3 leading-tight",children:"Capture, upload, or just describe the process."}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed mb-7",children:"Start from live browser work, an existing SOP, or a plain-language explanation from someone who knows the process."}),n.jsx("div",{className:"space-y-2.5 mt-auto",children:[{icon:gl,label:"Browser capture",value:"clicks + narration"},{icon:_$,label:"Document upload",value:"SOP / checklist"},{icon:lo,label:"Betty prompt",value:"from memory"}].map((t,e)=>n.jsxs("div",{className:"flex items-center justify-between bg-white border border-[#ddd9d1] rounded-xl px-4 py-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg bg-[#e7f1e9] flex items-center justify-center",children:n.jsx(t.icon,{className:"w-3.5 h-3.5 text-olive-dark"})}),n.jsx("span",{className:"text-sm font-semibold text-ink",children:t.label})]}),n.jsx("span",{className:"text-xs text-warm-gray bg-[#f4f1eb] px-2.5 py-1 rounded-full",children:t.value})]},e))})]}),n.jsxs(G.div,{variants:yt,className:"lg:col-span-5 bg-[#fbfaf6] rounded-[22px] border border-[#ddd9d1] p-7",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-[#e7f1e9] text-olive-dark text-xs font-bold mb-4",children:"02"}),n.jsx("h3",{className:"font-serif text-xl sm:text-2xl text-ink mb-2 leading-tight",children:"Generate the assets teams actually use."}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed",children:"SOPs, training guides, checklists, and AI-agent scripts are created from the same source workflow."})]}),n.jsxs(G.div,{variants:yt,className:"lg:col-span-5 bg-[#fbfaf6] rounded-[22px] border border-[#ddd9d1] p-7",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-[#e7f1e9] text-olive-dark text-xs font-bold mb-4",children:"03"}),n.jsx("h3",{className:"font-serif text-xl sm:text-2xl text-ink mb-2 leading-tight",children:"Review before anything is published."}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed",children:"Keep humans in the loop with approval, versioning, and review controls before export or runtime handoff."})]}),n.jsx(G.div,{id:"exports",variants:yt,className:"lg:col-span-12 rounded-[22px] p-7 sm:p-9 text-white relative overflow-hidden scroll-mt-24",style:{background:"radial-gradient(circle at 88% 0%, rgba(255,255,255,0.10), transparent 34%), linear-gradient(135deg, #184832, #2f6148)",boxShadow:"0 16px 38px rgba(34,34,31,0.06)"},children:n.jsxs("div",{className:"grid lg:grid-cols-12 gap-6 items-center",children:[n.jsxs("div",{className:"lg:col-span-5",children:[n.jsx("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-white/10 border border-white/20 text-white text-xs font-bold mb-4",children:"04"}),n.jsx("h3",{className:"font-serif text-2xl sm:text-3xl mb-2 leading-tight",children:"Export approved workflows anywhere."}),n.jsx("p",{className:"text-white/75 text-sm leading-relaxed",children:"Move reviewed outputs into the systems where your team already works."})]}),n.jsx("div",{className:"lg:col-span-7 grid grid-cols-2 sm:grid-cols-3 gap-2.5",children:[{label:"Google Docs",href:null},{label:"Confluence",href:null},{label:"Notion",href:null},{label:"PDF",href:null},{label:"Markdown",href:null},{label:"Workflow AS",href:"https://workflowas.live/"}].map(t=>t.href?n.jsxs("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"text-center text-sm font-semibold px-4 py-3 rounded-xl bg-white/10 border border-white/20 text-white hover:bg-white/15 transition-colors","data-testid":`export-dest-${t.label.toLowerCase().replace(/\s+/g,"-")}`,children:[t.label," ↗"]},t.label):n.jsx("span",{className:"text-center text-sm font-semibold px-4 py-3 rounded-xl bg-white/10 border border-white/20 text-white",children:t.label},t.label))})]})}),n.jsxs(G.div,{id:"betty",variants:yt,className:"lg:col-span-6 bg-[#fbfaf6] rounded-[22px] border border-[#ddd9d1] p-7 scroll-mt-24",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"w-9 h-9 rounded-full bg-[#e7f1e9] flex items-center justify-center",children:n.jsx(F9,{className:"w-4 h-4 text-olive-dark"})}),n.jsx("span",{className:"text-xs font-bold text-olive-dark uppercase tracking-wider",children:"Betty"})]}),n.jsx("h3",{className:"font-serif text-xl sm:text-2xl text-ink mb-2 leading-tight",children:"Betty fills the gaps between capture and clarity."}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed mb-5",children:"Ask questions, describe edge cases, or turn a rough idea into a workflow draft."}),n.jsx("div",{className:"bg-white border border-[#ddd9d1] rounded-2xl px-4 py-3 text-sm text-ink leading-relaxed",children:"“Help me turn our refund exception process into an AI-ready script.”"})]}),n.jsxs(G.div,{variants:yt,className:"lg:col-span-6 bg-[#fbfaf6] rounded-[22px] border border-[#ddd9d1] p-7",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"w-9 h-9 rounded-full bg-[#e7f1e9] flex items-center justify-center",children:n.jsx(vj,{className:"w-4 h-4 text-olive-dark"})}),n.jsx("span",{className:"text-xs font-bold text-olive-dark uppercase tracking-wider",children:"Enterprise"})]}),n.jsx("h3",{className:"font-serif text-xl sm:text-2xl text-ink mb-2 leading-tight",children:"Built for enterprise workflow capture."}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed mb-5",children:"Capture sensitive operational knowledge without exposing passwords, payment fields, or unmanaged screen recordings."}),n.jsx("ul",{className:"space-y-2 text-sm text-ink",children:["Password fields excluded","No full-screen recording required","Audit-friendly output history"].map(t=>n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx(vs,{className:"w-4 h-4 text-olive-dark shrink-0"}),n.jsx("span",{children:t})]},t))})]})]})]})}),n.jsx("section",{id:"how",className:"py-20 sm:py-28 px-4",children:n.jsxs("div",{className:"max-w-6xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",
17whileInView:"visible",viewport:{once:!0},variants:Pn,className:"text-center mb-14",children:[n.jsx(G.span,{variants:yt,className:"inline-block text-[11px] font-bold text-olive-dark bg-[#e7f1e9] px-3 py-1 rounded-full mb-5 uppercase tracking-[0.14em]",children:"How it works"}),n.jsxs(G.h2,{variants:yt,className:"font-serif text-4xl sm:text-5xl text-ink tracking-tight leading-[1.08]",children:["Three steps. From doing the work",n.jsx("br",{className:"hidden sm:block"})," to documenting the work."]})]}),n.jsx(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Pn,className:"grid md:grid-cols-3 gap-6",children:[{step:"01",title:"Record the workflow",description:"Use the extension while doing the task normally. Clicks, forms, URLs, and step timing are captured automatically."},{step:"02",title:"Narrate the reasoning",description:"Explain judgment calls, exceptions, and escalation logic while you work so the output has real process context."},{step:"03",title:"Generate structured outputs",description:"Turn the session into an SOP, training guide, and AI-ready script your team can review, approve, and use."}].map((t,e)=>n.jsxs(G.div,{variants:yt,className:"relative bg-[#fbfaf6] rounded-[22px] border border-[#ddd9d1] p-7 sm:p-8 hover:shadow-md transition-shadow",children:[n.jsx("span",{className:"block font-serif text-6xl sm:text-7xl text-olive-dark leading-none mb-6",children:t.step}),n.jsx("h3",{className:"font-bold text-base text-ink mb-3",children:t.title}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed",children:t.description})]},e))})]})}),n.jsx("section",{id:"captures",className:"py-20 sm:py-28 px-4",children:n.jsxs("div",{className:"max-w-6xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Pn,className:"text-center mb-14",children:[n.jsx(G.span,{variants:yt,className:"inline-block text-[11px] font-bold text-olive-dark bg-[#e7f1e9] px-3 py-1 rounded-full mb-5 uppercase tracking-[0.14em]",children:"Capture surface"}),n.jsx(G.h2,{variants:yt,className:"font-serif text-4xl sm:text-5xl text-ink mb-5 tracking-tight leading-[1.08]",children:"The full picture of how work happens."}),n.jsx(G.p,{variants:yt,className:"text-warm-gray max-w-2xl mx-auto text-base",children:"Workflow Capture preserves more than screenshots. It c
17aptures the actions, the words, and the context that make a workflow real."})]}),n.jsx(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Pn,className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-5",children:[{letter:"C",title:"Clicks & navigation",desc:"Every button, link, and tab change tracked with precise selectors."},{letter:"F",title:"Form entries",desc:"Text typed, dropdowns selected, and checkboxes toggled with context."},{letter:"V",title:"Voice narration",desc:"Spoken explanations transcribed so reasoning lives alongside actions."},{letter:"T",title:"Timing & sequence",desc:"Exact order and rhythm of each step so the AI follows the right path."},{letter:"P",title:"Page context",desc:"URLs, page titles, and visible content give every action meaning."},{letter:"D",title:"Decision points",desc:"Conditional branches and approvals surface from your narration."},{letter:"E",title:"Exception handling",desc:"How experts handle unusual cases is preserved permanently."},{letter:"R",title:"Review notes",desc:"Annotations and approver comments captured into the audit trail."}].map((t,e)=>n.jsxs(G.div,{variants:yt,className:"bg-[#fbfaf6] rounded-[20px] border border-[#ddd9d1] p-6 hover:shadow-md transition-all",children:[n.jsx("span",{className:"inline-flex items-center justify-center w-8 h-8 rounded-full bg-[#e7f1e9] text-olive-dark text-xs font-bold mb-8",children:t.letter}),n.jsx("h3",{className:"font-bold text-ink mb-2 text-sm text-center",children:t.title}),n.jsx("p",{className:"text-warm-gray text-xs leading-relaxed text-center",children:t.desc})]},e))})]})}),n.jsxs("section",{id:"outputs",className:"py-24 sm:py-32 px-4 relative overflow-hidden",style:{background:"radial-gradient(circle at 90% 12%, rgba(255,255,255,0.06), transparent 30%), linear-gradient(135deg, #184832 0%, #20543a 46%, #2f6148 100%)"},children:[n.jsx("div",{className:"absolute pointer-events-none hidden lg:block",style:{right:"-160px",top:"-120px",width:"720px",height:"900px",borderRadius:"999px",border:"60px solid rgba(255,255,255,0.06)",transform:"rotate(18deg)",zIndex:0}}),n.jsxs("div",{className:"max-w-6xl mx-auto relative z-10",children:[n.jsxs(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Pn,className:"text-center mb-14",children:[n.jsx(G.span,{variants:yt,className:"inline-block text-[11px] font-bold text-white/90 bg-white/10 px-3 py-1 rounded-full mb-5 uppercase tracking-[0.14em] border border-white/15",children:"Outputs generated"}),n.jsxs(G.h2,{variants:yt,className:"font-serif text-4xl sm:text-5xl text-white mb-5 tracking-tight leading-[1.08]",children:["More than a recording. You get",n.jsx("br",{className:"hidden sm:block"})," usable outputs."]}),n.jsx(G.p,{variants:yt,className:"text-white/70 max-w-2xl mx-auto text-base",children:"Every Workflow Capture session generates review-ready assets. Approve them, edit them, share them with your team."})]}),n.jsx(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Pn,className:"grid sm:grid-cols-2 gap-5 max-w-5xl mx-auto",children:[{letter:"S",badge:"Markdown · PDF",title:"SOPs",desc:"Clean, step-by-step process documentation that operations and compliance teams can actually use."},{letter:"T",badge:"Onboarding-ready",title:"Training Guides",desc:"Onboarding material for new employees with reasoning, examples, and exception handling baked in."},{letter:"AI",badge:"JSON · YAML",title:"AI Scripts",desc:"Structured instructions with decision points and escalation paths preserved for automation teams."},{letter:"A",badge:"Versioned",title:"Audit Trails",desc:"Captured workflows with timestamps, reviewers, approvals, and version history for defensible process records."}].map((t,e)=>n.jsxs(G.div,{variants:yt,className:"bg-white/[0.05] border border-white/10 rounded-[20px] p-7 hover:bg-white/[0.08] hover:border-white/20 transition-all",children:[n.jsxs("div",{className:"flex items-start justify-between mb-6",children:[n.jsx("span",{className:"inline-flex items-center justify-center min-w-[34px] h-[26px] px-2.5 rounded-full bg-white/10 border border-white/15 text-white text-[11px] font-bold",children:t.letter}),n.jsx("span",{className:"text-[10px] font-bold text-white/85 bg-white/10 border border-white/15 px-2.5 py-1 rounded-full uppercase tracking-[0.14em]",children:t.badge})]}),n.jsx("h3",{className:"font-serif text-2xl text-white mb-2 text-center",children:t.title}),n.jsx("p",{className:"text-white/65 text-sm leading-relaxed text-center",children:t.desc})]},e))})]})]}),n.jsx("section",{id:"usecases",className:"py-20 sm:py-28 px-4",children:n.jsxs("div",{className:"max-w-6xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",
17whileInView:"visible",viewport:{once:!0},variants:Pn,className:"text-center mb-14",children:[n.jsx(G.span,{variants:yt,className:"inline-block text-[11px] font-bold text-olive-dark bg-[#e7f1e9] px-3 py-1 rounded-full mb-5 uppercase tracking-[0.14em]",children:"Built for"}),n.jsxs(G.h2,{variants:yt,className:"font-serif text-4xl sm:text-5xl text-ink tracking-tight leading-[1.08]",children:["Built for teams that run",n.jsx("br",{className:"hidden sm:block"})," critical workflows."]})]}),n.jsx(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Pn,className:"grid md:grid-cols-2 lg:grid-cols-3 gap-5",children:[{letter:"O",title:"Operations leaders",desc:"Capture workflows your team repeats every day without chasing people for documentation."},{letter:"T",title:"Training & enablement",desc:"Turn expert behavior into reusable onboarding and training assets your new hires actually open."},{letter:"Q",title:"Compliance & QA",desc:"Preserve how a process is performed, reviewed, and approved with a full audit trail."},{letter:"AI",title:"AI & automation teams",desc:"Use real observed workflows as foundation data instead of guesses about how work happens."},{letter:"B",title:"BPO & shared services",desc:"Standardize and transfer operational knowledge faster across teams, sites, and time zones."},{letter:"X",title:"Transformation leaders",desc:"Identify which workflows are ready for automation and where the real exceptions live."}].map((t,e)=>n.jsxs(G.div,{variants:yt,className:"bg-[#fbfaf6] rounded-[22px] border border-[#ddd9d1] p-7 hover:shadow-md transition-all",children:[n.jsx("span",{className:"inline-flex items-center justify-center min-w-[34px] h-[26px] px-2.5 rounded-full bg-[#e7f1e9] text-olive-dark text-[11px] font-bold mb-8",children:t.letter}),n.jsx("h3",{className:"font-bold text-base text-ink mb-2 text-center",children:t.title}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed text-center",children:t.desc})]},e))})]})}),n.jsxs("section",{id:"security",className:"py-24 sm:py-32 px-4 relative overflow-hidden",style:{background:"radial-gradient(circle at 90% 12%, rgba(255,255,255,0.06), transparent 30%), linear-gradient(135deg, #184832 0%, #20543a 46%, #2f6148 100%)"},children:[n.jsx("div",{className:"absolute pointer-events-none hidden lg:block",style:{right:"-160px",top:"-120px",width:"720px",height:"900px",borderRadius:"999px",border:"60px solid rgba(255,255,255,0.06)",transform:"rotate(18deg)",zIndex:0}}),n.jsx("div",{className:"max-w-6xl mx-auto relative z-10",children:n.jsxs(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Pn,className:"grid lg:grid-cols-2 gap-12 items-start",children:[n.jsxs(G.div,{variants:yt,children:[n.jsx("span",{className:"inline-block text-[11px] font-bold text-white/90 bg-white/10 px-3 py-1 rounded-full mb-5 uppercase tracking-[0.14em] border border-white/15",children:"Security & privacy"}),n.jsxs("h2",{className:"font-serif text-4xl sm:text-5xl text-white mb-5 tracking-tight leading-[1.08]",children:["Built private",n.jsx("br",{}),"by default."]}),n.jsx("p",{className:"text-white/70 text-base leading-relaxed mb-7 max-w-md",children:"Enterprise teams cannot trust a black box. Workflow Capture is engineered so you decide what gets recorded, what gets sent, and who can see it."}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[n.jsxs("a",{href:"/signup?plan=free",className:"inline-flex items-center justify-center gap-2 bg-white hover:bg-cream text-olive-dark px-7 py-3 rounded-full font-semibold transition-all text-sm",children:["Start Free",n.jsx(kn,{className:"w-4 h-4"})]}),n.jsx("a",{href:"#security",className:"inline-flex items-center justify-center gap-2 bg-white/10 hover:bg-white/15 border border-white/20 text-white px-7 py-3 rounded-full font-semibold transition-all text-sm",children:"View Security"})]})]}),n.jsx(G.div,{variants:yt,className:"grid sm:grid-cols-2 gap-3.5",children:[{letter:"P",title:"Password fields excluded",desc:"Sensitive inputs are filtered automatically and never sent."},{letter:"R",title:"Recording is user-controlled",desc:"Start, pause, and stop whenever you want."},{letter:"V",title:"Review before sending",desc:"Inspect and edit every captured action before approval."},{letter:"W",title:"Workspace-isolated storage",desc:"Your captures live in your workspace, not public model training data."},{letter:"E",title:"Encrypted in transit",desc:"Recordings move over TLS to your private workspace."},{letter:"A",title:"Roles & access controls",desc:"Role-based access and enterprise SSO placeholders."}].map((t,e)=>n.jsxs("div",{className:"bg-white/[0.05] border border-white/10 rounded-[18px] p-5",children:[n.jsx("span",{className:"inline-flex items-center justify-center w-8 h-8 rounded-full bg-white/10 border border-white/15 text-white text-xs font-bold mb-4",children:t.letter}),n.jsx("h3",{className:"font-semibold text-white text-sm mb-1.5",children:t.title}),n.jsx("p",{className:"text-white/65 text-xs leading-relaxed",children:t.desc})]},e))})]})})]}),n.jsx("section",{className:"py-20 sm:py-28 px-4",children:n.jsxs("div",{className:"max-w-6xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",
17whileInView:"visible",viewport:{once:!0},variants:Pn,className:"text-center mb-14",children:[n.jsx(G.span,{variants:yt,className:"inline-block text-[11px] font-bold text-olive-dark bg-[#e7f1e9] px-3 py-1 rounded-full mb-5 uppercase tracking-[0.14em]",children:"Why teams buy"}),n.jsxs(G.h2,{variants:yt,className:"font-serif text-4xl sm:text-5xl text-ink tracking-tight leading-[1.08]",children:["From tribal knowledge to",n.jsx("br",{className:"hidden sm:block"})," operational intelligence."]})]}),n.jsx(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Pn,className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-5",children:[{stat:"Minutes",label:"Capture in minutes, not workshops",desc:"Skip the documentation interview marathon. Record the work as it happens."},{stat:"Reusable",label:"Reuse across teams and sites",desc:"One captured workflow becomes onboarding, SOPs, and automation input."},{stat:"Reviewable",label:"Reviewed before operationalizing",desc:"Every output is editable and approvable. Nothing goes live without sign-off."},{stat:"AI-ready",label:"Move workflows toward automation",desc:"Hand structured, narrated workflows to automation initiatives with reasoning preserved."},{stat:"Resilient",label:"Reduce dependency on experts",desc:"When experienced staff leave, the workflow knowledge stays."},{stat:"Defensible",label:"Audit-ready process assets",desc:"Versioned, timestamped, attributable process evidence regulators want."}].map((t,e)=>n.jsxs(G.div,{variants:yt,className:"bg-[#fbfaf6] rounded-[20px] border border-[#ddd9d1] p-6 text-center",children:[n.jsx("div",{className:"text-[10px] font-bold text-olive-dark uppercase tracking-[0.14em] mb-2",children:t.stat}),n.jsx("h3",{className:"font-bold text-ink text-base mb-2",children:t.label}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed",children:t.desc})]},e))})]})}),n.jsx("section",{id:"pricing",className:"py-20 sm:py-28 px-4",children:n.jsxs("div",{className:"max-w-6xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Pn,className:"text-center mb-14",children:[n.jsx(G.span,{variants:yt,className:"inline-block text-[11px] font-bold text-olive-dark bg-[#e7f1e9] px-3 py-1 rounded-full mb-5 uppercase tracking-[0.14em]",children:"Pricing"}),n.jsx(G.h2,{variants:yt,className:"font-serif text-4xl sm:text-5xl text-ink mb-5 tracking-tight leading-[1.08]",children:"Start free. Scale when you are ready."}),n.jsx(G.p,{variants:yt,className:"text-warm-gray max-w-2xl mx-auto text-base",children:"A clear path from individual proof-of-concept to enterprise-wide rollout. No hidden seats. No surprise bills."})]}),n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4 items-stretch",children:[{name:"Free",price:"$0",cadence:"",tag:"For individuals testing the product",features:["3 captures / month","Basic SOP generation","Markdown export","Single user"],cta:"Start Free",href:"/signup?plan=free",featured:!1},{name:"Pro",price:"$49",cadence:"/mo",tag:"For solo operators and consultants",features:["25 captures / month","SOP + training guide","JSON + Markdown export","Email support"],cta:"Get Started",href:"/signup?plan=pro",featured:!1},{name:"Team",price:"$199",cadence:"/mo",tag:"For small teams documenting workflows",features:["Up to 5 users","100 captures / month","SOP + guide + AI script","Shared library","Priority support"],cta:"Get Started",href:"/signup?plan=team",featured:!0},{name:"Business",price:"$499",cadence:"/mo",tag:"For ops, compliance, and transformation",features:["Up to 10 users","250 captures / month","Advanced AI scripts","Review workflow","Usage controls"],cta:"Get Started",href:"/signup?plan=business",featured:!1},{name:"Enterprise",price:"Custom",cadence:"",tag:"Regulated and org-wide rollout",features:["Custom users and volume","SSO / SAML","Audit logs","Security review","Private environment"],cta:"Join Waitlist",href:"/signup?plan=enterprise",featured:!1}].map((t,e)=>n.jsxs(G.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.5,delay:e*.05},className:`relative rounded-[22px] p-6 border flex flex-col text-center ${t.featured?"border-olive-dark text-white shadow-2xl lg:-translate-y-3":"bg-[#fbfaf6] border-[#ddd9d1] text-ink"}`,style:t.featured?{background:"linear-gradient(135deg, #184832 0%, #20543a 50%, #2f6148 100%)"}:void 0,"data-testid":`pricing-plan-${t.name.toLowerCase()}`,children:[t.featured&&n.jsx("span",{className:"inline-flex self-center items-center text-[10px] font-bold uppercase tracking-[0.14em] px-3 py-1 rounded-full bg-[#e7f1e9] text-olive-dark mb-3",children:"Most Popular"}),n.jsx("h3",{className:`font-serif text-2xl mb-1 ${t.featured?"text-white":"text-ink"}`,children:t.name}),n.jsx("p",{className:`text-xs mb-5 leading-relaxed min-h-[2.5rem] ${t.featured?"text-white/70":"text-warm-gray"}`,children:t.tag}),n.jsxs("div",{className:"mb-6",children:[n.jsx("span",{className:`font-serif text-4xl font-bold ${t.featured?"text-white":"text-ink"}`,children:t.price}),t.cadence&&n.jsx("span",{className:`text-sm ${t.featured?"text-white/70":"text-warm-gray"}`,children:t.cadence})]}),n.jsx("ul",{className:`space-y-2.5 mb-7 flex-1 text-left ${t.featured?"text-white/85":"text-ink/85"}`,children:t.features.map((s,r)=>n.jsxs("li",{className:"flex items-start gap-2 text-xs leading-relaxed justify-center",children:[n.jsx(vs,{className:`w-3.5 h-3.5 shrink-0 mt-0.5 ${t.featured?"text-cream":"text-olive-dark"}`}),n.jsx("span",{children:s})]},r))}),n.jsx("a",{href:t.href,className:`block text-center px-4 py-2.5 rounded-full font-semibold text-sm transition-all ${t.featured?"bg-white hover:bg-cream text-olive-dark":"bg-olive-dark hover:bg-olive text-white"}`,"data-testid":`pricing-cta-${t.name.toLowerCase()}`,children:t.cta})]},e))})]})}),n.jsxs("section",{id:"waitlist",className:"py-24 sm:py-32 px-4 relative overflow-hidden",style:{background:"radial-gradient(circle at 88% 14%, rgba(255,255,255,0.07), transparent 32%), linear-gradient(135deg, #184832 0%, #20543a 46%, #2f6148 100%)"},children:[n.jsx("div",{className:"absolute pointer-events-none hidden lg:block",style:{right:"-180px",top:"-180px",width:"720px",height:"900px",borderRadius:"999px",border:"60px solid rgba(255,255,255,0.06)",transform:"rotate(18deg)",zIndex:0}}),n.jsx("div",{className:"max-w-3xl mx-auto text-center relative z-10",children:n.jsxs(G.div,{initial:"hidden",
17whileInView:"visible",viewport:{once:!0},variants:Pn,children:[n.jsxs(G.h2,{variants:yt,className:"font-serif text-4xl sm:text-6xl text-white mb-6 leading-[1.05] tracking-tight",children:["Capture the work once.",n.jsx("br",{}),n.jsx("span",{className:"text-cream",children:"Reuse the knowledge everywhere."})]}),n.jsxs(G.div,{variants:yt,className:"flex flex-wrap items-center justify-center gap-3 mt-8",children:[n.jsxs("a",{href:"/signup?plan=free",className:"inline-flex items-center gap-2 bg-white hover:bg-cream text-olive-dark px-7 py-3.5 rounded-full font-semibold transition-all text-sm shadow-md","data-testid":"link-final-cta-start",children:["Start Free",n.jsx(kn,{className:"w-4 h-4"})]}),n.jsx("a",{href:"#how",className:"inline-flex items-center gap-2 bg-white/10 hover:bg-white/15 border border-white/20 text-white px-7 py-3.5 rounded-full font-semibold transition-all text-sm","data-testid":"link-final-cta-how",children:"See How It Works"})]})]})})]}),n.jsx("footer",{className:"bg-[#f4f1eb] border-t border-[#ddd9d1] pt-14 pb-8 px-4",children:n.jsxs("div",{className:"max-w-6xl mx-auto",children:[n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-10 mb-12",children:[n.jsxs("div",{className:"col-span-2",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx("div",{className:"w-8 h-8 bg-olive-dark rounded-lg flex items-center justify-center",children:n.jsx(ii,{className:"w-4 h-4 text-white"})}),n.jsx("span",{className:"font-black text-lg text-ink",children:"Workflow Capture"})]}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed mb-5 max-w-xs",children:"Turn real operational work into SOPs, training guides, AI-agent scripts, and reviewable workflow knowledge."}),n.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[n.jsx("a",{href:"/signup?plan=free",className:"inline-flex items-center gap-1.5 bg-olive-dark hover:bg-olive text-white px-4 py-2 rounded-full text-xs font-semibold transition-all","data-testid":"link-footer-start",children:"Start Free"}),n.jsx("a",{href:"#how",className:"inline-flex items-center gap-1.5 bg-white border border-[#ddd9d1] hover:border-olive-dark text-ink px-4 py-2 rounded-full text-xs font-semibold transition-all","data-testid":"link-footer-how-cta",children:"See How It Works"})]})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-[11px] font-bold text-ink uppercase tracking-[0.14em] mb-4",children:"Product"}),n.jsxs("ul",{className:"space-y-2.5 text-sm text-warm-gray",children:[n.jsx("li",{children:n.jsx("a",{href:"#how",className:"hover:text-ink transition-colors","data-testid":"link-footer-how",children:"How it works"})}),n.jsx("li",{children:n.jsx("a",{href:"#captures",className:"hover:text-ink transition-colors","data-testid":"link-footer-captures",children:"Capture surface"})}),n.jsx("li",{children:n.jsx("a",{href:"#outputs",className:"hover:text-ink transition-colors","data-testid":"link-footer-outputs",children:"Outputs"})}),n.jsx("li",{children:n.jsx("a",{href:"#betty",className:"hover:text-ink transition-colors","data-testid":"link-footer-betty",children:"Betty assistant"})}),n.jsx("li",{children:n.jsx("a",{href:"#exports",className:"hover:text-ink transition-colors","data-testid":"link-footer-exports",children:"Export destinations"})})]})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-[11px] font-bold text-ink uppercase tracking-[0.14em] mb-4",children:"Company"}),n.jsxs("ul",{className:"space-y-2.5 text-sm text-warm-gray",children:[n.jsx("li",{children:n.jsx("a",{href:"#usecases",className:"hover:text-ink transition-colors","data-testid":"link-footer-usecases",children:"Use cases"})}),n.jsx("li",{children:n.jsx("a",{href:"/security",className:"hover:text-ink transition-colors","data-testid":"link-footer-security",children:"Security"})}),n.jsx("li",{children:n.jsx("a",{href:"#pricing",className:"hover:text-ink transition-colors","data-testid":"link-footer-pricing",children:"Pricing"})}),n.jsx("li",{children:n.jsx("a",{href:"https://workflowas.live/",target:"_blank",rel:"noopener noreferrer",className:"hover:text-ink transition-colors","data-testid":"link-footer-workflow-as",children:"Workflow AS â
17†—"})}),n.jsx("li",{children:n.jsx("a",{href:"/customer-stories",className:"hover:text-ink transition-colors","data-testid":"link-footer-stories",children:"Customer stories"})})]})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-[11px] font-bold text-ink uppercase tracking-[0.14em] mb-4",children:"Help"}),n.jsxs("ul",{className:"space-y-2.5 text-sm text-warm-gray",children:[n.jsx("li",{children:n.jsx("a",{href:"/extension-support",className:"hover:text-ink transition-colors","data-testid":"link-footer-support",children:"Help center"})}),n.jsx("li",{children:n.jsx("a",{href:"/changelog",className:"hover:text-ink transition-colors","data-testid":"link-footer-changelog",children:"Product updates"})}),n.jsx("li",{children:n.jsx("a",{href:"/security",className:"hover:text-ink transition-colors","data-testid":"link-footer-security-help",children:"Security overview"})}),n.jsx("li",{children:n.jsx("a",{href:"/status",className:"hover:text-ink transition-colors","data-testid":"link-footer-status",children:"System status"})}),n.jsx("li",{children:n.jsx("span",{className:"text-warm-gray/70",children:"Chat support coming soon"})})]})]})]}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-10 -mt-4 mb-10",children:n.jsxs("div",{className:"md:col-start-5",children:[n.jsx("h4",{className:"text-[11px] font-bold text-ink uppercase tracking-[0.14em] mb-4",children:"Legal"}),n.jsxs("ul",{className:"space-y-2.5 text-sm text-warm-gray",children:[n.jsx("li",{children:n.jsx("a",{href:"/privacy",className:"hover:text-ink transition-colors","data-testid":"link-footer-privacy",children:"Privacy policy"})}),n.jsx("li",{children:n.jsx("a",{href:"/terms",className:"hover:text-ink transition-colors","data-testid":"link-footer-terms",children:"Terms of service"})}),n.jsx("li",{children:n.jsx("a",{href:"/dpa",className:"hover:text-ink transition-colors","data-testid":"link-footer-dpa",children:"Data processing addendum"})}),n.jsx("li",{children:n.jsx("a",{href:"/subprocessors",className:"hover:text-ink transition-colors","data-testid":"link-footer-subprocessors",children:"Subprocessors"})}),n.jsx("li",{children:n.jsx("a",{href:"/security",className:"hover:text-ink transition-colors","data-testid":"link-footer-security-legal",children:"Security overview"})})]})]})}),n.jsxs("div",{className:"border-t border-[#ddd9d1] pt-6 flex flex-col sm:flex-row items-center justify-between gap-3 text-xs text-warm-gray",children:[n.jsx("p",{children:"© 2026 Workflow Capture. All rights reserved."}),n.jsxs("div",{className:"flex items-center gap-5",children:[n.jsx("a",{href:"/privacy",className:"hover:text-ink transition-colors",children:"Privacy"}),n.jsx("a",{href:"/terms",className:"hover:text-ink transition-colors",children:"Terms"}),n.jsx("a",{href:"/security",className:"hover:text-ink transition-colors",children:"Security"}),n.jsx("a",{href:"/status",className:"hover:text-ink transition-colors",children:"Status"})]})]})]})})]})}function NW(){const[t,e]=j.useState("sop");return n.jsxs(G.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.7},className:"bg-[#fbfaf6] rounded-[20px] border border-[#d9d7ce] overflow-hidden",style:{boxShadow:"0 28px 80px rgba(34,34,31,0.16)"},children:[n.jsxs("div",{className:"bg-[#f4f1eb] border-b border-[#d9d7ce] px-4 py-2.5 flex items-center gap-2",children:[n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-red-400"}),n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-amber-400"}),n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-green-400"})]}),n.jsxs("div",{className:"flex-1 mx-4 bg-white border border-[#d9d7ce] rounded-md px-3 py-1 text-[11px] text-warm-gray flex items-center gap-2",children:[n.jsx(po,{className:"w-3 h-3 text-olive-dark"}),n.jsx("span",{children:"app.workflowcapture.com / claims / queue"})]}),n.jsxs("div",{className:"flex items-center gap-1.5 bg-red-50 border border-red-100 rounded-full px-2.5 py-1 text-[10px] font-semibold text-red-600",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500 animate-pulse"}),"Recording · 02:14"]})]}),n.jsxs("div",{className:"grid lg:grid-cols-2 gap-0",children:[n.jsxs("div",{className:"p-6 sm:p-8 border-b lg:border-b-0 lg:border-r border-warm-border bg-cream-light/30",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("h3",{className:"text-xs font-bold text-ink uppercase tracking-wider",children:"Live capture"}),n.jsx("span",{className:"text-[10px] text-warm-gray bg-white border border-warm-border px-2 py-0.5 rounded-full",children:"12 actions · 4 narrations"})]}),n.jsx("ul",{className:"space-y-2 text-[11px] text-ink",children:[{t:"00:00:01",a:'Clicked "Open queue"',type:"action"},{t:"00:00:04",a:"Filtered by status = Pending",type:"action"},{t:"00:00:09",a:"Selected first row",type:"action"},{t:"00:00:13",a:'"If the date is older than 7 days, escalate it."',type:"voice"},{t:"00:00:17",a:"Set status → Escalated",type:"action"},{t:"00:00:21",a:'"Otherwise route it back to the original adjuster."',type:"voice"},{t:"00:00:24",a:'Added note: "Aged claim per policy"',type:"action"},{t:"00:00:27",a:"Saved record",type:"action"}].map((s,r)=>n.jsxs("li",{className:"flex items-start gap-2.5 group",children:[n.jsx("span",{className:"text-warm-gray font-mono text-[10px] mt-0.5 shrink-0",children:s.t}),s.type==="voice"?n.jsxs("span",{className:"flex items-start gap-1.5 leading-relaxed text-olive italic",children:[n.jsx(oo,{className:"w-3 h-3 mt-0.5 shrink-0"}),s.a]}):n.jsx("span",{className:"leading-relaxed",children:s.a})]},r))})]}),n.jsxs("div",{className:"p-6 sm:p-8",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("h3",{className:"text-xs font-bold text-ink uppercase tracking-wider",children:"Generated outputs"}),n.jsx("span",{className:"text-[10px] text-olive bg-olive/10 px-2 py-0.5 rounded-full font-semibold uppercase tracking-wider",children:"Ready"})]}),n.jsx("div",{className:"flex gap-1 bg-cream-light border border-warm-border rounded-lg p-1 mb-4",children:[{id:"sop",label:"SOP",icon:Mi},{id:"guide",label:"Training Guide",icon:UA},{id:"script",label:"AI Script",icon:Zd}].map(s=>n.jsxs("button",{onClick:()=>e(s.id),"data-testid":`tab-${s.id}`,className:`flex-1 flex items-center justify-center gap-1.5 text-[10px] font-semibold px-2 py-1.5 rounded-md transition-all ${t===s.id?"bg-white text-ink shadow-sm border border-warm-border":"text-warm-gray hover:text-ink"}`,children:[n.jsx(s.icon,{className:"w-3 h-3"}),s.label]},s.id))}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-lg p-4 text-[11px] leading-relaxed text-ink min-h-[180px]",children:[t==="sop"&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"font-bold text-ink mb-2",children:"Aged Claim Escalation · SOP"}),n.jsxs("div",{children:[n.jsx("span",{className:"text-olive font-semibold",children:"1."})," Open the Pending queue."]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-olive font-semibold",children:"2."})," For each claim, check the submission date."]}),n.jsx("div",{className:"pl-4 text-warm-gray",children:"If older than 7 days → set status to Escalated and add aged-claim note."}),n.jsx("div",{className:"pl-4 text-warm-gray",children:"Otherwise → route back to original adjuster."}),n.jsxs("div",{children:[n.jsx("span",{className:"text-olive font-semibold",children:"3."})," Save record. Audit entry is logged automatically."]})]}),t==="guide"&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"font-bold text-ink mb-2",children:"Training Guide · New Adjuster"}),n.jsx("p",{children:"The aged-claim rule exists because claims older than a week often fall through the cracks. When you see one, escalate it to the team lead instead of trying to resolve it yourself."}),n.jsx("p",{className:"mt-2 text-warm-gray italic",children:'"If the date is older than 7 days, escalate it. Otherwise route it back to the original adjuster." — captured from senior adjuster'})]}),t==="script"&&n.jsx("pre",{className:"font-mono text-[10px] text-ink/90 whitespace-pre-wrap",children:`{
18  "name": "aged_claim_escalation",
19  "trigger": "queue.status == 'Pending'",
20  "steps": [
21    { "for_each": "claim",
22      "if": "age_days > 7",
23      "then": ["set_status: Escalated",
24               "add_note: 'Aged claim per policy'"],
25      "else": ["route_to: original_adjuster"]
26    },
27    { "save": true, "audit": true }
28  ]
29}`})]}),n.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[n.jsx("span",{className:"text-[10px] text-warm-gray",children:"Also exports:"}),n.jsx("span",{className:"text-[10px] bg-cream-light border border-warm-border text-ink/70 px-2 py-0.5 rounded",children:"Audit Trail"}),n.jsx("span",{className:"text-[10px] bg-cream-light border border-warm-border text-ink/70 px-2 py-0.5 rounded",children:"Markdown"}),n.jsx("span",{className:"text-[10px] bg-cream-light border border-warm-border text-ink/70 px-2 py-0.5 rounded",children:"PDF"})]})]})]})]})}const vv=[{t:"10:42:01",a:'Clicked "Open queue"',script:{step:1,label:"Open the queue"}},{t:"10:42:04",a:'Filtered by "Pending"',script:{step:2,label:"Filter by status = Pending"}},{t:"10:42:09",a:"Selected first row",script:{step:3,label:"For each row:"}},{t:"10:42:13",a:'Voice: "If the date is older than 7 days, escalate it."',script:{step:null,label:"if age > 7 days → escalate",indent:!0}},{t:"10:42:17",a:"Set status → Escalated",script:{step:null,label:"else → continue review",indent:!0}},{t:"10:42:21",a:"Added note and saved",script:{step:4,label:"Save and log audit entry"}}];function kW(){const[t,e]=j.useState(0);j.useEffect(()=>{if(t>=vv.length){const a=setTimeout(()=>e(0),4e3);return()=>clearTimeout(a)}const i=setTimeout(()=>e(a=>a+1),1200);return()=>clearTimeout(i)},[t]);const s=vv.slice(0,t),r=t<vv.length;return n.jsxs("div",{className:"bg-white rounded-2xl border border-warm-border overflow-hidden shadow-lg","data-testid":"capture-demo",children:[n.jsxs("div",{className:"bg-cream-light border-b border-warm-border px-4 py-2.5 flex items-center gap-2",children:[n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-red-300"}),n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-amber-300"}),n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-green-300"})]}),n.jsxs("div",{className:"flex-1 mx-4 bg-white border border-warm-border rounded-md px-3 py-1 text-[11px] text-warm-gray flex items-center gap-2 truncate",children:[n.jsx(po,{className:"w-3 h-3 text-olive shrink-0"}),n.jsx("span",{className:"truncate",children:"app.example.com / process-claim"})]}),n.jsxs("div",{className:`flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[10px] font-semibold transition-colors ${r?"bg-red-50 border border-red-100 text-red-600":"bg-olive/10 border border-olive/30 text-olive"}`,children:[n.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r?"bg-red-500 animate-pulse":"bg-olive"}`}),r?"Recording":"Saved"]})]}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-0 min-h-[290px]",children:[n.jsxs("div",{className:"p-6 sm:p-7 border-b sm:border-b-0 sm:border-r border-warm-border",children:[n.jsx("h3",{className:"text-xs font-bold text-ink uppercase tracking-wider mb-3",children:"Live capture"}),n.jsxs("ul",{className:"space-y-2 text-[11px] text-ink",children:[n.jsx(Rr,{children:s.map((i,a)=>n.jsxs(G.li,{initial:{opacity:0,x:-8}
29,animate:{opacity:1,x:0},transition:{duration:.25},className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"text-warm-gray font-mono text-[10px] mt-0.5 shrink-0",children:i.t}),n.jsx("span",{className:"leading-relaxed",children:i.a})]},a))}),r&&s.length===0&&n.jsx("li",{className:"text-warm-gray text-[10px] italic",children:"Waiting for first action…"})]})]}),n.jsxs("div",{className:"p-6 sm:p-7 bg-cream-light/50",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsx("h3",{className:"text-xs font-bold text-ink uppercase tracking-wider",children:"Generated script"}),n.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-semibold transition-colors ${r?"text-warm-gray bg-warm-gray/10":"text-olive bg-olive/10"}`,children:r?"building":"ready"})]}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-lg p-4 font-mono text-[10px] leading-relaxed text-ink/90 space-y-1.5 min-h-[180px]",children:[s.length===0&&n.jsx("div",{className:"text-warm-gray italic",children:"Script will appear as you record…"}),n.jsx(Rr,{children:s.map((i,a)=>i.script.step!==null?n.jsxs(G.div,{initial:{opacity:0}
29,animate:{opacity:1},transition:{delay:.15,duration:.3},children:[n.jsxs("span",{className:"text-olive",children:["step ",i.script.step,"."]})," ",i.script.label]},`s-${a}`):n.jsx(G.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.15,duration:.3},className:"pl-4 text-warm-gray",children:i.script.label},`s-${a}`))})]})]})]})]})}function SW(){return n.jsx("div",{className:"pt-32 sm:pt-36 pb-20","data-testid":"page-wc-demo",children:n.jsxs("div",{className:"max-w-5xl mx-auto px-4",children:[n.jsxs(G.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6},className:"text-center mb-10",children:[n.jsxs("div",{className:"inline-flex items-center gap-2 bg-olive/10 text-olive px-4 py-1.5 rounded-full text-sm font-medium mb-5",children:[n.jsx(e$,{className:"w-4 h-4"}),"Live preview"]}),n.jsx("h1",{className:"font-serif text-4xl sm:text-5xl text-ink mb-4",children:"Watch a workflow get captured"}),n.jsx("p",{className:"text-warm-gray max-w-xl mx-auto",children:"Press play in your head. This is what your team sees the moment they hit Record on a real claims-processing workflow."})]}),n.jsx(G.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.7,delay:.1},className:"mb-12",children:n.jsx(kW,{})}),n.jsx("div",{className:"grid sm:grid-cols-3 gap-4 mb-14",children:[{icon:gl,label:"1. Click + navigate",desc:"Every action is timestamped."},{icon:oo,label:"2. Narrate the why",desc:"Voice is transcribed inline."},{icon:Mw,label:"3. Script appears",desc:"Reviewable, editable, runnable."}].map((t,e)=>n.jsxs("div",{className:"bg-cream rounded-xl border border-warm-border p-5 flex items-start gap-3",children:[n.jsx("div",{className:"w-9 h-9 bg-olive/10 rounded-lg flex items-center justify-center shrink-0",children:n.jsx(t.icon,{className:"w-4 h-4 text-olive"})}),n.jsxs("div",{children:[n.jsx("div",{className:"font-semibold text-ink text-sm mb-0.5",children:t.label}),n.jsx("div",{className:"text-warm-gray text-xs",children:t.desc})]})]},e))}),n.jsxs("div",{className:"bg-ink rounded-2xl p-8 sm:p-12 text-center",children:[n.jsx(lo,{className:"w-8 h-8 text-olive mx-auto mb-4"}),n.jsx("h2",{className:"font-serif text-2xl sm:text-3xl text-white mb-3",children:"Try it on your own workflow"}),n.jsx("p",{className:"text-white/60 mb-6 max-w-md mx-auto text-sm",children:"Install the Chrome extension, hit Start, and capture your first workflow in under a minute."}),n.jsxs(Ae,{href:"/signup",className:"inline-flex items-center gap-2 bg-olive hover:bg-olive-dark text-white px-7 py-3.5 rounded-full font-semibold transition-all text-sm","data-testid":"link-demo-cta",children:["Start Free",n.jsx(kn,{className:"w-4 h-4"})]})]})]})})}const Vf={free:{name:"Free",price:"$0",cadence:"forever",cta:"Create free account",bullets:["3 captures / month","Basic SOP generation","Markdown export","Single user"],note:"No credit card. No expiration. Upgrade anytime."},pro:{name:"Pro",price:"$49",cadence:"per month",cta:"Subscribe to Pro",bullets:["25 captures / month","SOP + training guide","JSON + Markdown export","Workflow library"],note:"Cancel anytime from your billing settings."},team:{name:"Team",price:"$199",cadence:"per month",cta:"Subscribe to Team",bullets:["Up to 5 users","100 captures / month","Shared workflow library","Priority support"],note:"Cancel anytime from your billing settings."},business:{name:"Business",price:"$499",cadence:"per month",cta:"Subscribe to Business",bullets:["Up to 10 users","250 captures / month","Advanced AI scripts","Review workflow"],note:"Cancel anytime from your billing settings."},enterprise:{name:"Enterprise",price:"Custom",cadence:"annual",cta:"Request a call",bullets:["Custom users & volume","SSO / SAML","Audit logs","Custom integrations"],note:"We'll be in touch within one business day to schedule a call."}};function CW(){const[t]=Al(),[e,s]=j.useState("free"),[r,i]=j.useState(""),[a,l]=j.useState(""),[d,u]=j.useState(""),[m,p]=j.useState(""),[x,g]=j.useState("idle"),[b,v]=j.useState(""),[k,N]=j.useState(null);j.useEffect(()=>{const E=typeof window<"u"?window.location.search:"",T=new URLSearchParams(E).get("plan");T&&T in Vf&&s(T)},[t]);const S=Vf[e],A=async E=>{if(E.preventDefault(),v(""),!r.includes("@")||!a.trim()){v("Please fill in your name and a valid email."),g("error");return}g("submitting");try{const _=await fetch("/api/wc-signup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r.trim(),name:a.trim(),company:d.trim(),plan:e,source:"workflowcapture-signup"})}),T=await _.json();if(!_.ok){v(T?.error||"Something went wrong. Please try again."),g("error");return}N(T.portalUrl||null),g("success")}catch{v("Network error. Please try again."),g("error")}};return x==="success"?n.jsx("div",{className:"pt-32 sm:pt-40 pb-20 px-4 min-h-[80vh] flex items-center justify-center bg-[#f4f1eb]",children:n.jsxs(G.div,{initial:{opacity:0,y:20}
29,animate:{opacity:1,y:0},className:"max-w-md w-full bg-white border border-[#ddd9d1] rounded-[22px] p-8 text-center","data-testid":"signup-success",children:[n.jsx("div",{className:"w-14 h-14 bg-[#e7f1e9] rounded-full flex items-center justify-center mx-auto mb-4",children:n.jsx(vs,{className:"w-7 h-7 text-olive-dark"})}),n.jsx("h1",{className:"font-serif text-2xl text-ink mb-2",children:e==="enterprise"?"Got it. We'll be in touch.":"You're in."}),n.jsx("p",{className:"text-warm-gray text-sm mb-6",children:e==="enterprise"?"We've received your request and will reach out within one business day to schedule a call.":"Your account is ready. Open your portal to start capturing your first workflow — you can upgrade to a paid plan anytime."}),k&&e!=="enterprise"&&n.jsxs("a",{href:k,className:"inline-flex items-center justify-center gap-2 w-full bg-olive-dark hover:bg-olive text-white px-6 py-3 rounded-full font-semibold text-sm mb-3","data-testid":"link-open-portal",children:["Open your portal",n.jsx(kn,{className:"w-4 h-4"})]}),n.jsx(Ae,{href:"/",className:"inline-flex items-center gap-2 text-warm-gray hover:text-ink text-xs","data-testid":"link-back-home",children:"← Back to home"})]})}):n.jsxs("div",{className:"min-h-screen bg-[#f4f1eb]","data-testid":"page-wc-signup",children:[n.jsxs("header",{className:"px-6 sm:px-10 py-5 flex items-center justify-between",children:[n.jsxs(Ae,{href:"/",className:"flex items-center gap-2","data-testid":"link-brand",children:[n.jsx("div",{className:"w-8 h-8 bg-olive-dark rounded-lg flex items-center justify-center",children:n.jsx(ii,{className:"w-4 h-4 text-white"})}),n.jsx("span",{className:"font-black text-lg text-ink",children:"Workflow Capture"})]}),n.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[n.jsx("span",{className:"text-warm-gray hidden sm:inline",children:"Already have an account?"}),n.jsx(Ae,{href:"/signin",className:"inline-flex items-center px-4 py-2 rounded-full bg-white border border-[#ddd9d1] text-ink font-semibold hover:border-olive-dark transition-all","data-testid":"link-nav-signin",children:"Sign in"})]})]}),n.jsx("div",{className:"px-4 sm:px-6 pb-12",children:n.jsxs("div",{className:"max-w-6xl mx-auto rounded-[28px] overflow-hidden border border-[#ddd9d1] bg-white grid lg:grid-cols-2",children:[n.jsxs(G.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.5},className:"relative overflow-hidden p-8 sm:p-12 text-white",style:{background:"radial-gradient(circle at 88% 14%, rgba(255,255,255,0.07), transparent 32%), linear-gradient(135deg, #184832 0%, #20543a 46%, #2f6148 100%)"},children:[n.jsx("div",{className:"absolute pointer-events-none hidden lg:block",style:{right:"-220px",top:"-180px",width:"560px",height:"780px",borderRadius:"999px",border:"54px solid rgba(255,255,255,0.07)",transform:"rotate(18deg)"}}),n.jsxs("div",{className:"relative z-10",children:[n.jsx("span",{className:"inline-flex items-center gap-2 bg-white/10 border border-white/15 text-white/90 px-3 py-1 rounded-full text-[11px] font-bold uppercase tracking-[0.14em] mb-7",children:"Start your workspace"}),n.jsxs("h1",{className:"font-serif text-4xl sm:text-5xl text-white mb-5 leading-[1.05] tracking-tight",children:["Capture the work once.",n.jsx("br",{}),n.jsxs("span",{className:"text-cream",children:["Reuse the knowledge",n.jsx("br",{}),"everywhere."]})]}),n.jsx("p",{className:"text-white/75 text-sm sm:text-base leading-relaxed mb-8 max-w-md",children:"Create a workspace for turning real browser workflows into SOPs, training guides, AI-agent scripts, and reviewable process knowledge."}),n.jsx("div",{className:"rounded-2xl bg-white/[0.07] border border-white/15 backdrop-blur-sm p-5 space-y-3 max-w-md",children:[{label:"No credit card required",value:"Free"},{label:"Password fields excluded",value:"Always"},{label:"First outputs",value:"SOP"}].map((E,_)=>n.jsxs("div",{className:"flex items-center justify-between text-sm border-t border-white/10 pt-3 first:border-t-0 first:pt-0",children:[n.jsx("span",{className:"text-white/70",children:E.label}),n.jsx("span",{className:"font-semibold text-cream",children:E.value})]},_))}),n.jsxs("div",{className:"mt-8 rounded-2xl bg-[#fbfaf6] border border-white/15 p-4 max-w-md",children:[n.jsxs("div",{className:"flex items-center gap-1.5 mb-3",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-[#ddd9d1]"}),n.jsx("span",{className:"w-2 h-2 rounded-full bg-[#ddd9d1]"}),n.jsx("span",{className:"w-2 h-2 rounded-full bg-[#ddd9d1]"})]}),n.jsxs("div",{className:"space-y-2 mb-3",children:[n.jsx("div",{className:"h-1.5 rounded-full bg-[#ddd9d1] w-11/12"}),n.jsx("div",{className:"h-1.5 rounded-full bg-[#ddd9d1] w-9/12"}),n.jsx("div",{className:"h-1.5 rounded-full bg-[#ddd9d1] w-10/12"})]}),n.jsxs("div",{className:"rounded-xl bg-[#e7f1e9] px-3 py-2.5 flex items-center justify-between",children:[n.jsx("span",{className:"text-[11px] font-semibold text-olive-dark",children:"Workflow ready"}),n.jsx("span",{className:"text-[11px] font-semibold text-olive-dark",children:"Generate"})]})]})]})]}),n.jsxs(G.div,{initial:{opacity:0,x:20}
29,animate:{opacity:1,x:0},transition:{duration:.5},className:"bg-[#fbfaf6] p-8 sm:p-12",children:[n.jsx(Ae,{href:"/",className:"text-warm-gray hover:text-ink text-xs mb-6 inline-block","data-testid":"link-back-to-home",children:"← Back to Workflow Capture"}),n.jsx("h2",{className:"font-serif text-3xl sm:text-4xl text-ink mb-2 tracking-tight",children:"Create your account"}),n.jsx("p",{className:"text-warm-gray text-sm mb-6",children:"Start free. Upgrade when your team is ready."}),n.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-2 mb-5",children:Object.keys(Vf).map(E=>{const _=Vf[E],T=e===E;return n.jsxs("button",{type:"button",onClick:()=>s(E),className:`text-center px-2 py-3 rounded-xl border text-xs transition-all ${T?"border-olive-dark bg-[#e7f1e9] text-olive-dark":"border-[#ddd9d1] bg-white text-ink hover:border-olive-dark/40"}`,"data-testid":`button-plan-${E}`,children:[n.jsx("div",{className:"font-bold leading-tight",children:_.name}),n.jsx("div",{className:`text-[10px] mt-0.5 ${T?"text-olive-dark/80":"text-warm-gray"}`,children:_.price})]},E)})}),n.jsxs("form",{onSubmit:A,className:"space-y-3",children:[n.jsx(Ff,{letter:"N",type:"text",placeholder:"Your name",value:a,onChange:l,testId:"input-name",required:!0}),n.jsx(Ff,{letter:"@",type:"email",placeholder:"[email protected]",value:r,onChange:i,testId:"input-email",required:!0}),n.jsx(Ff,{letter:"C",type:"text",placeholder:e==="free"?"Company or workspace name":"Company",value:d,onChange:u,testId:"input-company",required:e!=="free"}),n.jsx(Ff,{letter:"L",type:"password",placeholder:"Password",value:m,onChange:p,testId:"input-password",required:!0}),b&&n.jsx("div",{role:"alert","aria-live":"polite",className:"text-red-700 text-xs bg-red-50 border border-red-100 rounded-lg px-3 py-2","data-testid":"text-signup-error",children:b}),n.jsx("button",{type:"submit",disabled:x==="submitting",className:"w-full inline-flex items-center justify-center gap-2 bg-olive-dark hover:bg-olive disabled:opacity-60 text-white px-6 py-3.5 rounded-full font-semibold transition-all text-sm shadow-md","data-testid":"button-signup-submit",children:x==="submitting"?"Creating your account…":`${S.cta} →`}),n.jsxs("button",{type:"button",className:"w-full inline-flex items-center justify-center gap-2 bg-white border border-[#ddd9d1] hover:border-olive-dark text-ink px-4 py-3 rounded-full font-semibold transition-all text-sm","data-testid":"button-signup-google",children:[n.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-full bg-[#e7f1e9] text-olive-dark text-[10px] font-bold",children:"G"}),"Continue with Google"]}),n.jsxs("p",{className:"text-warm-gray/70 text-[11px] text-center pt-2 leading-relaxed",children:["By signing up you agree to our Terms and Privacy Policy. ",S.note]})]}),n.jsxs("div",{className:"mt-6 rounded-2xl border border-[#ddd9d1] bg-white p-5",children:[n.jsxs("div",{className:"flex items-start justify-between mb-3",children:[n.jsx("h3",{className:"font-serif text-xl text-ink",children:S.name}),n.jsx("span",{className:"text-[10px] font-bold text-olive-dark bg-[#e7f1e9] px-2.5 py-1 rounded-full uppercase tracking-[0.14em]",children:S.price==="$0"?"$0 forever":`${S.price} ${S.cadence}`})]}),n.jsx("ul",{className:"space-y-1.5 text-sm text-ink",children:S.bullets.map((E,_)=>n.jsxs("li",{className:"flex items-start gap-2",children:[n.jsx(vs,{className:"w-3.5 h-3.5 text-olive-dark mt-0.5 shrink-0"}),n.jsx("span",{children:E})]},_))}),n.jsx(Ae,{href:"/#pricing",className:"inline-block text-xs text-olive-dark hover:underline font-semibold mt-3",children:"Compare all plans →"})]})]})]})})]})}function Ff({letter:t,type:e,placeholder:s,value:r,onChange:i,testId:a,required:l}){return n.jsxs("div",{className:"relative",children:[n.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 inline-flex items-center justify-center w-7 h-7 rounded-full bg-[#e7f1e9] text-olive-dark text-[11px] font-bold",children:t}),n.jsx("input",{type:e,required:l,placeholder:s,"aria-label":s,value:r,onChange:d=>i(d.target.value),autoComplete:e==="password"?"new-password":e==="email"?"email":s.toLowerCase().includes("name")&&!s.toLowerCase().includes("company")?"name":s.toLowerCase().includes("company")?"organization":void 0,className:"w-full bg-white border border-[#ddd9d1] text-ink rounded-full pl-12 pr-4 py-3 text-sm outline-none focus:ring-2 focus:ring-olive-dark/30 focus:border-olive-dark","data-testid":a})]})}function TW(){const[t,e]=j.useState(""),[s,r]=j.useState("idle"),[i,a]=j.useState(""),[l,d]=j.useState(""),[u,m]=j.useState(null),[p,x]=j.useState(""),g=async v=>{if(v.preventDefault(),a(""),d(""),!t.includes("@")){a("Please enter a valid email address."),r("error");return}r("submitting");try{const k=await fetch("/api/wc-signin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t})}),N=await k.json();if(!k.ok){a(N.error||"Something went wrong. Please try again."),r("error");return}x(N.message||"Sign-in link sent. Check your email."),m(N.portalUrl||null),r("sent")}catch(k){a(k?.message||"Network error. Please try again."),r("error")}},b=()=>{a(""),d("Google sign-in is launching soon. For now, sign in with your email — we'll send you a secure one-click link.")};return s==="sent"?n.jsx("div",{className:"pt-32 sm:pt-40 pb-20 px-4 min-h-[80vh] flex items-center justify-center bg-[#f4f1eb]",children:n.jsxs(G.div,{initial:{opacity:0,y:20}
29,animate:{opacity:1,y:0},className:"max-w-md w-full bg-white border border-[#ddd9d1] rounded-[22px] p-8 text-center","data-testid":"signin-success",children:[n.jsx("div",{className:"w-14 h-14 bg-[#e7f1e9] rounded-full flex items-center justify-center mx-auto mb-4",children:n.jsx(vs,{className:"w-7 h-7 text-olive-dark"})}),n.jsx("h1",{className:"font-serif text-2xl text-ink mb-2",children:"Check your email"}),n.jsx("p",{className:"text-warm-gray text-sm mb-2",children:p}),n.jsxs("p",{className:"text-warm-gray text-xs mb-6",children:["We sent a one-click sign-in link to ",n.jsx("strong",{className:"text-ink",children:t}),". The link expires in 15 minutes."]}),u&&n.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3 mb-6 text-left",children:[n.jsx("p",{className:"text-xs font-bold text-amber-900 mb-1",children:"Dev shortcut"}),n.jsx("p",{className:"text-xs text-amber-800 leading-relaxed mb-2",children:"Skip the email and jump straight into the portal:"}),n.jsxs("a",{href:u,className:"inline-flex items-center gap-2 bg-amber-600 hover:bg-amber-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-colors","data-testid":"link-dev-portal",children:["Open portal now",n.jsx(kn,{className:"w-3 h-3"})]})]}),n.jsxs("div",{className:"flex items-center justify-center gap-4 text-xs",children:[n.jsx("button",{onClick:()=>{r("idle"),e(""),m(null)},className:"text-warm-gray hover:text-ink font-semibold","data-testid":"button-signin-different-email",children:"Use a different email"}),n.jsx("span",{className:"text-[#ddd9d1]",children:"•"}),n.jsx(Ae,{href:"/",className:"text-olive-dark hover:underline font-semibold",children:"Back to home"})]})]})}):n.jsxs("div",{className:"min-h-screen bg-[#f4f1eb]","data-testid":"page-wc-signin",children:[n.jsxs("header",{className:"px-6 sm:px-10 py-5 flex items-center justify-between",children:[n.jsxs(Ae,{href:"/",className:"flex items-center gap-2","data-testid":"link-brand",children:[n.jsx("div",{className:"w-8 h-8 bg-olive-dark rounded-lg flex items-center justify-center",children:n.jsx(ii,{className:"w-4 h-4 text-white"})}),n.jsx("span",{className:"font-black text-lg text-ink",children:"Workflow Capture"})]}),n.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[n.jsx("span",{className:"text-warm-gray hidden sm:inline",children:"New to Workflow Capture?"}),n.jsx(Ae,{href:"/signup",className:"inline-flex items-center px-4 py-2 rounded-full bg-white border border-[#ddd9d1] text-ink font-semibold hover:border-olive-dark transition-all","data-testid":"link-nav-start-free",children:"Start free"})]})]}),n.jsxs("div",{className:"px-4 sm:px-6 pb-12",children:[n.jsxs("div",{className:"max-w-6xl mx-auto rounded-[28px] overflow-hidden border border-[#ddd9d1] bg-white grid lg:grid-cols-2",children:[n.jsxs(G.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.5},className:"bg-[#fbfaf6] p-8 sm:p-12",children:[n.jsx(Ae,{href:"/",className:"text-warm-gray hover:text-ink text-xs mb-6 inline-block","data-testid":"link-back-to-home",children:"← Back to Workflow Capture"}),n.jsx("h2",{className:"font-serif text-3xl sm:text-4xl text-ink mb-2 tracking-tight",children:"Sign in to your portal"}),n.jsx("p",{className:"text-warm-gray text-sm mb-6 leading-relaxed",children:"Access your captured workflows, generated outputs, and review queue."}),n.jsxs("div",{className:"rounded-xl bg-[#e7f1e9] border border-olive-dark/15 px-4 py-3 mb-4 flex items-start gap-2.5",children:[n.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-full bg-olive-dark text-white text-[10px] font-bold mt-0.5 shrink-0",children:"✓"}),n.jsxs("p",{className:"text-[12px] text-ink leading-relaxed",children:[n.jsx("span",{className:"font-semibold",children:"No password needed."})," Enter your email and we'll send you a one-click sign-in link."]})]}),n.jsxs("form",{onSubmit:g,className:"space-y-3",children:[n.jsx(EW,{letter:"@",type:"email",placeholder:"[email protected]",value:t,onChange:e,testId:"input-signin-email",required:!0,autoFocus:!0}),i&&n.jsx("div",{role:"alert","aria-live":"polite",className:"text-red-700 text-xs bg-red-50 border border-red-100 rounded-lg px-3 py-2","data-testid":"text-signin-error",children:i}),l&&n.jsx("div",{role:"status","aria-live":"polite",className:"text-olive-dark text-xs bg-[#e7f1e9] border border-olive-dark/20 rounded-lg px-3 py-2","data-testid":"text-signin-info",children:l}),n.jsx("button",{type:"submit",disabled:s==="submitting",className:"w-full inline-flex items-center justify-center gap-2 bg-olive-dark hover:bg-olive disabled:opacity-60 text-white px-6 py-3.5 rounded-full font-semibold transition-all text-sm shadow-md","data-testid":"button-signin-submit",children:s==="submitting"?"Sending link…":"Email me a sign-in link →"}),n.jsxs("button",{type:"button",onClick:b,className:"w-full inline-flex items-center justify-center gap-2 bg-white border border-[#ddd9d1] hover:border-olive-dark text-ink px-4 py-3 rounded-full font-semibold transition-all text-sm","data-testid":"button-signin-google",children:[n.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-full bg-[#e7f1e9] text-olive-dark text-[10px] font-bold",children:"G"}),"Continue with Google"]})]}),n.jsx("p",{className:"text-warm-gray/80 text-[11px] text-center mt-5 leading-relaxed",children:"Workflow Capture uses passwordless sign-in — no password to remember or reset."})]}),n.jsxs(G.div,{initial:{opacity:0,x:20}
29,animate:{opacity:1,x:0},transition:{duration:.5},className:"relative overflow-hidden p-8 sm:p-12 text-white",style:{background:"radial-gradient(circle at 88% 14%, rgba(255,255,255,0.07), transparent 32%), linear-gradient(135deg, #184832 0%, #20543a 46%, #2f6148 100%)"},children:[n.jsx("div",{className:"absolute pointer-events-none hidden lg:block",style:{right:"-220px",top:"-180px",width:"560px",height:"780px",borderRadius:"999px",border:"54px solid rgba(255,255,255,0.07)",transform:"rotate(18deg)"}}),n.jsxs("div",{className:"relative z-10",children:[n.jsx("span",{className:"inline-flex items-center gap-2 bg-white/10 border border-white/15 text-white/90 px-3 py-1 rounded-full text-[11px] font-bold uppercase tracking-[0.14em] mb-7",children:"Welcome back"}),n.jsxs("h1",{className:"font-serif text-4xl sm:text-5xl text-white mb-5 leading-[1.05] tracking-tight",children:["Return to your",n.jsx("br",{}),n.jsx("span",{className:"text-cream",children:"workflow knowledge hub."})]}),n.jsx("p",{className:"text-white/75 text-sm sm:text-base leading-relaxed mb-8 max-w-md",children:"Pick up where your team left off: review captures, generate outputs, approve SOPs, and export AI-ready workflows."}),n.jsx("div",{className:"rounded-2xl bg-white/[0.07] border border-white/15 backdrop-blur-sm p-5 space-y-3 max-w-md",children:[{label:"Workflows captured",value:"12"},{label:"Awaiting review",value:"3"},{label:"Outputs generated",value:"24"}].map((v,k)=>n.jsxs("div",{className:"flex items-center justify-between text-sm border-t border-white/10 pt-3 first:border-t-0 first:pt-0",children:[n.jsx("span",{className:"text-white/70",children:v.label}),n.jsx("span",{className:"font-semibold text-cream",children:v.value})]},k))}),n.jsxs("div",{className:"mt-8 rounded-2xl bg-[#fbfaf6] border border-white/15 p-4 max-w-md",children:[n.jsxs("div",{className:"flex items-center gap-1.5 mb-3",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-[#ddd9d1]"}),n.jsx("span",{className:"w-2 h-2 rounded-full bg-[#ddd9d1]"}),n.jsx("span",{className:"w-2 h-2 rounded-full bg-[#ddd9d1]"})]}),n.jsxs("div",{className:"space-y-2 mb-3",children:[n.jsx("div",{className:"h-1.5 rounded-full bg-[#ddd9d1] w-11/12"}),n.jsx("div",{className:"h-1.5 rounded-full bg-[#ddd9d1] w-9/12"}),n.jsx("div",{className:"h-1.5 rounded-full bg-[#ddd9d1] w-10/12"})]}),n.jsxs("div",{className:"rounded-xl bg-[#e7f1e9] px-3 py-2.5 flex items-center justify-between",children:[n.jsx("span",{className:"text-[11px] font-semibold text-olive-dark",children:"3 reviews ready"}),n.jsx("span",{className:"text-[11px] font-semibold text-olive-dark",children:"Open"})]})]})]})]})]}),n.jsxs("p",{className:"text-center text-xs text-warm-gray mt-6",children:["Trouble signing in? ",n.jsx("a",{href:"mailto:[email protected]",className:"text-olive-dark hover:underline",children:"Email support"})]})]})]})}function EW({letter:t,type:e,placeholder:s,value:r,onChange:i,testId:a,required:l,autoFocus:d}){return n.jsxs("div",{className:"relative",children:[n.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 inline-flex items-center justify-center w-7 h-7 rounded-full bg-[#e7f1e9] text-olive-dark text-[11px] font-bold",children:t}),n.jsx("input",{type:e,required:l,placeholder:s,"aria-label":s,value:r,onChange:u=>i(u.target.value),autoFocus:d,autoComplete:e==="password"?"current-password":e==="email"?"email":void 0,className:"w-full bg-white border border-[#ddd9d1] text-ink rounded-full pl-12 pr-4 py-3 text-sm outline-none focus:ring-2 focus:ring-olive-dark/30 focus:border-olive-dark","data-testid":a})]})}const $O="May 2, 2026",ti="[email protected]",iT="Workflow Capture (a product of Deverus)";function BO(){return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"bg-white border border-warm-border rounded-2xl p-6 sm:p-8 mb-10",children:[n.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[n.jsx(Ix,{className:"w-5 h-5 text-olive flex-shrink-0 mt-0.5"}),n.jsx("h2",{className:"font-serif text-2xl text-ink",children:"In plain English"})]}),n.jsxs("ul",{className:"space-y-2.5 text-sm text-ink/90 leading-relaxed",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"We never record your screen."})," The Workflow Capture browser extension records the actions you take (clicks, navigation, text you typed) — not pixels."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Password fields are excluded."})," The extension is hardcoded to skip values entered into any field marked as a password."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"You review before anything is sent."}),' Captures stay on your device until you click "Send" — you can edit, delete, or discard them first.']}),n.jsxs("li",{children:[n.jsx("strong",{children:"Voice narration is optional."})," If you enable it, audio is sent to OpenAI's Whisper model for transcription, then deleted."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"We don't sell your data."})," Ever. To anyone."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"You can delete everything."})," Email us and we'll permanently remove your account and all captured workflows within 30 days."]})]})]}),n.jsxs(Cr,{title:"1. Who we are",children:[n.jsxs(gn,{children:[iT,' 
29("we," "us," "our") provides Workflow Capture, a Chrome browser extension and web service that helps teams document business workflows by recording browser actions and turning them into Standard Operating Procedures (SOPs), training guides, and AI-ready scripts.']}),n.jsxs(gn,{children:["This Privacy Policy explains what we collect, how we use it, who we share it with, and the choices you have. If you have questions, contact us at ",n.jsx("a",{href:`mailto:${ti}`,className:"text-olive font-semibold hover:underline",children:ti}),"."]})]}),n.jsxs(Cr,{title:"2. What the Chrome extension captures",children:[n.jsx(gn,{children:"When you start a recording in the Workflow Capture browser extension, we capture the following from the active tab:"}),n.jsx(Ko,{items:[n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"User-initiated actions:"})," clicks, form field entries, page navigations, scrolls, and similar interactions you perform."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Page metadata:"})," URLs, page titles, and the visible labels of the buttons or links you interact with — used to describe each step in plain English."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"DOM element selectors:"}),' CSS-style identifiers (e.g. "#submit-button") so the workflow can be replayed or automated later.']}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Optional voice narration:"})," if you enable the microphone button, your spoken explanation is captured as audio."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Timestamps:"})," when each step occurred so we can show the workflow in order."]})]}),n.jsx("h3",{className:"font-bold text-ink mt-6 mb-2",children:"What we do NOT capture"}),n.jsx(Ko,{items:[n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Screen pixels."})," No screenshots or video recordings of your screen are taken."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Password fields."})," Any input flagged as ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:'type="password"'})," is excluded from the capture stream."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Backgroun
29d activity."})," The extension only listens on tabs where you have explicitly started a recording. Other tabs and windows are ignored."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Files on your device."})," The extension cannot read your local files, downloads, or anything outside the browser."]})]})]}),n.jsxs(Cr,{title:"3. Account and billing data",children:[n.jsx(gn,{children:"When you sign up for an account at workflowcapture.ai, we collect:"}),n.jsx(Ko,{items:["Your name and email address","Your company name (optional on free plan)","An encrypted password","Plan tier and subscription status","Billing information (collected and stored by our payment processor when monetization launches — we never see your full card number)"]})]}),n.jsxs(Cr,{title:"4. How we use your data",children:[n.jsx(gn,{children:"We use the information we collect to:"}),n.jsx(Ko,{items:["Generate SOPs, training guides, and AI scripts from the workflows you capture","Provide your account, dashboard, and billing functionality","Send you transactional email (magic-link logins, billing receipts, security notices)","Detect fraud and abuse and keep the service secure","Improve the product (in aggregated, de-identified form only)"]}),n.jsxs(gn,{className:"mt-4",children:["We do ",n.jsx("strong",{children:"not"})," use your captured workflows to train machine learning models. We do ",n.jsx("strong",{children:"not"})," sell, rent, or trade your personal information to third parties for their marketing purposes."]})]}),n.jsxs(Cr,{title:"5. Third parties and subprocessors",children:[n.jsx(gn,{children:"To provide the service we share data with the following processors. Each is contractually bound to use your data only to deliver service to us:"}),n.jsx(Ko,{items:[n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Amazon Web Services (AWS):"})," hosting, database, file storage. Region: US."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"OpenAI:"})," SOP generation and (if enabled) Whisper voice transcription. Per OpenAI's policy, API inputs are not used to train their models."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Resend:"})," transactional email delivery."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Google Chrome Web Store:"})," distribution of the browser extension."]})]})]}),n.jsx(Cr,{title:"6. How long we keep your data",children:n.jsx(Ko,{items:[n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Captured workflows:"})," retained for the lifetime of your account, or until you delete them."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Voice audio:"})," deleted immediately after transcription completes (typically within 60 seconds)."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Account data:"})," retained while your account is active."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"After account deletion:"})," permanently erased within 30 days, except where law requires retention (e.g. tax records)."]}),n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:"Backups:"})," may persist in encrypted backups for up to 90 days before being overwritten."]})]})}),n.jsxs(Cr,{title:"7. Security",children:[n.jsx(gn,{children:"All data is encrypted in transit (TLS 1.2+) and at rest (AES-256). Access to production systems is restricted to a small number of authorized personnel and protected by multi-factor authentication. We follow industry-standard security practices and are working toward SOC 2 Type II attestation."}),n.jsxs(gn,{children:["That said, no system is perfectly secure. If you discover a security issue please email ",n.jsx("a",{href:`mailto:${ti}`,className:"text-olive font-semibold hover:underline",children:ti}),"."]})]}),n.jsxs(Cr,{title:"8. Your rights",children:[n.jsx(gn,{children:"Depending on where you live (e.g. EU, UK, California), you may have the right to:"}),n.jsx(Ko,{items:["Access the personal data we hold about you","Correct inaccurate data","Delete your data (subject to legal retention requirements)","Export your data in a portable format","Object to or restrict certain processing","Withdraw consent for optional processing (e.g. voice narration)"]}),n.jsxs(gn,{className:"mt-4",children:["To exercise any of these rights, email ",n.jsx("a",{href:`mailto:${ti}`,className:"text-olive font-semibold hover:underline",children:ti}),". We respond within 30 days."]})]}),n.jsxs(Cr,{title:"9. Chrome Web Store disclosures",children:[n.jsx(gn,{children:"Per Google's Chrome Web Store User Data Policy, we explicitly affirm:"}),n.jsx(Ko,{items:["We collect only the user data described above.","We use that data only to provide and improve the Workflow Capture service — not to sell to third parties, not to advertise, not to determine creditworthiness, and not to facilitate any purpose unrelated to the product.","We do not transfer your data to third parties except the subprocessors listed in Section 5, or as required by law.","We comply with the Chrome Web Store Limited Use requirements."]})]}),n.jsx(Cr,{title:"10. Children",children:n.jsx(gn,{children:"Workflow Capture is intended for business use by adults. We do not knowingly collect personal information from anyone under 16. If you believe a child has provided us data, please contact us and we'll delete it."})}),n.jsx(Cr,{title:"11. International transfers",children:n.jsx(gn,{children:"Our servers are located in the United States. If you access the service from outside the US, your data will be transferred to and processed in the US. Where required (e.g. for EU customers), we rely on Standard Contractual Clauses to safeguard those transfers."})}),n.jsx(Cr,{title:"12. Changes to this policy",children:n.jsx(gn,{children:`We may update this policy from time to time. If we make material changes we'll notify you by email and post a notice on this page. The "Last updated" date at the top reflects the most recent revision.`})}),n.jsxs(Cr,{title:"13. Contact us",children:[n.jsxs(gn,{children:["For privacy questions, data requests, or anything else: ",n.jsx("a",{href:`mailto:${ti}`,className:"text-olive font-semibold hover:underline",children:ti})]}),n.jsxs(gn,{children:[iT,n.jsx("br",{}),"United States"]})]})]})}function Cr({title:t,children:e}){return n.jsxs("section",{className:"mb-10","data-testid":`section-${t.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,40)}`,children:[n.jsxs("h2",{className:"font-serif text-2xl text-ink mb-3 flex items-center gap-2",children:[n.jsx(Mi,{className:"w-4 h-4 text-olive"}),t]}),n.jsx("div",{className:"space-y-3 text-sm text-ink/90 leading-relaxed",children:e})]})}function gn({children:t,className:e=""}){return n.jsx("p",{className:`text-sm text-ink/90 leading-relaxed ${e}`,children:t})}function Ko({items:t}){return n.jsx("ul",{className:"space-y-2 mt-2 text-sm text-ink/90",children:t.map((e,s)=>n.jsxs("li",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-olive flex-shrink-0 mt-2"}),n.jsx("span",{className:"leading-relaxed",children:e})]},s))})}const wv="Privacy Policy — Workflow Capture",jv="Privacy policy for the Workflow Capture Chrome extension and web service. Details what data the extension captures, how it's used, subprocessors, retention, user rights, and Chrome Web Store Limited Use disclosures.",AW="https://workflowcapture.ai/privacy";function yi(t,e,s){let r=document.head.querySelector(t);if(!r){if(t.startsWith("link"))r=document.createElement("link"),r.rel="canonical";else{r=document.createElement("meta");const i=t.match(/\[(name|property)="([^"]+)"\]/);i&&r.setAttribute(i[1],i[2])}document.head.appendChild(r)}r.setAttribute(e,s)}function aT(){return j.useEffect(()=>{const t=document.title,e=document.head.querySelector('meta[name="description"]')?.getAttribute("content")||"",s=document.head.querySelector('meta[property="og:title"]')?.getAttribute("content")||"",r=document.head.querySelector('meta[property="og:description"]')?.getAttribute("content")||"",i=document.head.querySelector('link[rel="canonical"]')?.getAttribute("href")||"";return document.title=wv,yi('meta[name="description"]',"content",jv),yi('meta[property="og:title"]',"content",wv),yi('meta[property="og:description"]',"content",jv),yi('meta[name="twitter:title"]',"content",wv),yi('meta[name="twitter:description"]',"content",jv),yi('link[rel="canonical"]',"href",AW),yi('meta[name="robots"]',"content","index, follow"),()=>{document.title=t,e&&yi('meta[name="description"]',"content",e),s&&yi('meta[property="og:title"]',"content",s),r&&yi('meta[property="og:description"]',"content",r),i&&yi('link[rel="canonical"]',"href",i)}},[]),n.jsx("div",{className:"min-h-screen bg-cream text-ink font-sans antialiased","data-testid":"page-wc-privacy",children:n.jsxs("main",{className:"max-w-3xl mx-auto px-4 sm:px-6 pt-10 sm:pt-14 pb-16 sm:pb-20",children:[n.jsxs("div",{className:"mb-10",children:[n.jsxs("span",{className:"inline-flex items-center gap-2 text-xs font-bold text-olive bg-olive/10 px-3 py-1 rounded-full mb-4 uppercase tracking-wider",children:[n.jsx(po,{className:"w-3.5 h-3.5"}),"Privacy"]}),n.jsx("h1",{className:"font-serif text-4xl sm:text-5xl text-ink mb-3 leading-tight tracking-tight",children:"Privacy Policy"}),n.jsx("p",{className:"text-warm-gray text-sm mb-2",children:"Workflow Capture Chrome extension and web service"}),n.jsxs("p",{className:"text-warm-gray text-sm",children:["Last updated: ",$O]}),n.jsx("div",{className:"mt-6",children:n.jsx(Ae,{href:"/",className:"text-warm-gray hover:text-ink text-sm font-semibold","data-testid":"link-back-home",children:"← Back to Workflow Capture"})})]}),n.jsx(BO,{}),n.jsxs("div",{className:"mt-16 pt-8 border-t border-warm-border flex items-center justify-between text-sm",children:[n.jsx(Ae,{href:"/",className:"text-warm-gray hover:text-ink font-semibold flex items-center gap-2","data-testid":"link-footer-home",children:"← Back to Workflow Capture"}),n.jsxs("a",{href:`mailto:${ti}`,className:"text-olive hover:text-olive-dark font-semibold flex items-center gap-2","data-testid":"link-footer-contact",children:[n.jsx(Zm,{className:"w-4 h-4"}),ti]})]})]})})}const zO="https://chromewebstore.google.com/detail/workflow-capture/pkhpfnncphblmicgplddodlmphmppobo",cN="/assets/Screenshot_2026-04-02_at_6.33.54_PM_1775172837472-BcjR0fsW.png",dN="/assets/Screenshot_2026-04-02_at_6.34.22_PM_1775172867293-n5Y6w8L6.png",uN="/assets/Screenshot_2026-04-02_at_6.34.41_PM_1775172884562-B7cr1QPZ.png",hN="/assets/Screenshot_2026-04-02_at_6.35.17_PM_1775172934906-CgCCdRKx.png",mN="/assets/Screenshot_2026-04-02_at_6.35.44_PM_1775172946111-BTwgIQgO.png",VO="/assets/Screenshot_2026-04-03_at_1.38.23_PM_1775241506892-1_34p_SD.png",oT="[email protected]",Jr={hidden:{opacity:0,y:30},visible:{opacity:1,y:0,transition:{duration:.6}}},_h={hidden:{opacity:0}
29,visible:{opacity:1,transition:{staggerChildren:.1}}};function pc({title:t,children:e,icon:s,defaultOpen:r=!1,testId:i}){const[a,l]=j.useState(r);return n.jsxs("div",{className:"bg-white rounded-xl border border-warm-border overflow-hidden",children:[n.jsxs("button",{"data-testid":i,onClick:()=>l(!a),className:"w-full flex items-center gap-3 px-6 py-4 text-left hover:bg-cream-light transition-colors",children:[n.jsx(s,{className:"w-5 h-5 text-olive flex-shrink-0"}),n.jsx("span",{className:"flex-1 font-semibold text-ink",children:t}),n.jsx(mo,{className:`w-4 h-4 text-warm-gray transition-transform ${a?"rotate-180":""}`})]}),a&&n.jsx("div",{className:"px-6 pb-6 pt-0 border-t border-warm-border",children:n.jsx("div",{className:"pt-4",children:e})})]})}function Uf({number:t,title:e,icon:s,children:r,testId:i}){const[a,l]=j.useState(!0);return n.jsxs("div",{"data-testid":i,className:"bg-white rounded-xl border border-warm-border overflow-hidden",children:[n.jsxs("button",{onClick:()=>l(!a),className:"w-full flex items-center gap-3 px-6 py-4 text-left hover:bg-cream-light transition-colors",children:[n.jsx("div",{className:"w-8 h-8 rounded-full bg-olive text-white flex items-center justify-center text-sm font-bold flex-shrink-0",children:t}),n.jsx(s,{className:"w-5 h-5 text-olive flex-shrink-0"}),n.jsx("span",{className:"flex-1 font-semibold text-ink",children:e}),n.jsx(mo,{className:`w-4 h-4 text-warm-gray transition-transform ${a?"rotate-180":""}`})]}),a&&n.jsx("div",{className:"px-6 pb-6 pt-0 border-t border-warm-border",children:n.jsx("div",{className:"pt-4",children:r})})]})}function lT(){return n.jsxs("div",{className:"min-h-screen bg-cream text-ink font-sans antialiased","data-testid":"page-wc-extension-support",children:[n.jsx("nav",{className:"fixed top-0 w-full z-50 bg-white/85 backdrop-blur-xl border-b border-warm-border",children:n.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-3 sm:py-4 flex justify-between items-center",children:[n.jsxs(Ae,{href:"/",className:"flex items-center gap-2 text-ink hover:text-olive transition-colors","data-testid":"link-nav-home",children:[n.jsx(QA,{className:"w-5 h-5 text-olive"}),n.jsx("span",{className:"font-black text-lg sm:text-xl",children:"Workflow Capture"})]}),n.jsxs("div",{className:"hidden md:flex items-center gap-8",children:[n.jsx("a",{href:"/#how",className:"text-warm-gray hover:text-ink font-medium transition-colors",children:"How it works"}),n.jsx("a",{href:"/#pricing",className:"text-warm-gray hover:text-ink font-medium transition-colors",children:"Pricing"}),n.jsx("span",{className:"text-olive font-semibold",children:"Support"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ae,{href:"/signin",className:"inline-flex items-center px-3 sm:px-4 py-2 rounded-full text-warm-gray hover:text-ink font-semibold transition-all text-xs sm:text-sm","data-testid":"button-nav-signin",children:"Sign in"}),n.jsxs(Ae,{href:"/signup",className:"inline-flex items-center px-4 py-2 rounded-full border border-olive text-olive hover:bg-olive/10 font-semibold transition-all text-xs sm:text-sm","data-testid":"button-nav-cta",children:[n.jsx("span",{className:"hidden sm:inline",children:"Get started free"}),n.jsx("span",{className:"sm:hidden",children:"Get started"}),n.jsx(kn,{className:"ml-1 w-4 h-4"})]})]})]})}),n.jsx("section",{className:"pt-28 sm:pt-36 pb-12 sm:pb-16 px-4",children:n.jsx("div",{className:"max-w-3xl mx-auto text-center",children:n.jsxs(G.div,{initial:"hidden",animate:"visible",variants:_h,children:[n.jsxs(G.div,{variants:Jr,className:"inline-flex items-center gap-2 bg-olive/10 text-olive px-4 py-1.5 rounded-full text-sm font-medium mb-6",children:[n.jsx(gj,{className:"w-4 h-4"}),"Support"]}),n.jsx(G.h1,{variants:Jr,className:"font-serif text-3xl sm:text-4xl lg:text-5xl text-ink leading-tight mb-4",children:"Extension Help & Support"}),n.jsx(G.p,{variants:Jr,className:"text-lg text-warm-gray max-w-xl mx-auto",children:"Step-by-step installation guide and troubleshooting for the Workflow Capture Chrome extension."})]})})}),n.jsx("section",{className:"pb-16 sm:pb-24 px-4",children:n.jsxs("div",{className:"max-w-3xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",
29whileInView:"visible",viewport:{once:!0},variants:_h,children:[n.jsx(G.h2,{variants:Jr,className:"font-serif text-2xl sm:text-3xl text-ink mb-2",children:"Install the Extension"}),n.jsx(G.p,{variants:Jr,className:"text-warm-gray mb-8",children:"One click from the Chrome Web Store. Takes about 30 seconds."})]}),n.jsxs("div",{className:"bg-white rounded-2xl border border-warm-border p-6 sm:p-8",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-5",children:[n.jsx("div",{className:"w-14 h-14 rounded-xl bg-olive/10 flex items-center justify-center flex-shrink-0",children:n.jsx(ii,{className:"w-7 h-7 text-olive"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h3",{className:"font-bold text-ink text-lg mb-1",children:"Workflow Capture for Chrome"}),n.jsx("p",{className:"text-sm text-warm-gray leading-relaxed",children:`Click "Add to Chrome" on the Web Store page, then click "Add extension" when prompted. That's it.`})]})]}),n.jsx("div",{className:"mt-6 flex flex-col sm:flex-row gap-3",children:n.jsxs("a",{href:zO,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-2 bg-olive hover:bg-olive-dark text-white px-6 py-3 rounded-lg text-sm font-semibold transition-colors","data-testid":"link-install-chrome-web-store",children:[n.jsx(ii,{className:"w-4 h-4"}),"Install from Chrome Web Store",n.jsx(kn,{className:"w-4 h-4"})]})}),n.jsx("div",{className:"mt-6 grid sm:grid-cols-3 gap-3",children:[{icon:vs,title:"Pin the icon",desc:"Click the puzzle piece in Chrome's toolbar, find Workflow Capture, click the pin."},{icon:oo,title:"Allow microphone",desc:"When you start your first recording Chrome will ask for mic access — click Allow."},{icon:_w,title:"Sign in to your portal",desc:"Open the extension and paste your portal URL so recordings save to your account."}].map((t,e)=>n.jsxs("div",{className:"bg-cream rounded-lg p-3 border border-warm-border",children:[n.jsx(t.icon,{className:"w-4 h-4 text-olive mb-1.5"}),n.jsx("p",{className:"text-xs font-semibold text-ink mb-0.5",children:t.title}),n.jsx("p",{className:"text-xs text-warm-gray leading-snug",children:t.desc})]},e))})]}),n.jsx("div",{className:"mt-8",children:n.jsx(pc,{title:"Advanced: install manually (developer / sideload)",icon:ym,testId:"install-manual-collapse",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-warm-gray leading-relaxed",children:"Most people should use the Chrome Web Store install above. These manual steps are only for developers or for environments where the Web Store is blocked."}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs(Uf,{number:1,title:"Download the extension zip",icon:na,testId:"install-step-1",children:[n.jsxs("p",{className:"text-sm text-warm-gray leading-relaxed mb-3",children:["Click the button below to download the extension file. A file called ",n.jsx("strong",{children:"Workflow-Capture.zip"})," will save to your computer."]}),n.jsxs("a",{href:"/Workflow-Capture.zip",download:!0,className:"inline-flex items-center gap-2 bg-olive hover:bg-olive-dark text-white px-5 py-2.5 rounded-lg text-sm font-semibold transition-colors mb-4","data-testid":"link-download-extension",children:[n.jsx(na,{className:"w-4 h-4"}),"Download Extension"]}),n.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3",children:[n.jsx("p",{className:"text-xs text-amber-900 leading-relaxed font-medium",children:"After downloading — unzip the file:"}),n.jsxs("ul",{className:"text-xs text-amber-800 leading-relaxed list-disc list-inside mt-1 space-y-1",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Mac:"})," Open Finder, go to Downloads, find ",n.jsx("strong",{children:"Workflow-Capture.zip"}),", double-click it"]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Windows:"})," Open File Explorer, go to Downloads, right-click ",n.jsx("strong",{children:"Workflow-Capture.zip"}),', select "Extract All"']}),n.jsxs("li",{children:["You'll see a folder called ",n.jsx("strong",{children:"Workflow-Capture"})," — keep it where it is"]})]})]})]}),n.jsx(Uf,{number:2,title:"Open Chrome Extensions & enable Developer mode",icon:ym,testId:"install-step-2",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:n.jsxs("p",{className:"text-xs text-red-800 leading-relaxed",children:[n.jsx("strong",{children:"Not the puzzle piece!"})," The puzzle piece icon shows a popup — you need the full Extensions settings page."]})}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-lg p-4",children:[n.jsx("p",{className:"text-sm text-ink font-semibold mb-3",children:"How to get there:"}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"A"}),n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["Click the ",n.jsx("strong",{children:"three vertical dots"})," at the top-right of Chrome."]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"B"}),n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["Hover over ",n.jsx("strong",{children:'"Extensions"'}),", then click ",n.jsx("strong",{children:'"Manage Extensions"'}),"."]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"C"}),n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["Turn the ",n.jsx("strong",{children:'"Developer mode"'})," toggle (top-right) ",n.jsx("strong",{children:"ON"}),"."]})]})]})]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx("img",{src:VO,alt:"Chrome Extensions menu",className:"rounded-lg border border-warm-border",style:{maxWidth:"280px",height:"auto"}}),n.jsx("img",{src:dN,alt:"Developer mode toggle",className:"rounded-lg border border-warm-border",style:{maxWidth:"280px",height:"auto"}})]})]})}),n.jsx(Uf,{number:3,title:"Load the extension",icon:FA,testId:"install-step-3",children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("p",{className:"text-sm text-warm-gray leading-relaxed",children:["Click ",n.jsx("strong",{children:'"L
29oad unpacked"'}),", then select the ",n.jsx("strong",{children:"Workflow-Capture"})," folder you unzipped. ",n.jsx("strong",{children:"Click once"})," on the folder (don't double-click into it), then click ",n.jsx("strong",{children:'"Select"'})," (Mac) or ",n.jsx("strong",{children:'"Select Folder"'})," (Windows)."]}),n.jsx("div",{className:"bg-olive/5 border border-olive/20 rounded-lg p-3",children:n.jsxs("p",{className:"text-xs text-olive-dark leading-relaxed",children:[n.jsx("strong",{children:"You'll know it worked"}),' when a "Workflow Capture" card appears on the extensions page and a new icon appears in your toolbar.']})}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx("img",{src:uN,alt:"Load unpacked button",className:"rounded-lg border border-warm-border",style:{maxWidth:"280px",height:"auto"}}),n.jsx("img",{src:hN,alt:"Select folder",className:"rounded-lg border border-warm-border",style:{maxWidth:"280px",height:"auto"}}),n.jsx("img",{src:cN,alt:"Extension installed",className:"rounded-lg border border-warm-border",style:{maxWidth:"280px",height:"auto"}})]})]})}),n.jsx(Uf,{number:4,title:"Allow microphone access",icon:oo,testId:"install-step-4",children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("p",{className:"text-sm text-warm-gray leading-relaxed",children:["Click the ",n.jsx("strong",{children:"puzzle piece icon"})," in Chrome's top-right, find ",n.jsx("strong",{children:'"Workflow Capture"'}),", and click it. If Chrome asks for microphone permission, click ",n.jsx("strong",{children:'"Allow"'}),"."]}),n.jsx("img",{src:mN,alt:"Ready to record",className:"rounded-lg border border-warm-border",style:{maxWidth:"300px",height:"auto"}})]})})]})]})})}),n.jsxs("div",{className:"bg-olive/10 border border-olive/20 rounded-xl p-6 text-center mt-6",children:[n.jsx(vs,{className:"w-8 h-8 text-olive mx-auto mb-2"}),n.jsx("p",{className:"font-semibold text-olive-dark mb-1",children:"You're all set!"}),n.jsx("p",{className:"text-sm text-olive",children:'Click the extension icon and hit "Start Recording" to capture your first workflow.'})]})]})}),n.jsx("section",{className:"py-16 sm:py-24 px-4 bg-white border-y border-warm-border",children:n.jsxs("div",{className:"max-w-3xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:_h,children:[n.jsx(G.h2,{variants:Jr,className:"font-serif text-2xl sm:text-3xl text-ink mb-2",children:"Troubleshooting"}),n.jsx(G.p,{variants:Jr,className:"text-warm-gray mb-8",children:"Having issues? Find solutions to common installation and recording problems below."})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx(pc,{title:"The extension won't install / I see an error",icon:IA,testId:"troubleshoot-install-error",children:n.jsxs("div",{className:"space-y-3 text-sm text-warm-gray leading-relaxed",children:[n.jsx("p",{children:n.jsx("strong",{children:"Common causes and fixes:"})}),n.jsxs("ul",{className:"space-y-2 list-disc list-inside",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Developer mode is off"})," — Go to ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome://extensions"}),' and make sure the "Developer mode" toggle (top-right) is turned ON.']}),n.jsxs("li",{children:[n.jsx("strong",{children:"Selected the wrong folder"})," — Make sure you're selecting the ",n.jsx("strong",{children:"Workflow-Capture"})," folder itself, not a file inside it or the zip file. The folder should contain a ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"manifest.json"})," file."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Didn't unzip the file"}),' — You need to unzip/extract the .zip file first. Double-click it on Mac, or right-click and "Extract All" on Windows.']}),n.jsxs("li",{children:[n.jsx("strong",{children:"Corrupt download"})," — Delete the file and re-download it from your portal."]})]})]})}),n.jsx(pc,{title:"I don't see the extension icon in Chrome",icon:ii,testId:"troubleshoot-no-icon",children:n.jsxs("div",{className:"space-y-3 text-sm text-warm-gray leading-relaxed",children:[n.jsx("p",{children:"The icon may be hidden behind the puzzle piece menu:"}),n.jsxs("ol",{className:"space-y-2 list-decimal list-inside",children:[n.jsxs("li",{children:["Click the ",n.jsx("strong",{children:"puzzle piece icon"})," in Chrome's top-right toolbar."]}),n.jsxs("li",{children:["Find ",n.jsx("strong",{children:'"Workflow Capture"'})," in the list."]}),n.jsxs("li",{children:["Click the ",n.jsx("strong",{children:"pin icon"})," next to it to keep it visible in your toolbar."]})]}),n.jsxs("p",{children:[`If "Workflow Capture" isn't in the list at all, the extension may not be installed. Go to `,n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome://extensions"})," and check if it appears there."]})]})}),n.jsx(pc,{title:"Microphone isn't working / no audio in recordings",icon:eM,testId:"troubleshoot-mic",children:n.jsxs("div",{className:"space-y-3 text-sm text-warm-gray leading-relaxed",children:[n.jsx("p",{children:n.jsx("strong",{children:"Check these settings:"})}),n.jsxs("ol",{className:"space-y-2 list-decimal list-inside",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Browser permission"}),' — Click the extension icon. If you see a microphone permission prompt, click "Allow".']}),n.jsxs("li",{children:[n.jsx("strong",{children:"System microphone"})," — Make sure your computer's microphone is not muted. On Mac, check System Preferences > Sound > Input. On Windows, check Settings > System > Sound > Input."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Other apps using the mic"})," — Close any other apps that might be using the microphone (Zoom, Teams, etc.) and try again."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Reset permissions"})," — Go to ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome://settings/content/microphone"})," and make sure the extension isn't blocked."]})]})]})}),n.jsx(pc,{title:"Recording doesn't capture my actions",icon:gl,testId:"troubleshoot-no-capture",children:n.jsxs("div",{className:"space-y-3 text-sm text-warm-gray leading-relaxed",children:[n.jsx("p",{children:n.jsx("strong",{children:"Try these steps:"})}),n.jsxs("ul",{className:"space-y-2 list-disc list-inside",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Make sure recording is active"}),' — After clicking "Start Recording," you should see a red recording indicator. If not, click the extension icon again.']}),n.jsxs("li",{children:[n.jsx("strong",{children:"Refresh the page"})," — If the extension was just installed, refresh the page you want to re
29cord on so the content script loads."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Check the page type"})," — Some special Chrome pages (",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome://"}),", ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome-extension://"}),") cannot be recorded. Navigate to a regular website."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Reinstall the extension"})," — Remove the extension from ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome://extensions"})," and load it again using the steps above."]})]})]})}),n.jsx(pc,{title:"Recording won't save / 'Save to Portal' doesn't work",icon:_w,testId:"troubleshoot-save",children:n.jsxs("div",{className:"space-y-3 text-sm text-warm-gray leading-relaxed",children:[n.jsx("p",{children:n.jsx("strong",{children:"Possible issues:"})}),n.jsxs("ul",{className:"space-y-2 list-disc list-inside",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Portal URL not set"})," — Open the extension popup and make sure your portal URL is entered in the Settings area. It should match the URL you use to access your Workflow Capture portal."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Network issue"})," — Check your internet connection. The extension needs to reach your portal to save recordings."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Empty recording"})," — If you clicked Start and Stop without performing any actions, there may be nothing to save. Try recording again with at least a few clicks or navigations."]})]})]})}),n.jsx(pc,{title:"Extension was removed or disappeared after Chrome update",icon:hb,testId:"troubleshoot-removed",children:n.jsxs("div",{className:"space-y-3 text-sm text-warm-gray leading-relaxed",children:[n.jsx("p",{children:"Chrome may disable unpacked extensions after updates. To fix:"}),n.jsxs("ol",{className:"space-y-2 list-decimal list-inside",children:[n.jsxs("li",{children:["Go to ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome://extensions"})]}),n.jsx("li",{children:'If you see Workflow Capture with an "Errors" badge or disabled toggle, click the toggle to re-enable it.'}),n.jsxs("li",{children:["If it's completely gone, re-install it by following the installation steps above. Make sure you still have the ",n.jsx("strong",{children:"Workflow-Capture"})," folder in your Downloads."]})]})]})})]})]})}),n.jsx("section",{className:"py-16 sm:py-24 px-4",children:n.jsxs("div",{className:"max-w-3xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:_h,children:[n.jsx(G.h2,{variants:Jr,className:"font-serif text-2xl sm:text-3xl text-ink mb-2",children:"Recording Tips"}),n.jsx(G.p,{variants:Jr,className:"text-warm-gray mb-8",children:"Get the best results from your workflow recordings."})]}),n.jsx("div",{className:"grid sm:grid-cols-2 gap-4",children:[{title:"Keep recordings under 5 minutes",desc:"Break long tasks into separate recordings — one per logical sub-task."},{title:"Narrate as you go",desc:"Explain why you're doing each step, not just what. Your reasoning is what makes the AI smarter."},{title:"Cover edge cases",desc:"If something unusual happens during a workflow, record how you handle it. The AI needs to learn exceptions too."},{title:"Work at your normal pace",desc:"Don't rush. The extension captures timing, and a natural pace helps the AI understand the workflow rhythm."},{title:"Record on a clean session",desc:"Close unnecessary tabs. A simpler browser state means cleaner recordings."},{title:"Test with a short recording first",desc:"Do a quick 30-second test recording to make sure everything is working before recording a full workflow."}].map((t,e)=>n.jsx("div",{className:"bg-white rounded-xl border border-warm-border p-5",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(vs,{className:"w-4 h-4 text-olive flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-ink text-sm mb-1",children:t.title}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed",children:t.desc})]})]})},e))})]})}),n.jsx("section",{className:"py-16 sm:py-24 px-4 bg-ink",children:n.jsx("div",{className:"max-w-3xl mx-auto text-center",children:n.jsxs(G.div,{initial:"hidden",
29whileInView:"visible",viewport:{once:!0},variants:_h,children:[n.jsx(G.h2,{variants:Jr,className:"font-serif text-2xl sm:text-3xl text-white mb-3",children:"Still Need Help?"}),n.jsx(G.p,{variants:Jr,className:"text-white/60 max-w-lg mx-auto mb-8",children:"If you're still experiencing issues, email our team and we'll help you get set up."}),n.jsx(G.div,{variants:Jr,children:n.jsxs("a",{href:`mailto:${oT}`,className:"inline-flex items-center gap-2 bg-olive hover:bg-olive-dark text-white px-6 py-3 rounded-full font-semibold transition-all text-sm","data-testid":"link-contact-support",children:[n.jsx(Zm,{className:"w-4 h-4"}),oT]})})]})})}),n.jsx("footer",{className:"bg-white border-t border-warm-border py-8 px-4",children:n.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-7 h-7 bg-olive rounded-md flex items-center justify-center",children:n.jsx(ii,{className:"w-3.5 h-3.5 text-white"})}),n.jsx("span",{className:"font-black text-lg text-ink",children:"Workflow Capture"})]}),n.jsxs("div",{className:"flex items-center gap-6 text-sm text-warm-gray",children:[n.jsx(Ae,{href:"/",className:"hover:text-ink transition-colors","data-testid":"link-footer-home",children:"Home"}),n.jsx(Ae,{href:"/extension-support",className:"hover:text-ink transition-colors","data-testid":"link-footer-support",children:"Support"}),n.jsx(Ae,{href:"/privacy",className:"hover:text-ink transition-colors","data-testid":"link-footer-privacy",children:"Privacy"})]}),n.jsx("p",{className:"text-warm-gray/60 text-xs",children:"© 2026 Workflow Capture"})]})})]})}function vi(t,e,s){let r=document.head.querySelector(t);if(!r){if(t.startsWith("link"))r=document.createElement("link"),r.rel="canonical";else{r=document.createElement("meta");const i=t.match(/\[(name|property)="([^"]+)"\]/);i&&r.setAttribute(i[1],i[2])}document.head.appendChild(r)}r.setAttribute(e,s)}function Jc({pageTitle:t,pageDescription:e,canonicalUrl:s,badge:r,badgeIcon:i,title:a,subtitle:l,lastUpdated:d,testId:u,children:m}){return j.useEffect(()=>{const p=document.title,x=document.head.querySelector('meta[name="description"]')?.getAttribute("content")||"",g=document.head.querySelector('meta[property="og:title"]')?.getAttribute("content")||"",b=document.head.querySelector('meta[property="og:description"]')?.getAttribute("content")||"",v=document.head.querySelector('link[rel="canonical"]')?.getAttribute("href")||"";return document.title=t,vi('meta[name="description"]',"content",e),vi('meta[property="og:title"]',"content",t),vi('meta[property="og:description"]',"content",e),vi('meta[name="twitter:title"]',"content",t),vi('meta[name="twitter:description"]',"content",e),vi('link[rel="canonical"]',"href",s),vi('meta[name="robots"]',"content","index, follow"),()=>{document.title=p,x&&vi('meta[name="description"]',"content",x),g&&vi('meta[property="og:title"]',"content",g),b&&vi('meta[property="og:description"]',"content",b),v&&vi('link[rel="canonical"]',"href",v)}},[t,e,s]),n.jsx("div",{className:"min-h-screen bg-cream text-ink font-sans antialiased","data-testid":u,children:n.jsxs("main",{className:"max-w-3xl mx-auto px-4 sm:px-6 pt-10 sm:pt-14 pb-16 sm:pb-20",children:[n.jsxs("div",{className:"mb-10",children:[n.jsxs("span",{className:"inline-flex items-center gap-2 text-xs font-bold text-olive bg-olive/10 px-3 py-1 rounded-full mb-4 uppercase tracking-wider",children:[n.jsx(i,{className:"w-3.5 h-3.5"}),r]}),n.jsx("h1",{className:"font-serif text-4xl sm:text-5xl text-ink mb-3 leading-tight tracking-tight",children:a}),l&&n.jsx("p",{className:"text-warm-gray text-sm mb-2",children:l}),d&&n.jsxs("p",{className:"text-warm-gray text-sm",children:["Last updated: ",d]}),n.jsx("div",{className:"mt-6",children:n.jsx(Ae,{href:"/",className:"text-warm-gray hover:text-ink text-sm font-semibold","data-testid":"link-back-home",children:"← Back to Workflow Capture"})})]}),n.jsx("div",{className:"prose prose-sm max-w-none text-ink/90 leading-relaxed space-y-6",children:m})]})})}function Ts({title:t,children:e}){return n.jsxs("section",{className:"bg-white border border-warm-border rounded-2xl p-6 sm:p-8",children:[n.jsx("h2",{className:"font-serif text-2xl text-ink mb-4",children:t}),n.jsx("div",{className:"space-y-3 text-sm text-ink/85 leading-relaxed",children:e})]})}const cT="[email protected]";function MW(){return n.jsxs(Jc,{pageTitle:"Terms of Service — Workflow Capture",pageDescription:"Terms of service for the Workflow Capture Chrome extension and SaaS platform. Covers acceptable use, subscription terms, customer data ownership, and liability.",canonicalUrl:"https://workflowcapture.ai/terms",badge:"Legal",badgeIcon:KA,title:"Terms of Service",subtitle:"These terms govern your use of Workflow Capture.",lastUpdated:"May 2, 2026",testId:"page-wc-terms",children:[n.jsx(Ts,{title:"1. Acceptance",children:n.jsx("p",{children:'By installing the Workflow Capture Chrome extension, signing up for an account, or otherwise using the Workflow Capture service ("Service"), you agree to these Terms of Service ("Terms"). If you are using the Service on behalf of an organization, you represent that you have authority to bind that organization to these Terms.'})}),n.jsx(Ts,{title:"2. The Service",children:n.jsx("p",{children:"Workflow Capture is a Chrome extension and web application that records browser actions, voice narration, and contextual notes from sessions you initiate, then generates SOPs, training documents, and AI-ready scripts from those captures. The Service is provided as software-as-a-service and may evolve over time."})}),n.jsx(Ts,{title:"3. Accounts",children:n.jsx("p",{children:"You are responsible for maintaining the confidentiality of your account credentials and for all activity that occurs under your account. Notify us immediately of any unauthorized use. You must be at least 18 years old to use the Service."})}),n.jsxs(Ts,{title:"4. Acceptable use",children:[n.jsx("p",{children:"You agree not to:"}),n.jsxs("ul",{className:"list-disc pl-5 space-y-1.5",children:[n.jsx("li",{children:"Capture workflows that contain content you do not have authority to record (for example, customer screens, third-party SaaS sessions, or other people's accounts without their consent)."}),n.jsx("li",{children:"Use the Service to record fields the extension does not exclude — such as bank account credentials, government IDs, or protected health information that has not been de-identified — without your organization's compliance approval."}
29),n.jsx("li",{children:"Reverse engineer, scrape, or attempt to access the Service in any way other than through the published interfaces."}),n.jsx("li",{children:"Use the Service to violate any law, regulation, or third-party right."})]})]}),n.jsxs(Ts,{title:"5. Subscriptions and billing",children:[n.jsx("p",{children:"Paid plans are billed in advance on a monthly or annual basis. Fees are non-refundable except where required by law. We may change pricing with 30 days' notice; changes will not apply to a pre-paid term already in progress."}),n.jsx("p",{children:"The Free plan is available indefinitely with no credit card required. If you choose to subscribe to a paid plan, you can cancel at any time from the billing settings."})]}),n.jsx(Ts,{title:"6. Customer data",children:n.jsxs("p",{children:['You own all workflow recordings, transcripts, and generated documents you create using the Service ("Customer Data"). We process Customer Data solely to provide and improve the Service for you. We will not sell Customer Data, train third-party models on it, or use it for advertising. See our ',n.jsx("a",{href:"/privacy",className:"text-olive font-semibold hover:underline",children:"Privacy Policy"})," and ",n.jsx("a",{href:"/dpa",className:"text-olive font-semibold hover:underline",children:"Data Processing Addendum"})," for details."]})}),n.jsx(Ts,{title:"7. Confidentiality",children:n.jsx("p",{children:"Each party will protect the other's confidential information with the same care it uses for its own confidential information of like importance, but in no event with less than reasonable care. This obligation survives termination."})}),n.jsx(Ts,{title:"8. Termination",children:n.jsx("p",{children:"You may stop using the Service at any time. We may suspend or terminate your access if you materially breach these Terms or use the Service in a way that creates risk for us or other users. On termination, you can export your Customer Data for 30 days, after which it will be deleted from active systems."})}),n.jsx(Ts,{title:"9. Disclaimers",children:n.jsx("p",{children:'The Service is provided "as is" without warranties of any kind. To the maximum extent permitted by law, we disclaim all implied warranties including merchantability, fitness for a particular purpose, and non-infringement. Generated outputs are starting points — you are responsible for reviewing and approving any document, SOP, or script before relying on it operationally.'})}),n.jsx(Ts,{title:"10. Limitation of liability",children:n.jsx("p",{children:"To the maximum extent permitted by law, neither party will be liable for any indirect, incidental, consequential, or punitive damages, or for lost profits or revenue. Our total aggregate liability under these Terms will not exceed the fees you paid in the twelve months preceding the claim."})}),n.jsx(Ts,{title:"11. Changes to these Terms",children:n.jsx("p",{children:"We may update these Terms from time to time. Material changes will be communicated via email or in-product notice at least 30 days before they take effect. Continued use after the effective date constitutes acceptance."})}),n.jsx(Ts,{title:"12. Contact",children:n.jsxs("p",{children:["Questions about these Terms? Reach us at ",n.jsx("a",{href:`mailto:${cT}`,className:"text-olive font-semibold hover:underline",children:cT}),"."]})})]})}const dT="[email protected]";function _W(){return n.jsxs(Jc,{pageTitle:"Data Processing Addendum — Workflow Capture",pageDescription:"Data Processing Addendum (DPA) for Workflow Capture. Covers GDPR, UK GDPR, and CCPA roles, processor obligations, security measures, sub-processors, and international transfers.",canonicalUrl:"https://workflowcapture.ai/dpa",badge:"Legal",badgeIcon:r9,title:"Data Processing Addendum",subtitle:"Forms part of the Workflow Capture Terms of Service.",lastUpdated:"May 2, 2026",testId:"page-wc-dpa",children:[n.jsx(Ts,{title:"1. Scope and roles",children:n.jsxs("p",{children:['This Data Processing Addendum ("DPA") applies whenever Workflow Capture processes personal data on your behalf in the course of providing the Service. For the purposes of GDPR, UK GDPR, and similar laws, you are the ',n.jsx("strong",{children:"controller"})," and Workflow Capture is the ",n.jsx("strong",{children:"processor"}),". For the CCPA, Workflow Capture acts as a ",n.jsx("strong",{children:"service provider"}),"."]})}),n.jsx(Ts,{title:"2. Subject matter and duration",children:n.jsx("p",{children:"The subject matter is the processing necessary to deliver the Service. Duration matches the term of your subscription, plus the 30-day post-termination export window described 
29in the Terms of Service."})}),n.jsx(Ts,{title:"3. Nature and purpose of processing",children:n.jsxs("ul",{className:"list-disc pl-5 space-y-1.5",children:[n.jsx("li",{children:"Recording browser actions, voice narration, and notes you submit through the Workflow Capture Chrome extension."}),n.jsx("li",{children:"Generating SOPs, training guides, and AI-ready scripts from captured sessions."}),n.jsx("li",{children:"Storing and serving your captures, generated outputs, exports, and audit history."}),n.jsx("li",{children:"Operating accounts, billing, and customer support."})]})}),n.jsxs(Ts,{title:"4. Categories of data and data subjects",children:[n.jsxs("p",{children:[n.jsx("strong",{children:"Data subjects:"})," your authorised users (employees, contractors), and anyone whose name or identifier appears in the workflows you choose to capture."]}),n.jsxs("p",{children:[n.jsx("strong",{children:"Categories:"})," account identifiers, browser action logs, audio narration recordings and transcripts, screenshots you opt to attach, support communications, and billing metadata. Workflow Capture is hardcoded to exclude password fields. You are responsible for ensuring you have authority to capture any other categories of personal data."]})]}),n.jsxs(Ts,{title:"5. Processor obligations",children:[n.jsx("p",{children:"Workflow Capture will:"}),n.jsxs("ul",{className:"list-disc pl-5 space-y-1.5",children:[n.jsx("li",{children:"Process personal data only on your documented instructions, including those embedded in the Terms and the Service configuration."}),n.jsx("li",{children:"Ensure persons authorised to process personal data are bound by confidentiality."}),n.jsxs("li",{children:["Implement the security measures set out in our ",n.jsx("a",{href:"/security",className:"text-olive font-semibold hover:underline",children:"Security Overview"}),"."]}),n.jsx("li",{children:"Assist you with data-subject requests, DPIAs, and notifications to supervisory authorities, taking into account the nature of the processing."}),n.jsx("li",{children:"Notify you without undue delay (and within 72 hours where feasible) of any personal data breach affecting your data."}),n.jsx("li",{children:"At your choice, delete or return personal data at the end of the engagement."})]})]}),n.jsx(Ts,{title:"6. Sub-processors",children:n.jsxs("p",{children:["You authorise Workflow Capture to engage the sub-processors listed at ",n.jsx("a",{href:"/subprocessors",className:"text-olive font-semibold hover:underline",children:"workflowcapture.ai/subprocessors"}),". We will give at least 30 days' notice of any new or replacement sub-processor and provide a mechanism for you to object."]})}),n.jsx(Ts,{title:"7. International transfers",children:n.jsx("p",{children:"Where personal data originating in the EEA, UK, or Switzerland is transferred to a country without an adequacy decision, the transfer is governed by the European Commission's Standard Contractual Clauses (Module Two: controller-to-processor), incorporated by reference, plus the UK Addendum where applicable."})}),n.jsx(Ts,{title:"8. Audit rights",children:n.jsx("p",{children:"You may, at your own cost and on reasonable notice, audit our compliance with this DPA up to once per year. To minimise disruption, we may satisfy audit requests with current third-party reports (such as SOC 2 Type II once issued) and a written questionnaire. Audits requested by a supervisory authority are not subject to the once-per-year limit."})}),n.jsx(Ts,{title:"9. Liability",children:n.jsx("p",{children:"The liability provisions in the Terms of Service apply to this DPA. Nothing in this DPA excludes or limits liability that cannot be excluded under applicable data protection law."})}),n.jsx(Ts,{title:"10. Conflict and execution",children:n.jsxs("p",{children:["If there is a conflict between the Terms and this DPA on data protection matters, this DPA controls. This DPA is incorporated into the Terms by reference and is effective when you accept the Terms or otherwise begin using the Service. To countersign a copy, email ",n.jsx("a",{href:`mailto:${dT}`,className:"text-olive font-semibold hover:underline",children:dT}),"."]})})]})}const uT="[email protected]",OW=[{name:"Neon (Serverless Postgres)",purpose:"Primary application database — accounts, workflows, generated outputs, audit logs.",location:"United States",dataTypes:"Account data, workflow content, transcripts, audit history"},{name:"Replit Object Storage (Google Cloud Storage)",purpose:"Storage for uploaded files, generated PDFs, and audio recordings.",location:"United States",dataTypes:"Captured files, exports, audio recordings"},{name:"OpenAI",purpose:"AI generation of SOPs, training guides, and Betty assistant responses from captured sessions.",location:"United States",dataTypes:"Workflow steps, transcripts, prompts (no training on customer data)"},{name:"Resend",purpose:"Transactional email delivery (magic links, invites, exports, billing receipts).",location:"United States",dataTypes:"Email addresses, names, message content"},{name:"Replit Deployments",purpose:"Hosting of the Workflow Capture web application and API.",location:"United States",dataTypes:"All Service traffic"},{name:"Stripe",purpose:"Payment processing and subscription billing.",location:"United States, Ireland",dataTypes:"Billing contact, payment instrument tokens, invoice history"}];function RW(){return n.jsxs(Jc,{pageTitle:"Subprocessors — Workflow Capture",pageDescription:"Current list of sub-processors used by Workflow Capture to deliver the Service, including their purpose, hosting location, and the categories of data they process.",canonicalUrl:"https://workflowcapture.ai/subprocessors",badge:"Legal",badgeIcon:K9,title:"Subprocessors",subtitle:"Third-party services Workflow Capture uses to deliver the Service.",lastUpdated:"May 2, 2026",testId:"page-wc-subprocessors",children:[n.jsx("section",{className:"bg-white border border-warm-border rounded-2xl p-6 sm:p-8",children:n.jsxs("p",{className:"text-sm text-ink/85 leading-relaxed mb-4",children:["Workflow Capture uses the following sub-processors to operate the Service. Each is bound by a written agreement that imposes data-protection obligations no less protective than our own commitments to you. We give at least 30 days' notice before adding or replacing a sub-processor — subscribe at ",n.jsx("a",{href:`mailto:${uT}`,className:"text-olive font-semibold hover:underline",children:uT})," to receive notifications."]})}),n.jsx("section",{className:"space-y-3",children:OW.map(t=>n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl p-5 sm:p-6","data-testid":`subprocessor-${t.name.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`,children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[n.jsx("h3",{className:"font-serif text-lg text-ink",children:t.name}),n.jsx("span",{className:"text-[10px] uppercase tracking-wider font-bold text-olive bg-olive/10 px-2 py-1 rounded-full whitespace-nowrap",children:t.location})]}),n.jsx("p",{className:"text-sm text-ink/85 leading-relaxed mb-2",children:t.purpose}),n.jsxs("p",{className:"text-xs text-warm-gray",children:[n.jsx("span",{className:"font-semibold text-ink/70",children:"Data processed:"})," ",t.dataTypes]})]},t.name))}),n.jsxs("section",{className:"bg-white border border-warm-border rounded-2xl p-6 sm:p-8",children:[n.jsx("h2",{className:"font-serif text-xl text-ink mb-3",children:"Object to a sub-processor"}),n.jsx("p",{className:"text-sm text-ink/85 leading-relaxed",children:"If you have a reasonable objection to a new sub-processor, write to us within 14 days of the change notice. We will work with you in good faith on a resolution. If we cannot resolve the objection, you may terminate the affected portion of the Service and receive a pro-rated refund of pre-paid fees for unused time."})]})]})}const DW=[{icon:po,title:"Encryption everywhere",body:"All traffic is served over TLS 1.2+ and HSTS is enforced. Customer data at rest is encrypted with AES-256, including database records, object storage, and backups."},{icon:$A,title:"Tenant isolation",body:"Every workflow, transcript, export, and activity-log entry is keyed to a client ID. API endpoints validate ownership on every request — there is no shared workspace mode where one tenant can read another's data."},{icon:yj,title:"Authentication and access",body:"Customer access is via passwordless magic links scoped to your verified email domain. Internal access is limited by role, requires SSO, and follows least-privilege principles."},{icon:d9,title:"Audit logging",body:"Every meaningful event — capture uploaded, AI script generated, workflow approved, export downloaded, settings changed — is recorded to an immutable activity log scoped to your account and surfaced in the portal."},{icon:j8,title:"Incident response",body:"We monitor application logs and infrastru
29cture health continuously. In the event of a confirmed incident affecting customer data, we will notify you within 72 hours with the facts we know and the actions we are taking."}],PW=["Password fields are excluded by the Workflow Capture Chrome extension at the DOM level — they never leave the browser.","No full-screen recording — only the actions and DOM events you initiate while recording.","Audio narration is processed on-demand, transcribed, and the original audio can be deleted by the customer at any time.","Customer-supplied API keys (e.g. for runtime integrations) are encrypted at rest with envelope encryption.","Production secrets are stored in a managed secret store, never in source control.","Code changes are peer-reviewed and pass automated dependency, secret, and SAST scans before deploy.","Backups are taken daily and retained for 30 days; restore drills are performed quarterly.","Customers can export all of their data (PDF, Markdown, JSON) and request hard deletion at any time."];function IW(){return n.jsxs(Jc,{pageTitle:"Security Overview — Workflow Capture",pageDescription:"How Workflow Capture protects customer data: encryption, tenant isolation, authentication, audit logging, incident response, and operational controls.",canonicalUrl:"https://workflowcapture.ai/security",badge:"Security",badgeIcon:vj,title:"Security Overview",subtitle:"How we protect the workflows you trust us with.",lastUpdated:"May 2, 2026",testId:"page-wc-security",children:[n.jsx("section",{className:"bg-white border border-warm-border rounded-2xl p-6 sm:p-8",children:n.jsx("p",{className:"text-sm text-ink/85 leading-relaxed",children:"Workflow Capture is built for teams documenting sensitive operational work. Security isn't a marketing badge — it's a property of how the product is designed. This page summarises the controls in place today and the practices we follow."})}),n.jsx("section",{className:"grid sm:grid-cols-2 gap-3",children:DW.map(t=>n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl p-5",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n.jsx("div",{className:"w-9 h-9 rounded-full bg-olive/10 flex items-center justify-center",children:n.jsx(t.icon,{className:"w-4 h-4 text-olive"})}),n.jsx("h3",{className:"font-serif text-lg text-ink",children:t.title})]}),n.jsx("p",{className:"text-sm text-ink/80 leading-relaxed",children:t.body})]},t.title))}),n.jsxs("section",{className:"bg-white border border-warm-border rounded-2xl p-6 sm:p-8",children:[n.jsx("h2",{className:"font-serif text-2xl text-ink mb-4",children:"Operational practices"}),n.jsx("ul",{className:"space-y-2.5 text-sm text-ink/85",children:PW.map((t,e)=>n.jsxs("li",{className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-olive mt-2 flex-shrink-0"}),n.jsx("span",{children:t})]},e))})]}),n.jsxs("section",{className:"bg-white border border-warm-border rounded-2xl p-6 sm:p-8",children:[n.jsx("h2",{className:"font-serif text-2xl text-ink mb-3",children:"Compliance roadmap"}),n.jsxs("p",{className:"text-sm text-ink/85 leading-relaxed mb-3",children:["Workflow Capture is currently undergoing SOC 2 Type II observation; the report is targeted for Q4 2026. We support customer-driven security reviews via questionnaire today. Contact ",n.jsx("a",{href:"mailto:[email protected]",className:"text-olive font-semibold hover:underline",children:"[email protected]"})," for a vendor packet, or to coordinate a security review or a signed Data Processing Addendum."]}),n.jsxs("p",{className:"text-sm text-ink/85 leading-relaxed",children:["Suspect a vulnerability? Email ",n.jsx("a",{href:"mailto:[email protected]",className:"text-olive font-semibold hover:underline",children:"[email protected]"})," with a description and reproduction steps. We respond to all reports within two business days."]})]})]})}const LW=[{company:"Regional background-screening firm",industry:"Compliance · 40 analysts",headline:"Cut SOP authoring from 3 weeks to 2 days",quote:"We used to corner our senior analysts for hours to write up their county-grading process. Workflow Capture lets them just do their work and narrate. We get a clean, reviewable script we can hand to a new hire — or to an AI agent — that same week.",speaker:"Operations Director",metrics:[{value:"92%",label:"Reduction in authoring time"},{value:"11",label:"Workflows captured in week one"},{value:"3 days",label:"Average review-to-approve"}]},{company:"Mid-market insurance TPA",industry:"Claims operations · 120 adjusters",headline:"Trained an AI assistant on aged-claim escalation in two captures",quote:"Our senior adjuster did the escalation flow twice with the extension running. Betty asked the right clarifying questions to fill the gaps, and we had a runnable script for our claims assistant b
29y Friday. The audit log made compliance comfortable signing off.",speaker:"Head of Claims Automation",metrics:[{value:"2",label:"Captures to first runnable script"},{value:"100%",label:"Audit-trail coverage"},{value:"$48k",label:"Annualised analyst hours redirected"}]},{company:"Healthcare RCM agency",industry:"Revenue cycle · 25 specialists",headline:"Onboarded three new specialists from the same workflow library",quote:"We captured every prior-auth workflow once. New specialists now ramp from a library of approved SOPs and training guides instead of shadowing for two months. The PDF export drops straight into our LMS.",speaker:"VP of Operations",metrics:[{value:"60 days → 14 days",label:"Time to productive ramp"},{value:"32",label:"Workflows in shared library"},{value:"0",label:"Compliance findings from audit"}]}];function $W(){return n.jsx(Jc,{pageTitle:"Customer Stories — Workflow Capture",pageDescription:"How operations teams use Workflow Capture to turn senior expertise into reviewable SOPs, training guides, and AI-ready scripts in days instead of weeks.",canonicalUrl:"https://workflowcapture.ai/customer-stories",badge:"Customer stories",badgeIcon:o$,title:"From silent expertise to shared playbooks",subtitle:"How real operations teams use Workflow Capture.",testId:"page-wc-customer-stories",children:n.jsxs("div",{className:"space-y-6",children:[LW.map(t=>n.jsxs("article",{className:"bg-white border border-warm-border rounded-2xl p-6 sm:p-8","data-testid":`story-${t.company.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`,children:[n.jsxs("div",{className:"mb-4",children:[n.jsx("p",{className:"text-[10px] uppercase tracking-wider font-bold text-olive mb-2",children:t.industry}),n.jsx("h2",{className:"font-serif text-2xl sm:text-3xl text-ink leading-tight mb-1",children:t.headline}),n.jsx("p",{className:"text-sm text-warm-gray",children:t.company})]}),n.jsxs("blockquote",{className:"border-l-4 border-olive/40 pl-5 my-5",children:[n.jsxs("p",{className:"font-serif italic text-lg text-ink leading-relaxed",children:["“",t.quote,"”"]}),n.jsxs("footer",{className:"text-xs text-warm-gray mt-2",children:["— ",t.speaker,", ",t.company]})]}),n.jsx("div",{className:"grid grid-cols-3 gap-3 mt-5 pt-5 border-t border-warm-border",children:t.metrics.map(e=>n.jsxs("div",{className:"text-center",children:[n.jsx("p",{className:"font-serif text-2xl sm:text-3xl text-olive font-bold leading-tight",children:e.value}),n.jsx("p",{className:"text-[10px] uppercase tracking-wider text-warm-gray mt-1",children:e.label})]},e.label))})]},t.company)),n.jsxs("section",{className:"bg-olive-dark text-white rounded-2xl p-6 sm:p-8 text-center",children:[n.jsx("h2",{className:"font-serif text-2xl sm:text-3xl mb-3",children:"Want to be next?"}),n.jsx("p",{className:"text-white/80 text-sm mb-5 max-w-md mx-auto",children:"Start a free workspace and capture your first workflow in under ten minutes."}),n.jsx("a",{href:"/signup?plan=free",className:"inline-flex items-center gap-2 bg-white text-olive-dark px-5 py-2.5 rounded-full font-semibold text-sm hover:bg-cream transition-colors","data-testid":"link-stories-cta",children:"Start Free"})]})]})})}const BW=[{version:"v1.6",date:"May 2026",tag:"This week",items:[{type:"added",text:"Exports tab now lists every PDF and Markdown export with a one-click re-download."},{type:"added",text:"Betty edit-mode chips: 'Add more steps' and 'Refine descriptions' now route through the assistant with prefab prompts."},{type:"improved",text:"Privacy policy page hardened for Chrome Web Store review (canonical URL, og/twitter metadata, robots index)."},{type:"improved",text:"Refreshed brand assets — favicon and og-image now reflect the cream/olive serif identity."}]},{version:"v1.5",date:"April 2026",tag:"",items:[{type:"added",text:"Workflow detail page: cleaner header, governance defaults moved to settings."},{type:"added",text:"Activity log now records every export, approval, and stage change scoped to your workspace."},{type:"improved",text:"Markdown export formatting tightened for Notion and Confluence paste-in."}]},{version:"v1.4",date:"March 2026",tag:"",items:[{type:"added",text:"Workflow Capture portal: SaaS Knowledge Hub with workflows, training documents, and team sharing."},{type:"added",text:"Magic-link authentication scoped to verified email domains."},{type:"added",text:"PDF and Markdown export pipeline."}]},{version:"v1.3",date:"February 2026",tag:"",items:[{type:"added",text:"Betty assistant — chat with your captured workflow to fill gaps, refine descriptions, or generate AI scripts."},{type:"improved",text:"Audio transcription latency reduced by 40%."}]},{version:"v1.2",date:"January 2026",tag:"",items:[{type:"added",text:"Voice narration capture alongside browser actions."},{type:"added",text:"Password-field exclusion at the DOM level inside the Chrome extension."}]},{version:"v1.0",date:"December 2025",tag:"Launch",items:[{type:"added",text:"First public release of the Workflow Capture Chrome extension and portal."}]}],zW={added:"text-olive bg-olive/10 border-olive/20",improved:"text-blue-700 bg-blue-50 border-blue-100",fixed:"text-amber-700 bg-amber-50 border-amber-100"};function VW(){return n.jsx(Jc,{pageTitle:"Product Updates — Workflow Capture",pageDescription:"Release notes and product updates for Workflow Capture — the Chrome extension and portal that turns work into SOPs, training guides, and AI-ready scripts.",canonicalUrl:"https://workflowcapture.ai/changelog",badge:"Product updates",badgeIcon:lo,title:"Product updates",subtitle:"Everything we've shipped, in reverse-chronological order.",testId:"page-wc-changelog",children:n.jsx("div",{className:"space-y-6",children:BW.map(t=>n.jsxs("article",{className:"bg-white border border-warm-border rounded-2xl p-6 sm:p-8","data-testid":`release-${t.version}`,children:[n.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4 pb-4 border-b border-warm-border",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("h2",{className:"font-serif text-2xl text-ink",children:t.ver
29sion}),t.tag&&n.jsx("span",{className:"text-[10px] uppercase tracking-wider font-bold text-olive bg-olive/10 px-2 py-1 rounded-full",children:t.tag})]}),n.jsx("span",{className:"text-xs text-warm-gray",children:t.date})]}),n.jsx("ul",{className:"space-y-2.5 text-sm",children:t.items.map((e,s)=>n.jsxs("li",{className:"flex items-start gap-3",children:[n.jsx("span",{className:`text-[9px] uppercase tracking-wider font-bold px-2 py-0.5 rounded-full border whitespace-nowrap mt-0.5 ${zW[e.type]||""}`,children:e.type}),n.jsx("span",{className:"text-ink/85 leading-relaxed",children:e.text})]},s))})]},t.version))})})}const FW=[{name:"Web application (workflowcapture.ai)",status:"operational"},{name:"Chrome extension capture pipeline",status:"operational"},{name:"AI generation (Betty + scripts)",status:"operational"},{name:"Exports (PDF, Markdown)",status:"operational"},{name:"Magic-link email delivery",status:"operational"},{name:"Object storage (uploads, recordings)",status:"operational"},{name:"Database (Postgres)",status:"operational"}],UW=[{date:"May 1, 2026",title:"All systems operational",body:"No incidents this week."},{date:"April 18, 2026",title:"Brief AI generation slowdown",body:"Upstream provider latency spike for ~22 minutes. No data loss; impacted captures retried successfully on reload."},{date:"April 4, 2026",title:"Scheduled database maintenance",body:"Planned 8-minute maintenance window. Read-only mode during the window; no impact on captures already in flight."}];function HW(){return n.jsxs(Jc,{pageTitle:"System Status — Workflow Capture",pageDescription:"Live status of Workflow Capture services — capture pipeline, AI generation, exports, email, storage, and database.",canonicalUrl:"https://workflowcapture.ai/status",badge:"Status",badgeIcon:hu,title:"System status",subtitle:"Current health of every Workflow Capture service.",testId:"page-wc-status",children:[n.jsxs("section",{className:"bg-white border border-olive/30 rounded-2xl p-6 sm:p-8",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-olive animate-pulse"}),n.jsx("h2",{className:"font-serif text-2xl text-ink",children:"All systems operational"})]}),n.jsx("p",{className:"text-sm text-warm-gray",children:"Last checked just now. Status auto-refreshes every five minutes."})]}),n.jsxs("section",{className:"bg-white border border-warm-border rounded-2xl p-6 sm:p-8",children:[n.jsx("h2",{className:"font-serif text-xl text-ink mb-4",children:"Services"}),n.jsx("ul",{className:"space-y-3",children:FW.map(t=>n.jsxs("li",{className:"flex items-center justify-between py-2 border-b border-warm-border/50 last:border-0",children:[n.jsx("span",{className:"text-sm text-ink",children:t.name}),n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-semibold text-olive",children:[n.jsx(vs,{className:"w-3.5 h-3.5"}),"Operational"]})]},t.name))})]}),n.jsxs("section",{className:"bg-white border border-warm-border rounded-2xl p-6 sm:p-8",children:[n.jsx("h2",{className:"font-serif text-xl text-ink mb-4",children:"Recent history"}),n.jsx("div",{className:"space-y-4",children:UW.map((t,e)=>n.jsxs("div",{className:"border-l-2 border-warm-border pl-4",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3 mb-1",children:[n.jsx("h3",{className:"font-semibold text-ink text-sm",children:t.title}),n.jsx("span",{className:"text-xs text-warm-gray whitespace-nowrap",children:t.date})]}),n.jsx("p",{className:"text-sm text-ink/80 leading-relaxed",children:t.body})]},e))})]}),n.jsx("section",{className:"text-center text-xs text-warm-gray",children:n.jsxs("p",{children:["Subscribe to incident notifications by emailing ",n.jsx("a",{href:"mailto:[email protected]",className:"text-olive font-semibold hover:underline",children:"[email protected]"}),"."]})})]})}const hT=[{href:"/features",label:"Features"},{href:"/demo",label:"Demo"},{href:"/pricing",label:"Pricing"}];function qW({variant:t="light"}){const[e,s]=j.useState(!1),[r]=Al(),i=t==="heroDark",a=i?"fixed top-0 w-full z-50 bg-olive-dark/90 backdrop-blur-xl border-b border-white/10":"fixed top-0 w-full z-50 bg-white/85 backdrop-blur-xl border-b border-warm-border",l=i?"font-black text-xl text-white":"font-black text-xl text-ink",d=i?"w-8 h-8 bg-white/15 border border-white/20 rounded-lg flex items-center justify-center":"w-8 h-8 bg-olive rounded-lg flex items-center justify-center",u=i?"w-4 h-4 text-cream":"w-4 h-4 text-white",m="font-medium text-sm transition-colors",p=i?"text-white/75 hover:text-white":"text-warm-gray hover:text-ink",x=i?"text-white":"text-ink",g=i?"text-white/75 hover:text-white font-medium text-sm":"text-warm-gray hover:text-ink font-medium text-sm",b=i?"inline-flex items-center px-4 py-2 rounded-full bg-white text-olive-dark hover:bg-cream font-semibold transition-all text-sm shadow-md":"inline-flex items-center px-4 py-2 rounded-full bg-olive text-white hover:bg-olive-dark font-semibold transition-all text-sm",v=i?"md:hidden p-2 text-white":"md:hidden p-2 text-ink",k=i?"md:hidden bg-olive-dark border-t border-white/10 px-4 py-3 space-y-1":"md:hidden bg-white border-t border-warm-border px-4 py-3 space-y-1",N=i?"block py-2 text-white font-medium":"block py-2 text-ink font-medium",S=i?"block py-2 text-white/75":"block py-2 text-warm-gray",A=i?"block py-2 text-cream font-semibold":"block py-2 text-olive font-semibold";return n.jsxs("nav",{className:a,"data-testid":"wc-nav",children:[n.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-3 flex justify-between items-center",children:[n.jsxs(Ae,{href:"/",className:"flex items-center gap-2","data-testid":"link-wc-brand",children:[n.jsx("div",{className:d,children:n.jsx(ii,{className:u})}),n.jsx("span",{className:l,children:"Workflow Capture"})]}),n.jsx("div",{className:"hidden md:flex items-center gap-7",children:hT.map(E=>
29{const _=r===E.href;return n.jsx(Ae,{href:E.href,className:`${m} ${_?x:p}`,"data-testid":`link-wc-${E.label.toLowerCase()}`,children:E.label},E.href)})}),n.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[n.jsx(Ae,{href:"/signin",className:g,"data-testid":"link-wc-signin",children:"Sign in"}),n.jsxs(Ae,{href:"/signup",className:b,"data-testid":"link-wc-signup",children:["Start Free",n.jsx(kn,{className:"ml-1 w-4 h-4"})]})]}),n.jsx("button",{className:v,onClick:()=>s(!e),"aria-label":"Toggle menu","data-testid":"button-wc-menu",children:e?n.jsx(ro,{className:"w-5 h-5"}):n.jsx(I9,{className:"w-5 h-5"})})]}),e&&n.jsxs("div",{className:k,children:[hT.map(E=>n.jsx(Ae,{href:E.href,onClick:()=>s(!1),className:N,children:E.label},E.href)),n.jsx(Ae,{href:"/signin",onClick:()=>s(!1),className:S,children:"Sign in"}),n.jsx(Ae,{href:"/signup",onClick:()=>s(!1),className:A,children:"Start Free"})]})]})}function WW(){return n.jsx("footer",{className:"bg-white border-t border-warm-border py-12 px-4","data-testid":"wc-footer",children:n.jsxs("div",{className:"max-w-7xl mx-auto",children:[n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-8 mb-10",children:[n.jsxs("div",{className:"col-span-2 md:col-span-1",children:[n.jsxs(Ae,{href:"/",className:"flex items-center gap-2 mb-3",children:[n.jsx("div",{className:"w-7 h-7 bg-olive rounded-md flex items-center justify-center",children:n.jsx(ii,{className:"w-3.5 h-3.5 text-white"})}),n.jsx("span",{className:"font-black text-lg text-ink",children:"Workflow Capture"})]}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed max-w-xs",children:"Show your work once. Automate it forever. The Chrome extension that turns clicks and narration into clean, runnable scripts."})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-bold text-ink uppercase tracking-wider mb-3",children:"Product"}),n.jsxs("ul",{className:"space-y-2 text-sm",children:[n.jsx("li",{children:n.jsx(Ae,{href:"/features",className:"text-warm-gray hover:text-ink",children:"Features"})}),n.jsx("li",{children:n.jsx(Ae,{href:"/demo",className:"text-warm-gray hover:text-ink",children:"Live demo"})}),n.jsx("li",{children:n.jsx(Ae,{href:"/pricing",className:"text-warm-gray hover:text-ink",children:"Pricing"})}),n.jsx("li",{children:n.jsx(Ae,{href:"/signup",className:"text-warm-gray hover:text-ink",children:"Start free"})})]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-bold text-ink uppercase tracking-wider mb-3",children:"Resources"}),n.jsxs("ul",{className:"space-y-2 text-sm",children:[n.jsx("li",{children:n.jsx(Ae,{href:"/extension-support",className:"text-warm-gray hover:text-ink",children:"Help center"})}),n.jsx("li",{children:n.jsx(Ae,{href:"/changelog",className:"text-warm-gray hover:text-ink",children:"Changelog"})}),n.jsx("li",{children:n.jsx(Ae,{href:"/customer-stories",className:"text-warm-gray hover:text-ink",children:"Customer stories"})}),n.jsx("li",{children:n.jsx(Ae,{href:"/status",className:"text-warm-gray hover:text-ink",children:"Status"})})]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs font-bold text-ink uppercase tracking-wider mb-3",children:"Company"}),n.jsxs("ul",{className:"space-y-2 text-sm",children:[n.jsx("li",{children:n.jsx("a",{href:"https://workflowas.live/",target:"_blank",rel:"noopener noreferrer",className:"text-warm-gray hover:text-ink",children:"Workflow AS ↗"})}),n.jsx("li",{children:n.jsx(Ae,{href:"/privacy",className:"text-warm-gray hover:text-ink",children:"Privacy"})}),n.jsx("li",{children:n.jsx(Ae,{href:"/terms",className:"text-warm-gray hover:text-ink",children:"Terms"})}),n.jsx("li",{children:n.jsx(Ae,{href:"/security",className:"text-warm-gray hover:text-ink",children:"Security"})}),n.jsx("li",{children:n.jsx(Ae,{href:"/dpa",className:"text-warm-gray hover:text-ink",children:"DPA"})}),n.jsx("li",{children:n.jsx(Ae,{href:"/subprocessors",className:"text-warm-gray hover:text-ink",children:"Subprocessors"})})]})]})]}),n.jsxs("div",{className:"border-t border-warm-border pt-6 flex flex-col sm:flex-row items-center justify-between gap-3",children:[n.jsx("p",{className:"text-warm-gray/70 text-xs",children:"© 2026 Workflow Capture. All rights reserved."}),n.jsx("p",{className:"text-warm-gray/70 text-xs",children:"Made for teams who'd rather work than write SOPs."})]})]})})}const fc={hidden:{opacity:0,y:24},visible:{opacity:1,y:0,transition:{duration:.6}}},GW={hidden:{opacity:0}
29,visible:{opacity:1,transition:{staggerChildren:.08}}};function KW(){const t=j.useRef(null);return j.useEffect(()=>{const e=t.current;if(!e||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;e.muted=!0;const r=e.play();r&&typeof r.catch=="function"&&r.catch(()=>{})},[]),n.jsxs(n.Fragment,{children:[n.jsxs("section",{id:"top",className:"relative overflow-hidden",style:{background:"radial-gradient(circle at 82% 18%, rgba(255,255,255,0.08), transparent 30%), linear-gradient(135deg, #184832 0%, #20543a 46%, #2f6148 100%)"},"data-testid":"section-hero",children:[n.jsx("video",{ref:t,className:"absolute inset-0 w-full h-full object-cover pointer-events-none motion-reduce:hidden",style:{opacity:.88,filter:"saturate(0.96) contrast(1.06) brightness(1.04)",zIndex:0},autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",poster:"/office-hero-poster.jpg","aria-hidden":"true",children:n.jsx("source",{src:"/office-hero.mp4",type:"video/mp4"})}),n.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{zIndex:1,background:"linear-gradient(90deg, rgba(10,38,27,0.74) 0%, rgba(10,38,27,0.52) 38%, rgba(10,38,27,0.20) 72%, rgba(10,38,27,0.10) 100%), linear-gradient(180deg, rgba(18,75,52,0.30), rgba(18,75,52,0.12))"}}),n.jsx("div",{className:"absolute pointer-events-none hidden lg:block",style:{right:"275px",top:"70px",width:"420px",height:"310px",borderRadius:"50%",background:"rgba(255,255,255,0.06)",filter:"blur(24px)",zIndex:2}}),n.jsx("div",{className:"absolute pointer-events-none hidden lg:block",style:{right:"188px",top:"-246px",width:"560px",height:"890px",borderRadius:"999px",border:"54px solid rgba(255,255,255,0.10)",transform:"rotate(18deg)",zIndex:2}}),n.jsx("div",{className:"max-w-[1220px] mx-auto px-4 sm:px-6 pt-24 sm:pt-32 lg:pt-40 pb-24 sm:pb-32 lg:pb-44 relative z-10",children:n.jsxs(G.div,{initial:"hidden",animate:"visible",variants:GW,className:"grid lg:grid-cols-12 gap-10 lg:gap-12 items-start",children:[n.jsxs("div",{className:"lg:col-span-7",children:[n.jsxs(G.div,{variants:fc,className:"inline-flex items-center gap-2 bg-white/10 border border-white/15 text-white/90 px-4 py-1.5 rounded-full text-xs font-semibold mb-7",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cream animate-pulse"}),"Workflow intelligence capture for enterprise"]}),n.jsxs(G.h1,{variants:fc,className:"font-serif text-[2rem] leading-[1.1] sm:text-5xl sm:leading-[1.05] lg:text-6xl text-white mb-5 sm:mb-6 tracking-tight",children:["Capture how work gets done. Turn it into"," ",n.jsx("span",{className:"text-cream",children:"SOPs, training, scripts, and approved AI-ready workflows."})]}),n.jsx(G.p,{variants:fc,className:"text-base sm:text-lg text-white/75 max-w-2xl mb-8 leading-relaxed",children:"Workflow Capture records browser actions and voice narration as your team works, then converts that knowledge into clear documentation, training guides, and AI-agent scripts."}),n.jsx(G.div,{variants:fc,className:"flex flex-wrap items-center gap-3 mb-7",children:n.jsxs(Ae,{href:"/signup?plan=free",className:"inline-flex items-center gap-2 bg-white hover:bg-cream text-olive-dark px-7 py-3.5 rounded-full font-semibold transition-all text-sm shadow-md","data-testid":"link-hero-cta",children:["Start Free",n.jsx(kn,{className:"w-4 h-4"})]})}),n.jsxs(G.div,{variants:fc,className:"flex flex-wrap items-center gap-x-5 gap-y-2 text-xs text-white/70",children:[n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(vs,{className:"w-3.5 h-3.5 text-cream"})," No screen recording"]}),n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(vs,{className:"w-3.5 h-3.5 text-cream"})," Password fields excluded"]}),n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(vs,{className:"w-3.5 h-3.5 text-cream"})," Review before sending"]}),n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(vs,{className:"w-3.5 h-3.5 text-cream"})," Built for enterprise workflows"]})]})]}),n.jsxs("div",{className:"lg:col-span-5 space-y-4 relative z-10",children:[n.jsxs(G.div,{variants:fc,className:"rounded-[26px] p-6 text-white",style:{background:"rgba(255,255,255,0.10)",border:"1px solid rgba(255,255,255,0.20)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[n.jsx("div",{className:"text-sm font-semibold mb-4 text-white/95",children:"First workflow proof"}),n.jsx("div",{className:"space-y-3 text-sm",children:[{label:"Capture method",value:"3"},{label:"Generated outputs",value:"SOP"},{label:"Review required",value:"Yes"},{label:"Export destinations",value:"6"}].map((e,s)=>n.jsxs("div",{className:"flex items-center justify-between border-t border-white/10 pt-3 first:border-t-0 first:pt-0",children:[n.jsx("span",{className:"text-white/70",children:e.label}),n.jsx("span",{className:"font-semibold text-cream",children:e.value})]},s))})]}),n.jsxs(G.div,{variants:fc,className:"rounded-[26px] p-6 text-white",style:{background:"rgba(255,255,255,0.10)",border:"1px solid rgba(255,255,255,0.20)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[n.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[n.jsx("div",{className:"w-9 h-9 rounded-full bg-white/15 border border-white/20 flex items-center justify-center shrink-0",children:n.jsx(lo,{className:"w-4 h-4 text-cream"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-semibold text-white/95",children:"Betty can help"}),n.jsx("div",{className:"text-xs text-white/65 mt-0.5",children:"Capture, upload, or describe from memory"})]})]}),n.jsx("div",{className:"bg-white text-ink rounded-2xl px-4 py-3 text-sm leading-relaxed mb-4 shadow-sm",children:"“I onboard new clients with the same 8-step process every time.”"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:["Describe process","Upload SOP","Create AI script"].map(e=>n.jsx("span",{className:"text-[11px] font-semibold px-3 py-1.5 rounded-full bg-white/10 border border-white/20 text-white/90",children:e},e))})]})]})]})})]}),n.jsx("section",{className:"relative -mt-16 sm:-mt-24 lg:-mt-36 px-4 z-20 pb-12 sm:pb-16 lg:pb-24",children:n.jsx("div",{className:"max-w-[1130px] mx-auto",children:n.jsx(JW,{})})})]})}const YW=[{label:"Dashboard",icon:HA},{label:"Capture",icon:RA,active:!0},{label:"Workflows",icon:GA,count:23}
29,{label:"Outputs",icon:k8,count:18},{label:"Templates",icon:C8},{label:"Team",icon:ZA},{label:"Usage",icon:hu},{label:"Settings",icon:JA}],Oh=[{t:"00:00:01",a:'Clicked "Open queue"',type:"action"},{t:"00:00:04",a:"Filtered by status = Pending",type:"action"},{t:"00:00:09",a:"Selected first row",type:"action"},{t:"00:00:13",a:'"If the date is older than 7 days, escalate it."',type:"voice"},{t:"00:00:17",a:"Set status → Escalated",type:"action"},{t:"00:00:21",a:'"Otherwise route it back to the original adjuster."',type:"voice"},{t:"00:00:24",a:'Added note: "Aged claim per policy"',type:"action"},{t:"00:00:27",a:"Saved record",type:"action"}];function QW(t){const e=Math.floor(t/60).toString().padStart(2,"0"),s=(t%60).toString().padStart(2,"0");return`${e}:${s}`}function JW(){const[t,e]=j.useState("sop"),[s,r]=j.useState(0),[i,a]=j.useState(134);return j.useEffect(()=>{const l=window.setInterval(()=>a(d=>d+1),1e3);return()=>window.clearInterval(l)},[]),j.useEffect(()=>{let l=0;const d=window.setInterval(()=>{if(l=l+1,l>Oh.length){l=0,r(0);return}r(l)},1100);return()=>window.clearInterval(d)},[]),j.useEffect(()=>{const l=["sop","guide","script"],d=window.setInterval(()=>{e(u=>l[(l.indexOf(u)+1)%l.length])},4500);return()=>window.clearInterval(d)},[]),n.jsx(G.div,{initial:{opacity:0,y:30},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.7},className:"bg-white rounded-[20px] border border-[#d9d7ce] overflow-hidden",style:{boxShadow:"0 28px 80px rgba(34,34,31,0.20)"},"data-testid":"hero-product-visual",children:n.jsxs("div",{className:"flex md:min-h-[520px]",children:[n.jsxs("aside",{className:"hidden md:flex w-56 shrink-0 bg-white border-r border-warm-border flex-col",children:[n.jsxs("div",{className:"px-4 py-4 border-b border-warm-border flex items-center gap-2.5",children:[n.jsx("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-br from-olive to-olive-dark flex items-center justify-center text-white font-black text-sm",children:"W"}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-sm font-black text-ink leading-tight truncate",children:"Workflow Capture"}),n.jsx("div",{className:"text-[10px] text-warm-gray leading-tight",children:"Knowledge hub"})]})]}),n.jsxs("nav",{className:"flex-1 px-3 py-4",children:[n.jsx("div",{className:"text-[10px] font-bold text-warm-gray uppercase tracking-wider px-3 mb-2",children:"Primary"}),YW.map(l=>{const d=l.icon;return n.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium mb-0.5 ${l.active?"bg-olive/10 text-olive":"text-warm-gray"}`,children:[n.jsx(d,{className:`w-4 h-4 shrink-0 ${l.active?"text-olive":"text-warm-gray/80"}`,strokeWidth:1.75}),n.jsx("span",{className:"flex-1",children:l.label}),l.count!==void 0&&n.jsx("span",{className:`text-xs font-semibold ${l.active?"text-olive":"text-warm-gray/70"}`,children:l.count})]},l.label)})]}),n.jsxs("div",{className:"border-t border-warm-border px-4 py-3",children:[n.jsx("div",{className:"text-[11px] font-semibold text-ink truncate",children:"VerifiedGrading Inc."}),n.jsx("div",{className:"text-[10px] text-warm-gray truncate",children:"[email protected]"})]})]}),n.jsxs("div",{className:"flex-1 min-w-0 flex flex-col bg-cream",children:[n.jsxs("header",{className:"bg-white border-b border-warm-border px-4 sm:px-5 py-3 flex items-center justify-between gap-2 sm:gap-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h2",{className:"text-xs sm:text-sm font-black text-ink leading-tight truncate",children:"Capture · Aged Claim Escalation"}),n.jsx("div",{className:"text-[10px] sm:text-[11px] text-warm-gray truncate",children:"VerifiedGrading Inc. · Pro · live capture in progress"})]}),n.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 shrink-0",children:[n.jsxs("span",{className:"inline-flex items-center gap-1.5 bg-red-50 border border-red-100 rounded-full px-2.5 py-1 text-[11px] font-semibold text-red-600","data-testid":"hero-recording-pill",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500 animate-pulse"}),"Recording · ",QW(i)]}),n.jsx("div",{className:"w-7 h-7 rounded-full bg-gradient-to-br from-slate-700 to-slate-900 text-white flex items-center justify-center text-[10px] font-black",children:"SK"})]})]}),n.jsxs("div",{className:"grid lg:grid-cols-2 gap-0 flex-1",children:[n.jsxs("div",{className:"p-5 sm:p-6 border-b lg:border-b-0 lg:border-r border-warm-border",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("h3",{className:"text-xs font-bold text-ink uppercase tracking-wider",children:"Live capture"}),n.jsxs("span",{className:"text-[10px] text-warm-gray bg-white border border-warm-border px-2 py-0.5 rounded-full","data-testid":"hero-capture-counter",children:[s," action",s===1?"":"s"," · ",Oh.slice(0,s).filter(l=>l.type==="voice").length," narration",Oh.slice(0,s).filter(l=>l.type==="voice").length===1?"":"s"]})]}),n.jsxs("ul",{className:"space-y-2 text-[11.5px] text-ink min-h-[280px]",children:[n.jsx(Rr,{initial:!1,children:Oh.slice(0,s).map((l,d)=>n.jsxs(G.li,{initial:{opacity:0,y:-4}
29,animate:{opacity:1,y:0},transition:{duration:.25},className:"flex items-start gap-2.5",children:[n.jsx("span",{className:"text-warm-gray font-mono text-[10px] mt-0.5 shrink-0",children:l.t}),l.type==="voice"?n.jsxs("span",{className:"flex items-start gap-1.5 leading-relaxed text-olive italic",children:[n.jsx(oo,{className:"w-3 h-3 mt-0.5 shrink-0"}),l.a]}):n.jsx("span",{className:"leading-relaxed",children:l.a})]},`${l.t}-${d}`))}),s<Oh.length&&n.jsxs("li",{className:"flex items-center gap-2 text-[10px] text-warm-gray pt-1",children:[n.jsxs("span",{className:"inline-flex gap-1",children:[n.jsx("span",{className:"w-1 h-1 rounded-full bg-warm-gray animate-bounce [animation-delay:-0.2s]"}),n.jsx("span",{className:"w-1 h-1 rounded-full bg-warm-gray animate-bounce [animation-delay:-0.1s]"}),n.jsx("span",{className:"w-1 h-1 rounded-full bg-warm-gray animate-bounce"})]}),"listening…"]})]})]}),n.jsxs("div",{className:"p-5 sm:p-6 bg-white",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("h3",{className:"text-xs font-bold text-ink uppercase tracking-wider",children:"Generated outputs"}),n.jsx("span",{className:"text-[10px] text-olive bg-olive/10 px-2 py-0.5 rounded-full font-semibold uppercase tracking-wider",children:"Ready"})]}),n.jsx("div",{className:"flex gap-1 bg-cream-light border border-warm-border rounded-lg p-1 mb-4",children:[{id:"sop",label:"SOP",icon:Mi},{id:"guide",label:"Training Guide",icon:UA},{id:"script",label:"AI Script",icon:Zd}].map(l=>n.jsxs("button",{onClick:()=>e(l.id),"data-testid":`tab-${l.id}`,className:`flex-1 flex items-center justify-center gap-1.5 text-[10px] font-semibold px-2 py-1.5 rounded-md transition-all ${t===l.id?"bg-white text-ink shadow-sm border border-warm-border":"text-warm-gray hover:text-ink"}`,children:[n.jsx(l.icon,{className:"w-3 h-3"}),l.label]},l.id))}),n.jsx("div",{className:"bg-cream-light/50 border border-warm-border rounded-lg p-4 text-[11px] leading-relaxed text-ink min-h-[200px]",children:n.jsx(Rr,{mode:"wait",children:n.jsxs(G.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.25},children:[t==="sop"&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"font-bold text-ink mb-2",children:"Aged Claim Escalation · SOP"}),n.jsxs("div",{children:[n.jsx("span",{className:"text-olive font-semibold",children:"1."})," Open the Pending queue."]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-olive font-semibold",children:"2."})," For each claim, check the submission date."]}),n.jsx("div",{className:"pl-4 text-warm-gray",children:"If older than 7 days → set status to Escalated and add aged-claim note."}),n.jsx("div",{className:"pl-4 text-warm-gray",children:"Otherwise → route back to original adjuster."}),n.jsxs("div",{children:[n.jsx("span",{className:"text-olive font-semibold",children:"3."})," Save record. Audit entry is logged automatically."]})]}),t==="guide"&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"font-bold text-ink mb-2",children:"Training Guide · New Adjuster"}),n.jsx("p",{children:"The aged-claim rule exists because claims older than a week often fall through the cracks. When you see one, escalate it to the team lead instead of trying to resolve it yourself."}),n.jsx("p",{className:"mt-2 text-warm-gray italic",children:'"If the date is older than 7 days, escalate it. Otherwise route it back to the original adjuster." — captured from senior adjuster'})]}),t==="script"&&n.jsx("pre",{className:"font-mono text-[10px] text-ink/90 whitespace-pre-wrap",children:`{
30  "name": "aged_claim_escalation",
31  "trigger": "queue.status == 'Pending'",
32  "steps": [
33    { "for_each": "claim",
34      "if": "age_days > 7",
35      "then": ["set_status: Escalated",
36               "add_note: 'Aged claim per policy'"],
37      "else": ["route_to: original_adjuster"]
38    },
39    { "save": true, "audit": true }
40  ]
41}`})]},t)})}),n.jsxs("div",{className:"flex items-center gap-2 mt-3 flex-wrap",children:[n.jsx("span",{className:"text-[10px] text-warm-gray",children:"Also exports:"}),n.jsx("span",{className:"text-[10px] bg-cream-light border border-warm-border text-ink/70 px-2 py-0.5 rounded",children:"Audit Trail"}),n.jsx("span",{className:"text-[10px] bg-cream-light border border-warm-border text-ink/70 px-2 py-0.5 rounded",children:"Markdown"}),n.jsx("span",{className:"text-[10px] bg-cream-light border border-warm-border text-ink/70 px-2 py-0.5 rounded",children:"PDF"})]})]})]})]})]})})}function Xc({id:t,eyebrow:e,title:s,subtitle:r,children:i,bg:a="cream"}){const l=op(),d=a==="white"?"bg-white":a==="ink"?"bg-[#1a2b1f] text-white":"bg-cream";return n.jsx("section",{id:t,className:`${d} py-14 sm:py-20 lg:py-28 px-4 sm:px-6`,children:n.jsxs("div",{className:"max-w-6xl mx-auto",children:[n.jsxs(G.div,{initial:l?!1:{opacity:0,y:16},whileInView:{opacity:1,y:0},viewport:{once:!0,margin:"-80px"},transition:{duration:.5},className:"max-w-3xl mb-8 sm:mb-12",children:[e&&n.jsxs("div",{className:`inline-flex items-center gap-2 text-[11px] font-bold uppercase tracking-[0.14em] mb-4 ${a==="ink"?"text-cream/70":"text-olive-dark/80"}`,children:[n.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${a==="ink"?"bg-cream":"bg-olive-dark"}`}),e]}),n.jsx("h2",{className:`font-serif text-3xl sm:text-4xl lg:text-5xl leading-[1.1] sm:leading-[1.05] tracking-tight mb-3 sm:mb-4 ${a==="ink"?"text-white":"text-ink"}`,children:s}),r&&n.jsx("p",{className:`text-base sm:text-lg leading-relaxed ${a==="ink"?"text-white/75":"text-warm-gray"}`,children:r})]}),n.jsx(G.div,{initial:l?!1:{opacity:0,y:28},whileInView:{opacity:1,y:0},viewport:{once:!0,margin:"-80px"},transition:{duration:.6,delay:.1},children:i})]})})}function Ln({children:t}){return n.jsxs("li",{className:"flex items-start gap-2.5 text-[14px] text-ink/85",children:[n.jsx("svg",{viewBox:"0 0 20 20",className:"w-4 h-4 mt-0.5 shrink-0 text-olive-dark",fill:"currentColor",children:n.jsx("path",{d:"M16.7 5.3a1 1 0 010 1.4l-7 7a1 1 0 01-1.4 0l-3.5-3.5a1 1 0 011.4-1.4L9 11.6l6.3-6.3a1 1 0 011.4 0z"})}),n.jsx("span",{children:t})]})}function lp({url:t,children:e,className:s=""}){return n.jsxs("div",{className:`rounded-2xl border border-warm-border bg-white shadow-2xl overflow-hidden ${s}`,children:[n.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-warm-border bg-[#f7f5f0]",children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-red-400/70"}),n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-amber-400/70"}),n.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-400/70"}),t&&n.jsx("span",{className:"ml-3 text-[11px] font-mono text-warm-gray truncate",children:t})]}),e]})}const mT={Captured:{dot:"bg-olive-dark",text:"text-olive-dark",bg:"bg-olive-dark/10",border:"border-olive-dark/20"},Generating:{dot:"bg-blue-500",text:"text-blue-700",bg:"bg-blue-50",border:"border-blue-200"}
41,"Needs Review":{dot:"bg-amber-500",text:"text-amber-800",bg:"bg-amber-50",border:"border-amber-200"},Approved:{dot:"bg-emerald-500",text:"text-emerald-700",bg:"bg-emerald-50",border:"border-emerald-200"},Exported:{dot:"bg-emerald-700",text:"text-emerald-800",bg:"bg-emerald-100/60",border:"border-emerald-300"},"Sent to Runtime":{dot:"bg-slate-700",text:"text-slate-800",bg:"bg-slate-100",border:"border-slate-300"},Failed:{dot:"bg-red-500",text:"text-red-700",bg:"bg-red-50",border:"border-red-200"}};function Nb({status:t}){const e=mT[t]||mT.Captured;return n.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] font-semibold border ${e.bg} ${e.text} ${e.border}`,children:[n.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${e.dot}`}),t]})}const XW=[{icon:gl,text:'Click "Pending Adjudication" tab',delay:.4},{icon:A$,text:'Type "DUI" in search',delay:.9},{icon:gl,text:"Open row 1 of 20",delay:1.4},{icon:oo,text:'"Because dismissed, I clear it."',delay:1.9,voice:!0}];function ZW(){const t=op();return n.jsx(Xc,{id:"capture",eyebrow:"01 · Capture",title:n.jsxs(n.Fragment,{children:["Just do your job."," ",n.jsx("em",{className:"font-serif italic text-olive-dark",children:"We'll capture the rest."})]}
41),subtitle:"Open the Capture page in your portal, click Start browser capture, and the Chrome extension records every browser action plus your voice narration. No screen video. No screenshots.",bg:"cream",children:n.jsxs("div",{className:"grid lg:grid-cols-12 gap-10 items-center",children:[n.jsx("div",{className:"lg:col-span-7 order-2 lg:order-1",children:n.jsx(lp,{url:"app.workflowcapture.ai/portal#/capture",children:n.jsxs("div",{className:"bg-cream p-4 space-y-3 min-h-[420px]",children:[n.jsx("div",{className:"bg-white border border-warm-border rounded-xl p-4",children:n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[n.jsxs("div",{className:"sm:col-span-2",children:[n.jsx("div",{className:"text-[13px] font-black text-ink mb-1",children:"Start a new capture"}),n.jsx("p",{className:"text-[11px] text-warm-gray leading-relaxed mb-2.5",children:"Pick a method to record a workflow. The Chrome extension records browser actions and your voice."}),n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[n.jsx("span",{className:"inline-flex items-center px-2.5 py-1.5 rounded-md bg-olive-dark text-white text-[10px] font-semibold",children:"Start browser capture"}),n.jsx("span",{className:"inline-flex items-center px-2.5 py-1.5 rounded-md bg-white border border-warm-border text-ink text-[10px] font-semibold",children:"Install Chrome extension"})]})]}),n.jsxs("div",{className:"border-t pt-3 sm:border-t-0 sm:border-l border-warm-border sm:pl-3 sm:pt-0",children:[n.jsx("p",{className:"text-[9px] font-bold text-warm-gray uppercase tracking-wider mb-1",children:"Extension status"}),n.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[n.jsx(G.span,{className:"w-1.5 h-1.5 rounded-full bg-emerald-500",animate:t?void 0:{scale:[1,1.4,1]},transition:{duration:1.5,repeat:1/0}}),n.jsx("span",{className:"text-[11px] font-semibold text-ink",children:"Recording"})]}),n.jsx("p",{className:"text-[10px] text-warm-gray leading-snug",children:"02:14 · 12 actions captured"}),n.jsx("div",{className:"text-[10px] font-semibold text-olive-dark mt-1",children:"Manage extension keys →"})]})]})}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl p-3",children:[n.jsx("div",{className:"text-[10px] font-bold text-warm-gray uppercase tracking-wider mb-1.5",children:"Capture tips"}),n.jsx("ul",{className:"space-y-1",children:["Pick one repeatable, browser-based process — not a one-off task.","Narrate as you go. Explain the why, not just the what.","Mention edge cases out loud — the system captures them.","Stop before personal or unrelated browsing.","Review the generated steps before sharing with anyone."].map((e,s)=>n.jsxs("li",{className:"flex gap-2 text-[11.5px]",children:[n.jsxs("span",{className:"text-olive-dark font-bold shrink-0",children:[s+1,"."]}),n.jsx("span",{className:"text-warm-gray leading-snug",children:e})]},s))})]}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl overflow-hidden",children:[n.jsxs("div",{className:"px-3 py-2 bg-[#f7f5f0] border-b border-warm-border flex items-center gap-2",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-warm-gray",children:"Live capture stream"}),n.jsxs(G.span,{className:"ml-auto inline-flex items-center gap-1 text-[10px] font-bold text-red-600",animate:t?void 0:{opacity:[1,.4,1]},transition:{duration:1.6,repeat:1/0},children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),"REC 02:14"]})]}),n.jsx("div",{className:"px-3 py-2.5 space-y-1.5",children:XW.map((e,s)=>{const r=e.icon;return n.jsxs(G.div,{initial:t?!1:{opacity:0,x:-8},whileInView:{opacity:1,x:0},viewport:{once:!0},transition:{delay:e.delay,duration:.4},className:`flex items-start gap-2 text-[11.5px] py-1 px-2 rounded ${e.voice?"bg-olive-dark/5":""}`,children:[n.jsx(r,{className:`w-3 h-3 mt-0.5 shrink-0 ${e.voice?"text-olive-dark":"text-warm-gray"}`}),n.jsx("span",{className:e.voice?"italic text-olive-dark":"text-ink",children:e.text}),n.jsxs("span",{className:"ml-auto text-[10px] font-mono text-warm-gray/60 shrink-0",children:["0:",String(Math.round(e.delay*30)).padStart(2,"0")]})]},s)})}),n.jsxs("div",{className:"px-3 py-2 border-t border-warm-border bg-cream/50 flex items-center gap-2",children:[n.jsxs("button",{"aria-label":"Pause capture",className:"inline-flex items-center gap-1 rounded-md bg-white border border-warm-border text-warm-gray text-[10px] font-semibold px-2.5 py-1",children:[n.jsx(J9,{className:"w-3 h-3"})," Pause"]}),n.jsx("button",{className:"inline-flex items-center rounded-md bg-olive-dark text-white text-[10px] font-semibold px-2.5 py-1",children:"Stop & save"}),n.jsx("span",{className:"ml-auto text-[10px] text-warm-gray",children:"Auto-saved every 30s"})]})]}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl p-3",children:[n.jsx("div",{className:"text-[10px] font-bold text-warm-gray uppercase tracking-wider mb-2",children:"Recent capture attempts"}),n.jsx("div",{className:"divide-y divide-warm-border/60",children:[{name:"Refund escalation",steps:6,time:"2h",status:"Approved"}
41,{name:"New client onboarding",steps:8,time:"5h",status:"Needs Review"}].map(e=>n.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[12px] font-semibold text-ink truncate",children:e.name}),n.jsxs("div",{className:"text-[10px] text-warm-gray",children:[e.steps," steps · ",e.time," ago"]})]}),n.jsx(Nb,{status:e.status})]},e.name))})]})]})})}),n.jsxs("div",{className:"lg:col-span-5 order-1 lg:order-2",children:[n.jsxs("ul",{className:"space-y-2.5 mb-6",children:[n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Browser action capture"})," — clicks, form fields, navigations, even table rows."]}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Voice narration"})," — capture the"," ",n.jsx("em",{children:"why"}),", not just the ",n.jsx("em",{children:"what"}),"."]}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Ambient page context"})," — breadcrumbs, headings, table captions, nearest column."]}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Selectors with quality grades"})," — primary selector + fallbacks (text, role, xpath)."]}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Password fields excluded"})," by default."]}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"User-controlled"})," — recording only when the user clicks Record."]})]}),n.jsxs("div",{className:"inline-flex items-center gap-2 text-[12px] text-warm-gray bg-white border border-warm-border rounded-full px-3 py-1.5",children:[n.jsx(po,{className:"w-3.5 h-3.5 text-olive-dark"}),"No screen recording · No video · No keystroke capture in password fields"]})]})]})})}const eG=["I run a weekly compliance review I'd like to document","I onboard new clients with the same 8-step process every time","Help me turn an existing SOP into an AI-ready script","I want to capture a refund/exception handling process"],tG=[{from:"bot",delay:.2,text:"Hi Sarah — I'm Betty, your Workflow Capture assistant. Tell me about a process you want to document, and I'll turn it into a structured workflow you can review, share, or hand off to an AI agent. You can also upload an existing doc and we'll pull it apart together.",actions:["Describe a process","Upload a document","Capture from browser"]},{from:"user",delay:1.6,text:"I onboard new clients with the same 8-step process every time."},{from:"bot",delay:2.6,text:"Got it. Walk me through it — what kicks the process off, and where does it usually go wrong? I'll start drafting the steps as you talk."},{from:"user",delay:4,text:"Starts when sales marks a deal closed-won. Step 1 we send a welcome email, then we provision their workspace, then…"},{from:"bot",delay:5,text:"Perfect — I have enough to draft this. Want me to create the workflow now so you can review it?",actions:["Create the workflow","Add more details"],primary:0}];function sG(){const t=op();return n.jsx(Xc,{id:"betty",eyebrow:"02 · Betty Assistant",title:n.jsxs(n.Fragment,{children:["Fill in the judgment calls"," ",n.jsx("em",{className:"font-serif italic text-olive-dark",children:"recordings alone miss."})]}),subtitle:"Don't have a process to record? Describe it to Betty in plain English, or upload an existing doc and she'll turn it into a structured workflow. She also asks the questions a recording can't — exceptions, decision points, why.",bg:"white",children:n.jsxs("div",{className:"grid lg:grid-cols-12 gap-10 items-start",children:[n.jsxs("div",{className:"lg:col-span-5 lg:pt-4",children:[n.jsxs("ul",{className:"space-y-2.5 mb-6",children:[n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Describe a process"})," — Betty drafts a structured workflow from your words."]}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Upload a document"})," — PDF, DOCX, or text. Betty reads it and pulls out the steps."]}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Asks follow-up questions"}),' — "What kicks this off? Where does it go wrong?"']}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Surfaces decision points"})," recordings don't make obvious."]}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Edit-with-Betty mode"})," on every workflow — refine steps, add exceptions, fix wording in chat."]})]}),n.jsxs("div",{className:"bg-cream border border-warm-border rounded-xl p-3.5",children:[n.jsx("div",{className:"text-[11px] font-bold text-warm-gray uppercase tracking-wider mb-2",children:"Try one of these prompts"}),n.jsx("div",{className:"space-y-1.5",children:eG.map(e=>n.jsxs("div",{className:"text-[12.5px] text-ink/85 px-2.5 py-1.5 rounded-md bg-white border border-warm-border hover:border-olive-dark/40 cursor-default",children:['"',e,'"']},e))})]})]}),n.jsx("div",{className:"lg:col-span-7",children:n.jsx(lp,{url:"app.workflowcapture.ai/portal#/dashboard",children:n.jsx("div",{className:"bg-cream p-4",children:n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl overflow-hidden",children:[n.jsxs("div",{className:"px-4 py-3 border-b border-warm-border flex items-center gap-2",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg bg-gradient-to-br from-olive-dark to-[#0f1a13] text-white flex items-center justify-center text-[11px] font-black",children:"B"}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[13px] font-black text-ink",children:"Betty"}),n.jsx("div",{className:"text-[10px] text-warm-gray",children:"Workflow assistant"})]}),n.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 text-[10px] text-emerald-700 font-bold",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500"}),"Online"]})]}),n.jsx("div",{className:"p-3 space-y-2.5 min-h-[340px]",children:tG.map((e,s)=>n.jsx(G.div,{initial:t?!1:{opacity:0,y:6},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:e.delay,duration:.4},className:`flex ${e.from==="bot"?"justify-start":"justify-end"}`,children:n.jsxs("div",{className:`max-w-[82%] rounded-2xl px-3.5 py-2 text-[12.5px] leading-relaxed ${e.from==="bot"?"bg-cream border border-warm-border text-ink rounded-bl-sm":"bg-olive-dark text-white rounded-br-sm"}`,children:[e.from==="bot"&&n.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-warm-gray mb
41-0.5",children:"Betty"}),e.text,e.actions&&n.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:e.actions.map((r,i)=>n.jsx("span",{className:`text-[10.5px] font-semibold px-2 py-1 rounded-md border ${e.primary===i?"bg-olive-dark text-white border-olive-dark":"bg-white text-ink border-warm-border"}`,children:r},r))})]})},s))}),n.jsxs("div",{className:"border-t border-warm-border p-3 bg-cream/40 flex items-center gap-2",children:[n.jsx("button",{"aria-label":"Attach a document",className:"w-7 h-7 rounded-md border border-warm-border bg-white flex items-center justify-center text-warm-gray",children:n.jsx(WA,{className:"w-3.5 h-3.5"})}),n.jsx("div",{className:"flex-1 px-3 py-2 rounded-md bg-white border border-warm-border text-[12px] text-warm-gray/70",children:"Tell Betty about a process, or paste an existing SOP…"}),n.jsx("button",{"aria-label":"Send message to Betty",className:"w-7 h-7 rounded-md bg-olive-dark text-white flex items-center justify-center",children:n.jsx(xj,{className:"w-3.5 h-3.5"})})]})]})})})})]})})}const nG=[{key:"overview",label:"Overview"},{key:"timeline",label:"Capture Timeline"},{key:"transcript",label:"Transcript"},{key:"sop",label:"SOP"},{key:"training",label:"Training Guide"},{key:"ai",label:"AI Script"},{key:"exports",label:"Exports"},{key:"review",label:"Review History"}];function rG(){const[t,e]=j.useState("overview"),s=op();return n.jsxs(Xc,{id:"outputs",eyebrow:"03 · Generated Outputs",title:n.jsxs(n.Fragment,{children:["One capture becomes"," ",n.jsx("em",{className:"font-serif italic text-olive-dark",children:"every operational asset"})," ","your team needs."]}),subtitle:"This is the actual workflow detail page from inside the portal. Eight tabs. Same recording. No re-typing. Click through them.",bg:"cream",children:[n.jsx(lp,{url:"app.workflowcapture.ai/portal#/workflows/criminal-grading-queue",children:n.jsxs("div",{className:"bg-cream",children:[n.jsxs("div",{className:"bg-white border-b border-warm-border px-4 sm:px-6 py-4 flex flex-wrap items-start justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-semibold text-warm-gray mb-1",children:"← Back to workflows"}),n.jsx("h3",{className:"text-lg font-black text-ink leading-tight",children:"Criminal grading queue"}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-warm-gray mt-1",children:[n.jsxs("span",{children:["Captured by ",n.jsx("strong",{className:"text-ink",children:"Sarah K."})]}),n.jsx("span",{children:"·"}),n.jsxs("span",{children:[n.jsx("strong",{className:"text-ink",children:"5"})," steps"]}),n.jsx("span",{children:"·"}),n.jsxs("span",{children:[n.jsx("strong",{className:"text-ink",children:"3"})," decision points"]}),n.jsx("span",{children:"·"}),n.jsx("span",{children:"Updated 2h ago"})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx(Nb,{status:"Approved"}),n.jsx("span",{className:"px-2.5 py-1.5 rounded-lg bg-white border border-warm-border text-[11px] font-semibold text-ink",children:"Edit with Betty"}),n.jsx("span",{className:"px-2.5 py-1.5 rounded-lg bg-white border border-warm-border text-[11px] font-semibold text-ink",children:"Export"})]})]}),n.jsx("div",{className:"bg-white border-b border-warm-border overflow-x-auto",children:n.jsx("div",{className:"flex",children:nG.map(r=>n.jsx("button",{onClick:()=>e(r.key),className:`px-4 py-2.5 text-[12px] font-semibold whitespace-nowrap border-b-2 transition-colors ${t===r.key?"border-olive-dark text-olive-dark":"border-transparent text-warm-gray hover:text-ink"}`,"data-testid":`tab-output-${r.key}`,children:r.label},r.key))})}),n.jsx("div",{className:"bg-white",children:n.jsx(Rr,{mode:"wait",children:n.jsxs(G.div,{initial:s?!1:{opacity:0,y:6},animate:{opacity:1,y:0},exit:s?void 0:{opacity:0,y:-4},transition:{duration:.25},children:[t==="overview"&&n.jsx(iG,{}),t==="timeline"&&n.jsx(oG,{}),t==="transcript"&&n.jsx(lG,{}),t==="sop"&&n.jsx(cG,{}),t==="training"&&n.jsx(dG,{}),t==="ai"&&n.jsx(uG,{}),t==="exports"&&n.jsx(hG,{}),t==="review"&&n.jsx(mG,{})]},t)})})]})}),n.jsx("p",{className:"text-[12px] text-warm-gray mt-4 italic",children:'↑ Same shape as the real workflow detail page. The 8 tabs, step-card structure, type badges, and "if unclear" notes are pulled straight from a real exported workflow.'})]})}const Hf=({children:t})=>n.jsx("h4",{className:"text-[10px] font-bold text-warm-gray uppercase tracking-wider mb-2",children:t});function iG(){const t=[{name:"Open the criminal grading queue",type:null,desc:"From the dashboard, click the Criminal Grading nav item.",tools:"Dashboard sidebar"},{name:"Read offense, date, disposition",type:"logic",desc:"For each pending adjudication record, read three fields before deciding.",logicNote:"Within 7 years → pay attention. Older than 7 years → no concern."},{name:"Apply the grading rule",type:"decision",desc:"Choose Clear, Review, or Adverse based on the rule matrix.",logicNote:"Misdemeanor → Clear. Dism
41issed → Clear. More than misdemeanor + within 7 years → Escalate.",ifUnclear:"If the disposition is missing, mark as Review and skip."},{name:"Save decision and continue",type:"forEach",desc:'Click "Save Decision", then return to the queue and open the next row.'}];return n.jsxs("div",{className:"px-4 sm:px-6 py-5 max-h-[540px] overflow-auto space-y-5",children:[n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[n.jsxs("div",{className:"border border-warm-border rounded-xl p-3",children:[n.jsx(Hf,{children:"What it does"}),n.jsx("p",{className:"text-[12.5px] text-ink leading-relaxed",children:"Reviews criminal search records in pending adjudication status and grades each based on offense severity, age, and disposition."})]}),n.jsxs("div",{className:"border border-warm-border rounded-xl p-3",children:[n.jsx(Hf,{children:"Why it exists"}),n.jsx("p",{className:"text-[12.5px] text-ink leading-relaxed",children:"Keep the queue current and apply consistent grading rules so escalations don't slip through."})]})]}),n.jsxs("div",{className:"border border-warm-border rounded-xl p-3",children:[n.jsx(Hf,{children:"Process insights"}),n.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-1 text-[12px] mb-2",children:[n.jsxs("span",{children:[n.jsx("span",{className:"font-bold text-warm-gray text-[10px]",children:"Frequency:"})," ",n.jsx("span",{className:"text-ink",children:"Every day"})]}),n.jsxs("span",{children:[n.jsx("span",{className:"font-bold text-warm-gray text-[10px]",children:"Volume:"})," ",n.jsx("span",{className:"text-ink",children:"20 pages daily"})]})]}),n.jsx("p",{className:"text-[10px] font-bold text-warm-gray uppercase tracking-wider mb-1",children:"Pain points"}),n.jsxs("ul",{className:"space-y-0.5",children:[n.jsxs("li",{className:"text-[11.5px] text-ink flex gap-1.5",children:[n.jsx("span",{className:"text-amber-500",children:"!"}),"20 pages every day, all manual."]}),n.jsxs("li",{className:"text-[11.5px] text-ink flex gap-1.5",children:[n.jsx("span",{className:"text-amber-500",children:"!"}),"Reviewer judgment varies by person."]})]})]}),n.jsxs("div",{children:[n.jsx(Hf,{children:"Workflow steps (4)"}),n.jsx("div",{className:"space-y-2",children:t.map((e,s)=>n.jsxs("div",{className:"border border-warm-border rounded-xl p-3 space-y-1.5",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"shrink-0 w-6 h-6 rounded-md bg-olive-dark/10 text-olive-dark text-[11px] font-bold flex items-center justify-center",children:s+1}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[n.jsx("span",{className:"text-[12.5px] font-bold text-ink",children:e.name}),e.type&&n.jsx(aG,{type:e.type})]}),n.jsx("p",{className:"text-[12px] text-ink/80 mt-0.5 leading-relaxed",children:e.desc})]})]}),e.logicNote&&n.jsx("div",{className:"ml-8 text-[11px] text-olive-dark bg-olive-dark/5 border border-olive-dark/10 rounded-md px-2.5 py-1.5 italic",children:e.logicNote}),e.tools&&n.jsxs("div",{className:"ml-8 text-[11px]",children:[n.jsx("span",{className:"font-bold text-warm-gray",children:"Tools:"})," ",n.jsx("span",{className:"text-ink",children:e.tools})]}),e.ifUnclear&&n.jsxs("div",{className:"ml-8 text-[11px] text-amber-800 bg-amber-50 border border-amber-200 rounded-md px-2.5 py-1.5",children:[n.jsx("span",{className:"font-bold",children:"If unclear:"})," ",e.ifUnclear]})]},s))})]})]})}function aG({type:t}){const s={logic:"bg-amber-50 text-amber-800 border-amber-200",forEach:"bg-blue-50 text-blue-700 border-blue-200",decision:"bg-amber-50 text-amber-800 border-amber-200"}[t]||"bg-cream text-warm-gray border-warm-border";return n.jsx("span",{className:`inline-flex px-1.5 py-0.5 rounded text-[9px] font-bold border ${s}`,children:t})}function oG(){const t=["Click 'Criminal Grading' nav","View pending adjudication queue","Open row 1 — DUI, 2022","Read offense / date / disposition","Click 'Clear'","Click 'Save Decision'","Return to queue","Open row 2 — Trespass, 2019","Click 'Clear' (older than 7 years)","Click 'Save Decision'","Open row 3 — Felony, 2024","Click 'Escalate' (more than misdemeanor + recent)"];return n.jsx("ol",{className:"px-4 sm:px-6 py-5 max-h-[540px] overflow-auto space-y-2",children:t.map((e,s)=>n.jsxs("li",{className:"flex gap-3 py-1.5 border-l-2 border-olive-dark/30 pl-3 -ml-1",children:[n.jsx("span",{className:"shrink-0 w-6 text-warm-gray text-[10px] font-bold tabular-nums",children:String(s+1).padStart(2,"0")}),n.jsx("span",{className:"text-[12.5px] text-ink",children:e})]},s))})}function lG(){return n.jsx("div",{className:"px-4 sm:px-6 py-5 max-h-[540px] overflow-auto",children:n.jsx("p",{className:"text-[12.5px] text-ink leading-relaxed whitespace-pre-wrap font-sans",children:`All righty, in today's video I'm going to show you how I process things out of the criminal grading queue. So after I log into the dashboard, I click on the criminal grading nav button, and then I 
41see all of the searches I have to grade.
42
43What I do is, I click on the first search in the list — you can click anywhere on the row and I'll be brought to the information for that search. Essentially what I do is, I look at the record data, and depending on what the record data is, that determines the decision: clear, review, or adverse.
44
45I take into account the offense description, the offense date, and the disposition. If something is within seven years, I have to pay attention to it. If it's older than seven years, I don't have to worry about it. If it's dismissed, I also don't have to worry about it.
46
47If anything's more than a misdemeanor and it is newer than seven years, I don't clear it — I actually escalate it. So that's how I do it, and I have to do this every day. As you can see, there's twenty pages I have to do on a daily basis. It would be really helpful if there was an automation for this.`})})}function cG(){return n.jsxs("div",{className:"px-4 sm:px-6 py-5 max-h-[540px] overflow-auto max-w-3xl",children:[n.jsxs("div",{className:"border-b border-warm-border pb-3 mb-4",children:[n.jsx("h2",{className:"text-[15px] font-black text-ink",children:"Criminal grading queue — Standard Operating Procedure"}),n.jsxs("div",{className:"flex flex-wrap gap-3 text-[10px] text-warm-gray mt-1.5",children:[n.jsx("span",{children:"Version: 1.0"}),n.jsx("span",{children:"Status: Approved"}),n.jsx("span",{children:"Last updated: May 4, 2026"})]})]}),n.jsx("h3",{className:"text-[12px] font-bold text-ink uppercase tracking-wider mb-1.5",children:"Purpose"}),n.jsx("p",{className:"text-[12.5px] text-ink mb-4 leading-relaxed",children:"Review pending adjudication searches and apply consistent grading decisions based on offense severity, age, and disposition."}),n.jsx("h3",{className:"text-[12px] font-bold text-ink uppercase tracking-wider mb-1.5",children:"Eligibility"}),n.jsxs("ul",{className:"text-[12.5px] text-ink mb-4 space-y-0.5 list-disc pl-5",children:[n.jsx("li",{children:'Search must be in "Pending Adjudication" status.'}),n.jsx("li",{children:"Reviewer must have grading permissions."})]}),n.jsx("h3",{className:"text-[12px] font-bold text-ink uppercase tracking-wider mb-1.5",children:"Terminal outcomes"}),n.jsxs("div",{className:"space-y-2 mb-3",children:[n.jsxs("div",{className:"border border-warm-border rounded-md p-2.5",children:[n.jsx("p",{className:"text-[12px] font-bold text-ink",children:"Cleared"}),n.jsxs("p",{className:"text-[11.5px] text-ink/80",children:[n.jsx("span",{className:"text-warm-gray font-semibold",children:"Criteria:"})," Misdemeanor, dismissed, or older than 7 years."]})]}),n.jsxs("div",{className:"border border-warm-border rounded-md p-2.5",children:[n.jsx("p",{className:"text-[12px] font-bold text-ink",children:"Escalated"}),n.jsxs("p",{className:"text-[11.5px] text-ink/80",children:[n.jsx("span",{className:"text-warm-gray font-semibold",children:"Criteria:"})," More than misdemeanor and newer than 7 years."]})]})]})]})}function dG(){return n.jsxs("div",{className:"px-4 sm:px-6 py-5 max-h-[540px] overflow-auto max-w-3xl",children:[n.jsx("h2",{className:"font-serif text-xl text-ink mb-2",children:"Training: Criminal Grading Queue"}),n.jsx("p",{className:"text-[11px] text-warm-gray mb-5",children:"Estimated 15 minutes · Beginner-friendly · 3 lessons"}),n.jsx("h3",{className:"text-[12.5px] font-bold text-ink mb-1.5",children:"What you'll learn"}),n.jsxs("ul",{className:"text-[12.5px] text-ink mb-5 space-y-0.5 list-disc pl-5",children:[n.jsx("li",{children:"How to find searches in pending adjudication status"}),n.jsx("li",{children:"How to apply the grading rules consistently"}),n.jsx("li",{children:"When to clear versus when to escalate"})]}),n.jsx("h3",{className:"font-serif text-base text-ink mb-1.5",children:"Lesson 1 — The 7-year rule"}),n.jsxs("p",{className:"text-[12.5px] text-ink mb-2 leading-relaxed",children:["If a record's offense date is more than 7 years old, you don't have to worry about it. Mark it cleared and move on. Anything ",n.jsx("em",{children:"within"})," 7 years requires careful review."]}),n.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-md px-3 py-2 mb-4 text-[11.5px]",children:[n.jsx("strong",{className:"text-amber-900",children:"Common mistake:"})," Confusing the offense date with the disposition date. Always read the offense date."]}),n.jsx("h3",{className:"font-serif text-base text-ink mb-1.5",children:"Lesson 2 — Severity"}),n.jsx("p",{className:"text-[12.5px] text-ink leading-relaxed",children:"Misdemeanors are always cleared. Anything more serious AND newer than 7 years goes to escalation, never gets cleared."})]})}function uG(){return n.jsx("pre",{className:"bg-[#0f1a13] text-[11px] sm:text-[11.5px] leading-relaxed text-cream/90 px-4 sm:px-6 py-5 max-h-[540px] overflow-auto font-mono",children:n.jsx("code",{children:`// Generated by Workflow Capture · v1.0
48// Workflow: Criminal grading queue
49// Approved by: Mark T. · 2026-05-04
50
51import { runBrowser } from '@workflow-capture/runtime';
52
53await runBrowser(async (page, ctx) => {
54  // Step 1: Open the criminal grading queue
55  await page.goto('https://app.verifiedgrading.com/dashboard');
56  await page.click('.legacy-sidebar:has-text("Criminal Grading")');
57
58  // Step 2: Loop over pending adjudication rows
59  for (const row of await page.$$('table tr:has-text("Pending Adjudication")')) {
60    await row.click();
61
62    const offense = await page.locator('.offense-desc').innerText();
63    const dateStr = await page.locator('.offense-date').innerText();
64    const disposition = await page.locator('.disposition').innerText();
65
66    const decision = ctx.applyRule({ offense, dateStr, disposition });
67    // ↳ Misdemeanor → Clear
68    // ↳ Dismissed   → Clear
69    // ↳ >Misdemeanor & <7y → Escalate
70
71    await page.click(\`button:has-text("\${decision}")\`);
72    await page.click('button:has-text("Save Decision")');
73    await page.goBack();
74  }
75});`})})}function hG(){const t=[{fmt:"PDF",file:"Criminal-Grading-Queue.pdf",who:"Mark T.",when:"2h ago"},{fmt:"Markdown",file:"criminal-grading-queue.md",who:"Mark T.",when:"2h ago"},{fmt:"PDF",file:"Criminal-Grading-Queue-v0.9.pdf",who:"Sarah K.",when:"1d ago"}];return n.jsxs("div",{className:"px-4 sm:px-6 py-5 max-h-[540px] overflow-auto",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsx("h3",{className:"text-[12.5px] font-bold text-ink",children:"Export history"}),n.jsx("span",{className:"px-2.5 py-1 rounded-md bg-olive-dark text-white text-[10px] font-semibold",children:"+ New exp
75ort"})]}),n.jsx("div",{className:"overflow-x-auto -mx-1",children:n.jsxs("table",{className:"w-full text-[12px] min-w-[420px]",children:[n.jsx("thead",{className:"text-warm-gray text-[10px] uppercase tracking-wider",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left py-2 font-bold",children:"Format"}),n.jsx("th",{className:"text-left py-2 font-bold",children:"File"}),n.jsx("th",{className:"text-left py-2 font-bold",children:"By"}),n.jsx("th",{className:"text-left py-2 font-bold",children:"When"})]})}),n.jsx("tbody",{children:t.map((e,s)=>n.jsxs("tr",{className:"border-t border-warm-border",children:[n.jsx("td",{className:"py-2.5",children:n.jsx("span",{className:"px-2 py-0.5 rounded-md bg-cream text-ink text-[10.5px] font-semibold border border-warm-border",children:e.fmt})}),n.jsx("td",{className:"py-2.5 text-ink font-mono text-[11px]",children:e.file}),n.jsx("td",{className:"py-2.5 text-warm-gray",children:e.who}),n.jsx("td",{className:"py-2.5 text-warm-gray",children:e.when})]},s))})]})})]})}function mG(){const t=[{who:"Mark T.",what:"Approved",note:"Looks good — shipping it.",when:"2h ago",tone:"emerald"},{who:"Mark T.",what:"Edited Step 3",note:"Renamed to 'Apply the grading rule'.",when:"2h ago",tone:"slate"},{who:"Mark T.",what:"Commented on Step 2",note:"Add a note about disposition.",when:"3h ago",tone:"slate"},{who:"Sarah K.",what:"Submitted for review",note:"First version — please check the 7-year logic.",when:"5h ago",tone:"amber"},{who:"system",what:"AI normalization",note:"12 raw actions → 4 named steps.",when:"5h ago",tone:"olive"},{who:"Sarah K.",what:"Capture complete",note:"5m 34s recording, 1 voice annotation.",when:"5h ago",tone:"olive"}];return n.jsx("div",{className:"px-4 sm:px-6 py-5 max-h-[540px] overflow-auto space-y-2.5",children:t.map((e,s)=>{const r=e.tone==="emerald"?"bg-emerald-50 border-emerald-200 text-emerald-700":e.tone==="amber"?"bg-amber-50 border-amber-200 text-amber-800":e.tone==="olive"?"bg-olive-dark/5 border-olive-dark/15 text-olive-dark":"bg-slate-50 border-slate-200 text-slate-700";return n.jsxs("div",{className:"flex gap-3",children:[n.jsx("span",{className:`shrink-0 mt-0.5 px-2 py-0.5 rounded-md border text-[10px] font-bold ${r}`,children:e.what}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"text-[12.5px] text-ink",children:[n.jsx("strong",{children:e.who}),n.jsxs("span",{className:"text-warm-gray",children:[" · ",e.when]})]}),n.jsxs("div",{className:"text-[11.5px] text-warm-gray italic",children:['"',e.note,'"']})]})]},s)})})}const pT=[{name:"Refund escalation",recorder:"Sarah K.",reviewer:"—",steps:6,status:"Needs Review",outputs:"—",updated:"2h ago"},{name:"New client onboarding",recorder:"Diego M.",reviewer:"Mark T.",steps:8,status:"Approved",outputs:"SOP · Training · AI Script",updated:"5h ago"},{name:"Criminal grading queue",recorder:"Sarah K.",reviewer:"Mark T.",steps:5,status:"Approved",outputs:"SOP · Training · AI Script",updated:"1d ago"},{name:"Audit log review",recorder:"Diego M.",reviewer:"Sarah K.",steps:4,status:"Captured",outputs:"—",updated:"1d ago"},{name:"Failed payment recovery",recorder:"Sarah K.",reviewer:"Mark T.",steps:7,status:"Generating",outputs:"—",updated:"2d ago"}];function pG(){const[t,e]=j.useState(!1),s=op(),r=t?pT.map(i=>i.name==="Refund escalation"?{...i,status:"Approved",reviewer:"Mark T."}:i):pT;return n.jsx(Xc,{id:"review",eyebrow:"04 · Review & Approval",title:n.jsxs(n.Fragment,{children:["Keep humans in the loop"," ",n.jsx("em",{className:"font-serif italic text-olive-dark",children:"before workflows go live."})]}),subtitle:"Every workflow lands in the Workflows page in one of seven statuses. A reviewer can edit any step, leave comments, and approve. Nothing exports until the status is Approved.",bg:"white",children:n.jsxs("div",{className:"grid lg:grid-cols-12 gap-10 items-start",children:[n.jsx("div",{className:"lg:col-span-7",children:n.jsx(lp,{url:"app.workflowcapture.ai/portal#/workflows",children:n.jsxs("div",{className:"bg-cream",children:[n.jsxs("div",{className:"bg-white border-b border-warm-border px-4 py-3 flex gap-2",children:[n.jsx("div",{className:"flex-1 px-3 py-1.5 rounded-md border border-warm-border bg-white text-[11px] text-warm-gray/70",children:"Search workflows…"}),n.jsxs("div",{className:"w-32 px-2.5 py-1.5 rounded-md border border-warm-border bg-white text-[11px] text-ink flex items-center justify-between",children:["All statuses ",n.jsx("span",{className:"text-warm-gray",children:"▾"})]})]}),n.jsx("div",{className:"bg-white overflow-x-auto",children:n.jsxs("table",{className:"w-full text-[11.5px] min-w-[720px]",children:[n.jsx("thead",{className:"bg-cream/50 text-warm-gray text-[9px] uppercase tracking-wider",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left py-2 px-3 font-bold",children:"Workflow"}),n.jsx("th",{className:"text-left py-2 px-3 font-bold",children:"Status"}),n.jsx("th",{className:"text-left py-2 px-3 font-bold",children:"Owner"}),n.jsx("th",{className:"text-left py-2 px-3 font-bold",children:"Reviewer"}),n.jsx("th",{className:"text-left py-2 px-3 font-bold",children:"Outputs"}),n.jsx("th",{className:"text-left py-2 px-3 font-bold",children:"Last updated"}),n.jsx("th",{className:"text-right py-2 px-3 font-bold",children:"Action"})]})}),n.jsx("tbody",{children:r.map(i=>n.jsxs(G.tr,{layout:!0,initial:!1,animate:{backgroundColor:i.name==="Refund escalation"&&t?"rgba(16,185,129,0.06)":"rgba(0,0,0,0)"},transition:{duration:.4},className:"border-t border-warm-border",children:[n.jsxs("td",{className:"py-2.5 px-3",children:[n.jsx("div",{className:"text-[12px] font-semibold text-ink",children:i.name}),n.jsxs("div",{className:"text-[10px] text-warm-gray",children:[i.steps," steps"]})]}),n.jsx("td",{className:"py-2.5 px-3",children:n.jsx(Nb,{status:i.status})}),n.jsx("td",{className:"py-2.5 px-3 text-warm-gray text-[10.5px]",children:i.recorder}),n.jsx("td",{className:"py-2.5 px-3 text-warm-gray text-[10.5px]",children:i.reviewer}),n.jsx("td",{className:"py-2.5 px-3 text-warm-gray text-[10.5px]",children:i.name==="Refund escalation"&&t?"SOP · Training · AI Script":i.outputs}),n.jsx("td",{className:"py-2.5 px-3 text-warm-gray text-[10.5px]",children:i.updated}),n.jsx("td",{className:"py-2.5 px-3 text-right",children:i.name==="Refund escalation"&&!t?n.jsx("button",{onClick:()=>e(!0),className:"inline-flex items-center px-2.5 py-1 rounded-md bg-olive-dark text-white text-[10.5px] font-semibold hover:bg-olive-dark/90","data-testid":"button-approve-demo",children:"Approve"}):n.jsx("span",{className:"text-[10.5px] text-warm-gray",children:"Open →"})})]},i.name))})]})}),!t&&n.jsxs(G.div,{initial:s?!1:{opacity:0}
75,animate:{opacity:1},className:"px-4 py-2.5 bg-amber-50 border-t border-amber-200 text-[11px] text-amber-900 flex items-center gap-2",children:[n.jsx("span",{className:"font-bold",children:"Try it →"}),' Click "Approve" on the Needs Review row above to see the status update flow live.']}),t&&n.jsxs(G.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},className:"px-4 py-2.5 bg-emerald-50 border-t border-emerald-200 text-[11px] text-emerald-800 flex items-center gap-2",children:[n.jsx("span",{className:"font-bold",children:"✓ Approved."})," Workflow is now eligible for export to PDF, Markdown, or AI script."]})]})})}),n.jsxs("div",{className:"lg:col-span-5 lg:pt-4",children:[n.jsxs("ul",{className:"space-y-2.5 mb-4",children:[n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"7 status states"})," — Captured → Generating → Needs Review → Approved → Exported → Sent to Runtime (with Failed as the off-ramp)."]}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Edit with Betty"})," — open any workflow and rewrite steps in chat with the assistant."]}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Inline approval"})," — one click changes the status and unlocks export."]}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Review History tab"})," on every workflow — every edit, comment, and approval, with timestamps."]}),n.jsxs(Ln,{children:[n.jsx("strong",{className:"text-ink",children:"Approval gates exports"})," — nothing leaves Workflow Capture until status = Approved."]})]}),n.jsx("div",{className:"text-[11px] text-warm-gray italic",children:"↑ Same status pills you'll see in your portal — same colours, same labels."})]})]})})}const fG=[{icon:Mi,name:"Markdown",desc:"Drop into any wiki, repo, or doc tool.",status:"Available"},{icon:VA,name:"PDF",desc:"Polished, signable, audit-ready.",status:"Available"},{icon:q8,name:"Browser automation script",desc:"Real selectors, runnable today.",status:"Available"},{icon:A8,name:"Google Docs",desc:"Push approved SOPs to your Drive.",status:"Coming soon"},{icon:tM,name:"Confluence",desc:"Sync to your space + page tree.",status:"Coming soon"},{icon:V$,name:"Webhooks / Zapier",desc:"Fire on approved → trigger anything.",status:"Coming soon"}];function xG(){const[t,e]=j.useState(!1),[s,r]=j.useState(null);function i(a){e(!1),r(a),setTimeout(()=>r(null),2400)}return n.jsx(Xc,{id:"export",eyebrow:"05 · Export & Activation",title:n.jsxs(n.Fragment,{children:["Move approved workflows"," ",n.jsx("em",{className:"font-serif italic text-olive-dark",children:"into the tools where work happens."})]}),subtitle:"The Export menu in the workflow detail page is the same one you'd click in your portal. Click it below to see exactly what your team would experience.",bg:"cream",children:n.jsxs("div",{className:"grid lg:grid-cols-12 gap-10 items-start",children:[n.jsx("div",{className:"lg:col-span-7",children:n.jsx(lp,{url:"app.workflowcapture.ai/portal#/workflows/criminal-grading-queue",children:n.jsxs("div",{className:"bg-cream p-4",children:[n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl p-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 mb-4",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"text-[14px] font-black text-ink leading-tight",children:"Criminal grading queue"}),n.jsx("div",{className:"text-[10.5px] text-warm-gray mt-0.5",children:"Captured by Sarah K. · 5 steps · Updated 2h ago"})]}),n.jsxs("div",{className:"flex items-center gap-1.5 relative",children:[n.jsx(Nb,{status:"Approved"}),n.jsx("button",{onClick:()=>e(a=>!a),className:"px-2.5 py-1.5 rounded-lg bg-white border border-warm-border text-[11px] font-semibold text-ink hover:bg-cream","data-testid":"button-export-demo",children:"Export"}),n.jsx(Rr,{children:t&&n.jsx(G.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},className:"absolute right-0 top-9 w-52 bg-white rounded-lg shadow-xl border border-warm-border z-20 py-1",children:[["pdf","Export as PDF",VA],["markdown","Export as Markdown",Mi]].map(([a,l,d])=>n.jsxs("button",{onClick:()=>i(a),className:"w-full text-left px-3 py-2 text-[12px] text-ink hover:bg-cream flex items-center gap-2",children:[n.jsx(d,{className:"w-3.5 h-3.5 text-warm-gray"}),l]},a))})})]})]}),n.jsx("div",{className:"text-[10px] font-bold text-warm-gray uppercase tracking-wider mb-1.5",children:"Export history"}),n.jsx("div",{className:"divide-y divide-warm-border/60",children:[{fmt:"PDF",file:"Criminal-Grading-Queue.pdf",when:"2h ago"},{fmt:"Markdown",file:"criminal-grading-queue.md",when:"2h ago"}].map(a=>n.jsxs("div",{className:"flex items-center justify-between py-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cream text-ink text-[10px] font-bold border border-warm-border",children:a.fmt}),n.jsx("span",{className:"text-[11.5px] text-ink font-mono",children:a.file})]}),n.jsx("span",{className:"text-[10.5px] text-warm-gray",children:a.when})]},a.file))})]}),n.jsx(Rr,{children:s&&n.jsxs(G.div,{initial:{opacity:0,y:8}
75,animate:{opacity:1,y:0},exit:{opacity:0,y:-4},className:"mt-3 inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-emerald-600 text-white text-[12px] font-semibold shadow-lg",children:[n.jsx(db,{className:"w-3.5 h-3.5"}),s.toUpperCase()," downloaded",n.jsx(na,{className:"w-3.5 h-3.5 opacity-70"})]})})]})})}),n.jsxs("div",{className:"lg:col-span-5",children:[n.jsx("div",{className:"text-[11px] font-bold text-warm-gray uppercase tracking-wider mb-3",children:"Destinations"}),n.jsx("div",{className:"space-y-2",children:fG.map(a=>{const l=a.icon,d=a.status==="Available";return n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl p-3 flex items-center gap-3","data-testid":`card-export-${a.name.toLowerCase().replace(/\W+/g,"-")}`,children:[n.jsx("div",{className:"w-9 h-9 rounded-lg bg-[#f0ece2] flex items-center justify-center shrink-0",children:n.jsx(l,{className:"w-4 h-4 text-olive-dark"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-[13px] font-black text-ink truncate",children:a.name}),n.jsx("div",{className:"text-[11px] text-warm-gray truncate",children:a.desc})]}),n.jsx("span",{className:`text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded border shrink-0 ${d?"bg-emerald-50 text-emerald-700 border-emerald-200":"bg-amber-50 text-amber-800 border-amber-200"}`,children:a.status})]},a.name)})})]})]})})}const gG=[{icon:KA,title:"Claims escalation",prompt:'"Capture how an adjuster reviews and escalates a claim."',capture:"Browser capture · 8 min recording",output:"SOP + decision logic + AI script",result:"Standardize triage across the team"},{icon:XA,title:"Customer onboarding",prompt:'"I onboard new clients with the same 8-step process every time."',capture:"Described to Betty · 5 min chat",output:"Training guide + checklist",result:"Cut new-CSM ramp from weeks to days"},{icon:h$,title:"Compliance review",prompt:`"I run a weekly compliance review I'd like to document."`,capture:"Uploaded existing SOP · auto-parsed",output:"Reviewer SOP + audit trail",result:"Defensible process for regulators"},{icon:$x,title:"Revenue ops handoff",prompt:'"Closed-won deal handed to implementation."',capture:"Browser capture · 12 min recording",output:"Runnable script + checklist",result:"Automate the boring 80% of handoff"},{icon:E9,title:"Refund / exception handling",prompt:'"Capture a refund/exception handling process."',capture:"Browser capture · 6 min recording",output:"Decision SOP + escalation matrix",result:"Fewer mis-routed tickets, faster resolution"},{icon:vj,title:"Existing SOP → AI script",prompt:'"Help me turn an existing SOP into an AI-ready script."',capture:"Uploaded DOCX · Betty parsed it",output:"Browser automation script",result:"Old SOPs become runnable today"}];function bG(){return n.jsx(Xc,{id:"usecases",eyebrow:"06 · Use cases",title:n.jsxs(n.Fragment,{children:["Real workflow prompts from the portal."," ",n.jsx("em",{className:"font-serif italic text-olive-dark",children:"All shapes Betty handles today."})]}),subtitle:"These prompts come straight from Betty's suggestion list. Click into the portal and you can pick any one to start with.",bg:"white",children:n.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:gG.map(t=>{const e=t.icon;return n.jsxs("div",{className:"bg-cream border border-warm-border rounded-2xl p-5 hover:border-olive-dark/40 transition flex flex-col","data-testid":`card-usecase-${t.title.toLowerCase().replace(/\W+/g,"-")}`,children:[n.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-white border border-warm-border flex items-center justify-center shrink-0",children:n.jsx(e,{className:"w-5 h-5 text-olive-dark"})}),n.jsx("div",{className:"text-[15px] font-black text-ink leading-tight",children:t.title})]}),n.jsx("div",{className:"text-[12px] italic text-olive-dark bg-olive-dark/5 border border-olive-dark/10 rounded-md px-2.5 py-1.5 mb-3",children:t.prompt}),n.jsxs("div",{className:"space-y-1.5 text-[12.5px] mt-auto",children:[n.jsx(Nv,{label:"How",value:t.capture}),n.jsx(Nv,{label:"Output",value:t.output}),n.jsx(Nv,{label:"Result",value:t.result,highlight:!0})]})]},t.title)})})})}function Nv({label:t,value:e,highlight:s}){return n.jsxs("div",{className:"flex gap-2",children:[n.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wide text-warm-gray shrink-0 w-12 mt-0.5",children:t}),n.jsx("span",{className:s?"text-olive-dark font-semibold":"text-ink/80",children:e})]})}const yG=[{icon:e9,title:"No screen recording",desc:"We capture structured browser actions and voice — never video, never screenshots."},{icon:po,title:"Password fields excluded",desc:"Anything in a password input is dropped at the source, never transmitted."},{icon:R$,title:"User-controlled capture",desc:"Recording only runs while the user explicitly clicks Record. Visible status indicator at all times."},{icon:PA,title:"Workspace isolation",desc:"Each customer runs in a dedicated AWS environment. No shared tenancy, no co-mingled data."},{icon:yj,title:"Encrypted in transit",desc:"TLS everywhere. At-rest encryption on every database, blob, and audio file."},{icon:F8,title:"Review before export",desc:"Approval gate on every artifact. Nothing leaves the platform without a human signoff."}];function vG(){return n.jsxs(Xc,{id:"security",eyebrow:"07 · Security",title:n.jsxs(n.Fragment,{children:["Capture operational knowledge"," ",n.jsx("em",{className:"font-serif italic text-cream",children:"without exposing sensitive data."})]}),subtitle:"Workflow Capture is built for regulated operations — claims, compliance, healthcare, finance. The design choices reflect that.",bg:"ink",children:[n.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:yG.map(t=>{const e=t.icon;return n.jsxs("div",{className:"bg-white/[0.04] border border-white/10 rounded-2xl p-5 hover:bg-white/[0.06] transition","data-testid":`card-security-${t.title.toLowerCase().replace(/\W+/g,"-")}`,children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-white/10 border border-white/10 flex items-center justify-center mb-3",children:n.jsx(e,{className:"w-5 h-5 text-cream"})}),n.jsx("div",{className:"text-[15px] font-black text-white mb-1",children:t.title}),n.jsx("p",{className:"text-[13px] text-white/70 leading-relaxed",children:t.desc})]},t.title)})}),n.jsxs("div",{className:"mt-8 text-[13px] text-white/70",children:["Read the full"," ",n.jsx("a",{href:"/security",className:"text-cream font-semibold underline underline-offset-2",children:"security overview"})," ","·"," ",n.jsx("a",{href:"/dpa",className:"text-cream font-semibold underline underline-offset-2",children:"DPA"})," ","·"," ",n.jsx("a",{href:"/subprocessors",className:"text-cream font-semibold underline underline-offset-2",children:"subprocessors"}),"."]})]})}function wG(){return n.jsx("section",{className:"px-4 sm:px-6 py-16 sm:py-24 lg:py-32",style:{background:"radial-gradient(circle at 18% 20%, rgba(255,255,255,0.08), transparent 30%), linear-gradient(135deg, #184832 0%, #20543a 60%, #2f6148 100%)"},"data-testid":"section-final-cta",children:n.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[n.jsxs("h2",{className:"font-serif text-3xl sm:text-4xl lg:text-5xl text-white leading-[1.1] sm:leading-[1.05] tracking-tight mb-4 sm:mb-5",children:["The workflow intelligence platform."," ",n.jsx("span",{className:"text-cream",children:"Inspect every piece above."})]}),n.jsx("p",{className:"text-base sm:text-lg text-white/80 mb-7 sm:mb-8 leading-relaxed",children:"Free to start. Capture your first workflow in under 5 minutes. No credit card."}),n.jsxs("div",{className:"flex flex-wrap justify-center gap-3",children:[n.jsxs(Ae,{href:"/signup",className:"inline-flex items-center px-6 py-3 rounded-full bg-white text-olive-dark hover:bg-cream font-semibold shadow-lg","data-testid":"button-final-start",children:["Start capturing free",n.jsx(kn,{className:"ml-1.5 w-4 h-4"})]}),n.jsx(Ae,{href:"/pricing",className:"inline-flex items-center px-6 py-3 rounded-full bg-white/10 hover:bg-white/15 border border-white/15 text-white font-semibold","data-testid":"button-final-pricing",children:"See pricing"})]})]})})}function fT(){return n.jsxs("div",{className:"bg-cream text-ink","data-testid":"page-home-v2",children:[n.jsx(qW,{variant:"heroDark"}),n.jsx(KW,{}),n.jsx(ZW,{}),n.jsx(sG,{}),n.jsx(rG,{}),n.jsx(pG,{}),n.jsx(xG,{}),n.jsx(bG,{}),n.jsx(vG,{}),n.jsx(wG,{}),n.jsx(WW,{})]})}function jG(){const[t]=Al();return j.useEffect(()=>{window.scrollTo(0,0)},[t]),null}function NG(){return n.jsxs("div",{className:"pt-40 pb-32 px-4 text-center min-h-[60vh] bg-cream","data-testid":"page-wc-notfound",children:[n.jsx("h1",{className:"font-serif text-5xl text-ink mb-3",children:"404"}
75),n.jsx("p",{className:"text-warm-gray mb-6",children:"That page doesn't exist on Workflow Capture."}),n.jsx("a",{href:"/",className:"text-olive hover:underline font-semibold",children:"← Go home"})]})}function kG({basePath:t=""}){return n.jsx(GE,{base:t,children:n.jsxs("div",{className:"min-h-screen bg-cream text-ink font-sans antialiased flex flex-col","data-testid":"workflow-capture-site",children:[n.jsx(jG,{}),n.jsx("main",{className:"flex-1",children:n.jsxs(ij,{children:[n.jsx(tt,{path:"/",component:fT}),n.jsx(tt,{path:"/v2",component:fT}),n.jsx(tt,{path:"/v1",component:Cx}),n.jsx(tt,{path:"/pricing",component:Cx}),n.jsx(tt,{path:"/features",component:Cx}),n.jsx(tt,{path:"/demo",component:SW}),n.jsx(tt,{path:"/signup",component:CW}),n.jsx(tt,{path:"/signin",component:TW}),n.jsx(tt,{path:"/privacy",component:aT}),n.jsx(tt,{path:"/workflow-capture-privacy-policy",component:aT}),n.jsx(tt,{path:"/extension-support",component:lT}),n.jsx(tt,{path:"/support",component:lT}),n.jsx(tt,{path:"/terms",component:MW}),n.jsx(tt,{path:"/dpa",component:_W}),n.jsx(tt,{path:"/subprocessors",component:RW}),n.jsx(tt,{path:"/security",component:IW}),n.jsx(tt,{path:"/customer-stories",component:$W}),n.jsx(tt,{path:"/changelog",component:VW}),n.jsx(tt,{path:"/status",component:HW}),n.jsx(tt,{path:"/terms-of-service",children:()=>n.jsx(Q0,{to:"/terms"})}),n.jsx(tt,{path:"/how-it-works",children:()=>n.jsx(Q0,{to:"/#how"})}),n.jsx(tt,{path:"/contact",children:()=>n.jsx(Q0,{to:"/extension-support"})}),n.jsx(tt,{path:"/workflow-as",children:()=>(window.location.replace("https://workflowas.live/"),null)}),n.jsx(tt,{component:NG})]})})]})})}function FO(){return null}var SG=Symbol.for("react.lazy"),eg=X1[" use ".trim().toString()];function CG(t){return typeof t=="object"&&t!==null&&"then"in t}function UO(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===SG&&"_payload"in t&&CG(t._payload)}function TG(t){const e=AG(t),s=j.forwardRef((r,i)=>{let{children:a,...l}=r;UO(a)&&typeof eg=="function"&&(a=eg(a._payload));const d=j.Children.toArray(a),u=d.find(_G);if(u){const m=u.props.children,p=d.map(x=>x===u?j.Children.count(m)>1?j.Children.only(null):j.isValidElement(m)?m.props.children:null:x);return n.jsx(e,{...l,ref:i,children:j.isValidElement(m)?j.cloneElement(m,void 0,p):null})}return n.jsx(e,{...l,ref:i,children:a})});return s.displayName=`${t}.Slot`,s}var EG=TG("Slot");function AG(t){const e=j.forwardRef((s,r)=>{let{children:i,...a}=s;if(UO(i)&&typeof eg=="function"&&(i=eg(i._payload)),j.isValidElement(i)){const l=RG(i),d=OG(a,i.props);return i.type!==j.Fragment&&(d.ref=r?ib(r,l):l),j.cloneElement(i,d)}return j.Children.count(i)>1?j.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var MG=Symbol("radix.slottable");function _G(t){return j.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===MG}function OG(t,e){const s={...e};for(const r in e){const i=t[r],a=e[r];/^on[A-Z]/.test(r)?i&&a?s[r]=(...d)=>{const u=a(...d);return i(...d),u}:i&&(s[r]=i):r==="style"?s[r]={...i,...a}:r==="className"&&(s[r]=[i,a].filter(Boolean).join(" "))}return{...t,...s}}function RG(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning;return s?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,s=e&&"isReactWarning"in e&&e.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}const DG=_A("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover-elevate active-elevate-2",{variants:{variant:{default:"bg-primary text-primary-foreground border border-primary-border",destructive:"bg-destructive text-destructive-foreground shadow-sm border-destructive-border",outline:" border [border-color:var(--button-outline)] shadow-xs active:shadow-none ",secondary:"border bg-secondary text-secondary-foreground border border-secondary-border ",ghost:"border border-transparent",link:"text-primary underline-offset-4 hover:underline"},size:{default:"min-h-9 px-4 py-2",sm:"min-h-8 rounded-md px-3 text-xs",lg:"min-h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),HO=j.forwardRef(({className:t,variant:e,size:s,asChild:r=!1,...i},a)=>{const l=r?EG:"button";return n.jsx(l,{className:_l(DG({variant:e,size:s,className:t})),ref:a,...i})});HO.displayName="Button";function qO({accentColor:t="olive"}){const[e,s]=j.useState(!1),[r,i]=j.useState(!1),[a,l]=j.useState([]),[d,u]=j.useState(""),[m,p]=j.useState(!1),[x,g]=j.useState(null),[b,v]=j.useState(!1),[k,N]=j.useState(0),[S,A]=j.useState([]),E=j.useRef(null),_=j.useRef(null),T=()=>{E.current?.scrollIntoView({behavior:"smooth"})};j.useEffect(()=>{T()},[a]),j.useEffect(()=>{e&&_.current&&_.current.focus()},[e,r]);const $=async()=>{try{const Y=await(await fetch("/api/chat/start",{method:"POST",headers:{"Content-Type":"application/json"}})).json();g(Y.conversationId),l([Y.message]),A(["Tell me about your workflows","I work in background checks","Show me how it works"])}catch(U){console.error("Failed to start conversation:",U),l([{role:"assistant",content:"Hi! I'm here to help you explore how Workflow AS can automate your regulated workflows safely. We help teams train digital workers that can't go off-script. What kind of repetitive work is your team handling today?",timestamp:new Date().toISOString()}]),A(["What's the audit loop?","I work in background checks","How are you different from RPA?"])}},L=async()=>{s(!0),i(!1),v(!1),N(a.length),a.length===0&&await $()},M=async()=>{e?s(!1):await L()};j.useEffect(()=>{const U=()=>{L()};return window.addEventListener("openChatbot",U),()=>window.removeEventListener("openChatbot",U)},[]);const I=async U=>{const Y=U||d.trim();if(!Y||m)return;const P={role:"user",content:Y,timestamp:new Date().toISOString()};l(ne=>[...ne,P]),u(""),p(!0),_.current&&(_.current.style.height="auto",_.current.style.height="44px"),A([]);try{if(x){const q=await(await fetch(`/api/chat/${x}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:P.content})})).json();l(W=>[...W,q.message]),q.suggestedActions&&A(q.suggestedActions)}else setTimeout(()=>{l(ne=>[...ne,{role:"assistant",content:"Thanks for reaching out! I'd love to learn more about what you're looking to automate. What kind of repetitive tasks does your team handle?",timestamp:new Date().toISOString()}
75]),A(["Background check searches","HR onboarding tasks","Finance reports"])},1e3)}catch(ne){console.error("Failed to send message:",ne),l(q=>[...q,{role:"assistant",content:"I'm having trouble connecting right now. Please try again in a moment, or you can reach us at [email protected]",timestamp:new Date().toISOString()}])}finally{p(!1)}},z=U=>{U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),I())},ae=U=>{I(U)};return j.useEffect(()=>{const U=setTimeout(()=>{!e&&a.length===0&&v(!0)},5e3);return()=>clearTimeout(U)},[]),j.useEffect(()=>{!e&&a.length>k&&a.slice(k).some(P=>P.role==="assistant")&&v(!0),e&&N(a.length)},[a,e,k]),n.jsxs(n.Fragment,{children:[n.jsx(Rr,{children:e&&!r&&n.jsx(G.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:20,scale:.95},transition:{duration:.2},className:"fixed bottom-24 right-6 z-50 w-[380px] max-w-[calc(100vw-3rem)]","data-testid":"chatbot-window",children:n.jsxs("div",{className:"bg-white backdrop-blur-xl rounded-2xl border border-warm-border overflow-hidden flex flex-col max-h-[520px]",children:[n.jsxs("div",{className:"bg-olive p-4 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-white/20 rounded-full flex items-center justify-center",children:n.jsx(Zd,{className:"w-5 h-5 text-white"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-white",children:"AI Assistant"}),n.jsx("p",{className:"text-xs text-white/70",children:"VeraCore AI"})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>i(!0),className:"p-2 hover:bg-white/10 rounded-lg transition-colors","data-testid":"button-minimize-chat",children:n.jsx(q9,{className:"w-4 h-4 text-white/80"})}),n.jsx("button",{onClick:()=>s(!1),className:"p-2 hover:bg-white/10 rounded-lg transition-colors","data-testid":"button-close-chat",children:n.jsx(ro,{className:"w-4 h-4 text-white/80"})})]})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-[280px] max-h-[320px] bg-cream",children:[a.map((U,Y)=>n.jsx(G.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:Y*.05},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:n.jsxs("div",{className:`flex items-start gap-2 max-w-[85%] ${U.role==="user"?"flex-row-reverse":""}`,children:[n.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 ${U.role==="user"?"bg-cream-dark":"bg-olive"}`,children:U.role==="user"?n.jsx($$,{className:"w-4 h-4 text-warm-gray"}):n.jsx(Zd,{className:"w-4 h-4 text-white"})}),n.jsx("div",{className:`px-4 py-3 rounded-2xl ${U.role==="user"?"bg-ink text-white rounded-tr-sm":"bg-white border border-warm-border rounded-tl-sm"}`,children:n.jsx("p",{className:`text-sm leading-relaxed whitespace-pre-wrap ${U.role==="user"?"text-white":"text-ink"}`,children:U.content})})]})},Y)),m&&n.jsx(G.div,{initial:{opacity:0}
75,animate:{opacity:1},className:"flex justify-start",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-olive",children:n.jsx(Zd,{className:"w-4 h-4 text-white"})}),n.jsx("div",{className:"px-4 py-3 rounded-2xl rounded-tl-sm bg-white border border-warm-border",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Xh,{className:"w-4 h-4 text-olive animate-spin"}),n.jsx("span",{className:"text-sm text-warm-gray",children:"Thinking..."})]})})]})}),n.jsx("div",{ref:E})]}),S.length>0&&!m&&n.jsx("div",{className:"px-4 py-2 bg-white border-t border-warm-border",children:n.jsx("div",{className:"flex flex-wrap gap-2",children:S.map((U,Y)=>n.jsx("button",{onClick:()=>ae(U),className:"text-xs px-3 py-1.5 rounded-full bg-olive/10 text-olive hover:opacity-80 transition-opacity border border-olive/20","data-testid":`button-suggestion-${Y}`,children:U},Y))})}),n.jsxs("div",{className:"p-4 border-t border-warm-border bg-white",children:[n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsx("textarea",{ref:_,value:d,onChange:U=>u(U.target.value),onKeyDown:z,placeholder:"Type a message...",rows:1,className:"flex-1 bg-cream border border-warm-border rounded-xl px-4 py-3 text-sm text-ink placeholder:text-warm-gray focus:outline-none focus:border-olive transition-all resize-none max-h-[120px] overflow-y-auto",disabled:m,"data-testid":"input-chat-message",style:{height:"auto",minHeight:"44px"},onInput:U=>{const Y=U.target;Y.style.height="auto",Y.style.height=Math.min(Y.scrollHeight,120)+"px"}}),n.jsx(HO,{onClick:()=>I(),disabled:!d.trim()||m,className:"bg-olive hover:bg-olive-dark text-white rounded-xl px-4 py-3 h-auto disabled:opacity-50","data-testid":"button-send-message",children:n.jsx(Lx,{className:"w-4 h-4"})})]}),n.jsx("p",{className:"text-xs text-warm-gray mt-2 text-center",children:"Powered by AI · Shift+Enter for new line"})]})]})})}),n.jsx(Rr,{children:e&&r&&n.jsx(G.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},className:"fixed bottom-24 right-6 z-50",children:n.jsxs("button",{onClick:()=>i(!1),className:"bg-olive text-white px-4 py-3 rounded-full flex items-center gap-2 hover:bg-olive-dark transition-colors","data-testid":"button-expand-chat",children:[n.jsx(Zd,{className:"w-5 h-5"}),n.jsx("span",{className:"font-medium",children:"Continue chat"})]})})}),n.jsxs(G.button,{onClick:M,className:"fixed bottom-6 right-6 z-50 w-14 h-14 bg-olive rounded-full flex items-center justify-center hover:bg-olive-dark transition-transform",whileHover:{scale:1.1},whileTap:{scale:.95},"data-testid":"button-open-chat",children:[n.jsx(Rr,{mode:"wait",children:e?n.jsx(G.div,{initial:{rotate:-90,opacity:0},animate:{rotate:0,opacity:1},exit:{rotate:90,opacity:0},children:n.jsx(ro,{className:"w-6 h-6 text-white"})},"close"):n.jsx(G.div,{initial:{rotate:90,opacity:0},animate:{rotate:0,opacity:1},exit:{rotate:-90,opacity:0},children:n.jsx($9,{className:"w-6 h-6 text-white"})},"open")}),b&&!e&&n.jsx(G.div,{initial:{scale:0},animate:{scale:1},className:"absolute -top-1 -right-1 w-5 h-5 bg-red-500 rounded-full flex items-center justify-center",children:n.jsx("span",{className:"text-xs text-white font-bold",children:"1"})})]}),b&&!e&&n.jsx(G.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},className:"fixed bottom-24 right-6 z-40 max-w-[250px]",children:n.jsxs("div",{className:"bg-white backdrop-blur-xl rounded-2xl rounded-br-sm border border-warm-border p-4",children:[n.jsxs("p",{className:"text-sm text-ink",children:[n.jsx(lo,{className:"w-4 h-4 text-olive inline mr-1"}),"Need help automating your workflows? I'm here to assist!"]}),n.jsx("button",{onClick:()=>v(!1),className:"absolute -top-2 -right-2 w-6 h-6 bg-cream-dark rounded-full flex items-center justify-center text-warm-gray hover:text-ink transition-colors border border-warm-border",children:n.jsx(ro,{className:"w-3 h-3"})})]})})]})}const Xr={hidden:{opacity:0,y:30},visible:{opacity:1,y:0,transition:{duration:.6}}},Rh={hidden:{opacity:0}
75,visible:{opacity:1,transition:{staggerChildren:.1}}};function Bd({title:t,children:e,icon:s,defaultOpen:r=!1,testId:i}){const[a,l]=j.useState(r);return n.jsxs("div",{className:"bg-white rounded-xl border border-warm-border overflow-hidden",children:[n.jsxs("button",{"data-testid":i,onClick:()=>l(!a),className:"w-full flex items-center gap-3 px-6 py-4 text-left hover:bg-cream-light transition-colors",children:[n.jsx(s,{className:"w-5 h-5 text-olive flex-shrink-0"}),n.jsx("span",{className:"flex-1 font-semibold text-ink",children:t}),n.jsx(mo,{className:`w-4 h-4 text-warm-gray transition-transform ${a?"rotate-180":""}`})]}),a&&n.jsx("div",{className:"px-6 pb-6 pt-0 border-t border-warm-border",children:n.jsx("div",{className:"pt-4",children:e})})]})}function PG(){return n.jsxs("div",{className:"min-h-screen bg-cream text-ink font-sans antialiased",children:[n.jsx("nav",{className:"fixed top-0 w-full z-50 bg-white/80 backdrop-blur-xl border-b border-warm-border",children:n.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-3 sm:py-4 flex justify-between items-center",children:[n.jsxs(Ae,{href:"/",className:"flex flex-col group",onClick:()=>window.scrollTo(0,0),children:[n.jsx("span",{className:"font-black text-xl sm:text-2xl text-ink",children:"Workflow AS"}),n.jsx("span",{className:"text-[10px] text-warm-gray tracking-wide"})]}),n.jsxs("div",{className:"hidden md:flex items-center gap-8",children:[n.jsx(Ae,{href:"/workflow-capture",className:"text-warm-gray hover:text-ink font-medium transition-colors",children:"Workflow Capture"}),n.jsx(Ae,{href:"/how-it-works",className:"text-warm-gray hover:text-ink font-medium transition-colors",children:"How It Works"}),n.jsx(Ae,{href:"/security",className:"text-warm-gray hover:text-ink font-medium transition-colors",children:"Security"}),n.jsx("span",{className:"text-olive font-semibold",children:"Extension Support"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(FO,{}),n.jsxs("a",{href:"/get-started",className:"inline-flex items-center px-4 py-2 rounded-full border border-olive text-olive hover:bg-olive/10 font-semibold transition-all text-xs sm:text-sm","data-testid":"button-nav-cta",children:[n.jsx("span",{className:"hidden sm:inline",children:"Get Started Free"}),n.jsx("span",{className:"sm:hidden",children:"Get Started"}),n.jsx(kn,{className:"ml-1 w-4 h-4"})]})]})]})}),n.jsx("section",{className:"pt-28 sm:pt-36 pb-12 sm:pb-16 px-4",children:n.jsx("div",{className:"max-w-3xl mx-auto text-center",children:n.jsxs(G.div,{initial:"hidden",animate:"visible",variants:Rh,children:[n.jsxs(G.div,{variants:Xr,className:"inline-flex items-center gap-2 bg-olive/10 text-olive px-4 py-1.5 rounded-full text-sm font-medium mb-6",children:[n.jsx(gj,{className:"w-4 h-4"}),"Support"]}),n.jsx(G.h1,{variants:Xr,className:"font-serif text-3xl sm:text-4xl lg:text-5xl text-ink leading-tight mb-4",children:"Extension Help & Support"}),n.jsx(G.p,{variants:Xr,className:"text-lg text-warm-gray max-w-xl mx-auto",children:"Step-by-step installation guide and troubleshooting for the Workflow Capture Chrome extension."})]})})}),n.jsx("section",{className:"pb-16 sm:pb-24 px-4",children:n.jsxs("div",{className:"max-w-3xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Rh,children:[n.jsx(G.h2,{variants:Xr,className:"font-serif text-2xl sm:text-3xl text-ink mb-2",children:"Installation Guide"}),n.jsx(G.p,{variants:Xr,className:"text-warm-gray mb-8",children:"Follow these 4 steps to install the Workflow Capture extension in Chrome. Takes about 2 minutes."})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs(qf,{number:1,title:"Download the Extension",icon:na,testId:"install-step-1",children:[n.jsxs("p",{className:"text-sm text-warm-gray leading-relaxed mb-3",children:["Click the button below to download the extension file. A file called ",n.jsx("strong",{children:"Workflow-Capture.zip"})," will save to your computer."]}),n.jsxs("a",{href:"/Workflow-Capture.zip",download:!0,className:"inline-flex items-center gap-2 bg-olive hover:bg-olive-dark text-white px-5 py-2.5 rounded-lg text-sm font-semibold transition-colors mb-4",children:[n.jsx(na,{className:"w-4 h-4"}),"Download Extension"]}),n.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3",children:[n.jsx("p",{className:"text-xs text-amber-900 leading-relaxed font-medium",children:"After downloading — unzip the file:"}),n.jsxs("ul",{className:"text-xs text-amber-800 leading-relaxed list-disc list-inside mt-1 space-y-1",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Mac:"})," Open Finder, go to Downloads, find ",n.jsx("strong",{children:"Workflow-Capture.zip"}),", double-click it"]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Windows:"})," Open File Explorer, go to Downloads, right-click ",n.jsx("strong",{children:"Workflow-Capture.zip"}),', select "Extract All"']}),n.jsxs("li",{children:["You'll see a folder called ",n.jsx("strong",{children:"Workflow-Capture"})," — keep it where it is"]})]})]})]}),n.jsx(qf,{number:2,title:"Open Chrome Extensions & Enable Developer Mode",icon:ym,testId:"install-step-2",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:n.jsxs("p",{className:"text-xs text-red-800 leading-relaxed",children:[n.jsx("strong",{children:"Not the puzzle piece!"})," If you click the puzzle piece icon in Chrome's toolbar, you'll see a popup — that's ",n.jsx("em",{children:"not"})," the right place. You need the full Extensions settings page."]})}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-lg p-4",children:[n.jsx("p",{className:"text-sm text-ink font-semibold mb-3",children:"How to get to the right page:"}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"A"}),n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["Click the ",n.jsx("strong",{children:"three vertical dots"})," (menu) at the very top-right of Chrome."]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"B"}),n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["Hover over ",n.jsx("strong",{children:'"Extensions"'})," in the menu, then click ",n.jsx("strong",{children:'"Manage Extensions"'}),"."]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"C"}),n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["On the Extensions page, find ",n.jsx("strong",{children:'"Developer mode"'})," toggle at the top-right and turn it ",n.jsx("strong",{children:"ON"}),"."]})]})]})]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx("img",{src:VO,alt:"Chrome Extensions menu",className:"rounded-lg border border-warm-border",style:{maxWidth:"280px",height:"auto"}}),n.jsx("img",{src:dN,alt:"Developer mode toggle",className:"rounded-lg border border-warm-border",style:{maxWidth:"280px",height:"auto"}})]})]})}),n.jsx(qf,{number:3,title:"Load the Extension",icon:FA,testId:"install-step-3",children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("p",{className:"text-sm text-warm-gray leading-relaxed",children:["After turning on Developer mode, three buttons appear at the top of the page. Click ",n.jsx("strong",{children:'"L
75oad unpacked"'}),"."]}),n.jsxs("p",{className:"text-sm text-warm-gray leading-relaxed",children:["A file browser opens. Navigate to your ",n.jsx("strong",{children:"Downloads"})," folder and select the ",n.jsx("strong",{children:"Workflow-Capture"})," folder you unzipped in Step 1. ",n.jsx("strong",{children:"Click once"})," on the folder (don't double-click into it), then click ",n.jsx("strong",{children:'"Select"'})," (Mac) or ",n.jsx("strong",{children:'"Select Folder"'})," (Windows)."]}),n.jsx("div",{className:"bg-olive/5 border border-olive/20 rounded-lg p-3",children:n.jsxs("p",{className:"text-xs text-olive-dark leading-relaxed",children:[n.jsx("strong",{children:"You'll know it worked"}),' when you see a "Workflow Capture" card appear on the extensions page, and a new icon appears in your browser toolbar.']})}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx("img",{src:uN,alt:"Load unpacked button",className:"rounded-lg border border-warm-border",style:{maxWidth:"280px",height:"auto"}}),n.jsx("img",{src:hN,alt:"Select folder",className:"rounded-lg border border-warm-border",style:{maxWidth:"280px",height:"auto"}}),n.jsx("img",{src:cN,alt:"Extension installed",className:"rounded-lg border border-warm-border",style:{maxWidth:"280px",height:"auto"}})]})]})}),n.jsx(qf,{number:4,title:"Allow Microphone Access",icon:oo,testId:"install-step-4",children:n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-sm text-warm-gray leading-relaxed",children:"The extension records your voice as you walk through a task, so Chrome needs your permission to use the microphone."}),n.jsxs("p",{className:"text-sm text-warm-gray leading-relaxed",children:["Click the ",n.jsx("strong",{children:"puzzle piece icon"})," in the top-right of Chrome, find ",n.jsx("strong",{children:'"Workflow Capture"'}),", and click it. A small popup appears — if Chrome asks for microphone permission, click ",n.jsx("strong",{children:'"Allow"'}),"."]}),n.jsx("img",{src:mN,alt:"Ready to record",className:"rounded-lg border border-warm-border",style:{maxWidth:"300px",height:"auto"}})]})}),n.jsxs("div",{className:"bg-olive/10 border border-olive/20 rounded-xl p-6 text-center mt-6",children:[n.jsx(vs,{className:"w-8 h-8 text-olive mx-auto mb-2"}),n.jsx("p",{className:"font-semibold text-olive-dark mb-1",children:"You're all set!"}),n.jsx("p",{className:"text-sm text-olive",children:'Click the extension icon and hit "Start Recording" to capture your first workflow.'})]})]})]})}),n.jsx("section",{className:"py-16 sm:py-24 px-4 bg-white border-y border-warm-border",children:n.jsxs("div",{className:"max-w-3xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Rh,children:[n.jsx(G.h2,{variants:Xr,className:"font-serif text-2xl sm:text-3xl text-ink mb-2",children:"Troubleshooting"}),n.jsx(G.p,{variants:Xr,className:"text-warm-gray mb-8",children:"Having issues? Find solutions to common installation and recording problems below."})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx(Bd,{title:"The extension won't install / I see an error",icon:IA,testId:"troubleshoot-install-error",children:n.jsxs("div",{className:"space-y-3 text-sm text-warm-gray leading-relaxed",children:[n.jsx("p",{children:n.jsx("strong",{children:"Common causes and fixes:"})}),n.jsxs("ul",{className:"space-y-2 list-disc list-inside",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Developer mode is off"})," — Go to ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome://extensions"}),' and make sure the "Developer mode" toggle (top-right) is turned ON.']}),n.jsxs("li",{children:[n.jsx("strong",{children:"Selected the wrong folder"})," — Make sure you're selecting the ",n.jsx("strong",{children:"Workflow-Capture"})," folder itself, not a file inside it or the zip file. The folder should contain a ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"manifest.json"})," file."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Didn't unzip the file"}
75),' — You need to unzip/extract the .zip file first. Double-click it on Mac, or right-click and "Extract All" on Windows.']}),n.jsxs("li",{children:[n.jsx("strong",{children:"Corrupt download"})," — Delete the file and re-download it from your portal."]})]})]})}),n.jsx(Bd,{title:"I don't see the extension icon in Chrome",icon:ii,testId:"troubleshoot-no-icon",children:n.jsxs("div",{className:"space-y-3 text-sm text-warm-gray leading-relaxed",children:[n.jsx("p",{children:"The icon may be hidden behind the puzzle piece menu:"}),n.jsxs("ol",{className:"space-y-2 list-decimal list-inside",children:[n.jsxs("li",{children:["Click the ",n.jsx("strong",{children:"puzzle piece icon"})," in Chrome's top-right toolbar."]}),n.jsxs("li",{children:["Find ",n.jsx("strong",{children:'"Workflow Capture"'})," in the list."]}),n.jsxs("li",{children:["Click the ",n.jsx("strong",{children:"pin icon"})," next to it to keep it visible in your toolbar."]})]}),n.jsxs("p",{children:[`If "Workflow Capture" isn't in the list at all, the extension may not be installed. Go to `,n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome://extensions"})," and check if it appears there."]})]})}),n.jsx(Bd,{title:"Microphone isn't working / no audio in recordings",icon:eM,testId:"troubleshoot-mic",children:n.jsxs("div",{className:"space-y-3 text-sm text-warm-gray leading-relaxed",children:[n.jsx("p",{children:n.jsx("strong",{children:"Check these settings:"})}),n.jsxs("ol",{className:"space-y-2 list-decimal list-inside",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Browser permission"}),' — Click the extension icon. If you see a microphone permission prompt, click "Allow".']}),n.jsxs("li",{children:[n.jsx("strong",{children:"System microphone"})," — Make sure your computer's microphone is not muted. On Mac, check System Preferences > Sound > Input. On Windows, check Settings > System > Sound > Input."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Other apps using the mic"})," — Close any other apps that might be using the microphone (Zoom, Teams, etc.) and try again."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Reset permissions"})," — Go to ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome://settings/content/microphone"})," and make sure the extension isn't blocked."]})]})]})}),n.jsx(Bd,{title:"Recording doesn't capture my actions",icon:gl,testId:"troubleshoot-no-capture",children:n.jsxs("div",{className:"space-y-3 text-sm text-warm-gray leading-relaxed",children:[n.jsx("p",{children:n.jsx("strong",{children:"Try these steps:"})}),n.jsxs("ul",{className:"space-y-2 list-disc list-inside",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Make sure recording is active"}),' — After clicking "Start Recording," you should see a red recording indicator. If not, click the extension icon again.']}),n.jsxs("li",{children:[n.jsx("strong",{children:"Refresh the page"})," — If the extension was just installed, refresh the page you want to record on so the content script loads."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Check the page type"})," — Some special Chrome pages (",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome://"}),", ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome-extension://"}),") cannot be recorded. Navigate to a regular website."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Reinstall the extension"})," — Remove the extension from ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome://extensions"})," and load it again using the steps above."]})]})]})}),n.jsx(Bd,{title:"Recording won't save / 'Save to Portal' doesn't work",icon:_w,testId:"troubleshoot-save",children:n.jsxs("div",{className:"space-y-3 text-sm text-warm-gray leading-relaxed",children:[n.jsx("p",{children:n.jsx("strong",{children:"Possible issues:"})}),n.jsxs("ul",{className:"space-y-2 list-disc list-inside",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Portal URL not set"})," — Open the extension popup and make sure your portal URL is entered in the Settings area. It should match the URL you use to access your Workflow AS portal."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Network issue"})," — Check your internet connection. The extension needs to reach your portal to save recordings."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Empty recording"})," — If you clicked Start and Stop without performing any actions, there may be nothing to save. Try recording again with at least a few clicks or navigations."]})]})]})}),n.jsx(Bd,{title:"Extension was removed or disappeared after Chrome update",icon:hb,testId:"troubleshoot-removed",children:n.jsxs("div",{className:"space-y-3 text-sm text-warm-gray leading-relaxed",children:[n.jsx("p",{children:"Chrome may disable unpacked extensions after updates. To fix:"}),n.jsxs("ol",{className:"space-y-2 list-decimal list-inside",children:[n.jsxs("li",{children:["Go to ",n.jsx("code",{className:"bg-cream-dark px-1.5 py-0.5 rounded text-xs",children:"chrome://extensions"})]}),n.jsx("li",{children:'If you see Workflow Capture with an "Errors" badge or disabled toggle, click the toggle to re-enable it.'}),n.jsxs("li",{children:["If it's completely gone, re-install it by following the installation steps above. Make sure you still have the ",n.jsx("strong",{children:"Workflow-Capture"})," folder in your Downloads."]})]})]})})]})]})}),n.jsx("section",{className:"py-16 sm:py-24 px-4",children:n.jsxs("div",{className:"max-w-3xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",
75whileInView:"visible",viewport:{once:!0},variants:Rh,children:[n.jsx(G.h2,{variants:Xr,className:"font-serif text-2xl sm:text-3xl text-ink mb-2",children:"Recording Tips"}),n.jsx(G.p,{variants:Xr,className:"text-warm-gray mb-8",children:"Get the best results from your workflow recordings."})]}),n.jsx("div",{className:"grid sm:grid-cols-2 gap-4",children:[{title:"Keep recordings under 5 minutes",desc:"Break long tasks into separate recordings — one per logical sub-task."},{title:"Narrate as you go",desc:"Explain why you're doing each step, not just what. Your reasoning is what makes the AI smarter."},{title:"Cover edge cases",desc:"If something unusual happens during a workflow, record how you handle it. The AI needs to learn exceptions too."},{title:"Work at your normal pace",desc:"Don't rush. The extension captures timing, and a natural pace helps the AI understand the workflow rhythm."},{title:"Record on a clean session",desc:"Close unnecessary tabs. A simpler browser state means cleaner recordings."},{title:"Test with a short recording first",desc:"Do a quick 30-second test recording to make sure everything is working before recording a full workflow."}].map((t,e)=>n.jsx("div",{className:"bg-white rounded-xl border border-warm-border p-5",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(vs,{className:"w-4 h-4 text-olive flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-ink text-sm mb-1",children:t.title}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed",children:t.desc})]})]})},e))})]})}),n.jsx("section",{className:"py-16 sm:py-24 px-4 bg-ink",children:n.jsx("div",{className:"max-w-3xl mx-auto text-center",children:n.jsxs(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Rh,children:[n.jsx(G.h2,{variants:Xr,className:"font-serif text-2xl sm:text-3xl text-white mb-3",children:"Still Need Help?"}),n.jsx(G.p,{variants:Xr,className:"text-white/60 max-w-lg mx-auto mb-8",children:"If you're still experiencing issues, reach out to our team and we'll help you get set up."}),n.jsx(G.div,{variants:Xr,children:n.jsxs(Ae,{href:"/contact",className:"inline-flex items-center gap-2 bg-olive hover:bg-olive-dark text-white px-6 py-3 rounded-full font-semibold transition-all text-sm","data-testid":"link-contact-support",children:["Contact Support",n.jsx(kn,{className:"w-4 h-4"})]})})]})})}),n.jsx("footer",{className:"bg-white border-t border-warm-border py-8 px-4",children:n.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-4",children:[n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"font-black text-lg text-ink",children:"Workflow AS"}),n.jsx("span",{className:"text-[10px] text-warm-gray tracking-wide"})]}),n.jsxs("div",{className:"flex items-center gap-6 text-sm text-warm-gray",children:[n.jsx(Ae,{href:"/workflow-capture",className:"hover:text-ink transition-colors",children:"Workflow Capture"}),n.jsx(Ae,{href:"/privacy",className:"hover:text-ink transition-colors",children:"Privacy"}),n.jsx(Ae,{href:"/terms",className:"hover:text-ink transition-colors",children:"Terms"}),n.jsx(Ae,{href:"/security",className:"hover:text-ink transition-colors",children:"Security"}),n.jsx(Ae,{href:"/contact",className:"hover:text-ink transition-colors",children:"Contact"})]})]})}),n.jsx(qO,{})]})}function qf({number:t,title:e,icon:s,children:r,testId:i}){const[a,l]=j.useState(!0);return n.jsxs("div",{"data-testid":i,className:"bg-white rounded-xl border border-warm-border overflow-hidden",children:[n.jsxs("button",{onClick:()=>l(!a),className:"w-full flex items-center gap-3 px-6 py-4 text-left hover:bg-cream-light transition-colors",children:[n.jsx("div",{className:"w-8 h-8 rounded-full bg-olive text-white flex items-center justify-center text-sm font-bold flex-shrink-0",children:t}),n.jsx(s,{className:"w-5 h-5 text-olive flex-shrink-0"}),n.jsx("span",{className:"flex-1 font-semibold text-ink",children:e}),n.jsx(mo,{className:`w-4 h-4 text-warm-gray transition-transform ${a?"rotate-180":""}`})]}),a&&n.jsx("div",{className:"px-6 pb-6 pt-0 border-t border-warm-border",children:n.jsx("div",{className:"pt-4",children:r})})]})}const IG="sop_portal_token";function LG(){try{return localStorage.getItem(IG)}catch{return null}}function wt(t,e={}){const s=LG(),r=new Headers(e.headers||{});return s&&r.set("Authorization",`Bearer ${s}`),fetch(t,{...e,headers:r,credentials:"include"})}function WO(t){switch((t||"").toLowerCase()){case"requested":case"captured":return"Captured";case"processing":case"generating":return"Generating";case"received":case"needs_review":case"review":return"Needs Review";case"reviewed":case"approved":return"Approved";case"exported":return"Exported";case"deployed":case"live":case"runtime":case"sent_to_runtime":return"Sent to Runtime";case"failed":case"error":return"Failed";default:return"Captured"}}const $G={Captured:{dot:"bg-olive",text:"text-olive",bg:"bg-olive/10",border:"border-olive/20"},Generating:{dot:"bg-blue-500",text:"text-blue-700",bg:"bg-blue-50",border:"border-blue-200"}
75,"Needs Review":{dot:"bg-amber-500",text:"text-amber-800",bg:"bg-amber-50",border:"border-amber-200"},Approved:{dot:"bg-emerald-500",text:"text-emerald-700",bg:"bg-emerald-50",border:"border-emerald-200"},Exported:{dot:"bg-emerald-700",text:"text-emerald-800",bg:"bg-emerald-100/60",border:"border-emerald-300"},"Sent to Runtime":{dot:"bg-slate-700",text:"text-slate-800",bg:"bg-slate-100",border:"border-slate-300"},Failed:{dot:"bg-red-500",text:"text-red-700",bg:"bg-red-50",border:"border-red-200"}},a1=["review_requested","output_generated","generation_failed","usage_limit_warning","billing_issue","weekly_digest"],pN={review_requested:{label:"Review requested",description:"When a workflow is assigned to a reviewer."},output_generated:{label:"Output generated",description:"When an SOP, training guide, or AI script is ready."},generation_failed:{label:"Generation failed",description:"When a workflow fails to process."},usage_limit_warning:{label:"Usage limit warning",description:"When you cross 80% of any plan limit."},billing_issue:{label:"Billing or payment issue",description:"Failed payments or upcoming renewals."},weekly_digest:{label:"Weekly workspace summary",description:"A digest of activity every Monday."}},o1={review_requested:!0,output_generated:!0,generation_failed:!0,usage_limit_warning:!0,billing_issue:!0,weekly_digest:!0},xT={free:"Free",pro:"Pro",team:"Team",business:"Business",enterprise:"Enterprise",unlimited:"Unlimited"};function GO(t){return xT[(t||"free").toLowerCase()]||xT.free}const Nc={workflows:"Workflows",teamSeats:"Team seats",documents:"Workflows from documents",recordingMinutesPerMonth:"Capture minutes / month"};function BG(t,e){const s=["free","pro","team","business"],r=s.indexOf((t||"free").toLowerCase());for(let i=Math.max(r,0)+1;i<s.length;i++)if(e.some(a=>a.key===s[i]))return s[i];return"pro"}function zG(t){return t?t.source==="workflowcapture.ai"||t.source==="workflowcapture.live"||(t.industry||"").toLowerCase().trim()==="workflow capture":!1}function Yn(t){const e=WO(t.status);return t.locked?"Needs Review":e}function fN(t){return Array.isArray(t.workflowSteps)?t.workflowSteps.length:0}function l1(t){return Array.isArray(t.workflowSteps)?t.workflowSteps.filter(e=>e&&(e.type==="decision"||/\b(if|when|else|otherwise|decision)\b/i.test(e.description||e.text||""))).length:0}function gu(t){if(!t)return"—";const e=new Date(t).getTime();if(!isFinite(e))return"—";const s=Math.floor((Date.now()-e)/1e3);if(s<60)return"just now";const r=Math.floor(s/60);if(r<60)return`${r}m ago`;const i=Math.floor(r/60);if(i<24)return`${i}h ago`;const a=Math.floor(i/24);if(a<30)return`${a}d ago`;const l=Math.floor(a/30);return l<12?`${l}mo ago`:`${Math.floor(l/12)}y ago`}function cp({status:t}){const e=$G[t],s=t==="Generating";return n.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[11px] font-semibold border ${e.bg} ${e.text} ${e.border} ${s?"status-pill-generating":""}`,"data-testid":`status-${t.toLowerCase().replace(/\s+/g,"-")}`,children:[s?n.jsxs("svg",{className:"w-3 h-3 animate-spin",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"4"}),n.jsx("path",{d:"M22 12a10 10 0 0 1-10 10",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",fill:"none"})]}):n.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${e.dot}`}),s?n.jsxs("span",{className:"inline-flex items-center",children:["Generating",n.jsxs("span",{className:"status-pill-dots ml-0.5","aria-hidden":"true",children:[n.jsx("span",{children:"."}),n.jsx("span",{children:"."}),n.jsx("span",{children:"."})]})]}):t]})}function ot({children:t,className:e=""}){return n.jsx("div",{className:`bg-white border border-warm-border rounded-2xl shadow-[0_1px_2px_rgba(15,23,42,0.04)] ${e}`,children:t})}function cs({title:t,action:e,description:s}){return n.jsxs("div",{className:"flex items-end justify-between gap-4 mb-4",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-bold text-ink leading-tight",children:t}),s&&n.jsx("p",{className:"text-sm text-warm-gray mt-1",children:s})]}),e&&n.jsx("div",{className:"flex-shrink-0",children:e})]})}function at({children:t,onClick:e,variant:s="primary",size:r="md",disabled:i,type:a="button",className:l="",testId:d}){const u={primary:"bg-olive text-white hover:bg-olive-dark border-olive disabled:bg-olive/40",secondary:"bg-white text-ink hover:bg-cream-dark border-warm-border",ghost:"bg-transparent text-warm-gray hover:bg-cream-dark hover:text-ink border-transparent",danger:"bg-red-600 text-white hover:bg-red-700 border-red-600"},m={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-5 py-2.5 text-sm"};return n.jsx("button",{type:a,onClick:e,disabled:i,"data-testid":d,className:`inline-flex items-center justify-center gap-2 font-semibold rounded-xl border transition-colors disabled:cursor-not-allowed disabled:opacity-60 ${u[s]} ${m[r]} ${l}`,children:t})}function si({label:t,value:e,hint:s,testId:r}){return n.jsxs(ot,{className:"p-5",children:[n.jsx("div",{className:"text-xs font-semibold text-warm-gray uppercase tracking-wide",children:t}),n.jsx("div",{className:"text-3xl font-black text-ink mt-2 leading-none","data-testid":r,children:e}),s&&n.jsx("div",{className:"text-xs text-warm-gray mt-2 leading-snug",children:s})]})}function to({icon:t="◎",title:e,body:s,primary:r,secondary:i}){return n.jsxs("div",{className:"text-center py-12 px-6",children:[n.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl bg-olive/10 text-olive flex items-center justify-center text-2xl mb-4",children:t}),n.jsx("h3",{className:"text-base font-bold text-ink",children:e}),n.jsx("p",{className:"text-sm text-warm-gray mt-2 max-w-md mx-auto leading-relaxed",children:s}),n.jsxs("div",{className:"flex items-center justify-center gap-2 mt-5",children:[r&&n.jsx(at,{onClick:r.onClick,testId:r.testId,children:r.label}),i&&n.jsx(at,{variant:"secondary",onClick:i.onClick,testId:i.testId,children:i.label})]})]})}function VG({done:t,label:e,description:s,action:r}){return n.jsxs("div",{className:"flex items-start gap-3 py-3",children:[n.jsx("div",{className:`flex-shrink-0 w-5 h-5 rounded-full mt-0.5 flex items-center justify-center text-[11px] font-bold ${t?"bg-emerald-500 text-white":"bg-cream-dark border border-warm-border text-warm-gray"}`,children:t?"✓":""}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("p",{className:`text-sm font-medium ${t?"text-warm-gray line-through":"text-ink"}`,children:e}),s&&n.jsx("p",{className:"text-xs text-warm-gray mt-0.5 leading-snug",children:s})]}),r&&!t&&n.jsxs("button",{onClick:r.onClick,className:"flex-shrink-0 text-xs font-semibold text-olive hover:text-olive-dark",children:[r.label," →"]})]})}function FG({message:t,kind:e="info",onDismiss:s}){const r={info:"bg-slate-800 text-white",success:"bg-emerald-600 text-white",error:"bg-red-600 text-white"};return n.jsx("div",{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-50 px-4 py-2.5 rounded-xl shadow-lg text-sm font-medium ${r[e]}`,onClick:s,children:t})}function aa({label:t,hint:e,children:s}){return n.jsxs("label",{className:"block",children:[n.jsx("div",{className:"text-sm font-semibold text-ink mb-1.5",children:t}),s,e&&n.jsx("div",{className:"text-xs text-warm-gray mt-1.5 leading-snug",children:e})]})}function Vc({value:t,onChange:e,placeholder:s,type:r="text",disabled:i,testId:a}){return n.jsx("input",{type:r,value:t,onChange:l=>e(l.target.value),placeholder:s,disabled:i,"data-testid":a,className:"w-full px-3.5 py-2.5 bg-white border border-warm-border rounded-xl text-sm text-ink placeholder:text-warm-gray/60 focus:outline-none focus:ring-2 focus:ring-olive/30 focus:border-olive disabled:bg-cream-dark disabled:text-warm-gray"})}function xN({value:t,onChange:e,options:s,testId:r}){return n.jsx("select",{value:t,onChange:i=>e(i.target.value),"data-testid":r,className:"w-full px-3.5 py-2.5 bg-white border border-warm-border rounded-xl text-sm text-ink focus:outline-none focus:ring-2 focus:ring-olive/30 focus:border-olive",children:s.map(i=>n.jsx("option",{value:i.value,children:i.label},i.value))})}function KO({checked:t,onChange:e,label:s,description:r,disabled:i,testId:a}){return n.jsxs("div",{className:`flex items-start justify-between gap-4 py-3 ${i?"opacity-60":""}`,children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-sm font-semibold text-ink",children:s}),r&&n.jsx("p",{className:"text-xs text-warm-gray mt-0.5 leading-snug",children:r})]}),n.jsx("button",{type:"button",onClick:()=>{i||e(!t)},disabled:i,"data-testid":a,className:`flex-shrink-0 relative w-10 h-6 rounded-full transition-colors ${t?"bg-olive":"bg-warm-border"} ${i?"cursor-not-allowed":""}`,"aria-pressed":t,children:n.jsx("span",{className:`absolute top-0.5 left-0.5 w-
755 h-5 bg-white rounded-full shadow transition-transform ${t?"translate-x-4":""}`})})]})}const UG=6e4;function HG(t){const e=new Date(t).getTime();if(!isFinite(e))return"";const s=Math.floor((Date.now()-e)/1e3);if(s<60)return"just now";const r=Math.floor(s/60);if(r<60)return`${r}m`;const i=Math.floor(r/60);if(i<24)return`${i}h`;const a=Math.floor(i/24);return a<30?`${a}d`:new Date(t).toLocaleDateString()}function qG(){const[t,e]=j.useState([]),[s,r]=j.useState(0),[i,a]=j.useState(!1),[l,d]=j.useState(!1),u=j.useRef(null);async function m(){d(!0);try{const b=await wt("/api/portal/notifications?limit=20");if(b.ok){const v=await b.json();e(v.notifications||[]),r(v.unread||0)}}catch{}finally{d(!1)}}j.useEffect(()=>{m();const b=setInterval(m,UG);return()=>clearInterval(b)},[]),j.useEffect(()=>{if(!i)return;function b(v){u.current&&!u.current.contains(v.target)&&a(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[i]);async function p(b){e(v=>v.map(k=>k.id===b?{...k,readAt:new Date().toISOString()}:k)),r(v=>Math.max(0,v-1));try{await wt(`/api/portal/notifications/${b}/read`,{method:"POST"})}catch{}}async function x(){e(b=>b.map(v=>v.readAt?v:{...v,readAt:new Date().toISOString()})),r(0);try{await wt("/api/portal/notifications/mark-all-read",{method:"POST"})}catch{}}function g(b){if(b.readAt||p(b.id),b.link)try{new URL(b.link,window.location.origin).origin===window.location.origin?window.location.href=b.link:window.open(b.link,"_blank","noopener")}catch{window.location.href=b.link}a(!1)}return n.jsxs("div",{className:"relative",ref:u,children:[n.jsxs("button",{type:"button",onClick:()=>{a(b=>!b),i||m()},className:"relative w-9 h-9 rounded-full hover:bg-cream-dark flex items-center justify-center text-warm-gray hover:text-ink transition-colors","aria-label":"Notifications","data-testid":"notification-bell",children:[n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"}),n.jsx("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"})]}),s>0&&n.jsx("span",{className:"absolute -top-0.5 -right-0.5 min-w-[18px] h-[18px] px-1 rounded-full bg-red-500 text-white text-[10px] font-bold flex items-center justify-center","data-testid":"notification-bell-count",children:s>9?"9+":s})]}),i&&n.jsxs("div",{className:"absolute right-0 top-11 w-[380px] max-w-[calc(100vw-2rem)] bg-white border border-warm-border rounded-xl shadow-lg z-50 overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-warm-border",children:[n.jsx("div",{className:"text-sm font-bold text-ink",children:"Notifications"}),s>0&&n.jsx("button",{onClick:x,className:"text-xs text-olive font-semibold hover:underline","data-testid":"button-mark-all-read",children:"Mark all read"})]}),n.jsxs("div",{className:"max-h-[420px] overflow-y-auto",children:[l&&t.length===0&&n.jsx("div",{className:"px-4 py-8 text-center text-xs text-warm-gray",children:"Loading…"}),!l&&t.length===0&&n.jsxs("div",{className:"px-4 py-10 text-center",children:[n.jsx("div",{className:"text-3xl mb-2",children:"🔔"}),n.jsx("div",{className:"text-sm font-semibold text-ink mb-1",children:"You're all caught up"}),n.jsx("div",{className:"text-xs text-warm-gray",children:"New notifications will show up here."})]}),t.map(b=>{const v=pN[b.type],k=!b.readAt;return n.jsxs("button",{type:"button",onClick:()=>g(b),className:`w-full text-left px-4 py-3 border-b border-warm-border/60 last:border-0 hover:bg-cream-dark transition-colors flex gap-3 ${k?"bg-olive/5":""}`,"data-testid":`notification-item-${b.id}`,children:[n.jsx("div",{className:`flex-shrink-0 w-2 h-2 mt-2 rounded-full ${k?"bg-olive":"bg-transparent"}`}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[n.jsx("div",{className:"text-sm font-semibold text-ink truncate",children:b.title}),n.jsx("div",{className:"text-[10px] text-warm-gray flex-shrink-0",children:HG(b.createdAt)})]}),b.body&&n.jsx("div",{className:"text-xs text-warm-gray mt-0.5 line-clamp-2",children:b.body}),v&&n.jsx("div",{className:"text-[10px] uppercase tracking-wide text-warm-gray/70 mt-1 font-semibold",children:v.label})]})]},b.id)})]})]})]})}let tg=null;function kb(t=null){tg&&tg(t)}function WG(){const[t,e]=j.useState(null),[s,r]=j.useState(null),[i,a]=j.useState(!1),[l,d]=j.useState(!1),[u,m]=j.useState(null),[p,x]=j.useState(""),[g,b]=j.useState(""),[v,k]=j.useState(!1);if(j.useEffect(()=>(tg=async M=>
75{e(M),m(null),k(!1),b(""),a(!0);try{const I=await wt("/api/portal/billing/usage");if(I.ok){const z=await I.json();r(z),x(BG(z.plan,z.availablePlans))}else m("Failed to load plans")}catch{m("Network error")}finally{a(!1)}},()=>{tg=null}),[]),!t)return null;const N=()=>e(null),S=async()=>{d(!0),m(null);try{const M=await wt("/api/portal/billing/upgrade-consent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toPlan:p,reason:t?.reason||(t?.limitType?`${t.limitType}_limit_reached`:"manual_upgrade"),limitType:t?.limitType||null})}),I=await M.json();if(!M.ok){m(I?.error||"Failed to start checkout"),d(!1);return}I?.checkoutUrl?window.location.href=I.checkoutUrl:(m("Checkout URL not returned"),d(!1))}catch{m("Network error"),d(!1)}},A=async()=>{d(!0),m(null);try{const M=await wt("/api/portal/billing/notify-owner",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({suggestedPlan:p,reason:t?.reason||(t?.limitType?`${t.limitType}_limit_reached`:"manual_request"),limitType:t?.limitType||null,note:g})}),I=await M.json();if(!M.ok){m(I?.error||"Couldn't notify the owner"),d(!1);return}k(!0)}catch{m("Network error")}finally{d(!1)}},E=(s?.availablePlans||[]).filter(M=>["pro","team","business"].includes(M.key)),_=t.limitType,T=s&&_?s.limits[_]:null,$=s&&_?s.usage[_]:null,L=s?.callerIsOwner!==!1;return n.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/40 p-4",onClick:N,children:n.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto",onClick:M=>M.stopPropagation(),"data-testid":"upgrade-modal",children:[n.jsxs("div",{className:"p-6 border-b border-warm-border",children:[n.jsx("h2",{className:"text-xl font-bold text-ink",children:L?"Upgrade required":"Ask the owner to upgrade"}),n.jsx("p",{className:"text-sm text-warm-gray mt-1",children:t.message||(_?`You've reached the ${Nc[_].toLowerCase()} limit on your ${s?.planLabel||"current"} plan.`:L?"Choose a plan to continue.":"Only the workspace owner can change the plan. Pick the plan you'd suggest and we'll email them.")}),_&&T!==null&&n.jsxs("p",{className:"text-xs text-warm-gray mt-2",children:["Current usage: ",n.jsxs("span",{className:"font-semibold",children:[$," of ",T]})," ",Nc[_].toLowerCase(),"."]}),!L&&(s?.ownerName||s?.ownerEmail)&&n.jsxs("p",{className:"text-xs text-warm-gray mt-2",children:["Workspace owner: ",n.jsx("span",{className:"font-semibold text-ink",children:s?.ownerName||s?.ownerEmail})]})]}),i?n.jsx("div",{className:"p-8 text-center text-warm-gray",children:"Loading plans…"}):n.jsxs("div",{className:"p-6 space-y-3",children:[E.map(M=>{const I=p===M.key;return n.jsxs("button",{onClick:()=>x(M.key),"data-testid":`plan-option-${M.key}`,className:`w-full text-left p-4 rounded-xl border-2 transition-colors ${I?"border-olive bg-olive/5":"border-warm-border hover:border-olive/50"}`,children:[n.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:`w-4 h-4 rounded-full border-2 ${I?"border-olive bg-olive":"border-warm-border"}`}),n.jsx("span",{className:"font-bold text-ink text-base",children:M.label})]}),n.jsxs("span",{className:"font-bold text-ink",children:["$",M.price,n.jsx("span",{className:"text-xs text-warm-gray font-normal",children:"/mo"})]})]}),n.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs text-warm-gray pl-6",children:["workflows","teamSeats","documents","recordingMinutesPerMonth"].map(z=>n.jsxs("div",{children:[n.jsx("span",{className:"font-semibold text-ink",children:M.limits[z]===null?"Unlimited":M.limits[z]})," ",Nc[z]]},z))})]},M.key)}),!L&&!v&&n.jsxs("div",{className:"pt-2",children:[n.jsx("label",{className:"block text-xs font-semibold text-ink mb-1.5",children:"Optional note for your owner"}),n.jsx("textarea",{value:g,onChange:M=>b(M.target.value),placeholder:"e.g. 'We need more recording minutes this month for new hire training'",maxLength:1e3,rows:3,"data-testid":"textarea-owner-note",className:"w-full text-sm border border-warm-border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-olive/30 resize-none"})]}),v&&n.jsxs("div",{className:"text-sm text-ink bg-olive/10 border border-olive/30 rounded-lg px-3 py-3","data-testid":"upgrade-request-sent",children:["✓ Sent to ",n.jsx("span",{className:"font-semibold",children:s?.ownerName||s?.ownerEmail||"your owner"}
75),". They'll get an email with your suggested plan",g?" and note":"","."]}),u&&n.jsx("div",{className:"text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg px-3 py-2","data-testid":"upgrade-error",children:u})]}),n.jsx("div",{className:"p-6 border-t border-warm-border flex items-center justify-between gap-4",children:L?n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"text-xs text-warm-gray max-w-sm",children:["By clicking ",n.jsx("span",{className:"font-semibold",children:"Agree & Continue"})," you'll be redirected to Stripe to enter payment. Your acceptance is recorded."]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(at,{variant:"ghost",onClick:N,children:"Cancel"}),n.jsx(at,{onClick:S,disabled:l||i||!p,testId:"button-confirm-upgrade",children:l?"Redirecting…":"Agree & Continue"})]})]}):n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-xs text-warm-gray max-w-sm",children:"We'll email the workspace owner with your suggested plan and note. They have to approve and pay."}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(at,{variant:"ghost",onClick:N,children:v?"Close":"Cancel"}),!v&&n.jsx(at,{onClick:A,disabled:l||i||!p,testId:"button-notify-owner-modal",children:l?"Sending…":"Notify owner"})]})]})})]})})}function GG({session:t,navigate:e,showToast:s}){const r=t.submissions.slice(0,5);return n.jsxs("div",{className:"space-y-6",children:[n.jsx(ot,{className:"p-7",children:n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[n.jsxs("div",{className:"lg:col-span-2",children:[n.jsx("h2",{className:"text-xl font-black text-ink mb-2",children:"Start a new capture"}),n.jsx("p",{className:"text-sm text-warm-gray leading-relaxed mb-5",children:"Pick a method to record a workflow. The Chrome extension records browser actions and your voice. You can also upload an existing process document and skip recording entirely."}),n.jsxs("div",{className:"flex flex-wrap gap-2.5",children:[n.jsx(at,{onClick:()=>s("Launching browser capture is wired by the extension"),testId:"button-start-browser-capture",children:"Start browser capture"}),n.jsx(at,{variant:"secondary",onClick:()=>window.open(zO,"_blank","noopener,noreferrer"),children:"Install Chrome extension"})]})]}),n.jsxs("div",{className:"border-l border-warm-border pl-6",children:[n.jsx("p",{className:"text-xs font-bold text-warm-gray uppercase tracking-wider mb-2",children:"Extension status"}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500"}),n.jsx("span",{className:"text-sm font-semibold text-ink",children:"Not detected"})]}),n.jsx("p",{className:"text-xs text-warm-gray leading-snug",children:"Install the extension and reload this page to connect."}),n.jsx("button",{onClick:()=>e({name:"settings",section:"extension"}),className:"text-xs font-semibold text-olive hover:text-olive-dark mt-3",children:"Manage extension keys →"})]})]})}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Capture tips"}),n.jsx("ul",{className:"space-y-2.5 text-sm text-ink",children:["Pick one repeatable, browser-based process — not a one-off task.","Narrate as you go. Explain the why, not just the what.","Mention edge cases out loud — the system captures them.","Stop before personal or unrelated browsing.","Review the generated steps before sharing with anyone."].map((i,a)=>n.jsxs("li",{className:"flex gap-3",children:[n.jsxs("span",{className:"text-olive font-bold flex-shrink-0",children:[a+1,"."]}),n.jsx("span",{className:"text-warm-gray leading-snug",children:i})]},a))})]}),n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Recent capture attempts"}),r.length===0?n.jsx(to,{icon:"●",title:"No captures yet",body:"Start your first capture above. Recent attempts will appear here."}):n.jsx("div",{className:"divide-y divide-warm-border/60",children:r.map(i=>n.jsxs("button",{onClick:()=>e({name:"workflow",id:i.id}),className:"w-full text-left flex items-center justify-between py-3 hover:bg-cream/40 -mx-2 px-2 rounded-lg",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-sm font-semibold text-ink truncate",children:i.title||"Untitled"}),n.jsxs("p",{className:"text-xs text-warm-gray",children:[fN(i)," steps · ",gu(i.createdAt)]})]}),n.jsx(cp,{status:Yn(i)})]},i.id))})]})]})]})}function KG({session:t,navigate:e}){const[s,r]=j.useState(""),[i,a]=j.useState("all"),l=j.useMemo(()=>t.submissions.filter(d=>!(s&&!(d.title||"").toLowerCase().includes(s.toLowerCase())||i!=="all"&&Yn(d)!==i)),[t.submissions,s,i]);return t.submissions.length===0?n.jsx(ot,{className:"p-8",children:n.jsx(to,{icon:"▤",title:"No workflows yet",body:"Create your first workflow to see it here — capture from your browser, upload a document, or describe one to Betty. You'll be able to review steps, generate SOPs, and export to your tools.",primary:{label:"Create your first workflow",onClick:()=>e({name:"capture"})}})}):n.jsxs("div",{className:"space-y-4",children:[n.jsxs(ot,{className:"p-4 flex flex-col sm:flex-row gap-3",children:[n.jsx("div",{className:"flex-1",children:n.jsx(Vc,{value:s,onChange:r,placeholder:"Search workflows...",testId:"input-search-workflows"})}),n.jsx("div",{className:"sm:w-48",children:n.jsx(xN,{value:i,onChange:a,testId:"select-status-filter",options:[{value:"all",label:"All statuses"},{value:"Captured",label:"Captured"},{value:"Generating",label:"Generating"},{value:"Needs Review",label:"Needs Review"},{value:"Approved",label:"Approved"},{value:"Exported",label:"Exported"},{value:"Sent to Runtime",label:"Sent to Runtime"},{value:"Failed",label:"Failed"}]})})]}),n.jsx(ot,{className:"p-0 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{className:"bg-cream-dark/50",children:n.jsxs("tr",{className:"text-left text-[11px] font-bold text-warm-gray uppercase tracking-wider",children:[n.jsx("th",{className:"py-3 px-5",children:"Workflow"}),n.jsx("th",{className:"py-3 px-5",children:"Status"}),n.jsx("th",{className:"py-3 px-5",children:"Owner"}),n.jsx("th",{className:"py-3 px-5",children:"Reviewer"}),n.jsx("th",{className:"py-3 px-5",children:"Outputs"}),n.jsx("th",{className:"py-3 px-5",children:"Last updated"}),n.jsx("th",{className:"py-3 px-5 text-right",children:"Action"})]})}),n.jsxs("tbody",{className:"divide-y divide-warm-border/60",children:[l.map(d=>{const u=Yn(d),m=!d.locked&&(u==="Approved"||u==="Exported"||u==="Sent to Runtime")?"SOP · Training · AI Script":"—";return n.jsxs("tr",{className:"hover:bg-cream/40",children:[n.jsxs("td",{className:"py-4 px-5",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("button",{onClick:()=>e({name:"workflow",id:d.id}),className:"font-semibold text-ink hover:text-olive text-left","data-testid":`link-workflow-${d.id}`,children:d.title||"Untitled workflow"}),d.locked&&n.jsxs("button",{onClick:p=>{p.stopPropagation(),kb({reason:"capture_minutes_lock",limitType:"recordingMinutesPerMonth"})},className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md bg-amber-50 text-amber-800 border border-amber-200 text-[10px] font-bold uppercase tracking-wider hover:bg-amber-100",title:"Over monthly capture limit — upgrade to access","data-testid":`badge-locked-${d.id}
75`,children:[n.jsx("span",{"aria-hidden":!0,children:"🔒"})," Locked"]})]}),n.jsxs("div",{className:"text-xs text-warm-gray",children:[fN(d)," steps · ",l1(d)," decisions"]})]}),n.jsx("td",{className:"py-4 px-5",children:n.jsx(cp,{status:u})}),n.jsx("td",{className:"py-4 px-5 text-warm-gray text-xs",children:d.capturedByName||t.contactName}),n.jsx("td",{className:"py-4 px-5 text-warm-gray text-xs",children:d.reviewerName||"—"}),n.jsx("td",{className:"py-4 px-5 text-warm-gray text-xs",children:m}),n.jsx("td",{className:"py-4 px-5 text-warm-gray text-xs",children:gu(d.createdAt)}),n.jsx("td",{className:"py-4 px-5 text-right",children:n.jsx(at,{size:"sm",variant:"secondary",onClick:()=>e({name:"workflow",id:d.id}),children:"Open"})})]},d.id)}),l.length===0&&n.jsx("tr",{children:n.jsx("td",{colSpan:7,className:"py-8 text-center text-warm-gray text-sm",children:"No workflows match your filters."})})]})]})})})]})}function YG({session:t,workflowId:e,navigate:s,showToast:r,onSessionRefresh:i}){const[a,l]=j.useState("overview"),[d,u]=j.useState(!1),[m,p]=j.useState(null),[x,g]=j.useState(!1),[b,v]=j.useState(!1),[k,N]=j.useState(""),[S,A]=j.useState(!1),[E,_]=j.useState(!1),[T,$]=j.useState(!1),[L,M]=j.useState(0),I=j.useRef(null),z=t.submissions.find(D=>D.id===e);if(j.useEffect(()=>{if(!d)return;const D=V=>{I.current&&!I.current.contains(V.target)&&u(!1)};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[d]),!z)return n.jsx(ot,{className:"p-8",children:n.jsx(to,{icon:"?",title:"Workflow not found",body:"This workflow may have been deleted or you don't have access.",primary:{label:"Back to workflows",onClick:()=>s({name:"workflows"})}})});const ae=WO(z.status),U=Array.isArray(z.workflowSteps)?z.workflowSteps:[],Y=z.aiSummary||{},P=Y.processInsights||{},ne=ae==="Approved"||ae==="Exported"||ae==="Sent to Runtime";async function q(){g(!0);try{const D=await wt(`/api/portal/sop/${z.id}/approve`,{method:"PATCH"});if(!D.ok)throw new Error((await D.json().catch(()=>({}))).error||"Failed");r("Workflow approved"),await i()}catch(D){r(D.message||"Approve failed")}finally{g(!1)}}async function W(){A(!0);try{const D=await wt(`/api/portal/sop/${z.id}/reject`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comment:k.trim()})});if(!D.ok)throw new Error((await D.json().catch(()=>({}))).error||"Failed");r("Changes requested"),v(!1),N(""),await i()}catch(D){r(D.message||"Failed to request changes")}finally{A(!1)}}async function ie(){$(!0);try{const D=await wt(`/api/portal/sop/${z.id}`,{method:"DELETE"});if(!D.ok)throw new Error((await D.json().catch(()=>({}))).error||"Delete failed");r("Workflow deleted"),_(!1),await i(),s({name:"workflows"})}catch(D){r(D?.message||"Delete failed"),$(!1)}}async function he(D){p(D),u(!1);try{const V=await wt(`/api/portal/sop/${z.id}/export/${D}`);if(!V.ok){const We=await V.json().catch(()=>({}));throw new Error(We.error||"Export failed")}const ge=await V.blob(),ue=URL.createObjectURL(ge),Me=document.createElement("a");Me.href=ue,Me.download=`${(z.title||"workflow").replace(/[^a-zA-Z0-9_\- ]/g,"_")}.${D==="pdf"?"pdf":"md"}`,document.body.appendChild(Me),Me.click(),Me.remove(),URL.revokeObjectURL(ue),r(`${D.toUpperCase()} downloaded`),M(We=>We+1)}catch(V){r(V.message||"Export failed")}finally{p(null)}}const se=D=>D?Array.isArray(D)?D.map(V=>
75typeof V=="string"?V:JSON.stringify(V)):typeof D=="string"&&D.trim()?[D]:[]:[],B=[{key:"overview",label:"Overview"},{key:"timeline",label:"Capture Timeline"},{key:"transcript",label:"Transcript"},{key:"sop",label:"SOP"},{key:"training",label:"Training Guide"},{key:"ai",label:"AI Script"},{key:"exports",label:"Exports"},{key:"review",label:"Review History"}],le=({children:D})=>n.jsx("h3",{className:"text-sm font-bold text-ink uppercase tracking-wider mb-3",children:D}),pe=({children:D})=>n.jsx("h4",{className:"text-xs font-bold text-warm-gray uppercase tracking-wider mb-2",children:D}),Oe=({type:D})=>{const ge={logic:"bg-amber-50 text-amber-800 border-amber-200",forEach:"bg-blue-50 text-blue-700 border-blue-200",decision:"bg-amber-50 text-amber-800 border-amber-200"}[D]||"bg-cream text-warm-gray border-warm-border";return n.jsx("span",{className:`inline-flex px-1.5 py-0.5 rounded text-[10px] font-bold border ${ge}`,children:D})},Se=(D,V)=>{const ge=se(D.substeps),ue=se(D.toolsOrSystems),Me=se(D.constraints);return n.jsxs("div",{className:"border border-warm-border rounded-xl p-4 space-y-2",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("span",{className:"flex-shrink-0 w-7 h-7 rounded-lg bg-olive/10 text-olive text-xs font-bold flex items-center justify-center",children:V+1}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("span",{className:"text-sm font-bold text-ink",children:D.name||D.description||"Step"}),D.type&&D.type!=="code"&&n.jsx(Oe,{type:D.type})]}),D.description&&D.description!==D.name&&n.jsx("p",{className:"text-sm text-ink/80 mt-1 leading-relaxed",children:D.description})]})]}),D.logicNote&&n.jsx("div",{className:"ml-10 text-xs text-olive bg-olive/5 border border-olive/10 rounded-lg px-3 py-2 italic",children:D.logicNote}),ge.length>0&&n.jsxs("div",{className:"ml-10",children:[n.jsx("p",{className:"text-[11px] font-bold text-warm-gray uppercase tracking-wider mb-1",children:"Sub-steps"}),n.jsx("ol",{className:"space-y-1",children:ge.map((We,_e)=>n.jsxs("li",{className:"text-xs text-ink flex gap-2",children:[n.jsxs("span",{className:"flex-shrink-0 text-warm-gray",children:[_e+1,"."]}),n.jsx("span",{children:We})]},_e))})]}),(ue.length>0||D.inputs||D.outputs)&&n.jsxs("div",{className:"ml-10 flex flex-wrap gap-x-6 gap-y-1 text-xs",children:[ue.length>0&&n.jsxs("span",{children:[n.jsx("span",{className:"font-bold text-warm-gray",children:"Tools:"})," ",n.jsx("span",{className:"text-ink",children:ue.join(", ")})]}),D.inputs&&n.jsxs("span",{children:[n.jsx("span",{className:"font-bold text-warm-gray",children:"Inputs:"})," ",n.jsx("span",{className:"text-ink",children:D.inputs})]}),D.outputs&&n.jsxs("span",{children:[n.jsx("span",{className:"font-bold text-warm-gray",children:"Outputs:"})," ",n.jsx("span",{className:"text-ink",children:D.outputs})]})]}),Me.length>0&&n.jsxs("div",{className:"ml-10",children:[n.jsx("p",{className:"text-[11px] font-bold text-warm-gray uppercase tracking-wider mb-1",children:"Constraints"}),n.jsx("ul",{className:"space-y-0.5",children:Me.map((We,_e)=>n.jsxs("li",{className:"text-xs text-ink flex gap-1.5",children:[n.jsx("span",{className:"text-warm-gray",children:"-"}),We]},_e))})]}),D.ifUnclear&&n.jsxs("div",{className:"ml-10 text-xs text-amber-800 bg-amber-50 border border-amber-200 rounded-lg px-3 py-2",children:[n.jsx("span",{className:"font-bold",children:"If unclear:"})," ",D.ifUnclear]})]},V)};return n.jsxs("div",{className:"space-y-5",children:[n.jsx("button",{onClick:()=>s({name:"workflows"}),className:"text-xs font-semibold text-warm-gray hover:text-ink",children:"← Back to workflows"}),n.jsx(ot,{className:"p-6",children:n.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("h1",{className:"text-2xl font-black text-ink","data-testid":"text-workflow-title",children:z.title||"Untitled workflow"}),!z.locked&&n.jsx("button",{type:"button",onClick:async()=>{const V=(window.prompt("Rename this workflow",z.title||"")||"").trim();if(!(!V||V===z.title))try{const ge=await wt(`/api/portal/sop/${z.id}/rename`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:V})});if(!ge.ok)throw new Error((await ge.json().catch(()=>({}))).error||"Rename failed");r("Workflow renamed"),await i()}catch(ge){r(ge?.message||"Rename failed")}},className:"text-xs font-semibold text-warm-gray hover:text-olive border border-warm-border hover:border-olive/40 rounded-md px-2 py-1 transition-colors",title:"Rename this workflow","data-testid":"button-rename-workflow",children:"Rename"})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-warm-gray",children:[n.jsxs("span",{children:["Captured by ",n.jsx("span",{className:"font-semibold text-ink",children:z.capturedByName||t.contactName})]}),n.jsx("span",{children:"·"}),n.jsxs("span",{children:[n.jsx("span",{className:"font-semibold text-ink",children:U.length})," steps"]}),n.jsx("span",{children:"·"}),n.jsxs("span",{children:[n.jsx("span",{className:"font-semibold text-ink",children:l1(z)})," decision points"]}),n.jsx("span",{children:"·"}),n.jsxs("span",{children:["Updated ",gu(z.createdAt)]})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!z.locked&&n.jsx(cp,{status:ae}),z.locked&&n.jsx("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-amber-50 text-amber-800 text-xs font-bold border border-amber-200",children:"🔒 Locked — upgrade to unlock"}),!z.locked&&n.jsx(at,{size:"sm",variant:"secondary",onClick:()=>s({name:"edit",id:z.id}),children:"Edit with Betty"}),!z.locked&&n.jsxs("div",{className:"relative",ref:I,children:[n.jsx(at,{size:"sm",variant:"secondary",onClick:()=>u(!d),children:m?`Exporting ${m}...`:"Export"}),d&&n.jsx("div",{className:"absolute right-0 mt-1 w-48 bg-white rounded-lg shadow-lg border border-warm-border z-50 py-1",children:[["pdf","Export as PDF"],["markdown","Export as Markdown"]].map(([D,V])=>n.jsx("button",{disabled:!!m,className:"w-full text-left px-4 py-2 text-sm text-ink hover:bg-warm-bg transition-colors disabled:opacity-50",onClick:()=>he(D),children:V},D))})]}),!z.locked&&n.jsx(at,{size:"sm",variant:"danger",onClick:()=>_(!0),disabled:T,testId:"button-delete-workflow",children:"Delete"}),!z.locked&&(()=>{const D=t.contacts.find(_e=>_e.email?.toLowerCase()===t.contactEmail?.toLowerCase()),V=D?.id,ge=D?.isPrimary===1,ue=!!z.reviewerId&&z.reviewerId===V,Me=!!z.capturedById&&z.capturedById===V,We=(ge||ue)&&!(Me&&!ge);return ne?null:We?n.jsxs(n.Fragment,{children:[n.jsx(at,{size:"sm",variant:"secondary",onClick:()=>v(!0),disabled:x||S,children:"Request changes"}),n.jsx(at,{size:"sm",onClick:q,disabled:x||S,children:x?"Approving...":"Approve"})]}):n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-amber-50 text-amber-800 text-xs font-bold border border-amber-200",children:["Awaiting review",z.reviewerName?` · ${z.reviewerName}`:""]})})(),b&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-center justify-center p-4",onClick:()=>!S&&v(!1),children:n.jsxs("div",{className:"w-full max-w-md bg-white rounded-2xl border border-warm-border p-6",onClick:D=>D.stopPropagation(),children:[n.jsx("h2",{className:"text-lg font-bold text-ink mb-1",children:"Request changes"}
75),n.jsx("p",{className:"text-sm text-warm-gray mb-4",children:"Tell the capturer what to fix. They'll get an email with your note."}),n.jsx("textarea",{value:k,onChange:D=>N(D.target.value),placeholder:"What needs to change?",rows:5,className:"w-full px-3 py-2 border border-warm-border rounded-lg text-sm focus:outline-none focus:border-olive resize-none","data-testid":"textarea-reject-comment"}),n.jsxs("div",{className:"flex items-center justify-end gap-2 mt-5",children:[n.jsx(at,{variant:"secondary",onClick:()=>v(!1),disabled:S,children:"Cancel"}),n.jsx(at,{onClick:W,disabled:S,testId:"button-confirm-reject",children:S?"Sending...":"Send to capturer"})]})]})}),E&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-center justify-center p-4",onClick:()=>!T&&_(!1),children:n.jsxs("div",{className:"w-full max-w-md bg-white rounded-2xl border border-warm-border p-6",onClick:D=>D.stopPropagation(),children:[n.jsx("h2",{className:"text-lg font-bold text-ink mb-1",children:"Delete this workflow?"}),n.jsxs("p",{className:"text-sm text-warm-gray mb-4",children:['"',z.title||"Untitled workflow",`" will be permanently deleted — including its recorded steps, audio, transcript, and generated outputs. This can't be undone.`]}),n.jsxs("div",{className:"flex items-center justify-end gap-2 mt-5",children:[n.jsx(at,{variant:"secondary",onClick:()=>_(!1),disabled:T,children:"Cancel"}),n.jsx(at,{variant:"danger",onClick:ie,disabled:T,testId:"button-confirm-delete-workflow",children:T?"Deleting...":"Delete workflow"})]})]})})]})]})}),z.locked?n.jsx(ot,{className:"p-8",children:n.jsxs("div",{className:"max-w-xl mx-auto text-center space-y-4",children:[n.jsx("div",{className:"mx-auto w-12 h-12 rounded-full bg-amber-100 flex items-center justify-center text-2xl","aria-hidden":!0,children:"🔒"}),n.jsx("h2",{className:"text-xl font-bold text-ink",children:"This workflow is over your monthly capture limit"}),n.jsx("p",{className:"text-sm text-warm-gray leading-relaxed",children:"Your recording was saved in full, but it's locked because your workspace has used all of this month's capture minutes on your current plan. Upgrade to access the steps, transcript, SOP, and exports — or wait until the limit resets next month."}),n.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[n.jsx(at,{onClick:()=>kb({reason:"capture_minutes_lock",limitType:"recordingMinutesPerMonth"}),testId:"button-upgrade-from-locked-workflow",children:"Upgrade plan"}),n.jsx(at,{variant:"secondary",onClick:()=>s({name:"workflows"}),children:"Back to workflows"})]})]})}):n.jsxs(ot,{className:"p-0 overflow-hidden",children:[n.jsx("div",{className:"border-b border-warm-border overflow-x-auto",children:n.jsx("div",{className:"flex",children:B.map(D=>n.jsx("button",{onClick:()=>l(D.key),"data-testid":`tab-${D.key}`,className:`px-5 py-3 text-sm font-semibold whitespace-nowrap border-b-2 transition-colors ${a===D.key?"border-olive text-olive":"border-transparent text-warm-gray hover:text-ink"}`,children:D.label},D.key))})}),n.jsxs("div",{className:"p-6",children:[a==="overview"&&n.jsxs("div",{className:"space-y-6",children:[z.description&&n.jsxs("div",{children:[n.jsx(pe,{children:"Description"}),n.jsx("p",{className:"text-sm text-ink leading-relaxed",children:z.description})]}),(Y.whatItDoes||Y.whyItExists)&&n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[Y.whatItDoes&&n.jsxs("div",{className:"border border-warm-border rounded-xl p-4",children:[n.jsx(pe,{children:"What it does"}),n.jsx("p",{className:"text-sm text-ink leading-relaxed",children:Y.whatItDoes})]}),Y.whyItExists&&n.jsxs("div",{className:"border border-warm-border rounded-xl p-4",children:[n.jsx(pe,{children:"Why it exists"}),n.jsx("p",{className:"text-sm text-ink leading-relaxed",children:Y.whyItExists})]})]}),(P.frequency||P.estimatedVolume||P.isLooped||se(P.painPoints).length>0)&&n.jsxs("div",{className:"border border-warm-border rounded-xl p-4",children:[n.jsx(pe,{children:"Process insights"}),n.jsxs("div",{className:"flex flex-wrap gap-x-8 gap-y-2 text-sm mb-3",children:[P.frequency&&n.jsxs("span",{children:[n.jsx("span",{className:"font-bold text-warm-gray text-xs",children:"Frequency:"})," ",n.jsx("span",{className:"text-ink",children:P.frequency})]}),P.estimatedVolume&&n.jsxs("span",{children:[n.jsx("span",{className:"font-bold text-warm-gray text-xs",children:"Volume:"})," ",n.jsx("span",{className:"text-ink",children:P.estimatedVolume})]}),P.isLooped&&n.jsxs("span",{children:[n.jsx("span",{className:"font-bold text-warm-gray text-xs",children:"Looped:"})," ",n.jsx("span",{className:"text-ink",children:P.loopDescription||"Yes"})]})]}),se(P.painPoints).length>0&&n.jsxs("div",{children:[n.jsx("p",{className:"text-[11px] font-bold text-warm-gray uppercase tracking-wider mb-1",children:"Pain points"}),n.jsx("ul",{className:"space-y-1",children:se(P.painPoints).map((D,V)=>n.jsxs("li",{className:"text-xs text-ink flex gap-1.5",children:[n.jsx("span",{className:"text-amber-500",children:"!"}),D]},V))})]}),se(P.exceptions).length>0&&n.jsxs("div",{className:"mt-2",children:[n.jsx("p",{className:"text-[11px] font-bold text-warm-gray uppercase tracking-wider mb-1",children:"Exceptions"}),n.jsx("ul",{className:"space-y-1",children:se(P.exceptions).map((D,V)=>n.jsxs("li",{className:"text-xs text-ink flex gap-1.5",children:[n.jsx("span",{className:"text-warm-gray",children:"-"}),D]},V))})]})]}),se(Y.decisionPoints).length>0&&n.jsxs("div",{children:[n.jsx(pe,{children:"Decision points"}),n.jsx("ul",{className:"space-y-1.5",children:se(Y.decisionPoints).map((D,V)=>n.jsxs("li",{className:"text-sm text-ink flex gap-2",children:[n.jsx("span",{className:"text-olive flex-shrink-0",children:"◆"}),D]},V))})]}),se(Y.eligibilityConditions).length>0&&n.jsxs("div",{children:[n.jsx(pe,{children:"Eligibility conditions"}),n.jsx("ul",{className:"space-y-1.5",children:se(Y.eligibilityConditions).map((D,V)=>n.jsxs("li",{className:"text-sm text-ink flex gap-2",children:[n.jsx("span",{className:"text-warm-gray flex-shrink-0",children:"-"}),D]},V))})]}),Array.isArray(Y.escalationPaths)&&Y.escalationPaths.length>0&&n.jsxs("div",{children:[n.jsx(pe,{children:"Escalation paths"}),n.jsx("div",{className:"space-y-2",children:Y.escalationPaths.map((D,V)=>n.jsxs("div",{className:"border border-warm-border rounded-lg p-3 text-sm",children:[n.jsx("p",{className:"font-semibold text-ink",children:D.trigger||D}),D.action&&n.jsx("p",{className:"text-ink/80 mt-1",children:D.action}),D.notes&&n.jsx("p",{className:"text-xs text-warm-gray mt-1 italic",children:D.notes})]},V))})]}),Array.isArray(Y.terminalOutcomes)&&Y.terminalOutcomes.length>0&&n.jsxs("div",{children:[n.jsx(pe,{children:"Terminal outcomes"}),n.jsx("div",{className:"space-y-2",children:Y.terminalOutcomes.map((D,V)=>n.jsxs("div",{className:"border border-warm-border rounded-lg p-3 text-sm",children:[n.jsx("p",{className:"font-bold text-ink",children:D.outcome||D}),D.criteria&&n.jsxs("p",{className:"text-ink/80 mt-1",children:[n.jsx("span",{className:"text-warm-gray font-semibold text-xs",children:"Criteria:"})," ",D.criteria]}),D.requiredActions&&n.jsxs("p",{className:"text-ink/80 mt-0.5",children:[n.jsx("span",{className:"text-warm-gray font-semibold text-xs",children:"Required:"})," ",D.requiredActions]})]},V))})]}),Array.isArray(Y.requiredTemplates)&&Y.requiredTemplates.length>0&&n.jsxs("div",{children:[n.jsx(pe,{children:"Required templates"}),n.jsx("div",{className:"space-y-3",children:Y.requiredTemplates.map((D,V)=>n.jsxs("div",{className:"border border-warm-border rounded-lg p-3",children:[n.jsx("p",{className:"text-sm font-bold text-ink mb-1",children:D.name}),D.exactText&&n.jsx("pre",{className:"text-xs text-ink bg-cream rounded-lg p-2 whitespace-pre-wrap font-sans mb-1",children:D.exactText}),D.whenUsed&&n.jsx("p",{className:"text-xs text-warm-gray italic",children:D.whenUsed})]},V))})]}),se(Y.uncertaintyHandling).length>0&&n.jsxs("div",{children:[n.jsx(pe,{children:"When things are unclear"}),n.jsx("ul",{className:"space-y-1.5",children:se(Y.uncertaintyHandling).map((D,V)=>n.jsxs("li",{className:"text-sm text-ink flex gap-2",children:[n.jsx("span",{className:"text-amber-500 flex-shrink-0",children:"?"}),D]},V))})]}),n.jsxs("div",{children:[n.jsxs(pe,{children:["Workflow steps (",U.length,")"]}),U.length===0?n.jsx("p",{className:"text-sm text-warm-gray",children:"No steps captured yet."}):n.jsx("div",{className:"space-y-3",children:U.map((D,V)=>Se(D,V))})]})]}),a==="timeline"&&(U.length===0?n.jsx("p",{className:"text-sm text-warm-gray",children:"Timeline will appear once the capture is processed."}):n.jsx("ol",{className:"space-y-3",children:U.map((D,V)=>n.jsxs("li",{className:"flex gap-4 py-3 border-l-2 border-olive/30 pl-4 -ml-1",children:[n.jsx("span",{className:"flex-shrink-0 w-6 text-warm-gray text-xs font-bold",children:String(V+1).padStart(2,"0")}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"text-sm text-ink font-medium",children:D?.name||D?.description||D?.text||D?.action||"Step"}),D?.description&&D.description!==D.name&&n.jsx("p",{className:"text-xs text-ink/70 mt-0.5",children:D.description}),D?.url&&n.jsx("p",{className:"text-xs text-warm-gray mt-0.5 truncate",children:D.url})]})]},V))})),a==="transcript"&&(z.audioTranscript?n.jsx("pre",{className:"text-sm text-ink whitespace-pre-wrap leading-relaxed font-sans",children:z.audioTranscript}):n.jsx("p",{className:"text-sm text-warm-gray",children:"No voice transcript was captured for this workflow."})),a==="sop"&&(U.length===0?n.jsx(to,{icon:"◇",title:"No SOP content",body:"Capture or describe a workflow first, then this tab will show the generated SOP."}):n.jsxs("div",{className:"space-y-6 max-w-3xl",children:[n.jsxs("div",{className:"border-b border-warm-border pb-4",children:[n.jsxs("h2",{className:"text-lg font-black text-ink",children:[z.title," — Standard Operating Procedure"]}),n.jsxs("div",{className:"flex flex-wrap gap-4 text-xs text-warm-gray mt-2",children:[n.jsx("span",{children:"Version: 1.0"}),n.jsxs("span",{children:["Status: ",ae]}),n.jsxs("span",{children:["Last updated: ",z.createdAt?new Date(z.createdAt).toLocaleDateString():"—"]})]})]}),Y.whatItDoes&&n.jsxs("div",{children:[n.jsx(le,{children:"1. Purpose"}),n.jsx("p",{className:"text-sm text-ink leading-relaxed",children:Y.whatItDoes}),Y.whyItExists&&n.jsx("p",{className:"text-sm text-ink/80 mt-2 leading-relaxed",children:Y.whyItExists})]}),se(Y.eligibilityConditions).length>0&&n.jsxs("div",{children:[n.jsx(le,{children:"2. Scope & eligibility"}),n.jsx("ul",{className:"space-y-1.5 text-sm text-ink",children:se(Y.eligibilityConditions).map((D,V)=>n.jsxs("li",{className:"flex gap-2",children:[n.jsx("span",{className:"text-warm-gray",children:"-"}),D]},V))})]}),n.jsxs("div",{children:[n.jsxs(le,{children:[se(Y.eligibilityConditions).length>0?"3":"2",". Procedure"]}),n.jsx("div",{className:"space-y-4",children:U.map((D,V)=>{const ge=se(D.substeps),ue=se(D.toolsOrSystems),Me=se(D.constraints);return n.jsxs("div",{className:"border-l-2 border-olive/30 pl-4",children:[n.jsxs("p",{className:"text-sm font-bold text-ink",children:["Step ",V+1,": ",D.name||"Untitled",D.type&&D.type!=="code"&&n.jsxs("span",{className:"text-xs text-warm-gray font-normal ml-2",children:["[",D.type,"]"]})]}),D.description&&n.jsx("p",{className:"text-sm text-ink/80 mt-1",children:D.description}),ge.length>0&&n.jsx("ol",{className:"mt-2 space-y-1 ml-4",children:ge.map((We,_e)=>n.jsx("li",{className:"text-xs text-ink list-decimal",children:We},_e))}),ue.length>0&&n.jsxs("p",{className:"text-xs text-warm-gray mt-1",children:["Systems: ",ue.join(", ")
75]}),Me.length>0&&n.jsx("div",{className:"mt-1 text-xs text-amber-800 bg-amber-50 rounded px-2 py-1",children:Me.map((We,_e)=>n.jsx("p",{children:We},_e))}),D.ifUnclear&&n.jsxs("p",{className:"text-xs text-amber-700 mt-1 italic",children:["If unclear: ",D.ifUnclear]})]},V)})})]}),se(Y.decisionPoints).length>0&&n.jsxs("div",{children:[n.jsx(le,{children:"Decision points"}),n.jsx("ul",{className:"space-y-1.5 text-sm text-ink",children:se(Y.decisionPoints).map((D,V)=>n.jsxs("li",{className:"flex gap-2",children:[n.jsx("span",{className:"text-olive",children:"◆"}),D]},V))})]}),Array.isArray(Y.escalationPaths)&&Y.escalationPaths.length>0&&n.jsxs("div",{children:[n.jsx(le,{children:"Escalation procedures"}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-sm border border-warm-border rounded-lg overflow-hidden",children:[n.jsx("thead",{className:"bg-cream-dark/50 text-[11px] font-bold text-warm-gray uppercase",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-2 px-3 text-left",children:"Trigger"}),n.jsx("th",{className:"py-2 px-3 text-left",children:"Action"}),n.jsx("th",{className:"py-2 px-3 text-left",children:"Notes"})]})}),n.jsx("tbody",{className:"divide-y divide-warm-border/60",children:Y.escalationPaths.map((D,V)=>n.jsxs("tr",{children:[n.jsx("td",{className:"py-2 px-3 text-ink",children:D.trigger||D}),n.jsx("td",{className:"py-2 px-3 text-ink",children:D.action||""}),n.jsx("td",{className:"py-2 px-3 text-warm-gray",children:D.notes||""})]},V))})]})})]}),Array.isArray(Y.requiredTemplates)&&Y.requiredTemplates.length>0&&n.jsxs("div",{children:[n.jsx(le,{children:"Templates & standard text"}),Y.requiredTemplates.map((D,V)=>n.jsxs("div",{className:"mb-4",children:[n.jsx("p",{className:"text-sm font-bold text-ink mb-1",children:D.name}),n.jsx("pre",{className:"text-xs bg-cream border border-warm-border rounded-lg p-3 whitespace-pre-wrap font-sans text-ink",children:D.exactText}),D.whenUsed&&n.jsxs("p",{className:"text-xs text-warm-gray mt-1 italic",children:["Used when: ",D.whenUsed]})]},V))]}),Array.isArray(Y.terminalOutcomes)&&Y.terminalOutcomes.length>0&&n.jsxs("div",{children:[n.jsx(le,{children:"Terminal outcomes"}),n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-sm border border-warm-border rounded-lg overflow-hidden",children:[n.jsx("thead",{className:"bg-cream-dark/50 text-[11px] font-bold text-warm-gray uppercase",children:n.jsxs("tr",{children:[n.jsx("th",{className:"py-2 px-3 text-left",children:"Outcome"}),n.jsx("th",{className:"py-2 px-3 text-left",children:"Criteria"}),n.jsx("th",{className:"py-2 px-3 text-left",children:"Required actions"})]})}),n.jsx("tbody",{className:"divide-y divide-warm-border/60",children:Y.terminalOutcomes.map((D,V)=>n.jsxs("tr",{children:[n.jsx("td",{className:"py-2 px-3 text-ink font-semibold",children:D.outcome||D}),n.jsx("td",{className:"py-2 px-3 text-ink",children:D.criteria||""}),n.jsx("td",{className:"py-2 px-3 text-ink",children:D.requiredActions||""})]},V))})]})})]})]})),a==="training"&&(U.length===0?n.jsx(to,{icon:"◇",title:"No training content",body:"Capture or describe a workflow first, then this tab will show the training guide."}):n.jsxs("div",{className:"space-y-6 max-w-3xl",children:[n.jsxs("div",{className:"bg-olive/5 border border-olive/15 rounded-xl p-5",children:[n.jsxs("h2",{className:"text-lg font-black text-ink mb-2",children:["Training Guide: ",z.title]}),n.jsx("p",{className:"text-sm text-ink/80 leading-relaxed",children:Y.whatItDoes||z.description||"This guide walks you through the workflow step by step."}),Y.whyItExists&&n.jsx("p",{className:"text-sm text-ink/70 mt-2 italic",children:Y.whyItExists})]}),se(Y.eligibilityConditions).length>0&&n.jsxs("div",{children:[n.jsx(le,{children:"Before you begin"}),n.jsx("p",{className:"text-sm text-ink/80 mb-2",children:"Make sure the following conditions are met before starting:"}),n.jsx("ul",{className:"space-y-1.5",children:se(Y.eligibilityConditions).map((D,V)=>n.jsxs("li",{className:"text-sm text-ink flex gap-2",children:[n.jsx("span",{className:"flex-shrink-0 w-5 h-5 rounded bg-olive/10 text-olive text-xs flex items-center justify-center font-bold",children:"✓"}),D]},V))})]}),n.jsxs("div",{children:[n.jsx(le,{children:"Step-by-step walkthrough"}),n.jsx("div",{className:"space-y-5",children:U.map((D,V)=>{const ge=se(D.substeps),ue=se(D.toolsOrSystems);return n.jsxs("div",{className:"border border-warm-border rounded-xl p-4",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("span",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-olive text-white text-sm font-bold flex items-center justify-center",children:V+1}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm font-bold text-ink",children:D.name||"Step"}),D.description&&n.jsx("p",{className:"text-sm text-ink/80 mt-1 leading-relaxed",children:D.description})]})]}),ge.length>0&&n.jsxs("div",{className:"ml-11 mt-3 bg-cream/50 rounded-lg p-3",children:[n.jsx("p",{className:"text-[11px] font-bold text-warm-gray uppercase mb-1.5",children:"Detailed steps"}),n.jsx("ol",{className:"space-y-1.5",children:ge.map((Me,We)=>n.jsxs("li",{className:"text-xs text-ink flex gap-2",children:[n.jsxs("span",{className:"text-warm-gray flex-shrink-0",children:[String.fromCharCode(97+We),"."]}),n.jsx("span",{children:Me})]},We))})]}),ue.length>0&&n.jsx("div",{className:"ml-11 mt-2 flex flex-wrap gap-1.5",children:ue.map((Me,We)=>n.jsx("span",{className:"inline-flex px-2 py-0.5 rounded-full bg-blue-50 text-blue-700 text-[10px] font-semibold border border-blue-200",children:Me},We))}),D.logicNote&&n.jsxs("div",{className:"ml-11 mt-2 text-xs text-olive bg-olive/5 rounded-lg px-3 py-2",children:[n.jsx("span",{className:"font-bold",children:"Tip:"})," ",D.logicNote]}),D.ifUnclear&&n.jsxs("div",{className:"ml-11 mt-2 text-xs text-amber-800 bg-amber-50 rounded-lg px-3 py-2",children:[n.jsx("span",{className:"font-bold",children:"Watch out:"})," ",D.ifUnclear]})]},V)})})]}),se(Y.uncertaintyHandling).length>0&&n.jsxs("div",{children:[n.jsx(le,{children:"Common questions & edge cases"}),n.jsx("div",{className:"space-y-2",children:se(Y.uncertaintyHandling).map((D,V)=>n.jsxs("div",{className:"flex gap-2 text-sm text-ink",children:[n.jsx("span",{className:"text-amber-500 flex-shrink-0 font-bold",children:"Q:"}),n.jsx("span",{children:D})]},V))})]}),n.jsxs("div",{className:"bg-cream border border-warm-border rounded-xl p-5",children:[n.jsx(le,{children:"Qu
75ick reference checklist"}),n.jsx("div",{className:"space-y-2",children:U.map((D,V)=>n.jsxs("label",{className:"flex items-start gap-2.5 text-sm text-ink cursor-pointer",children:[n.jsx("input",{type:"checkbox",className:"mt-0.5 rounded border-warm-border text-olive focus:ring-olive"}),n.jsxs("span",{children:["Step ",V+1,": ",D.name||D.description||"Complete"]})]},V))})]})]})),a==="ai"&&(U.length===0?n.jsx(to,{icon:"◇",title:"No AI script content",body:"Capture or describe a workflow first, then this tab will show the AI agent script."}):n.jsxs("div",{className:"space-y-6 max-w-3xl",children:[n.jsxs("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-5",children:[n.jsxs("h2",{className:"text-lg font-black text-ink mb-1",children:["AI Agent Script: ",z.title]}),n.jsx("p",{className:"text-sm text-ink/70",children:"Structured automation specification for AI agent execution."})]}),n.jsxs("div",{className:"border border-warm-border rounded-xl p-4",children:[n.jsx(pe,{children:"Agent overview"}),n.jsxs("div",{className:"grid grid-cols-2 gap-3 text-xs",children:[n.jsxs("div",{children:[n.jsx("span",{className:"font-bold text-warm-gray",children:"Name:"})," ",n.jsx("span",{className:"text-ink",children:z.title})]}),n.jsxs("div",{children:[n.jsx("span",{className:"font-bold text-warm-gray",children:"Steps:"})," ",n.jsx("span",{className:"text-ink",children:U.length})]}),n.jsxs("div",{children:[n.jsx("span",{className:"font-bold text-warm-gray",children:"Decision points:"})," ",n.jsx("span",{className:"text-ink",children:l1(z)})]}),P.frequency&&n.jsxs("div",{children:[n.jsx("span",{className:"font-bold text-warm-gray",children:"Frequency:"})," ",n.jsx("span",{className:"text-ink",children:P.frequency})]}),P.isLooped&&n.jsxs("div",{children:[n.jsx("span",{className:"font-bold text-warm-gray",children:"Loop:"})," ",n.jsx("span",{className:"text-ink",children:P.loopDescription||"Yes"})]}),P.estimatedVolume&&n.jsxs("div",{children:[n.jsx("span",{className:"font-bold text-warm-gray",children:"Volume:"})," ",n.jsx("span",{className:"text-ink",children:P.estimatedVolume})]})]})]}),se(Y.eligibilityConditions).length>0&&n.jsxs("div",{className:"border border-warm-border rounded-xl p-4",children:[n.jsx(pe,{children:"Preconditions (gate check)"}),n.jsx("pre",{className:"text-xs text-ink bg-slate-50 rounded-lg p-3 whitespace-pre-wrap font-mono",children:se(Y.eligibilityConditions).map((D,V)=>`REQUIRE: ${D}`).join(`
76`)})]}),n.jsxs("div",{children:[n.jsx(pe,{children:"Execution flow"}),n.jsx("div",{className:"space-y-3",children:U.map((D,V)=>{const ge=se(D.substeps),ue=se(D.toolsOrSystems),Me=se(D.constraints),We=D.type==="logic"||D.type==="decision",_e=D.type==="forEach";return n.jsxs("div",{className:`border rounded-xl p-4 ${We?"border-amber-200 bg-amber-50/30":_e?"border-blue-200 bg-blue-50/30":"border-warm-border"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsxs("span",{className:"font-mono text-xs text-warm-gray",children:["#",String(V+1).padStart(2,"0")]}),n.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded ${We?"bg-amber-100 text-amber-800":_e?"bg-blue-100 text-blue-700":"bg-slate-100 text-slate-700"}`,children:We?"DECISION":_e?"FOR_EACH":"ACTION"}),n.jsx("span",{className:"text-sm font-bold text-ink",children:D.name||"Step"})]}),n.jsxs("pre",{className:"text-xs text-ink bg-white/80 rounded-lg p-2 whitespace-pre-wrap font-mono border border-warm-border/50",children:[`execute: "${D.description||D.name||""}"`,ue.length>0?`systems: [${ue.map(Re=>`"${Re}"`).join(", ")}]`:"",D.inputs?`input: "${D.inputs}"`:"",D.outputs?`output: "${D.outputs}"`:"",ge.length>0?`substeps:
77${ge.map((Re,ze)=>`  ${ze+1}. ${Re}`).join(`
78`)}`:"",Me.length>0?`constraints:
79${Me.map(Re=>`  - ${Re}`).join(`
80`)}`:"",D.ifUnclear?`on_error: "${D.ifUnclear}"`:""]})]},V)})})]}),se(Y.decisionPoints).length>0&&n.jsxs("div",{className:"border border-warm-border rounded-xl p-4",children:[n.jsx(pe,{children:"Decision logic"}),n.jsx("pre",{className:"text-xs text-ink bg-slate-50 rounded-lg p-3 whitespace-pre-wrap font-mono",children:se(Y.decisionPoints).map((D,V)=>`IF: ${D}`).join(`
81
82`)})]}),se(Y.uncertaintyHandling).length>0&&n.jsxs("div",{className:"border border-warm-border rounded-xl p-4",children:[n.jsx(pe,{children:"Error handling"}),n.jsx("pre",{className:"text-xs text-ink bg-slate-50 rounded-lg p-3 whitespace-pre-wrap font-mono",children:se(Y.uncertaintyHandling).map(D=>`FALLBACK: ${D}`).join(`
83`)})]}),Array.isArray(Y.terminalOutcomes)&&Y.terminalOutcomes.length>0&&n.jsxs("div",{className:"border border-warm-border rounded-xl p-4",children:[n.jsx(pe,{children:"Terminal states"}),n.jsx("pre",{className:"text-xs text-ink bg-slate-50 rounded-lg p-3 whitespace-pre-wrap font-mono",children:Y.terminalOutcomes.map(D=>`STATE "${D.outcome||D}":
84  criteria: "${D.criteria||""}"
85  actions: "${D.requiredActions||""}"`).join(`
86
87`)})]})]})),a==="exports"&&n.jsx(sK,{workflowId:z.id,reloadKey:L,onRedownload:he,redownloading:m}),a==="review"&&n.jsx("div",{className:"space-y-3",children:[{when:z.createdAt,who:t.contactName,what:"Workflow captured"},z.receivedAt&&{when:z.receivedAt,who:"System",what:"Capture processed"},z.reviewedAt&&{when:z.reviewedAt,who:t.contactName,what:"Reviewed"},z.approvedAt&&{when:z.approvedAt,who:t.contactName,what:"Approved"}
87].filter(Boolean).map((D,V)=>n.jsxs("div",{className:"flex items-start gap-3 py-2 border-b border-warm-border/40 last:border-0",children:[n.jsx("span",{className:"flex-shrink-0 w-2 h-2 rounded-full bg-olive mt-2"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"text-sm font-semibold text-ink",children:D.what}),n.jsxs("p",{className:"text-xs text-warm-gray",children:[D.who," · ",gu(D.when)]})]})]},V))})]})]})]})}function QG({session:t,navigate:e}){const[s,r]=j.useState("all"),i=t.submissions.filter(l=>{const d=Yn(l);return d==="Approved"||d==="Exported"||d==="Sent to Runtime"});if(i.length===0)return n.jsx(ot,{className:"p-8",children:n.jsx(to,{icon:"▦",title:"No outputs yet",body:"Once you approve a captured workflow, we'll generate an SOP, training guide, and AI-agent script. Approve a workflow to populate this library.",primary:{label:"Go to Workflows",onClick:()=>e({name:"workflows"})},secondary:{label:"Capture a workflow",onClick:()=>e({name:"capture"})}})});const a=i.flatMap(l=>[{id:`${l.id}-sop`,asset:`${l.title} SOP`,type:"SOP",source:l.title,status:Yn(l),version:"v1.0",workflow:l},{id:`${l.id}-training`,asset:`${l.title} training guide`,type:"Training",source:l.title,status:Yn(l),version:"v1.0",workflow:l},{id:`${l.id}-ai`,asset:`${l.title} AI script`,type:"AI Script",source:l.title,status:"Needs Review",version:"v0.8",workflow:l}]).filter(l=>s==="all"||l.type===s);return n.jsxs("div",{className:"space-y-4",children:[n.jsx(ot,{className:"p-4 flex flex-wrap gap-2",children:["all","SOP","Training","AI Script","Checklist"].map(l=>n.jsx("button",{onClick:()=>r(l),className:`px-3.5 py-1.5 rounded-full text-xs font-semibold border transition-colors ${s===l?"bg-olive text-white border-olive":"bg-white text-warm-gray border-warm-border hover:text-ink"}`,children:l==="all"?"All types":l},l))}),n.jsx(ot,{className:"p-0 overflow-hidden",children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{className:"bg-cream-dark/50",children:n.jsxs("tr",{className:"text-left text-[11px] font-bold text-warm-gray uppercase tracking-wider",children:[n.jsx("th",{className:"py-3 px-5",children:"Asset"}),n.jsx("th",{className:"py-3 px-5",children:"Type"}),n.jsx("th",{className:"py-3 px-5",children:"Source"}),n.jsx("th",{className:"py-3 px-5",children:"Status"}),n.jsx("th",{className:"py-3 px-5",children:"Version"}),n.jsx("th",{className:"py-3 px-5 text-right",children:"Action"})]})}),n.jsx("tbody",{className:"divide-y divide-warm-border/60",children:a.map(l=>n.jsxs("tr",{className:"hover:bg-cream/40",children:[n.jsx("td",{className:"py-4 px-5 font-semibold text-ink",children:l.asset}),n.jsx("td",{className:"py-4 px-5 text-warm-gray text-xs",children:l.type}),n.jsx("td",{className:"py-4 px-5 text-warm-gray text-xs truncate max-w-[200px]",children:l.source}),n.jsx("td",{className:"py-4 px-5",children:n.jsx(cp,{status:l.status})}),n.jsx("td",{className:"py-4 px-5 text-warm-gray text-xs",children:l.version}),n.jsx("td",{className:"py-4 px-5 text-right",children:n.jsx(at,{size:"sm",variant:"secondary",onClick:()=>e({name:"workflow",id:l.workflow.id}),children:"Open"})})]},l.id))})]})})})]})}function JG({navigate:t,showToast:e}){const s=[{name:"SOP template",desc:"Standard operating procedure with steps, owner, frequency, and review cadence."},{name:"Training guide template",desc:"New-hire walkthrough with screenshots, narration, and check-your-understanding prompts."},{name:"AI-agent script template",desc:"Structured actions, inputs, validations, and exception paths."},{name:"Compliance SOP template",desc:"Process steps with control points, evidence capture, and audit fields."},{name:"Checklist template",desc:"Lightweight pass/fail checklist for repeatable QA tasks."}],[r,i]=j.useState("SOP template");return n.jsxs("div",{className:"space-y-4",children:[n.jsx(ot,{className:"p-6",children:n.jsx(cs,{title:"Output templates",description:"Choose how generated assets are formatted across your workspace."})}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:s.map(a=>{const l=a.name===r;return n.jsxs(ot,{className:`p-5 transition-all ${l?"ring-2 ring-olive/40":""}`,"data-testid":`template-card-${a.name.toLowerCase().replace(/\s+/g,"-")}`,children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[n.jsx("h3",{className:"text-base font-bold text-ink",children:a.name}),l&&n.jsx("span",{className:"px-2 py-0.5 rounded-full bg-olive/10 text-olive text-[10px] font-bold uppercase tracking-wider","data-testid":`badge-default-${a.name.toLowerCase().replace(/\s+/g,"-")}`,children:"✓ Default"})]}),n.jsx("p",{className:"text-sm text-warm-gray leading-snug mb-4",children:a.desc}),n.jsx("div",{className:"flex items-center gap-2",children:!l&&n.jsx(at,{size:"sm",variant:"ghost",onClick:()=>{i(a.name),e(`${a.name} set as default`)},testId:`button-set-default-${a.name.toLowerCase().replace(/\s+/g,"-")}`,children:"Set default"})})]},a.name)})})]})}
87function XG({contact:t,isSelf:e,callerIsOwner:s,onChange:r,showToast:i}){const[a,l]=j.useState(null);if(!s||e)return n.jsx("span",{className:"text-xs text-warm-gray",children:"—"});async function d(){if(confirm(`Transfer workspace ownership to ${t.name}? You will become a Member.`)){l("make-owner");try{const m=await wt(`/api/portal/sop/contacts/${t.id}/make-owner`,{method:"POST"});if(!m.ok)throw new Error((await m.json().catch(()=>({}))).error||"Failed");i("Ownership transferred"),await r()}catch(m){i(m?.message||"Failed to transfer ownership")}finally{l(null)}}}async function u(){if(confirm(`Remove ${t.name} from this workspace? They will lose access immediately.`)){l("remove");try{const m=await wt(`/api/portal/sop/contacts/${t.id}`,{method:"DELETE"});if(!m.ok)throw new Error((await m.json().catch(()=>({}))).error||"Failed");i("Member removed"),await r()}catch(m){i(m?.message||"Failed to remove member")}finally{l(null)}}}return n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[!t.isPrimary&&n.jsx("button",{onClick:d,disabled:a!==null,className:"text-xs font-semibold text-olive hover:underline disabled:opacity-50","data-testid":`button-make-owner-${t.id}`,children:a==="make-owner"?"...":"Make owner"}),!t.isPrimary&&n.jsx("button",{onClick:u,disabled:a!==null,className:"text-xs font-semibold text-red-700 hover:underline disabled:opacity-50","data-testid":`button-remove-member-${t.id}`,children:a==="remove"?"...":"Remove"})]})}function ZG({session:t,onSessionRefresh:e,showToast:s}){const[r,i]=j.useState(!1),[a,l]=j.useState(""),[d,u]=j.useState(""),[m,p]=j.useState(""),[x,g]=j.useState(!1),[b,v]=j.useState(null),k=t.pendingInvites||[],N=!!t.contacts.find(E=>E.email?.toLowerCase()===t.contactEmail?.toLowerCase())?.isPrimary;async function S(E,_){if(confirm(`Cancel the invite for ${_}? Their sign-in link will stop working.`)){v(E);try{const T=await wt(`/api/portal/sop/invite/${E}/revoke`,{method:"POST"});if(!T.ok){let $="Failed to cancel invite";try{$=(await T.json()).error||$}catch{}throw new Error($)}s("Invite canceled"),await e()}catch(T){s(T?.message||"Failed to cancel invite")}finally{v(null)}}}async function A(){p("");const E=d.trim();if(!E){p("Email address is required.");return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(E)){p("Enter a valid email address.");return}g(!0);try{const _=await wt("/api/portal/sop/invite/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a.trim(),email:E})});if(!_.ok){let $="Failed to send invite";try{$=(await _.json()).error||$}catch{}throw new Error($)}const T=await _.json().catch(()=>({}));s(T.sentTo?`Invite emailed to ${T.sentTo}`:"Invite sent"),l(""),u(""),p(""),i(!1),await e()}catch(_){p(_?.message||"Failed to send invite")}finally{g(!1)}}return n.jsxs("div",{className:"space-y-4",children:[n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Workspace members",description:`${t.contacts.length} ${t.contacts.length===1?"person has":"people have"} access.${k.length?` ${k.length} invite${k.length===1?"":"s"} waiting.`:""}`,action:n.jsx(at,{onClick:()=>i(!0),testId:"button-invite-user",children:"+ Invite User"})}),n.jsx("div",{className:"overflow-x-auto -mx-6 px-6",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"text-left text-[11px] font-bold text-warm-gray uppercase tracking-wider border-b border-warm-border",children:[n.jsx("th",{className:"py-3 pr-4",children:"Name"}),n.jsx("th",{className:"py-3 pr-4",children:"Email"}),n.jsx("th",{className:"py-3 pr-4",children:"Role"}),n.jsx("th",{className:"py-3 pr-4",children:"Status"}),n.jsx("th",{className:"py-3 pr-4 text-right",children:"Action"})]})}),n.jsxs("tbody",{className:"divide-y divide-warm-border/60",children:[t.contacts.map(E=>{const _=E.email?.toLowerCase()===t.contactEmail?.toLowerCase(),T=!!t.contacts.find($=>$.email?.toLowerCase()===t.contactEmail?.toLowerCase())?.isPrimary;return n.jsxs("tr",{children:[n.jsxs("td",{className:"py-4 pr-4",children:[n.jsxs("div",{className:"font-semibold text-ink",children:[E.name,_&&n.jsx("span",{className:"ml-2 text-[10px] uppercase tracking-wide text-warm-gray",children:"You"})]}),E.title&&n.jsx("div",{className:"text-xs text-warm-gray",children:E.title})]}),n.jsx("td",{className:"py-4 pr-4 text-warm-gray text-xs",children:E.email}),n.jsx("td",{className:"py-4 pr-4 text-xs font-semibold text-ink",children:E.isPrimary?"Owner":"Member"}),n.jsx("td",{className:"py-4 pr-4",children:n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-emerald-50 text-emerald-700 text-[11px] font-semibold border border-emerald-200",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500"})," Active"]})}),n.jsx("td",{className:"py-4 pr-4 text-right",children:n.jsx(XG,{contact:E,isSelf:_,callerIsOwner:T,onCh
87ange:e,showToast:s})})]},E.id)}),k.map(E=>{const _=E.name||E.email||"this teammate";return n.jsxs("tr",{className:"bg-amber-50/40",children:[n.jsxs("td",{className:"py-4 pr-4",children:[n.jsx("div",{className:"font-semibold text-ink",children:E.name||E.email||"Invited teammate"}),n.jsxs("div",{className:"text-xs text-warm-gray",children:["Invited ",new Date(E.createdAt).toLocaleDateString()]})]}),n.jsx("td",{className:"py-4 pr-4 text-warm-gray text-xs",children:E.email||"—"}),n.jsx("td",{className:"py-4 pr-4 text-xs font-semibold text-ink",children:"Member"}),n.jsx("td",{className:"py-4 pr-4",children:n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-amber-50 text-amber-700 text-[11px] font-semibold border border-amber-200",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500"})," Invited · waiting"]})}),n.jsx("td",{className:"py-4 pr-4 text-right",children:N?n.jsx("button",{onClick:()=>S(E.id,_),disabled:b!==null,className:"text-xs font-semibold text-red-700 hover:underline disabled:opacity-50","data-testid":`button-revoke-invite-${E.id}`,children:b===E.id?"Canceling…":"Cancel invite"}):n.jsx("span",{className:"text-xs text-warm-gray",children:"—"})})]},E.id)})]})]})})]}),n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Roles",description:"Two roles control what people can see and do."}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[{name:"Owner",desc:"Full access including billing, member management, and workspace settings."},{name:"Member",desc:"Capture, edit, and share workflows. Captures may require owner review before publication."}].map(E=>n.jsxs("div",{className:"border border-warm-border rounded-xl p-4",children:[n.jsx("p",{className:"text-sm font-bold text-ink mb-1",children:E.name}),n.jsx("p",{className:"text-xs text-warm-gray leading-snug",children:E.desc})]},E.name))})]}),r&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-center justify-center p-4",children:n.jsxs(ot,{className:"w-full max-w-md p-6",children:[n.jsx("h2",{className:"text-lg font-bold text-ink mb-1",children:"Invite a teammate"}),n.jsx("p",{className:"text-sm text-warm-gray mb-5",children:"We'll send them a sign-in link by email."}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(aa,{label:"Name (optional)",children:n.jsx(Vc,{value:a,onChange:l,placeholder:"Jane Smith",testId:"input-invite-name"})}),n.jsxs(aa,{label:"Work email *",children:[n.jsx(Vc,{value:d,onChange:E=>{u(E),m&&p("")},placeholder:"[email protected]",type:"email",testId:"input-invite-email"}),m&&n.jsx("p",{role:"alert",className:"text-xs text-red-700 mt-1.5","data-testid":"text-invite-error",children:m})]})]}),n.jsxs("div",{className:"flex items-center justify-end gap-2 mt-6",children:[n.jsx(at,{variant:"secondary",onClick:()=>{i(!1),p("")},disabled:x,children:"Cancel"}),n.jsx(at,{onClick:A,disabled:x,testId:"button-send-invite",children:x?"Sending...":"Send invite"})]})]})})]})}function eK({session:t,navigate:e}){const[s,r]=j.useState(null),[i,a]=j.useState(null);j.useEffect(()=>{let g=!1;return wt("/api/portal/billing/usage").then(async b=>{if(!b.ok)throw new Error((await b.json().catch(()=>({}))).error||"Failed to load usage");return b.json()}).then(b=>{g||r(b)}).catch(b=>{g||a(b?.message||"Failed to load usage")}),()=>{g=!0}},[]);const l=g=>g===null?"Unlimited":String(g),d=({used:g,total:b,label:v,unit:k})=>{const N=b===null?0:Math.min(100,Math.round(g/Math.max(b,1)*100)),S=b!==null&&g>b,A=b!==null&&g>=b,E=b!==null&&N>=80&&!A,_=S||A?"text-red-700":E?"text-amber-700":"text-warm-gray",T=S||A?"bg-red-500":E?"bg-amber-500":"bg-olive",$=S?"Over plan limit":A?"Plan limit reached":E?"Approaching plan limit":null;return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between text-sm mb-1.5",children:[n.jsx("span",{className:"font-semibold text-ink",children:v}),n.jsxs("span",{className:`text-xs font-semibold ${_}`,children:[g,k||""," / ",b===null?"Unlimited":`${b}${k||""}`]})]}),n.jsx("div",{className:"w-full h-2 bg-cream-dark rounded-full overflow-hidden",children:n.jsx("div",{className:`h-full transition-all ${T}`,style:{width:`${N}%`}})}),$&&n.jsx("p",{className:`text-xs mt-1.5 font-medium ${S||A?"text-red-700":"text-amber-700"}`,children:$})]})};if(i)return n.jsx(ot,{className:"p-6",children:n.jsx("div",{className:"text-sm text-red-700",children:i})});if(!s)return n.jsx(ot,{className:"p-6",children:n.jsx("div",{className:"text-sm text-warm-gray",children:"Loading usage..."})});const{limits:u,usage:m,planLabel:p}=s,x=(s.plan||"").toLowerCase()==="unlimited";return n.jsxs("div",{className:"space-y-5",children:[x&&n.jsxs("div",{className:"rounded-xl border border-olive/30 bg-olive/10 p-4 flex items-start gap-3","data-testid":"banner-unlimited-plan",children:[n.jsx("span",{className:"text-lg leading-none mt-0.5",children:"✦"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-semibold text-ink",children:"You're on the Unlimited plan"}),n.jsx("p",{className:"text-xs text-warm-gray mt-0.5",children:"Your workspace has no limits on workflows, team seats, document workflows, or capture minutes — at no cost. Enjoy!"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[n.jsx(si,{label:"Workflows",value:m.workflows,hint:`Limit: ${l(u.workflows)}`}),n.jsx(si,{label:"Workflows from documents",value:m.documents,hint:`Limit: ${l(u.documents)}`}),n.jsx(si,{label:"Team seats",value:m.teamSeats,hint:`Limit: ${l(u.teamSeats)}`}),n.jsx(si,{label:"Capture time (this month)",value:`${m.recordingMinutesPerMonth} min`,hint:`Limit: ${u.recordingMinutesPerMonth===null?"Unlimited":`${u.recordingMinutesPerMonth} min`}`})]}),n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:`Plan usage — ${p}`,description:"Workflows and seats are totals. Capture minutes reset at the start of each month. Document uploads are unlimited — only workflows generated from a document count."}),n.jsxs("div",{className:"space-y-5",children:[n.jsx(d,{used:m.workflows,total:u.w
87orkflows,label:"Workflows"}),n.jsx(d,{used:m.documents,total:u.documents,label:"Workflows from documents"}),n.jsx(d,{used:m.teamSeats,total:u.teamSeats,label:"Team seats"}),n.jsx(d,{used:m.recordingMinutesPerMonth,total:u.recordingMinutesPerMonth,label:"Capture minutes (month)",unit:" min"})]}),n.jsx("div",{className:"border-t border-warm-border mt-6 pt-5 flex items-center justify-between",children:x?n.jsx("p",{className:"text-sm text-warm-gray",children:"No limits apply to your workspace — nothing to manage here."}):n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-sm text-warm-gray",children:"Need more headroom?"}),n.jsx(at,{variant:"secondary",onClick:()=>e({name:"settings",section:"billing"}),children:"Manage plan"})]})})]})]})}const gT={idea:{label:"Submitted",color:"bg-olive/10 text-olive border-olive/20"},planned:{label:"Planned",color:"bg-indigo-50 text-indigo-700 border-indigo-200"},in_progress:{label:"In progress",color:"bg-amber-50 text-amber-800 border-amber-200"},done:{label:"Completed",color:"bg-emerald-50 text-emerald-700 border-emerald-200"},cancelled:{label:"Declined",color:"bg-cream-dark text-warm-gray border-warm-border"}};function tK(){const[t,e]=j.useState(null),[s,r]=j.useState("feature"),[i,a]=j.useState(""),[l,d]=j.useState(""),[u,m]=j.useState(!1),[p,x]=j.useState(null),[g,b]=j.useState(null),v=async()=>{try{const N=await wt("/api/portal/sop/feedback");if(!N.ok)throw new Error("Failed to load");e(await N.json())}catch{e([])}};j.useEffect(()=>{v()},[]);const k=async()=>{if(i.trim()){m(!0),b(null),x(null);try{const N=await wt("/api/portal/sop/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i.trim(),description:l.trim()||null,type:s})});if(!N.ok){const S=await N.json().catch(()=>({}));throw new Error(S.error||"Could not submit feedback")}a(""),d(""),r("feature"),x("Thanks! Your idea was sent to the Workflow Capture team."),setTimeout(()=>x(null),4e3),v()}catch(N){b(N?.message||"Could not submit feedback")}finally{m(!1)}}};return n.jsxs("div",{className:"space-y-5",children:[n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Share an idea or report a bug",description:"Your feedback goes straight to the product backlog. We'll update the status as it moves through triage, planning, and release."}),p&&n.jsx("div",{className:"bg-emerald-50 border border-emerald-200 text-emerald-800 px-4 py-3 rounded-lg mb-4 text-sm","data-testid":"text-feedback-success",children:p}),g&&n.jsx("div",{className:"bg-red-50 border border-red-200 text-red-800 px-4 py-3 rounded-lg mb-4 text-sm","data-testid":"text-feedback-error",children:g}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(aa,{label:"Type",children:n.jsx(xN,{value:s,onChange:N=>r(N),options:[{value:"feature",label:"Feature request"},{value:"improvement",label:"Improvement"},{value:"bug",label:"Bug report"}],testId:"select-feedback-type"})}),n.jsx(aa,{label:"Title",children:n.jsx(Vc,{value:i,onChange:a,placeholder:"What's your idea or what went wrong?","data-testid":"input-feedback-title"})}),n.jsx(aa,{label:"Details (optional)",children:n.jsx("textarea",{value:l,onChange:N=>d(N.target.value),placeholder:"Share more context — steps, examples, or what you'd like to see.",rows:5,className:"w-full px-3 py-2 rounded-lg border border-warm-border bg-white text-sm text-ink placeholder-warm-gray focus:outline-none focus:border-olive resize-y","data-testid":"input-feedback-description"})}),n.jsx("div",{className:"flex justify-end",children:n.jsx(at,{variant:"primary",onClick:k,disabled:u||!i.trim(),testId:"button-submit-feedback",children:u?"Sending...":"Submit feedback"})})]})]}),n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:`Your submissions${t?` (${t.length})`:""}`,description:"Status updates appear here as our team reviews and ships your requests."}),t===null?n.jsx("div",{className:"text-center py-10 text-sm text-warm-gray",children:"Loading…"}):t.length===0?n.jsx(to,{icon:"💡",title:"No feedback yet",body:"Use the form above to share your first idea, improvement, or bug report."}):n.jsx("div",{className:"space-y-3",children:t.map(N=>{const S=gT[N.status]||gT.idea;return n.jsx("div",{className:"border border-warm-border rounded-lg p-4 bg-white","data-testid":`feedback-item-${N.id}`,children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"text-sm font-semibold text-ink",children:N.title}),N.description&&n.jsx("p",{className:"text-xs text-warm-gray mt-1 whitespace-pre-wrap",children:N.description}),n.jsxs("p",{className:"text-[11px] text-warm-gray mt-2",children:["Submitted ",new Date(N.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]}),n.jsx("span",{className:`text-[11px] font-semibold px-2.5 py-1 rounded-full border ${S.color}`,children:S.label})]})},N.id)})})]})]})}function sK({workflowId:t,reloadKey:e,onRedownload:s,redownloading:r}){const[i,a]=j.useState(null),[l,d]=j.useState(null);return j.useEffect(()=>{let u=!1;return d(null),wt(`/api/portal/sop/${t}/exports`).then(async m=>{if(!m.ok)throw new Error((await m.json().catch(()=>({}))).error||"Failed to load exports");return m.json()}).then(m=>{u||a(m)}).catch(m=>{u||(d(m.message||"Failed to load exports"),a([]))}),()=>{u=!0}},[t,e]),i===null?n.jsx("div",{className:"py-10","aria-hidden":!0}):l?n.jsx("div",{className:"text-center py-10 text-sm text-red-700",children:l}):i.length===0?n.jsx(to,{icon:"↗",title:"No exports yet",body:"Export this workflow to PDF or Markdown from the actions above."}):n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-xs text-warm-gray mb
87-3",children:"Each time you export, a record is kept here. Click an entry to download a fresh copy."}),i.map(u=>{const m=u.format==="markdown"?"markdown":"pdf",p=m==="pdf"?"PDF":"Markdown",x=u.sizeBytes?`${(u.sizeBytes/1024).toFixed(1)} KB`:null,g=r===m;return n.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 rounded-lg border border-warm-border bg-white hover:border-olive/40 transition-colors","data-testid":`export-record-${u.id}`,children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-xs font-bold uppercase tracking-wide px-2 py-0.5 rounded-full bg-olive/10 text-olive border border-olive/20",children:p}),n.jsx("span",{className:"text-sm font-semibold text-ink truncate",children:u.fileName||`${p} export`})]}),n.jsxs("p",{className:"text-xs text-warm-gray mt-1",children:[gu(u.exportedAt),x?` · ${x}`:""]})]}),n.jsx(at,{size:"sm",variant:"secondary",disabled:g,onClick:()=>s(m),children:g?"Downloading...":"Download again"})]},u.id)})]})}const Wf=[{slug:"getting-started",title:"Getting started with Workflow Capture",summary:"What Workflow Capture does and how to record your first workflow in under five minutes.",body:[{text:"Workflow Capture turns the things you already do in your browser into clean, shareable standard operating procedures. You record once, our AI cleans up the steps, and your team gets a living document they can follow."},{heading:"Record your first workflow",bullets:["Click + Create workflow at the top right of the portal.","Pick Capture from browser, install the Chrome extension if prompted, and click Start recording.","Walk through the task naturally. Talk through what you're doing — the audio narration helps the AI understand intent.","Click Stop when you're finished. We process the recording in the background and you'll see it appear under All workflows."]},{heading:"Other ways to create a workflow",bullets:["Upload — drop in an existing PDF, Word doc, or screenshot and we'll structure it.","Describe — tell Betty what the workflow is and she'll draft the steps for you."]}]},{slug:"recording-tips",title:"Tips for great recordings",summary:"Get cleaner, more useful captures by following a few simple habits.",body:[{bullets:[`Narrate as you go. A short spoken note for each step ("Now I'm checking the order total") makes the AI summary much sharper.`,"Slow down on clicks. A small pause helps us catch the right element.","Close personal tabs first. We filter infrastructure URLs automatically, but starting clean keeps the capture focused.","If you make a mistake, just keep going — you can edit any step afterwards from the workflow detail page."]}]},{slug:"review-and-approve",title:"Reviewing and approving workflows",summary:"How review assignments work and what Approved means.",body:[{text:"When a teammate captures a workflow, the workspace owner (or an assigned reviewer) gets a notification asking them to review it. Approval signals that the SOP is ready to be used or shared."},{heading:"Reviewer rules",bullets:["Only the workspace owner or assigned reviewer can approve.","The capturer cannot approve their own workflow unless they're also the owner.","Use Request changes to send a note back to the capturer — they'll get an email."]}]},{slug:"exporting",title:"Exporting your workflows",summary:"Download workflows as PDF or Markdown to share, archive, or paste into other tools.",body:[{text:"Open any workflow and click Export. We support PDF (good for sharing with non-technical teammates) and Markdown (good for engineering docs, Notion, GitHub, etc.)."},{text:"Exports include the full step list, AI summary, and any user notes you've added."}]},{slug:"team-and-roles",title:"Team members and roles",summary:"How to invite teammates and what each role can do.",body:[{text:"Invite teammates from the Team page. Everyone you invite can capture workflows; the owner controls billing and approves workflows by default."},{bullets:["Owner — full access, billing, approves workflows.","Member — captures and edits workflows; can be assigned as a reviewer.","When member review is required (default), the owner reviews each workflow before it's marked approved."]}]},{slug:"billing-and-plans",title:"Billing, plans, and limits",summary:"How plans work, what counts toward each limit, and how upgrades take effect.",body:[{text:"Each plan includes a monthly cap on capture minutes, plus limits on total workflows, team seats, and uploaded documents. You can see your current usage on the Usage page."},{heading:"What happens at the cap",bullets:["Recordings always save — you'll never lose work.","Once you cross your monthly capture-minutes cap, any new workflow above the limit is locked behind an upgrade prompt.","Locked workflows automatically unlock when you upgrade or when the month rolls over."]},{heading:"Upgrading or changing plans",bullets:["Use the Upgrade button on the Usage page or Settings → Billing.","Plan changes go through Stripe Checkout. Use the Customer Portal link in Settings to update your card, download invoices, or cancel."]}]},{slug:"privacy-and-security",title:"Privacy, security, and your data",summary:"Where your data lives and how we protect it.",body:[{text:"Your captures are stored in an isolated environment per workspace. Audio is stored encrypted at rest. We never use your data to train external AI models."}
87,{text:"We automatically filter out steps from infrastructure URLs (the portal itself, Replit, etc.) so they never make it into your captures or AI summaries."},{text:"For our full security overview, DPA, sub-processor list, and privacy policy, see the public site or email [email protected]."}]},{slug:"troubleshooting",title:"Troubleshooting",summary:"Common issues and how to resolve them.",body:[{heading:"The Chrome extension isn't recording",bullets:["Make sure the extension is enabled and pinned to your toolbar.","Reload the page you want to capture, then click Start in the extension.","Some browser-internal pages (chrome://, the extension store) can't be recorded."]},{heading:"My workflow is stuck in Processing",bullets:["Long captures can take a few minutes. Refresh after 2–3 minutes.","If it's still stuck after 10 minutes, send us a note from the Feedback page with the workflow name."]},{heading:"I crossed my limit but want to keep working",bullets:["Recordings still save — they're just locked behind upgrade.","Upgrade from Settings → Billing and any locked workflow becomes accessible immediately."]}]}],nK={"getting-started":"▶","recording-tips":"◉","review-and-approve":"✓",exporting:"↓","team-and-roles":"◍","billing-and-plans":"$","privacy-and-security":"◈",troubleshooting:"?"};function rK({navigate:t,topic:e}){const s=e&&Wf.some(i=>i.slug===e)?e:Wf[0].slug,r=Wf.find(i=>i.slug===s);return n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[220px_1fr] gap-6",children:[n.jsx("aside",{className:"lg:sticky lg:top-6 lg:self-start",children:n.jsx(ot,{className:"p-2",children:n.jsx("nav",{className:"space-y-0.5",children:Wf.map(i=>n.jsxs("button",{onClick:()=>t({name:"help",topic:i.slug}),"data-testid":`help-nav-${i.slug}`,className:`w-full text-left flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors ${s===i.slug?"bg-olive/10 text-olive":"text-warm-gray hover:bg-cream-dark hover:text-ink"}`,children:[n.jsx("span",{className:"w-5 text-center",children:nK[i.slug]||"•"}),i.title]},i.slug))})})}),n.jsxs("div",{className:"min-w-0 space-y-5",children:[n.jsxs(ot,{children:[n.jsx(cs,{title:r.title,description:r.summary}),n.jsx("div",{className:"space-y-5 text-sm leading-relaxed",children:r.body.map((i,a)=>n.jsxs("div",{children:[i.heading&&n.jsx("h3",{className:"font-semibold text-ink mb-2",children:i.heading}),i.text&&n.jsx("p",{className:"text-warm-gray",children:i.text}),i.bullets&&n.jsx("ul",{className:"list-disc pl-5 space-y-1.5 text-warm-gray",children:i.bullets.map((l,d)=>n.jsx("li",{children:l},d))})]},a))})]}),n.jsxs(ot,{children:[n.jsx(cs,{title:"Still need help?",description:"We're a small team and we read every message."}),n.jsxs("div",{className:"text-sm text-warm-gray space-y-2",children:[n.jsxs("p",{children:["Email us at"," ",n.jsx("a",{href:"mailto:[email protected]",className:"text-olive font-semibold hover:underline","data-testid":"link-help-support-email",children:"[email protected]"})," — we usually respond within a business day."]}),n.jsxs("p",{children:["Have a feature request or want to report a bug?"," ",n.jsx("button",{onClick:()=>t({name:"feedback"}),className:"text-olive font-semibold hover:underline","data-testid":"link-help-feedback",children:"Send us feedback"}),"."]})]})]})]})]})}const iK=[{key:"workspace",label:"Workspace",icon:"◈"},{key:"profile",label:"My Profile",icon:"◉"},{key:"team",label:"Team & Roles",icon:"◍"},{key:"billing",label:"Plan & Billing",icon:"$"},{key:"limits",label:"Usage Limits",icon:"◐"},{key:"notifications",label:"Notifications",icon:"◔"},{key:"integrations",label:"Integrations",icon:"↗"}];function aK({session:t,section:e,onSectionChange:s,onSessionRefresh:r,showToast:i,onLogout:a}){return n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[220px_1fr] gap-6",children:[n.jsx("aside",{className:"lg:sticky lg:top-6 lg:self-start",children:n.jsx(ot,{className:"p-2",children:n.jsx("nav",{className:"space-y-0.5",children:iK.map(l=>n.jsxs("button",{onClick:()=>s(l.key),"data-testid":`settings-nav-${l.key}`,className:`w-full text-left flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors ${e===l.key?"bg-olive/10 text-olive":"text-warm-gray hover:bg-cream-dark hover:text-ink"}`,children:[n.jsx("span",{className:"w-5 text-center",children:l.icon}),l.label]},l.key))})})}),n.jsxs("div",{className:"min-w-0",children:[e==="workspace"&&n.jsx(oK,{session:t,onSessionRefresh:r,showToast:i}),e==="profile"&&n.jsx(lK,{session:t,showToast:i,onLogout:a,onSessionRefresh:r}),e==="team"&&n.jsx(cK,{session:t,onSessionRefresh:r,showToast:i}),e==="billing"&&n.jsx(dK,{session:t,showToast:i}),e==="limits"&&n.jsx(hK,{session:t}),e==="notifications"&&n.jsx(mK,{session:t,showToast:i,onSessionRefresh:r}),e==="integrations"&&n.jsx(pK,{showToast:i})]})]})}function YO({onSave:t,saving:e,disabled:s}){return n.jsx("div",{className:"flex items-center justify-end pt-5 mt-5 border-t border-warm-border",children:n.jsx(at,{onClick:t,disabled:e||s,testId:"button-save-settings",children:e?"Saving...":"Save Changes"})})}function oK({session:t,onSessionRefresh:e,showToast:s}){const[r,i]=j.useState(t.companyName),[a,l]=j.useState("America/Ne
87w_York"),[d,u]=j.useState(!1),[m,p]=j.useState(t.requireMemberReview),[x,g]=j.useState(!1),v=t.contacts.find(S=>S.email?.toLowerCase()===t.contactEmail?.toLowerCase())?.isPrimary===1;async function k(){u(!0);try{if(!(await wt("/api/portal/sop/company-profile",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({companyName:r})})).ok)throw new Error("Profile save failed");await e(),s("Workspace saved")}catch(S){s(S?.message||"Save failed")}finally{u(!1)}}async function N(S){if(!v)return;const A=m;p(S),g(!0);try{const E=await wt("/api/portal/sop/workspace-settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireMemberReview:S})});if(!E.ok)throw new Error((await E.json().catch(()=>({}))).error||"Save failed");await e(),s(S?"Member captures will require your review":"Member captures will be auto-approved")}catch(E){p(A),s(E?.message||"Couldn't save")}finally{g(!1)}}return n.jsxs("div",{className:"space-y-4",children:[n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Workspace",description:"Settings that apply to your entire workspace."}),n.jsxs("div",{className:"space-y-4 max-w-xl",children:[n.jsx(aa,{label:"Workspace name",children:n.jsx(Vc,{value:r,onChange:i,testId:"input-workspace-name"})}),n.jsx(aa,{label:"Primary timezone",children:n.jsx(xN,{value:a,onChange:l,options:[{value:"America/New_York",label:"Eastern Time (ET)"},{value:"America/Chicago",label:"Central Time (CT)"},{value:"America/Denver",label:"Mountain Time (MT)"},{value:"America/Los_Angeles",label:"Pacific Time (PT)"},{value:"Europe/London",label:"London (GMT)"},{value:"UTC",label:"UTC"}]})})]}),n.jsx(YO,{onSave:k,saving:d})]}),n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Review workflow",description:"Decide whether captures from teammates need owner approval before they're considered final."}),n.jsxs("div",{className:"max-w-xl",children:[n.jsx(KO,{checked:m,onChange:N,label:"Require member review",description:v?"When ON, captures from non-owner teammates wait for your approval and you'll get an email. When OFF, every capture is auto-approved.":"Only the workspace owner can change this setting."}),!v&&n.jsxs("p",{className:"text-xs text-warm-gray mt-3 italic",children:["Currently ",m?"ON":"OFF","."]}),x&&n.jsx("p",{className:"text-xs text-warm-gray mt-2",children:"Saving…"})]})]})]})}function lK({session:t,showToast:e,onLogout:s,onSessionRefresh:r}){const[i,a]=j.useState(t.contactName),[l]=j.useState(t.contactEmail),[d,u]=j.useState(!1),m=t.myNotificationPrefsV2||Object.fromEntries(a1.map(b=>[b,{email:o1[b],inApp:!0}])),[p,x]=j.useState(m);async function g(b,v,k){const N={...p,[b]:{...p[b],[v]:k}};x(N),u(!0);try{const S=await wt("/api/portal/sop/me/notification-prefs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({prefs:N})});if(!S.ok)throw new Error((await S.json().catch(()=>({}))).error||"Save failed");await r()}catch(S){e(S?.message||"Couldn't save preference"),x(p)}finally{u(!1)}}return n.jsxs("div",{className:"space-y-4",children:[n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"My profile",description:"How your account appears to teammates."}),n.jsxs("div",{className:"space-y-4 max-w-xl",children:[n.jsx("div",{className:"flex items-center gap-4",children:n.jsx("div",{className:"w-16 h-16 rounded-2xl bg-olive/10 text-olive flex items-center justify-center text-2xl font-black",children:i?.[0]?.toUpperCase()||"?"})}),n.jsx(aa,{label:"Full name",children:n.jsx(Vc,{value:i,onChange:a,testId:"input-profile-name"})}),n.jsx(aa,{label:"Email",hint:"Used for sign-in. Contact support to change.",children:n.jsx(Vc,{value:l,onChange:()=>{},disabled:!0})}),n.jsx(aa,{label:"Password",hint:"Workflow Capture uses passwordless sign-in. No password to manage.",children:n.jsx("div",{className:"text-xs text-warm-gray italic",children:"Magic-link authentication is enabled."})})]}),n.jsx(YO,{onSave:()=>e("Profile saved"),saving:!1})]}),n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Notification preferences",description:"Choose how you want to be notified for each event. These override the workspace defaults."}),n.jsxs("div",{className:"max-w-2xl",children:[n.jsxs("div",{className:"grid grid-cols-[1fr_70px_70px] gap-x-4 px-2 pb-2 mb-1 border-b border-warm-border/60 text-xs font-semibold uppercase tracking-wide text-warm-gray",children:[n.jsx("div",{children:"Event"}),n.jsx("div",{className:"text-center",children:"Email"}),n.jsx("div",{className:"text-center",children:"In-app"})]}),a1.map(b=>{const v=pN[b],k=p[b]||{email:!0,inApp:!0};return n.jsxs("div",{className:"grid grid-cols-[1fr_70px_70px] gap-x-4 items-center py-3 px-2 border-b border-warm-border/40 last:border-0",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium text-ink",children:v.label}),n.jsx("div",{className:"text-xs text-warm-gray mt-0.5",children:v.description})]}),n.jsx("div",{className:"flex justify-center",children:n.jsx("input",{type:"checkbox",checked:k.email,onChange:N=>g(b,"email",N.target.checked),"aria-label":`Email for ${v.label}`,className:"h-4 w-4 accent-olive cursor-pointer","data-testid":`pref-${b}-email`})}),n.jsx("div",{className:"flex justify-center",children:n.jsx("input",{type:"checkbox",checked:k.inApp,onChange:N=>g(b,"inApp",N.target.checked),"aria-label":`In-app for ${v.label}`,className:"h-4 w-4 accent-olive cursor-pointer","data-testid":`pref-${b}-inApp`})})]},b)}),d&&n.jsx("p",{className:"text-xs text-warm-gray mt-3",children:"Saving…"})]})]}),n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Active sessions"}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("p",{className:"text-sm text-warm-gray",children:"Sign out of every browser and device."}),n.jsx(at,{variant:"danger",onClick:()=>s(),testId:"button-signout-all",children:"Sign out all sessions"})]})]})]})}function cK({session:t,onSessionRefresh:e,showToast:s}){const[r,i]=j.useState(!1),[a,l]=j.useState(""),[d,u]=j.useState(""),[m,p]=j.useState(""),[x,g]=j.useState(!1),[b,v]=j.useState(null),k=!!t.contacts.find(T=>T.email?.toLowerCase()===t.contactEmail?.toLowerCase())?.isPrimary;async function N(T,$){if(confirm(`Transfer workspace ownership to ${$}? You will become a Member.`)){v(`owner:${T}`);try{const L=await wt(`/api/portal/sop/contacts/${T}/make-owner`,{method:"POST"});if(!L.ok)throw new Error((await L.json().catch(()=>({}))).error||"Failed");s("Ownership transferred"),await e()}catch(L){s(L?.message||"Failed to transfer ownership")}finally{v(null)}}}async function S(T,$){if(confirm(`Remove ${$} from this workspace? They will lose access immediately.`)){v(`remove:${T}`);try{const L=await wt(`/api/portal/sop/contacts/${T}`,{method:"DELETE"});if(!L.ok)throw new Error((await L.json().catch(()=>({}))).error||"Failed");s("Member removed"),await e()}catch(L){s(L?.message||"Failed to remove member")}finally{v(null)}}}const A=t.pendingInvites||[];async function E(T,$){if(confirm(`Cancel the invite for ${$}? Their sign-in link will stop working.`)){v(`revoke:${T}`);try{const L=await wt(`/api/portal/sop/invite/${T}/revoke`,{method:"POST"});if(!L.ok)throw new Error((await L.json().catch(()=>({}))).error||"Failed");s("Invite canceled"),await e()}catch(L){s(L?.message||"Failed to cancel invite")}finally{v(null)}}}async function _(){p("");const T=d.trim();if(!T){p("Email address is required.");return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(T)){p("Enter a valid email address.");return}g(!0);try{const $=await fetch("/api/portal/sop/invite/generate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({name:a.trim(),email:T})});if(!$.ok){let M="Failed to send invite";try{M=(await $.json()).error||M}catch{}throw new Error(M)}const L=await $.json().catch(()=>({}));s(L.sentTo?`Invite emailed to ${L.sentTo}`:"Invite sent"),l(""),u(""),i(!1)}catch($){p($?.message||"Failed to send invite")}finally{g(!1)}}return n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Team & roles",description:"Manage who has access. Mirrors the Team page.",action:n.jsx(at,{onClick:()=>i(!0),testId:"button-settings-invite-teammate",children:"+ Invite teammate"})}),r&&n.jsx("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-center justify-center p-4",onClick:()=>!x&&i(!1),children:n.jsxs("div",{className:"w-full max-w-md bg-white rounded-2xl border border-warm-border p-6",onClick:T=>T.stopPropagation(),children:[n.jsx("h2",{className:"text-lg font-bold text-ink mb-1",children:"Invite a teammate"}
87),n.jsx("p",{className:"text-sm text-warm-gray mb-5",children:"We'll send them a sign-in link by email."}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs font-bold text-ink mb-1.5",children:"Name (optional)"}),n.jsx("input",{value:a,onChange:T=>l(T.target.value),placeholder:"Jane Smith",className:"w-full px-3 py-2 border border-warm-border rounded-lg text-sm focus:outline-none focus:border-olive","data-testid":"input-settings-invite-name"})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-xs font-bold text-ink mb-1.5",children:["Work email ",n.jsx("span",{className:"text-red-600",children:"*"})]}),n.jsx("input",{value:d,onChange:T=>{u(T.target.value),m&&p("")},type:"email",placeholder:"[email protected]",className:"w-full px-3 py-2 border border-warm-border rounded-lg text-sm focus:outline-none focus:border-olive","data-testid":"input-settings-invite-email"}),m&&n.jsx("p",{role:"alert",className:"text-xs text-red-700 mt-1.5","data-testid":"text-settings-invite-error",children:m})]})]}),n.jsxs("div",{className:"flex items-center justify-end gap-2 mt-6",children:[n.jsx(at,{variant:"secondary",onClick:()=>i(!1),disabled:x,children:"Cancel"}),n.jsx(at,{onClick:_,disabled:x,testId:"button-settings-send-invite",children:x?"Sending...":"Send invite"})]})]})}),n.jsx("div",{className:"overflow-x-auto -mx-6 px-6",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"text-left text-[11px] font-bold text-warm-gray uppercase tracking-wider border-b border-warm-border",children:[n.jsx("th",{className:"py-3 pr-4",children:"Member"}),n.jsx("th",{className:"py-3 pr-4",children:"Role"}),n.jsx("th",{className:"py-3 pr-4",children:"Status"}),n.jsx("th",{className:"py-3 pr-4 text-right",children:"Action"})]})}),n.jsxs("tbody",{className:"divide-y divide-warm-border/60",children:[t.contacts.map(T=>{const $=T.email?.toLowerCase()===t.contactEmail?.toLowerCase();return n.jsxs("tr",{children:[n.jsxs("td",{className:"py-4 pr-4",children:[n.jsxs("div",{className:"font-semibold text-ink",children:[T.name,$&&n.jsx("span",{className:"ml-2 text-[10px] uppercase tracking-wide text-warm-gray",children:"You"})]}),n.jsx("div",{className:"text-xs text-warm-gray",children:T.email})]}),n.jsx("td",{className:"py-4 pr-4 text-xs font-semibold text-ink",children:T.isPrimary?"Owner":"Member"}),n.jsx("td",{className:"py-4 pr-4 text-xs font-semibold text-emerald-700",children:"Active"}),n.jsx("td",{className:"py-4 pr-4 text-right",children:!k||$||T.isPrimary?n.jsx("span",{className:"text-xs text-warm-gray",children:"—"}):n.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n.jsx("button",{onClick:()=>N(T.id,T.name),disabled:b!==null,className:"text-xs font-semibold text-olive hover:underline disabled:opacity-50","data-testid":`button-settings-make-owner-${T.id}`,children:b===`owner:${T.id}`?"...":"Make owner"}),n.jsx("button",{onClick:()=>S(T.id,T.name),disabled:b!==null,className:"text-xs font-semibold text-red-700 hover:underline disabled:opacity-50","data-testid":`button-settings-remove-member-${T.id}`,children:b===`remove:${T.id}`?"...":"Remove"})]})})]},T.id)}),A.map(T=>{const $=T.name||T.email||"this teammate";return n.jsxs("tr",{className:"bg-amber-50/40",children:[n.jsxs("td",{className:"py-4 pr-4",children:[n.jsx("div",{className:"font-semibold text-ink",children:T.name||T.email||"Invited teammate"}),n.jsxs("div",{className:"text-xs text-warm-gray",children:[T.email||"—"," · invited ",new Date(T.createdAt).toLocaleDateString()]})]}),n.jsx("td",{className:"py-4 pr-4 text-xs font-semibold text-ink",children:"Member"}),n.jsx("td",{className:"py-4 pr-4 text-xs font-semibold text-amber-700",children:"Invited · waiting"}),n.jsx("td",{className:"py-4 pr-4 text-right",children:k?n.jsx("button",{onClick:()=>E(T.id,$),disabled:b!==null,className:"text-xs font-semibold text-red-700 hover:underline disabled:opacity-50","data-testid":`button-settings-revoke-invite-${T.id}`,children:b===`revoke:${T.id}`?"...":"Cancel invite"}):n.jsx("span",{className:"text-xs text-warm-gray",children:"—"})})]},T.id)})]})]})})]})}function dK({session:t,showToast:e}){const[s,r]=j.useState(null),[i,a]=j.useState(!1);j.useEffect(()=>{(async()=>{try{const[x,g]=await Promise.all([fetch("/api/billing/status").then(b=>b.json()).catch(()=>({enabled:!1})),wt("/api/portal/billing/usage").then(b=>
87b.ok?b.json():null).catch(()=>null)]);a(!!x?.enabled),g&&r(g)}catch{}})()},[]);const l=s?.planLabel||GO(t.plan),d=s?.usage?.teamSeats??t.contacts.length,u=s?.limits?.teamSeats,m=u===null?"∞":u===void 0?"—":String(u),p=u===null?"Unlimited":u===void 0?"Loading…":"Included";return n.jsx("div",{className:"space-y-4",children:n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Plan & billing",description:"Your current plan and seats."}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-5",children:[n.jsxs("div",{className:"p-4 rounded-xl border border-warm-border bg-cream/40",children:[n.jsx("div",{className:"text-xs font-semibold text-warm-gray uppercase tracking-wider",children:"Current plan"}),n.jsx("div",{className:"text-lg font-bold text-ink mt-1",children:l})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-warm-border bg-cream/40",children:[n.jsx("div",{className:"text-xs font-semibold text-warm-gray uppercase tracking-wider",children:"Seats"}),n.jsxs("div",{className:"text-lg font-bold text-ink mt-1",children:[d," / ",m]}),n.jsx("div",{className:"text-xs text-warm-gray mt-1",children:p})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-warm-border bg-cream/40",children:[n.jsx("div",{className:"text-xs font-semibold text-warm-gray uppercase tracking-wider",children:"Billing email"}),n.jsx("div",{className:"text-sm font-bold text-ink mt-1 truncate",children:t.contactEmail})]})]}),n.jsx(uK,{usage:s,billingEnabled:i,showToast:e})]})})}function uK({usage:t,billingEnabled:e,showToast:s}){const[r,i]=j.useState(!1),[a,l]=j.useState(!1),[d,u]=j.useState(!1),[m,p]=j.useState("");j.useEffect(()=>{if(typeof window<"u"){const k=window.location.hash,N=window.location.search,S=k.includes("?")?k.slice(k.indexOf("?")):"",A=N+S,E=k.includes("?")?k.slice(0,k.indexOf("?")):k;if(A.includes("upgraded=1")){s("Upgrade successful — your plan is active.");try{window.history.replaceState({},"",window.location.pathname+E)}catch{}}else if(A.includes("cancelled=1")){s("Upgrade cancelled — no charge was made.");try{window.history.replaceState({},"",window.location.pathname+E)}catch{}}}},[s]);const x=async()=>{i(!0);try{const k=await wt("/api/portal/billing/customer-portal",{method:"POST"}),N=await k.json();if(!k.ok){s(N?.error||"Couldn't open billing portal");return}N?.url&&(window.location.href=N.url)}catch{s("Network error")}finally{i(!1)}},g=async()=>{l(!0);try{const k=await wt("/api/portal/billing/notify-owner",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"manual_request_from_billing_page",note:m})}),N=await k.json();if(!k.ok){s(N?.error||"Couldn't notify the owner");return}u(!0),s(`Sent to ${N?.ownerEmail||"the workspace owner"}`)}catch{s("Network error")}finally{l(!1)}};if((t?.plan||"").toLowerCase()==="unlimited")return n.jsx("div",{className:"mt-5 pt-5 border-t border-warm-border",children:n.jsxs("div",{className:"bg-olive/10 border border-olive/30 rounded-xl p-4 max-w-2xl","data-testid":"note-unlimited-plan",children:[n.jsx("p",{className:"text-sm font-semibold text-ink mb-1",children:"✦ You're on the Unlimited plan"}),n.jsxs("p",{className:"text-xs text-warm-gray",children:["Your workspace has no usage limits and nothing to pay — no subscription or billing needed. Questions? Email"," ",n.jsx("a",{href:"mailto:[email protected]",className:"font-semibold text-olive hover:text-olive-dark underline",children:"[email protected]"}),"."]})]})});if(!e)return n.jsxs("div",{className:"mt-5 pt-5 border-t border-warm-border text-sm text-warm-gray",children:["Billing is not yet configured. To change plans, email"," ",n.jsx("a",{href:"mailto:[email protected]",className:"font-semibold text-olive hover:text-olive-dark underline",children:"[email protected]"}),"."]});const b=t?.currentPeriodEnd?new Date(t.currentPeriodEnd).toLocaleDateString():"—",v=t?.callerIsOwner!==!1;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 max-w-2xl",children:[n.jsxs("div",{className:"p-4 rounded-xl border border-warm-border",children:[n.jsx("div",{className:"text-xs font-semibold text-warm-gray uppercase tracking-wider",children:"Subscription status"}),n.jsx("div",{className:"text-sm text-ink mt-1 capitalize",children:t?.stripeStatus||"Not subscribed"})]}),n.jsxs("div",{className:"p-4 rounded-xl border border-warm-border",children:[n.jsx("div",{className:"text-xs font-semibold text-warm-gray uppercase tracking-wider",children:"Renews"}),n.jsx("div",{className:"text-sm text-ink mt-1",children:b})]})]}),v?n.jsxs("div",{className:"flex flex-wrap gap-2 mt-5 pt-5 border-t border-warm-border",children:[n.jsx(at,{onClick:()=>kb({reason:"manual_upgrade"}),testId:"button-upgrade-plan",children:t?.hasSubscription?"Change plan":"Upgrade plan"}),t?.hasSubscription&&n.jsx(at,{variant:"secondary",onClick:x,disabled:r,testId:"button-manage-subscription",children:r?"Opening…":"Manage subscription & invoices"})]}):n.jsx("div",{className:"mt-5 pt-5 border-t border-warm-border",children:n.jsxs("div",{className:"bg-cream/40 border border-warm-border rounded-xl p-4 max-w-2xl",children:[n.jsx("p",{className:"text-sm text-ink font-semibold mb-1",children:"Only the workspace owner can manage billing"}
87),n.jsx("p",{className:"text-xs text-warm-gray mb-3",children:t?.ownerName||t?.ownerEmail?n.jsxs(n.Fragment,{children:["Reach out to ",n.jsx("span",{className:"font-semibold text-ink",children:t?.ownerName||t?.ownerEmail})," to change plan, payment, or invoices — or send them a quick request below."]}):n.jsx(n.Fragment,{children:"Reach out to your workspace owner to change plan, payment, or invoices — or send them a quick request below."})}),n.jsx("textarea",{value:m,onChange:k=>p(k.target.value),placeholder:"Add an optional note (e.g. 'We need more recording minutes for the new hire')…",maxLength:1e3,rows:2,disabled:d,"data-testid":"textarea-upgrade-note",className:"w-full text-sm border border-warm-border rounded-lg px-3 py-2 bg-white focus:outline-none focus:ring-2 focus:ring-olive/30 mb-3 resize-none disabled:bg-cream/60"}),n.jsx(at,{onClick:g,disabled:a||d,testId:"button-notify-owner",children:d?"Request sent ✓":a?"Sending…":"Notify owner to upgrade"})]})})]})}function hK({session:t}){const[e,s]=j.useState(null);j.useEffect(()=>{wt("/api/portal/billing/usage").then(a=>a.ok?a.json():null).then(a=>a&&s(a)).catch(()=>{})},[]);const r=[{label:Nc.workflows,key:"workflows"},{label:Nc.documents,key:"documents"},{label:Nc.teamSeats,key:"teamSeats"},{label:Nc.recordingMinutesPerMonth,key:"recordingMinutesPerMonth"}],i=!e;return n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Usage limits",description:`Monitored against your ${e?.planLabel||"current"} plan.`}),i?n.jsx("div",{className:"text-sm text-warm-gray py-4",children:"Loading usage…"}):n.jsx("div",{className:"space-y-5 max-w-xl",children:r.map(a=>{const l=e?.usage[a.key]??0,d=e?.limits[a.key];if(d==null)return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between text-sm mb-1.5",children:[n.jsx("span",{className:"font-semibold text-ink",children:a.label}),n.jsxs("span",{className:"text-xs font-semibold text-warm-gray",children:[l," / Unlimited"]})]}),n.jsx("div",{className:"w-full h-2 bg-cream-dark rounded-full overflow-hidden",children:n.jsx("div",{className:"h-full bg-olive/40",style:{width:"8%"}})})]},a.key);const u=Math.min(100,Math.round(l/Math.max(d,1)*100)),m=l>d,p=l>=d,x=u>=80&&!p,g=m?"Over plan limit":p?"Plan limit reached":x?"Approaching plan limit":null,b=m||p?"text-red-700":x?"text-amber-700":"text-warm-gray",v=m||p?"bg-red-500":x?"bg-amber-500":"bg-olive";return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between text-sm mb-1.5",children:[n.jsx("span",{className:"font-semibold text-ink",children:a.label}),n.jsxs("span",{className:`text-xs font-semibold ${b}`,children:[l," / ",d]})]}),n.jsx("div",{className:"w-full h-2 bg-cream-dark rounded-full overflow-hidden",children:n.jsx("div",{className:`h-full ${v}`,style:{width:`${u}%`}})}),g&&n.jsx("p",{className:`text-xs mt-1.5 font-medium ${m||p?"text-red-700":"text-amber-700"}`,children:g})]},a.key)})}),n.jsx("div",{className:"mt-6 pt-5 border-t border-warm-border",children:e?.callerIsOwner===!1?n.jsxs("p",{className:"text-sm text-warm-gray",children:["Want more? Only the workspace owner (",e?.ownerName||e?.ownerEmail||"your owner",") can change the plan. Visit ",n.jsx("span",{className:"font-semibold text-ink",children:"Settings → Plan & Billing"})," to send them an upgrade request."]}):n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-sm text-warm-gray mb-3",children:"Want more? Upgrade your plan to raise these limits."}),n.jsx(at,{variant:"secondary",onClick:()=>kb({reason:"limits_page_upgrade"}),testId:"button-upgrade-from-limits",children:"Upgrade plan"})]})})]})}function mK({session:t,showToast:e,onSessionRefresh:s}){const i=t.contacts.find(x=>x.email?.toLowerCase()===t.contactEmail?.toLowerCase())?.isPrimary===1,a=t.notificationDefaults||o1,[l,d]=j.useState(a),[u,m]=j.useState(!1);j.useEffect(()=>{wt("/api/portal/sop/notification-defaults").then(x=>x.ok?x.json():null).then(x=>{x?.defaults&&d({...o1,...x.defaults})}).catch(()=>{})},[]);async function p(x,g){if(!i)return;const b={...l,[x]:g};d(b),m(!0);try{const v=await wt("/api/portal/sop/notification-defaults",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaults:b})});if(!v.ok)throw new Error((await v.json().catch(()=>({}))).error||"Save failed");await s(),e("Workspace defaults updated")}catch(v){e(v?.message||"Couldn't save"),d(l)}finally{m(!1)}}return n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Notifications",description:i?"Workspace-wide email defaults. Members can override on their profile.":"Workspace-wide email defaults set by the workspace owner. Override these for yourself in My Profile → Notification preferences."}),n.jsxs("div",{className:"divide-y divide-warm-border/60 max-w-xl",children:[a1.map(x=>{const g=pN[x];return n.jsx(KO,{checked:l[x]!==!1,onChange:b=>p(x,b),label:g.label,description:g.description,disabled:!i,testId:`workspace-default-${x}`},x)}),u&&n.jsx("p",{className:"text-xs text-warm-gray mt-3",children:"Saving…"}),!i&&n.jsx("p",{className:"text-xs text-warm-gray italic mt-3",children:"Only the workspace owner can change defaults."})]})]})}function pK({showToast:t}){const e=[{key:"google_docs",name:"Google Docs",desc:"Export SOPs and training guides as Google Docs.",connected:!1},{key:"confluence",name:"Confluence",desc:"Push approved outputs to a Confluence space.",connected:!1},{key:"notion",name:"Notion",desc:"Sync workflows to a Notion database.",connected:!1}
87,{key:"pdf_export",name:"PDF export",desc:"Generate PDFs of any approved output.",connected:!1},{key:"workflow_as_runtime",name:"Workflow AS / runtime",desc:"Hand off approved AI scripts for execution.",connected:!1},{key:"webhooks_zapier",name:"Webhooks / Zapier",desc:"Trigger external systems on workflow events.",connected:!1}],[s,r]=j.useState({}),[i,a]=j.useState({});j.useEffect(()=>{wt("/api/portal/integrations/requests").then(d=>d.ok?d.json():{requests:[]}).then(d=>{const u={};for(const m of d.requests||[])u[m.integrationKey]=!0;r(u)}).catch(()=>{})},[]);async function l(d,u){if(!(s[d]||i[d])){a(m=>({...m,[d]:!0}));try{const m=await wt("/api/portal/integrations/request-access",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({integrationKey:d,integrationLabel:u})});if(!m.ok)throw new Error("Request failed");const p=await m.json();r(x=>({...x,[d]:!0})),t(p.alreadyRequested?`You're already on the early-access list for ${u}.`:`Cheers! We've added you to the early-access list for ${u}. We'll be in touch when it's ready.`)}catch(m){t(m?.message||"Couldn't record your request. Please try again.")}finally{a(m=>({...m,[d]:!1}))}}}return n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Integrations",description:"Connect Workflow Capture to where your team already works."}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:e.map(d=>{const u=!!s[d.key],m=!!i[d.key];return n.jsxs("div",{className:"p-4 rounded-xl border border-warm-border",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-bold text-ink",children:d.name}),n.jsx("p",{className:"text-xs text-warm-gray mt-0.5 leading-snug",children:d.desc})]}),d.connected&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full bg-emerald-50 text-emerald-700 text-[11px] font-semibold border border-emerald-200",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500"})," Connected"]})]}),d.connected?n.jsx(at,{size:"sm",variant:"ghost",onClick:()=>t("Disconnect this integration from the connected service to remove it."),children:"Disconnect"}):n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full bg-amber-50 text-amber-800 text-[11px] font-semibold border border-amber-200",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500"})," Coming soon"]}),u?n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full bg-emerald-50 text-emerald-700 text-[11px] font-semibold border border-emerald-200","data-testid":`badge-requested-${d.key}`,children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500"})," You're on the list"]}):n.jsx("button",{type:"button",disabled:m,onClick:()=>l(d.key,d.name),className:"text-xs font-semibold text-olive-dark hover:underline disabled:opacity-60 disabled:no-underline","data-testid":`button-request-${d.key}`,children:m?"Sending…":"Request early access →"})]})]},d.key)})})]})}async function nu(t,e){let s={};try{const a=await t.json();a&&typeof a=="object"&&(s=a)}catch{}const r=s.error||e,i=s.errorCategory;if(!i)return r;switch(i){case"auth":case"model":return`${r} (Our team has been notified.)`;case"rate_limit":return`${r} Give it ~30 seconds and try again.`;
87case"network":case"server":return`${r} If it keeps happening, please let us know.`;case"bad_request":return r;default:return r}}function bT({session:t,onSessionRefresh:e,onNavigateCapture:s,onNavigateWorkflows:r,onNavigateWorkflow:i,showToast:a}){const l=(t.contactName||"there").split(" ")[0],d="Tell me about a process you want to document, ask a workflow question, or describe a task from memory. I can turn it into a structured workflow, SOP draft, training guide, or AI-agent script.",u=[{label:"Describe a process",key:"describe"},{label:"Upload a document",key:"upload"},{label:"Capture from browser",key:"capture"}],[m,p]=j.useState([]),[x,g]=j.useState(""),[b,v]=j.useState([]),[k,N]=j.useState(!1),[S,A]=j.useState(!1),[E,_]=j.useState(null),T=j.useRef(null),$=j.useRef(null);j.useEffect(()=>{$.current?.scrollTo({top:$.current.scrollHeight,behavior:"smooth"})},[m,k]);async function L(U){if(!U.trim()||k)return;const Y=[...b,{role:"user",content:U}];p(P=>[...P,{role:"user",content:U}]),v(Y),g(""),N(!0);try{const P=await wt("/api/portal/sop/chat-describe-followup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation:Y})});if(!P.ok)throw new Error(await nu(P,"Betty had trouble responding."));const ne=await P.json(),q={role:"assistant",content:ne.reply||"Tell me more about this process.",actions:ne.readyToCreate?[{label:"Create the workflow",key:"create"},{label:"Add more details",key:"noop"}]:void 0};p(W=>[...W,q]),v(W=>[...W,{role:"assistant",content:q.content}]),A(!!ne.readyToCreate)}catch(P){p(ne=>[...ne,{role:"assistant",content:P?.message||"Something went wrong. Try again?"}])}finally{N(!1)}}async function M(){if(!(k||b.length===0)){N(!0),p(U=>[...U,{role:"assistant",content:"Creating your workflow now..."}]);try{const U=await wt("/api/portal/sop/chat-describe-create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation:b})});if(!U.ok)throw new Error(await nu(U,"Couldn't create workflow."));const Y=await U.json();await e(),p(P=>[...P,{role:"assistant",content:`Done — I created **${Y.title||"your workflow"}**. Open it to review the steps.`,actions:[{label:"Open workflow",key:`open_${Y.id||""}`},{label:"View all workflows",key:"nav_workflows"}]}]),v([]),A(!1),a("Workflow created")}catch(U){p(Y=>[...Y,{role:"assistant",content:U?.message||"Couldn't create the workflow. Try again?"}])}finally{N(!1)}}}async function I(U){N(!0),p(Y=>[...Y,{role:"user",content:`Uploaded ${U.name}`},{role:"assistant",content:"Reading your document..."}]);try{const Y=new FormData;Y.append("file",U);const P=await wt("/api/portal/sop/chat-upload",{method:"POST",body:Y});if(!P.ok)throw new Error(await nu(P,"Couldn't read that file."));const ne=await P.json();ne.fileId&&ne.analysis&&_({fileId:ne.fileId,analysis:ne.analysis});const q=ne?.analysis?.summary||"I've read your document.",W=(ne?.analysis?.clarifyingQuestions||[]).slice(0,2).join(" ");p(ie=>[...ie,{role:"assistant",content:`${q}
88
89${W||"Would you like me to turn this into a workflow?"}`,actions:[{label:"Turn into a workflow",key:"create_from_doc"},{label:"Upload another",key:"upload"}]}])}catch(Y){p(P=>[...P,{role:"assistant",content:Y?.message||"Couldn't read that file. Try a PDF or DOCX."}])}finally{N(!1)}}async function z(){if(!(k||!E)){N(!0),p(U=>[...U,{role:"assistant",content:"Creating your workflow from the document..."}]);try{const U=E.analysis,Y=await wt("/api/portal/sop/chat-create-script",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:U.suggestedScriptTitle||"Uploaded workflow",description:U.suggestedScriptDescription||U.summary||"",fileId:E.fileId,processSteps:U.processSteps||[],analysisData:U})});if(!Y.ok)throw new Error(await nu(Y,"Couldn't create workflow."));const P=await Y.json();await e(),p(ne=>[...ne,{role:"assistant",content:`Done — I created **${P.title||"your workflow"}** from your document. Open it to review the steps.`,actions:[{label:"Open workflow",key:`open_${P.id||""}`},{label:"View all workflows",key:"nav_workflows"}]}]),_(null),a("Workflow created")}catch(U){p(Y=>[...Y,{role:"assistant",content:U?.message||"Couldn't create the workflow. Try again?"}])}finally{N(!1)}}}function ae(U){if(U==="describe"){p(Y=>[...Y,{role:"assistant",content:"Great — describe the process in your own words. Mention what triggers it, the key steps, and where it usually goe
89s wrong."}]);return}if(U==="upload")return T.current?.click();if(U==="capture")return s();if(U==="create")return M();if(U==="create_from_doc")return z();if(U==="nav_workflows")return r();if(U.startsWith("open_")&&U.length>5)return i(U.slice(5))}return n.jsxs("div",{className:"px-7 sm:px-9 pb-7 pt-5",children:[n.jsx("input",{ref:T,type:"file",accept:".pdf,.doc,.docx,.png,.jpg,.jpeg,.md,.txt,.csv,.json,.xml,.yaml,.yml,.rtf",className:"hidden",onChange:U=>{const Y=U.target.files?.[0];Y&&I(Y),U.target.value=""}}),n.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[n.jsx("div",{className:"w-9 h-9 rounded-full bg-gradient-to-br from-olive to-olive-dark text-white flex items-center justify-center font-black text-sm flex-shrink-0",children:"B"}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("p",{className:"text-sm font-bold text-ink leading-tight",children:"Betty"}),n.jsx("p",{className:"text-[11px] text-warm-gray leading-tight mt-0.5",children:"Your Workflow Capture assistant · online"})]}),n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] font-semibold text-emerald-700",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500"}),"Ask or generate"]})]}),m.length===0&&n.jsx("p",{className:"text-sm text-warm-gray leading-relaxed mb-4 bg-cream/60 border border-warm-border rounded-xl px-4 py-3",children:d}),m.length>0&&n.jsxs("div",{ref:$,className:"mb-4 max-h-[320px] overflow-y-auto space-y-3 pr-1",children:[m.map((U,Y)=>n.jsxs("div",{className:`flex gap-2.5 ${U.role==="user"?"flex-row-reverse":""}`,children:[n.jsx("div",{className:`flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold ${U.role==="user"?"bg-slate-700 text-white":"bg-olive/15 text-olive"}`,children:U.role==="user"?(l?.[0]||"?").toUpperCase():"B"}),n.jsxs("div",{className:`max-w-[80%] rounded-2xl px-3.5 py-2 text-sm leading-relaxed ${U.role==="user"?"bg-slate-700 text-white":"bg-cream border border-warm-border text-ink"}`,children:[n.jsx("div",{className:"whitespace-pre-wrap",dangerouslySetInnerHTML:{__html:QO(U.content)}}),U.actions&&U.actions.length>0&&n.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2.5",children:U.actions.map(P=>n.jsx("button",{onClick:()=>ae(P.key),className:"text-[11px] font-semibold px-2.5 py-1 rounded-full bg-white text-olive border border-olive/30 hover:bg-olive/10 transition-colors",children:P.label},P.key))})]})]},Y)),k&&n.jsxs("div",{className:"flex gap-2.5",children:[n.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-olive/15 text-olive flex items-center justify-center text-[10px] font-bold",children:"B"}),n.jsxs("div",{className:"bg-cream border border-warm-border rounded-2xl px-3.5 py-2.5 inline-flex gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-olive/60 animate-bounce"}),n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-olive/60 animate-bounce",style:{animationDelay:"150ms"}}),n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-olive/60 animate-bounce",style:{animationDelay:"300ms"}})]})]})]}),n.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:u.map(U=>n.jsx("button",{onClick:()=>ae(U.key),disabled:k,"data-testid":`betty-chip-${U.key}`,className:"text-xs font-semibold px-3 py-1.5 rounded-full bg-white text-ink border border-warm-border hover:border-olive/50 hover:bg-olive/5 transition-colors disabled:opacity-50",children:U.label},U.key))}),n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsx("button",{onClick:()=>T.current?.click(),disabled:k,className:"flex-shrink-0 w-9 h-9 border border-warm-border rounded-xl text-warm-gray hover:text-olive hover:border-olive/40 transition-colors disabled:opacity-40 flex items-center justify-center",title:"Upload a document","data-testid":"betty-attach-inline",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})})}),n.jsx("textarea",{value:x,onChange:U=>g(U.target.value),onKeyDown:U=>{U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),L(x))},rows:1,disabled:k,placeholder:"Ask Betty, or describe a workflow your team performs...","data-testid":"betty-input-inline","data-betty-input":!0,className:"flex-1 text-sm border border-warm-border rounded-xl px-3.5 py-2.5 bg-white text-ink placeholder:text-warm-gray/60 focus:outline-none focus:ring-2 focus:ring-olive/30 focus:border-olive resize-none max-h-[120px]"}),n.jsx(at,{onClick:()=>L(x),disabled:k||!x.trim(),size:"md",testId:"betty-send-inline",children:"Send"})]}),S&&n.jsxs("div",{className:"mt-3 flex items-center justify-between bg-olive/5 border border-olive/20 rounded-xl px-4 py-2.5",children:[n.jsx("p",{className:"text-xs text-ink",children:"Looks like we have enough to draft this workflow."}),n.jsx(at,{size:"sm",onClick:M,disabled:k,testId:"betty-create-inline",children:"Create workflow"})]})]})}function fK({session:t,workflowId:e,onSessionRefresh:s,onNavigateWorkflow:r,onNavigateWorkflows:i,showToast:a}){const l=t.submissions.find(M=>M.id===e),d=(t.contactName||"there").split(" ")[0],u=l?Array.isArray(l.workflowSteps)?l.workflowSteps:[]:[],m={role:"assistant",content:l?`Hi ${d} — I have your **${l.title}** workflow loaded (${u.length} steps). Tell me what you'd like to change: add or remove steps, update descriptions, reorganize the flow, or refine any details. When you're happy with the changes, I'll save everything.`:"I couldn't find that workflow. It may have been deleted.",actions:l?[{label:"Add more steps",key:"edit_add_steps"},{label:"Refine descriptions",key:"edit_refine"},{label:"Back to workflow",key:`back_${e}`}]:[{label:"Back to workflows",key:"nav_workflows"}]},[p,x]=j.useState([m]),[g,b]=j.useState(""),[v,k]=j.useState([]),[N,S]=j.useState(!1),[A,E]=j.useState(!1),_=j.useRef(null);j.useEffect(()=>{_.current?.scrollTo({top:_.current.scrollHeight,behavior:"smooth"})},[p,N]);
89async function T(M){if(!M.trim()||N||!l)return;const I={role:"user",content:M},z=[...v,{role:"user",content:M}];x(ae=>[...ae,I]),k(z),b(""),S(!0);try{const ae=await wt("/api/portal/sop/chat-describe-followup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation:z,workflowId:l.id})});if(!ae.ok)throw new Error(await nu(ae,"Betty had trouble responding."));const U=await ae.json(),Y={role:"assistant",content:U.reply||"Tell me more about what you'd like to change.",actions:U.readyToCreate?[{label:"Save changes",key:"save"},{label:"Keep editing",key:"noop"}]:void 0};x(P=>[...P,Y]),k(P=>[...P,{role:"assistant",content:Y.content}]),E(!!U.readyToCreate)}catch(ae){x(U=>[...U,{role:"assistant",content:ae?.message||"Something went wrong. Try again?"}])}finally{S(!1)}}async function $(){if(!(N||!l||v.length===0)){S(!0),x(M=>[...M,{role:"assistant",content:"Saving your changes..."}]);try{const M=await wt(`/api/portal/sop/${l.id}/edit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation:v})});if(!M.ok)throw new Error(await nu(M,"Couldn't save changes."));const I=await M.json();await s(),x(z=>[...z,{role:"assistant",content:`Done — I've updated **${I.title||l.title}** with ${I.stepCount} steps. Open the workflow to review your changes.`,actions:[{label:"Open workflow",key:`back_${l.id}`},{label:"Keep editing",key:"noop"}]}]),k([]),E(!1),a("Workflow updated")}catch(M){x(I=>[...I,{role:"assistant",content:M?.message||"Couldn't save changes. Try again?"}])}finally{S(!1)}}}function L(M){if(M==="save")return $();if(M.startsWith("back_")&&M.length>5)return r(M.slice(5));if(M==="nav_workflows")return i();if(M==="edit_add_steps")return T("I'd like to add more steps to this workflow. What's missing? Help me think through what other steps belong here.");if(M==="edit_refine")return T("Help me refine the descriptions for these steps so they're clearer and more useful for someone following the SOP.")}return n.jsxs(ot,{className:"overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-3 px-6 py-4 border-b border-warm-border bg-gradient-to-r from-cream via-white to-olive/[0.04]",children:[n.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-olive to-olive-dark text-white flex items-center justify-center font-black text-sm flex-shrink-0",children:"B"}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("p",{className:"text-sm font-bold text-ink leading-none",children:"Betty"}),n.jsx("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-blue-700 bg-blue-50 px-1.5 py-0.5 rounded-full border border-blue-200",children:"Edit mode"})]}),n.jsx("p",{className:"text-xs text-warm-gray mt-0.5",children:l?`Editing: ${l.title}`:"Workflow not found"})]})]}),n.jsxs("div",{ref:_,className:"px-6 py-5 space-y-4 max-h-[500px] min-h-[300px] overflow-y-auto bg-cream/30",children:[p.map((M,I)=>n.jsxs("div",{className:`flex gap-3 ${M.role==="user"?"flex-row-reverse":""}`,children:[n.jsx("div",{className:`flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold ${M.role==="user"?"bg-slate-700 text-white":"bg-olive/15 text-olive"}`,children:M.role==="user"?(d?.[0]||"?").toUpperCase():"B"}),n.jsxs("div",{className:`max-w-[80%] rounded-2xl px-4 py-2.5 text-sm leading-relaxed ${M.role==="user"?"bg-slate-700 text-white":"bg-white border border-warm-border text-ink"}`,children:[n.jsx("div",{className:"whitespace-pre-wrap",dangerouslySetInnerHTML:{__html:QO(M.content)}}),M.actions&&M.actions.length>0&&n.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:M.actions.map(z=>n.jsx("button",{onClick:()=>L(z.key),className:"text-xs font-semibold px-2.5 py-1 rounded-full bg-olive/10 text-olive border border-olive/20 hover:bg-olive/20 transition-colors",children:z.label},z.key))})]})]},I)),N&&n.jsxs("div",{className:"flex gap-3",children:[n.jsx("div",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-olive/15 text-olive flex items-center justify-center text-[11px] font-bold",children:"B"}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-2xl px-4 py-3 inline-flex gap-1",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-olive/60 animate-bounce",style:{animationDelay:"0ms"}}),n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-olive/60 animate-bounce",style:{animationDelay:"150ms"}}),n.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-olive/60 animate-bounce",style:{animationDelay:"300ms"}})]})]})]}),n.jsxs("div",{className:"px-6 py-3 border-t border-warm-border bg-white flex items-end gap-2",children:[n.jsx("textarea",{value:g,onChange:M=>b(M.target.value),onKeyDown:M=>
89{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),T(g))},rows:1,disabled:N||!l,placeholder:"Describe what you'd like to change...",className:"flex-1 text-sm border border-warm-border rounded-lg px-3 py-2 bg-white text-ink placeholder:text-warm-gray/60 focus:outline-none focus:ring-2 focus:ring-olive/30 focus:border-olive resize-none max-h-[120px]"}),n.jsx(at,{onClick:()=>T(g),disabled:N||!g.trim()||!l,children:"Send"})]}),v.length>0&&n.jsxs("div",{className:`px-6 py-3 border-t border-warm-border flex items-center justify-between ${A?"bg-olive/5":"bg-white"}`,children:[n.jsx("p",{className:"text-xs text-ink",children:A?"Ready to save your changes?":"Save anytime once you're happy with the changes."}),n.jsx(at,{size:"sm",onClick:$,disabled:N,children:"Save changes"})]})]})}function QO(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>")}function JO({email:t,emailVerified:e}){const[s,r]=j.useState(!1),[i,a]=j.useState(null),[l,d]=j.useState(null);if(e)return null;const u=async()=>{r(!0),a(null),d(null);try{const m=await fetch("/api/auth/resend-verification",{method:"POST",credentials:"include"}),p=await m.json();m.status===429?d("Too many requests. Please wait an hour before trying again."):m.ok?a("Sent! Check your inbox."):d(p.error||"Failed to resend link.")}catch(m){d(m.message||"Failed to resend link.")}finally{r(!1)}};return n.jsxs("div",{"data-testid":"banner-email-verification",className:"w-full bg-amber-50 border-b border-amber-200 text-amber-900 px-4 py-2.5 text-sm flex items-center justify-center gap-3 flex-wrap",children:[n.jsxs("span",{children:["One last step — click the magic link we sent to ",n.jsx("strong",{children:t})," to unlock exports, team invites, and account upgrades."]}),n.jsx("button",{"data-testid":"button-resend-verification",onClick:u,disabled:s,className:"underline font-medium hover:text-amber-700 disabled:opacity-50",children:s?"Sending...":"Resend link"}),i&&n.jsx("span",{className:"text-emerald-700",children:i}),l&&n.jsx("span",{className:"text-red-700",children:l})]})}function yT(t){const e=t.replace(/^#\/?/,"").split("?")[0].trim();if(!e)return{name:"dashboard"};const[s,r]=e.split("/");switch(s){case"dashboard":return{name:"dashboard"};case"capture":return{name:"capture"};case"workflows":return r?{name:"workflow",id:r}:{name:"workflows"};case"edit":return r?{name:"edit",id:r}:{name:"dashboard"};case"outputs":return{name:"dashboard"};case"templates":return{name:"dashboard"};case"team":return{name:"team"};case"usage":return{name:"usage"};case"feedback":return{name:"feedback"};case"help":return{name:"help",topic:r};case"settings":return{name:"settings",section:r||"workspace"};case"privacy":return{name:"privacy"};default:return{name:"dashboard"}}}function xK(t){switch(t.name){case"dashboard":return"#/dashboard";case"capture":return"#/capture";case"workflows":return"#/workflows";case"workflow":return`#/workflows/${t.id}`;case"edit":return`#/edit/${t.id}`;case"outputs":return"#/outputs";case"templates":return"#/templates";case"team":return"#/team";case"usage":return"#/usage";case"feedback":return"#/feedback";case"help":return t.topic?`#/help/${t.topic}`:"#/help";case"settings":return t.section?`#/settings/${t.section}`:"#/settings";case"privacy":return"#/privacy"}}function gK(){const[t,e]=j.useState(()=>yT(window.location.hash));j.useEffect(()=>{const r=()=>e(yT(window.location.hash));return window.addEventListener("hashchange",r),()=>window.removeEventListener("hashchange",r)},[]);const s=j.useCallback(r=>{window.location.hash=xK(r)},[]);return{view:t,navigate:s}}const bK=[{key:"dashboard",label:"Dashboard",icon:HA},{key:"capture",label:"Capture",icon:RA},{key:"workflows",label:"Workflows",countKey:"workflows",icon:GA},{key:"team",label:"Team",icon:ZA},{key:"usage",label:"Usage",icon:hu},{key:"settings",label:"Settings",icon:JA}];function yK({session:t,onSessionRefresh:e,onLogout:s}){const{view:r,navigate:i}=gK(),[a,l]=j.useState(null),d=j.useCallback(N=>{l(N),setTimeout(()=>l(null),2400)},[]),u=N=>r.name===N||N==="workflows"&&(r.name==="workflow"||r.name==="edit");j.useEffect(()=>{const N=document.documentElement,S=document.body,A=N.style.height,E=N.style.overflow,_=S.style.height,T=S.style.overflow;return N.style.height="100%",N.style.overflow="hidden",S.style.height="100%",S.style.overflow="hidden",()=>{N.style.height=A,N.style.overflow=E,S.style.height=_,S.style.overflow=T}},[]);const m=!!t.emailVerified,p=(t.recentActivity||[]).some(N=>/capture|recording/i.test(N.action)),x=GO(t.plan),g=(()=>{const N=(t.contactName||"").trim(),S=t.contactEmail||"";if(N&&N.toLowerCase()!=="client"){const E=N.split(/\s+/).filter(
89Boolean);if(E.length>=2)return(E[0][0]+E[E.length-1][0]).toUpperCase();if(E.length===1)return E[0].slice(0,2).toUpperCase()}return((S.split("@")[0]||"").replace(/[^a-zA-Z]/g,"").slice(0,2)||"?").toUpperCase()})(),b=j.useMemo(()=>{const N=!!t.companyName,S=t.submissions.length>0,A=t.submissions.some(T=>Yn(T)==="Approved"||Yn(T)==="Exported"),E=t.contacts.length>1;return[{key:"workspace",label:"Create workspace",description:"Done — your workspace is live.",done:N},{key:"verify",label:"Verify email",description:"We use this to send sign-in links.",done:m},{key:"first",label:"Create your first workflow",description:"Capture from your browser, upload a document, or describe one to Betty — any method works.",done:S,action:{label:"Start",onClick:()=>i({name:"capture"})}},{key:"sop",label:"Generate first SOP",description:"Appears once a workflow is reviewed.",done:A,action:{label:"Review",onClick:()=>i({name:"workflows"})}},{key:"invite",label:"Invite teammate",description:"Share workflows with reviewers and operators.",done:E,action:{label:"Invite",onClick:()=>i({name:"team"})}},{key:"plan",label:"Choose subscription plan",description:"Stay on Free or pick a paid plan whenever you're ready.",done:!1,action:{label:"Cho
89ose",onClick:()=>i({name:"settings",section:"billing"})}},{key:"install",label:"Install Chrome extension (optional)",description:"Only needed if you want screen-recording captures.",done:p,action:{label:"Install",onClick:()=>i({name:"capture"})}}]},[t,i,m,p]),v=b.filter(N=>N.done).length,k=t.submissions.length===0;return n.jsxs("div",{children:[n.jsx(WG,{}),n.jsx(JO,{email:t.contactEmail||"",emailVerified:m}),n.jsxs("div",{className:"h-screen bg-cream flex overflow-hidden",children:[n.jsxs("aside",{className:"w-60 flex-shrink-0 bg-white border-r border-warm-border flex flex-col h-screen sticky top-0",children:[n.jsx("div",{className:"px-5 py-5 border-b border-warm-border",children:n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-br from-olive to-olive-dark flex items-center justify-center text-white font-black text-sm",children:"W"}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-sm font-black text-ink leading-tight truncate",children:"Workflow Capture"}),n.jsx("div",{className:"text-[10px] text-warm-gray leading-tight",children:"Knowledge hub"})]})]})}),n.jsxs("nav",{className:"flex-1 overflow-y-auto px-3 py-4",children:[n.jsx("div",{className:"text-[10px] font-bold text-warm-gray uppercase tracking-wider px-3 mb-2",children:"Primary"}),bK.map(N=>{const S=N.countKey==="workflows"?t.submissions.length:N.countKey==="outputs"?t.submissions.filter(_=>Yn(_)==="Approved"||Yn(_)==="Exported").length:null,A=u(N.key),E=N.icon;return n.jsxs("button",{onClick:()=>i({name:N.key}),"data-testid":`nav-${N.key}`,className:`w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors mb-0.5 ${A?"bg-olive/10 text-olive":"text-warm-gray hover:bg-cream-dark hover:text-ink"}`,children:[n.jsx(E,{className:`w-4 h-4 shrink-0 ${A?"text-olive":"text-warm-gray/80"}`,strokeWidth:1.75}),n.jsx("span",{className:"flex-1 text-left",children:N.label}),S!==null&&n.jsx("span",{className:`text-xs font-semibold ${A?"text-olive":"text-warm-gray/70"}`,children:S})]},N.key)})]}),n.jsxs("div",{className:"border-t border-warm-border px-3 py-3 space-y-0.5",children:[n.jsxs("button",{onClick:()=>i({name:"help"}),"data-testid":"link-help-center",className:`w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors ${r.name==="help"?"bg-olive/10 text-olive":"text-warm-gray hover:bg-cream-dark hover:text-ink"}`,children:[n.jsx("span",{className:"w-5 text-center",children:"?"}),n.jsx("span",{className:"flex-1 text-left",children:"Help Center"})]}),n.jsxs("button",{onClick:()=>i({name:"privacy"}),"data-testid":"nav-privacy",className:`w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors ${r.name==="privacy"?"bg-olive/10 text-olive":"text-warm-gray hover:bg-cream-dark hover:text-ink"}`,children:[n.jsx(po,{className:`w-4 h-4 shrink-0 ${r.name==="privacy"?"text-olive":"text-warm-gray/80"}`,strokeWidth:1.75}),n.jsx("span",{className:"flex-1 text-left",children:"Privacy Policy"})]}),n.jsxs("button",{onClick:()=>i({name:"feedback"}),"data-testid":"nav-feedback",className:`w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors ${r.name==="feedback"?"bg-olive/10 text-olive":"text-warm-gray hover:bg-cream-dark hover:text-ink"}`,children:[n.jsx(z9,{className:`w-4 h-4 shrink-0 ${r.name==="feedback"?"text-olive":"text-warm-gray/80"}`,strokeWidth:1.75}),n.jsx("span",{className:"flex-1 text-left",children:"Feedback"})]}),n.jsxs("button",{onClick:()=>s(),"data-testid":"button-signout",className:"w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium text-warm-gray hover:bg-cream-dark hover:text-ink",children:[n.jsx("span",{className:"w-5 text-center",children:"↪"})," Sign out"]})]}),n.jsxs("div",{className:"border-t border-warm-border px-4 py-3",children:[n.jsx("div",{className:"text-xs font-semibold text-ink truncate",children:t.companyName}),n.jsx("div",{className:"text-[11px] text-warm-gray truncate",children:t.contactEmail})]})]}),n.jsxs("main",{className:"flex-1 min-w-0 overflow-y-auto",children:[n.jsxs("header",{className:"bg-white border-b border-warm-border px-8 py-5 flex items-center justify-between gap-6",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("h1",{className:"text-2xl font-black text-ink leading-tight",children:[r.name==="dashboard"&&"Welcome to Workflow Capture",r.n
89ame==="capture"&&"Capture a workflow",r.name==="workflows"&&"All workflows",r.name==="workflow"&&"Workflow detail",r.name==="edit"&&"Edit workflow",r.name==="outputs"&&"Outputs",r.name==="templates"&&"Templates",r.name==="team"&&"Team",r.name==="usage"&&"Usage",r.name==="feedback"&&"Feedback & ideas",r.name==="help"&&"Help Center",r.name==="settings"&&"Settings",r.name==="privacy"&&"Privacy Policy"]}),r.name==="dashboard"&&n.jsxs("div",{className:"text-xs text-warm-gray mt-1 truncate","data-testid":"text-header-meta",children:[t.companyName," · ",x," · ",t.submissions.length," ",t.submissions.length===1?"workflow":"workflows"]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx(at,{variant:"primary",onClick:()=>i({name:"capture"}),testId:"button-header-create",children:"+ Create workflow"}),n.jsx(qG,{}),n.jsx("div",{className:"w-9 h-9 rounded-full bg-gradient-to-br from-slate-700 to-slate-900 text-white flex items-center justify-center text-xs font-black ml-1",title:t.contactName||t.contactEmail,"data-testid":"avatar-user",children:g})]})]}),n.jsxs("div",{className:"px-8 py-7 max-w-[1280px] mx-auto",children:[r.name==="dashboard"&&n.jsx(wK,{session:t,isEmpty:k,checklist:b,completedSetup:v,navigate:i,onSessionRefresh:e,showToast:d}),r.name==="capture"&&n.jsx(GG,{session:t,navigate:i,showToast:d}),r.name==="workflows"&&n.jsx(KG,{session:t,navigate:i}),r.name==="workflow"&&n.jsx(YG,{session:t,workflowId:r.id,navigate:i,showToast:d,onSessionRefresh:e}),r.name==="edit"&&n.jsx(fK,{session:t,workflowId:r.id,onSessionRefresh:e,onNavigateWorkflow:N=>i({name:"workflow",id:N}),onNavigateWorkflows:()=>i({name:"workflows"}),showToast:d}),r.name==="outputs"&&n.jsx(QG,{session:t,navigate:i}),r.name==="templates"&&n.jsx(JG,{navigate:i,showToast:d}),r.name==="team"&&n.jsx(ZG,{session:t,onSessionRefresh:e,showToast:d}),r.name==="usage"&&n.jsx(eK,{session:t,navigate:i}),r.name==="feedback"&&n.jsx(tK,{}),r.name==="help"&&n.jsx(rK,{navigate:i,topic:r.topic}),r.name==="settings"&&n.jsx(aK,{session:t,section:r.section||"workspace",onSectionChange:N=>i({name:"settings",section:N}),onSessionRefresh:e,showToast:d,onLogout:s}),r.name==="privacy"&&n.jsx(vK,{})]})]}),a&&n.jsx(FG,{message:a,kind:"success"})]})]})}function vK(){return n.jsx("div",{className:"max-w-3xl mx-auto",children:n.jsxs(ot,{className:"p-6 sm:p-8",children:[n.jsxs("div",{className:"mb-6",children:[n.jsxs("span",{className:"inline-flex items-center gap-2 text-xs font-bold text-olive bg-olive/10 px-3 py-1 rounded-full mb-4 uppercase tracking-wider",children:[n.jsx(po,{className:"w-3.5 h-3.5"}),"Privacy"]}),n.jsx("p",{className:"text-warm-gray text-sm mb-1",children:"Workflow Capture Chrome extension and web service"}),n.jsxs("p",{className:"text-warm-gray text-sm",children:["Last updated: ",$O]}),n.jsxs("p",{className:"text-xs text-warm-gray mt-3",children:["Questions? Email"," ",n.jsx("a",{href:`mailto:${ti}`,className:"text-olive font-semibold hover:underline",children:ti}),". The same policy is also available publicly at"," ",n.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-olive font-semibold hover:underline",children:"workflowcapture.ai/privacy"}),"."]})]}),n.jsx(BO,{})]})})}function wK({session:t,isEmpty:e,checklist:s,completedSetup:r,navigate:i,onSessionRefresh:a,showToast:l}){const d=t.submissions,u=j.useMemo(()=>{const p=d.filter(g=>Yn(g)==="Approved"||Yn(g)==="Exported").length,x=d.filter(g=>Yn(g)==="Exported"||Yn(g)==="Sent to Runtime").length;return{workflows:d.length,sops:p,scripts:p,exports:x}},[d]);if(e)return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[n.jsxs(ot,{className:"lg:col-span-2 overflow-hidden shadow-[0_2px_12px_rgba(45,58,35,0.12)]",children:[n.jsxs("div",{className:"relative p-8 sm:p-10 capture-hero text-white overflow-hidden",children:[n.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-white/[0.04] via-transparent to-white/[0.02]"}),n.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute hidden md:block",style:{right:"-180px",top:"50%",transform:"translateY(-50%)",width:"640px",height:"640px",borderRadius:"9999px",border:"70px solid var(--hero-ring-border)",background:"transparent"}}),n.jsxs("div",{className:"relative grid grid-cols-1 md:grid-cols-[1fr_auto] gap-8 items-start",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl sm:text-3xl font-black leading-tight text-white",children:"Turn your first real workflow into an SOP or AI-ready script"}),n.jsx("p",{className:"text-base text-white/75 mt-3 leading-relaxed max-w-xl",children:"Capture a browser process, upload an existing document, or simply tell Betty what your team does from memory."}),n.jsx("p",{className:"text-xs font-bold text-white/60 uppercase tracking-wider mt-5",children:"Three ways to create a workflow"}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 mt-2",children:[n.jsx("button",{onClick:()=>i({name:"capture"}),"data-testid":"button-method-capture",className:"inline-flex items-center justify-center gap-2 font-semibold rounded-xl px-5 py-2.5 text-sm bg-transparent text-white border border-white/40 hover:bg-white/10 transition-colors",children:"Capture from browser"}),n.jsx("button",{onClick:()=>{const p=document.querySelector('[data-testid="betty-attach"], [data-testid="betty-attach-inline"]');
89p?p.click():i({name:"capture"})},"data-testid":"button-method-upload",className:"inline-flex items-center justify-center gap-2 font-semibold rounded-xl px-5 py-2.5 text-sm bg-transparent text-white border border-white/40 hover:bg-white/10 transition-colors",children:"Upload a document"}),n.jsx("button",{onClick:()=>{const p=document.querySelector("[data-betty-input]");p&&(p.focus(),p.scrollIntoView({behavior:"smooth",block:"center"}))},"data-testid":"button-method-describe",className:"inline-flex items-center justify-center gap-2 font-semibold rounded-xl px-5 py-2.5 text-sm bg-transparent text-white border border-white/40 hover:bg-white/10 transition-colors",children:"Describe to Betty"})]}),n.jsx("p",{className:"text-xs text-white/60 mt-4 leading-relaxed max-w-xl",children:"Pick whichever fits the process. Password fields are excluded from captures, and you review everything before it's published."})]}),n.jsx("div",{className:"hidden md:block relative z-10",children:n.jsxs("div",{className:"w-64 overflow-hidden flex flex-col",style:{background:"#fbfaf6",borderRadius:"18px",boxShadow:"0 24px 50px rgba(20, 36, 28, 0.18)"},children:[n.jsxs("div",{className:"flex items-center px-3 gap-1.5",style:{height:"34px",background:"#eef0ea"},children:[n.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#c8cdc0"}}),n.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#c8cdc0"}}),n.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#c8cdc0"}})]}),n.jsxs("div",{className:"px-4 py-4 flex-1 space-y-2",children:[n.jsx("div",{className:"h-2 rounded w-3/4",style:{background:"#e6e8df"}}),n.jsx("div",{className:"h-2 rounded w-2/3",style:{background:"#e6e8df"}}),n.jsx("div",{className:"h-2 rounded w-1/2",style:{background:"#e6e8df"}}),n.jsx("div",{className:"h-2 rounded w-3/5",style:{background:"#eceee6"}})]}),n.jsxs("div",{className:"mx-3 mb-3 flex items-center justify-between rounded-lg px-3 py-2",style:{background:"#e8f2ea",border:"1px solid #cfe0d3",color:"#174832"},children:[n.jsx("span",{className:"text-[11px] font-semibold",children:"Capture ready"}),n.jsx("span",{className:"text-[11px] font-bold",children:"Start"})]})]})})]})]}),n.jsx(bT,{session:t,onSessionRefresh:a,onNavigateCapture:()=>i({name:"capture"}),onNavigateWorkflows:()=>i({name:"workflows"}),onNavigateWorkflow:p=>i({name:"workflow",id:p}),showToast:l})]}),n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Finish setup",description:`${r} of ${s.length} completed`}),n.jsx("div",{className:"w-full h-1 bg-cream-dark rounded-full overflow-hidden mb-3",children:n.jsx("div",{className:"h-full bg-olive transition-all",style:{width:`${r/s.length*100}%`}})}),n.jsx("div",{className:"divide-y divide-warm-border/60",children:s.map(p=>n.jsx(VG,{done:p.done,label:p.label,description:p.description,action:p.action},p.key))})]})]}),n.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[n.jsx(si,{label:"Workflows created",value:"0",hint:"Start with one repeatable process.",testId:"stat-workflows-empty"}),n.jsx(si,{label:"SOPs generated",value:"0",hint:"Appears after your first workflow.",testId:"stat-sops-empty"}),n.jsx(si,{label:"AI-ready scripts",value:"0",hint:"Generated from reviewed workflows.",testId:"stat-scripts-empty"}),n.jsx(si,{label:"Exports completed",value:"0",hint:"Send assets when approved.",testId:"stat-exports-empty"})]}),n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Your output library is ready",description:"Assets will appear here after you create your first workflow."}),n.jsxs("div",{className:"bg-cream/40 border border-warm-border rounded-xl p-5 text-center",children:[n.jsx("p",{className:"text-sm font-bold text-ink",children:"No workflows yet"}),n.jsx("p",{className:"text-xs text-warm-gray mt-1 leading-snug",children:"Capture, upload, or describe a process. We'll turn it into reviewed operational knowledge."}),n.jsx(at,{onClick:()=>i({name:"capture"}),size:"sm",className:"mt-3",testId:"button-create-first",children:"Create your first workflow"})]}),n.jsx("div",{className:"space-y-2 mt-4",children:[{tag:"S",name:"SOP draft",desc:"Generated from any workflow you create"},{tag:"T",name:"Training guide",desc:"Created from approved workflow steps"},{tag:"AI",name:"AI-agent script",desc:"Actions, inputs, validations, and exceptions"}].map(p=>n.jsxs("div",{className:"flex items-center justify-between py-3 px-3 bg-white rounded-lg border border-warm-border",children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[n.jsx("span",{className:"flex-shrink-0 inline-flex items-center justify-center w-7 h-7 rounded-md bg-olive/10 text-olive text-[11px] font-black",children:p.tag}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-sm font-semibold text-ink",children:p.name}),n.jsx("p",{className:"text-xs text-warm-gray leading-snug",children:p.desc})]})]}),n.jsx("span",{className:"flex-shrink-0 text-[11px] font-semibold text-warm-gray bg-cream px-2.5 py-1 rounded-full border border-warm-border",children:"Waiting"})]},p.name))})]})]});const m=d.slice(0,5);return n.jsxs("div",{className:"space-y-6",children:[n.jsxs(ot,{className:"overflow-hidden shadow-[0_2px_12px_rgba(45,58,35,0.12)]",children:[n.jsxs("div",{className:"relative p-8 sm:p-10 capture-hero text-white overflow-hidden",children:[n.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-white/[0.04] via-trans
89parent to-white/[0.02]"}),n.jsx("div",{className:"pointer-events-none absolute -right-20 -top-20 w-72 h-72 rounded-full bg-white/[0.025] blur-3xl"}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"inline-block px-2.5 py-1 rounded-full bg-white/10 text-white/90 text-[11px] font-bold uppercase tracking-wider mb-3 border border-white/15",children:"Knowledge Hub"}),n.jsx("h1",{className:"text-2xl sm:text-3xl font-black text-white leading-tight",children:"Capture it, upload it, or just tell Betty what you want to build"}),n.jsx("p",{className:"text-base text-white/75 mt-3 leading-relaxed max-w-2xl",children:"Generate SOPs, training guides, and AI-agent scripts from approved captures — or describe a process from memory and Betty will draft it for you."}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 mt-5",children:[n.jsx("button",{onClick:()=>i({name:"capture"}),className:"inline-flex items-center justify-center gap-2 font-semibold rounded-xl px-5 py-2.5 text-sm bg-white text-[#184832] hover:bg-white/90 transition-colors",children:"New Capture"}),n.jsx("button",{onClick:()=>i({name:"workflows"}),className:"inline-flex items-center justify-center gap-2 font-semibold rounded-xl px-5 py-2.5 text-sm bg-transparent text-white border border-white/40 hover:bg-white/10 transition-colors",children:"View workflows"})]})]})]}),n.jsx(bT,{session:t,onSessionRefresh:a,onNavigateCapture:()=>i({name:"capture"}),onNavigateWorkflows:()=>i({name:"workflows"}),onNavigateWorkflow:p=>i({name:"workflow",id:p}),showToast:l})]}),n.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[n.jsx(si,{label:"SOPs generated",value:u.sops,testId:"stat-sops"}),n.jsx(si,{label:"Training guides",value:u.sops,testId:"stat-training"}),n.jsx(si,{label:"AI-ready scripts",value:u.scripts,testId:"stat-scripts"}),n.jsx(si,{label:"Exports completed",value:u.exports,testId:"stat-exports"})]}),n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Output library",description:"Recent workflow assets",action:n.jsx(at,{variant:"secondary",size:"sm",onClick:()=>i({name:"workflows"}),children:"View all"})}),n.jsx("div",{className:"overflow-x-auto -mx-6 px-6",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"text-left text-[11px] font-bold text-warm-gray uppercase tracking-wider border-b border-warm-border",children:[n.jsx("th",{className:"py-2 pr-4",children:"Asset"}),n.jsx("th",{className:"py-2 pr-4",children:"Type"}),n.jsx("th",{className:"py-2 pr-4",children:"Status"}),n.jsx("th",{className:"py-2 pr-4",children:"Updated"}),n.jsx("th",{className:"py-2 pr-4 text-right",children:"Action"})]})}),n.jsx("tbody",{className:"divide-y divide-warm-border/60",children:m.map(p=>n.jsxs("tr",{className:"hover:bg-cream-dark/40",children:[n.jsxs("td",{className:"py-3 pr-4",children:[n.jsx("button",{onClick:()=>i({name:"workflow",id:p.id}),className:"font-semibold text-ink hover:text-olive text-left","data-testid":`link-workflow-${p.id}`,children:p.title||"Untitled workflow"}),n.jsxs("div",{className:"text-xs text-warm-gray",children:[fN(p)," steps"]})]}),n.jsx("td",{className:"py-3 pr-4 text-warm-gray",children:"Workflow"}),n.jsx("td",{className:"py-3 pr-4",children:n.jsx(cp,{status:Yn(p)})}),n.jsx("td",{className:"py-3 pr-4 text-warm-gray text-xs",children:gu(p.createdAt)}),n.jsx("td",{className:"py-3 pr-4 text-right",children:n.jsx(at,{size:"sm",variant:"secondary",onClick:()=>i({name:"workflow",id:p.id}),children:"Open"})})]},p.id))})]})})]}),n.jsxs(ot,{className:"p-6",children:[n.jsx(cs,{title:"Recommended next steps"}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{label:"Capture another workflow",onClick:()=>i({name:"capture"})},{label:"Invite a compliance reviewer",onClick:()=>i({name:"team"})},{label:"Review your workflows",onClick:()=>i({name:"workflows"})}].map((p,x)=>n.jsxs("button",{onClick:p.onClick,className:"w-full text-left flex items-center justify-between px-4 py-3 rounded-xl border border-warm-border hover:border-olive/40 hover:bg-cream/60 transition-colors",children:[n.jsx("span",{className:"text-sm font-semibold text-ink",children:p.label}),n.jsx("span",{className:"text-warm-gray",children:"→"})]},x))})]})]})}const gN="sop_portal_token";function jK(){try{return localStorage.getItem(gN)}catch{return null}}function NK(t){try{localStorage.setItem(gN,t)}catch{}}function kK(){try{localStorage.removeItem(gN)}catch{}}function Tt(t,e={}){const s=jK(),r=new Headers(e.headers||{});return s&&r.set("Authorization",`Bearer ${s}`),fetch(t,{...e,headers:r,credentials:"include"})}const vT={planned:"Being designed",building:"Under construction",testing:"Be
89ing tested",deployed:"Deployed and running",live:"Active and running",paused:"Temporarily paused",retired:"Retired"};function SK(t){if(!t)return"";const e=t.trim();return e?e.split(/(\s+)/).map(s=>/^\s+$/.test(s)||/[A-Z]/.test(s)?s:s.charAt(0).toUpperCase()+s.slice(1)).join(""):""}function CK(t){return t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function TK({darkMode:t,session:e,onSessionUpdate:s}){const[r,i]=j.useState({companyName:e?.companyName||"",industry:e?.industry||"",website:e?.website||"",platform:e?.platform||""}),[a,l]=j.useState(!1),[d,u]=j.useState(!1),m=async()=>{l(!0),u(!1);try{const S=await Tt("/api/portal/sop/company-profile",{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(r)});if(S.ok){const A=await S.json();u(!0),s&&s(A),setTimeout(()=>u(!1),3e3)}}catch{}l(!1)},p=t?"bg-slate-800 border-slate-700":"bg-white border-warm-border",x=t?"text-white":"text-ink",g=t?"text-slate-400":"text-warm-gray",b=t?"bg-slate-700":"bg-cream-dark",v=t?"text-slate-400":"text-warm-gray",k=`w-full ${t?"bg-slate-700 border-slate-600 text-white":"bg-white border-warm-border text-ink"} border rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-olive focus:ring-1 focus:ring-olive`,N=`block text-sm font-medium ${t?"text-slate-400":"text-warm-gray"} mb-1`;return n.jsxs("div",{className:"space-y-6","data-testid":"section-portal-settings",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:`w-10 h-10 rounded-xl ${b} border ${t?"border-slate-600":"border-warm-border"} flex items-center justify-center`,children:n.jsxs("svg",{className:`w-5 h-5 ${v}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),n.jsxs("div",{children:[n.jsx("h2",{className:`text-xl font-bold ${x}`,children:"Settings"}),n.jsx("p",{className:`text-sm ${g} mt-0.5`,children:"Manage your company profile, payment details, and platform configuration."})]})]}),n.jsxs("div",{className:`border ${p} rounded-xl`,children:[n.jsx("div",{className:`px-6 py-4 border-b ${t?"border-slate-700":"border-warm-border"}`,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("svg",{className:`w-5 h-5 ${v}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M9 6.75h1.5m-1.5 3h1.5m-1.5 3h1.5m3-6H15m-1.5 3H15m-1.5 3H15M9 21v-3.375c0-.621.504-1.125 1.125-1.125h3.75c.621 0 1.125.504 1.125 1.125V21"})}),n.jsx("h3",{className:`text-base font-semibold ${x}`,children:"Company Profile"})]})}),n.jsxs("div",{className:"p-6",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:N,children:"Company Name"}),n.jsx("input",{"data-testid":"input-portal-company-name",type:"text",value:r.companyName,onChange:S=>i(A=>({...A,companyName:S.target.value})),className:k,placeholder:"Your Company Name"})]}),n.jsxs("div",{children:[n.jsx("label",{className:N,children:"Industry"}),n.jsx("input",{"data-testid":"input-portal-industry",type:"text",value:r.
89industry,onChange:S=>i(A=>({...A,industry:S.target.value})),className:k,placeholder:"e.g. Background Check / CRA"})]}),n.jsxs("div",{children:[n.jsx("label",{className:N,children:"Website"}),n.jsx("input",{"data-testid":"input-portal-website",type:"url",value:r.website,onChange:S=>i(A=>({...A,website:S.target.value})),className:k,placeholder:"https://www.example.com"})]}),n.jsxs("div",{children:[n.jsx("label",{className:N,children:"Platform"}),n.jsx("input",{"data-testid":"input-portal-platform",type:"text",value:r.platform,onChange:S=>i(A=>({...A,platform:S.target.value})),className:k,placeholder:"e.g. Accio, Tazworks"})]})]}),n.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[n.jsx("button",{"data-testid":"button-save-company-profile",onClick:m,disabled:a,className:"bg-olive hover:bg-olive-dark text-white text-sm font-medium px-4 py-2 rounded-lg transition-colors disabled:opacity-50",children:a?"Saving...":"Save Changes"}),d&&n.jsx("span",{className:"text-sm text-green-600 font-medium",children:"Saved successfully"})]})]})]})]})}const xc={_initial:{reply:"",actions:[{label:"How does this work?",actionKey:"how_it_works"},{label:"I have documents to upload",actionKey:"upload_docs"},{label:"Record my process",actionKey:"start_capture"},{label:"Describe what I do",actionKey:"describe_workflow"}]},how_it_works:{reply:`Great question! Here's how it works:
90
911. **Capture** — Use our recording tool to record yourself doing a task, step-by-step. Just click, type, and navigate like you normally would.
92
932. **Review** — We turn your recording into a clean, step-by-step workflow document — you can review and edit every step.
94
953. **Share** — Use the finished workflow for training, onboarding, compliance, or as the source of truth for how the work gets done.
96
97You can also upload a process document and I'll help turn it into a structured workflow — no recording needed.
98
99What would you like to do?`,actions:[{label:"Record my process",actionKey:"start_capture"},{label:"Upload a document",actionKey:"upload_docs"},{label:"Tell me about security",actionKey:"security"}]},upload_docs:{reply:"",actions:[]},start_capture:{reply:`Let's get your first process recorded! The Capture feature uses our recording tool to record your screen activity as you perform a task.
100
101Once installed, just:
102• Click **Start Recording**
103• Do your task naturally — clicking, typing, navigating
104• **Narrate as you go** — the extension captures your audio too, so talk through each step and explain your reasoning. This is incredibly helpful for building a richer workflow document.
105• Click **Stop** when you're done
106
107Your voice narration gets transcribed and paired with each step, so the more you explain your thought process and decision-making, the more useful the finished workflow will be for anyone who has to follow it later.
108
109Ready to set up the extension?`,actions:[{label:"Open Capture setup",actionKey:"nav_capture"},{label:"What happens after I record?",actionKey:"after_record"},{label:"I'd rather upload a document",actionKey:"upload_docs"}]},security:{reply:`Security is at the core of everything we do:
110
111• **Encrypted at rest and in transit** — Industry-standard encryption on every recording, transcript, and document
112• **Isolated tenant data** — Your captures and workflows are never mixed with another customer's
113• **Least-privilege access** — Only people you invite can see your workspace
114• **Auditable** — Every view, edit, and export is logged
115• **You own your data** — Export or delete any workflow at any time
116
117We only store what's needed to turn your recording into a clear workflow document.`,actions:[{label:"Record my process",actionKey:"start_capture"},{label:"Upload a document",actionKey:"upload_docs"},{label:"How does the process work?",actionKey:"how_it_works"}]},how_capture:{reply:`The Capture extension records each click, keystroke, and navigation you make — plus **your voice narration** — then we organize it all into clear, numbered steps.
118
119Talk through what you're doing and why as you record. Your narration gets transcribed and attached to each step, giving the finished workflow much richer context.
120
121You can:
122• **Edit** any step to refine the instructions
123• **Add notes** to capture the reasoning behind a step
124• **Export** the workflow for training, review, or compliance
125
126Think of it as teaching a new teammate by showing *and telling* them exactly how you do it — except it's written down once and reusable forever.`,actions:[{label:"Open Capture setup",actionKey:"nav_capture"},{label:"Tell me about security",actionKey:"security"}]},after_record:{reply:`After you stop recording, we automatically:
127
1281. **Transcribe** your voice narration and pair it with each step
1292. **Process** the recording into a step-by-step workflow
1303. **Analyze** each action and label it in plain English
1314. **Present** it for your review in the Workflows section
132
133Your narration adds valuable context — the logic behind each step, edge cases to wat
133ch for, and decision-making that clicks alone can't capture.
134
135You can edit any step, add notes, and when you're happy with it the workflow is ready to share with your team.
136
137Ready to try it?`,actions:[{label:"Open Capture setup",actionKey:"nav_capture"},{label:"I'd rather upload a document",actionKey:"upload_docs"}]},back_overview:{reply:`No problem! Here's what you can do from the Overview:
138
139• **My Workflows** — Capture and manage the processes you do
140• **Training Documents** — Upload SOPs, guides, and reference materials
141
142Or just upload a document here and I'll help you get started right away.`,actions:[{label:"Record my process",actionKey:"start_capture"},{label:"Upload a document",actionKey:"upload_docs"},{label:"How does this work?",actionKey:"how_it_works"}]}};function EK({contactName:t,onNavigate:e,onSessionRefresh:s,existingDocs:r,editScriptContext:i,onClearEditContext:a,submissions:l=[],onEditScript:d,darkMode:u=!1}){const m=t?.split(" ")[0]||"there",p=j.useMemo(()=>{if(r.length>0){const V=r.slice(0,3).map(ue=>`**${ue.fileName}**`).join(", "),ge=r.length>3?` and ${r.length-3} more`:"";return{role:"assistant",content:`Hi ${m}! Welcome back to your portal.
143
144I see you've already uploaded ${r.length===1?"a document":`${r.length} documents`}: ${V}${ge}.
145
146Would you like me to turn one of these into a structured workflow? Or you can upload a new document, record your process, or ask me anything.`,actions:[...r.slice(0,3).map(ue=>({label:`Use "${ue.fileName.length>25?ue.fileName.substring(0,22)+"...":ue.fileName}"`,actionKey:`use_existing_doc_${ue.id}`})),{label:"Upload a new document",actionKey:"upload_docs"},{label:"Record my process",actionKey:"start_capture"},{label:"Describe what I do",actionKey:"describe_workflow"}]}}return{role:"assistant",content:`Hi ${m} — pick how you'd like to capture your first workflow.`,actions:xc._initial.actions}},[m,r]),[x,g]=j.useState([p]),[b,v]=j.useState(""),[k,N]=j.useState(!1),[S,A]=j.useState(!0),[E,_]=j.useState(!1),[T,$]=j.useState({fileId:null,fileName:"",analysis:null,questionIndex:0,answers:{},scriptCreated:!1}),[L,M]=j.useState(!1),[I,z]=j.useState(null),[ae,U]=j.useState({messages:[],creating:!1}),[Y,P]=j.useState(null),ne=j.useRef(null),q=j.useRef(null);j.useEffect(()=>{ne.current?.scrollIntoView({behavior:"smooth"})},[x,k]),j.useEffect(()=>{if(i){const V=i.steps.map((ue,Me)=>`${Me+1}. **${ue.name||ue.description||"Step"}**`).join(`
147`),ge=`Let's take a look at **${i.title}** together. Here's what it does today:
148
149${V}
150
151What would you like to change, or what's not working the way you'd like? You can describe it however feels natural — I'll ask follow-up questions if I need more detail.`;z({sopId:i.sopId,title:i.title,isCapture:i.isCapture,steps:i.steps||[],history:[{role:"assistant",content:ge}]}),A(!1),g(ue=>[...ue,{role:"assistant",content:ge,actions:[...i.isCapture?[{label:"Record a new script instead",actionKey:"nav_capture"}]:[],{label:"Done editing",actionKey:"done_editing"}]}]),a?.()}},[i]);const W=async V=>{if(!["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","image/png","image/jpeg","text/markdown","text/plain","text/csv","application/json","application/xml","text/xml","text/yaml","application/x-yaml","application/rtf","text/rtf"].includes(V.type)){g(ue=>[...ue,{role:"assistant",content:"I can only accept **PDF**, **Word** (.doc, .docx), **Markdown** (.md), **Text** (.txt), **CSV**, **JSON**, **XML**, **YAML**, **RTF**, **PNG**, or **JPG** files. Could you try uploading in one of those formats?"}]);return}(V.size/(1024*1024)).toFixed(1),g(ue=>[...ue,{role:"user",content:`Uploaded: ${V.name}`,fileInfo:{name:V.name,size:V.size}}]),_(!0),N(!0);try{const ue=new FormData;ue.append("file",V);const Me=await Tt("/api/portal/sop/chat-upload",{method:"POST",credentials:"include",body:ue});if(!Me.ok)throw new Error((await Me.json()).error||"Upload failed");const We=await Me.json(),_e=We.analysis;$({fileId:We.fileId,fileName:We.fileName,analysis:_e,questionIndex:0,answers:{},scriptCreated:!1});const Re=_e.processSteps?.length>0?`
152
153I identified these steps:
154`+_e.processSteps.map((Fe,Kt)=>{const us=typeof Fe=="string"?Fe:Fe.name,ht=typeof Fe=="string"?"":Fe.description&&Fe.description!==Fe.name?` — ${Fe.description}`:"";return`${Kt+1}. **${us}**${ht}`}).join(`
155`):"",ze=_e.clarifyingQuestions?.[0]||"Can you tell me more about this process?";g(Fe=>[...Fe,{role:"assistant",content:`I've saved **${We.fileName}** to your Documents.
156
157${_e.summary}${Re}
158
159I have a few questions to help me build a better script for you:
160
161**${ze}**`,actions:[{label:"Skip questions — create script now",actionKey:"create_script_now"}]}])}catch(ue){g(Me=>[...Me,{role:"assistant",content:`Something went wrong uploading your document: ${ue.message}. Please try again.`}])}finally{_(!1),N(!1)}},ie=async(V=!1)=>
161{if(T.analysis){N(!0);try{const ge=await Tt("/api/portal/sop/chat-create-script",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:T.analysis.suggestedScriptTitle,description:T.analysis.suggestedScriptDescription,fileId:T.fileId,processSteps:T.analysis.processSteps,answers:V?{}:T.answers,analysisData:{eligibilityConditions:T.analysis.eligibilityConditions,requiredTemplates:T.analysis.requiredTemplates,escalationPaths:T.analysis.escalationPaths,terminalOutcomes:T.analysis.terminalOutcomes,uncertaintyHandling:T.analysis.uncertaintyHandling}})});if(!ge.ok)throw new Error((await ge.json()).error||"Failed to create script");const ue=await ge.json();$(Me=>({...Me,scriptCreated:!0})),g(Me=>[...Me,{role:"assistant",content:`I've created a new workflow: **${ue.title}**
162
163You'll find it in your Workflows section where you can review the steps, add details, and refine it. Once it's polished it's ready to share with your team.
164
165Want to upload another document or try the capture extension?`,actions:[{label:"View my scripts",actionKey:"nav_scripts"},{label:"Upload another document",actionKey:"upload_docs"},{label:"Try the capture extension",actionKey:"start_capture"}]}]),s()}catch(ge){g(ue=>[...ue,{role:"assistant",content:`I had trouble creating the script: ${ge.message}. Let me try again — or you can upload a different document.`}])}finally{N(!1)}}},he=async V=>{g(ge=>[...ge,{role:"user",content:`Use "${V.fileName}"`,fileInfo:{name:V.fileName,size:V.fileSize||0}}]),N(!0);try{const ge=await Tt(`/api/portal/sop/chat-analyze-existing/${V.id}`,{method:"POST",credentials:"include"});if(!ge.ok)throw new Error((await ge.json()).error||"Analysis failed");const Me=(await ge.json()).analysis;$({fileId:V.id,fileName:V.fileName,analysis:Me,questionIndex:0,answers:{},scriptCreated:!1});const We=Me.processSteps?.length>0?`
166
167I identified these steps:
168`+Me.processSteps.map((Re,ze)=>{const Fe=typeof Re=="string"?Re:Re.name,Kt=typeof Re=="string"?"":Re.description&&Re.description!==Re.name?` — ${Re.description}`:"";return`${ze+1}. **${Fe}**${Kt}`}).join(`
169`):"",_e=Me.clarifyingQuestions?.[0]||"Can you tell me more about this process?";g(Re=>[...Re,{role:"assistant",content:`Great choice! I've analyzed **${V.fileName}**.
170
171${Me.summary}${We}
172
173Let me ask a few questions to build a better script:
174
175**${_e}**`,actions:[{label:"Skip questions — create script now",actionKey:"create_script_now"}]}])}catch(ge){g(ue=>[...ue,{role:"assistant",content:`I had trouble analyzing that document: ${ge.message}. You can try uploading it again or pick a different one.`}])}finally{N(!1)}},se=V=>{if(V==="done_editing"){z(null),g(_e=>[..._e,{role:"assistant",content:"All done! You can view your updated script in the Scripts section. Need anything else?",actions:[{label:"View my scripts",actionKey:"nav_scripts"},{label:"Upload a document",actionKey:"upload_docs"}]}]);return}if(V.startsWith("open_script_")){const _e=V.replace("open_script_",""),ze=l.find(Fe=>Fe.id===_e)?.title||I?.title||"the script";g(Fe=>[...Fe,{role:"user",content:"Open script to export"}]),z(null),U({messages:[],creating:!1}),e("sops",{sopId:_e}),g(Fe=>[...Fe,{role:"assistant",content:`Opening **${ze}** now — you'll see the export option in the top right of the script view.`}]);return}if(V==="nav_documents"){z(null),U({messages:[],creating:!1}),e("documents");return}if(V==="nav_capture"){z(null),U({messages:[],creating:!1}),e("sops",{capture:!0});return}if(V==="nav_scripts"){z(null),U({messages:[],creating:!1}),e("sops");return}if(V==="create_script_now"){const _e="Skip questions — create script now";g(Re=>[...Re,{role:"user",content:_e}]),ie(!0);return}if(V.startsWith("edit_script_")){const _e=V.replace("edit_script_",""),Re=l.find(ze=>ze.id===_e);Re&&(g(ze=>[...ze,{role:"user",content:`Edit "${Re.title}"`}]),d?.(Re));return}if(V.startsWith("pick_script_")){const _e=V.replace("pick_script_",""),Re=l.find(ze=>ze.id===_e);Re&&g(ze=>[...ze,{role:"user",content:Re.title},{role:"assistant",content:`Want to review **${Re.title}** together or make changes?`,actions:[{label:"Edit this script",actionKey:`edit_script_${Re.id}`},{label:"Pick a different script",actionKey:"list_scripts"}]}]);return}if(V==="list_scripts"){if(l.length===0){g(Re=>[...Re,{role:"assistant",content:"You don't have any saved scripts yet. Want to create one?",actions:[{label:"Record my process",actionKey:"start_capture"},{label:"Upload a document",actionKey:"upload_docs"},{label:"Describe what I do",actionKey:"describe_workflow"}]}]);return}const _e=l.slice(0,8).map(Re=>`• **${Re.title}**`).join(`
176`);g(Re=>[...Re,{role:"user",content:"Show my scripts"},{role:"assistant",content:`Here are your saved scripts — pick one to review or edit:
177
178${_e}`,actions:l.slice(0,6).map(ze=>({label:ze.title.length>32?ze.title.substring(0,29)+"...":ze.title,actionKey:`edit_script_${ze.id}`}))}]);return}if(V.startsWith("use_existing_doc_")){const _e=V.replace("use_existing_doc_",""),Re=r.find(ze=>ze.id===_e);if(Re){he(Re);return}}if(V==="upload_docs"){U({messages:[],creating:!1}),z(null);const _e=Object.values(xc).flatMap(Re=>Re.actions||[]).find(Re=>Re.actionKey==="upload_docs")?.label||"I have documents to upload";g(Re=>[...Re,{role:"user",content:_e}]),N(!0),setTimeout(()=>{if(N(!1),r.length>0){const Re=r.map(ze=>`• **${ze.fileName}**`).join(`
179`);g(ze=>[...ze,{role:"assistant",content:`I found ${r.length===1?"a document":`${r.length} documents`} you've already uploaded:
180
181${Re}
182
183Would you like to use one of these to create a script? Or you can upload a new document using the paperclip icon below.`,actions:[...r.slice(0,5).map(Fe=>({label:Fe.fileName.length>
18330?Fe.fileName.substring(0,27)+"...":Fe.fileName,actionKey:`use_existing_doc_${Fe.id}`})),{label:"Upload a new document",actionKey:"trigger_file_upload"}]}])}else g(Re=>[...Re,{role:"assistant",content:`You can upload a document right here — SOPs, checklists, process guides, or reference materials.
184
185I'll analyze it and help you turn it into a clean, step-by-step workflow document. Just click the paperclip icon below or drag and drop a file.
186
187Supported formats: **PDF**, **Word**, **Markdown**, **Text**, **CSV**, **JSON**, **XML**, **YAML**, **RTF**, **PNG**, **JPG**`,actions:[{label:"Upload a document",actionKey:"trigger_file_upload"},{label:"How does the capture extension work?",actionKey:"how_capture"}]}])},500);return}if(V==="trigger_file_upload"){q.current?.click();return}if(V==="noop")return;if(V==="describe_workflow"){g(_e=>[..._e,{role:"user",content:"I'd like to describe what I do"}]),N(!0),z(null),$({fileId:null,fileName:"",analysis:null,questionIndex:0,answers:{},scriptCreated:!1}),U({messages:[],creating:!1}),setTimeout(()=>{N(!1),g(_e=>[..._e,{role:"assistant",content:`Tell me about the process you'd like to automate. Just describe it in your own words — what's it called, what are the main steps, and what systems or tools are involved?
188
189I'll turn your description into a structured script.`}]),U({messages:[{role:"assistant",content:"Tell me about the process you'd like to automate."}],creating:!1})},500);return}if(V==="create_from_description"){g(_e=>[..._e,{role:"user",content:"Create the script"}]),B();return}if(["how_it_works","security","how_capture","after_record","back_overview"].includes(V)){const _e=Object.values(xc).flatMap(Fe=>Fe.actions||[]).find(Fe=>Fe.actionKey===V)?.label||V;g(Fe=>[...Fe,{role:"user",content:_e}]);const Re={how_it_works:"How does Workflow Capture work from start to finish? Cover recording a process with the Chrome extension, voice narration, the structured workflow document we generate, how a user reviews and edits it, how to share it with their team, and how the free plan lets them get started without a credit card.",security:"Explain the Workflow Capture security model in detail. Cover encryption at rest and in transit, tenant data isolation, access controls, audit logging, and how customers can export or delete their data.",how_capture:"How does the Workflow Capture Chrome extension work? What does it record, how does voice narration help, and what can users do with the generated script?",after_record:"What happens after a user finishes recording a process with the Capture extension? Walk through the full process from recording to deployment.",back_overview:"Give me an overview of what I can do in the Workflow Capture portal. Cover Workflows, Training Documents, and how to share them with my team."},ze=xc[V];Se(Re[V]||_e).catch(()=>{N(!1),ze&&g(Fe=>[...Fe,{role:"assistant",content:ze.reply,actions:ze.actions}])});return}const ue=xc[V];if(!ue)return;const We={role:"user",content:Object.values(xc).flatMap(_e=>_e.actions||[]).find(_e=>_e.actionKey===V)?.label||V};g(_e=>[..._e,We]),N(!0),setTimeout(()=>{N(!1),g(_e=>[..._e,{role:"assistant",content:ue.reply,actions:ue.actions}])},600+Math.random()*400)},B=async()=>{if(ae.messages.length!==0){N(!0),U(V=>({...V,creating:!0}));try{const V=await Tt("/api/portal/sop/chat-describe-create",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation:ae.messages})});if(!V.ok)throw new Error((await V.json()).error||"Failed to create script");const ge=await V.json();U({messages:[],creating:!1}),g(ue=>[...ue,{role:"assistant",content:`I've created a new workflow: **${ge.title}**
190
191You'll find it in your Workflows section where you can review the steps, add details, and refine it. Once it's polished it's ready to share with your team.
192
193Want to describe another process or try something else?`,actions:[{label:"View my scripts",actionKey:"nav_scripts"},{label:"Describe another process",actionKey:"describe_workflow"},{label:"Upload a document",actionKey:"upload_docs"}]}]),s()}catch(V){g(ge=>[...ge,{role:"assistant",content:`Something went wrong creating the script: ${V.message}. Please try again.`}]),U(ge=>({...ge,creating:!1}))}N(!1)}},le=async V=>{const ge=[...ae.messages,{role:"user",content:V}];U(ue=>({...ue,messages:ge})),N(!0);try{const ue=await Tt("/api/portal/sop/chat-describe-followup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation:ge})});if(!ue.ok)throw new Error((await ue.json()).error||"Failed");const Me=await ue.json(),We=[...ge,{role:"assistant",content:Me.reply}];U(_e=>({..._e,messages:We})),g(_e=>[..._e,{role:"assistant",content:Me.reply,actions:Me.readyToCreate?[{label:"Create the script",actionKey:"create_from_description"},{label:"Add more details",actionKey:"noop"}]:void 0}])}catch{g(Me=>[...Me,{role:"assistant",content:"Something went wrong. Please try again."}])}N(!1)},pe=async V=>{if(!I)return;N(!0);const ge=[...I.history,{role:"user",content:V}];try{const ue=await Tt(`/api/portal/sop/${I.sopId}/edit-steps-chat`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({instruction:V,isCapture:I.isCapture,conversation:ge})});if(!ue.ok)throw new Error((await ue.json()).error||"Failed to update steps");const Me=await ue.json();if(Me.updatedSteps){await s();const We=Me.updatedSteps.map((Fe,Kt)=>`${Kt+1}. **${Fe.name}**${Fe.description&&Fe.description!==Fe.name?` — ${Fe.description}`:""}`).join(`
194`),ze=(Me.reply?`${Me.reply}
195
196Here are the updated steps:
197
198${We}`:`Done. Here are the updated steps:
199
200${We}`)+`
201
202Want to head over to the script to export it, or is there anything else you'd like to change?`;z(Fe=>Fe&&{...Fe,steps:Me.updatedSteps,history:[...ge,{role:"assistant",content:ze}]}),g(Fe=>[...Fe,{role:"assistant",content:ze,actions:[{label:"Open script to export",actionKey:`open_script_${I.sopId}`},{label:"Keep editing",actionKey:"noop"},{label:"Done editing",actionKey:"done_editing"}]}])}else{const We=Me.reply||Me.clarification||Me.message||"Could you tell me a bit more about what you'd like to change?";z(_e=>_e&&{..._e,history:[...ge,{role:"assistant",content:We}]}),g(_e=>[..._e,{role:"assistant",content:We,actions:[{label:"Done editing",actionKey:"done_editing"}]}])}}catch{g(Me=>[...Me,{role:"assistant",content:"Something went wrong. Please try again."}])}N(!1)},Oe=()=>{const V=b.trim();if(!V)return;const ge={role:"user",content:V};g(ze=>[...ze,ge]),v("");const ue=document.querySelector('[data-testid="portal-chat-input"]');if(ue&&(ue.style.height="auto",ue.style.height="38px"),I){pe(V);return}if(ae.messages.length>0&&!ae.creating){le(V);return}const Me=V.toLowerCase(),We=/\b(access|open|view|edit|review|show|find|pull up|go to|see|update|modify|change|work on|look at)\b/,_e=/\b(script|sop|workflow|process|onboarding|playbook)\b/;
202if(l.length>0&&We.test(Me)&&_e.test(Me)){const ze=ht=>ht.toLowerCase().replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim(),Fe=new Set(["access","open","view","edit","review","show","find","pull","up","go","to","see","update","modify","change","work","on","look","at","my","the","a","an","please","can","you","i","want","need","script","sop","workflow","process","and","for","of","with","that","this","onboarding","playbook","named","called"]),Kt=ze(V).split(" ").filter(ht=>ht&&!Fe.has(ht)),us=l.map(ht=>{const is=ze(ht.title||"").split(" ").filter(Boolean),Yt=new Set(is),un=Kt.filter(Di=>Yt.has(Di)).length;return{sop:ht,score:un,titleLen:is.length}}).filter(ht=>ht.score>0).sort((ht,is)=>is.score-ht.score||ht.titleLen-is.titleLen);N(!0),setTimeout(()=>{if(N(!1),us.length===0){const ht=l.slice(0,8).map(is=>`• **${is.title}**`).join(`
203`);g(is=>[...is,{role:"assistant",content:`I couldn't find a script matching that name. Here are the scripts you have saved — pick one and we can review or edit it together:
204
205${ht}`,actions:l.slice(0,6).map(Yt=>({label:Yt.title.length>32?Yt.title.substring(0,29)+"...":Yt.title,actionKey:`pick_script_${Yt.id}`}))}])}else if(us.length===1||us[0].score>=2&&us[0].score>(us[1]?.score||0)){const ht=us[0].sop;g(is=>[...is,{role:"assistant",content:`Got it — I found **${ht.title}**. Want to review it together or make changes?`,actions:[{label:"Edit this script",actionKey:`edit_script_${ht.id}`},{label:"Pick a different script",actionKey:"list_scripts"}]}])}else{const ht=us.slice(0,6),is=ht.map(Yt=>`• **${Yt.sop.title}**`).join(`
206`);g(Yt=>[...Yt,{role:"assistant",content:`I found a few scripts that could match. Which one did you mean?
207
208${is}`,actions:ht.map(un=>({label:un.sop.title.length>32?un.sop.title.substring(0,29)+"...":un.sop.title,actionKey:`edit_script_${un.sop.id}`}))}])}},400);return}if(T.analysis&&!T.scriptCreated){const ze=T.analysis.clarifyingQuestions||[],Fe=ze[T.questionIndex]||"",Kt={...T.answers,[Fe]:V},us=T.questionIndex+1;$(ht=>({...ht,answers:Kt,questionIndex:us})),us<ze.length?(N(!0),setTimeout(()=>{N(!1),g(ht=>[...ht,{role:"assistant",content:`Got it, thanks!
209
210**${ze[us]}**`,actions:[{label:"Skip remaining — create script",actionKey:"create_script_now"}]}])},500)):(N(!0),setTimeout(()=>{N(!1),g(ht=>[...ht,{role:"assistant",content:"Thanks for answering those questions! I now have enough to create your script. Let me set that up for you."}]),ie(!1)},500));return}const Re=V.toLowerCase();if(Re.includes("document")||Re.includes("upload")||Re.includes("sop")||Re.includes("file")){N(!0),setTimeout(()=>{if(N(!1),r.length>0){const ze=r.map(Fe=>`• **${Fe.fileName}**`).join(`
211`);g(Fe=>[...Fe,{role:"assistant",content:`I found ${r.length===1?"a document":`${r.length} documents`} you've already uploaded:
212
213${ze}
214
215Would you like to use one of these to create a script? Or you can upload a new document using the paperclip icon below.`,actions:[...r.slice(0,5).map(Kt=>({label:Kt.fileName.length>30?Kt.fileName.substring(0,27)+"...":Kt.fileName,actionKey:`use_existing_doc_${Kt.id}`})),{label:"Upload a new document",actionKey:"trigger_file_upload"}]}])}else g(ze=>[...ze,{role:"assistant",content:`You can upload a document right here — just click the paperclip icon below or drag and drop a file.
216
217I'll analyze it and help you turn it into a script. Supported formats: **PDF**, **Word**, **Markdown**, **Text**, **CSV**, **JSON**, **XML**, **YAML**, **RTF**, **PNG**, **JPG**`,actions:[{label:"Upload a document",actionKey:"trigger_file_upload"},{label:"How does capture work?",actionKey:"how_capture"}]}])},500);return}Se(V)},Se=async V=>{N(!0);try{if(Y){const ge=await fetch(`/api/chat/${Y}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:V})});if(ge.ok){const ue=await ge.json();N(!1),g(Me=>[...Me,{role:"assistant",content:ue.message.content,actions:[{label:"Upload a document",actionKey:"upload_docs"},{label:"Record my process",actionKey:"start_capture"},{label:"Describe what I do",actionKey:"describe_workflow"}]}]);return}}else{const ge=await fetch("/api/chat/start",{method:"POST",headers:{"Content-Type":"application/json"}});if(ge.ok){const ue=await ge.json();P(ue.conversationId);const Me=await fetch(`/api/chat/${ue.conversationId}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:V})});if(Me.ok){const We=await Me.json();N(!1),g(_e=>[..._e,{role:"assistant",content:We.message.content,actions:[{label:"Upload a document",actionKey:"upload_docs"},{label:"Record my process",actionKey:"start_capture"},{label:"Describe what I do",actionKey:"describe_workflow"}]}]);return}}}throw new Error("AI response failed")}catch{N(!1);const ge=xc.how_it_works;g(ue=>[...ue,{role:"assistant",content:ge.reply,actions:ge.actions}])}},D=V=>{V.preventDefault(),M(!1);const ge=V.dataTransfer.files?.[0];ge&&W(ge)};return S?n.jsxs("button",{"data-testid":"portal-chat-expand",onClick:()=>A(!1),className:`w-full rounded-xl border p-4 flex items-center gap-3 transition-colors text-left ${u?"bg-slate-800 border-slate-600 hover:border-slate-500":"bg-white border-warm-border hover:border-olive/30"}`,children:[n.jsx("span",{className:"w-8 h-8 rounded-full bg-olive/10 flex items-center justify-center flex-shrink-0",children:n.jsx("svg",{className:"w-4 h-4 text-olive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}),n.jsx("span",{className:"text-sm font-medium text-ink",children:"Need help getting started? Chat with your onboarding guide"}),n.jsx("svg",{className:"w-4 h-4 text-warm-gray ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}):n.jsxs("div",{"data-testid":"portal-onboarding-chat",className:`rounded-xl border overflow-hidden transition-colors ${u?"bg-slate-800":"bg-white"} ${L?"border-olive border-2 bg-olive/5":u?"border-slate-600":"border-warm-border"}`,onDragOver:V=>{V.preventDefault(),M(!0)},onDragLeave:()=>M(!1),onDrop:D,children:[n.jsxs("div",{className:`flex items-center justify-between px-5 py-3 border-b ${u?"border-slate-600 bg-slate-700/50":"border-warm-border bg-cream-light/50"}`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:`w-7 h-7 rounded-full flex items-center justify-center ${u?"bg-olive/20":"bg-olive/10"}`,children:n.jsx("svg",{className:"w-3.5 h-3.5 text-olive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}),n.jsx("span",{className:`text-sm font-semibold ${u?"text-slate-100":"text-ink"}`,children:I?"Script Editor":"Onboarding Guide"}),n.jsx("span",{className:"w-2 h-2 rounded-full bg-olive"})]}),n.jsx("button",{"data-testid":"portal-chat-collapse",onClick:()=>A(!0),className:`p-1 transition-colors ${u?"text-slate-400 hover:text-slate-200":"text-warm-gray hover:text-ink"}`,children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})})]}),L&&n.jsxs("div",{className:"px-5 py-8 text-center",children:[n.jsx("svg",{className:"w-8 h-8 text-olive mx-auto mb-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),n.jsx("p",{className:"text-sm font-medium text-olive",children:"Drop your document here"}),n.jsx("p",{className:"text-xs text-warm-gray mt-1",children:"PDF, Word, Markdown, Text, CSV, JSON, XML, YAML, RTF, PNG, or JPG"})]}),!L&&n.jsxs("div",{className:"max-h-[360px] overflow-y-auto px-5 py-4 space-y-4","data-testid":"portal-chat-messages",children:[x.map((V,ge)=>n.jsx("div",{className:`flex ${V.role==="user"?"justify-end":"justify-start"}`,children:n.jsxs("div",{className:`max-w-[85%] ${V.role==="user"?"order-1":""}`,children:[V.fileInfo&&n.jsx("div",{className:`flex items-center gap-2 mb-1 ${V.role==="user"?"justify-end":""}`,children:n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs bg-olive/10 text-olive px-2 py-1 rounded-md",children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.48
2176L20.5 13"})}),V.fileInfo.name," (",(V.fileInfo.size/1024).toFixed(0)," KB)"]})}),n.jsx("div",{className:`text-sm leading-relaxed rounded-2xl px-4 py-2.5 ${V.role==="user"?"bg-olive text-white rounded-br-md":u?"bg-slate-700 text-slate-100 rounded-bl-md":"bg-cream-light text-ink rounded-bl-md"}`,style:{whiteSpace:"pre-line"},children:V.content.split(/(\*\*[^*]+\*\*)/).map((ue,Me)=>ue.startsWith("**")&&ue.endsWith("**")?n.jsx("strong",{children:ue.slice(2,-2)},Me):n.jsx("span",{children:ue},Me))}),V.actions&&V.actions.length>0&&n.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:V.actions.map(ue=>{const Me=ue.actionKey==="start_capture";return n.jsxs("button",{"data-testid":`chat-action-${ue.actionKey}`,onClick:()=>se(ue.actionKey),className:Me?"text-xs font-semibold px-3.5 py-2 rounded-full border transition-colors flex items-center gap-1.5 bg-olive text-white border-olive hover:bg-olive-dark":`text-xs font-medium px-3 py-1.5 rounded-full border transition-colors ${u?"border-olive/30 text-olive hover:bg-olive/10":"border-olive/20 text-olive hover:bg-olive/5"}`,children:[Me&&n.jsx("span",{className:"text-[9px] uppercase tracking-wide bg-white/25 text-white px-1.5 py-0.5 rounded-full",children:"Recommended"}),ue.label]},ue.actionKey)})})]})},ge)),(k||E)&&n.jsx("div",{className:"flex justify-start",children:n.jsx("div",{className:`rounded-2xl rounded-bl-md px-4 py-3 ${u?"bg-slate-700":"bg-cream-light"}`,children:E?n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("svg",{className:"w-4 h-4 text-olive animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),n.jsx("span",{className:`text-xs ${u?"text-slate-400":"text-warm-gray"}`,children:"Analyzing your document..."})]}):n.jsxs("div",{className:"flex gap-1",children:[n.jsx("span",{className:"w-2 h-2 rounded-full bg-warm-gray animate-bounce",style:{animationDelay:"0ms"}}),n.jsx("span",{className:"w-2 h-2 rounded-full bg-warm-gray animate-bounce",style:{animationDelay:"150ms"}}),n.jsx("span",{className:"w-2 h-2 rounded-full bg-warm-gray animate-bounce",style:{animationDelay:"300ms"}})]})})}),n.jsx("div",{ref:ne})]}),n.jsx("input",{ref:q,type:"file",accept:".pdf,.doc,.docx,.png,.jpg,.jpeg,.md,.txt,.csv,.json,.xml,.yaml,.yml,.rtf",className:"hidden",onChange:V=>{const ge=V.target.files?.[0];ge&&W(ge),V.target.value=""}}),n.jsx("div",{className:`px-5 py-3 border-t ${u?"border-slate-600":"border-warm-border"}`,children:n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{"data-testid":"portal-chat-attach",onClick:()=>q.current?.click(),disabled:k||E,className:`px-2.5 py-2 border rounded-lg transition-colors disabled:opacity-40 ${u?"text-slate-400 hover:text-olive border-slate-600":"text-warm-gray hover:text-olive border-warm-border"}`,title:"Upload a document",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}),n.jsx("textarea",{"data-testid":"portal-chat-input",value:b,onChange:V=>v(V.target.value),onKeyDown:V=>{V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),Oe())},placeholder:I?"Describe what you'd like to change...":ae.messages.length>0?"Describe your process...":T.analysis&&!T.scriptCreated?"Type your answer...":"Type anything — I'll help you figure out the rest.",className:`flex-1 text-sm border rounded-lg px-3 py-2 focus:outline-none focus:ring-1 focus:ring-olive/30 focus:border-olive/30 resize-none max-h-[120px] overflow-y-auto ${u?"bg-slate-700 border-slate-600 text-slate-100 placeholder-slate-400":"bg-white border-warm-border text-ink"}`,disabled:k||E,rows:1,style:{height:"auto",minHeight:"38px"},onInput:V=>{const ge=V.target;ge.style.height="auto",ge.style.height=Math.min(ge.scrollHeight,120)+"px"}}),n.jsx("button",{"data-testid":"portal-chat-send",onClick:Oe,disabled:!b.trim()||k||E,className:"px-3 py-2 bg-olive text-white rounded-lg text-sm font-medium disabled:opacity-40 hover:bg-olive-dark transition-colors",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]})})]})}function wT(){const[t,e]=j.useState(""),[s,r]=j.useState(!0),[i,a]=j.useState(!1),[l,d]=j.useState(""),[u,m]=j.useState(!1),[p,x]=j.useState(!1),[g,b]=j.useState(null),[v,k]=j.useState(null),[N,S]=j.useState(""),[A,E]=j.useState(()=>typeof window>"u"?"":new URLSearchParams(window.location.search).get("name")||""),[_,T]=j.useState(()=>typeof window>"u"?"":new URLSearchParams(window.location.search).get("email")||""),[$,L]=j.useState(!1),[M,I]=j.useState(""),[z,ae]=j.useState(!1),[U,Y]=j.useState(!1),[P,ne]=j.useState(null),[q,W]=j.useState(!1),[ie,he]=j.useState(0),[se,B]=j.useState(()=>localStorage.getItem("wc_ext_installed")==="true"),[le,pe]=j.useState(()=>{try{return localStorage.getItem("portal_how_this_works_dismissed")==="1"}catch{return!1}}),[Oe,Se]=j.useState(null),[D,V]=j.useState(()=>typeof window<"u"&&window.location.hash.includes("import-recording=")?"sops":"overview"),[ge,ue]=j.useState(null),[Me,We]=j.useState(null),[_e,Re]=j.useState(""),[ze,Fe]=j.useState(!1),[Kt,us]=j.useState([]),[ht,is]=j.useState(null),[Yt,un]=j.useState([]),[Di,Il]=j.useState(!1),[js,Pi]=j.useState(""),[nr,Tn]=j.useState(""),[xr,Ll]=j.useState(""),[pa,Ii]=j.useState(!1),[Vn,Ks]=j.useState(()=>window.innerWidth>=768),[we,Rs]=j.useState(!1),[Zt,$l]=j.useState(""),[fa,Pu]=j.useState("all"),[Li,gr]=j.useState(null),[hs,Ys]=j.useState(null),[$r,xa]=j.useState([]),[Qt,Br]=j.useState(""),[go,hi]=j.useState(""),[bo,yo]=j.useState("feature"),[vo,Bl]=j.useState(!1),[nn,rr]=j.useState(""),[Fn,hn]=j.useState("idle"),[Un,ms]=j.useState(""),[Jt,En]=j.useState(!1),[ps,$i]=j.useState(null),[zl,ga]=j.useState(""),[rn,Ue]=j.useState("new"),[F,fe]=j.useState(null),[Ie,Et]=j.useState(()=>
217{try{return localStorage.getItem("__wc_pending_append_sop_id")||null}catch{return null}}),lt=j.useCallback(R=>{Et(R);try{R?localStorage.setItem("__wc_pending_append_sop_id",R):localStorage.removeItem("__wc_pending_append_sop_id")}catch{}},[]),[as,fs]=j.useState(null),Ut=j.useRef(!1),Ds=j.useRef(!1),wo=j.useRef(!1),[xs,ba]=j.useState(!1),[nd,jo]=j.useState(!1),[Vl,mi]=j.useState(null),[br,xp]=j.useState(null),[gp,Bi]=j.useState(null),[bp,ya]=j.useState(null),[Iu,An]=j.useState(""),[zi,va]=j.useState("editor"),[Fl,wa]=j.useState(!1),[Fb,rd]=j.useState("steps"),[zr,yp]=j.useState(null),[vp,Ul]=j.useState(null),[Lu,$u]=j.useState(null),[Ub,Vi]=j.useState(!1),[Mn,ja]=j.useState({billingContactName:"",billingEmail:"",billingPhone:""}),[id,Na]=j.useState(!1),[ka,Sa]=j.useState(""),[ad,Hl]=j.useState(!1),[ql,Vr]=j.useState(!1),Wl=[/sop-portal/i,/replit\.com/i,/workflow-capture/i];function Ca(R){return Wl.some(be=>be.test(R))}function pi(R,be){if(!R)return"";let ce=R;return ce=ce.replace(/```[\w]*\n?/g,"").replace(/```\n?/g,""),ce=ce.replace(/\/\/ Generated by .*\n?/g,""),ce=ce.split(`
218`).filter(ve=>{if(Ca(ve))return!1;if(be){const X=ve.match(/page\.goto\(['"](.+?)['"]\)/);if(X)try{return new URL(X[1]).origin!==be}catch{return!0}}return!0}).join(`
219`),ce.trim()}function Fi(R){const be=R.url||R.href||"";if(be&&Wl.some(ve=>ve.test(be)))return!0;const ce=R.name||"",J=R.code||"";return!!((R.action==="navigate"||R.type==="navigate")&&Wl.some(ve=>ve.test(ce)||ve.test(J))||J&&J.split(`
220`).every(ve=>!ve.trim()||Ca(ve)))}j.useEffect(()=>{D!=="managed-workers"&&(Ys(null),gr(null))},[D]);const _n=j.useCallback(()=>Tt("/api/portal/sop/session").then(R=>{if(!R.ok)throw new Error("no session");return R.json()}).then(ne).catch(()=>{}),[]);j.useEffect(()=>{const R=new URLSearchParams(window.location.search),be=R.get("sop_token");be&&(NK(be),window.history.replaceState(null,"",window.location.pathname+(window.location.hash||"")));const ce=R.get("invite");ce?(b(ce),Tt(`/api/portal/sop/invite/${ce}`).then(J=>J.ok?J.json():J.json().then(ve=>{throw new Error(ve.error)})).then(J=>{k(J),r(!1)}).catch(J=>{S(J.message),r(!1)})):_n().finally(()=>r(!1))},[_n]),j.useEffect(()=>{if(!P||Ds.current)return;const R=new URLSearchParams(window.location.search);if(R.get("recording_saved")!=="1")return;Ds.current=!0;const be=R.get("sopId")||null;if(V("sops"),ba(!0),xp(be),window.history.replaceState(null,"",window.location.pathname),_n(),be){fs(be),hn("processing");let ce=0;const J=async()=>{if(ce++,ce>40){hn("success"),fs(null),await _n();return}try{const ve=await Tt(`/api/portal/sop/${be}/status`,{credentials:"include"});if(ve.ok&&(await ve.json()).status!=="processing"){hn("success"),fs(null),await _n();return}setTimeout(J,3e3)}catch{setTimeout(J,3e3)}};setTimeout(J,5e3)}},[P]),j.useEffect(()=>{if(!P||wo.current)return;const R=new URLSearchParams(window.location.search);if(R.get("recording_failed")!=="1")return;wo.current=!0;const be=R.get("reason");mi(be||null),jo(!0),V("sops");const ce=window.location.hash;window.history.replaceState(null,"",window.location.pathname+(ce||""))},[P]),j.useEffect(()=>{if(!P||Ut.current)return;const R=window.location.hash;if(!R.includes("import-recording="))return;Ut.current=!0;const be=R.split("import-recording=")[1];if(!be)return;let ce;try{ce=JSON.parse(decodeURIComponent(escape(atob(be))))}catch{return}const J=De=>{const rt=De?.actionsLog||De?.steps||[],oe=De?.audio||De?.audioData||null,kt=oe?oe.startsWith("data:")?oe.split(",")[1]:oe:null,Xt=De?.code||ce.code||"",Fr=window.location.origin,Hn=pi(Xt,Fr),ko={steps:rt.length>0?rt:ce.steps||[],audio:kt,name:De?.name||ce.name||"Untitled Recording",startUrl:De?.startUrl||ce.startUrl||"",code:Hn,recordedAt:De?.recordedAt||De?.timestamp||ce.recordedAt||new Date().toISOString(),hasAudio:!!kt||!!ce.hasAudio,stepCount:rt.length||ce.stepCount||0};$i(ko),ga(ko.name),Ie?(Ue("append"),fe(Ie),lt(null)):(Ue("new"),fe(null)),En(!0),V("sops")},ve=()=>{if(window.__SC_PENDING_RECORDING)return window.__SC_PENDING_RECORDING;try{const De=localStorage.getItem("__SC_PENDING_RECORDING");if(De)return localStorage.removeItem("__SC_PENDING_RECORDING"),JSON.parse(De)}catch{}return null},X=De=>{if(De.source!==window)return;const rt=De.data||{};if(rt.type==="SC_PENDING_RECORDING"&&rt.data){window.__SC_PENDING_RECORDING=rt.data;try{localStorage.setItem("__SC_RECOVERED_RECORDING",JSON.stringify(rt.data))}catch{}}};window.addEventListener("message",X);try{window.postMessage({type:"SC_GET_PENDING_RECORDING"},"*")}catch{}const Ee=ve();if(Ee)window.removeEventListener("message",X),J(Ee);else{let De=0;const rt=setInterval(()=>{De++;try{window.postMessage({type:"SC_GET_PENDING_RECORDING"},"*")}catch{}const oe=ve();oe?(clearInterval(rt),window.removeEventListener("message",X),J(oe)):De>=10&&(clearInterval(rt),window.removeEventListener("message",X),J(ce))},500)}},[P]),j.useEffect(()=>{if(!P||Ut.current||window.location.hash.includes("import-recording="))return;let R=!1;const be=Ee=>{if(R||Ut.current)return!1;const De=Ee?.actionsLog||Ee?.steps||[];if(!Array.isArray(De)||De.length===0)return!1;Ut.current=!0,window.__SC_PENDING_RECORDING=Ee;try{localStorage.setItem("__SC_RECOVERED_RECORDING",JSON.stringify(Ee))}catch{}const rt=Ee?.audio||Ee?.audioData||null,oe=rt?rt.startsWith("data:")?rt.split(",")[1]:rt:null,kt=Ee?.name||"Untitled Recording";return $i({steps:De,audio:oe,name:kt,startUrl:Ee?.startUrl||"",code:pi(Ee?.code||"",window.location.origin),recordedAt:Ee?.recordedAt||Ee?.timestamp||new Date().toISOString(),hasAudio:!!oe,stepCount:De.length}),ga(kt),Ue("new"),fe(null),En(!0),V("sops"),!0};try{const Ee=localStorage.getItem("__SC_RECOVERED_RECORDING");if(Ee&&be(JSON.parse(Ee)))return}catch{}const ce=Ee=>{if(Ee.source!==window)return;const De=Ee.data||{};De.type==="SC_PENDING_RECORDING"&&De.data&&be(De.data)};window.addEventListener("message",ce);const J=Ee=>{if(!(Ee.key!=="__SC_RECOVERED_RECORDING"||!Ee.newValue))try{be(JSON.parse(Ee.newValue))}catch{}};window.addEventListener("storage",J);let ve=0;const X=setInterval(()=>{if(R||Ut.current||++ve>8){clearInterval(X),window.removeEventListener("message",ce);return}try{const Ee=localStorage.getItem("__SC_RECOVERED_RECORDING");if(Ee&&be(JSON.parse(Ee))){clearInterval(X),window.removeEventListener("message",ce);return}}catch{}try{window.postMessage({type:"SC_GET_PENDING_RECORDING"},"*")}catch{}},700);return()=>{R=!0,clearInterval(X),window.removeEventListener("message",ce),window.removeEventListener("storage",J)}},[P]);const wp=async()=>
220{if(!ps)return;En(!1),hn("importing");const R={...ps,name:zl};delete R.hasAudio,delete R.stepCount;const ce=rn==="append"&&F?`/api/portal/sop/${F}/append-capture`:"/api/portal/sop/capture";try{const J=await Tt(ce,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R)});if(!J.ok){const X=await J.json().catch(()=>({}));throw new Error(X.error||"Failed to import recording")}const ve=await J.json();fs(ve.sopId),hn("processing"),window.history.replaceState(null,"",window.location.pathname),delete window.__SC_PENDING_RECORDING;try{localStorage.removeItem("__SC_RECOVERED_RECORDING")}catch{}if($i(null),Ue("new"),fe(null),lt(null),_n(),ve.sopId){const X=async()=>{try{const Ee=await Tt(`/api/portal/sop/${ve.sopId}/status`,{credentials:"include"});if(Ee.ok&&(await Ee.json()).status!=="processing"){hn("success"),fs(null),await _n();return}setTimeout(X,3e3)}catch{setTimeout(X,3e3)}};setTimeout(X,5e3)}}catch(J){hn("error"),ms(J.message||"Import failed")}},Gl=async R=>{if(Iu.trim())try{(await Tt(`/api/portal/sop/${R}/rename`,{method:"PATCH",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({name:Iu.trim()})})).ok&&(await _n(),ya(null),An(""))}catch{}},od=async R=>{if(confirm("Are you sure you want to delete this script? This cannot be undone."))try{(await Tt(`/api/portal/sop/${R}`,{method:"DELETE",credentials:"include"})).ok&&(await _n(),Oe===R&&Se(null))}catch{}},Bu=j.useCallback(async()=>{try{const R=await Tt("/api/portal/sop/tickets",{credentials:"include"});R.ok&&us(await R.json())}catch{}},[]);j.useEffect(()=>{P&&D==="messages"&&Bu()},[P,D,Bu]);const an=j.useCallback(async()=>{try{const R=await Tt("/api/portal/sop/client-documents",{credentials:"include"});R.ok&&un(await R.json())}catch{}},[]);j.useEffect(()=>{P&&(D==="documents"||D==="overview"||D==="sops")&&an()},[P,D,an]);const Ta=async R=>{const be=R.target.files?.[0];if(be){Il(!0);try{const ce=new FormData;ce.append("file",be);const J=await Tt("/api/portal/sop/client-documents",{method:"POST",credentials:"include",body:ce});J.ok&&un(await J.json())}catch{}Il(!1),R.target.value=""}},ld=async R=>{try{const be=await Tt(`/api/portal/sop/client-documents/${R}`,{method:"DELETE",credentials:"include"});be.ok&&un(await be.json())}catch{}},Ea=j.useCallback(async()=>{try{const R=await Tt("/api/portal/sop/feedback",{credentials:"include"});R.ok&&xa(await R.json())}catch{}},[]);j.useEffect(()=>{P&&Ea()},[P,Ea]);const Hb=async()=>{if(Qt.trim()){Bl(!0);try{(await Tt("/api/portal/sop/feedback",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({title:Qt.trim(),description:go.trim()||null,type:bo})})).ok&&(Br(""),hi(""),yo("feature"),rr("Your idea has been submitted! Our team will review it."),setTimeout(()=>rr(""),4e3),Ea())}catch{}Bl(!1)}},zu=async()=>{if(!(!js.trim()||!nr.trim())){Ii(!0);try{const R=await Tt("/api/portal/sop/tickets",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({subject:js.trim(),message:nr.trim()})});R.ok&&(us(await R.json()),Pi(""),Tn(""))}catch{}finally{Ii(!1)}}},cd=async R=>{if(xr.trim()){Ii(!0);try{const be=await Tt(`/api/portal/sop/tickets/${R}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({message:xr.trim()})});if(be.ok){const ce=await be.json();us(J=>J.map(ve=>ve.id===R?ce:ve)),Ll("")}}catch{}finally{Ii(!1)}}},Kl=async R=>{ue(R),Fe(!0),We(null);try{const be=await Tt(`/api/portal/sop/documents/${R}/view`,{credentials:"include"});if(be.ok){const ce=await be.json();We(ce.contentHtml||"<p>Document content not available.</p>"),Re(ce.title||"Document")}else We("<p>Unable to load document.</p>")}catch{We("<p>Unable to load document.</p>")}finally{Fe(!1)}},Yl=async()=>{await Tt("/api/portal/sop/logout",{method:"POST"}),kK(),ne(null),e("")},jp=async R=>{R.preventDefault(),d(""),m(!1),a(!0);try{const be=await Tt("/api/portal/sop/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t.trim()})}),ce=await be.json();if(!be.ok)throw new Error(ce.error||"Login failed");m(!0)}catch(be){d(be.message)}finally{a(!1)}};if(!P&&s)return n.jsx("div",{className:"min-h-screen bg-cream flex items-center justify-center",children:n.jsx("div",{className:"text-warm-gray text-lg",children:"Loading portal..."})});if(g&&!P){const R=async be=>{be.preventDefault(),L(!0),S("");try{const ce=await Tt(`/api/portal/sop/invite/${g}/accept`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({name:A,email:_})});if(!ce.ok){const ve=await ce.json();throw new Error(ve.error)}const J=await ce.json();J.needsVerification?(k(null),b(null),x(!0),m(!0),window.history.replaceState(null,"","/sop-portal")):(ne(J),b(null),window.history.replaceState(null,"","/sop-portal"))}catch(ce){S(ce.message)}finally{L(!1)}};return n.jsx("div",{className:"min-h-screen bg-cream flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsx("h1",{className:"text-2xl font-black mb-1",children:"Workflow AS"}),n.jsx("p",{className:"text-[10px] text-warm-gray tracking-wide"}),n.jsx("p",{className:"text-warm-gray text-sm mt-1",children:"Client Portal"})]}),n.jsx("div",{className:"bg-white rounded-2xl border border-warm-border p-8",children:v?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"text-center mb-6",children:[n.jsx("div",{className:"w-14 h-14 bg-olive/10 rounded-full flex items-center justify-center text-2xl mx-auto mb-3",children:"✉️"}),n.jsx("h2",{"data-testid":"text-invite-heading",className:"text-xl font-bold font-serif text-ink mb-1",children:"You've Been Invited"}),n.jsxs("p",{className:"text-warm-gray text-sm",children:[v.createdBy," inv
220ited you to join ",n.jsx("span",{className:"font-semibold text-ink",children:v.companyName})," on VeraCore AI"]})]}),n.jsxs("form",{onSubmit:R,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-ink mb-1",children:"Your Name"}),n.jsx("input",{"data-testid":"input-invite-name",type:"text",value:A,onChange:be=>E(be.target.value),placeholder:"Jane Smith",required:!0,className:"w-full px-4 py-2.5 rounded-xl border border-warm-border focus:border-olive outline-none transition-all text-sm"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-ink mb-1",children:"Your Email"}),n.jsx("input",{"data-testid":"input-invite-email",type:"email",value:_,onChange:be=>T(be.target.value),placeholder:"[email protected]",required:!0,className:"w-full px-4 py-2.5 rounded-xl border border-warm-border focus:border-olive outline-none transition-all text-sm"})]}),N&&n.jsx("div",{"data-testid":"text-invite-error",className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg text-sm",children:N}),n.jsx("button",{"data-testid":"button-accept-invite",type:"submit",disabled:$,className:"w-full bg-olive hover:bg-olive-dark text-white font-medium py-2.5 rounded-full transition-colors disabled:opacity-50 text-sm",children:$?"Joining...":"Join Team"})]})]}):N?n.jsxs("div",{className:"text-center py-4",children:[n.jsx("div",{className:"w-14 h-14 bg-red-100 rounded-full flex items-center justify-center text-2xl mx-auto mb-3",children:"🔒"}),n.jsx("h2",{className:"text-xl font-bold font-serif text-ink mb-2",children:"Invalid Invite Link"}),n.jsx("p",{className:"text-warm-gray text-sm mb-6",children:N}),n.jsx("a",{href:"/sop-portal","data-testid":"link-back-to-login",className:"text-olive hover:text-olive-dark text-sm font-medium",children:"Go to sign in"})]}):n.jsx("div",{className:"text-center py-4",children:n.jsx("p",{className:"text-warm-gray",children:"Validating invite link..."})})})]})})}if(!P)return n.jsx("div",{className:"min-h-screen bg-cream flex items-center justify-center p-4",children:n.jsxs("div",{className:"w-full max-w-md",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsx("h1",{className:"text-2xl font-black mb-1",children:"Workflow AS"}),n.jsx("p",{className:"text-[10px] text-warm-gray tracking-wide"}),n.jsx("p",{className:"text-warm-gray text-sm mt-1",children:"Client Portal"})]}),n.jsx("div",{className:"bg-white rounded-2xl border border-warm-border p-8",children:u?n.jsxs("div",{className:"text-center py-4",children:[n.jsx("div",{className:"w-16 h-16 bg-olive/10 rounded-full flex items-center justify-center mx-auto mb-4",children:n.jsx("svg",{className:"w-8 h-8 text-olive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})})}),n.jsx("h2",{"data-testid":"text-magic-link-sent",className:"text-xl font-bold font-serif text-ink mb-2",children:"Check your email"}),n.jsx("p",{className:"text-warm-gray text-sm mb-1",children:"We sent a login link to"}),n.jsx("p",{className:"text-ink font-medium text-sm mb-6",children:p?_:t}),n.jsxs("p",{className:"text-warm-gray text-xs mb-4",children:["The link expires in ",p?"24 hours":"15 minutes","."]}),n.jsx("button",{"data-testid":"button-try-different-email",onClick:()=>{m(!1),x(!1),e(""),d("")},className:"text-olive hover:text-olive-dark text-sm font-medium",children:"Use a different email"})]}):n.jsxs(n.Fragment,{children:[n.jsx("h2",{"data-testid":"text-login-heading",className:"text-xl font-bold font-serif text-ink mb-1",children:"Sign In"}),n.jsx("p",{className:"text-warm-gray text-sm mb-6",children:"Enter your email and we'll send you a login link"}),n.jsxs("form",{onSubmit:jp,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-ink mb-1",children:"Email Address"}),n.jsx("input",{"data-testid":"input-email",type:"email",value:t,onChange:R=>e(R.target.value),placeholder:"[email protected]",required:!0,className:"w-full px-4 py-2.5 rounded-xl border border-warm-border focus:border-olive outline-none transition-all text-sm"})]}),l&&n.jsx("div",{"data-testid":"text-login-error",className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg text-sm",children:l}),n.jsx("button",{"data-testid":"button-login",type:"submit",disabled:i,className:"w-full bg-olive hover:bg-olive-dark text-white font-medium py-2.5 rounded-full transition-colors disabled:opacity-50 text-sm",children:i?"Sending link...":"Send me a login link"})]})]})}),n.jsx("p",{className:"text-center text-xs text-warm-gray mt-6",children:"Don't have access? Contact your VeraCore AI representative."})]})});const On=P.submissions||[],No=P.pendingDocuments||[],Vu=P.signedDocuments||[],Ui=[],Fu=P.recentActivity||[];P.team;const qb=No.length>0,Wb=Kt.filter(R=>R.status==="open"||R.status==="in_progress").length||P.openTickets||0,Np=[{key:"overview",label:"Overview",icon:"◎",tooltip:"Your home base — start here every day."},{key:"sops",label:"My Workflows",icon:"📋",tooltip:"The processes you've recorded or described — ready to review, share, and use for training."},{key:"documents",label:"Training Documents",icon:"📄",tooltip:"Any file that explains how you do something — SOPs, checklists, guides."},{key:"my-team",label:"Team",icon:"👥",tooltip:"People at your company who can use this portal."}];new Set(Np.map(R=>R.key));const kp=n.jsx(n.Fragment,{children:Jt&&ps&&n.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",onClick:()=>{En(!1),$i(null),Ue("new"),fe(null),lt(null);try{localStorage.removeItem("__SC_RECOVERED_RECORDING")}catch{}window.history.replaceState(null,"",window.location.pathname)},children:n.jsxs("div",{className:"bg-white rounded-2xl border border-warm-border w-full max-w-lg flex flex-col max-h-[80vh]",onClick:R=>R.stopPropagation(),children:[n.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-warm-border",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-olive rounded-xl flex items-center justify-center text-white font-bold text-sm",children:"VC"}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-ink",children:rn==="append"?"Add Capture to Script":"Import Recording"}),n.jsx("p",{className:"text-xs text-warm-gray",children:rn==="append"?"Append new steps to an existing script":"Review and save your workflow capture"})]})]}),n.jsx("button",{"data-testid":"btn-close-import",onClick:()=>{En(!1),$i(null),Ue("new"),fe(null),lt(null);try{localStorage.removeItem("__SC_RECOVERED_RECORDING")}catch{}window.history.replaceState(null,"",window.location.pathname)},className:"text-warm-gray hover:text-warm-gray p-1",children:n.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),n.jsxs("div",{className:"p-6 space-y-4 overflow-y-auto flex-1",children:[On.length>0&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-ink mb-1",children:"Save to"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{"data-testid":"btn-import-mode-new",onClick:()=>{Ue("new"),fe(null)},className:`flex-1 px-3 py-2 rounded-lg text-sm font-medium border transition-colors ${rn==="new"?"bg-olive/10 border-olive text-olive":"bg-white border-warm-border text-warm-gray hover:border-olive/50"}`,children:"New Script"}),n.jsx("button",{"data-testid":"btn-import-mode-append",onClick:()=>{Ue("append"),!F&&On.length>0&&fe(On[0].id)},className:`flex-1 px-3 py-2 rounded-lg text-sm font-medium border transition-colors ${rn==="append"?"bg-olive/10 border-olive text-olive":"bg-white border-warm-border text-warm-gray hover:border-olive/50"}`,children:"Add to Existing"})]})]}),rn==="append"&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-ink mb-1",children:"Select Script"}),n.jsx("select",{"data-testid":"select-append-target",value:F||"",onChange:R=>fe(R.target.value),className:"w-full border border-warm-border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-olive/20 bg-white",children:On.map(R=>n.jsx("option",{value:R.id,children:R.title},R.id))}),n.jsx("p",{className:"text-xs text-warm-gray mt-1",children:"New steps will be appended to the end of this script."})]}),rn==="new"&&n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-ink mb-1",children:"Script Name"}),n.jsx("input",{"data-testid":"input-import-name",type:"text",value:zl,onChange:R=>ga(R.target.value),className:"w-full border border-warm-border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-olive/20",placeholder:"Enter a name for this script"})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{className:"bg-cream-light rounded-lg p-3",children:[n.jsx("p",{className:"text-xs text-warm-gray mb
220-1",children:"Actions Recorded"}),n.jsx("p",{className:"text-lg font-bold text-ink",children:ps.stepCount||ps.steps?.length||0})]}),n.jsxs("div",{className:"bg-cream-light rounded-lg p-3",children:[n.jsx("p",{className:"text-xs text-warm-gray mb-1",children:"Voice Narration"}),n.jsx("div",{className:"flex items-center gap-2",children:ps.hasAudio?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),n.jsx("p",{className:"text-sm font-medium text-green-700",children:"Captured"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"w-2 h-2 bg-cream-dark rounded-full"}),n.jsx("p",{className:"text-sm font-medium text-warm-gray",children:"None"})]})})]})]}),ps.hasAudio&&ps.audio&&n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-ink mb-1",children:"Audio Preview"}),n.jsx("audio",{"data-testid":"audio-import-preview",controls:!0,className:"w-full",src:`data:audio/webm;base64,${ps.audio}`,children:"Your browser does not support audio playback."})]}),ps.hasAudio&&!ps.audio&&n.jsxs("div",{className:"bg-purple-50 border border-purple-100 rounded-lg p-3 flex items-center gap-3",children:[n.jsx("svg",{className:"text-purple-500 flex-shrink-0",width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M12 1a4 4 0 0 0-4 4v7a4 4 0 0 0 8 0V5a4 4 0 0 0-4-4zm-1 18.93V22h2v-2.07A8 8 0 0 0 20 12h-2a6 6 0 0 1-12 0H4a8 8 0 0 0 7 7.93z"})}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-purple-700",children:"Voice narration captured"}),n.jsx("p",{className:"text-xs text-purple-500",children:"Audio will be saved with your script and available for playback after creation."})]})]}),ps.startUrl&&n.jsxs("div",{className:"bg-cream-light rounded-lg p-3",children:[n.jsx("p",{className:"text-xs text-warm-gray mb-1",children:"Starting URL"}),n.jsx("p",{className:"text-sm text-ink font-mono truncate",children:ps.startUrl})]}),ps.code&&n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-ink mb-1",children:"Generated Code Preview"}),n.jsxs("pre",{className:"bg-slate-900 text-green-400 rounded-lg p-3 text-xs font-mono overflow-x-auto max-h-48 overflow-y-auto whitespace-pre-wrap",children:[ps.code.substring(0,1e3),ps.code.length>1e3?`
221
222// ... truncated ...`:""]})]}),n.jsx("div",{className:"bg-olive/10 border border-olive/30 rounded-lg p-3",children:n.jsx("p",{className:"text-xs text-olive",children:rn==="append"?"New steps will be appended to the existing script. Audio and AI analysis will be updated to include the new capture. This takes about 10-30 seconds.":"After creating, your recording will be processed automatically — steps will be detected, audio transcribed, and the workflow analyzed by AI. This takes about 10-30 seconds."})})]}),n.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-warm-border",children:[n.jsx("button",{"data-testid":"btn-cancel-import",onClick:()=>{En(!1),$i(null),Ue("new"),fe(null),lt(null);try{localStorage.removeItem("__SC_RECOVERED_RECORDING")}catch{}window.history.replaceState(null,"",window.location.pathname)},className:"px-4 py-2 text-sm text-warm-gray hover:text-ink",children:"Cancel"}),n.jsx("button",{"data-testid":"btn-confirm-import",onClick:wp,className:"bg-olive hover:bg-olive-dark text-white px-6 py-2.5 rounded-full text-sm font-semibold transition-all",children:rn==="append"?"Add to Script":"Create Script"})]})]})})}),Sp=Fn!=="idle"?n.jsxs("div",{className:"fixed bottom-4 right-4 z-[60] max-w-sm w-full shadow-lg rounded-lg",children:[Fn==="importing"&&n.jsxs("div",{"data-testid":"banner-import-progress",className:"flex items-center gap-3 bg-white border border-olive/30 rounded-lg p-4",children:[n.jsxs("svg",{className:"animate-spin h-5 w-5 text-olive",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),n.jsx("span",{className:"text-olive-dark font-medium text-sm",children:"Saving your recording..."})]}),Fn==="processing"&&n.jsxs("div",{"data-testid":"banner-import-processing",className:"flex items-center gap-3 bg-white border border-olive/30 rounded-lg p-4",children:[n.jsxs("svg",{className:"animate-spin h-5 w-5 text-olive",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),n.jsx("span",{className:"text-olive-dark font-medium text-sm",children:"Processing your recording... this takes 10-30 seconds."})]}),Fn==="success"&&n.jsxs("div",{"data-testid":"banner-import-success",className:"flex items-center gap-3 bg-green-50 border border-green-200 rounded-lg p-4",children:[n.jsx("span",{className:"text-green-800 font-medium text-sm",children:"Recording saved! It's now in your workflows."}),n.jsx("button",{onClick:()=>hn("idle"),className:"ml-auto text-green-600 hover:text-green-800 text-sm underline",children:"Dismiss"})]}),Fn==="error"&&n.jsxs("div",{"data-testid":"banner-import-error",className:"flex items-center gap-3 bg-red-50 border border-red-200 rounded-lg p-4",children:[n.jsxs("span",{className:"text-red-800 font-medium text-sm",children:["Import failed: ",Un]}),n.jsx("button",{onClick:()=>hn("idle"),className:"ml-auto text-red-600 hover:text-red-800 text-sm underline",children:"Dismiss"})]})]}):null;return P&&zG(P)?n.jsxs(n.Fragment,{children:[n.jsx(yK,{session:P,onSessionRefresh:async()=>{await _n()},onLogout:Yl}),kp,Sp]}):n.jsxs("div",{className:`h-screen flex flex-col ${we?"bg-slate-900 text-slate-100":"bg-white"}`,children:[n.jsx(JO,{email:P.contactEmail||"",emailVerified:!!P.emailVerified}),n.jsxs("div",{className:"flex flex-1 min-h-0",children:[Vn&&n.jsx("div",{className:"fixed inset-0 bg-black/40 z-40 md:hidden",onClick:()=>Ks(!1)}),n.jsxs("aside",{className:`${Vn?"w-64 translate-x-0":"w-16 -translate-x-full md:translate-x-0"} fixed md:sticky top-0 h-screen md:h-full z-50 md:z-auto flex-shrink-0 ${we?"bg-slate-800 border-slate-700":"bg-white border-warm-border"} border-r flex flex-col transition-all duration-200`,children:[n.jsxs("div",{className:`p-4 flex items-center gap-3 border-b ${we?"border-slate-700":"border-warm-border"}`,children:[n.jsx("button",{onClick:()=>Ks(!Vn),className:`${we?"text-slate-400 hover:text-slate-200":"text-warm-gray hover:text-warm-gray"} transition-colors`,"data-testid":"button-toggle-sidebar",children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),Vn&&n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:`font-black text-lg ${we?"text-white":"text-ink"}`,children:"Workflow AS"}),n.jsx("span",{className:`text-[8px] tracking-wide ${we?"text-slate-400":"text-warm-gray"}`})]})]}),n.jsxs("nav",{className:"flex-1 overflow-y-auto py-3 px-2",children:[n.jsx("div",{className:"space-y-0.5 mb-2",children:Np.map(R=>n.jsxs("button",{"data-testid":`nav-${R.key}`,title:R.tooltip,onClick:()=>{V(R.key),window.innerWidth<768&&Ks(!1)},className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm transition-colors ${D===R.key?we?"bg-blue-900/30 text-blue-400 font-semibold":"bg-olive/10 text-olive font-semibold":we?"text-slate-400 hover:bg-slate-700 hover:text-slate-200":"text-warm-gray hover:bg-cream-dark hover:text-ink"}`,children:[n.jsx("span",{className:"text-base flex-shrink-0",children:R.icon}),Vn&&n.jsx("span",{className:"flex-1 text-left",children:R.label})]},R.key))}),[{key:"automator",label:"Automator",v4:!0,icon:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 3.104v5.714a2.25 2.25 0 01-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 014.5 0m0 0v5.714a2.25 2.25 0 00.659 1.591L19 14.5M14.25 3.104c.251.023.501.05.75.082M19 14.5l-2.47 2.47a2.25 2.25 0 01-1.591.659H9.061a2.25 2.25 0 01-1.591-.659L5 14.5m14 0V17a2.25 2.25 0 01-2.25 2.25H7.25A2.25 2.25 0 015 17v-2.5"})})},{key:"playbooks",label:"Playbooks & Autom...",v4:!0,icon:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"})})},{key:"monitoring",label:"Monitoring",v4:!0,icon:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z"})})},{key:"messages",label:"Message Us",icon:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8.625 12a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0zm0 0H8.25m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0zm0 0H12m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0zm0 0h-.375M21 12c0 4.556-4.03 8.25-9 8.25a9.764 9.764 0 0 1-2.555-.337A5.972 5.972 0 0 1 5.41 20.97a5.969 5.969 0 0 1-.474-.065 4.48 4.48 0 0 0 .978-2.025c.09-.457-.133-.901-.467-1.226C3.93 16.178 3 14.189 3 12c0-4.556 4.03-8.25 9-8.25s9 3.694 9 8.25z"})}),badge:Wb||void 0,badgeColor:"bg-red-500"},{key:"human-review",label:"Human Review",v4:!0,icon:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 12.75L11.25 15 15 9.75M21 12c0 1.268-.63 2.39-1.593 3.068a3.745 3.745 0 01-1.043 3.296 3.745 3.745 0 01-3.296 1.043A3.745 3.745 0 0112 21c-1.268 0-2.39-.63
222-3.068-1.593a3.746 3.746 0 01-3.296-1.043 3.745 3.745 0 01-1.043-3.296A3.745 3.745 0 013 12c0-1.268.63-2.39 1.593-3.068a3.745 3.745 0 011.043-3.296 3.746 3.746 0 013.296-1.043A3.746 3.746 0 0112 3c1.268 0 2.39.63 3.068 1.593a3.746 3.746 0 013.296 1.043 3.746 3.746 0 011.043 3.296A3.745 3.745 0 0121 12z"})})},{key:"interaction-logs",label:"Interaction Logs",v4:!0,icon:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})},{key:"test-suites",label:"Test Suites",v4:!0,icon:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 3.104v5.714a2.25 2.25 0 01-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 014.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19 14.5M14.25 3.104c.251.023.501.05.75.082M5 14.5v4.75A2.25 2.25 0 007.25 21.5h9.5A2.25 2.25 0 0019 19.25V14.5"})})}].filter(R=>!R.v4).map(R=>n.jsxs("button",{"data-testid":`nav-${R.key}`,onClick:()=>{V(R.key),window.innerWidth<768&&Ks(!1)},className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm transition-colors ${D===R.key?we?"bg-blue-900/30 text-blue-400 font-semibold":"bg-olive/10 text-olive font-semibold":we?"text-slate-400 hover:bg-slate-700 hover:text-slate-200":"text-warm-gray hover:bg-cream-light hover:text-ink"}`,children:[n.jsx("span",{className:"flex-shrink-0 w-5 h-5",children:R.icon}),Vn&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"flex-1 text-left truncate",children:R.label}),R.badge&&R.badge>0&&n.jsx("span",{className:`text-[10px] font-bold min-w-[20px] h-[20px] flex items-center justify-center rounded-md px-1.5 text-white ${R.badgeColor||"bg-olive"}`,children:R.badge})]})]},R.key))]}),n.jsxs("div",{className:`border-t py-2 px-2 ${we?"border-slate-700":"border-warm-border"}`,children:[n.jsxs("button",{"data-testid":"nav-feedback",onClick:()=>{V("feedback"),window.innerWidth<768&&Ks(!1)},className:`w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors ${D==="feedback"?we?"bg-blue-900/30 text-blue-400 font-semibold":"bg-olive/10 text-olive font-semibold":we?"text-slate-400 hover:bg-slate-700 hover:text-slate-200":"text-warm-gray hover:bg-cream-light hover:text-ink"}`,children:[n.jsx("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.087.16 2.185.283 3.293.369V21l4.076-4.076a1.526 1.526 0 011.037-.443 48.282 48.282 0 005.68-.494c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.
222123-2.995-2.707-3.228A48.394 48.394 0 0012 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018z"})}),Vn&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"flex-1 text-left",children:"Feedback & Ideas"}),$r.length>0&&n.jsx("span",{className:"text-[10px] font-bold min-w-[20px] h-[20px] flex items-center justify-center rounded-md px-1.5 bg-cream-dark text-warm-gray",children:$r.length})]})]}),n.jsxs("button",{"data-testid":"button-dark-mode",onClick:()=>Rs(!we),className:`w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors ${we?"text-yellow-400 hover:bg-slate-700":"text-warm-gray hover:bg-cream-light hover:text-ink"}`,children:[we?n.jsx("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z"})}):n.jsx("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z"})}),Vn&&n.jsx("span",{className:"flex-1 text-left",children:we?"Light mode":"Dark mode"})]}),n.jsxs("button",{"data-testid":"nav-portal-settings",onClick:()=>{V("portal-settings"),window.innerWidth<768&&Ks(!1)},className:`w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors ${D==="portal-settings"?we?"bg-blue-900/30 text-blue-400 font-semibold":"bg-olive/10 text-olive font-semibold":we?"text-slate-400 hover:bg-slate-700 hover:text-slate-200":"text-warm-gray hover:bg-cream-light hover:text-ink"}`,children:[n.jsxs("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"}),n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),Vn&&n.jsx("span",{className:"flex-1 text-left",children:"Settings"})]}),n.jsxs("button",{"data-testid":"button-logout",onClick:Yl,className:`w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors ${we?"text-slate-400 hover:bg-slate-700 hover:text-red-400":"text-warm-gray hover:bg-cream-light hover:text-red-600"}`,children:[n.jsx("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})}),Vn&&n.jsx("span",{className:"flex-1 text-left",children:"Sign out"})]})]})]}),n.jsxs("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:[n.jsx("header",{className:`${we?"bg-slate-800 border-slate-700":"bg-white border-warm-border"} border-b px-4 md:px-6 py-4 flex items-center justify-between sticky top-0 z-10`,children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>Ks(!0),className:`md:hidden ${we?"text-slate-400 hover:text-slate-200":"text-warm-gray hover:text-ink"} transition-colors`,"data-testid":"button-mobile-menu",children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),n.jsx("h2",{className:`text-lg font-bold ${we?"text-white":"text-ink"}`,children:SK(P.companyName)})]})}),n.jsxs("main",{className:`flex-1 px-4 md:px-6 py-4 md:py-6 overflow-y-auto ${we?"bg-slate-900 portal-dark":"bg-cream-light"}`,children:[we&&n.jsx("style",{children:`
223            .portal-dark .text-ink { color: #e2e8f0 !important; }
224            .portal-dark .text-ink { color: #cbd5e1 !important; }
225            .portal-dark .text-ink { color: #94a3b8 !important; }
226            .portal-dark .text-warm-gray { color: #94a3b8 !important; }
227            .portal-dark .text-warm-gray { color: #64748b !important; }
228            .portal-dark .bg-white { background-color: #1e293b !important; }
229            .portal-dark .bg-cream-light { background-color: #0f172a !important; }
230            .portal-dark .bg-cream-dark { background-color: #1e293b !important; }
231            .portal-dark .border-warm-border { border-color: #334155 !important; }
232            .portal-dark .border-warm-border { border-color: #1e293b !important; }
233            .portal-dark .bg-olive/10 { background-color: rgba(107, 114, 68, 0.1) !important; }
234            .portal-dark .bg-green-50 { background-color: rgba(34, 197, 94, 0.1) !important; }
235            .portal-dark .bg-orange-50 { background-color: rgba(249, 115, 22, 0.1) !important; }
236            .portal-dark .bg-red-50 { background-color: rgba(239, 68, 68, 0.1) !important; }
237            .portal-dark .bg-purple-50 { background-color: rgba(168, 85, 247, 0.1) !important; }
238            .portal-dark .bg-yellow-50 { background-color: rgba(234, 179, 8, 0.1) !important; }
239            
240            .portal-dark input, .portal-dark textarea, .portal-dark select {
241              background-color: #1e293b !important;
242              border-color: #334155 !important;
243              color: #e2e8f0 !important;
244            }
245            .portal-dark input::placeholder, .portal-dark textarea::placeholder {
246              color: #64748b !important;
247            }
248          `}),D==="overview"&&n.jsxs("div",{className:"space-y-5",children:[n.jsx("h2",{"data-testid":"text-welcome",className:"text-xl font-bold text-ink",children:"Overview"}),!le&&n.jsxs("div",{"data-testid":"card-how-this-works",className:"bg-white border border-warm-border rounded-xl p-5 relative",children:[n.jsx("button",{"data-testid":"button-dismiss-how-this-works",onClick:()=>{try{localStorage.setItem("portal_how_this_works_dismissed","1")}catch{}pe(!0)},className:"absolute top-3 right-3 text-warm-gray hover:text-ink text-lg leading-none","aria-label":"Dismiss",children:"×"}),n.jsx("h3",{className:"text-base font-bold text-ink mb-3",children:"How this works"}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[{n:"1",t
248itle:"Show us your work.",body:"Record your screen, upload a how-to doc, or just describe what you do."},{n:"2",title:"We turn it into instructions.",body:"No coding — we handle the technical part."},{n:"3",title:"Share it with your team.",body:"Use it for training, onboarding, or as the single source of truth."}].map(R=>n.jsxs("div",{className:"flex gap-3 items-start",children:[n.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-olive/10 text-olive flex items-center justify-center text-sm font-bold",children:R.n}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-sm font-semibold text-ink leading-snug",children:R.title}),n.jsx("p",{className:"text-xs text-warm-gray leading-snug mt-0.5",children:R.body})]})]},R.n))})]}),n.jsx(EK,{contactName:P.contactName||"",onNavigate:(R,be)=>{V(R),be?.capture&&(W(!0),he(0)),be?.sopId&&(Se(be.sopId),va("editor"),rd("steps"))},onSessionRefresh:async()=>{const R=await Tt("/api/portal/sop/session",{credentials:"include"}).then(be=>be.json());ne(R),an()},existingDocs:Yt,editScriptContext:Lu,onClearEditContext:()=>$u(null),submissions:On,onEditScript:R=>{const be=R.captureMethod==="recording",ce=(R.workflowSteps||[]).filter(J=>!Fi(J));$u({sopId:R.id,title:R.title,isCapture:be,steps:ce}),Se(null),V("overview")},darkMode:we}),qb&&n.jsxs("div",{"data-testid":"section-pending-actions",className:"bg-cream-light border border-warm-border rounded-lg px-4 py-3",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3 mb-2",children:[n.jsx("p",{className:"text-xs font-semibold text-warm-gray uppercase tracking-wider",children:"Tasks for you"}),n.jsxs("span",{className:"text-[10px] text-warm-gray",children:[No.length," waiting"]})]}),n.jsx("div",{className:"space-y-1.5",children:No.map(R=>n.jsx(Ae,{href:`/sign/${R.accessToken}`,children:n.jsxs("div",{"data-testid":`action-sign-${R.id}`,className:"flex items-center justify-between bg-white rounded-md px-3 py-2 border border-warm-border hover:border-olive/40 transition-colors cursor-pointer",children:[n.jsxs("p",{className:"font-medium text-ink text-sm truncate",children:["Sign: ",R.title]}),n.jsx("span",{className:"text-olive text-xs font-medium whitespace-nowrap ml-3",children:"Open →"})]})},R.id))})]})]}),D==="sops"&&!Oe&&n.jsxs("div",{className:"space-y-6",children:[Fn==="importing"&&n.jsxs("div",{"data-testid":"banner-import-progress",className:"flex items-center gap-3 bg-olive/10 border border-olive/30 rounded-lg p-4",children:[n.jsxs("svg",{className:"animate-spin h-5 w-5 text-olive",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),n.jsx("span",{className:"text-olive-dark font-medium",children:"Saving your recording..."})]}),Fn==="processing"&&n.jsxs("div",{"data-testid":"banner-import-processing",className:"bg-olive/10 border border-olive/30 rounded-lg p-4",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n.jsxs("svg",{className:"animate-spin h-5 w-5 text-olive",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),n.jsx("span",{className:"text-olive-dark font-medium",children:"Processing your recording..."})]}),n.jsxs("div",{className:"ml-8 space-y-1",children:[n.jsx("p",{className:"text-xs text-olive",children:"Detecting workflow steps..."}),n.jsx("p",{className:"text-xs text-olive",children:"Transcribing voice narration..."}),n.jsx("p",{className:"text-xs text-olive",children:"Analyzing workflow intent..."}),n.jsx("p",{className:"text-xs text-olive/70",children:"This may take 10-30 seconds depending on recording length."})]})]}),Fn==="success"&&n.jsxs("div",{"data-testid":"banner-import-success",className:"flex items-center gap-3 bg-green-50 border border-green-200 rounded-lg p-4",children:[n.jsx("svg",{className:"h-5 w-5 text-green-600",viewBox:"0 0 20 20",fill:"currentColor",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),n.jsx("span",{className:"text-green-800 font-medium",children:"Recording processed! Steps, transcript, and analysis are ready."}),n.jsx("button",{onClick:()=>hn("idle"),className:"ml-auto text-green-600 hover:text-green-800 text-sm underline",children:"Dismiss"})]}),Fn==="error"&&n.jsxs("div",{"data-testid":"banner-import-error",className:"flex items-center gap-3 bg-red-50 border border-red-200 rounded-lg p-4",children:[n.jsx("svg",{className:"h-5 w-5 text-red-600",viewBox:"0 0 20 20",fill:"currentColor",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),n.jsxs("span",{className:"text-red-800 font-medium",children:["Import failed: ",Un]}),n.jsx("button",{onClick:()=>hn("idle"),className:"ml-auto text-red-600 hover:text-red-800 text-sm underline",children:"Dismiss"})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h2",{"data-testid":"text-sop-heading",className:"text-xl font-bold text-ink",children:"My Scripts"}),n.jsx("p",{className:"text-warm-gray text-sm",children:"Manage and monitor your automation scripts."})]}),n.jsxs("button",{"data-testid":"button-record-workflow",onClick:()=>{W(R=>!R),se||he(0)},className:"bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors flex items-center gap-2",children:[n.jsx("span",{className:"w-2 h-2 bg-white rounded-full animate-pulse"}),"Record Script"]})]}),q&&se&&n.jsxs("div",{"data-testid":"section-ready-to-record",className:"bg-white rounded-xl border border-warm-border overflow-hidden",children:[Ie&&(()=>{const R=On.find(be=>be.id===Ie);return R?n.jsxs("div",{className:"px-6 py-3 bg-blue-50 border-b border-blue-200 flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 text-blue-600 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:n.jsx("path",{d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),n.jsxs("p",{className:"text-sm text-blue-800",children:["Adding capture to: ",n.jsx("strong",{children:R.title})]}),n.jsx("button",{onClick:()=>lt(null),className:"ml-auto text-xs text-blue-600 hover:text-blue-800 underline",children:"Cancel"})]}):null})(),n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-warm-border",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-9 h-9 bg-olive/10 rounded-lg flex items-center justify-center",children:n.jsx("svg",{className:"w-5 h-5 text-olive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-ink text-base",children:"Extension Installed — Ready to Record"}),n.jsx("p",{className:"text-warm-gray text-xs",children:Ie?"Record additional steps to add to your script":"Follow these steps to record your process"})]})]}),n.jsx("button",{onClick:()=>W(!1),className:"text-warm-gray hover:text-warm-gray p-1",children:n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-6 py-5 space-y-4",children:[n.jsxs("ol",{className:"text-sm text-ink space-y-3 list-decimal list-inside",children:[n.jsxs("li",{children:["Click the ",n.jsx("strong",{children:"Workflow Capture extension icon"})," in your Chrome toolbar (top-right of your browser)"]}),n.jsxs("li",{children:["Hit ",n.jsx("strong",{children:'"Start Recording"'})]}),n.jsxs("li",{children:["Go to the website where you do your work and perform the task — ",n.jsx("strong",{children:"talk out loud"})," describing each step as you go"]}),n.jsxs("li",{children:["When finished, click the extension icon again and hit ",n.jsx("strong",{children:'"Stop & Save to Portal"'})]})]}),n.jsxs("div",{className:"bg-olive/10 border border-olive/30 rounded-lg p-3 flex items-start gap-2",children:[n.jsxs("svg",{className:"w-4 h-4 text-olive flex-shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"12 6 12 12 16 14"})]}),n.jsxs("p",{className:"text-xs text-olive leading-relaxed",children:[n.jsx("strong",{children:"Keep recordings under 5 minutes."})," If a task takes longer, break it into separate recordings."]})]}),n.jsxs("div",{className:"border-t border-warm-border pt-3 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[10px] uppercase tracking-wider text-warm-gray font-semibold",children:"Portal URL"}),n.jsx("code",{className:"text-xs text-warm-gray bg-cream-dark px-2 py-0.5 rounded border border-warm-border",children:window.location.origin}),n.jsx("button",{onClick:()=>navigator.clipboard.writeText(window.location.origin),className:"text-warm-gray hover:text-warm-gray p-1 rounded hover:bg-cream-dark transition-colors",title:"Copy URL",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),n.jsx("button",{onClick:()=>{B(!1),localStorage.removeItem("wc_ext_installed"),he(0)},className:"text-xs text-warm-gray hover:text-warm-gray underline",children:"Re-install extension"})]})]})]}),q&&!se&&(()=>{const R=[{title:"Download the extension file",content:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("p",{className:"text-sm text-warm-gray leading-relaxed",children:["Click the green button below. A file called ",n.jsx("strong",{children:"Workflow-Capture.zip"})," will save to your computer."]}),n.jsxs("a",{href:"/Workflow-Capture.zip",download:!0,className:"inline-flex items-center gap-2 bg-olive hover:bg-olive-dark text-white px-5 py-2.5 rounded-lg text-sm font-semibold transition-colors",children:[n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n.jsx("polyline",{points:"7 10 12 15 17 10"}),n.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),"Download Extension"]}),n.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3",children:[n.jsx("p",{className:"text-xs text-amber-900 leading-relaxed font-medium",children:"After downloading — unzip the file:"}),n.jsxs("ol",{className:"text-xs text-amber-800 leading-relaxed list-decimal list-inside mt-1 space-y-1",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Mac:"}),' Open Finder → click "Downloads" on the left → find ',n.jsx("strong",{children:"Workflow-Capture.zip"})," → double-click it"]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Windows:"}),' Open File Explorer → click "Downloads" on the left → right-click ',n.jsx("strong",{children:"Workflow-Capture.zip"}),' → "Extract All"']}),n.jsxs("li",{children:["You'll now see a folder called ",n.jsx("strong",{children:"Workflow-Capture"})," — don't move it, you'll need it in Step 3"]})]})]})]}),images:[]},{title:"Go to Manage Extensions and turn on Developer Mode",content:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:n.jsxs("p",{className:"text-xs text-red-800 leading-relaxed",children:[n.jsx("strong",{children:"Not the puzzle piece!"})," If you click the puzzle piece icon (🧩) in Chrome's toolbar, you'll see the popup below — that's ",n.jsx("em",{children:"not"})," the right place. You need the full Extensions settings page."]})}),n.jsx("img",{src:"/guide/step2-puzzle-popup.png",alt:"This is NOT the right page",className:"rounded-lg border-2 border-red-300 mx-auto",style:{maxWidth:"200px",height:"auto"}}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-lg p-4",children:[n.jsx("p",{className:"text-sm text-ink font-semibold mb-3",children:"Here's how to get to the right page:"}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"A"}),n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["Look at the ",n.jsx("strong",{children:"very top-right"})," of your Chrome window. You'll see ",n.jsx("strong",{children:"three vertical dots"})," (⋮). Click them."]}),n.jsxs("div",{className:"mt-2 inline-flex items-center gap-1 bg-cream-dark rounded-lg px-3 py-2",children:[n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("div",{className:"w-1 h-1 bg-warm-gray rounded-full"}),n.jsx("div",{className:"w-1 h-1 bg-warm-gray rounded-full"}),n.jsx("div",{className:"w-1 h-1 bg-warm-gray rounded-full"})]}),n.jsx("span",{className:"text-xs text-warm-gray ml-2",children:"← Click this icon"})]})]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"B"}),n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["A big menu opens. Look for ",n.jsx("strong",{children:'"Extensions"'})," and hover over it. A sub-menu appears — click ",n.jsx("strong",{children:'"Manage Extensions"'}),"."]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"C"}),n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["You're now on the Extensions settings page. Look at the ",n.jsx("strong",{children:"top-right corner"})," of this page — there's a toggle switch labeled ",n.jsx("strong",{children:'"Developer mode"'}),"."]}),n.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 bg-cream-dark rounded-lg px-3 py-2",children:[n.jsx("span",{className:"text-xs text-warm-gray",children:"Developer mode"}),n.jsx("div",{className:"w-9 h-5 bg-cream-dark rounded-full relative cursor-pointer",children:n.jsx("div",{className:"absolute left-0.5 top-0.5 w-4 h-4 bg-white rounded-full"})}),n.jsx("span",{className:"text-xs text-warm-gray",children:"OFF"})]}),n.jsx("span",{className:"text-lg",children:"→"}),n.jsxs("div",{className:"flex items-center gap-2 bg-olive/10 rounded-lg px-3 py-2 border border-olive/20",children:[n.jsx("span",{className:"text-xs text-olive font-medium",children:"Developer mode"}),n.jsx("div",{className:"w-9 h-5 bg-olive rounded-full relative",children:n.jsx("div",{className:"absolute right-0.5 top-0.5 w-4 h-4 bg-white rounded-full"})}),n.jsx("span",{className:"text-xs text-olive font-medium",children:"ON ✓"})]})]}),n.jsx("p",{className:"text-xs text-warm-gray mt-2",children:"Click the toggle to turn it ON (it will slide right and turn blue). This tells Chrome to allow custom extension files."})]})]})]})]})]}),images:[dN]},{title:"Click 'Load unpacked' and select the folder",content:n.jsxs("div",{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-warm-gray leading-relaxed",children:"After turning on Developer Mode, three new buttons appear at the top of the page. You only need one of them."}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-lg p-4 space-y-4",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",
248{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"A"}),n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["Click the ",n.jsx("strong",{children:'"Load unpacked"'})," button — it's in the ",n.jsx("strong",{children:"top-left area"})," of the page."]}),n.jsxs("div",{className:"mt-2 inline-flex items-center gap-2",children:[n.jsx("div",{className:"bg-white border border-warm-border rounded px-3 py-1.5 text-xs font-medium text-ink",children:"Load unpacked"}),n.jsx("span",{className:"text-xs text-warm-gray",children:"← Click this button"})]})]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"B"}),n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["A file browser window pops up. Navigate to your ",n.jsx("strong",{children:"Downloads"})," folder and find the ",n.jsx("strong",{children:"Workflow-Capture"})," folder you unzipped in Step 1."]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"C"}),n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:[n.jsx("strong",{children:"Click once"})," on the Workflow-Capture folder to highlight it (don't double-click into it). Then click:"]}),n.jsxs("ul",{className:"text-xs text-warm-gray mt-1 space-y-0.5 list-disc list-inside",children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Windows:"}),' Click "Select Folder"']}),n.jsxs("li",{children:[n.jsx("strong",{children:"Mac:"}),' Click "Open"']})]})]})]})]}),n.jsxs("div",{className:"bg-olive/10 border border-olive/20 rounded-lg p-3 flex items-start gap-2",children:[n.jsx("svg",{className:"w-4 h-4 text-olive flex-shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),n.jsxs("p",{className:"text-xs text-olive-dark leading-relaxed",children:[n.jsx("strong",{children:"You'll know it worked"}),' when you see a "Workflow Capture" card appear on the extensions page, and a new icon appears in your browser toolbar at the top of Chrome.']})]})]}),images:[uN,hN]},{title:"Allow microphone access",content:n.jsxs("div",{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-warm-gray leading-relaxed",children:"The extension records your voice as you walk through a task, so Chrome needs your permission to use the microphone."}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-lg p-4 space-y-4",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"A"}),n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["Now you ",n.jsx("em",{children:"can"})," click the ",n.jsx("strong",{children:"puzzle piece icon"})," (🧩) in the top-right of Chrome. Find ",n.jsx("strong",{children:'"Workflow Capture"'})," in the list and click it."]}),n.jsx("p",{className:"text-xs text-warm-gray mt-1",children:"Tip: Click the pin icon next to it so it stays visible in your toolbar."})]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"B"}),n.jsxs("p",{className:"text-sm text-ink leading-relaxed",children:["A small popup opens. Click the ",n.jsx("strong",{children:'"Test Microphone"'})," button."]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-olive text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:"C"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm text-ink leading-relaxed",children:"Chrome shows a permission popup at the top of the page:"}),n.jsxs("div",{className:"mt-2 bg-cream-dark rounded-lg px-3 py-2 flex items-center gap-3",children:[n.jsx("span",{className:"text-xs text-warm-gray",children:'"...wants to use your microphone"'}),n.jsx("div",{className:"bg-olive text-white px-2 py-0.5 rounded text-xs font-medium",children:"Allow"}),n.jsx("div",{className:"bg-cream-dark text-warm-gray px-2 py-0.5 rounded text-xs",children:"Block"})]}),n.jsxs("p",{className:"text-xs text-warm-gray mt-2",children:["Click ",n.jsx("strong",{children:'"Allow"'}),". The tab will close automatically once permission is granted."]})]})]})]}),n.jsxs("div",{className:"bg-olive/10 border border-olive/20 rounded-lg p-3",children:[n.jsx("p",{className:"text-xs text-olive-dark leading-relaxed font-medium",children:"You're all set! Here's how to record a workflow:"}),n.jsxs("ol",{className:"text-xs text-olive leading-relaxed list-decimal list-inside mt-1 space-y-1",children:[n.jsx("li",{children:"Click the Workflow Capture extension icon"}),n.jsxs("li",{children:["Hit ",n.jsx("strong",{children:'"Start Recording"'})]}),n.jsx("li",{children:"Go to the website where you do your work and perform the task — talk out loud describing what you're doing"}),n.jsxs("li",{children:["When finished, click the extension icon again and hit ",n.jsx("strong",{children:'"Stop & Save to Portal"'})]}),n.jsx("li",{children:"Your recorded workflow will appear here in your Scripts page"})]}),n.jsx("p",{className:"text-xs text-olive mt-2 italic",children:"Tip: Keep re
248cordings under 5 minutes. If a task is longer, break it into separate recordings."})]})]}),images:[cN,mN]}];return n.jsxs("div",{"data-testid":"section-capture-guide",className:"bg-white rounded-xl border border-warm-border overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-warm-border",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-9 h-9 bg-olive/10 rounded-lg flex items-center justify-center",children:n.jsx("svg",{className:"w-5 h-5 text-olive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"})})}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-ink text-base",children:"Set Up the Workflow Capture Extension"}),n.jsx("p",{className:"text-warm-gray text-xs",children:"4 quick steps — takes about 2 minutes"})]})]}),n.jsx("button",{"data-testid":"button-close-guide",onClick:()=>W(!1),className:"text-warm-gray hover:text-warm-gray p-1",children:n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsx("div",{className:"divide-y divide-warm-border",children:R.map((be,ce)=>{const J=(ie||0)>ce,ve=(ie||0)===ce;return n.jsxs("div",{"data-testid":`guide-step-${ce+1}`,className:`transition-all ${ve?"bg-cream-light":""}`,children:[n.jsxs("button",{onClick:()=>he(ve?-1:ce),className:"w-full flex items-center gap-3 px-6 py-3.5 text-left hover:bg-cream-light transition-colors",children:[J?n.jsx("div",{className:"w-7 h-7 rounded-full bg-olive/10 flex items-center justify-center flex-shrink-0",children:n.jsx("svg",{className:"w-4 h-4 text-olive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}):n.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0 text-xs font-bold ${ve?"bg-olive text-white":"bg-cream-dark text-warm-gray"}`,children:ce+1}),n.jsx("span",{className:`flex-1 text-sm font-medium ${J?"text-warm-gray line-through":"text-ink"}`,children:be.title}),n.jsx("svg",{className:`w-4 h-4 text-warm-gray transition-transform flex-shrink-0 ${ve?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),ve&&n.jsxs("div",{className:"px-6 pb-5 pl-16",children:[n.jsx("div",{className:"mb-3",children:be.content}),be.images.length>0&&n.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:be.images.map((X,Ee)=>n.jsx("img",{src:X,alt:`Step ${ce+1} reference`,className:"rounded-lg border border-warm-border",style:{maxWidth:"300px",height:"auto"}},Ee))}),n.jsxs("button",{"data-testid":`button-done-step-${ce+1}`,onClick:()=>he(ce+1),className:"text-sm font-medium text-olive hover:text-olive flex items-center gap-1 transition-colors",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Done — next step"]})]})]},ce)})}),(ie||0)>=R.length&&n.jsxs("div",{className:"px-6 py-5 bg-olive/10 border-t border-olive/20 text-center",children:[n.jsx("p",{className:"text-sm font-semibold text-olive-dark mb-1",children:"You're all set!"}),n.jsx("p",{className:"text-xs text-olive mb-3",children:'Click the extension icon and hit "Start Recording" to capture your first workflow.'}),n.jsx("button",{"data-testid":"button-finish-setup",onClick:()=>{B(!0),localStorage.setItem("wc_ext_installed","true"),W(!1)},className:"bg-olive hover:bg-olive-dark text-white px-5 py-2 rounded-lg text-sm font-semibold transition-colors",children:"Got it — I'm ready to record"})]}),n.jsxs("div",{className:"px-6 py-3 border-t border-warm-border bg-cream-light flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[10px] uppercase tracking-wider text-warm-gray font-semibold",children:"Portal URL"}),n.jsx("code",{className:"text-xs text-warm-gray bg-white px-2 py-0.5 rounded border border-warm-border",children:window.location.origin}),n.jsx("button",{"data-testid":"button-copy-portal-url",onClick:()=>{navigator.clipboard.writeText(window.location.origin)},className:"text-warm-gray hover:text-warm-gray p-1 rounded hover:bg-white transition-colors",title:"Copy URL",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),n.jsx("span",{className:"text-[10px] text-warm-gray",children:"Paste into extension Settings"})]})]})})(),l&&n.jsx("div",{"data-testid":"text-upload-error",className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg text-sm",children:l}),On.length>0&&n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:On.map(R=>{R.workflowSteps;const be=R.aiSummary,ce=R.status==="processing";return n.jsxs("div",{"data-testid":`card-script-${R.id}`,className:"bg-white rounded-xl border border-warm-border flex flex-col",children:[n.jsx("div",{className:"h-1 bg-green-500 w-full rounded-t-xl"}),n.jsxs("div",{className:"p-5 flex-1 flex flex-col",children:[n.jsxs("div",{className:"flex items-start justify-between mb-2",children:[bp===R.id?n.jsxs("div",{className:"flex-1 mr-2",children:[n.jsx("input",{"data-testid":`input-rename-${R.id}
248`,type:"text",value:Iu,onChange:J=>An(J.target.value),onKeyDown:J=>{J.key==="Enter"&&Gl(R.id),J.key==="Escape"&&ya(null)},className:"w-full border border-warm-border rounded px-2 py-1 text-sm font-semibold focus:outline-none focus:ring-2 focus:ring-olive/20",autoFocus:!0}),n.jsxs("div",{className:"flex gap-1 mt-1",children:[n.jsx("button",{onClick:()=>Gl(R.id),className:"text-xs text-olive hover:text-olive-dark font-medium",children:"Save"}),n.jsx("button",{onClick:()=>ya(null),className:"text-xs text-warm-gray hover:text-warm-gray",children:"Cancel"})]})]}):n.jsx("h3",{className:"font-semibold text-ink",children:R.title}),R.contactName&&(P.contacts||[]).length>1&&n.jsxs("span",{className:"text-xs text-warm-gray",children:["by ",R.contactName]}),n.jsxs("div",{className:"relative flex-shrink-0",children:[n.jsx("button",{"data-testid":`btn-script-menu-${R.id}`,onClick:J=>{J.stopPropagation(),Bi(gp===R.id?null:R.id)},className:"text-warm-gray hover:text-warm-gray p-1 rounded hover:bg-cream-dark",children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[n.jsx("circle",{cx:"12",cy:"5",r:"2"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"}),n.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}),gp===R.id&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-30",onClick:J=>{J.stopPropagation(),Bi(null)}}),n.jsxs("div",{className:"absolute right-0 top-8 bg-white rounded-lg border border-warm-border shadow-lg py-1 z-40 w-40",style:{bottom:"auto"},ref:J=>{J&&J.getBoundingClientRect().bottom>window.innerHeight&&(J.style.top="auto",J.style.bottom="100%",J.style.marginBottom="4px")},onClick:J=>J.stopPropagation(),children:[n.jsxs("button",{"data-testid":`btn-view-edit-${R.id}`,onClick:()=>{Bi(null),Se(R.id),va("editor"),rd("steps")},className:"w-full text-left px-4 py-2 text-sm text-ink hover:bg-cream-light flex items-center gap-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"View & Edit"]}),n.jsxs("button",{"data-testid":`btn-rename-${R.id}`,onClick:()=>{Bi(null),ya(R.id),An(R.title)},className:"w-full text-left px-4 py-2 text-sm text-ink hover:bg-cream-light flex items-center gap-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Rename"]}),n.jsxs("button",{"data-testid":`btn-add-capture-${R.id}`,onClick:()=>{Bi(null),lt(R.id),W(!0),se||he(0)},className:"w-full text-left px-4 py-2 text-sm text-ink hover:bg-cream-light flex items-center gap-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"16"}),n.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),"Add Capture"]}),n.jsxs("button",{"data-testid":`btn-delete-${R.id}`,onClick:()=>{Bi(null),od(R.id)},className:"w-full text-left px-4 py-2 text-sm text-red-600 hover:bg-red-50 flex items-center gap-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),"Delete Script"]})]})]})]})]}),n.jsx("p",{className:"text-sm text-warm-gray italic mb-3 line-clamp-1",children:be?.whatItDoes||R.description||"No description"}),ce&&n.jsxs("div",{className:"flex items-center gap-2 text-xs text-purple-600 mb-3",children:[n.jsxs("svg",{className:"animate-spin h-3 w-3",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Processing..."]}),!ce&&R.captureMethod==="recording"&&!R.audioTranscript&&!R.audioUrl&&n.jsx("div",{"data-testid":`note-no-audio-${R.id}`,className:"bg-amber-50 border border-amber-200 rounded-lg px-3 py-2 mb-3",children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("svg",{className:"text-amber-500 flex-shrink-0 mt-0.5",width:"14",height:"14",viewBox:"0 0 24 24",fill:"
248currentColor",children:n.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),n.jsx("p",{className:"text-xs text-amber-800 leading-relaxed",children:"No audio was captured in this recording. Please make sure your browser has microphone permissions enabled before your next recording."})]})})]}),n.jsx("div",{className:"px-5 pb-5",children:n.jsx("button",{"data-testid":`btn-manage-${R.id}`,onClick:()=>{Se(R.id),va("editor"),rd("steps")},className:"w-full bg-cream-dark hover:bg-cream-dark text-ink font-medium py-2.5 rounded-lg text-sm transition-colors",children:"Manage"})})]},R.id)})}),On.length===0&&n.jsxs("div",{"data-testid":"section-no-submissions",className:"bg-white rounded-xl border border-warm-border p-12 text-center",children:[n.jsx("div",{className:"text-4xl mb-4",children:"🎬"}),n.jsx("h3",{className:"text-lg font-semibold text-ink mb-2",children:"No Scripts Yet"}),n.jsx("p",{className:"text-warm-gray text-sm max-w-md mx-auto mb-4",children:'Use the Workflow Capture extension to record your browser workflows with voice narration. Click "Record Script" above to get started.'}),n.jsx("button",{"data-testid":"button-show-guide-empty",onClick:()=>{W(!0),he(0)},className:"bg-olive hover:bg-olive-dark text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors",children:"Get Started"})]})]}),D==="sops"&&Oe&&(()=>{const R=On.find(J=>J.id===Oe);if(!R)return null;const be=R.workflowSteps,ce=R.aiSummary;return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("button",{"data-testid":"btn-back-to-scripts",onClick:()=>Se(null),className:"text-warm-gray hover:text-warm-gray p-1 mt-1 flex-shrink-0",children:n.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("h2",{className:"text-xl md:text-2xl font-bold text-ink break-words",children:R.title}),n.jsx("span",{className:"px-2.5 py-0.5 rounded-full text-xs font-semibold bg-green-100 text-green-700 flex-shrink-0",children:"ACTIVE"})]}),n.jsxs("p",{className:"text-xs text-warm-gray mt-1","data-testid":"text-script-created-date",children:["Created ",new Date(R.createdAt||R.requestedAt).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})]})]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsxs("button",{"data-testid":"btn-add-capture-detail",onClick:()=>{lt(R.id),Se(null),W(!0),se||he(0)},className:"inline-flex items-center gap-1.5 px-3.5 py-2 text-sm font-medium text-ink bg-cream-dark border border-warm-border rounded-lg hover:bg-cream-dark/80 transition-colors",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"16"}),n.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),"Add Capture"]}),n.jsxs("button",{"data-testid":"btn-edit-steps",onClick:()=>{const J=R.captureMethod==="recording",ve=(R.workflowSteps||[]).filter(X=>!Fi(X));$u({sopId:R.id,title:R.title,isCapture:J,steps:ve}),Se(null),V("overview")},className:"inline-flex items-center gap-1.5 px-4 py-2.5 text-sm font-semibold text-white bg-olive border border-olive rounded-lg hover:bg-olive-dark transition-colors shadow-sm",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit Steps"]})]})]}),n.jsx("div",{className:"overflow-x-auto -mx-4 md:mx-0 px-4 md:px-0",children:n.jsxs("div",{className:"flex items-center border-b border-warm-border min-w-max",children:[n.jsxs("button",{"data-testid":"tab-editor",onClick:()=>va("editor"),className:`px-4 md:px-5 py-3 text-sm font-medium border-b-2 transition-colors flex items-center gap-2 whitespace-nowrap ${zi==="editor"?"border-olive text-olive":"border-transparent text-warm-gray hover:text-ink"}`,children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]}),"Editor"]}),n.jsxs("button",{"data-testid":"tab-voice-detail",onClick:()=>va("voice"),className:`px-4 md:px-5 py-3 text-sm font-medium border-b-2 transition-colors flex items-center gap-2 whitespace-nowrap ${zi==="voice"?"border-olive text-olive":"border-transparent text-warm-gray hover:text-ink"}`,children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"
248currentColor",children:n.jsx("path",{d:"M12 1a4 4 0 0 0-4 4v7a4 4 0 0 0 8 0V5a4 4 0 0 0-4-4zm-1 18.93V22h2v-2.07A8 8 0 0 0 20 12h-2a6 6 0 0 1-12 0H4a8 8 0 0 0 7 7.93z"})}),"Voice Annotation"]}),(R.fileId||R.captureMethod==="document_chat")&&n.jsxs("button",{"data-testid":"tab-documents",onClick:()=>va("documents"),className:`px-5 py-3 text-sm font-medium border-b-2 transition-colors flex items-center gap-2 ${zi==="documents"?"border-olive text-olive":"border-transparent text-warm-gray hover:text-ink"}`,children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]}),"Documents"]}),n.jsxs("button",{"data-testid":"btn-export-script",onClick:()=>{const J=R.workflowSteps,ve=R.aiSummary;let X=`# ${R.title}
249
250`;if(X+=`| Field | Value |
251|---|---|
252`,X+=`| **Created** | ${new Date(R.createdAt).toISOString().replace("T"," ").replace(/\.\d+Z$/," UTC")} |
253`,R.receivedAt&&(X+=`| **Last updated** | ${new Date(R.receivedAt).toISOString().replace("T"," ").replace(/\.\d+Z$/," UTC")} |
254`),X+=`
255`,ve&&(X+=`## Workflow Intent
256
257`,ve.whatItDoes&&(X+=`**What:** ${ve.whatItDoes}
258
259`),ve.whyItExists&&(X+=`**Why:** ${ve.whyItExists}
260
261`),ve.purpose&&!ve.whatItDoes&&(X+=`**Purpose:** ${ve.purpose}
262
263`),ve.decisionPoints&&ve.decisionPoints.length>0&&(X+=`**Conditions evaluated:**
264`,ve.decisionPoints.forEach(oe=>{X+=`- ${oe}
265`}),X+=`
266`),ve.eligibilityConditions&&ve.eligibilityConditions.length>0&&(X+=`## Eligibility / Scope Gates
267
268`,X+=`> These conditions must be true before processing begins.
269
270`,ve.eligibilityConditions.forEach(oe=>{X+=`- ${oe}
271`}),X+=`
272`),ve.requiredTemplates&&ve.requiredTemplates.length>0&&(X+=`## Required Note Templates
273
274`,ve.requiredTemplates.forEach(oe=>{X+=`### ${oe.name}
275`,X+=`**When used:** ${oe.whenUsed}
276
277`,X+=`\`\`\`
278${oe.exactText}
279\`\`\`
280
281`})),ve.escalationPaths&&ve.escalationPaths.length>0&&(X+=`## Escalation / Fallback Paths
282
283`,X+=`> When the automation must stop or hand off to a human.
284
285`,ve.escalationPaths.forEach(oe=>{X+=`- **Trigger:** ${oe.trigger}
286`,X+=`  - **Action:** ${oe.action}
287`,oe.notes&&(X+=`  - **Notes:** ${oe.notes}
288`),X+=`
289`})),ve.terminalOutcomes&&ve.terminalOutcomes.length>0&&(X+=`## Terminal Outcomes
290
291`,X+=`> Every possible end state and what must happen for each.
292
293`,ve.terminalOutcomes.forEach(oe=>{X+=`### ${oe.outcome}
294`,X+=`- **Criteria:** ${oe.criteria}
295`,X+=`- **Required actions:** ${oe.requiredActions}
296
297`})),ve.uncertaintyHandling&&ve.uncertaintyHandling.length>0&&(X+=`## Uncertainty Handling
298
299`,X+=`> What to do when information is missing, ambiguous, or unexpected.
300
301`,ve.uncertaintyHandling.forEach(oe=>{X+=`- ${oe}
302`}),X+=`
303`),ve.processInsights)){const oe=ve.processInsights;(oe.frequency||oe.isLooped||oe.estimatedVolume||oe.painPoints&&oe.painPoints.length>0||oe.exceptions&&oe.exceptions.length>0)&&(X+=`## Process Insights
304
305`,oe.frequency&&(X+=`- **Frequency:** ${oe.frequency}
306`),oe.isLooped&&(X+=`- **Repeating:** ${oe.loopDescription||"Yes"}
307`),oe.estimatedVolume&&(X+=`- **Volume:** ${oe.estimatedVolume}
308`),oe.painPoints?.length>0&&oe.painPoints.forEach(Xt=>{X+=`- **Pain point:** ${Xt}
309`}),oe.exceptions?.length>0&&oe.exceptions.forEach(Xt=>{X+=`- **Exception:** ${Xt}
310`}),X+=`
311`)}{const oe=R.fileId?Yt.find(kt=>kt.id===R.fileId):null;oe&&(X+=`## Source Document
312
313`,X+=`| Field | Value |
314|---|---|
315`,X+=`| **File** | ${oe.fileName} |
316`,X+=`| **Uploaded** | ${new Date(oe.createdAt).toISOString().replace("T"," ").replace(/\.\d+Z$/," UTC")} |
317`,oe.fileSize&&(X+=`| **Size** | ${(oe.fileSize/1024).toFixed(0)} KB |
318`),X+=`
319`),ve?.chatAnswers&&Object.keys(ve.chatAnswers).length>0&&(X+=`## Onboarding Q&A
320
321`,Object.entries(ve.chatAnswers).forEach(([kt,Xt])=>{X+=`**Q: ${kt}**
322`,X+=`A: ${Xt}
323
324`}))}R.audioTranscript&&(X+=`## Voice Annotation
325
326`,X+=`> ${R.audioTranscript.replace(/\n/g,`
327> `)}
328
329`),J&&J.length>0&&(X+=`## Automation Steps
330
331`,J.filter(oe=>!Fi(oe)).forEach((oe,kt)=>{if(X+=`### ▶ Step ${kt+1}: ${oe.name||oe.description||"Step"}
332
333`,oe.description&&oe.description!==oe.name&&(X+=`${oe.description}
334
335`),oe.substeps&&oe.substeps.length>0&&(X+=`**Sub-steps:**
336`,oe.substeps.forEach(Xt=>{X+=`- ${Xt}
337`}),X+=`
338`),oe.toolsOrSystems&&oe.toolsOrSystems.length>0&&(X+=`**Tools/Systems:** ${oe.toolsOrSystems.join(", ")}
339
340`),(oe.inputs||oe.outputs)&&(oe.inputs&&(X+=`**Input:** ${oe.inputs}
341`),oe.outputs&&(X+=`**Output:** ${oe.outputs}
342`),X+=`
343`),oe.constraints&&oe.constraints.length>0&&(X+=`**Constraints:**
344`,oe.constraints.forEach(Xt=>{X+=`- ⚠ ${Xt}
345`}),X+=`
346`),oe.ifUnclear&&(X+=`**If unclear:** ${oe.ifUnclear}
347
348`),oe.userNote&&(X+=`**Note:** ${oe.userNote}
349
350`),oe.logicNote&&(X+=`*AI insight: ${oe.logicNote}*
351
352`),oe.code){const Xt=(oe.code||"").split(`
353`).filter(Fr=>!Ca(Fr)).join(`
354`).trim();Xt&&(X+="```javascript\n"+Xt+"\n```\n\n")}}));{const oe=new Set;if(J&&J.forEach(kt=>{const Fr=(kt.code||"").match(/#[A-Za-z][\w-]*/g);Fr&&Fr.forEach(Hn=>oe.add(Hn))}),R.scriptCode){const kt=R.scriptCode.match(/#[A-Za-z][\w-]*/g);kt&&kt.forEach(Xt=>oe.add(Xt))}oe.size>0&&(X+=`## Selectors
355
356`,oe.forEach(kt=>{X+=`- \`${kt}\`
357`}),X+=`
358`)}R.scriptCode&&(X+=`## Script Code
359
360`,X+="```javascript\n"+R.scriptCode+"\n```\n\n"),X+=`---
361*Exported from VeraCore AI — ${new Date().toUTCString()}*
362`;const Ee=new Blob([X],{type:"text/markdown"}),De=URL.createObjectURL(Ee),rt=document.createElement("a");rt.href=De,rt.download=`${(R.title||"workflow").replace(/[^a-zA-Z0-9]+/g,"-").toLowerCase()}.md`,document.body.appendChild(rt),rt.click(),document.body.removeChild(rt),URL.revokeObjectURL(De)},className:"flex items-center gap-2 px-4 py-2 ml-2 rounded-lg text-sm font-medium bg-cream-dark text-ink hover:bg-cream-dark transition-colors whitespace-nowrap",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n.jsx("polyline",{points:"7 10 12 15 17 10"}),n.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),"Export"]})]})}),zi==="editor"&&n.jsxs("div",{className:"space-y-4",children:[be&&be.length>0&&n.jsx("div",{className:"flex items-center gap-2",children:n.jsxs("span",{className:"px-3 py-1.5 rounded-lg text-sm font-medium bg-slate-800 text-white flex items-center gap-1.5",children:["Steps",n.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded-full bg-green-500 text-white",children:be.filter(J=>!Fi(J)).length})]})}),(()=>{R.captureMethod;const J=be?.filter(X=>!Fi(X))||[],ve=be?be.reduce((X,Ee,De)=>(Fi(Ee)||X.push(De),X),[]):[];return n.jsxs("div",{className:"space-y-0",children:[n.jsx("div",{className:"flex items-center justify-between mb-4",children:n.jsxs("p",{className:"text-sm text-warm-gray font-medium",children:[J.length," steps"]})}),J.length>0?n.jsx("div",{className:"space-y-0",children:J.map((X,Ee)=>{const De=ve[Ee];return n.jsx("div",{children:n.jsxs("div",{className:`rounded-xl border p-5 cursor-pointer transition-colors ${we?"bg-slate-800":"bg-white"} ${zr===De?we?"border-blue-700 ring-1 ring-blue-900":"border-olive/30 ring-1 ring-olive/20":we?"border-slate-700 hover:border-slate-600":"border-warm-border hover:border-warm-border"}`,onClick:()=>yp(zr===De?null:De),"data-testid":`step-card-${Ee}`,children:[n.jsxs("div",{className:"flex items-start justify-between gap-2 mb-3",children:[n.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[n.jsx("div",{className:"w-7 h-7 rounded-full bg-slate-800 text-white flex items-center justify-center text-xs font-bold flex-shrink-0",children:Ee+1}),n.jsx("h4",{className:`font-semibold break-words ${we?"text-white":"text-ink"}`,children:X.name||X.description||`Step ${Ee+1}`})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[X.userNote&&zr!==De&&n.jsx("span",{className:"bg-olive/10 text-olive px-2 py-0.5 rounded text-xs font-medium","data-testid":`badge-note-${Ee}`,children:"Note"}),X.logicNote&&n.jsx("span",{className:"text-xs text-warm-gray italic max-w-[120px] md:max-w-xs truncate",children:X.logicNote})]})]}),X.processLogic&&n.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-2",children:[X.processLogic.isLoop&&n.jsxs("span",{className:"bg-olive/10 text-olive border border-olive/20 px-2 py-0.5 rounded text-xs font-medium","data-testid":`tag-loop-${Ee}`,children:["↻ ",X.processLogic.loopDescription||"Repeating"]}),X.processLogic.frequency&&n.jsxs("span",{className:"bg-purple-50 text-purple-700 border border-purple-200 px-2 py-0.5 rounded text-xs font-medium","data-testid":`tag-frequency-${Ee}`,children:["🕐 ",X.processLogic.frequency]}),X.processLogic.condition&&n.jsxs("span",{className:"bg-amber-50 text-amber-700 border border-amber-200 px-2 py-0.5 rounded text-xs font-medium","data-testid":`tag-condition-${Ee}`,children:["⚡ ",X.processLogic.condition]}),X.processLogic.painPoint&&n.jsxs("span",{className:"bg-red-50 text-red-700 border border-red-200 px-2 py-0.5 rounded text-xs font-medium","data-testid":`tag-pain-${Ee}`,children:["⚠ ",X.processLogic.painPoint]}),X.processLogic.volume&&n.jsxs("span",{className:"bg-green-50 text-green-700 border border-green-200 px-2 py-0.5 rounded text-xs font-medium","data-testid":`tag-volume-${Ee}`,children:["📊 ",X.processLogic.volume]})]}),X.description&&X.description!==X.name&&n.jsx("p",{className:`text-sm leading-relaxed mb-2 ${we?"text-slate-300":"text-warm-gray"}`,children:X.description}),X.substeps&&X.substeps.length>0&&n.jsx("div",{className:"mb-2",children:n.jsx("ul",{className:`text-xs space-y-1 ml-4 ${we?"text-slate-400":"text-warm-gray"}`,children:X.substeps.map((rt,oe)=>n.jsx("li",{className:"list-disc",children:rt},oe))})}),X.constraints&&X.constraints.length>0&&n.jsx("div",{className:"mb-2",children:n.jsx("div",{className:"flex flex-wrap gap-1.5",children:X.constraints.map((rt,oe)=>n.jsxs("span",{className:"bg-amber-50 text-amber-800 border border-amber-200 px-2 py-0.5 rounded text-xs font-medium","data-testid":`tag-constraint-${Ee}-${oe}`,children:["⚠ ",rt]},oe))})}),X.ifUnclear&&n.jsxs("div",{className:`mb-2 text-xs ${we?"text-slate-400":"text-warm-gray"}`,children:[n.jsx("span",{className:"font-semibold text-orange-700",children:"If unclear:"})," ",X.ifUnclear]}),zr!==De&&n.jsx("div",{className:"mt-3 pt-2 border-t border-warm-border/50",children:n.jsxs("button",{"data-testid":`btn-add-note-${Ee}`,onClick:rt=>{rt.stopPropagation(),yp(De)},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-olive bg-olive/8 border border-olive/20 rounded-lg hover:bg-olive/15 hover:border-olive/30 transition-colors",children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M12 20h9"}),n.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]}),X.userNote?"Edit Note":"Add Note"]})}),zr===De&&n.jsxs("div",{className:`mt-3 pt-3 border-t ${we?"border-slate-700":"border-warm-border"}`,onClick:rt=>rt.stopPropagation(),children:[n.jsx("label",{className:`text-xs font-medium mb-1 block ${we?"text-slate-400":"text-warm-gray"}`,children:"Your notes for this step"}),n.jsx("textarea",{className:`w-full border rounded-lg p-2.5 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-olive/20 focu
362s:border-olive/30 ${we?"bg-slate-900 border-slate-700 text-slate-200 placeholder-slate-500":"bg-white border-warm-border text-ink placeholder-warm-gray"}`,rows:3,placeholder:"Add notes about this step...",defaultValue:X.userNote||"","data-testid":`input-step-note-${Ee}`,id:`step-note-textarea-${R.id}-${De}`}),n.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[n.jsxs("button",{"data-testid":`btn-save-note-${Ee}`,className:"inline-flex items-center gap-1.5 px-3.5 py-1.5 text-xs font-semibold text-white bg-olive rounded-lg hover:bg-olive-dark transition-colors",onClick:async()=>{const rt=document.getElementById(`step-note-textarea-${R.id}-${De}`);if(!rt)return;const oe=rt.value;if(oe===(X.userNote||"")){Ul(Ee),setTimeout(()=>Ul(null),2e3);return}try{await Tt(`/api/portal/sop/${R.id}/step-note`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({stepIndex:De,note:oe})}),be&&(be[De]={...be[De],userNote:oe.trim()}),Ul(Ee),setTimeout(()=>Ul(null),2e3)}catch(kt){console.error("Failed to save note:",kt)}},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Save Note"]}),vp===Ee&&n.jsx("p",{className:"text-xs text-green-600 font-medium","data-testid":`text-note-saved-${Ee}`,children:"Saved"})]})]})]})},X.id||Ee)})}):n.jsx("p",{className:"text-sm text-warm-gray text-center py-8",children:"No steps detected"})]})})()]}),zi==="voice"&&n.jsxs("div",{className:"space-y-4",children:[R.audioUrl&&n.jsxs("div",{className:"bg-white rounded-xl border border-warm-border p-5",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx("svg",{className:"text-purple-500",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M12 1a4 4 0 0 0-4 4v7a4 4 0 0 0 8 0V5a4 4 0 0 0-4-4zm-1 18.93V22h2v-2.07A8 8 0 0 0 20 12h-2a6 6 0 0 1-12 0H4a8 8 0 0 0 7 7.93z"})}),n.jsx("p",{className:"text-xs font-semibold text-purple-700 uppercase tracking-wide",children:"Recording"})]}),n.jsx("audio",{"data-testid":"audio-player-detail",controls:!0,className:"w-full",src:`/api/portal/sop/${R.id}/audio`,children:"Your browser does not support audio playback."})]}),R.captureMethod==="recording"&&n.jsx("div",{className:"flex justify-end",children:n.jsxs("button",{"data-testid":"btn-reanalyze-portal",disabled:Fl,onClick:async()=>{wa(!0);try{(await Tt(`/api/portal/sop/${R.id}/reanalyze`,{method:"POST",credentials:"include"})).ok&&await _n()}catch(J){console.error("Re-analyze failed:",J)}finally{wa(!1)}},className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium text-olive bg-olive/10 border border-olive/20 rounded-lg hover:bg-olive/20 transition-colors disabled:opacity-50",children:[n.jsxs("svg",{className:`w-3.5 h-3.5 ${Fl?"animate-spin":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M23 4v6h-6"}),n.jsx("path",{d:"M1 20v-6h6"}),n.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]}),Fl?"Re-analyzing...":"Re-analyze Steps"]})}),ce&&n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[ce.whatItDoes&&n.jsxs("div",{className:"bg-white rounded-xl border border-warm-border p-5",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsxs("svg",{className:"text-olive",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]}),n.jsx("p",{className:"text-xs font-semibold text-olive uppercase tracking-wide",children:"What It Does"})]}),n.jsx("p",{className:"text-sm text-ink leading-relaxed",children:ce.whatItDoes})]}),ce.whyItExists&&n.jsxs("div",{className:"bg-white rounded-xl border border-green-200 p-5",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsxs("svg",{className:"text-green-500",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("p",{className:"text-xs font-semibold text-green-700 uppercase tracking-wide",children:"Why It Exists"})]}),n.jsx("p",{className:"text-sm text-ink leading-relaxed",children:ce.whyItExists})]})]}),ce?.decisionPoints&&ce.decisionPoints.length>0&&n.jsxs("div",{className:"bg-white rounded-xl border border-amber-200 p-5",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{className:"text-amber-500",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),n.jsx("p",{className:"text-xs font-semibold text-amber-700 uppercase tracking-wide",children:"Decision Points Detected"})]}),n.jsx("div",{className:"flex flex-wrap gap-2",children:ce.decisionPoints.map((J,ve)=>n.jsx("span",{className:"bg-amber-100 text-amber-800 px-3 py-1.5 rounded-full text-xs font-medium",children:J},ve))})]}),ce?.processInsights&&(()=>{const J=ce.processInsights;
362return J.frequency||J.isLooped||J.estimatedVolume||J.painPoints&&J.painPoints.length>0||J.exceptions&&J.exceptions.length>0?n.jsxs("div",{className:"bg-white rounded-xl border border-purple-200 p-5","data-testid":"section-process-insights",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{className:"text-purple-500",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"12 6 12 12 16 14"})]}),n.jsx("p",{className:"text-xs font-semibold text-purple-700 uppercase tracking-wide",children:"Process Insights"})]}),n.jsxs("div",{className:"space-y-3",children:[J.frequency&&n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"bg-olive/10 text-olive px-2 py-0.5 rounded text-xs font-semibold shrink-0",children:"Frequency"}),n.jsx("span",{className:"text-sm text-ink","data-testid":"text-frequency",children:J.frequency})]}),J.isLooped&&n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"bg-olive/10 text-olive px-2 py-0.5 rounded text-xs font-semibold shrink-0",children:"Repeating"}),n.jsx("span",{className:"text-sm text-ink","data-testid":"text-loop-description",children:J.loopDescription||"This workflow loops over multiple items"})]}),J.estimatedVolume&&n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"bg-green-100 text-green-700 px-2 py-0.5 rounded text-xs font-semibold shrink-0",children:"Volume"}),n.jsx("span",{className:"text-sm text-ink","data-testid":"text-volume",children:J.estimatedVolume})]}),J.painPoints&&J.painPoints.length>0&&n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"bg-red-100 text-red-700 px-2 py-0.5 rounded text-xs font-semibold shrink-0",children:"Pain Points"}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:J.painPoints.map((X,Ee)=>n.jsx("span",{className:"bg-red-50 text-red-700 px-2.5 py-1 rounded-full text-xs","data-testid":`text-pain-point-${Ee}`,children:X},Ee))})]}),J.exceptions&&J.exceptions.length>0&&n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:"bg-orange-100 text-orange-700 px-2 py-0.5 rounded text-xs font-semibold shrink-0",children:"Exceptions"}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:J.exceptions.map((X,Ee)=>n.jsx("span",{className:"bg-orange-50 text-orange-700 px-2.5 py-1 rounded-full text-xs","data-testid":`text-exception-${Ee}`,children:X},Ee))})]})]})]}):null})(),ce?.eligibilityConditions&&ce.eligibilityConditions.length>0&&n.jsxs("div",{className:"bg-white rounded-xl border border-blue-200 p-5","data-testid":"section-eligibility",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx("svg",{className:"text-blue-500",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})}),n.jsx("p",{className:"text-xs font-semibold text-blue-700 uppercase tracking-wide",children:"Eligibility / Scope Gates"})]}),n.jsx("p",{className:"text-xs text-warm-gray mb-3",children:"These conditions must be true before processing begins."}),n.jsx("div",{className:"space-y-2",children:ce.eligibilityConditions.map((J,ve)=>n.jsxs("div",{className:"flex items-start gap-2 bg-blue-50 rounded-lg px-3 py-2","data-testid":`text-eligibility-${ve}`,children:[n.jsx("span",{className:"text-blue-500 mt-0.5 shrink-0",children:"•"}),n.jsx("span",{className:"text-sm text-ink",children:J})]},ve))})]}),ce?.requiredTemplates&&ce.requiredTemplates.length>0&&n.jsxs("div",{className:"bg-white rounded-xl border border-indigo-200 p-5","data-testid":"section-templates",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{className:"text-indigo-500",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"}),n.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),n.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),n.jsx("p",{className:"text-xs font-semibold text-indigo-700 uppercase tracking-wide",children:"Required Note Templates"})]}),n.jsx("div",{className:"space-y-4",children:ce.requiredTemplates.map((J,ve)=>n.jsxs("div",{className:"border border-indigo-100 rounded-lg p-3","data-testid":`template-${ve}`,children:[n.jsx("p",{className:"text-sm font-medium text-ink mb-1",children:J.name}
362),n.jsxs("p",{className:"text-xs text-warm-gray mb-2",children:["When used: ",J.whenUsed]}),n.jsx("pre",{className:"bg-indigo-50 rounded px-3 py-2 text-xs text-ink whitespace-pre-wrap font-mono",children:J.exactText})]},ve))})]}),ce?.escalationPaths&&ce.escalationPaths.length>0&&n.jsxs("div",{className:"bg-white rounded-xl border border-red-200 p-5","data-testid":"section-escalation",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{className:"text-red-500",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),n.jsx("p",{className:"text-xs font-semibold text-red-700 uppercase tracking-wide",children:"Escalation / Fallback Paths"})]}),n.jsx("p",{className:"text-xs text-warm-gray mb-3",children:"When the automation must stop or hand off to a human."}),n.jsx("div",{className:"space-y-3",children:ce.escalationPaths.map((J,ve)=>n.jsxs("div",{className:"bg-red-50 rounded-lg px-3 py-2.5","data-testid":`escalation-${ve}`,children:[n.jsxs("p",{className:"text-sm text-ink",children:[n.jsx("span",{className:"font-medium",children:"Trigger:"})," ",J.trigger]}),n.jsxs("p",{className:"text-sm text-ink mt-1",children:[n.jsx("span",{className:"font-medium",children:"Action:"})," ",J.action]}),J.notes&&n.jsxs("p",{className:"text-xs text-warm-gray mt-1",children:["Notes: ",J.notes]})]},ve))})]}),ce?.terminalOutcomes&&ce.terminalOutcomes.length>0&&n.jsxs("div",{className:"bg-white rounded-xl border border-green-200 p-5","data-testid":"section-outcomes",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{className:"text-green-500",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("p",{className:"text-xs font-semibold text-green-700 uppercase tracking-wide",children:"Terminal Outcomes"})]}),n.jsx("p",{className:"text-xs text-warm-gray mb-3",children:"Every possible end state and what must happen for each."}),n.jsx("div",{className:"space-y-3",children:ce.terminalOutcomes.map((J,ve)=>n.jsxs("div",{className:"border border-green-100 rounded-lg p-3","data-testid":`outcome-${ve}`,children:[n.jsx("p",{className:"text-sm font-medium text-ink mb-1",children:J.outcome}),n.jsxs("p",{className:"text-xs text-ink",children:[n.jsx("span",{className:"font-medium",children:"Criteria:"})," ",J.criteria]}),n.jsxs("p",{className:"text-xs text-ink mt-1",children:[n.jsx("span",{className:"font-medium",children:"Required actions:"})," ",J.requiredActions]})]},ve))})]}),ce?.uncertaintyHandling&&ce.uncertaintyHandling.length>0&&n.jsxs("div",{className:"bg-white rounded-xl border border-orange-200 p-5","data-testid":"section-uncertainty",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{className:"text-orange-500",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),n.jsx("p",{className:"text-xs font-semibold text-orange-700 uppercase tracking-wide",children:"Uncertainty Handling"})]}),n.jsx("p",{className:"text-xs text-warm-gray mb-3",children:"What to do when information is missing, ambiguous, or unexpected."}),n.jsx("div",{className:"space-y-2",children:ce.uncertaintyHandling.map((J,ve)=>n.jsxs("div",{className:"flex items-start gap-2 bg-orange-50 rounded-lg px-3 py-2","data-testid":`text-uncertainty-${ve}`,children:[n.jsx("span",{className:"text-orange-500 mt-0.5 shrink-0",children:"•"}),n.jsx("span",{className:"text-sm text-ink",children:J})]},ve))})]}),R.audioTranscript&&n.jsxs("div",{className:"bg-white rounded-xl border border-warm-border p-5",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx("svg",{className:"text-warm-gray",width:"16",height:"16",viewBox:"0 0 24 24",fill:"
362currentColor",children:n.jsx("path",{d:"M12 1a4 4 0 0 0-4 4v7a4 4 0 0 0 8 0V5a4 4 0 0 0-4-4zm-1 18.93V22h2v-2.07A8 8 0 0 0 20 12h-2a6 6 0 0 1-12 0H4a8 8 0 0 0 7 7.93z"})}),n.jsx("p",{className:"text-xs font-semibold text-warm-gray uppercase tracking-wide",children:"Original Transcript"})]}),n.jsx("p",{className:"text-sm text-ink leading-relaxed whitespace-pre-wrap",children:R.audioTranscript})]}),R.captureMethod==="recording"&&!R.audioUrl&&!R.audioTranscript&&n.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-6 text-center",children:[n.jsx("svg",{className:"text-amber-500 mx-auto mb-3",width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),n.jsx("p",{className:"text-sm font-medium text-amber-900 mb-1",children:"No audio was captured in this recording"}),n.jsx("p",{className:"text-xs text-amber-700 leading-relaxed max-w-sm mx-auto",children:"Please double-check that your browser has microphone permissions enabled before making another recording. You can usually find this in your browser's site settings or the address bar."})]}),R.captureMethod!=="recording"&&!R.audioUrl&&!R.audioTranscript&&!ce&&n.jsx("div",{className:"bg-white rounded-xl border border-warm-border p-12 text-center",children:n.jsx("p",{className:"text-sm text-warm-gray",children:"No voice annotation available for this script."})})]}),zi==="documents"&&(()=>{const J=R.fileId?Yt.find(ve=>ve.id===R.fileId):null;return n.jsx("div",{className:"space-y-4","data-testid":"section-source-documents",children:J?n.jsxs("div",{className:"bg-white rounded-xl border border-warm-border p-5",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsxs("svg",{className:"text-olive",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]}),n.jsx("p",{className:"text-xs font-semibold text-olive uppercase tracking-wide",children:"Source Document"})]}),n.jsxs("div",{className:"flex items-center justify-between bg-cream-light rounded-lg p-4","data-testid":`source-doc-${J.id}`,children:[n.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[n.jsx("div",{className:"w-9 h-9 rounded-lg bg-olive/10 flex items-center justify-center flex-shrink-0",children:n.jsxs("svg",{className:"text-olive",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"}),n.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),n.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"font-medium text-ink text-sm truncate",children:J.fileName}),n.jsxs("p",{className:"text-xs text-warm-gray mt-0.5",children:["Uploaded ",new Date(J.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),J.fileSize&&n.jsxs("span",{children:[" · ",(J.fileSize/1024).toFixed(0)," KB"]})]})]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsxs("a",{"data-testid":`button-download-source-doc-${J.id}`,href:`/api/portal/sop/client-documents/${J.id}/download`,className:"inline-flex items-center gap-1.5 text-olive hover:text-olive-dark text-sm font-medium px-3 py-1.5 rounded-lg hover:bg-olive/10 transition-colors",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n.jsx("polyline",{points:"7 10 12 15 17 10"}),n.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),"Download"]}),n.jsxs("button",{"data-testid":`button-view-source-doc-${J.id}`,onClick:()=>{V("documents"),Se(null)},className:"inline-flex items-center gap-1.5 text-warm-gray hover:text-ink text-sm font-medium px-3 py-1.5 rounded-lg hover:bg-cream-dark transition-colors",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),n.jsx("polyline",{points:"15 3 21 3 21 9"}),n.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"View in Documents"]})]})]})]}):n.jsxs("div",{className:"bg-white rounded-xl border border-warm-border p-12 text-center",children:[n.jsxs("svg",{className:"text-warm-gray mx-auto mb-3",width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]}),n.jsx("p",{className:"text-sm text-warm-gray",children:"The source document used to create this script is no longer available."})]})})})()]})})(),D==="documents"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-bold text-ink",children:"Documents"}),n.jsx("p",{className:"text-warm-gray text-sm",children:"Your legal documents and agreements"})]}),No.length>0&&n.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-5",children:[n.jsx("h3",{className:"text-sm font-semibold text-amber-900 mb
362-3",children:"Awaiting Your Signature"}),n.jsx("div",{className:"space-y-2",children:No.map(R=>n.jsxs("div",{"data-testid":`card-pending-doc-${R.id}`,className:"flex items-center justify-between bg-white rounded-lg p-4 border border-amber-100",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-ink",children:R.title}),n.jsxs("p",{className:"text-sm text-warm-gray",children:["Sent ",new Date(R.sentAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]}),n.jsx(Ae,{href:`/sign/${R.accessToken}`,children:n.jsx("button",{"data-testid":`button-sign-${R.id}`,className:"bg-olive hover:bg-olive-dark text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors",children:"Sign Now"})})]},R.id))})]}),Vu.length>0&&n.jsxs("div",{className:"bg-white rounded-xl border border-warm-border p-5",children:[n.jsx("h3",{className:"text-sm font-semibold text-ink mb-3",children:"Signed Documents"}),n.jsx("div",{className:"space-y-2",children:Vu.map(R=>n.jsx("div",{"data-testid":`card-signed-doc-${R.id}`,className:"bg-cream-light rounded-lg p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-ink",children:R.title}),n.jsxs("p",{className:"text-sm text-warm-gray",children:["Signed ",new Date(R.signedAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{"data-testid":`button-view-doc-${R.id}`,onClick:()=>Kl(R.id),className:"text-olive hover:text-olive-dark text-sm font-medium px-3 py-1.5 rounded-lg hover:bg-olive/10 transition-colors",children:"View"}),n.jsx("a",{"data-testid":`button-download-doc-${R.id}`,href:`/api/portal/sop/documents/${R.id}/download`,className:"text-warm-gray hover:text-ink text-sm font-medium px-3 py-1.5 rounded-lg hover:bg-cream-dark transition-colors",children:"Download"}),n.jsx("span",{className:"px-3 py-1 rounded-full text-xs font-medium bg-olive/10 text-olive",children:"Signed"})]})]})},R.id))})]}),No.length===0&&Vu.length===0&&Yt.length===0&&n.jsxs("div",{className:"bg-white rounded-xl border border-warm-border p-12 text-center",children:[n.jsx("div",{className:"text-4xl mb-4",children:"📄"}),n.jsx("h3",{className:"text-lg font-semibold text-ink mb-2",children:"No Documents Yet"}),n.jsx("p",{className:"text-warm-gray text-sm",children:"Upload documents or check back when agreements are ready for signing."})]}),Yt.length>0&&n.jsxs("div",{className:"bg-white rounded-xl border border-warm-border p-5",children:[n.jsx("h3",{className:"text-sm font-semibold text-ink mb-3",children:"Your Uploads"}),n.jsx("div",{className:"space-y-2",children:Yt.map(R=>n.jsx("div",{"data-testid":`card-upload-${R.id}`,className:"bg-cream-light rounded-lg p-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:"font-medium text-ink text-sm truncate",children:R.fileName}),n.jsxs("p",{className:"text-xs text-warm-gray mt-0.5",children:[R.uploadedBy&&(P.contacts||[]).length>1&&n.jsxs("span",{children:["Uploaded by ",R.uploadedBy," · "]}),new Date(R.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),R.fileSize&&n.jsxs("span",{children:[" · ",(R.fileSize/1024).toFixed(0)," KB"]})]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("a",{"data-testid":`button-download-upload-${R.id}`,href:`/api/portal/sop/client-documents/${R.id}/download`,className:"text-olive hover:text-olive-dark text-sm font-medium px-3 py-1.5 rounded-lg hover:bg-olive/10 transition-colors",children:"Download"}),n.jsx("button",{"data-testid":`button-delete-upload-${R.id}`,onClick:()=>ld(R.id),className:"text-warm-gray hover:text-red-500 p-1.5 rounded-lg hover:bg-red-50 transition-colors",title:"Remove",children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]})},R.id))})]}),n.jsx("div",{className:"bg-white rounded-xl border border-warm-border p-5",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold text-ink",children:"Upload a Document"}),n.jsx("p",{className:"text-xs text-warm-gray mt-0.5",children:"PDF, Word, Markdown, Text, CSV, and more (max 10 MB)"})]}),n.jsxs("label",{"data-testid":"button-upload-document",className:`inline-flex items-center gap-2 px-4 py-2.5 rounded-lg text-sm font-medium transition-colors cursor-pointer ${Di?"bg-cream-dark text-warm-gray":"bg-olive hover:bg-olive-dark text-white"}`,children:[n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n.jsx("polyline",{points:"17 8 12 3 7 8"}),n.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),Di?"Uploading...":"Choose File",n.jsx("input",{type:"file",accept:".pdf,.doc,.docx,.png,.jpg,.jpeg,.md,.txt,.csv,.json,.xml,.yaml,.yml,.rtf",onChange:Ta,disabled:Di,className:"hidden"})]})]})})]}),D==="activity"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-bold text-ink",children:"Recent Activity"}),n.jsx("p",{className:"text-warm-gray text-sm",children:"What's been happening on your account"})]}),Fu.length>0?n.jsx("div",{className:"bg-white rounded-xl border border-warm-border p-6",children:n.jsx("div",{className:"space-y-4",children:Fu.map((R,be)=>n.jsxs("div",{"data-testid":`activity-item-${be}`,className:"flex gap-3",children:[n.jsxs("div",{className:"flex flex-col items-center",children:[n.jsx("div",{className:"w-2.5 h-2.5 bg-olive rounded-full mt-1.5"}),be<Fu.length-1&&n.jsx("div",{className:"w-px flex-1 bg-cream-dark mt-1"})]}),n.jsxs("div",{className:"pb-4 flex-1",children:[n.jsx("p",{className:"text-sm font-medium text-ink",children:CK(R.action)}),n.jsx("p",{className:"text-xs text-warm-gray",children:new Date(R.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]})]},be))})}):n.jsxs("div",{className:"bg-white rounded-xl border border-warm-border p-12 text-center",children:[n.jsx("div",{className:"text-4xl mb-4",children:"📋"}),n.jsx("h3",{className:"text-lg font-semibold text-ink mb-2",children:"No Recent Activity"}),n.jsx("p",{className:"text-warm-gray text-sm",children:"Activity on your account will appear here."})]})]}),D==="messages"&&n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-bold text-ink",children:"Messages"}),n.jsx("p",{className:"text-warm-gray text-sm",children:"Send a message to your VeraCore AI team"})]}),n.jsxs("div",{className:"bg-white rounded-xl border border-warm-border p-6",children:[n.jsx("h3",{className:"font-semibold text-ink mb-3",children:"New Message"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("input",{"data-testid":"input-ticket-subject",type:"text",value:js,onChange:R=>Pi(R.target.value),placeholder:"Subject — e.g., Question about my automation",className:"w-full px-4 py-2.5 rounded-lg border border-warm-border focus:ring-2 focus:ring-olive focus:border-olive outline-none text-sm"}),n.jsx("textarea",{"data-testid":"input-ticket-message",value:nr,onChange:R=>Tn(R.target.value),placeholder:"Write your message here...",rows:4,className:"w-full px-4 py-2.5 rounded-lg border border-warm-border focus:ring-2 focus:ring-olive focus:border-olive outline-none text-sm resize-none"}),n.jsx("button",{"data-testid":"button-submit-ticket",onClick:zu,disabled:pa||!js.trim()||!nr.trim(),className:"bg-olive hover:bg-olive-dark text-white font-medium px-6 py-2.5 rounded-lg transition-colors disabled:opacity-50 text-sm",children:pa?"Sending...":"Send Message"})]})]}),Kt.length>0&&n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-sm font-semibold text-ink",children:"Previous Messages"}),Kt.map(R=>{const be=ht===R.id,ce=R.status==="open"?"bg-orange-100 text-orange-700":R.status==="in_progress"?"bg-olive/10 text-olive":R.status==="resolved"?"bg-green-100 text-green-700":"bg-cream-dark text-warm-gray";return n.jsxs("div",{"data-testid":`ticket-${R.id}`,className:"bg-white rounded-xl border border-warm-border overflow-hidden",children:[n.jsxs("button",{"data-testid":`toggle-ticket-${R.id}`,onClick:()=>is(be?null:R.id),className:"w-full p-4 text-left flex items-center justify-between hover:bg-cream-light transition-colors",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-ink",children:R.subject}),n.jsxs("p",{className:"text-xs text-warm-gray mt-0.5",children:[R.contactName&&(P.contacts||[]).length>1&&n.jsxs("span",{children:["Submitted by ",R.contactName," · "]}),new Date(R.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})," · ",(R.messages||[]).length," message(s)"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:`px-2.5 py-1 rounded-full text-xs font-medium ${ce}`,children:R.status==="in_progress"?"In Progress":R.status.charAt(0).toUpperCase()+R.status.slice(1)}),n.jsx("span",{className:"text-warm-gray text-sm",children:be?"▲":"▼"})]})]}),be&&n.jsxs("div",{className:"border-t border-warm-border",children:[n.jsx("div",{className:"p-4 space-y-3 max-h-80 overflow-y-auto bg-cream-light",children:(R.messages||[]).map(J=>n.jsx("div",{"data-testid":`portal-message-${J.id}`,className:`flex ${J.senderType==="client"?"justify-end":"justify-start"}`,children:n.jsxs("div",{className:`max-w-[80%] rounded-xl px-4 py-3 ${J.senderType==="client"?"bg-olive/5 border border-olive/20":"bg-white border border-warm-border"}`,children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx("span",{className:`text-xs font-medium ${J.senderType==="client"?"text-olive":"text-ink"}`,children:J.senderName}),n.jsx("span",{className:"text-[10px] text-warm-gray",children:new Date(J.createdAt).toLocaleStr
362ing("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})]}),n.jsx("p",{className:"text-sm text-ink whitespace-pre-wrap",children:J.message})]})},J.id))}),(R.status==="open"||R.status==="in_progress")&&n.jsx("div",{className:"p-4 border-t border-warm-border bg-white",children:n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{"data-testid":`input-reply-${R.id}`,type:"text",value:ht===R.id?xr:"",onChange:J=>Ll(J.target.value),placeholder:"Type a reply...",className:"flex-1 px-3 py-2 rounded-lg border border-warm-border focus:ring-2 focus:ring-olive focus:border-olive outline-none text-sm",onKeyDown:J=>{J.key==="Enter"&&cd(R.id)}}),n.jsx("button",{"data-testid":`button-reply-${R.id}`,onClick:()=>cd(R.id),disabled:pa||!xr.trim(),className:"bg-olive hover:bg-olive-dark text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors disabled:opacity-50",children:"Reply"})]})})]})]},R.id)})]})]}),D==="my-team"&&(()=>{const R=P.contacts||[],be=P.contactEmail?.toLowerCase(),ce=R.filter(De=>De.email?.toLowerCase()!==be),J=we,ve=J?"bg-slate-800 border-slate-700":"bg-white border-warm-border",X=J?"text-white":"text-ink",Ee=J?"text-slate-400":"text-warm-gray";return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h2",{className:`text-xl font-bold ${X}`,children:"My Team"}),n.jsx("p",{className:`text-sm ${Ee}`,children:"People from your organization with portal access"})]}),n.jsxs("button",{"data-testid":"button-generate-invite-team",onClick:()=>{I(""),S(""),ae(De=>!De)},className:"flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors bg-olive hover:bg-olive-dark text-white",children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"})}),z?"Cancel":"Invite Teammate"]})]}),z&&n.jsxs("div",{className:`rounded-xl border p-4 space-y-3 ${J?"bg-slate-800 border-slate-700":"bg-white border-warm-border"}`,children:[n.jsx("p",{className:`text-xs ${Ee}`,children:"We'll email an invite to this address. The link expires in 7 days."}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-2",children:[n.jsx("input",{"data-testid":"input-invite-name-team",type:"text",placeholder:"Name (optional)",value:A,onChange:De=>{E(De.target.value),N&&S("")},className:`px-3 py-2 rounded-lg border text-sm ${J?"bg-slate-700 border-slate-600 text-slate-200":"bg-white border-warm-border text-ink"}`}),n.jsx("input",{"data-testid":"input-invite-email-team",type:"email",placeholder:"[email protected]",value:_,onChange:De=>{T(De.target.value),N&&S("")},className:`px-3 py-2 rounded-lg border text-sm ${J?"bg-slate-700 border-slate-600 text-slate-200":"bg-white border-warm-border text-ink"}`})]}),N&&n.jsx("p",{role:"alert",className:"text-xs text-red-600","data-testid":"text-invite-error-team",children:N}),n.jsx("div",{className:"flex justify-end",children:n.jsx("button",{"data-testid":"button-send-invite-team",disabled:$||!_.trim(),onClick:async()=>{S("");const De=_.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(De)){S("Enter a valid email address.");return}L(!0);try{const rt=await Tt("/api/portal/sop/invite/generate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({name:A.trim(),email:De})});if(!rt.ok){let kt="Failed to send invite";try{kt=(await rt.json()).error||kt}catch{}throw new Error(kt)}const oe=await rt.json().catch(()=>({}));I(`Invite emailed to ${oe.sentTo||De}`),E(""),T(""),ae(!1)}catch(rt){S(rt?.message||"Failed to send invite")}finally{L(!1)}},className:"flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium bg-olive hover:bg-olive-dark text-white disabled:opacity-50",children:$?"Sending...":"Send invite"})})]}),M&&!z&&n.jsx("div",{className:`rounded-xl border p-3 text-sm ${J?"bg-emerald-900/30 border-emerald-700 text-emerald-200":"bg-emerald-50 border-emerald-200 text-emerald-800"}`,"data-testid":"text-invite-success-team",children:M}),n.jsx("div",{className:`rounded-xl border ${ve} p-4`,children:n.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[n.jsx("div",{className:"w-10 h-10 bg-olive/10 rounded-full flex items-center justify-center text-olive font-bold text-sm",children:P.contactName?.split(" ").map(De=>De[0]).join("")||"?"}),n.jsxs("div",{children:[n.jsx("p",{className:`font-semibold text-sm ${X}`,children:P.contactName}),n.jsx("p",{className:`text-xs ${Ee}`,children:P.contactEmail})]}),n.jsx("span",{className:"ml-auto text-xs font-medium bg-olive/10 text-olive px-2 py-0.5 rounded-full",children:"You"})]})}),ce.length>0?n.jsx("div",{className:"space-y-3",children:ce.map(De=>n.jsx("div",{"data-testid":`card-teammate-${De.id}`,className:`rounded-xl border ${ve} p-4`,children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 bg-olive/10 rounded-full flex items-center justify-center text-olive font-bold text-sm",children:De.name?.split(" ").map(rt=>rt[0]).join("")||"?"}),n.jsxs("div",{children:[n.jsx("p",{className:`font-semibold text-sm ${X}`,children:De.name}),n.jsx("p",{className:`text-xs ${Ee}`,children:De.email})]}),De.title&&n.jsx("span",{className:`ml-auto text-xs font-medium px-2 py-0.5 rounded-full ${J?"bg-slate-700 text-slate-300":"bg-cream-dark text-warm-gray"}`,children:De.title})]})},De.id))}):n.jsxs("div",{className:`rounded-xl border-2 border-dashed p-8 text-center ${J?"border-slate-700":"border-warm-border"}`,children:[n.jsx("div",{className:"text-3xl mb-3",children:"👥"}),n.jsx("p",{className:`font-medium ${X}`,children:"No teammates yet"}),n.jsx("p",{className:`text-sm mt-1 ${Ee}`,children:"Use the invite button above to bring in colleagues from your organization"})]})]})})(),D==="managed-workers"&&(()=>{const R=Ui.filter(oe=>oe.status==="live"||oe.status==="deployed"),be=Ui.filter(oe=>{const kt=!Zt||oe.name.toLowerCase().includes(Zt.toLowerCase())||(oe.type||"").toLowerCase().includes(Zt.toLowerCase()),Xt=fa==="all"||oe.status===fa;return kt&&Xt}),ce=we,J=ce?"bg-slate-800 border-slate-700":"bg-white border-warm-border",ve=ce?"text-white":"text-ink",X=ce?"text-slate-400":"text-warm-gray",Ee=ce?"text-slate-500":"text-warm-gray",De=ce?"bg-slate-800 border-slate-700":"bg-white border-warm-border",rt=ce?"bg-slate-800 border-slate-600 text-white placeholder-slate-500":"bg-white border-warm-border text-ink placeholder-warm-gray";return n.jsxs("div",{className:"space-y-6","data-testid":"section-managed-workers",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:`w-10 h-10 rounded-xl ${ce?"bg-slate-700":"bg-cream-dark"} flex items-center justify-center`,children:n.jsx("svg",{className:`w-5 h-5 ${ce?"text-slate-300":"text-warm-gray"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375"})})}),n.jsxs("div",{children:[n.jsx("h2",{className:`text-xl font-bold ${ve}`,children:"Managed Employees"}),n.jsxs("p",{className:`text-sm ${X}`,children:[Ui.length," employee",Ui.length!==1?"s":""," assigned to your account"]})]})]}),n.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[{label:"Active Employees",value:R.length,dot:"bg-green-500",icon:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375"}
362,{label:"Human Review Needed",value:0,dot:"bg-amber-500",icon:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"},{label:"Open Employee Issues",value:0,dot:"bg-orange-500",icon:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126z"},{label:"Avg Queue Depth",value:0,dot:"bg-olive",icon:"M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"}].map(oe=>n.jsxs("div",{className:`${De} border rounded-xl p-4`,"data-testid":`stat-${oe.label.toLowerCase().replace(/\s+/g,"-")}`,children:[n.jsxs("p",{className:`text-xs font-medium flex items-center gap-1.5 ${X}`,children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:oe.icon})}),oe.label]}),n.jsx("p",{className:`text-2xl font-bold mt-1 ${ve}`,children:oe.value})]},oe.label))}),(()=>{const oe=!!P.billingInfo,kt=(P.provisioning||[]).find(Rn=>["crm_ready","account_create_requested","account_create_in_progress","account_created","account_ou_move_pending","account_ou_moved","onboarding_dispatch_pending","onboarding_dispatched","onboarding_running"].includes(Rn.status)),Xt=(P.provisioning||[]).find(Rn=>Rn.status==="onboarding_succeeded"),Fr=(P.provisioning||[]).find(Rn=>["onboarding_failed","manual_review_required"].includes(Rn.status)),Hn=On.filter(Rn=>Rn.status==="approved"),ko=On.length>0;return n.jsxs("div",{className:`${J} border rounded-xl p-6`,"data-testid":"section-deploy-scripts",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n.jsx("div",{className:"w-9 h-9 rounded-lg bg-olive flex items-center justify-center",children:n.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.59 14.37a6 6 0 01-5.84 7.38v-4.8m5.84-2.58a14.98 14.98 0 006.16-12.12A14.98 14.98 0 009.631 8.41m5.96 5.96a14.926 14.926 0 01-5.841 2.58m-.119-8.54a6 6 0 00-7.381 5.84h4.8m2.581-5.84a14.927 14.927 0 00-2.58 5.841m2.699 2.7c-.103.021-.207.041-.311.06a15.09 15.09 0 01-2.448-2.448 14.9 14.9 0 01.06-.312m-2.24 2.39a4.493 4.493 0 00-1.757 4.306 4.493 4.493 0 004.306-1.758M16.5 9a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0z"})})}),n.jsxs("div",{children:[n.jsx("h3",{className:`font-semibold ${ve}`,children:"Deploy My Scripts"}),n.jsx("p",{className:`text-xs ${X}`,children:"Launch your recorded workflows as managed employees"})]})]}),Xt?n.jsx("div",{className:`rounded-lg p-5 ${ce?"bg-green-900/20 border border-green-800":"bg-green-50 border border-green-200"}`,children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-full bg-green-500/20 flex items-center justify-center flex-shrink-0",children:n.jsx("svg",{className:"w-5 h-5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),n.jsxs("div",{children:[n.jsx("h4",{className:`font-semibold ${ce?"text-green-400":"text-green-800"}`,children:"Environment Ready"}),n.jsx("p",{className:`text-sm mt-1 ${ce?"text-green-300/80":"text-green-700"}`,children:"Your dedicated environment has been provisioned and your employees are live."})]})]})}):Fr?n.jsx("div",{className:`rounded-lg p-5 ${ce?"bg-red-900/20 border border-red-800":"bg-red-50 border border-red-200"}`,children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-full bg-red-500/20 flex items-center justify-center flex-shrink-0",children:n.jsx("svg",{className:"w-5 h-5 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126z"})})}),n.jsxs("div",{children:[n.jsx("h4",{className:`font-semibold ${ce?"text-red-400":"text-red-800"}`,children:"Provisioning Needs Attention"}),n.jsx("p",{className:`text-sm mt-1 ${ce?"text-red-300/80":"text-red-700"}`,children:"There was an issue setting up your environment. Our team has been notified and will reach out shortly."})]})]})}):ql||kt?n.jsx("div",{className:`rounded-lg p-5 ${ce?"bg-blue-900/20 border border-blue-800":"bg-olive/10 border border-olive/30"}`,children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:`w-10 h-10 rounded-full ${ce?"bg-blue-500/20":"bg-olive/10"} flex items-center justify-center flex-shrink-0`,children:n.jsx("svg",{className:`w-5 h-5 ${ce?"text-blue-500":"text-olive"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.59 14.37a6 6 0 01-5.84 7.38v-4.8m5.84-2.58a14.98 14.98 0 006.16-12.12A14.98 14.98 0 009.63 8.41m5.96 5.96a14.926 14.926 0 01-5.841 2.58m-.119-8.54a6 6 0 00-7.381 5.84h4.8m2.581-5.84a14.927 14.927 0 00-2.58 5.841m2.699 2.7c-.103.021-.207.041-.311.06a15.09 15.09 0 01-2.448-2.448 14.9 14.9 0 01.06-.312m-2.24 2.39a4.493 4.493 0 00-1.757 4.306 4.493 4.493 0 004.306-1.758M16.5 9a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0z"})})}),n.jsxs("div",{children:[n.jsx("h4",{className:`font-semibold ${ce?"text-blue-400":"text-olive-dark"}`,children:"Provisioning Your Secure Environment"}),n.jsxs("p",{className:`text-sm mt-1 ${ce?"text-blue-300/80":"text-olive"}`,children:["We're setting up your dedicated, isolated environment. Your automations will be ready within ",n.jsx("strong",{children:"24–48 hours"}),". We'll notify you as soon as everything is live."]}),n.jsxs("p",{className:`text-xs mt-3 ${ce?"text-blue-400/60":"text-olive"}`,children:["Requested ",kt?new Date(kt.requestedAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"just now"]})]})]})}):ko?n.jsxs("div",{children:[n.jsxs("div",{className:`rounded-lg p-4 mb-4 ${ce?"bg-slate-700/50":"bg-cream-light"}`,children:[n.jsxs("p",{className:`text-sm ${X} mb-2`,children:[On.length," script",On.length!==1?"s":""," recorded",Hn.length>0?`, ${Hn.length} approved`:""]}),oe&&n.jsxs("p",{className:`text-xs ${Ee}`,children:["Billing contact: ",P.billingInfo.billingContactName," 
362(",P.billingInfo.billingEmail,")"]})]}),n.jsx("button",{"data-testid":"button-deploy-scripts",onClick:async()=>{if(!oe){ja(Rn=>({...Rn,billingContactName:P.contactName||"",billingEmail:P.contactEmail||""})),Vi(!0);return}Hl(!0);try{const Rn=await Tt("/api/portal/sop/deploy",{method:"POST",credentials:"include"}),Gb=await Rn.json();if(!Rn.ok)throw new Error(Gb.error||"Failed to deploy");Vr(!0);const Kb=await Tt("/api/portal/sop/session",{credentials:"include"}).then(Uu=>Uu.json());ne(Kb)}catch(Rn){alert(Rn.message)}finally{Hl(!1)}},disabled:ad,className:"w-full bg-olive hover:bg-olive-dark text-white font-semibold py-3 px-6 rounded-full transition-all disabled:opacity-50 flex items-center justify-center gap-2",children:ad?n.jsxs(n.Fragment,{children:[n.jsxs("svg",{className:"animate-spin w-4 h-4",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Deploying..."]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.59 14.37a6 6 0 01-5.84 7.38v-4.8m5.84-2.58a14.98 14.98 0 006.16-12.12A14.98 14.98 0 009.631 8.41m5.96 5.96a14.926 14.926 0 01-5.841 2.58m-.119-8.54a6 6 0 00-7.381 5.84h4.8m2.581-5.84a14.927 14.927 0 00-2.58 5.841m2.699 2.7c-.103.021-.207.041-.311.06a15.09 15.09 0 01-2.448-2.448 14.9 14.9 0 01.06-.312m-2.24 2.39a4.493 4.493 0 00-1.757 4.306 4.493 4.493 0 004.306-1.758M16.5 9a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0z"})}),"Deploy My Scripts"]})})]}):n.jsx("div",{className:`rounded-lg p-5 text-center ${ce?"bg-slate-700/50":"bg-cream-light"}`,children:n.jsxs("p",{className:`text-sm ${X}`,children:["Record your workflows using the ",n.jsx("button",{onClick:()=>V("sops"),className:"text-olive hover:underline font-medium",children:"Capture feature"})," first, then come back here to deploy them."]})})]})})(),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx("svg",{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 ${Ee}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})}),n.jsx("input",{"data-testid":"input-search-workers",type:"text",value:Zt,onChange:oe=>$l(oe.target.value),className:`w-full ${rt} border rounded-lg pl-10 pr-4 py-2.5 text-sm focus:outline-none focus:border-olive focus:ring-1 focus:ring-olive`,placeholder:"Search employees..."})]}),n.jsxs("select",{"data-testid":"select-worker-status",value:fa,onChange:oe=>Pu(oe.target.value),className:`${rt} border rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-olive`,children:[n.jsx("option",{value:"all",children:"All Status"}),n.jsx("option",{value:"live",children:"Active"}),n.jsx("option",{value:"deployed",children:"Deployed"}),n.jsx("option",{value:"paused",children:"Paused"}),n.jsx("option",{value:"building",children:"Building"}),n.jsx("option",{value:"testing",children:"Testing"})]})]}),be.length>0?n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:be.map(oe=>{const kt=Li===oe.id,Xt=oe.status==="live"?"bg-green-500":oe.status==="deployed"?"bg-olive":oe.status==="paused"?"bg-amber-500":"bg-warm-gray",Fr=oe.status==="live"?ce?"bg-green-900/40 text-green-400 border-green-700":"bg-green-50 text-green-700 border-green-200":oe.status==="deployed"?ce?"bg-blue-900/40 text-blue-400 border-blue-700":"bg-olive/10 text-olive border-olive/30":oe.status==="paused"?ce?"bg-amber-900/40 text-amber-400 border-amber-700":"bg-amber-50 text-amber-700 border-amber-200":ce?"bg-slate-700 text-slate-400 border-slate-600":"bg-cream-dark text-warm-gray border-warm-border";return n.jsxs("div",{"data-testid":`card-worker-${oe.id}`,className:`${J} border rounded-xl p-5 relative cursor-pointer transition-colors ${hs?.id===oe.id?ce?"ring-2 ring-olive":"ring-2 ring-olive/30":""}`,onClick:()=>{Ys(oe),gr(null)},children:[n.jsxs("div",{className:"flex items-start justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:`w-8 h-8 rounded-lg ${ce?"bg-slate-700":"bg-cream-dark"} flex items-center justify-center flex-shrink-0`,children:n.jsx("svg",{className:`w-4 h-4 ${ce?"text-slate-400":"text-warm-gray"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375"})})}),n.jsx("h3",{className:`text-sm font-semibold ${ve}`,children:oe.name})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:`inline-flex items-center gap-1.5 text-[11px] font-medium px-2.5 py-1 rounded-full border ${Fr}`,children:[n.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${Xt}`}),vT[oe.status]?oe.status.charAt(0).toUpperCase()+oe.status.slice(1):oe.status]}),n.jsxs("div",{className:"relative",children:[n.jsx("button",{"data-testid":`button-menu-${oe.id}`,onClick:Hn=>{Hn.stopPropagation(),gr(kt?null:oe.id)},className:`p-1 rounded-md ${ce?"hover:bg-slate-700 text-slate-400":"hover:bg-cream-dark text-warm-gray"} transition-colors`,children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 12.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 18.75a.75.75 0 110-1.5.75.75 0 010 1.5z"})})}),kt&&n.jsx("div",{className:`absolute right-0 top-full mt-1 w-48 ${ce?"bg-slate-700 border-slate-600":"bg-white border-warm-border"} border rounded-xl z-20 py-1`,"data-testid":`menu-${oe.id}`,children:["View Details","View Queue","View Recent Activity","View Issues","Pause Employee","Resume Employee"].map(Hn=>n.jsx("button",{"data-testid":`menu-action-${Hn.toLowerCase().replace(/\s+/g,"-")}-${oe.id}`,onClick:ko=>{ko.stopPropagation(),gr(null),Hn==="View Details"&&Ys(oe)},className:`w-full text-left px-4 py-2.5 text-sm ${ce?"text-slate-200 hover:bg-slate-600":"text-ink hover:bg-cream-light"} transition-colors`,children:Hn},Hn))})]})]})]}),n.jsx("p",{className:`text-sm ${X} mb-3`,children:oe.type||"Automation employee"}),n.jsxs("div",{className:`flex items-center gap-4 text-xs ${Ee}`,children:[n.jsxs("span",{children:["Queue: ",n.jsx("span",{className:`font-medium ${ve}`,children:"0"})]}),oe.deployedAt&&n.jsx("span",{children:new Date(oe.deployedAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]}),n.jsx("div",{className:"mt-2",children:n.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] font-medium px-2 py-0.5 rounded-full ${ce?"bg-green-900/30 text-green-400":"bg-green-50 text-green-700"}`,children:[n.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75"})}),"Audit Logged"]})})]},oe.id)})}):n.jsxs("div",{className:`${J} border rounded-xl p-12 text-center`,children:[n.jsx("div",{className:"text-4xl mb-3",children:"🤖"}),n.jsx("h3",{className:`text-lg font-semibold mb-1 ${ve}
362`,children:Ui.length===0?"No Managed Employees Yet":"No employees match your filters"}),n.jsx("p",{className:`text-sm max-w-md mx-auto ${X}`,children:Ui.length===0?"Your managed employees will appear here once your automations are deployed and running.":"Try adjusting your search or status filter."})]})]})})(),Ub&&n.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center","data-testid":"modal-billing",children:[n.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>{Vi(!1),Sa("")}}),n.jsxs("div",{className:`relative w-full max-w-md mx-4 ${we?"bg-slate-800":"bg-white"} rounded-2xl overflow-hidden`,children:[n.jsx("div",{className:`px-6 py-5 border-b ${we?"border-slate-700":"border-warm-border"}`,children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h3",{className:`text-lg font-bold ${we?"text-white":"text-ink"}`,children:"Billing Contact"}),n.jsx("p",{className:`text-sm mt-1 ${we?"text-slate-400":"text-warm-gray"}`,children:"Who should we reach out to about billing if you upgrade to a paid plan?"})]}),n.jsx("button",{"data-testid":"button-close-billing",onClick:()=>{Vi(!1),Sa("")},className:`p-1 rounded-md ${we?"hover:bg-slate-700 text-slate-400":"hover:bg-cream-dark text-warm-gray"}`,children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),n.jsxs("div",{className:"px-6 py-5 space-y-4",children:[n.jsx("div",{className:`rounded-lg p-4 ${we?"bg-blue-900/20 border border-blue-800":"bg-olive/10 border border-olive/30"}`,children:n.jsx("p",{className:`text-sm ${we?"text-blue-300":"text-olive"}`,children:"Your free account is ready to use right now at no cost. We'll only contact you about billing if you choose to upgrade to a paid plan."})}),ka&&n.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:n.jsx("p",{className:"text-sm text-red-700",children:ka})}),n.jsxs("div",{children:[n.jsx("label",{className:`block text-sm font-medium mb-1 ${we?"text-slate-300":"text-ink"}`,children:"Contact Name"}),n.jsx("input",{"data-testid":"input-billing-contact-name",type:"text",value:Mn.billingContactName,onChange:R=>ja(be=>({...be,billingContactName:R.target.value})),className:`w-full ${we?"bg-slate-700 border-slate-600 text-white":"bg-white border-warm-border text-ink"} border rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-olive`,placeholder:"John Smith"})]}),n.jsxs("div",{children:[n.jsx("label",{className:`block text-sm font-medium mb-1 ${we?"text-slate-300":"text-ink"}`,children:"Billing Email"}),n.jsx("input",{"data-testid":"input-billing-email",type:"email",value:Mn.billingEmail,onChange:R=>ja(be=>({...be,billingEmail:R.target.value})),className:`w-full ${we?"bg-slate-700 border-slate-600 text-white":"bg-white border-warm-border text-ink"} border rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-olive`,placeholder:"[email protected]"})]}),n.jsxs("div",{children:[n.jsxs("label",{className:`block text-sm font-medium mb-1 ${we?"text-slate-300":"text-ink"}`,children:["Phone ",n.jsx("span",{className:`font-normal ${we?"text-slate-500":"text-warm-gray"}`,children:"(optional)"})]}),n.jsx("input",{"data-testid":"input-billing-phone",type:"tel",value:Mn.billingPhone,onChange:R=>ja(be=>({...be,billingPhone:R.target.value})),className:`w-full ${we?"bg-slate-700 border-slate-600 text-white":"bg-white border-warm-border text-ink"} border rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-olive`,placeholder:"(555) 123-4567"})]})]}),n.jsxs("div",{className:`px-6 py-4 border-t ${we?"border-slate-700 bg-slate-800/80":"border-warm-border bg-cream-light"} flex items-center justify-end gap-3`,children:[n.jsx("button",{"data-testid":"button-cancel-billing",onClick:()=>{Vi(!1),Sa("")},className:`px-4 py-2.5 text-sm font-medium rounded-lg ${we?"text-slate-300 hover:bg-slate-700":"text-warm-gray hover:bg-cream-dark"}`,children:"Cancel"}),n.jsx("button",{"data-testid":"button-save-billing",disabled:id,onClick:async()=>
362{if(Sa(""),!Mn.billingContactName||!Mn.billingEmail){Sa("Please provide a contact name and email.");return}Na(!0);try{const R=await Tt("/api/portal/sop/billing",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(Mn)}),be=await R.json();if(!R.ok)throw new Error(be.error||"Failed to save");const ce=await Tt("/api/portal/sop/session",{credentials:"include"}).then(J=>J.json());ne(ce),Vi(!1),ja({billingContactName:"",billingEmail:"",billingPhone:""}),Hl(!0);try{const J=await Tt("/api/portal/sop/deploy",{method:"POST",credentials:"include"}),ve=await J.json();if(!J.ok)throw new Error(ve.error||"Failed to deploy");Vr(!0);const X=await Tt("/api/portal/sop/session",{credentials:"include"}).then(Ee=>Ee.json());ne(X)}catch(J){alert(J.message)}finally{Hl(!1)}}catch(R){Sa(R.message)}finally{Na(!1)}},className:"px-6 py-2.5 text-sm font-semibold rounded-lg bg-olive hover:bg-olive-dark text-white disabled:opacity-50 flex items-center gap-2",children:id?n.jsxs(n.Fragment,{children:[n.jsxs("svg",{className:"animate-spin w-4 h-4",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Saving..."]}):"Continue & Deploy"})]})]})]}),hs&&D==="managed-workers"&&n.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end","data-testid":"panel-worker-detail",children:[n.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:()=>Ys(null)}),n.jsxs("div",{className:`relative w-full max-w-md ${we?"bg-slate-800":"bg-white"} overflow-y-auto`,children:[n.jsxs("div",{className:`sticky top-0 z-10 ${we?"bg-slate-800 border-slate-700":"bg-white border-warm-border"} border-b px-6 py-4 flex items-start justify-between`,children:[n.jsxs("div",{children:[n.jsx("h3",{className:`text-lg font-bold ${we?"text-white":"text-ink"}`,children:hs.name}),n.jsxs("p",{className:`text-sm ${we?"text-slate-400":"text-warm-gray"}`,children:["Managed employee in ",hs.type||"Automation"]})]}),n.jsx("button",{"data-testid":"button-close-worker-panel",onClick:()=>Ys(null),className:`p-1 rounded-md ${we?"hover:bg-slate-700 text-slate-400":"hover:bg-cream-dark text-warm-gray"}`,children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n.jsxs("div",{className:"px-6 py-5 space-y-6",children:[n.jsx("div",{className:`${we?"bg-slate-700/50":"bg-cream-light"} rounded-xl p-4 space-y-3`,children:[{label:"Status",value:vT[hs.status]||hs.status},{label:"Queue Depth",value:"0"},{label:"Last Activity",value:hs.deployedAt?new Date(hs.deployedAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—"},{label:"Related Automation",value:hs.name}].map(R=>n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-sm ${we?"text-slate-400":"text-warm-gray"}`,children:R.label}),n.jsx("span",{className:`text-sm font-medium ${we?"text-white":"text-ink"}`,children:R.value})]},R.label))}),n.jsxs("div",{className:`${we?"bg-slate-700/50":"bg-cream-light"} rounded-xl p-4`,children:[n.jsx("p",{className:`text-xs font-medium uppercase tracking-wider mb-1 ${we?"text-slate-400":"text-warm-gray"}`,children:"Queue Trend (24h)"}),n.jsx("div",{className:"h-12 flex items-end gap-1 mt-2",children:[3,5,2,7,4,6,3,5,8,4,2,6,3,5,4,7,2,5,3,6,4,3,5,2].map((R,be)=>n.jsx("div",{className:`flex-1 rounded-sm ${we?"bg-blue-500/40":"bg-olive/20"}`,style:{height:`${R/8*100}%`}},be))}),n.jsxs("div",{className:"flex items-center justify-between mt-3",children:[n.jsx("span",{className:`text-xs ${we?"text-slate-400":"text-warm-gray"}`,children:"Task Success Rate"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("svg",{className:"w-8 h-8",viewBox:"0 0 36 36",children:[n.jsx("path",{d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",fill:"none",stroke:we?"#334155":"#e2e8f0",strokeWidth:"3"}),n.jsx("path",{d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",fill:"none",stroke:"#22c55e",strokeWidth:"3",strokeDasharray:"94, 100"})]}),n.jsx("span",{className:`text-sm font-bold ${we?"text-green-400":"text-green-600"}`,children:"94%"})]})]})]}),n.jsxs("div",{children:[n.jsxs("p",{className:`text-xs font-bold uppercase tracking-wider mb-3 flex items-center gap-2 ${we?"text-slate-300":"text-ink"}`,children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Oversight"]}),n.jsx("div",{className:`${we?"bg-slate-700/50":"bg-cream-light"} rounded-xl p-4 space-y-3`,children:[{label:"Human Review",value:"Not required"}
362,{label:"Open Issues",value:"0"},{label:"Audit Status",value:"Active - all actions logged"},{label:"Automator",value:hs.type||"Automation"}].map(R=>n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-sm ${we?"text-slate-400":"text-warm-gray"}`,children:R.label}),n.jsx("span",{className:`text-sm font-medium ${we?"text-white":"text-ink"}`,children:R.value})]},R.label))})]}),n.jsxs("div",{children:[n.jsxs("p",{className:`text-xs font-bold uppercase tracking-wider mb-3 flex items-center gap-2 ${we?"text-slate-300":"text-ink"}`,children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Recent Activity"]}),n.jsx("div",{className:`${we?"bg-slate-700/50":"bg-cream-light"} rounded-xl p-4 space-y-3`,children:[{dot:"bg-green-500",text:"Successful Run",desc:hs.name,date:"Recent"},{dot:"bg-green-500",text:"Human Review Completed",desc:"Document Verification",date:"Recent"},{dot:"bg-olive",text:"Automation Deployed",desc:hs.name,date:hs.deployedAt?new Date(hs.deployedAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—"}].map((R,be)=>n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("span",{className:`w-2 h-2 rounded-full mt-1.5 flex-shrink-0 ${R.dot}`}),n.jsxs("div",{children:[n.jsxs("p",{className:`text-sm font-medium ${we?"text-white":"text-ink"}`,children:[R.text," — ",R.desc]}),n.jsx("p",{className:`text-xs ${we?"text-slate-500":"text-warm-gray"}`,children:R.date})]})]},be))})]}),n.jsxs("div",{children:[n.jsxs("p",{className:`text-xs font-bold uppercase tracking-wider mb-3 flex items-center gap-2 ${we?"text-slate-300":"text-ink"}`,children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244"})}),"Linked Objects"]}),n.jsx("div",{className:`${we?"bg-slate-700/50":"bg-cream-light"} rounded-xl p-4 space-y-3`,children:[{label:"Automation",value:hs.name},{label:"Automator",value:hs.type||"Automation"},{label:"Related Issues",value:"0 issue(s)"}].map(R=>n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:`text-sm ${we?"text-slate-400":"text-warm-gray"}`,children:R.label}),n.jsx("span",{className:`text-sm font-medium ${we?"text-white":"text-ink"}`,children:R.value})]},R.label))})]}),n.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[n.jsxs("button",{"data-testid":"button-view-issues",className:`inline-flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-medium ${we?"bg-amber-900/40 text-amber-400 border border-amber-700":"bg-amber-50 text-amber-700 border border-amber-200"}`,children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126z"})}),"View Issues"]}),n.jsxs("button",{"data-testid":"button-open-audit",className:`inline-flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-medium border ${we?"bg-slate-700 text-slate-300 border-slate-600":"bg-white text-ink border-warm-border"}`,children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),"Open Audit Trail"]}),n.jsxs("button",{"data-testid":"button-view-activity",className:`inline-flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-medium border ${we?"bg-slate-700 text-slate-300 border-slate-600":"bg-white text-ink border-warm-border"}`,children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),"View Full Activity"]})]})]})]})]}),D==="automator"&&n.jsxs("div",{className:"space-y-6","data-testid":"section-automator",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("span",{className:"text-3xl",children:"⚙️"}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-bold text-ink",children:"Automator"}),n.jsx("p",{className:"text-warm-gray text-sm",children:"Your automation workflows and configurations"})]})]}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl p-12 text-center",children:[n.jsx("div",{className:"text-4xl mb-3",children:"🔧"}),n.jsx("h3",{className:"text-lg font-semibold text-ink mb-1",children:"Automator Configuration"}),n.jsx("p",{className:"text-warm-gray text-sm max-w-md mx-auto",children:"Your automation workflows will appear here once configured by your VeraCore AI team."})]})]}),D==="playbooks"&&n.jsxs("div",{className:"space-y-6","data-testid":"section-playbooks",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("span",{className:"text-3xl",children:"📘"}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-bold text-ink",children:"Playbooks & Automations"}),n.jsx("p",{className:"text-warm-gray text-sm",children:"Your deployed playbooks and automated workflows"})]})]}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl p-12 text-center",children:[n.jsx("div",{className:"text-4xl mb-3",children:"📚"}),n.jsx("h3",{className:"text-lg font-semibold text-ink mb-1",children:"Playbook Library"}),n.jsx("p",{className:"text-warm-gray text-sm max-w-md mx-auto",children:"Your playbooks will be available here once your automations are deployed."})]})]}),D==="monitoring"&&n.jsxs("div",{className:"space-y-6","data-testid":"section-monitoring",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("span",{className:"text-3xl",children:"📡"}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-bold text-ink",children:"Monitoring"}),n.jsx("p",{className:"text-warm-gray text-sm",children:"Real-time health and performance of your workflows"})]})]}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl p-12 text-center",children:[n.jsx("div",{className:"text-4xl mb-3",children:"📊"}),n.jsx("h3",{className:"text-lg font-semibold text-ink mb-1",children:"System Monitoring"}),n.jsx("p",{className:"text-warm-gray text-sm max-w-md mx-auto",children:"Health dashboards and performance metrics will appear here once your employees are active."})]})]}),D==="human-review"&&n.jsxs("div",{className:"space-y-6","data-testid":"section-human-review",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("span",{className:"text-3xl",children:"✅"}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-bold text-ink",children:"Human Review"}),n.jsx("p",{className:"text-warm-gray text-sm",children:"Items flagged for human approval or judgment"})]})]}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl p-12 text-center",children:[n.jsx("div",{className:"text-4xl mb-3",children:"👁️"}),n.jsx("h3",{className:"text-lg font-semibold text-ink mb-1",children:"Review Queue"}),n.jsx("p",{className:"text-warm-gray text-sm max-w-md mx-auto",children:"Items requiring your approval will appear here when employees flag them for human review."})]})]}),D==="interaction-logs"&&n.jsxs("div",{className:"space-y-6","data-testid":"section-interaction-logs",children:[n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("span",{className:"text-3xl",children:"📋"}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-bold text-ink",children:"Interaction Logs & Alerts"}),n.jsx("p",{className:"text-warm-gray text-sm",children:"Every action is traceable, understandable, and linked to evidence."})]})]})}
362),n.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3",children:[{label:"Events Today",value:"0",dot:"bg-green-500",highlight:!0},{label:"Successful Runs",value:"0",dot:"bg-green-500"},{label:"Warnings",value:"0",dot:"bg-orange-500"},{label:"Human Review",value:"0",dot:"bg-purple-500"},{label:"Issue-Linked",value:"0",dot:"bg-red-500"}].map((R,be)=>n.jsxs("div",{className:`bg-white rounded-xl p-4 border ${R.highlight?"border-green-200 border-2":"border-warm-border"}`,children:[n.jsxs("p",{className:"text-warm-gray text-xs font-medium flex items-center gap-1.5",children:[n.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${R.dot}`}),R.label]}),n.jsx("p",{className:"text-2xl font-bold text-ink mt-1",children:R.value})]},be))}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl p-12 text-center","data-testid":"empty-interaction-logs",children:[n.jsx("div",{className:"text-4xl mb-3",children:"📋"}),n.jsx("h3",{className:"text-lg font-semibold text-ink mb-1",children:"No Interaction Logs Yet"}),n.jsx("p",{className:"text-warm-gray text-sm max-w-md mx-auto",children:"Interaction logs will appear here once your automations begin processing. Every action is traceable and linked to evidence."})]})]}),D==="test-suites"&&n.jsxs("div",{className:"space-y-6","data-testid":"section-test-suites",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("span",{className:"text-3xl",children:"🧪"}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-xl font-bold text-ink",children:"Test Suites"}),n.jsx("p",{className:"text-warm-gray text-sm",children:"Test and validate your automation workflows"})]})]}),n.jsxs("div",{className:"bg-white border border-warm-border rounded-xl p-12 text-center",children:[n.jsx("div",{className:"text-4xl mb-3",children:"🧪"}),n.jsx("h3",{className:"text-lg font-semibold text-ink mb-1",children:"Test Runner"}),n.jsx("p",{className:"text-warm-gray text-sm max-w-md mx-auto",children:"Run test cases against your automations to validate behavior before deployment."})]})]}),D==="feedback"&&(()=>{const R=we,be=R?"bg-slate-800 border-slate-700":"bg-white border-warm-border",ce=R?"text-white":"text-ink",J=R?"text-slate-400":"text-warm-gray",ve=R?"bg-slate-700 border-slate-600 text-white placeholder-slate-500":"bg-white border-warm-border text-ink placeholder-warm-gray",X={idea:{label:"Submitted",color:R?"bg-blue-900/40 text-blue-400":"bg-olive/10 text-olive"},planned:{label:"Planned",color:R?"bg-indigo-900/40 text-indigo-400":"bg-olive/10 text-olive"},in_progress:{label:"In Progress",color:R?"bg-amber-900/40 text-amber-400":"bg-amber-50 text-amber-700"},done:{label:"Completed",color:R?"bg-green-900/40 text-green-400":"bg-green-50 text-green-700"},cancelled:{label:"Declined",color:R?"bg-slate-700 text-slate-400":"bg-cream-dark text-warm-gray"}};return n.jsxs("div",{className:"space-y-6","data-testid":"section-feedback",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("span",{className:"text-3xl",children:"💬"}),n.jsxs("div",{children:[n.jsx("h2",{className:`text-xl font-bold ${ce}`,children:"Feedback & Ideas"}),n.jsx("p",{className:`text-sm ${J}`,children:"Share feedback and feature requests with the VeraCore AI team"})]})]}),n.jsxs("div",{className:`${be} border rounded-xl p-6`,children:[n.jsx("h3",{className:`text-sm font-semibold mb-4 ${ce}`,children:"Submit an Idea"}),nn&&n.jsx("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-lg mb-4 text-sm","data-testid":"text-feedback-success",children:nn}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:`block text-xs font-medium mb-1 ${J}`,children:"Type"}),n.jsxs("select",{"data-testid":"select-feedback-type",value:bo,onChange:Ee=>yo(Ee.target.value),className:`w-full ${ve} border rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-olive`,children:[n.jsx("option",{value:"feature",children:"Feature Request"}),n.jsx("option",{value:"improvement",children:"Improvement"}),n.jsx("option",{value:"bug",children:"Bug Report"})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:`block text-xs font-medium mb-1 ${J}`,children:"Title"}),n.jsx("input",{"data-testid":"input-feedback-title",type:"text",value:Qt,onChange:Ee=>Br(Ee.target.value),className:`w-full ${ve} border rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-olive`,placeholder:"What's your idea?"})]}),n.jsxs("div",{children:[n.jsx("label",{className:`block text-xs font-medium mb-1 ${J}`,children:"Description (optional)"}),n.jsx("textarea",{"data-testid":"input-feedback-desc",value:go,onChange:Ee=>hi(Ee.target.value),className:`w-full ${ve} border rounded-lg px-3 py-2 text-sm focus:outline-none focus:border-olive min-h-[80px] resize-y`,placeholder:"Describe your idea in more detail..."})]}),n.jsx("button",{"data-testid":"button-submit-feedback",onClick:Hb,disabled:vo||!Qt.trim(),className:"bg-olive hover:bg-olive-dark text-white text-sm font-medium px-5 py-2 rounded-lg transition-colors disabled:opacity-50",children:vo?"Submitting...":"Submit Idea"})]})]}),n.jsxs("div",{children:[n.jsxs("h3",{className:`text-sm font-semibold mb-3 ${ce}`,children:["Your Submissions (",$r.length,")"]}),$r.length>0?n.jsx("div",{className:"space-y-3",children:$r.map(Ee=>{const De=X[Ee.status]||X.idea;return n.jsx("div",{"data-testid":`card-feedback-${Ee.id}`,className:`${be} border rounded-xl p-4`,children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:`text-sm font-semibold ${ce}`,children:Ee.title}),Ee.description&&n.jsx("p",{className:`text-xs mt-1 ${J}`,children:Ee.description}),n.jsx("p",{className:`text-xs mt-2 ${R?"text-slate-500":"text-warm-gray"}`,children:new Date(Ee.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]}),n.jsx("span",{className:`text-[11px] font-medium px-2.5 py-1 rounded-full ${De.color}`,children:De.label})]})},Ee.id)})}):n.jsxs("div",{className:`${be} border rounded-xl p-8 text-center`,children:[n.jsx("div",{className:"text-3xl mb-2",children:"💡"}),n.jsx("p",{className:`text-sm ${J}`,children:"No ideas submitted yet. Use the form above to share your first one!"})]})]})]})}
362)(),D==="portal-settings"&&n.jsx(TK,{darkMode:we,session:P,onSessionUpdate:R=>ne(be=>be&&{...be,...R})}),n.jsxs("button",{"data-testid":"button-floating-help",onClick:()=>{V("messages"),window.innerWidth<768&&Ks(!1)},title:"Open Message Us",className:`fixed bottom-5 right-5 z-40 flex items-center gap-2 px-4 py-2.5 rounded-full shadow-lg border transition-all hover:shadow-xl ${we?"bg-slate-800 border-slate-600 text-slate-200 hover:bg-slate-700":"bg-white border-warm-border text-ink hover:bg-cream-light"}`,children:[n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.556-4.03 8.25-9 8.25a9.764 9.764 0 01-2.555-.337A5.972 5.972 0 015.41 20.97a5.969 5.969 0 01-.474-.065 4.48 4.48 0 00.978-2.025c.09-.457-.133-.901-.467-1.226C3.93 16.178 3 14.189 3 12c0-4.556 4.03-8.25 9-8.25s9 3.694 9 8.25z"})}),n.jsx("span",{className:"text-xs font-semibold whitespace-nowrap",children:"Stuck? Chat with us"})]})]})]}),ge&&n.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4","data-testid":"modal-document-viewer",children:n.jsxs("div",{className:"bg-white rounded-2xl w-full max-w-4xl max-h-[90vh] flex flex-col border border-warm-border",children:[n.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-warm-border",children:[n.jsx("h2",{className:"text-lg font-bold text-ink",children:_e}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("a",{href:`/api/portal/sop/documents/${ge}/download`,"data-testid":"button-download-modal",className:"text-sm font-medium text-warm-gray hover:text-ink px-3 py-1.5 rounded-lg hover:bg-cream-dark transition-colors",children:"Download"}),n.jsx("button",{"data-testid":"button-close-doc-viewer",onClick:()=>{ue(null),We(null)},className:"text-warm-gray hover:text-warm-gray p-1 rounded-lg hover:bg-cream-dark transition-colors",children:n.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),n.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:ze?n.jsx("div",{className:"flex items-center justify-center py-16",children:n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-olive"})}):n.jsx("div",{"data-testid":"document-content",className:"prose max-w-none",dangerouslySetInnerHTML:{__html:Me||""}})})]})}),nd&&n.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",onClick:()=>jo(!1),children:n.jsx("div",{className:"bg-white rounded-2xl border border-warm-border w-full max-w-md",onClick:R=>R.stopPropagation(),children:n.jsxs("div",{className:"p-8 text-center",children:[n.jsx("div",{className:"w-16 h-16 bg-amber-500 rounded-full flex items-center justify-center mx-auto mb-4",children:n.jsx("svg",{className:"w-8 h-8 text-white",viewBox:"0 0 20 20",fill:"currentColor",children:n.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l6.518 11.59c.75 1.334-.213 2.99-1.742 2.99H3.48c-1.53 0-2.493-1.656-1.743-2.99L8.257 3.1zM11 13a1 1 0 10-2 0 1 1 0 002 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),n.jsx("h3",{"data-testid":"text-recording-failed-title",className:"text-xl font-bold text-ink mb-2",children:"Recording couldn't upload"}),n.jsx("p",{className:"text-warm-gray text-sm mb-2",children:"We brought you back to your portal, but the recording didn't finish uploading automatically."}),Vl&&n.jsxs("p",{className:"text-xs text-warm-gray/80 mb-4 italic",children:["Reason: ",Vl]}),n.jsx("p",{className:"text-warm-gray text-sm mb-6",children:"Make sure you're signed in here, then try again from the extension. Your recording is still saved locally in the extension and you can re-upload it."}),n.jsx("button",{"data-testid":"btn-dismiss-recording-failed",onClick:()=>jo(!1),className:"bg-olive hover:bg-olive-dark text-white px-6 py-2.5 rounded-lg text-sm font-semibold transition-colors",children:"Got it"})]})})}),xs&&n.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",onClick:()=>ba(!1),children:n.jsx("div",{className:"bg-white rounded-2xl border border-warm-border w-full max-w-md",onClick:R=>R.stopPropagation(),children:n.jsxs("div",{className:"p-8 text-center",children:[n.jsx("div",{className:"w-16 h-16 bg-olive rounded-full flex items-center justify-center mx-auto mb-4",children:n.jsx("svg",{className:"w-8 h-8 text-white",viewBox:"0 0 20 20",fill:"currentColor",children:n.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),n.jsx("h3",{"data-testid":"text-recording-saved-title",className:"text-xl font-bold text-ink mb-2",children:"Recording Saved!"}),n.jsx("p",{className:"text-warm-gray text-sm mb-6",children:"Your workflow recording has been saved and is being processed. Steps will be detected, audio transcribed, and the workflow analyzed automatically. This usually takes 10-30 seconds."}),n.jsxs("div",{className:"flex items-center justify-center gap-2 mb-6",children:[n.jsxs("svg",{className:"animate-spin h-4 w-4 text-olive",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),n.jsx("span",{className:"text-sm text-olive font-medium",children:"Processing your recording..."})]}),n.jsx("button",{"data-testid":"btn-dismiss-recording-saved",onClick:()=>ba(!1),className:"bg-olive hover:bg-olive-dark text-white px-6 py-2.5 rounded-lg text-sm font-semibold transition-colors",children:"Got it"})]})})}),kp]})]})}const Dh=[{action:"Navigate to portal",selector:"address-bar",detail:"https://claims.acmeinsurance.com/queue",time:"0:03"}
362,{action:"Click login button",selector:"login-btn",detail:'Button: "Sign In"',time:"0:05"},{action:"Type username",selector:"username-field",detail:"Input: [email protected]",time:"0:08"},{action:"Type password",selector:"password-field",detail:"••••••••••",time:"0:10"},{action:"Submit login form",selector:"submit-btn",detail:'Button: "Login"',time:"0:12"},{action:"Click claims queue",selector:"nav-claims",detail:'Link: "Claims Queue"',time:"0:15"},{action:"Select pending claim",selector:"claim-row",detail:"Row: CLM-2847 — Johnson",time:"0:18"},{action:"Review claim details",selector:"claim-detail",detail:"Panel: Claim details loaded",time:"0:21"},{action:"Click approve button",selector:"approve-btn",detail:'Button: "Approve Claim"',time:"0:24"},{action:"Add processing note",selector:"note-field",detail:'Textarea: "Verified — auto-approved"',time:"0:27"},{action:"Submit approval",selector:"confirm-btn",detail:'Button: "Confirm"',time:"0:30"}],kv=["I'm logging into the claims portal now...","This is our main claims queue — I filter by pending status first.","For standard claims under $5,000, I check the documentation is complete...","If everything matches, I approve it directly — no escalation needed.","I always add a processing note so the audit trail is clean.","That's the full flow — about 30 seconds per claim."],Sv=`// Workflow: Claims Queue Processing
363// Generated from Workflow Capture recording
364
365Step 1: Navigate to Claims Portal
366  → Open https://claims.acmeinsurance.com/queue
367  → Login with credentials
368
369Step 2: Filter Pending Claims  ↻ Repeating
370  → Click "Claims Queue" in sidebar
371  → Sort by: Oldest first
372  → Filter: Status = "Pending"
373
374Step 3: Process Each Claim  ⚡ Condition
375  → Open claim details
376  → IF amount < $5,000 AND docs complete:
377      → Click "Approve Claim"
378      → Add note: "Verified — auto-approved"
379  → ELSE:
380      → Flag for manual review
381
382Step 4: Confirm & Close
383  → Submit approval
384  → Move to next claim in queue`;function AK(){const[t,e]=j.useState("idle"),[s,r]=j.useState(0),[i,a]=j.useState(0),[l,d]=j.useState(0),[u,m]=j.useState(!1),[p,x]=j.useState(0),[g,b]=j.useState(0),v=j.useRef([]),k=j.useCallback(_=>(v.current.push(_),_),[]),N=j.useCallback(()=>{v.current.forEach(_=>{clearInterval(_),clearTimeout(_)}),v.current=[]},[]);j.useEffect(()=>()=>N(),[N]);const S=()=>{N(),e("recording"),r(0),a(0),d(0),m(!1);let _=0;k(setInterval(()=>{if(_++,_>=Dh.length){N(),k(setTimeout(()=>{e("processing"),x(0);let T=0;k(setInterval(()=>{T+=2,x(T),T>=100&&(N(),k(setTimeout(()=>{e("complete"),b(0);const $=Sv.split(`
385`).length;let L=0;k(setInterval(()=>{L++,b(L),L>=$&&N()},60))},600)))},40))},1200));return}a(_),r(_+1),_%2===0&&(m(!0),d(T=>Math.min(T+1,kv.length-1)))},900))},A=()=>{N(),e("idle"),r(0),a(0),x(0),b(0)},E=t==="idle"?"Ready":t==="recording"?`Recording: ${s} actions captured`:t==="processing"?`Processing: ${p}%`:"Script generated";return n.jsxs("div",{className:"relative w-full max-w-5xl mx-auto",children:[n.jsx("span",{className:"sr-only","aria-live":"polite",role:"status",children:E}),n.jsxs("div",{className:"bg-white rounded-2xl border border-warm-border overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-warm-border bg-cream-light",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full bg-red-400"}),n.jsx("div",{className:"w-3 h-3 rounded-full bg-amber-400"}),n.jsx("div",{className:"w-3 h-3 rounded-full bg-green-400"})]}),n.jsx("div",{className:"flex-1 flex items-center justify-center",children:n.jsxs("div",{className:"bg-white rounded-lg border border-warm-border px-4 py-1 text-xs text-warm-gray max-w-md w-full text-center truncate",children:[t==="idle"&&"claims.acmeinsurance.com",t==="recording"&&(Dh[i]?.detail||"Recording..."),t==="processing"&&"Processing recording...",t==="complete"&&"Script generated successfully"]})}),t==="recording"&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"relative flex h-2.5 w-2.5",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-red-500"})]}),n.jsx("span",{className:"text-[10px] font-bold text-red-500 uppercase tracking-wider",children:"REC"})]})]}),n.jsx("div",{className:"relative min-h-[420px] sm:min-h-[480px] overflow-hidden",children:n.jsxs(Rr,{mode:"wait",children:[t==="idle"&&n.jsxs(G.div,{initial:{opacity:0}
385,animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 flex flex-col items-center justify-center p-8",children:[n.jsx("div",{className:"w-20 h-20 bg-olive/10 rounded-2xl flex items-center justify-center mb-6",children:n.jsxs("svg",{className:"w-10 h-10 text-olive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polygon",{points:"10,8 16,12 10,16",fill:"currentColor",stroke:"none"})]})}),n.jsx("h3",{className:"font-serif text-2xl sm:text-3xl text-ink mb-3 text-center",children:"See Workflow Capture in Action"}),n.jsx("p",{className:"text-warm-gray text-sm sm:text-base text-center max-w-lg mb-8",children:"Watch how a claims processor records their workflow in 30 seconds — and turns it into an AI-ready script instantly."}),n.jsxs("button",{onClick:S,className:"bg-olive hover:bg-olive-dark text-white font-semibold px-8 py-3 rounded-full transition-all text-sm flex items-center gap-2","data-testid":"button-start-capture-demo",children:[n.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:n.jsx("polygon",{points:"5,3 19,12 5,21"})}),"Watch the Demo"]})]},"idle"),t==="recording"&&n.jsxs(G.div,{initial:{opacity:0}
385,animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 flex flex-col sm:flex-row",children:[n.jsxs("div",{className:"flex-1 p-4 sm:p-6 overflow-y-auto",children:[n.jsxs("div",{className:"bg-cream rounded-xl border border-warm-border p-3 sm:p-4 mb-4",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[n.jsx("div",{className:"w-8 h-8 bg-olive rounded-lg flex items-center justify-center",children:n.jsx("svg",{className:"w-4 h-4 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})})}),n.jsxs("div",{children:[n.jsx("p",{className:"text-xs font-bold text-ink",children:"Claims Queue — Pending Review"}),n.jsx("p",{className:"text-[10px] sm:text-xs text-warm-gray",children:"12 claims waiting"})]})]}),n.jsx("div",{className:"space-y-1.5",children:["CLM-2847 — Johnson, M. — $3,200","CLM-2848 — Roberts, K. — $7,100","CLM-2849 — Chen, L. — $1,890","CLM-2850 — Williams, D. — $4,500"].map((_,T)=>n.jsxs(G.div,{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs transition-all ${T===0&&i>=6?"bg-olive/10 border border-olive/30 text-olive font-medium":"bg-white border border-warm-border text-ink"}`,animate:T===0&&i>=6?{scale:[1,1.02,1]}:{},children:[n.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${T===0&&i>=8?"bg-green-500":"bg-amber-400"}`}),_]},T))})]}),i>=8&&n.jsxs(G.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"bg-green-50 border border-green-200 rounded-lg p-3 flex items-center gap-2",children:[n.jsx("svg",{className:"w-4 h-4 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),n.jsx("span",{className:"text-xs font-medium text-green-700",children:"Claim CLM-2847 approved successfully"})]})]}),n.jsxs("div",{className:"w-full sm:w-52 md:w-64 border-t sm:border-t-0 sm:border-l border-warm-border bg-cream-light p-3 sm:p-4 flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsxs("span",{className:"relative flex h-2 w-2",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-red-500"})]}),n.jsx("span",{className:"text-[10px] sm:text-xs font-bold text-red-500",children:"RECORDING"})]}),n.jsx("span",{className:"text-[10px] sm:text-xs text-warm-gray font-mono",children:Dh[i]?.time||"0:00"})]}),n.jsxs("div",{className:"text-center mb-4",children:[n.jsx(G.p,{initial:{scale:1.3,opacity:0}
385,animate:{scale:1,opacity:1},className:"text-3xl font-black text-ink",children:s},s),n.jsx("p",{className:"text-[10px] sm:text-xs text-warm-gray uppercase tracking-wider",children:"actions captured"})]}),n.jsxs("div",{className:"flex items-center gap-1.5 mb-3 px-2 py-1.5 bg-olive/10 rounded-lg",children:[n.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-olive opacity-75"}),n.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5 bg-olive"})]}),n.jsx("span",{className:"text-[10px] text-olive font-medium",children:"Audio narration recording"})]}),n.jsxs("div",{className:"flex-1 overflow-hidden",children:[n.jsx("p",{className:"text-[10px] font-bold text-warm-gray uppercase tracking-wider mb-2",children:"Action Log"}),n.jsx("div",{className:"space-y-1",children:Dh.slice(0,i+1).slice(-5).map((_,T)=>n.jsxs(G.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},className:"flex items-start gap-1.5 text-[10px] sm:text-xs",children:[n.jsx("span",{className:"text-warm-gray/50 font-mono shrink-0",children:_.time}),n.jsx("span",{className:"text-ink truncate",children:_.action})]},`${_.time}-${T}`))})]}),n.jsx(Rr,{children:u&&n.jsxs(G.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0},className:"mt-3 bg-white rounded-lg border border-warm-border p-2",children:[n.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[n.jsx("svg",{className:"w-3 h-3 text-olive",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z"})}),n.jsx("span",{className:"text-[10px] font-bold text-olive uppercase",children:"Voice"})]}),n.jsxs("p",{className:"text-[10px] sm:text-xs text-warm-gray italic leading-relaxed",children:['"',kv[l],'"']})]})})]})]},"recording"),t==="processing"&&n.jsxs(G.div,{initial:{opacity:0}
385,animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 flex flex-col items-center justify-center p-8",children:[n.jsx("div",{className:"w-16 h-16 bg-olive/10 rounded-2xl flex items-center justify-center mb-6",children:n.jsxs("svg",{className:"w-8 h-8 text-olive animate-spin",fill:"none",viewBox:"0 0 24 24",children:[n.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),n.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}),n.jsx("h3",{className:"text-lg font-bold text-ink mb-2",children:"Generating Your Script"}),n.jsxs("p",{className:"text-sm text-warm-gray mb-6 text-center max-w-sm",children:["Analyzing ",Dh.length," captured actions and voice narration..."]}),n.jsx("div",{className:"w-64 bg-cream-dark rounded-full h-2 overflow-hidden",children:n.jsx(G.div,{className:"h-full bg-olive rounded-full",initial:{width:0},animate:{width:`${p}%`}})}),n.jsxs("div",{className:"flex items-center gap-6 mt-6 text-xs text-warm-gray",children:[n.jsxs("span",{className:p>20?"text-olive font-medium":"",children:[p>20?"✓":"○"," Transcribing audio"]}),n.jsxs("span",{className:p>50?"text-olive font-medium":"",children:[p>50?"✓":"○"," Detecting patterns"]}),n.jsxs("span",{className:p>80?"text-olive font-medium":"",children:[p>80?"✓":"○"," Building script"]})]})]},"processing"),t==="complete"&&n.jsxs(G.div,{initial:{opacity:0}
385,animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 flex flex-col sm:flex-row overflow-y-auto",children:[n.jsxs("div",{className:"flex-1 p-4 sm:p-6 overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[n.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500"}),n.jsx("span",{className:"text-xs font-bold text-green-600",children:"Script Generated"}),n.jsx("span",{className:"text-[10px] sm:text-xs text-warm-gray ml-auto",children:"Claims Queue Processing"})]}),n.jsxs("div",{className:"bg-[#1a1a2e] rounded-xl p-4 font-mono text-[10px] sm:text-[11px] leading-relaxed overflow-hidden h-[240px] sm:h-[380px]",children:[Sv.split(`
386`).slice(0,g).map((_,T)=>n.jsx(G.div,{initial:{opacity:0,x:-5},animate:{opacity:1,x:0},transition:{delay:T*.02},className:_.startsWith("//")?"text-green-400/60":_.startsWith("Step")?"text-amber-300 font-bold mt-2":_.includes("↻")||_.includes("⚡")?"text-purple-300":_.includes("→")?"text-slate-300 pl-4":"text-slate-400",children:_||" "},T)),g<Sv.split(`
387`).length&&n.jsx("span",{className:"inline-block w-2 h-4 bg-olive animate-pulse ml-1"})]})]}),n.jsxs("div",{className:"w-full sm:w-52 md:w-60 border-t sm:border-t-0 sm:border-l border-warm-border bg-cream-light p-4 flex flex-col gap-4 overflow-y-auto",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-[10px] sm:text-xs font-bold text-olive uppercase tracking-wider mb-2",children:"AI Analysis"}),n.jsx("div",{className:"space-y-2",children:[{label:"Repeating Loop",desc:"Claims queue iteration",icon:"↻"},{label:"Condition Detected",desc:"Amount threshold check",icon:"⚡"},{label:"Decision Point",desc:"Approve vs. escalate",icon:"◇"}].map((_,T)=>n.jsxs(G.div,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:.5+T*.15},className:"bg-white rounded-lg border border-warm-border p-2",children:[n.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[n.jsx("span",{className:"text-sm",children:_.icon}),n.jsx("span",{className:"text-[10px] sm:text-xs font-bold text-ink",children:_.label})]}),n.jsx("p",{className:"text-[10px] sm:text-xs text-warm-gray",children:_.desc})]},T))})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-[10px] sm:text-xs font-bold text-olive uppercase tracking-wider mb-2",children:"Voice Transcript"}),n.jsx("div",{className:"bg-white rounded-lg border border-warm-border p-2 text-[10px] sm:text-xs text-warm-gray italic leading-relaxed max-h-32 overflow-y-auto",children:kv.map((_,T)=>n.jsxs("p",{className:"mb-1",children:['"',_,'"']},T))})]}),n.jsxs(G.button,{initial:{opacity:0}
387,animate:{opacity:1},transition:{delay:1.5},className:"bg-olive hover:bg-olive-dark text-white text-xs font-semibold px-4 py-2.5 rounded-full transition-all flex items-center justify-center gap-1.5 mt-auto","data-testid":"button-export-runtime",children:[n.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 7l5 5m0 0l-5 5m5-5H6"})}),"Export to Runtime"]})]})]},"complete")]})}),t!=="idle"&&n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-t border-warm-border bg-cream-light",children:[n.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-warm-gray",children:[n.jsxs("span",{className:t==="recording"?"text-olive font-bold":t!=="idle"?"text-olive":"",children:[t==="recording"||t==="processing"||t==="complete"?"✓":"○"," Record"]}),n.jsx("span",{className:"text-warm-gray/30",children:"—"}),n.jsxs("span",{className:t==="processing"?"text-olive font-bold":t==="complete"?"text-olive":"",children:[t==="processing"||t==="complete"?"✓":"○"," Process"]}),n.jsx("span",{className:"text-warm-gray/30",children:"—"}),n.jsxs("span",{className:t==="complete"?"text-olive font-bold":"",children:[t==="complete"?"✓":"○"," Script Ready"]})]}),n.jsx("button",{onClick:A,className:"text-[10px] text-warm-gray hover:text-ink transition-colors","data-testid":"button-replay-demo",children:"↺ Replay"})]})]})]})}const Xs={hidden:{opacity:0,y:30},visible:{opacity:1,y:0,transition:{duration:.6}}},Yi={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.1}}};function MK(){return n.jsxs("div",{className:"min-h-screen bg-cream text-ink font-sans antialiased",children:[n.jsx("nav",{className:"fixed top-0 w-full z-50 bg-white/80 backdrop-blur-xl border-b border-warm-border",children:n.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-3 sm:py-4 flex justify-between items-center",children:[n.jsxs(Ae,{href:"/",className:"flex flex-col group",onClick:()=>window.scrollTo(0,0),children:[n.jsx("span",{className:"font-black text-xl sm:text-2xl text-ink",children:"Workflow AS"}),n.jsx("span",{className:"text-[10px] text-warm-gray tracking-wide"})]}),n.jsxs("div",{className:"hidden md:flex items-center gap-8",children:[[{label:"How It Works",href:"/how-it-works"},{label:"Industries",href:"/industries"},{label:"Security",href:"/security"},{label:"Pricing",href:"/pricing"}].map(t=>n.jsx(Ae,{href:t.href,className:"text-warm-gray hover:text-ink font-medium transition-colors",children:t.label},t.label)),n.jsx("span",{className:"text-olive font-semibold",children:"Workflow Capture"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(FO,{}),n.jsxs("a",{href:"/get-started",className:"inline-flex items-center px-4 py-2 rounded-full border border-olive text-olive hover:bg-olive/10 font-semibold transition-all text-xs sm:text-sm","data-testid":"button-nav-cta",children:[n.jsx("span",{className:"hidden sm:inline",children:"Get Started Free"}),n.jsx("span",{className:"sm:hidden",children:"Get Started"}),n.jsx(kn,{className:"ml-1 w-4 h-4"})]})]})]})}),n.jsx("section",{className:"pt-28 sm:pt-36 pb-16 sm:pb-24 px-4",children:n.jsx("div",{className:"max-w-4xl mx-auto text-center",children:n.jsxs(G.div,{initial:"hidden",animate:"visible",variants:Yi,children:[n.jsxs(G.div,{variants:Xs,className:"inline-flex items-center gap-2 bg-olive/10 text-olive px-4 py-1.5 rounded-full text-sm font-medium mb-6",children:[n.jsx(ii,{className:"w-4 h-4"}),"Chrome Extension"]}),n.jsx(G.h1,{variants:Xs,className:"font-serif text-4xl sm:text-5xl lg:text-6xl text-ink leading-tight mb-6",children:"Workflow Capture"}),n.jsx(G.p,{variants:Xs,className:"text-lg sm:text-xl text-warm-gray max-w-2xl mx-auto mb-4",children:"Record your browser workflows with voice narration. Turn manual tasks into AI-ready automation scripts — no coding, no documentation, no process manuals."}),n.jsx(G.p,{variants:Xs,className:"text-sm text-warm-gray/70 max-w-xl mx-auto mb-10",children:"Workflow Capture is a Chrome extension built by Workflow AS. It watches as you work, records every click and keystroke, captures your voice explanations, and generates structured scripts your AI employee can learn from."}),n.jsxs(G.div,{variants:Xs,className:"flex flex-wrap items-center justify-center gap-3",children:[n.jsxs("a",{href:"/get-started",className:"inline-flex items-center gap-2 bg-olive hover:bg-olive-dark text-white px-6 py-3 rounded-full font-semibold transition-all text-sm","data-testid":"link-get-started-hero",children:["Get Started",n.jsx(kn,{className:"w-4 h-4"})]}),n.jsxs(Ae,{href:"/extension-support",className:"inline-flex items-center gap-2 border border-warm-border hover:border-olive/30 px-6 py-3 rounded-full font-semibold transition-all text-sm text-warm-gray hover:text-ink","data-testid":"link-extension-support-hero",children:[n.jsx(gj,{className:"w-4 h-4"}),"Installation Help"]})]})]})})}),n.jsx("section",{className:"pb-16 sm:pb-24 px-4",children:n.jsx("div",{className:"max-w-5xl mx-auto",children:n.jsx(AK,{})})}),n.jsx("section",{className:"py-16 sm:py-24 px-4 bg-white border-y border-warm-border",children:n.jsxs("div",{className:"max-w-5xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",
387whileInView:"visible",viewport:{once:!0},variants:Yi,className:"text-center mb-12",children:[n.jsx(G.h2,{variants:Xs,className:"font-serif text-3xl sm:text-4xl text-ink mb-4",children:"How It Works"}),n.jsx(G.p,{variants:Xs,className:"text-warm-gray max-w-xl mx-auto",children:"Three simple steps to turn your manual workflows into AI-ready scripts."})]}),n.jsx(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Yi,className:"grid md:grid-cols-3 gap-8",children:[{icon:gl,step:"1",title:"Record Your Workflow",description:"Click the extension icon and hit Start Recording. Then perform your task as you normally would — navigate pages, click buttons, fill out forms. Workflow Capture tracks every action automatically."},{icon:oo,step:"2",title:"Narrate As You Go",description:"Talk out loud as you work. Explain why you're doing each step, what to watch out for, and how you handle edge cases. Your voice narration captures the tribal knowledge no document ever could."},{icon:Mw,step:"3",title:"Get Your Script",description:"When you're done, click Stop & Save. Workflow Capture sends your recording to the portal, where it's analyzed and converted into a structured, reviewable automation script — ready for your AI employee."}].map((t,e)=>n.jsxs(G.div,{variants:Xs,className:"bg-cream rounded-2xl border border-warm-border p-8 text-center",children:[n.jsx("div",{className:"w-14 h-14 bg-olive/10 rounded-2xl flex items-center justify-center mx-auto mb-5",children:n.jsx(t.icon,{className:"w-7 h-7 text-olive"})}),n.jsxs("div",{className:"text-xs font-bold text-olive uppercase tracking-wider mb-2",children:["Step ",t.step]}),n.jsx("h3",{className:"font-serif text-xl text-ink mb-3",children:t.title}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed",children:t.description})]},e))})]})}),n.jsx("section",{className:"py-16 sm:py-24 px-4",children:n.jsxs("div",{className:"max-w-5xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Yi,className:"text-center mb-12",children:[n.jsx(G.h2,{variants:Xs,className:"font-serif text-3xl sm:text-4xl text-ink mb-4",children:"What It Captures"}),n.jsx(G.p,{variants:Xs,className:"text-warm-gray max-w-xl mx-auto",children:"Every detail of your workflow is recorded so your AI employee can learn exactly how you work."})]}),n.jsx(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Yi,className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-6",children:[{icon:gl,title:"Clicks & Navigation",desc:"Every button click, link, tab switch, and page navigation is tracked with precise selectors."},{icon:Mw,title:"Form Entries",desc:"Text typed into fields, dropdowns selected, checkboxes toggled — all captured with context."},{icon:oo,title:"Voice Narration",desc:"Your spoken explanations are recorded and transcribed, preserving decision-making logic and reasoning."},{icon:LA,title:"Timing & Sequence",desc:"The exact order and timing of each step, so the AI understands the workflow rhythm."},{icon:Ix,title:"Page Context",desc:"URLs, page titles, and visible content give each action full context within the workflow."},{icon:q$,title:"Decision Points",desc:"Conditional branches, approvals, and escalation paths are identified from your narration."}].map((t,e)=>n.jsxs(G.div,{variants:Xs,className:"bg-white rounded-xl border border-warm-border p-6",children:[n.jsx(t.icon,{className:"w-5 h-5 text-olive mb-3"}),n.jsx("h3",{className:"font-semibold text-ink mb-1.5 text-sm",children:t.title}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed",children:t.desc})]},e))})]})}),n.jsx("section",{className:"py-16 sm:py-24 px-4 bg-white border-y border-warm-border",children:n.jsxs("div",{className:"max-w-4xl mx-auto",children:[n.jsxs(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Yi,className:"text-center mb-12",children:[n.jsx(G.h2,{variants:Xs,className:"font-serif text-3xl sm:text-4xl text-ink mb-4",children:"Privacy & Security"}),n.jsx(G.p,{variants:Xs,className:"text-warm-gray max-w-xl mx-auto",children:"Your data stays yours. Workflow Capture is built with enterprise-grade privacy from the ground up."})]}
387),n.jsx(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Yi,className:"grid sm:grid-cols-2 gap-6",children:[{icon:po,title:"No Passwords Captured",desc:"Password fields are automatically excluded from recordings. Sensitive inputs are never stored."},{icon:QA,title:"You Control What's Recorded",desc:"Start and stop recording whenever you want. Only the workflows you choose to capture are sent."},{icon:Ix,title:"Review Before Sending",desc:"You can review every captured action before it's submitted to your portal. Nothing is sent without your approval."},{icon:vs,title:"Encrypted Transmission",desc:"All data is transmitted over HTTPS. Your recordings are sent directly to your dedicated portal."}].map((t,e)=>n.jsxs(G.div,{variants:Xs,className:"bg-cream rounded-xl border border-warm-border p-6 flex items-start gap-4",children:[n.jsx("div",{className:"w-10 h-10 bg-olive/10 rounded-lg flex items-center justify-center flex-shrink-0",children:n.jsx(t.icon,{className:"w-5 h-5 text-olive"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-ink mb-1",children:t.title}),n.jsx("p",{className:"text-warm-gray text-sm leading-relaxed",children:t.desc})]})]},e))})]})}),n.jsx("section",{className:"py-16 sm:py-24 px-4",children:n.jsxs("div",{className:"max-w-3xl mx-auto",children:[n.jsx(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Yi,className:"text-center mb-12",children:n.jsx(G.h2,{variants:Xs,className:"font-serif text-3xl sm:text-4xl text-ink mb-4",children:"Frequently Asked Questions"})}),n.jsx(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Yi,className:"space-y-3",children:[{q:"What browsers does Workflow Capture support?",a:"Workflow Capture is a Chrome extension and works on Google Chrome and Chromium-based browsers like Microsoft Edge and Brave."},{q:"Does it record my screen or take screenshots?",a:"No. Workflow Capture records browser actions (clicks, navigation, form entries) and voice narration — not your screen. It does not take screenshots or capture video of your display."},{q:"Can I use it on any website?",a:"Yes. Workflow Capture works on any website you visit in Chrome. It records the actions you take regardless of the platform or web application."},{q:"How long should my recordings be?",a:"We recommend keeping recordings under 5 minutes. If a task takes longer, break it into separate recordings — one per logical sub-task."},{q:"What happens to my recordings?",a:"Recordings are sent directly to your Workflow AS portal, where they're processed into structured automation scripts. You review and approve every script before it's used to train your AI employee."},{q:"Is my data shared with anyone?",a:"No. Your recordings are only accessible to your organization through your secure portal. We do not share, sell, or use your data for any other purpose."}].map((t,e)=>n.jsx(_K,{question:t.q,answer:t.a,index:e},e))})]})}),n.jsx("section",{className:"py-16 sm:py-24 px-4 bg-ink",children:n.jsx("div",{className:"max-w-3xl mx-auto text-center",children:n.jsxs(G.div,{initial:"hidden",whileInView:"visible",viewport:{once:!0},variants:Yi,children:[n.jsx(G.h2,{variants:Xs,className:"font-serif text-3xl sm:text-4xl text-white mb-4",children:"Ready to Capture Your First Workflow?"}),n.jsx(G.p,{variants:Xs,className:"text-white/60 max-w-lg mx-auto mb-8",children:"Get started with Workflow AS and let your AI employee learn directly from how you work."}),n.jsxs(G.div,{variants:Xs,className:"flex flex-wrap items-center justify-center gap-3",children:[n.jsxs("a",{href:"/get-started",className:"inline-flex items-center gap-2 bg-olive hover:bg-olive-dark text-white px-6 py-3 rounded-full font-semibold transition-all text-sm","data-testid":"link-get-started-bottom",children:["Get Started",n.jsx(kn,{className:"w-4 h-4"})]}),n.jsx(Ae,{href:"/extension-support",className:"inline-flex items-center gap-2 border border-white/20 hover:border-white/40 text-white/80 hover:text-white px-6 py-3 rounded-full font-semibold transition-all text-sm","data-testid":"link-extension-support-bottom",children:"Need Help Installing?"})]})]})})}),n.jsx("footer",{className:"bg-white border-t border-warm-border py-8 px-4",children:n.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-4",children:[n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"font-black text-lg text-ink",children:"Workflow AS"}),n.jsx("span",{className:"text-[10px] text-warm-gray tracking-wide"})]}),n.jsxs("div",{className:"flex items-center gap-6 text-sm text-warm-gray",children:[n.jsx(Ae,{href:"/privacy",className:"hover:text-ink transition-colors",children:"Privacy"}),n.jsx(Ae,{href:"/terms",className:"hover:text-ink transition-colors",children:"Terms"}),n.jsx(Ae,{href:"/security",className:"hover:text-ink transition-colors",children:"Security"}),n.jsx(Ae,{href:"/extension-support",className:"hover:text-ink transition-colors",children:"Extension Support"}),n.jsx(Ae,{href:"/contact",className:"hover:text-ink transition-colors",children:"Contact"})]})]})}),n.jsx(qO,{})]})}function _K({question:t,answer:e,index:s}){const[r,i]=j.useState(!1);return n.jsx(G.div,{variants:Xs,children:n.jsxs("button",{"data-testid":`faq-capture-${s}`,onClick:()=>i(!r),className:"w-full text-left bg-white rounded-xl border border-warm-border hover:border-olive/30 transition-all",children:[n.jsxs("div",{className:"flex items-center justify-between p-5",children:[n.jsx("span",{className:"font-semibold text-ink pr-4",children:t}),n.jsx(mo,{className:`w-5 h-5 text-warm-gray/60 shrink-0 transition-transform duration-200 ${r?"rotate-180":""}`})]}),r&&n.jsx("div",{className:"px-5 pb-5 -mt-1",children:n.jsx("p",{className:"text-warm-gray leading-relaxed",children:e})})]})})}const OK=[{href:"/admin",label:"Dashboard",icon:C9},{href:"/admin/clients",label:"Clients",icon:wj},{href:"/admin/billing",label:"Billing",icon:K8},{href:"/admin/documents",label:"Documents",icon:Mi},{href:"/admin/issues",label:"Issues",icon:oi},{href:"/admin/enhancements",label:"Enhancements",icon:qA},{href:"/admin/data-export",label:"Data Export",icon:na},{href:"/admin/integration-requests",label:"Integration Requests",icon:s$},{href:"/admin/mass-messaging",label:"Mass Messaging",icon:Zm},{href:"/admin/team",label:"Team",icon:N$},{href:"/admin/app-settings",label:"Settings",icon:ym}];function RK({admin:t,onSignOut:e,children:s}){const[r]=Al(),{data:i}=ds({queryKey:["/api/admin/tickets","active"],queryFn:async()=>{const d=await fetch("/api/admin/tickets?status=active",{credentials:"include"});if(!d.ok)throw new Error("failed");return d.json()},refetchInterval:3e4}),a=(i?.totalsByStatus?.open||0)+(i?.totalsByStatus?.in_progress||0),l=d=>d==="/admin"?r==="/admin"||r==="/admin/":r===d||r.startsWith(d+"/");return n.jsxs("div",{className:"h-screen overflow-hidden bg-[#f7f5f0] text-ink flex","data-testid":"layout-admin",children:[n.jsxs("aside",{className:"w-[220px] shrink-0 bg-white border-r border-[#e7e3d9] relative",children:[n.jsxs("div",{className:"px-4 py-5 flex items-center gap-2 border-b border-[#f0ece2]",children:[n.jsx("div",{className:"w-7 h-7 rounded-md bg-olive-dark flex items-center justify-center text-white font-black text-xs",children:"W"}),n.jsx("span",{className:"font-black text-[15px] text-ink",children:"Workflow Capture"})]}),n.jsx("nav",{className:"absolute inset-x-0 top-[57px] bottom-[
387112px] overflow-y-auto py-3 px-2",children:OK.map(d=>{const u=d.icon,m=l(d.href);return n.jsxs(Ae,{href:d.href,className:`flex items-center gap-2.5 px-3 py-2 rounded-md text-[13px] font-medium mb-0.5 ${m?"bg-[#f0ece2] text-ink":"text-warm-gray hover:bg-[#f7f5f0] hover:text-ink"}`,"data-testid":`nav-${d.label.toLowerCase().replace(/\s+/g,"-")}`,children:[n.jsx(u,{className:`w-4 h-4 ${m?"text-olive-dark":"text-warm-gray/70"}`}),n.jsx("span",{className:"flex-1",children:d.label}),d.href==="/admin/issues"&&a>0&&n.jsx("span",{className:"text-[10px] font-bold px-1.5 py-0.5 rounded-full bg-red-500 text-white","data-testid":"badge-issues-count",children:a}),d.soon&&n.jsx("span",{className:"text-[9px] uppercase tracking-wide text-warm-gray/60",children:"soon"})]},d.href)})}),n.jsxs("div",{className:"absolute inset-x-0 bottom-0 h-[112px] bg-white px-4 py-3 border-t border-[#f0ece2] min-w-0",children:[n.jsx("div",{className:"text-[13px] font-bold text-ink leading-tight truncate",title:t.name,"data-testid":"text-admin-name",children:t.name}),n.jsx("div",{className:"text-[11px] text-warm-gray truncate",title:t.role,children:t.role}),n.jsx("div",{className:"text-[11px] text-warm-gray/80 truncate mb-1.5",title:t.email,children:t.email}),n.jsxs(Ae,{href:"/admin/settings",className:"w-full flex items-center gap-2 px-2 py-1 rounded-md text-[12px] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":"button-admin-settings",children:[n.jsx(ym,{className:"w-3.5 h-3.5"})," Settings"]}),n.jsxs("button",{onClick:e,className:"w-full flex items-center gap-2 px-2 py-1 rounded-md text-[12px] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":"button-admin-signout",children:[n.jsx(O9,{className:"w-3.5 h-3.5"})," Sign out"]})]})]}),n.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[n.jsxs("header",{className:"h-14 bg-white border-b border-[#e7e3d9] flex items-center px-6 gap-4 sticky top-0 z-10",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[n.jsx("span",{className:"font-bold text-ink",children:"Workflow Capture"}),n.jsx("span",{className:"text-[10px] uppercase tracking-wider px-2 py-0.5 rounded-full bg-[#f0ece2] text-warm-gray font-semibold",children:"Production"})]}),n.jsx("div",{className:"flex-1 flex justify-center",children:n.jsxs("div",{className:"relative w-full max-w-md",children:[n.jsx(YA,{className:"w-3.5 h-3.5 text-warm-gray absolute left-3 top-1/2 -translate-y-1/2"}),n.jsx("input",{type:"search",placeholder:"Search clients, contacts, workflows…",className:"w-full bg-[#f7f5f0] border border-[#e7e3d9] rounded-full pl-9 pr-4 py-1.5 text-[12px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":"input-global-search",disabled:!0})]})}),n.jsxs("div",{className:"text-[12px] text-warm-gray",children:["Welcome, ",n.jsx("span",{className:"text-ink font-semibold",children:t.name.split(" ")[0]})]})]}),n.jsxs("main",{className:"flex-1 overflow-y-auto",children:[n.jsx("div",{className:"text-[10px] italic text-warm-gray text-right px-6 pt-2",children:"Accountable automation for high-stakes, regulated operations."}),s]})]})]})}function DK({onSignIn:t}){const[e,s]=j.useState(""),[r,i]=j.useState(""),[a,l]=j.useState(""),[d,u]=j.useState(!1),m=async p=>{p.preventDefault(),l(""),u(!0);try{const x=await fetch("/api/admin/signin",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({email:e,password:r})}),g=await x.json();x.ok?t(g.admin):l(g.error||"Sign-in failed.")}catch(x){l(x?.message||"Network error.")}finally{u(!1)}};return n.jsx("div",{className:"min-h-screen bg-[#f4f1eb] flex items-center justify-center p-4","data-testid":"page-admin-signin",children:n.jsxs("form",{onSubmit:m,className:"w-full max-w-md bg-white border border-[#ddd9d1] rounded-2xl p-8",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-olive-dark flex items-center justify-center text-white font-black",children:"W"}),n.jsx("span",{className:"font-black text-lg text-ink",children:"Workflow Capture"})]}),n.jsx("h1",{className:"font-serif text-2xl text-ink mb-1",children:"Admin sign in"}),n.jsx("p",{className:"text-warm-gray text-sm mb-6",children:"Team members only."}),n.jsx("label",{className:"block text-xs font-semibold text-ink mb-1",children:"Email"}
387),n.jsx("input",{type:"email",value:e,onChange:p=>s(p.target.value),required:!0,autoFocus:!0,className:"w-full bg-white border border-[#ddd9d1] text-ink rounded-lg px-3 py-2.5 text-sm mb-4 outline-none focus:ring-2 focus:ring-olive-dark/30 focus:border-olive-dark","data-testid":"input-admin-email"}),n.jsx("label",{className:"block text-xs font-semibold text-ink mb-1",children:"Password"}),n.jsx("input",{type:"password",value:r,onChange:p=>i(p.target.value),required:!0,className:"w-full bg-white border border-[#ddd9d1] text-ink rounded-lg px-3 py-2.5 text-sm mb-4 outline-none focus:ring-2 focus:ring-olive-dark/30 focus:border-olive-dark","data-testid":"input-admin-password"}),a&&n.jsx("div",{role:"alert",className:"text-red-700 text-xs bg-red-50 border border-red-100 rounded-lg px-3 py-2 mb-4","data-testid":"text-admin-error",children:a}),n.jsx("button",{type:"submit",disabled:d,className:"w-full bg-olive-dark hover:bg-olive disabled:opacity-60 text-white px-6 py-3 rounded-full font-semibold text-sm","data-testid":"button-admin-signin",children:d?"Signing in…":"Sign in"})]})})}const je=Symbol.for("drizzle:entityKind");function yn(t,e){if(!t||typeof t!="object")return!1;if(t instanceof e)return!0;if(!Object.prototype.hasOwnProperty.call(e,je))throw new Error(`Class "${e.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let s=Object.getPrototypeOf(t).constructor;if(s)for(;s;){if(je in s&&s[je]===e[je])return!0;s=Object.getPrototypeOf(s)}return!1}class Sm{constructor(e,s){this.table=e,this.config=s,this.name=s.name,this.keyAsName=s.keyAsName,this.notNull=s.notNull,this.default=s.default,this.defaultFn=s.defaultFn,this.onUpdateFn=s.onUpdateFn,this.hasDefault=s.hasDefault,this.primary=s.primaryKey,this.isUnique=s.isUnique,this.uniqueName=s.uniqueName,this.uniqueType=s.uniqueType,this.dataType=s.dataType,this.columnType=s.columnType,this.generated=s.generated,this.generatedIdentity=s.generatedIdentity}static[je]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}class PK{static[je]="ColumnBuilder";config;constructor(e,s,r){this.config={name:e,keyAsName:e==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:s,columnType:r,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){this.config.name===""&&(this.config.name=e)}}const ou=Symbol.for("drizzle:Name");class IK{static[je]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(e,s){this.reference=()=>{const{name:r,columns:i,foreignColumns:a}=e();return{name:r,columns:i,foreignTable:a[0].table,foreignColumns:a}},s&&(this._onUpdate=s.onUpdate,this._onDelete=s.onDelete)}onUpdate(e){return this._onUpdate=e===void 0?"no action":e,this}onDelete(e){return this._onDelete=e===void 0?"no action":e,this}build(e){return new LK(e,this)}}class LK{constructor(e,s){this.table=e,this.reference=s.reference,this.onUpdate=s._onUpdate,this.onDelete=s._onDelete}static[je]="PgForeignKey";reference;onUpdate;onDelete;getName(){const{name:e,columns:s,foreignColumns:r}=this.reference(),i=s.map(d=>d.name),a=r.map(d=>d.name),l=[this.table[ou],...i,r[0].table[ou],...a];return e??`${l.join("_")}_fk`}}function $K(t,...e){return t(...e)}function BK(t,e){return`${t[ou]}_${e.join("_")}_unique`}function jT(t,e,s){for(let r=e;r<t.length;r++){const i=t[r];
387if(i==="\\"){r++;continue}if(i==='"')return[t.slice(e,r).replace(/\\/g,""),r+1];if(!s&&(i===","||i==="}"))return[t.slice(e,r).replace(/\\/g,""),r]}return[t.slice(e).replace(/\\/g,""),t.length]}function XO(t,e=0){const s=[];let r=e,i=!1;for(;r<t.length;){const a=t[r];if(a===","){(i||r===e)&&s.push(""),i=!0,r++;continue}if(i=!1,a==="\\"){r+=2;continue}if(a==='"'){const[u,m]=jT(t,r+1,!0);s.push(u),r=m;continue}if(a==="}")return[s,r+1];if(a==="{"){const[u,m]=XO(t,r+1);s.push(u),r=m;continue}const[l,d]=jT(t,r,!1);s.push(l),r=d}return[s,r]}function zK(t){const[e]=XO(t,1);return e}function ZO(t){return`{${t.map(e=>Array.isArray(e)?ZO(e):typeof e=="string"?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${e}`).join(",")}}`}class Ot extends PK{foreignKeyConfigs=[];static[je]="PgColumnBuilder";array(e){return new FK(this.config.name,this,e)}references(e,s={}){return this.foreignKeyConfigs.push({ref:e,actions:s}),this}unique(e,s){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=s?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:"always",mode:"stored"},this}buildForeignKeys(e,s){return this.foreignKeyConfigs.map(({ref:r,actions:i})=>$K((a,l)=>{const d=new IK(()=>{const u=a();return{columns:[e],foreignColumns:[u]}});return l.onUpdate&&d.onUpdate(l.onUpdate),l.onDelete&&d.onDelete(l.onDelete),d.build(s)},r,i))}buildExtraConfigColumn(e){return new VK(e,this.config)}}class ft extends Sm{constructor(e,s){s.uniqueName||(s.uniqueName=BK(e,[s.name])),super(e,s),this.table=e}static[je]="PgColumn"}class VK extends ft{static[je]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(e){return this.indexConfig.opClass=e,this}}class FK extends Ot{static[je]="PgArrayBuilder";constructor(e,s,r){super(e,"array","PgArray"),this.config.baseBuilder=s,this.config.size=r}build(e){const s=this.config.baseBuilder.build(e);return new bN(e,this.config,s)}}class bN extends ft{constructor(e,s,r,i){super(e,s),this.baseColumn=r,this.range=i,this.size=s.size}size;static[je]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size=="number"?this.size:""}]`}mapFromDriverValue(e){return typeof e=="string"&&(e=zK(e)),e.map(s=>this.baseColumn.mapFromDriverValue(s))}mapToDriverValue(e,s=!1){const r=e.map(i=>i===null?null:yn(this.baseColumn,bN)?this.baseColumn.mapToDriverValue(i,!0):this.baseColumn.mapToDriverValue(i));return s?r:ZO(r)}}const NT=Symbol.for("drizzle:isPgEnum");function UK(t){return!!t&&typeof t=="function"&&NT in t&&t[NT]===!0}class eR{static[je]="Subquery";constructor(e,s,r,i=!1){this._={brand:"Subquery",sql:e,selectedFields:s,alias:r,isWith:i}}}const HK={startActiveSpan(t,e){return e()}},lu=Symbol.for("drizzle:ViewBaseConfig"),Cv=Symbol.for("drizzle:Schema"),kT=Symbol.for("drizzle:Columns"),ST=Symbol.for("drizzle:ExtraConfigColumns"),Tv=Symbol.for("drizzle:OriginalName"),Ev=Symbol.for("drizzle:BaseName"),sg=Symbol.for("drizzle:IsAlias"),CT=Symbol.for("drizzle:ExtraConfigBuilder"),tR=Symbol.for("drizzle:IsDrizzleTable");class Ar{static[je]="Table";static Symbol={Name:ou,Schema:Cv,OriginalName:Tv,Columns:kT,ExtraConfigColumns:ST,BaseName:Ev,IsAlias:sg,ExtraConfigBuilder:CT};[ou];[Tv];[Cv];[kT];[ST];[Ev];[sg]=!1;[tR]=!0;[CT]=void 0;constructor(e,s,r){this[ou]=this[Tv]=e,this[Cv]=s,this[Ev]=r}}function sR(t){return typeof t=="object"&&t!==null&&tR in t}function qK(t){return t!=null&&typeof t.getSQL=="function"}function WK(t){const e={sql:"",params:[]};for(const s of t)e.sql+=s.sql,e.params.push(...s.params),s.typings?.length&&(e.typings||(e.typings=[]),e.typings.push(...s.typings));return e}class ji{static[je]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new Ms([this])}}class Ms{constructor(e){this.queryChunks=e}static[je]="SQL";decoder=nR;shouldInlineParams=!1;
387append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return HK.startActiveSpan("drizzle.buildSQL",s=>{const r=this.buildQueryFromSourceParams(this.queryChunks,e);return s?.setAttributes({"drizzle.query.text":r.sql,"drizzle.query.params":JSON.stringify(r.params)}),r})}buildQueryFromSourceParams(e,s){const r=Object.assign({},s,{inlineParams:s.inlineParams||this.shouldInlineParams,paramStartIndex:s.paramStartIndex||{value:0}}),{casing:i,escapeName:a,escapeParam:l,prepareTyping:d,inlineParams:u,paramStartIndex:m}=r;return WK(e.map(p=>{if(yn(p,ji))return{sql:p.value.join(""),params:[]};if(yn(p,c1))return{sql:a(p.value),params:[]};if(p===void 0)return{sql:"",params:[]};if(Array.isArray(p)){const x=[new ji("(")];for(const[g,b]of p.entries())x.push(b),g<p.length-1&&x.push(new ji(", "));return x.push(new ji(")")),this.buildQueryFromSourceParams(x,r)}if(yn(p,Ms))return this.buildQueryFromSourceParams(p.queryChunks,{...r,inlineParams:u||p.shouldInlineParams});if(yn(p,Ar)){const x=p[Ar.Symbol.Schema],g=p[Ar.Symbol.Name];return{sql:x===void 0||p[sg]?a(g):a(x)+"."+a(g),params:[]}}if(yn(p,Sm)){const x=i.getColumnCasing(p);if(s.invokeSource==="indexes")return{sql:a(x),params:[]};const g=p.table[Ar.Symbol.Schema];return{sql:p.table[sg]||g===void 0?a(p.table[Ar.Symbol.Name])+"."+a(x):a(g)+"."+a(p.table[Ar.Symbol.Name])+"."+a(x),params:[]}}if(yn(p,GK)){const x=p[lu].schema,g=p[lu].name;return{sql:x===void 0||p[lu].isAlias?a(g):a(x)+"."+a(g),params:[]}}if(yn(p,iR)){if(yn(p.value,d1))return{sql:l(m.value++,p),params:[p],typings:["none"]};const x=p.value===null?null:p.encoder.mapToDriverValue(p.value);if(yn(x,Ms))return this.buildQueryFromSourceParams([x],r);if(u)return{sql:this.mapInlineParam(x,r),params:[]};let g=["none"];return d&&(g=[d(p.encoder)]),{sql:l(m.value++,x),params:[x],typings:g}}return yn(p,d1)?{sql:l(m.value++,p),params:[p],typings:["none"]}:yn(p,Ms.Aliased)&&p.fieldAlias!==void 0?{sql:a(p.fieldAlias),params:[]}:yn(p,eR)?p._.isWith?{sql:a(p._.alias),params:[]}:this.buildQueryFromSourceParams([new ji("("),p._.sql,new ji(") "),new c1(p._.alias)],r):UK(p)?p.schema?{sql:a(p.schema)+"."+a(p.enumName),params:[]}:{sql:a(p.enumName),params:[]}:qK(p)?p.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([p.getSQL()],r):this.buildQueryFromSourceParams([new ji("("),p.getSQL(),new ji(")")],r):u?{sql:this.mapInlineParam(p,r),params:[]}:{sql:l(m.value++,p),params:[p],typings:["none"]}}))}mapInlineParam(e,{escapeString:s}){if(e===null)return"null";if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="string")return s(e);if(typeof e=="object"){const r=e.toString();return s(r==="[object Object]"?JSON.stringify(e):r)}throw new Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return e===void 0?this:new Ms.Aliased(this,e)}mapWith(e){return this.decoder=typeof e=="function"?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}}class c1{constructor(e){this.value=e}static[je]="Name";brand;getSQL(){return new Ms([this])}}const nR={mapFromDriverValue:t=>t},rR={mapToDriverValue:t=>t};({...nR,...rR});class iR{constructor(e,s=rR){this.value=e,this.encoder=s}static[je]="Param";brand;getSQL(){return new Ms([this])}}function Ft(t,...e){const s=[];(e.length>0||t.length>0&&t[0]!=="")&&s.push(new ji(t[0]));for(const[r,i]of e.entries())s.push(i,new ji(t[r+1]));return new Ms(s)}(t=>{function e(){return new Ms([])}t.empty=e;function s(u){return new Ms(u)}t.fromList=s;function r(u){return new Ms([new ji(u)])}t.raw=r;function i(u,m){const p=[];for(const[x,g]of u.entries())x>0&&m!==void 0&&p.push(m),p.push(g);return new Ms(p)}t.join=i;function a(u){return new c1(u)}t.identifier=a;function l(u){return new d1(u)}t.placeholder=l;function d(u,m){return new iR(u,m)}t.param=d})(Ft||(Ft={}));(t=>{class e{constructor(r,i){this.sql=r,this.fieldAlias=i}static[je]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new e(this.sql,this.fieldAlias)}}t.Aliased=e})(Ms||(Ms={}));let d1=class{constructor(e){this.name=e}static[je]="Placeholder";getSQL(){return new Ms([this])}};const aR=Symbol.for("drizzle:IsDrizzleView");class GK{static[je]="View";[lu];[aR]=!0;
387constructor({name:e,schema:s,selectedFields:r,query:i}){this[lu]={name:e,originalName:e,schema:s,selectedFields:r,query:i,isExisting:!i,isAlias:!1}}getSQL(){return new Ms([this])}}function KK(t){return typeof t=="object"&&t!==null&&aR in t}Sm.prototype.getSQL=function(){return new Ms([this])};Ar.prototype.getSQL=function(){return new Ms([this])};eR.prototype.getSQL=function(){return new Ms([this])};function YK(t){return t[Ar.Symbol.Columns]}function QK(t){return t[lu].selectedFields}function dn(t,e){return{name:typeof t=="string"&&t.length>0?t:"",config:typeof t=="object"?t:e}}class Sb extends Ot{static[je]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(e){if(e){const{name:s,...r}=e;this.config.generatedIdentity={type:"always",sequenceName:s,sequenceOptions:r}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(e){if(e){const{name:s,...r}=e;this.config.generatedIdentity={type:"byDefault",sequenceName:s,sequenceOptions:r}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class JK extends Sb{static[je]="PgBigInt53Builder";constructor(e){super(e,"number","PgBigInt53")}build(e){return new XK(e,this.config)}}class XK extends ft{static[je]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}}class ZK extends Sb{static[je]="PgBigInt64Builder";constructor(e){super(e,"bigint","PgBigInt64")}build(e){return new eY(e,this.config)}}class eY extends ft{static[je]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(e){return BigInt(e)}}function tY(t,e){const{name:s,config:r}=dn(t,e);return r.mode==="number"?new JK(s):new ZK(s)}class sY extends Ot{static[je]="PgBigSerial53Builder";constructor(e){super(e,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new nY(e,this.config)}}class nY extends ft{static[je]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}}class rY extends Ot{static[je]="PgBigSerial64Builder";constructor(e){super(e,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(e){return new iY(e,this.config)}}class iY extends ft{static[je]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(e){return BigInt(e)}}function aY(t,e){const{name:s,config:r}=dn(t,e);return r.mode==="number"?new sY(s):new rY(s)}class oY extends Ot{static[je]="PgBooleanBuilder";constructor(e){super(e,"boolean","PgBoolean")}build(e){return new lY(e,this.config)}}class lY extends ft{static[je]="PgBoolean";getSQLType(){return"boolean"}}function cY(t){return new oY(t??"")}class dY extends Ot{static[je]="PgCharBuilder";constructor(e,s){super(e,"string","PgChar"),this.config.length=s.length,this.config.enumValues=s.enum}build(e){return new uY(e,this.config)}}class uY extends ft{static[je]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}function hY(t,e={}){const{name:s,config:r}=dn(t,e);return new dY(s,r)}class mY extends Ot{static[je]="PgCidrBuilder";constructor(e){super(e,"string","PgCidr")}build(e){return new pY(e,this.config)}}class pY extends ft{static[je]="PgCidr";getSQLType(){return"cidr"}}function fY(t){return new mY(t??"")}class xY extends Ot{static[je]="PgCustomColumnBuilder";constructor(e,s,r){super(e,"custom","PgCustomColumn"),this.config.fieldConfig=s,this.config.customTypeParams=r}build(e){return new gY(e,this.config)}}class gY extends ft{static[je]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(e,s){super(e,s),this.sqlName=s.customTypeParams.dataType(s.fieldConfig),this.mapTo=s.customTypeParams.toDriver,this.mapFrom=s.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return typeof this.mapFrom=="function"?this.mapFrom(e):e}mapToDriverValue(e){return typeof this.mapTo=="function"?this.mapTo(e):e}}function yN(t){return(e,s)=>{const{name:r,config:i}=dn(e,s);return new xY(r,i,t)}}class dp extends Ot{static[je]="PgDateColumnBaseBuilder";defaultNow(){return this.default(Ft`now()`)}}class bY extends dp{static[je]="PgDateBuilder";constructor(e){super(e,"date","PgDate")}build(e){return new yY(e,this.config)}}class yY extends ft{static[je]="PgDate";
387getSQLType(){return"date"}mapFromDriverValue(e){return new Date(e)}mapToDriverValue(e){return e.toISOString()}}class vY extends dp{static[je]="PgDateStringBuilder";constructor(e){super(e,"string","PgDateString")}build(e){return new wY(e,this.config)}}class wY extends ft{static[je]="PgDateString";getSQLType(){return"date"}}function jY(t,e){const{name:s,config:r}=dn(t,e);return r?.mode==="date"?new bY(s):new vY(s)}class NY extends Ot{static[je]="PgDoublePrecisionBuilder";constructor(e){super(e,"number","PgDoublePrecision")}build(e){return new kY(e,this.config)}}class kY extends ft{static[je]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(e){return typeof e=="string"?Number.parseFloat(e):e}}function SY(t){return new NY(t??"")}class CY extends Ot{static[je]="PgInetBuilder";constructor(e){super(e,"string","PgInet")}build(e){return new TY(e,this.config)}}class TY extends ft{static[je]="PgInet";getSQLType(){return"inet"}}function EY(t){return new CY(t??"")}class AY extends Sb{static[je]="PgIntegerBuilder";constructor(e){super(e,"number","PgInteger")}build(e){return new MY(e,this.config)}}class MY extends ft{static[je]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(e){return typeof e=="string"?Number.parseInt(e):e}}function _s(t){return new AY(t??"")}class _Y extends Ot{static[je]="PgIntervalBuilder";constructor(e,s){super(e,"string","PgInterval"),this.config.intervalConfig=s}build(e){return new OY(e,this.config)}}class OY extends ft{static[je]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){const e=this.fields?` ${this.fields}`:"",s=this.precision?`(${this.precision})`:"";return`interval${e}${s}`}}function RY(t,e={}){const{name:s,config:r}=dn(t,e);return new _Y(s,r)}class DY extends Ot{static[je]="PgJsonBuilder";constructor(e){super(e,"json","PgJson")}build(e){return new PY(e,this.config)}}class PY extends ft{static[je]="PgJson";constructor(e,s){super(e,s)}getSQLType(){return"json"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}}function IY(t){return new DY(t??"")}class LY extends Ot{static[je]="PgJsonbBuilder";constructor(e){super(e,"json","PgJsonb")}build(e){return new $Y(e,this.config)}}class $Y extends ft{static[je]="PgJsonb";constructor(e,s){super(e,s)}getSQLType(){return"jsonb"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}}function Dr(t){return new LY(t??"")}class BY extends Ot{static[je]="PgLineBuilder";constructor(e){super(e,"array","PgLine")}build(e){return new zY(e,this.config)}}class zY extends ft{static[je]="PgLine";getSQLType(){return"line"}mapFromDriverValue(e){const[s,r,i]=e.slice(1,-1).split(",");return[Number.parseFloat(s),Number.parseFloat(r),Number.parseFloat(i)]}mapToDriverValue(e){return`{${e[0]},${e[1]},${e[2]}}`}}class VY extends Ot{static[je]="PgLineABCBuilder";constructor(e){super(e,"json","PgLineABC")}build(e){return new FY(e,this.config)}}class FY extends ft{static[je]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue(e){const[s,r,i]=e.slice(1,-1).split(",");return{a:Number.parseFloat(s),b:Number.parseFloat(r),c:Number.parseFloat(i)}}mapToDriverValue(e){return`{${e.a},${e.b},${e.c}}`}}function UY(t,e){const{name:s,config:r}=dn(t,e);return!r?.mode||r.mode==="tuple"?new BY(s):new VY(s)}class HY extends Ot{static[je]="PgMacaddrBuilder";constructor(e){super(e,"string","PgMacaddr")}build(e){return new qY(e,this.config)}}class qY extends ft{static[je]="PgMacaddr";getSQLType(){return"macaddr"}}function WY(t){return new HY(t??"")}class GY extends Ot{static[je]="PgMacaddr8Builder";constructor(e){super(e,"string","PgMacaddr8")}build(e){return new KY(e,this.config)}}class KY extends ft{static[je]="PgMacaddr8";getSQLType(){return"macaddr8"}}function YY(t){return new GY(t??"")}class QY extends Ot{static[je]="PgNumericBuilder";constructor(e,s,r){super(e,"string","PgNumeric"),this.config.precision=s,this.config.scale=r}build(e){return new JY(e,this.config)}}class JY extends ft{static[je]="PgNumeric";precision;scale;constructor(e,s){super(e,s),this.precision=s.precision,this.scale=s.scale}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}function XY(t,e){const{name:s,config:r}=dn(t,e);return new QY(s,r?.precision,r?.scale)}class ZY extends Ot{static[je]="PgPointTupleBuilder";constructor(e){super(e,"array","PgPointTuple")}build(e){return new eQ(e,this.config)}}class eQ extends ft{static[je]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue(e){if(typeof e=="string"){const[s,r]=e.slice(1,-1).split(",");return[Number.parseFloat(s),Number.parseFloat(r)]}return[e.x,e.y]}mapToDriverValue(e){return`(${e[0]},${e[1]})`}}class tQ extends Ot{static[je]="PgPointObjectBuilder";constructor(e){super(e,"json","PgPointObject")}build(e){return new sQ(e,this.config)}}class sQ extends ft{static[je]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue(e){if(typeof e=="string"){const[s,r]=e.slice(1,-1).split(",");return{x:Number.parseFloat(s),y:Number.parseFloat(r)}}return e}mapToDriverValue(e){return`(${e.x},${e.y})`}}function nQ(t,e){const{name:s,config:r}=dn(t,e);return!r?.mode||r.mode==="tuple"?new ZY(s):new tQ(s)}function rQ(t){const e=[];for(let s=0;s<t.length;s+=2)e.push(Number.parseInt(t.slice(s,s+2),16));return new Uint8Array(e)}function TT(t,e){const s=new ArrayBuffer(8),r=new DataView(s);for(let i=0;i<8;i++)r.setUint8(i,t[e+i]);return r.getFloat64(0,!0)}function oR(t){const e=rQ(t);let s=0;const r=e[s];s+=1;const i=new DataView(e.buffer),a=i.getUint32(s,r===1);if(s+=4,a&536870912&&(i.getUint32(s,r===1),s+=4),(a&65535)===1){const l=TT(e,s);s+=8;const d=TT(e,s);return s+=8,[l,d]}throw new Error("Unsupported geometry type")}class iQ extends Ot{static[je]="PgGeometryBuilder";constructor(e){super(e,"array","PgGeometry")}build(e){return new aQ(e,this.config)}}class aQ extends ft{static[je]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){return oR(e)}mapToDriverValue(e){return`point(${e[0]} ${e[1]})`}}class oQ extends Ot{static[je]="PgGeometryObjectBuilder";constructor(e){super(e,"json","PgGeometryObject")}build(e){return new lQ(e,this.config)}}class lQ extends ft{static[je]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){const s=oR(e);return{x:s[0],y:s[1]}}mapToDriverValue(e){return`point(${e.x} ${e.y})`}}function cQ(t,e){const{name:s,config:r}=dn(t,e);return!r?.mode||r.mode==="tuple"?new iQ(s):new oQ(s)}class dQ extends Ot{static[je]="PgRealBuilder";constructor(e,s){super(e,"number","PgReal"),this.config.length=s}build(e){return new uQ(e,this.config)}}class uQ extends ft{static[je]="PgReal";constructor(e,s){super(e,s)}getSQLType(){return"real"}mapFromDriverValue=e=>typeof e=="string"?Number.parseFloat(e):e}function hQ(t){return new dQ(t??"")}class mQ extends Ot{static[je]="PgSerialBuilder";constructor(e){super(e,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new pQ(e,this.config)}}class pQ extends ft{static[je]="PgSerial";
387getSQLType(){return"serial"}}function fQ(t){return new mQ(t??"")}class xQ extends Sb{static[je]="PgSmallIntBuilder";constructor(e){super(e,"number","PgSmallInt")}build(e){return new gQ(e,this.config)}}class gQ extends ft{static[je]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=e=>typeof e=="string"?Number(e):e}function bQ(t){return new xQ(t??"")}class yQ extends Ot{static[je]="PgSmallSerialBuilder";constructor(e){super(e,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new vQ(e,this.config)}}class vQ extends ft{static[je]="PgSmallSerial";getSQLType(){return"smallserial"}}function wQ(t){return new yQ(t??"")}class jQ extends Ot{static[je]="PgTextBuilder";constructor(e,s){super(e,"string","PgText"),this.config.enumValues=s.enum}build(e){return new NQ(e,this.config)}}class NQ extends ft{static[je]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function Z(t,e={}){const{name:s,config:r}=dn(t,e);return new jQ(s,r)}class kQ extends dp{constructor(e,s,r){super(e,"string","PgTime"),this.withTimezone=s,this.precision=r,this.config.withTimezone=s,this.config.precision=r}static[je]="PgTimeBuilder";build(e){return new SQ(e,this.config)}}class SQ extends ft{static[je]="PgTime";withTimezone;precision;constructor(e,s){super(e,s),this.withTimezone=s.withTimezone,this.precision=s.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function CQ(t,e={}){const{name:s,config:r}=dn(t,e);return new kQ(s,r.withTimezone??!1,r.precision)}class TQ extends dp{static[je]="PgTimestampBuilder";constructor(e,s,r){super(e,"date","PgTimestamp"),this.config.withTimezone=s,this.config.precision=r}build(e){return new EQ(e,this.config)}}class EQ extends ft{static[je]="PgTimestamp";withTimezone;precision;constructor(e,s){super(e,s),this.withTimezone=s.withTimezone,this.precision=s.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=e=>new Date(this.withTimezone?e:e+"+0000");mapToDriverValue=e=>e.toISOString()}class AQ extends dp{static[je]="PgTimestampStringBuilder";constructor(e,s,r){super(e,"string","PgTimestampString"),this.config.withTimezone=s,this.config.precision=r}build(e){return new MQ(e,this.config)}}class MQ extends ft{static[je]="PgTimestampString";withTimezone;precision;constructor(e,s){super(e,s),this.withTimezone=s.withTimezone,this.precision=s.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function Le(t,e={}){const{name:s,config:r}=dn(t,e);return r?.mode==="string"?new AQ(s,r.withTimezone??!1,r.precision):new TQ(s,r?.withTimezone??!1,r?.precision)}class _Q extends Ot{static[je]="PgUUIDBuilder";constructor(e){super(e,"string","PgUUID")}defaultRandom(){return this.default(Ft`gen_random_uuid()`)}build(e){return new OQ(e,this.config)}}class OQ extends ft{static[je]="PgUUID";getSQLType(){return"uuid"}}function RQ(t){return new _Q(t??"")}class DQ extends Ot{static[je]="PgVarcharBuilder";constructor(e,s){super(e,"string","PgVarchar"),this.config.length=s.length,this.config.enumValues=s.enum}build(e){return new PQ(e,this.config)}}class PQ extends ft{static[je]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function st(t,e={}){const{name:s,config:r}=dn(t,e);return new DQ(s,r)}class IQ extends Ot{static[je]="PgBinaryVectorBuilder";constructor(e,s){super(e,"string","PgBinaryVector"),this.config.dimensions=s.dimensions}build(e){return new LQ(e,this.config)}}class LQ extends ft{static[je]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function $Q(t,e){const{name:s,config:r}=dn(t,e);return new IQ(s,r)}class BQ extends Ot{static[je]="PgHalfVectorBuilder";constructor(e,s){super(e,"array","PgHalfVector"),this.config.dimensions=s.dimensions}build(e){return new zQ(e,this.config)}}class zQ extends ft{static[je]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(s=>Number.parseFloat(s))}}function VQ(t,e){const{name:s,config:r}=dn(t,e);return new BQ(s,r)}class FQ extends Ot{static[je]="PgSparseVectorBuilder";constructor(e,s){super(e,"string","PgSparseVector"),this.config.dimensions=s.dimensions}build(e){return new UQ(e,this.config)}}class UQ extends ft{static[je]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}
387function HQ(t,e){const{name:s,config:r}=dn(t,e);return new FQ(s,r)}class qQ extends Ot{static[je]="PgVectorBuilder";constructor(e,s){super(e,"array","PgVector"),this.config.dimensions=s.dimensions}build(e){return new WQ(e,this.config)}}class WQ extends ft{static[je]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(s=>Number.parseFloat(s))}}function GQ(t,e){const{name:s,config:r}=dn(t,e);return new qQ(s,r)}function KQ(){return{bigint:tY,bigserial:aY,boolean:cY,char:hY,cidr:fY,customType:yN,date:jY,doublePrecision:SY,inet:EY,integer:_s,interval:RY,json:IY,jsonb:Dr,line:UY,macaddr:WY,macaddr8:YY,numeric:XY,point:nQ,geometry:cQ,real:hQ,serial:fQ,smallint:bQ,smallserial:wQ,text:Z,time:CQ,timestamp:Le,uuid:RQ,varchar:st,bit:$Q,halfvec:VQ,sparsevec:HQ,vector:GQ}}const u1=Symbol.for("drizzle:PgInlineForeignKeys"),ET=Symbol.for("drizzle:EnableRLS");class AT extends Ar{static[je]="PgTable";static Symbol=Object.assign({},Ar.Symbol,{InlineForeignKeys:u1,EnableRLS:ET});[u1]=[];[ET]=!1;[Ar.Symbol.ExtraConfigBuilder]=void 0}function YQ(t,e,s,r,i=t){const a=new AT(t,r,i),l=typeof e=="function"?e(KQ()):e,d=Object.fromEntries(Object.entries(l).map(([p,x])=>{const g=x;g.setName(p);const b=g.build(a);return a[u1].push(...g.buildForeignKeys(b,a)),[p,b]})),u=Object.fromEntries(Object.entries(l).map(([p,x])=>{const g=x;g.setName(p);const b=g.buildExtraConfigColumn(a);return[p,b]})),m=Object.assign(a,d);return m[Ar.Symbol.Columns]=d,m[Ar.Symbol.ExtraConfigColumns]=u,Object.assign(m,{enableRLS:()=>(m[AT.Symbol.EnableRLS]=!0,m)})}const rs=(t,e,s)=>YQ(t,e,s,void 0);var _t;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function s(i){throw new Error}t.assertNever=s,t.arrayToEnum=i=>{const a={};for(const l of i)a[l]=l;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(d=>typeof i[i[d]]!="number"),l={};for(const d of a)l[d]=i[d];return t.objectValues(l)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const l in i)Object.prototype.hasOwnProperty.call(i,l)&&a.push(l);return a},t.find=(i,a)=>{for(const l of i)if(a(l))return l},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(_t||(_t={}));var h1;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(h1||(h1={}));const Be=_t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),eo=t=>{switch(typeof t){case"undefined":return Be.undefined;case"string":return Be.string;case"number":return Number.isNaN(t)?Be.nan:Be.number;case"boolean":return Be.boolean;case"function":return Be.function;case"bigint":return Be.bigint;case"symbol":return Be.symbol;case"object":return Array.isArray(t)?Be.array:t===null?Be.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Be.promise:typeof Map<"u"&&t instanceof Map?Be.map:typeof Set<"u"&&t instanceof Set?Be.set:typeof Date<"u"&&t instanceof Date?Be.date:Be.object;default:return Be.unknown}}
vendor: 9,600 bytes, line 387
387,Ce=_t.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),QQ=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Pr extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}format(e){const s=e||function(a){return a.message},r={_errors:[]},i=a=>{for(const l of a.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)r._errors.push(s(l));else{let d=r,u=0;for(;u<l.path.length;){const m=l.path[u];u===l.path.length-1?(d[m]=d[m]||{_errors:[]},d[m]._errors.push(s(l))):d[m]=d[m]||{_errors:[]},d=d[m],u++}}};return i(this),r}static assert(e){if(!(e instanceof Pr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_t.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},r=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];s[a]=s[a]||[],s[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:s}}get formErrors(){return this.flatten()}}Pr.create=t=>new Pr(t);const bu=(t,e)=>{let s;switch(t.code){case Ce.invalid_type:t.received===Be.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case Ce.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,_t.jsonStringifyReplacer)}`;break;case Ce.unrecognized_keys:s=`Unrecognized key(s) in object: ${_t.joinValues(t.keys,", ")}`;break;case Ce.invalid_union:s="Invalid input";break;case Ce.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${_t.joinValues(t.options)}`;break;case Ce.invalid_enum_value:s=`Invalid enum value. Expected ${_t.joinValues(t.options)}, received '${t.received}'`;break;case Ce.invalid_arguments:s="Invalid function arguments";break;case Ce.invalid_return_type:s="Invalid function return type";break;case Ce.invalid_date:s="Invalid date";break;case Ce.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:_t.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case Ce.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case Ce.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case Ce.custom:s="Invalid input";break;case Ce.invalid_intersection_types:s="Intersection results could not be merged";break;case Ce.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case Ce.not_finite:s="Number must be finite";break;default:s=e.defaultError,_t.assertNever(t)}return{message:s}};let lR=bu;function JQ(t){lR=t}function ng(){return lR}const rg=t=>{const{data:e,path:s,errorMaps:r,issueData:i}=t,a=[...s,...i.path||[]],l={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let d="";const u=r.filter(m=>!!m).slice().reverse();for(const m of u)d=m(l,{data:e,defaultError:d}).message;return{...i,path:a,message:d}},XQ=[];function Pe(t,e){const s=ng(),r=rg({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,s,s===bu?void 0:bu].filter(i=>!!i)});t.common.issues.push(r)}class $n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){const r=[];for(const i of s){if(i.status==="aborted")return et;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,s){const r=[];for(const i of s){const a=await i.key,l=await i.value;r.push({key:a,value:l})}return $n.mergeObjectSync(e,r)}static mergeObjectSync(e,s){const r={};for(const i of s){const{key:a,value:l}=i;if(a.status==="aborted"||l.status==="aborted")return et;a.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(r[a.value]=l.value)}return{status:e.value,value:r}}}const et=Object.freeze({status:"aborted"}),ru=t=>({status:"dirty",value:t}),Zn=t=>({status:"valid",value:t}),m1=t=>t.status==="aborted",p1=t=>t.status==="dirty",Fc=t=>t.status==="valid",Cm=t=>typeof Promise<"u"&&t instanceof Promise;var Ye;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ye||(Ye={}));class ca{constructor(e,s,r,i){this._cachedPath=[],this.parent=e,this.data=s,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const MT=(t,e)=>{if(Fc(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new Pr(t.common.issues);return this._error=s,this._error}}};function ut(t){if(!t)return{};const{errorMap:e,invalid_type_error:s,required_error:r,description:i}=t;if(e&&(s||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(l,d)=>{const{message:u}=t;return l.code==="invalid_enum_value"?{message:u??d.defaultError}:typeof d.data>"u"?{message:u??r??d.defaultError}:l.code!=="invalid_type"?{message:d.defaultError}:{message:u??s??d.defaultError}},description:i}}class bt{get description(){return this._def.description}_getType(e){return eo(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:eo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $n,ctx:{common:e.parent.common,data:e.data,parsedType:eo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(Cm(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){const s=this._parse(e);return Promise.resolve(s)}parse(e,s){const r=this.safeParse(e,s);if(r.success)return r.data;throw r.error}safeParse(e,s){const r={common:{issues:[],async:s?.async??!1,contextualErrorMap:s?.errorMap},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:eo(e)},i=this._parseSync({data:e,path:r.path,parent:r});return MT(r,i)}"~validate"(e){const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:eo(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:s});return Fc(r)?{value:r.value}:{issues:s.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(r=>Fc(r)?{value:r.value}:{issues:s.common.issues})}async parseAsync(e,s){const r=await this.safeParseAsync(e,s);if(r.success)return r.data;throw r.error}async safeParseAsync(e,s){const r={common:{issues:[],contextualErrorMap:s?.errorMap,async:!0},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:eo(e)},i=this._parse({data:e,path:r.path,parent:r}),a=await(Cm(i)?i:Promise.resolve(i));return MT(r,a)}refine(e,s){const r=i=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(i):s;return this._refinement((i,a)=>{const l=e(i),d=()=>a.addIssue({code:Ce.custom,...r(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(u=>u?!0:(d(),!1)):l?!0:(d(),!1)})}refinement(e,s){return this._refinement((r,i)=>
vendor: 4,917 bytes, line 387
387e(r)?!0:(i.addIssue(typeof s=="function"?s(r,i):s),!1))}_refinement(e){return new Ri({schema:this,typeName:nt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return oa.create(this,this._def)}nullable(){return Sl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ei.create(this)}promise(){return vu.create(this,this._def)}or(e){return Mm.create([this,e],this._def)}and(e){return _m.create(this,e,this._def)}transform(e){return new Ri({...ut(this._def),schema:this,typeName:nt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new Im({...ut(this._def),innerType:this,defaultValue:s,typeName:nt.ZodDefault})}brand(){return new vN({typeName:nt.ZodBranded,type:this,...ut(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new Lm({...ut(this._def),innerType:this,catchValue:s,typeName:nt.ZodCatch})}describe(e){const s=this.constructor;return new s({...this._def,description:e})}pipe(e){return up.create(this,e)}readonly(){return $m.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ZQ=/^c[^\s-]{8,}$/i,eJ=/^[0-9a-z]+$/,tJ=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sJ=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nJ=/^[a-z0-9_-]{21}$/i,rJ=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,iJ=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,aJ=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,oJ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Av;const lJ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,cJ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,dJ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,uJ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hJ=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mJ=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cR="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pJ
vendor: 24,207 bytes, line 387
387=new RegExp(`^${cR}$`);function dR(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const s=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${s}`}function fJ(t){return new RegExp(`^${dR(t)}$`)}function uR(t){let e=`${cR}T${dR(t)}`;const s=[];return s.push(t.local?"Z?":"Z"),t.offset&&s.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${s.join("|")})`,new RegExp(`^${e}$`)}function xJ(t,e){return!!((e==="v4"||!e)&&lJ.test(t)||(e==="v6"||!e)&&dJ.test(t))}function gJ(t,e){if(!rJ.test(t))return!1;try{const[s]=t.split(".");if(!s)return!1;const r=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function bJ(t,e){return!!((e==="v4"||!e)&&cJ.test(t)||(e==="v6"||!e)&&uJ.test(t))}class Si extends bt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Be.string){const a=this._getOrReturnCtx(e);return Pe(a,{code:Ce.invalid_type,expected:Be.string,received:a.parsedType}),et}const r=new $n;let i;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),Pe(i,{code:Ce.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),Pe(i,{code:Ce.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const l=e.data.length>a.value,d=e.data.length<a.value;(l||d)&&(i=this._getOrReturnCtx(e,i),l?Pe(i,{code:Ce.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):d&&Pe(i,{code:Ce.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")aJ.test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"email",code:Ce.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Av||(Av=new RegExp(oJ,"u")),Av.test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"emoji",code:Ce.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")sJ.test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"uuid",code:Ce.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")nJ.test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"nanoid",code:Ce.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")ZQ.test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"cuid",code:Ce.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")eJ.test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"cuid2",code:Ce.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")tJ.test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"ulid",code:Ce.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Pe(i,{validation:"url",code:Ce.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"regex",code:Ce.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),Pe(i,{code:Ce.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),Pe(i,{code:Ce.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),Pe(i,{code:Ce.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?uR(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{code:Ce.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?pJ.test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{code:Ce.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?fJ(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{code:Ce.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?iJ.test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"duration",code:Ce.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?xJ(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"ip",code:Ce.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?gJ(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"jwt",code:Ce.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?bJ(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"cidr",code:Ce.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?hJ.test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"base64",code:Ce.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?mJ.test(e.data)||(i=this._getOrReturnCtx(e,i),Pe(i,{validation:"base64url",code:Ce.invalid_string,message:a.message}),r.dirty()):_t.assertNever(a);return{status:r.value,value:e.data}}_regex(e,s,r){return this.refinement(i=>e.test(i),{validation:s,code:Ce.invalid_string,...Ye.errToObj(r)})}_addCheck(e){return new Si({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ye.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ye.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ye.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ye.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ye.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ye.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ye.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ye.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ye.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ye.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ye.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ye.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ye.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Ye.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Ye.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ye.errToObj(e)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...Ye.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s?.position,...Ye.errToObj(s?.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...Ye.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...Ye.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...Ye.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...Ye.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...Ye.errToObj(s)})}nonempty(e){return this.min(1,Ye.errToObj(e))}trim(){return new Si({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Si({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Si({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}Si.create=t=>new Si({checks:[],typeName:nt.ZodString,coerce:t?.coerce??!1,...ut(t)});function yJ(t,e){const s=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=s>r?s:r,a=Number.parseInt(t.toFixed(i).replace(".","")),l=Number.parseInt(e.toFixed(i).replace(".",""));return a%l/10**i}class jl extends bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Be.number){const a=this._getOrReturnCtx(e);return Pe(a,{code:Ce.invalid_type,expected:Be.number,received:a.parsedType}),et}let r;const i=new $n;for(const a of this._def.checks)a.kind==="int"?_t.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Pe(r,{code:Ce.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),Pe(r,{code:Ce.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),Pe(r,{code:Ce.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?yJ(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),Pe(r,{code:Ce.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Pe(r,{code:Ce.not_finite,message:a.message}),i.dirty()):_t.assertNever(a);return{status:i.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,Ye.toString(s))}gt(e,s){return this.setLimit("min",e,!1,Ye.toString(s))}lte(e,s){return this.setLimit("max",e,!0,Ye.toString(s))}lt(e,s){return this.setLimit("max",e,!1,Ye.toString(s))}setLimit(e,s,r,i){return new jl({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:r,message:Ye.toString(i)}]})}_addCheck(e){return new jl({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ye.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ye.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:Ye.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:Ye.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ye.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ye.toString(e)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&_t.isInteger(e.value))}get isFinite(){let e=null,s=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(s===null||r.value>s)&&(s=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(s)&&Number.isFinite(e)}}jl.create=t=>new jl({checks:[],typeName:nt.ZodNumber,coerce:t?.coerce||!1,...ut(t)});class Nl extends bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Be.bigint)return this._getInvalidInput(e);let r;const i=new $n;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),Pe(r,{code:Ce.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),Pe(r,{code:Ce.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Pe(r,{code:Ce.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):_t.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){const s=this._getOrReturnCtx(e);return Pe(s,{code:Ce.invalid_type,expected:Be.bigint,received:s.parsedType}),et}gte(e,s){return this.setLimit("min",e,!0,Ye.toString(s))}gt(e,s){return this.setLimit("min",e,!1,Ye.toString(s))}lte(e,s){return this.setLimit("max",e,!0,Ye.toString(s))}lt(e,s){return this.setLimit("max",e,!1,Ye.toString(s))}setLimit(e,s,r,i){return new Nl({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:r,message:Ye.toString(i)}]})}_addCheck(e){return new Nl({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ye.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:Ye.toString(s)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}Nl.create=t=>new Nl({checks:[],typeName:nt.ZodBigInt,coerce:t?.coerce??!1,...ut(t)});class Tm extends bt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Be.boolean){const r=this._getOrReturnCtx(e);return Pe(r,{code:Ce.invalid_type,expected:Be.boolean,received:r.parsedType}),et}return Zn(e.data)}}Tm.create=t=>new Tm({typeName:nt.ZodBoolean,coerce:t?.coerce||!1,...ut(t)});class Uc extends bt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Be.date){const a=this._getOrReturnCtx(e);return Pe(a,{code:Ce.invalid_type,expected:Be.date,received:a.parsedType}),et}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return Pe(a,{code:Ce.invalid_date}),et}const r=new $n;let i;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),Pe(i,{code:Ce.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),Pe(i,{code:Ce.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):_t.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Uc({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:Ye.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:Ye.toString(s)})}get minDate(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}}Uc.create=t=>new Uc({checks:[],coerce:t?.coerce||!1,typeName:nt.ZodDate,...ut(t)});class ig extends bt{_parse(e){if(this._getType(e)!==Be.symbol){const r=this._getOrReturnCtx(e);return Pe(r,{code:Ce.invalid_type,expected:Be.symbol,received:r.parsedType}),et}return Zn(e.data)}}ig.create=t=>new ig({typeName:nt.ZodSymbol,...ut(t)});class Em extends bt{_parse(e){if(this._getType(e)!==Be.undefined){const r=this._getOrReturnCtx(e);return Pe(r,{code:Ce.invalid_type,expected:Be.undefined,received:r.parsedType}),et}return Zn(e.data)}}Em.create=t=>new Em({typeName:nt.ZodUndefined,...ut(t)});class Am extends bt{_parse(e){if(this._getType(e)!==Be.null){const r=this._getOrReturnCtx(e);return Pe(r,{code:Ce.invalid_type,expected:Be.null,received:r.parsedType}),et}return Zn(e.data)}}Am.create=t=>new Am({typeName:nt.ZodNull,...ut(t)});class yu extends bt{constructor(){super(...arguments),this._any=!0}_parse(e){return Zn(e.data)}}yu.create=t=>new yu({typeName:nt.ZodAny,...ut(t)});class Oc extends bt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Zn(e.data)}}Oc.create=t=>new Oc({typeName:nt.ZodUnknown,...ut(t)});class ho extends bt{_parse(e){const s=this._getOrReturnCtx(e);return Pe(s,{code:Ce.invalid_type,expected:Be.never,received:s.parsedType}),et}}ho.create=t=>new ho({typeName:nt.ZodNever,...ut(t)});class ag extends bt{_parse(e){if(this._getType(e)!==Be.undefined){const r=this._getOrReturnCtx(e);return Pe(r,{code:Ce.invalid_type,expected:Be.void,received:r.parsedType}),et}return Zn(e.data)}}ag.create=t=>new ag({typeName:nt.ZodVoid,...ut(t)});class Ei extends bt{_parse(e){const{ctx:s,status:r}=this._processInputParams(e),i=this._def;if(s.parsedType!==Be.array)return Pe(s,{code:Ce.invalid_type,expected:Be.array,received:s.parsedType}),et;if(i.exactLength!==null){const l=s.data.length>i.exactLength.value,d=s.data.length<i.exactLength.value;(l||d)&&(Pe(s,{code:l?Ce.too_big:Ce.too_small,minimum:d?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&s.data.length<i.minLength.value&&(Pe(s,{code:Ce.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&s.data.length>i.maxLength.value&&(Pe(s,{code:Ce.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),s.common.async)return Promise.all([...s.data].map((l,d)=>i.type._parseAsync(new ca(s,l,s.path,d)))).then(l=>$n.mergeArray(r,l));const a=[...s.data].map((l,d)=>i.type._parseSync(new ca(s,l,s.path,d)));return $n.mergeArray(r,a)}get element(){return this._def.type}min(e,s){return new Ei({...this._def,minLength:{value:e,message:Ye.toString(s)}})}max(e,s){return new Ei({...this._def,maxLength:{value:e,message:Ye.toString(s)}})}length(e,s){return new Ei({...this._def,exactLength:{value:e,message:Ye.toString(s)}})}nonempty(e){return this.min(1,e)}}Ei.create=(t,e)=>new Ei({type:t,minLength:null,maxLength:null,exactLength:null,typeName:nt.ZodArray,...ut(e)});function Wd(t){if(t instanceof bs){const e={};for(const s in t.shape){const r=t.shape[s];e[s]=oa.create(Wd(r))}return new bs({...t._def,shape:()=>e})}else return t instanceof Ei?new Ei({...t._def,type:Wd(t.element)}):t instanceof oa?oa.create(Wd(t.unwrap())):t instanceof Sl?Sl.create(Wd(t.unwrap())):t instanceof da?da.create(t.items.map(e=>Wd(e))):t}class bs extends bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),s=_t.objectKeys(e);return this._cached={shape:e,keys:s},this._cached}_parse(e){if(this._getType(e)!==Be.object){const m=this._getOrReturnCtx(e);return Pe(m,{code:Ce.invalid_type,expected:Be.object,received:m.parsedType}),et}const{status:r,ctx:i}=this._processInputParams(e),{shape:a,keys:l}=this._getCached(),d=[];if(!(this._def.catchall instanceof ho&&this._def.unknownKeys==="strip"))for(const m in i.data)l.includes(m)||d.push(m);const u=[];for(const m of l){const p=a[m],x=i.data[m];u.push({key:{status:"valid",value:m},value:p._parse(new ca(i,x,i.path,m)),alwaysSet:m in i.data})}if(this._def.catchall instanceof ho){const m=this._def.unknownKeys;if(m==="passthrough")for(const p of d)u.push({key:{status:"valid",value:p},value:{status:"valid",value:i.data[p]}});else if(m==="strict")d.length>0&&(Pe(i,{code:Ce.unrecognized_keys,keys:d}),r.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const p of d){const x=i.data[p];u.push({key:{status:"valid",value:p},value:m._parse(new ca(i,x,i.path,p)),alwaysSet:p in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const m=[];for(const p of u){const x=await p.key,g=await p.value;m.push({key:x,value:g,alwaysSet:p.alwaysSet})}return m}).then(m=>$n.mergeObjectSync(r,m)):$n.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return Ye.errToObj,new bs({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,r)=>{const i=this._def.errorMap?.(s,r).message??r.defaultError;return s.code==="unrecognized_keys"?{message:Ye.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new bs({...this._def,unknownKeys:"strip"})}passthrough(){return new bs({...this._def,unknownKeys:"passthrough"})}extend(e){return new bs({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new bs({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:nt.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new bs({...this._def,catchall:e})}pick(e){const s={};for(const r of _t.objectKeys(e))e[r]&&this.shape[r]&&(s[r]=this.shape[r]);return new bs({...this._def,shape:()=>s})}omit(e){const s={};for(const r of _t.objectKeys(this.shape))e[r]||(s[r]=this.shape[r]);return new bs({...this._def,shape:()=>s})}deepPartial(){return Wd(this)}partial(e){const s={};for(const r of _t.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?s[r]=i:s[r]=i.optional()}return new bs({...this._def,shape:()=>s})}required(e){const s={};for(const r of _t.objectKeys(this.shape))if(e&&!e[r])s[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof oa;)a=a._def.innerType;s[r]=a}return new bs({...this._def,shape:()=>s})}keyof(){return hR(_t.objectKeys(this.shape))}}bs.create=(t,e)=>new bs({shape:()=>t,unknownKeys:"strip",catchall:ho.create(),typeName:nt.ZodObject,...ut(e)});bs.strictCreate=(t,e)=>new bs({shape:()=>t,unknownKeys:"strict",catchall:ho.create(),typeName:nt.ZodObject,...ut(e)});bs.lazycreate=(t,e)=>new bs({shape:t,unknownKeys:"strip",catchall:ho.create(),typeName:nt.ZodObject,...ut(e)});class Mm extends bt{_parse(e){const{ctx:s}=this._processInputParams(e),r=this._def.options;function i(a){for(const d of a)if(d.result.status==="valid")return d.result;for(const d of a)if(d.result.status==="dirty")return s.common.issues.push(...d.ctx.common.issues),d.result;const l=a.map(d=>new Pr(d.ctx.common.issues));return Pe(s,{code:Ce.invalid_union,unionErrors:l}),et}if(s.common.async)return Promise.all(r.map(async a=>{const l={...s,common:{...s.common,issues:[]},parent:null};return{result:await a._parseAsync({data:s.data,path:s.path,parent:l}),ctx:l}})).then(i);{let a;const l=[];for(const u of r){const m={...s,common:{...s.common,issues:[]},parent:null},p=u._parseSync({data:s.data,path:s.path,parent:m});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:m}),m.common.issues.length&&l.push(m.common.issues)}if(a)return s.common.issues.push(...a.ctx.common.issues),a.result;const d=l.map(u=>
vendor: 8,865 bytes, line 387
387new Pr(u));return Pe(s,{code:Ce.invalid_union,unionErrors:d}),et}}get options(){return this._def.options}}Mm.create=(t,e)=>new Mm({options:t,typeName:nt.ZodUnion,...ut(e)});const Qa=t=>t instanceof Rm?Qa(t.schema):t instanceof Ri?Qa(t.innerType()):t instanceof Dm?[t.value]:t instanceof kl?t.options:t instanceof Pm?_t.objectValues(t.enum):t instanceof Im?Qa(t._def.innerType):t instanceof Em?[void 0]:t instanceof Am?[null]:t instanceof oa?[void 0,...Qa(t.unwrap())]:t instanceof Sl?[null,...Qa(t.unwrap())]:t instanceof vN||t instanceof $m?Qa(t.unwrap()):t instanceof Lm?Qa(t._def.innerType):[];class Cb extends bt{_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==Be.object)return Pe(s,{code:Ce.invalid_type,expected:Be.object,received:s.parsedType}),et;const r=this.discriminator,i=s.data[r],a=this.optionsMap.get(i);return a?s.common.async?a._parseAsync({data:s.data,path:s.path,parent:s}):a._parseSync({data:s.data,path:s.path,parent:s}):(Pe(s,{code:Ce.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),et)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,r){const i=new Map;for(const a of s){const l=Qa(a.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const d of l){if(i.has(d))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);i.set(d,a)}}return new Cb({typeName:nt.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:i,...ut(r)})}}function f1(t,e){const s=eo(t),r=eo(e);if(t===e)return{valid:!0,data:t};if(s===Be.object&&r===Be.object){const i=_t.objectKeys(e),a=_t.objectKeys(t).filter(d=>i.indexOf(d)!==-1),l={...t,...e};for(const d of a){const u=f1(t[d],e[d]);if(!u.valid)return{valid:!1};l[d]=u.data}return{valid:!0,data:l}}else if(s===Be.array&&r===Be.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let a=0;a<t.length;a++){const l=t[a],d=e[a],u=f1(l,d);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return s===Be.date&&r===Be.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class _m extends bt{_parse(e){const{status:s,ctx:r}=this._processInputParams(e),i=(a,l)=>{if(m1(a)||m1(l))return et;const d=f1(a.value,l.value);return d.valid?((p1(a)||p1(l))&&s.dirty(),{status:s.value,value:d.data}):(Pe(r,{code:Ce.invalid_intersection_types}),et)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,l])=>i(a,l)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}_m.create=(t,e,s)=>new _m({left:t,right:e,typeName:nt.ZodIntersection,...ut(s)});class da extends bt{_parse(e){const{status:s,ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.array)return Pe(r,{code:Ce.invalid_type,expected:Be.array,received:r.parsedType}),et;if(r.data.length<this._def.items.length)return Pe(r,{code:Ce.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),et;!this._def.rest&&r.data.length>this._def.items.length&&(Pe(r,{code:Ce.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const a=[...r.data].map((l,d)=>{const u=this._def.items[d]||this._def.rest;return u?u._parse(new ca(r,l,r.path,d)):null}).filter(l=>!!l);return r.common.async?Promise.all(a).then(l=>$n.mergeArray(s,l)):$n.mergeArray(s,a)}get items(){return this._def.items}rest(e){return new da({...this._def,rest:e})}}da.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new da({items:t,typeName:nt.ZodTuple,rest:null,...ut(e)})};class Om extends bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.object)return Pe(r,{code:Ce.invalid_type,expected:Be.object,received:r.parsedType}),et;const i=[],a=this._def.keyType,l=this._def.valueType;for(const d in r.data)i.push({key:a._parse(new ca(r,d,r.path,d)),value:l._parse(new ca(r,r.data[d],r.path,d)),alwaysSet:d in r.data});return r.common.async?$n.mergeObjectAsync(s,i):$n.mergeObjectSync(s,i)}get element(){return this._def.valueType}static create(e,s,r){return s instanceof bt?new Om({keyType:e,valueType:s,typeName:nt.ZodRecord,...ut(r)}):new Om({keyType:Si.create(),valueType:e,typeName:nt.ZodRecord,...ut(s)})}}class og extends bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.map)return Pe(r,{code:Ce.invalid_type,expected:Be.map,received:r.parsedType}),et;const i=this._def.keyType,a=this._def.valueType,l=[...r.data.entries()].map(([d,u],m)=>({key:i._parse(new ca(r,d,r.path,[m,"key"])),value:a._parse(new ca(r,u,r.path,[m,"value"]))}));if(r.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const u of l){const m=await u.key,p=await u.value;if(m.status==="aborted"||p.status==="aborted")return et;(m.status==="dirty"||p.status==="dirty")&&s.dirty(),d.set(m.value,p.value)}return{status:s.value,value:d}})}else{const d=new Map;for(const u of l){const m=u.key,p=u.value;if(m.status==="aborted"||p.status==="aborted")return et;(m.status==="dirty"||p.status==="dirty")&&s.dirty(),d.set(m.value,p.value)}return{status:s.value,value:d}}}}og.create=(t,e,s)=>new og({valueType:e,keyType:t,typeName:nt.ZodMap,...ut(s)});class Hc extends bt{_parse(e){const{status:s,ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.set)return Pe(r,{code:Ce.invalid_type,expected:Be.set,received:r.parsedType}),et;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(Pe(r,{code:Ce.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),s.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(Pe(r,{code:Ce.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),s.dirty());const a=this._def.valueType;function l(u){const m=new Set;for(const p of u){if(p.status==="aborted")return et;p.status==="dirty"&&s.dirty(),m.add(p.value)}return{status:s.value,value:m}}const d=[...r.data.values()].map((u,m)=>a._parse(new ca(r,u,r.path,m)));return r.common.async?Promise.all(d).then(u=>l(u)):l(d)}min(e,s){return new Hc({...this._def,minSize:{value:e,message:Ye.toString(s)}})}max(e,s){return new Hc({...this._def,maxSize:{value:e,message:Ye.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}Hc.create=(t,e)=>new Hc({valueType:t,minSize:null,maxSize:null,typeName:nt.ZodSet,...ut(e)});class cu extends bt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==Be.function)return Pe(s,{code:Ce.invalid_type,expected:Be.function,received:s.parsedType}),et;function r(d,u){return rg({data:d,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,ng(),bu].filter(m=>!!m),issueData:{code:Ce.invalid_arguments,argumentsError:u}})}function i(d,u){return rg({data:d,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,ng(),bu].filter(m=>!!m),issueData:{code:Ce.invalid_return_type,returnTypeError:u}})}const a={errorMap:s.common.contextualErrorMap},l=s.data;if(this._def.returns instanceof vu){const d=this;return Zn(async function(...u){const m=new Pr([]),p=await d._def.args.parseAsync(u,a).catch(b=>{throw m.addIssue(r(u,b)),m}),x=await Reflect.apply(l,this,p);return await d._def.returns._def.type.parseAsync(x,a).catch(b=>{throw m.addIssue(i(x,b)),m})})}else{const d=this;return Zn(function(...u){const m=d._def.args.safeParse(u,a);if(!m.success)throw new Pr([r(u,m.error)]);const p=Reflect.apply(l,this,m.data),x=d._def.returns.safeParse(p,a);if(!x.success)throw new Pr([i(p,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new cu({...this._def,args:da.create(e).rest(Oc.create())})}returns(e){return new cu({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,r){return new cu({args:e||da.create([]).rest(Oc.create()),returns:s||Oc.create(),typeName:nt.ZodFunction,...ut(r)})}}class Rm extends bt{get schema(){return this._def.getter()}_parse(e){const{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Rm.create=(t,e)=>new Rm({getter:t,typeName:nt.ZodLazy,...ut(e)});class Dm extends bt{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return Pe(s,{received:s.data,code:Ce.invalid_literal,expected:this._def.value}),et}
vendor: 5,385 bytes, line 387
387return{status:"valid",value:e.data}}get value(){return this._def.value}}Dm.create=(t,e)=>new Dm({value:t,typeName:nt.ZodLiteral,...ut(e)});function hR(t,e){return new kl({values:t,typeName:nt.ZodEnum,...ut(e)})}class kl extends bt{_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),r=this._def.values;return Pe(s,{expected:_t.joinValues(r),received:s.parsedType,code:Ce.invalid_type}),et}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const s=this._getOrReturnCtx(e),r=this._def.values;return Pe(s,{received:s.data,code:Ce.invalid_enum_value,options:r}),et}return Zn(e.data)}get options(){return this._def.values}get enum(){const e={};for(const s of this._def.values)e[s]=s;return e}get Values(){const e={};for(const s of this._def.values)e[s]=s;return e}get Enum(){const e={};for(const s of this._def.values)e[s]=s;return e}extract(e,s=this._def){return kl.create(e,{...this._def,...s})}exclude(e,s=this._def){return kl.create(this.options.filter(r=>!e.includes(r)),{...this._def,...s})}}kl.create=hR;class Pm extends bt{_parse(e){const s=_t.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Be.string&&r.parsedType!==Be.number){const i=_t.objectValues(s);return Pe(r,{expected:_t.joinValues(i),received:r.parsedType,code:Ce.invalid_type}),et}if(this._cache||(this._cache=new Set(_t.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=_t.objectValues(s);return Pe(r,{received:r.data,code:Ce.invalid_enum_value,options:i}),et}return Zn(e.data)}get enum(){return this._def.values}}Pm.create=(t,e)=>new Pm({values:t,typeName:nt.ZodNativeEnum,...ut(e)});class vu extends bt{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==Be.promise&&s.common.async===!1)return Pe(s,{code:Ce.invalid_type,expected:Be.promise,received:s.parsedType}),et;const r=s.parsedType===Be.promise?s.data:Promise.resolve(s.data);return Zn(r.then(i=>this._def.type.parseAsync(i,{path:s.path,errorMap:s.common.contextualErrorMap})))}}vu.create=(t,e)=>new vu({type:t,typeName:nt.ZodPromise,...ut(e)});class Ri extends bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===nt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:s,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:l=>{Pe(r,l),l.fatal?s.abort():s.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){const l=i.transform(r.data,a);if(r.common.async)return Promise.resolve(l).then(async d=>{if(s.value==="aborted")return et;const u=await this._def.schema._parseAsync({data:d,path:r.path,parent:r});return u.status==="aborted"?et:u.status==="dirty"||s.value==="dirty"?ru(u.value):u});{if(s.value==="aborted")return et;const d=this._def.schema._parseSync({data:l,path:r.path,parent:r});return d.status==="aborted"?et:d.status==="dirty"||s.value==="dirty"?ru(d.value):d}}if(i.type==="refinement"){const l=d=>{const u=i.refinement(d,a);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(r.common.async===!1){const d=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return d.status==="aborted"?et:(d.status==="dirty"&&s.dirty(),l(d.value),{status:s.value,value:d.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(d=>d.status==="aborted"?et:(d.status==="dirty"&&s.dirty(),l(d.value).then(()=>({status:s.value,value:d.value}))))}if(i.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Fc(l))return et;const d=i.transform(l.value,a);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:d}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>Fc(l)?Promise.resolve(i.transform(l.value,a)).then(d=>({status:s.value,value:d})):et);_t.assertNever(i)}}Ri.create=(t,e,s)=>new Ri({schema:t,typeName:nt.ZodEffects,effect:e,...ut(s)});Ri.createWithPreprocess=(t,e,s)=>new Ri({schema:e,effect:{type:"preprocess",transform:t},typeName:nt.ZodEffects,...ut(s)});class oa extends bt{_parse(e){return this._getType(e)===Be.undefined?Zn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}oa.create=(t,e)=>new oa({innerType:t,typeName:nt.ZodOptional,...ut(e)});class Sl extends bt{_parse(e){return this._getType(e)===Be.null?Zn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sl.create=(t,e)=>new Sl({innerType:t,typeName:nt.ZodNullable,...ut(e)});class Im extends bt{_parse(e){const{ctx:s}=this._processInputParams(e);let r=s.data;return s.parsedType===Be.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}Im.create=(t,e)=>new Im({innerType:t,typeName:nt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ut(e)});class Lm extends bt{_parse(e){const{ctx:s}=this._processInputParams(e),r={...s,common:{...s.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Cm(i)?i.then(a=>
387({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Pr(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Pr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Lm.create=(t,e)=>new Lm({innerType:t,typeName:nt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ut(e)});class lg extends bt{_parse(e){if(this._getType(e)!==Be.nan){const r=this._getOrReturnCtx(e);return Pe(r,{code:Ce.invalid_type,expected:Be.nan,received:r.parsedType}),et}return{status:"valid",value:e.data}}}lg.create=t=>new lg({typeName:nt.ZodNaN,...ut(t)});const vJ=Symbol("zod_brand");class vN extends bt{_parse(e){const{ctx:s}=this._processInputParams(e),r=s.data;return this._def.type._parse({data:r,path:s.path,parent:s})}unwrap(){return this._def.type}}class up extends bt{_parse(e){const{status:s,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?et:a.status==="dirty"?(s.dirty(),ru(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?et:i.status==="dirty"?(s.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,s){return new up({in:e,out:s,typeName:nt.ZodPipeline})}}class $m extends bt{_parse(e){const s=this._def.innerType._parse(e),r=i=>(Fc(i)&&(i.value=Object.freeze(i.value)),i);return Cm(s)?s.then(i=>r(i)):r(s)}unwrap(){return this._def.innerType}}$m.create=(t,e)=>new $m({innerType:t,typeName:nt.ZodReadonly,...ut(e)});function _T(t,e){const s=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof s=="string"?{message:s}:s}function wN(t,e={},s){return t?yu.create().superRefine((r,i)=>{const a=t(r);if(a instanceof Promise)return a.then(l=>{if(!l){const d=_T(e,r),u=d.fatal??s??!0;i.addIssue({code:"custom",...d,fatal:u})}});if(!a){const l=_T(e,r),d=l.fatal??s??!0;i.addIssue({code:"custom",...l,fatal:d})}}):yu.create()}const wJ={object:bs.lazycreate};var nt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(nt||(nt={}));const jJ=(t,e={message:`Input not instance of ${t.name}`})=>wN(s=>s instanceof t,e),jN=Si.create,NN=jl.create,NJ=lg.create,kJ=Nl.create,kN=Tm.create,SJ=Uc.create,CJ=ig.create,TJ=Em.create,mR=Am.create,cg=yu.create,EJ=Oc.create,AJ=ho.create,MJ=ag.create,pR=Ei.create,fR=bs.create,_J=bs.strictCreate,SN=Mm.create,OJ=Cb.create,RJ=_m.create,DJ=da.create,xR=Om.create,PJ=og.create,IJ=Hc.create,LJ=cu.create,$J=Rm.create,BJ=Dm.create,zJ=kl.create,VJ=Pm.create,FJ=vu.create,OT=Ri.create,UJ=oa.create,HJ=Sl.create,qJ=Ri.createWithPreprocess,WJ=up.create,GJ=()=>jN().optional(),KJ=()=>NN().optional(),YJ=()=>kN().optional(),QJ={string:(t=>Si.create({...t,coerce:!0})),number:(t=>jl.create({...t,coerce:!0})),boolean:(t=>Tm.create({...t,coerce:!0})),bigint:(t=>Nl.create({...t,coerce:!0})),date:(t=>Uc.create({...t,coerce:!0}))},JJ=et,XJ=Object.freeze(Object.defineProperty({__proto__:null,BRAND:vJ,DIRTY:ru,EMPTY_PATH:XQ,INVALID:et,NEVER:JJ,OK:Zn,ParseStatus:$n,Schema:bt,ZodAny:yu,ZodArray:Ei,ZodBigInt:Nl,ZodBoolean:Tm,ZodBranded:vN,ZodCatch:Lm,ZodDate:Uc,ZodDefault:Im,ZodDiscriminatedUnion:Cb,ZodEffects:Ri,ZodEnum:kl,ZodError:Pr,get ZodFirstPartyTypeKind(){return nt},ZodFunction:cu,ZodIntersection:_m,ZodIssueCode:Ce,ZodLazy:Rm,ZodLiteral:Dm,ZodMap:og,ZodNaN:lg,ZodNativeEnum:Pm,ZodNever:ho,ZodNull:Am,ZodNullable:Sl,ZodNumber:jl,ZodObject:bs,ZodOptional:oa,ZodParsedType:Be,ZodPipeline:up,ZodPromise:vu,ZodReadonly:$m,ZodRecord:Om,ZodSchema:bt,ZodSet:Hc,ZodString:Si,ZodSymbol:ig,ZodTransformer:Ri,ZodTuple:da,ZodType:bt,ZodUndefined:Em,ZodUnion:Mm,ZodUnknown:Oc,ZodVoid:ag,addIssueToContext:Pe,any:cg,array:pR,bigint:kJ,boolean:kN,coerce:QJ,custom:wN,date:SJ,datetimeRegex:uR,defaultErrorMap:bu,discriminatedUnion:OJ,effect:OT,enum:zJ,function:LJ,getErrorMap:ng,getParsedType:eo,instanceof:jJ,intersection:RJ,isAborted:m1,isAsync:Cm,isDirty:p1,isValid:Fc,late:wJ,lazy:$J,literal:BJ,makeIssue:rg,map:PJ,nan:NJ,nativeEnum:VJ,never:AJ,null:mR,nullable:HJ,number:NN,object:fR,get objectUtil(){return h1},oboolean:YJ,onumber:KJ,optional:UJ,ostring:GJ,pipeline:WJ,preprocess:qJ,promise:FJ,quotelessJson:QQ,record:xR,set
387:IJ,setErrorMap:JQ,strictObject:_J,string:jN,symbol:CJ,transformer:OT,tuple:DJ,undefined:TJ,union:SN,unknown:EJ,get util(){return _t},void:MJ},Symbol.toStringTag,{value:"Module"})),gs={INT8_MIN:-128,INT8_MAX:127,INT8_UNSIGNED_MAX:255,INT16_MIN:-32768,INT16_MAX:32767,INT16_UNSIGNED_MAX:65535,INT24_MIN:-8388608,INT24_MAX:8388607,INT24_UNSIGNED_MAX:16777215,INT32_MIN:-2147483648,INT32_MAX:2147483647,INT32_UNSIGNED_MAX:4294967295,INT48_MIN:-0x800000000000,INT48_MAX:0x7fffffffffff,INT48_UNSIGNED_MAX:0xffffffffffff,INT64_MIN:-9223372036854775808n,INT64_MAX:9223372036854775807n,INT64_UNSIGNED_MAX:18446744073709551615n};function Ls(t,e){return e.includes(t.columnType)}function ZJ(t){return"enumValues"in t&&Array.isArray(t.enumValues)&&t.enumValues.length>0}const eX=SN([jN(),NN(),kN(),mR()]),tX=SN([eX,xR(cg()),pR(cg())]),sX=wN(t=>t instanceof Buffer);function gR(t,e){const s=e?.zodInstance??XJ,r=e?.coerce??{};let i;return ZJ(t)&&(i=t.enumValues.length?s.enum(t.enumValues):s.string()),i||(Ls(t,["PgGeometry","PgPointTuple"])?i=s.tuple([s.number(),s.number()]):Ls(t,["PgGeometryObject","PgPointObject"])?i=s.object({x:s.number(),y:s.number()}):Ls(t,["PgHalfVector","PgVector"])?(i=s.array(s.number()),i=t.dimensions?i.length(t.dimensions):i):Ls(t,["PgLine"])?i=s.tuple([s.number(),s.number(),s.number()]):Ls(t,["PgLineABC"])?i=s.object({a:s.number(),b:s.number(),c:s.number()}):Ls(t,["PgArray"])?(i=s.array(gR(t.baseColumn,s)),i=t.size?i.length(t.size):i):t.dataType==="array"?i=s.array(s.any()):t.dataType==="number"?i=nX(t,s,r):t.dataType==="bigint"?i=rX(t,s,r):t.dataType==="boolean"?i=r===!0||r.boolean?s.coerce.boolean():s.boolean():t.dataType==="date"?i=r===!0||r.date?s.coerce.date():s.date():t.dataType==="string"?i=iX(t,s,r):t.dataType==="json"?i=tX:t.dataType==="custom"?i=s.any():t.dataType==="buffer"&&(i=sX)),i||(i=s.any()),i}function nX(t,e,s){let r=t.getSQLType().includes("unsigned"),i,a,l=!1;Ls(t,["MySqlTinyInt","SingleStoreTinyInt"])?(i=r?0:gs.INT8_MIN,a=r?gs.INT8_UNSIGNED_MAX:gs.INT8_MAX,l=!0):Ls(t,["PgSmallInt","PgSmallSerial","MySqlSmallInt","SingleStoreSmallInt"])?(i=r?0:gs.INT16_MIN,a=r?gs.INT16_UNSIGNED_MAX:gs.INT16_MAX,l=!0):Ls(t,["PgReal","MySqlFloat","MySqlMediumInt","SingleStoreMediumInt","SingleStoreFloat"])?(i=r?0:gs.INT24_MIN,a=r?gs.INT24_UNSIGNED_MAX:gs.INT24_MAX,l=Ls(t,["MySqlMediumInt","SingleStoreMediumInt"])):Ls(t,["PgInteger","PgSerial","MySqlInt","SingleStoreInt"])?(i=r?0:gs.INT32_MIN,a=r?gs.INT32_UNSIGNED_MAX:gs.INT32_MAX,l=!0):Ls(t,["PgDoublePrecision","MySqlReal","MySqlDouble","SingleStoreReal","SingleStoreDouble","SQLiteReal"])?(i=r?0:gs.INT48_MIN,a=r?gs.INT48_UNSIGNED_MAX:gs.INT48_MAX):Ls(t,["PgBigInt53","PgBigSerial53","MySqlBigInt53","MySqlSerial","SingleStoreBigInt53","SingleStoreSerial","SQLiteInteger"])?(r=r||Ls(t,["MySqlSerial","SingleStoreSerial"]),i=r?0:Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER,l=!0):Ls(t,["MySqlYear","SingleStoreYear"])?(i=1901,a=2155,l=!0):(i=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER);let d=s===!0||s?.number?e.coerce.number():e.number();return d=d.min(i).max(a),l?d.int():d}function rX(t,e,s){const r=t.getSQLType().includes("unsigned"),i=r?0n:gs.INT64_MIN,a=r?gs.INT64_UNSIGNED_MAX:gs.INT64_MAX;return(s===!0||s?.bigint?e.coerce.bigint():e.bigint()).min(i).max(a)}function iX(t,e,s){if(Ls(t,["PgUUID"]))return e.string().uuid();let r,i,a=!1;Ls(t,["PgVarchar","SQLiteText"])?r=t.length:Ls(t,["MySqlVarChar","SingleStoreVarChar"])?r=t.length??gs.INT16_UNSIGNED_MAX:Ls(t,["MySqlText","SingleStoreText"])&&(t.textType==="longtext"?r=gs.INT32_UNSIGNED_MAX:t.textType==="mediumtext"?r=gs.INT24_UNSIGNED_MAX:t.textType==="text"?r=gs.INT16_UNSIGNED_MAX:r=gs.INT8_UNSIGNED_MAX),Ls(t,["PgChar","MySqlChar","SingleStoreChar"])&&(r=t.length,a=!0),Ls(t,["PgBinaryVector"])&&(i=/^[01]+$/,r=t.dimensions);let l=s===!0||s?.string?e.coerce.string():e.string();return l=i?l.regex(i):l,r&&a?l.length(r):r?l.max(r):l}function bR(t){return sR(t)?YK(t):QK(t)}function yR(t,e,s,r){const i={};for(const[a,l]of Object.entries(t)){if(!yn(l,Sm)&&!yn(l,Ms)&&!yn(l,Ms.Aliased)&&typeof l=="object"){const x=sR(l)||KK(l)?bR(l):l;i[a]=yR(x,e[a]??{},s,r);continue}const d=e[a];if(d!==void 0&&typeof d!="function"){i[a]=d;continue}const u=yn(l,Sm)?l:void 0,m=u?gR(u,r):cg(),p=typeof d=="function"?d(m):m;s.never(u)||(i[a]=p,u&&(s.nullable(u)&&(i[a]=i[a].nullable()),s.optional(u)&&(i[a]=i[a].optional())))}return fR(i)}const aX={never:t=>t?.generated?.type==="always"||t?.generatedIdentity?.type==="always",optional:t=>!t.notNull||t.notNull&&t.hasDefault,nullable:t=>!t.notNull},fr=(t,e)=>{const s=bR(t);return yR(s,{},aX)}
387,oX=rs("waitlist_entries",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),name:Z("name").notNull(),email:Z("email").notNull(),company:Z("company"),automationGoal:Z("automation_goal").notNull(),timeline:Z("timeline").notNull(),createdAt:Le("created_at").defaultNow().notNull()});fr(oX).omit({id:!0,createdAt:!0});const lX=rs("team_members",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),name:Z("name").notNull(),email:Z("email").notNull().unique(),password:Z("password"),role:Z("role").notNull(),slackHandle:Z("slackHandle"),isActive:_s("isActive").notNull().default(1),createdAt:Le("createdAt").defaultNow().notNull(),updatedAt:Le("updatedAt").defaultNow().notNull()});fr(lX).omit({id:!0,createdAt:!0,updatedAt:!0});const cX=rs("ops_clients",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),companyName:Z("company_name").notNull(),slug:Z("slug").unique(),customerUrl:Z("customer_url"),industry:Z("industry").notNull().default("Background Check / CRA"),source:Z("source"),stage:Z("stage").notNull().default("prospect"),stageChangedAt:Le("stage_changed_at").defaultNow().notNull(),plan:Z("plan").notNull().default("free"),website:Z("website"),platform:Z("platform"),trialEndDate:Le("trial_end_date"),demoDate:Le("demo_date"),churnedReason:Z("churned_reason"),notes:Z("notes"),portalToken:Z("portal_token").unique(),portalTokenExpiry:Le("portal_token_expiry"),stripeCustomerId:Z("stripe_customer_id"),stripeSubscriptionId:Z("stripe_subscription_id"),stripePriceId:Z("stripe_price_id"),stripeStatus:Z("stripe_status"),stripeCurrentPeriodEnd:Le("stripe_current_period_end"),requireMemberReview:_s("require_member_review").notNull().default(1),notificationDefaults:Dr("notification_defaults").$type(),createdAt:Le("created_at").defaultNow().notNull(),updatedAt:Le("updated_at").defaultNow().notNull()});fr(cX).omit({id:!0,createdAt:!0,updatedAt:!0});const Rc=[{key:"signed_up",label:"Signed Up",color:"gray"},{key:"onboarding",label:"Onboarding",color:"blue"},{key:"activated",label:"Activated",color:"teal"},{key:"active",label:"Active",color:"green"},{key:"inactive",label:"Inactive",color:"amber"},{key:"churned",label:"Churned",color:"red"}],Zc=[{key:"free",label:"Free",price:0,limits:{workflows:1,teamSeats:1,documents:5,recordingMinutesPerMonth:30}},{key:"pro",label:"Pro",price:49,limits:{workflows:5,teamSeats:3,documents:50,recordingMinutesPerMonth:300}},{key:"team",label:"Team",price:199,limits:{workflows:25,teamSeats:10,documents:250,recordingMinutesPerMonth:1500}},{key:"business",label:"Business",price:499,limits:{workflows:100,teamSeats:25,documents:null,recordingMinutesPerMonth:null}},{key:"enterprise",label:"Enterprise",price:null,limits:{workflows:null,teamSeats:null,documents:null,recordingMinutesPerMonth:null}},{key:"unlimited",label:"Unlimited",price:0,hidden:!0,limits:{workflows:null,teamSeats:null,documents:null,recordingMinutesPerMonth:null}}];Zc.filter(t=>!("hidden"in t&&t.hidden));const dX=rs("ops_contacts",{emailVerified:_s("email_verified").notNull().default(0),emailVerifiedAt:Le("email_verified_at"),id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id").notNull(),name:Z("name").notNull(),email:Z("email"),phone:Z("phone"),title:Z("title"),isPrimary:_s("is_primary").notNull().default(0),notes:Z("notes"),notificationPrefs:Dr("notification_prefs").$type(),createdAt:Le("created_at").defaultNow().notNull()});rs("notifications",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id").notNull(),contactId:st("contact_id").notNull(),type:Z("type").notNull(),title:Z("title").notNull(),body:Z("body"),link:Z("link"),meta:Dr("meta").$type(),readAt:Le("read_at"),createdAt:Le("created_at").defaultNow().notNull()});fr(dX).omit({id:!0,createdAt:!0});rs("portal_invite_tokens",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id").notNull(),token:Z("token").notNull().unique(),createdBy:Z("created_by").notNull(),invitedEmail:Z("invited_email"),invitedName:Z("invited_name"),expiresAt:Le("expires_at").notNull(),usedBy:Z("used_by"),usedAt:Le("used_at"),createdAt:Le("created_at").defaultNow().notNull()});rs("portal_magic_links",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),contactEmail:Z("contact_email").notNull(),clientId:st("client_id").notNull(),token:Z("token").notNull().unique(),expiresAt:Le("expires_at").notNull(),usedAt:Le("used_at"),inviteId:Z("invite_id"),inviteName:Z("invite_name"),createdAt:Le("created_at").defaultNow().notNull()});const uX=rs("ops_documents",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id").notNull(),type:Z("type").notNull(),title:Z("title").notNull(),status:Z("status").notNull().default("draft"),contentHtml:Z("content_html"),contentJson:Dr("content_json"),sentToName:Z("sent_to_name"),sentToEmail:Z("sent_to_email"),sentAt:Le("sent_at"),viewedAt:Le("viewed_at"),signedAt:Le("signed_at"),signatureData:Z("signature_data"),signerIp:Z("signer_ip"),signerName:Z("signer_name"),signerTitle:Z("signer_title"),pdfUrl:Z("pdf_url"),accessToken:Z("access_token").notNull().unique().default(Ft`gen_random_uuid()`),expiresAt:Le("expires_at"),createdById:Z("created_by_id"),createdAt:Le("created_at").defaultNow().notNull(),updatedAt:Le("updated_at").defaultNow().notNull()});fr(uX).omit({id:!0,createdAt:!0,updatedAt:!0});const hX=rs("client_files",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id").notNull(),fileName:Z("file_name").notNull(),fileType:Z("file_type").notNull(),fileSize:_s("file_size"),filePath:
387Z("file_path").notNull(),fileData:yN({dataType(){return"bytea"},toDriver(t){return t},fromDriver(t){return t}})("file_data"),uploadedBy:Z("uploaded_by"),description:Z("description"),documentType:Z("document_type").default("upload"),createdAt:Le("created_at").defaultNow().notNull()});fr(hX).omit({id:!0,createdAt:!0});const mX=rs("sop_submissions",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id").notNull(),title:Z("title").notNull(),description:Z("description"),status:Z("status").notNull().default("requested"),fileId:st("file_id"),requestedAt:Le("requested_at").defaultNow().notNull(),receivedAt:Le("received_at"),reviewedAt:Le("reviewed_at"),approvedAt:Le("approved_at"),reviewNotes:Z("review_notes"),lastReminderSentAt:Le("last_reminder_sent_at"),reminderCount:_s("reminder_count").notNull().default(0),captureMethod:Z("capture_method"),workflowSteps:Dr("workflow_steps"),audioTranscript:Z("audio_transcript"),aiSummary:Dr("ai_summary"),recordedAt:Le("recorded_at"),startUrl:Z("start_url"),scriptCode:Z("script_code"),audioUrl:Z("audio_url"),audioData:yN({dataType(){return"bytea"},toDriver(t){return t},fromDriver(t){return t}})("audio_data"),audioDurationSec:_s("audio_duration_sec"),captureDurationSec:_s("capture_duration_sec"),capturedById:st("captured_by_id"),reviewerId:st("reviewer_id"),reviewNotifiedAt:Le("review_notified_at"),createdAt:Le("created_at").defaultNow().notNull()});fr(mX).omit({id:!0,createdAt:!0,lastReminderSentAt:!0,reminderCount:!0});const pX=rs("support_tickets",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id").notNull(),contactEmail:Z("contact_email").notNull(),contactName:Z("contact_name").notNull(),subject:Z("subject").notNull(),status:Z("status").notNull().default("open"),priority:Z("priority").notNull().default("normal"),assignedTo:Z("assigned_to"),createdAt:Le("created_at").defaultNow().notNull(),updatedAt:Le("updated_at").defaultNow().notNull(),closedAt:Le("closed_at")});fr(pX).omit({id:!0,createdAt:!0,updatedAt:!0,closedAt:!0});const fX=rs("ticket_messages",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),ticketId:st("ticket_id").notNull(),senderType:Z("sender_type").notNull(),senderName:Z("sender_name").notNull(),senderEmail:Z("sender_email"),message:Z("message").notNull(),createdAt:Le("created_at").defaultNow().notNull()});fr(fX).omit({id:!0,createdAt:!0});rs("activity_logs",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:Z("clientId"),documentId:Z("documentId"),userId:Z("userId"),action:Z("action").notNull(),details:Dr("details"),source:Z("source").default("admin"),createdAt:Le("createdAt").defaultNow().notNull()});const xX=rs("enhancement_requests",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),epicId:st("epic_id"),title:Z("title").notNull(),description:Z("description"),type:Z("type").notNull().default("internal"),priority:Z("priority").notNull().default("normal"),status:Z("status").notNull().default("idea"),versionTarget:Z("version_target").notNull().default("backlog"),clientId:st("client_id"),assignedTo:Z("assigned_to"),createdBy:Z("created_by"),sortOrder:_s("sort_order").notNull().default(0),dueDate:Le("due_date"),createdAt:Le("created_at").defaultNow().notNull(),updatedAt:Le("updated_at").defaultNow().notNull()});rs("enhancement_versions",{key:Z("key").primaryKey(),label:Z("label").notNull(),color:Z("color").notNull().default("#9ca3af"),sortOrder:_s("sort_order").notNull().default(0),isLocked:_s("is_locked").notNull().default(0)});rs("enhancement_epics",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),title:Z("title").notNull(),description:Z("description"),versionKey:Z("version_key").notNull().default("triage"),type:Z("type").notNull().default("internal"),priority:Z("priority").notNull().default("normal"),status:Z("status").notNull().default("idea"),sortOrder:_s("sort_order").notNull().default(0),createdBy:Z("created_by"),createdAt:Le("created_at").defaultNow().notNull(),updatedAt:Le("updated_at").defaultNow().notNull()});fr(xX).omit({id:!0,createdAt:!0,updatedAt:!0});const gX=rs("governance_sections",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),sectionKey:Z("section_key").notNull().unique(),title:Z("title").notNull(),status:Z("status").notNull().default("
387configured"),statusLabel:Z("status_label").notNull().default("Configured"),description:Z("description").notNull(),lastUpdated:Le("last_updated").defaultNow().notNull(),updatedBy:Z("updated_by").notNull().default("System"),isEnabled:_s("is_enabled").notNull().default(1),config:Dr("config").default({}),createdAt:Le("created_at").defaultNow().notNull(),updatedAt:Le("updated_at").defaultNow().notNull()});fr(gX).omit({id:!0,createdAt:!0,updatedAt:!0});rs("ops_settings",{key:Z("key").primaryKey(),value:Dr("value").notNull(),updatedAt:Le("updated_at").defaultNow().notNull()});const bX=rs("client_billing_info",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id").notNull(),billingContactName:Z("billing_contact_name").notNull(),billingEmail:Z("billing_email").notNull(),billingPhone:Z("billing_phone"),createdAt:Le("created_at").defaultNow().notNull(),updatedAt:Le("updated_at").defaultNow().notNull()});fr(bX).omit({id:!0,createdAt:!0,updatedAt:!0});const yX=rs("client_provisioning",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id").notNull(),status:Z("status").notNull().default("crm_ready"),accountId:Z("account_id"),region:Z("region").default("us-east-1"),crmPayload:Z("crm_payload"),orchestratorPayload:Z("orchestrator_payload"),requestedAt:Le("requested_at").defaultNow().notNull(),accountCreatedAt:Le("account_created_at"),onboardingDispatchedAt:Le("onboarding_dispatched_at"),provisionedAt:Le("provisioned_at"),failureReason:Z("failure_reason"),notes:Z("notes")});fr(yX).omit({id:!0,requestedAt:!0});const vR=["draft","sent","paid","overdue","void"],vX=rs("client_invoices",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id").notNull(),invoiceNumber:Z("invoice_number"),amountCents:_s("amount_cents").notNull().default(0),currency:Z("currency").notNull().default("usd"),status:Z("status").notNull().default("draft"),periodStart:Le("period_start"),periodEnd:Le("period_end"),issuedAt:Le("issued_at"),dueAt:Le("due_at"),paidAt:Le("paid_at"),externalUrl:Z("external_url"),notes:Z("notes"),createdAt:Le("created_at").defaultNow().notNull(),updatedAt:Le("updated_at").defaultNow().notNull()});fr(vX).omit({id:!0,createdAt:!0,updatedAt:!0});rs("stripe_payments",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id"),stripeCustomerId:Z("stripe_customer_id"),stripeInvoiceId:Z("stripe_invoice_id").notNull().unique(),stripeSubscriptionId:Z("stripe_subscription_id"),stripeChargeId:Z("stripe_charge_id"),stripePaymentIntentId:Z("stripe_payment_intent_id"),amountPaidCents:_s("amount_paid_cents").notNull().default(0),amountRefundedCents:_s("amount_refunded_cents").notNull().default(0),currency:Z("currency").notNull().default("usd"),status:Z("status").notNull().default("paid"),description:Z("description"),hostedInvoiceUrl:Z("hosted_invoice_url"),invoicePdfUrl:Z("invoice_pdf_url"),periodStart:Le("period_start"),periodEnd:Le("period_end"),paidAt:Le("paid_at").notNull(),createdAt:Le("created_at").defaultNow().notNull(),updatedAt:Le("updated_at").defaultNow().notNull()});rs("plan_upgrade_consents",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id").notNull(),contactId:st("contact_id"),contactEmail:Z("contact_email"),fromPlan:Z("from_plan").notNull(),toPlan:Z("to_plan").notNull(),reason:Z("reason"),limitType:Z("limit_type"),limitValue:_s("limit_value"),usageAtConsent:_s("usage_at_consent"),priceAtConsent:_s("price_at_consent"),ipAddress:Z("ip_address"),userAgent:Z("user_agent"),stripeCheckoutSessionId:Z("stripe_checkout_session_id"),stripeSubscriptionId:Z("stripe_subscription_id"),status:Z("status").notNull().default("pending"),consentedAt:Le("consented_at").defaultNow().notNull(),completedAt:Le("completed_at")});rs("mass_email_sends",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),sentByTeamMemberId:st("sent_by_team_member_id"),sentByName:Z("sent_by_name").notNull(),subject:Z("subject").notNull(),bodyHtml:Z("body_html").notNull(),mode:Z("mode").notNull(),targetStages:Dr("target_stages").$type(),targetClientId:st("target_client_id"),targetDescription:Z("target_description").notNull(),recipientEmails:Dr("recipient_emails").$type().notNull(),totalSent:_s("total_sent").notNull().default(0),totalFailed:_s("total_failed").notNull().default(0),errors:Dr("errors").$type().default([]),createdAt:Le("created_at").defaultNow().notNull()});rs("integration_access_requests",{id:st("id").primaryKey().default(Ft`gen_random_uuid()`),clientId:st("client_id").notNull(),contactId:st("contact_id"),contactEmail:Z("contact_email").notNull(),contactName:Z("contact_name"),integrationKey:Z("integration_key").notNull(),integrationLabel:Z("integration_label").notNull(),status:Z("status").notNull().default("requested"),ipAddress:Z("ip_address"),userAgent:Z("user_agent"),requestedAt:Le("requested_at").defaultNow().notNull(),notifiedAt:Le("notified_at")});const RT={gray:"bg-gray-100 text-gray-700 border-gray-200",blue:"bg-blue-50 text-blue-700 border-blue-200",teal:"bg-teal-50 text-teal-700 border-teal-200",green:"bg-emerald-50 text-emerald-700 border-emerald-200",amber:"bg-amber-50 text-amber-800 border-amber-200",red:"bg-red-50 text-red-700 border-red-200"};function wX(t){return Rc.find(s=>s.key===t)||{key:t,label:t||"—",color:"gray"}}function dg({stage:t}){const e=wX(t),s=RT[e.color]||RT.gray;return n.jsx("span",{className:`inline-flex items-center text-[11px] font-semibold px-2 py-0.5 rounded-full border ${s}`,"data-testid":`stage-badge-${e.key}`,children:e.label})}
387function Gf(t){return(t/100).toLocaleString(void 0,{style:"currency",currency:"USD",maximumFractionDigits:0})}function x1(t){const e=Date.now()-new Date(t).getTime(),s=Math.floor(e/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const r=Math.floor(s/60);if(r<24)return`${r}h ago`;const i=Math.floor(r/24);return i<30?`${i}d ago`:new Date(t).toLocaleDateString()}function DT(t){return t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function jX(){const{data:t,isLoading:e,error:s}=ds({queryKey:["/api/admin/dashboard"],queryFn:async()=>{const g=await fetch("/api/admin/dashboard",{credentials:"include"});if(!g.ok)throw new Error("failed");return g.json()},refetchInterval:3e5,refetchOnWindowFocus:!0,staleTime:3e4});if(e||!t)return n.jsx("div",{className:"px-6 py-10 max-w-[1400px] mx-auto",children:n.jsx("p",{className:"text-warm-gray text-sm",children:s?"Failed to load dashboard.":"Loading dashboard…"})});const{clients:r,workflows:i,tickets:a,enhancements:l,invoices:d,revenue:u,waitlist:m,comms:p}=t,x=(r.byStage.active||0)+(r.byStage.activated||0);return n.jsxs("div",{className:"px-6 py-6 max-w-[1400px] mx-auto","data-testid":"page-admin-dashboard",children:[n.jsxs("div",{className:"flex items-end justify-between mb-6 flex-wrap gap-2",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"font-serif text-3xl text-ink tracking-tight",children:"Operations Dashboard"}),n.jsxs("p",{className:"text-[12px] text-warm-gray mt-1",children:["Updated ",x1(t.generatedAt)," · auto-refreshes in the background"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(AX,{}),n.jsx(Ae,{href:"/admin/clients",className:"text-[12px] px-3 py-1.5 rounded-md bg-olive-dark text-white hover:opacity-90","data-testid":"link-view-clients",children:"View clients"}),n.jsx(Ae,{href:"/admin/issues",className:"text-[12px] px-3 py-1.5 rounded-md border border-[#e7e3d9] text-ink hover:bg-[#f7f5f0]",children:"Open issues"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-5",children:[n.jsx(Kf,{label:"Total clients",value:String(r.total),hint:`${r.newThisWeek} new this week · ${r.newThisMonth} this month`,icon:n.jsx(wj,{className:"w-4 h-4 text-olive-dark"}),href:"/admin/clients"}),n.jsx(Kf,{label:"Active",value:String(x),hint:`${Math.round(x/Math.max(1,r.total)*100)}% of total`,icon:n.jsx($x,{className:"w-4 h-4 text-emerald-700"}),href:"/admin/clients?stage=active,activated"}),n.jsx(Kf,{label:"Needs attention",value:String(r.attentionTotal),hint:r.attentionTotal>0?"Stuck > 14 days in a non-final stage":"All clients on track",icon:n.jsx(oi,{className:`w-4 h-4 ${r.attentionTotal>0?"text-amber-700":"text-warm-gray"}`}),tone:r.attentionTotal>0?"warn":void 0,href:"/admin/clients?attention=1"}),n.jsx(Kf,{label:"MRR",value:Gf(u.mrrCents),hint:u.pastDueCount>0?`${u.activeSubscribers} active · ${u.pastDueCount} past due (${Gf(u.pastDueCents)}) · ${Gf(u.paidYtdCents)} paid YTD`:`${u.activeSubscribers} active subscriber${u.activeSubscribers===1?"":"s"} · ${Gf(u.paidYtdCents)} paid YTD`,icon:n.jsx(bj,{className:`w-4 h-4 ${u.pastDueCount>0?"text-red-700":"text-olive-dark"}`}),tone:u.pastDueCount>0?"danger":void 0,href:"/admin/clients"})]}),n.jsxs("div",{className:"grid lg:grid-cols-3 gap-3 mb-5",children:[n.jsxs(Ph,{title:"Pipeline",subtitle:"Clients by stage",className:"lg:col-span-2",children:[n.jsx("div",{className:"space-y-2",children:Rc.map(g=>{const b=r.byStage[g.key]||0,v=r.total?Math.round(b/r.total*100):0;return n.jsxs("div",{className:"flex items-center gap-3","data-testid":`stage-row-${g.key}`,children:[n.jsx("div",{className:"w-32 shrink-0",children:n.jsx(dg,{stage:g.key})}),n.jsx("div",{className:"flex-1 h-2 bg-[#f3efe5] rounded-full overflow-hidden",children:n.jsx("div",{className:`h-full ${CX(g.color)}`,style:{width:`${v}%`}})}),n.jsxs("div",{className:"w-20 text-right text-[12px] tabular-nums",children:[n.jsx("span",{className:"font-semibold text-ink",children:b}),n.jsxs("span",{className:"text-warm-gray ml-1",children:["· ",v,"%"]})]})]},g.key)})}),n.jsx("div",{className:"flex items-center gap-4 mt-4 pt-3 border-t border-[#f0ece2] text-[11px] text-warm-gray flex-wrap",children:Zc.map(g=>{const b=r.byPlan[g.key]||0;return b?n.jsxs("span",{children:[n.jsx("span",{className:"font-semibold text-ink",children:b})," on ",g.label]},g.key):null})})]}),n.jsxs(Ph,{title:"Signups",subtitle:"Last 14 days",icon:n.jsx($x,{className:"w-3.5 h-3.5"}),children:[n.jsx(SX,{data:r.signupsByDay}),n.jsxs("div",{className:"flex items-baseline gap-2 mt-3",children:[n.jsx("span",{className:"font-serif text-2xl text-ink",children:r.newThisWeek}),n.jsx("span",{className:"text-[11px] text-warm-gray",children:"in last 7 days"})]})]})]}),n.jsxs("div",{className:"grid lg:grid-cols-3 gap-3 mb-5",children:[n.jsxs(Ph,{title:"Workflow review queue",subt
387itle:`${i.awaitingReviewTotal} awaiting review · ${i.recordedLast7d} recorded in last 7d`,icon:n.jsx(N5,{className:"w-3.5 h-3.5"}),headerLink:{href:"/admin/documents",label:"All documents"},children:[i.awaitingReview.length===0?n.jsx(Tx,{icon:n.jsx(N5,{className:"w-4 h-4"}),text:"Nothing waiting for review."}):n.jsx("ul",{className:"divide-y divide-[#f0ece2]",children:i.awaitingReview.map(g=>n.jsxs("li",{className:"py-2 flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-[13px] text-ink truncate",children:g.title}),n.jsxs("p",{className:"text-[11px] text-warm-gray truncate",children:[g.companyName,g.recordedAt?` · recorded ${x1(g.recordedAt)}`:""]})]}),n.jsxs(Ae,{href:`/admin/clients/${g.clientId}`,className:"shrink-0 text-[11px] text-warm-gray hover:text-ink inline-flex items-center",children:["View ",n.jsx(no,{className:"w-3 h-3"})]})]},g.id))}),n.jsx(kX,{byStatus:i.byStatus,total:i.total})]}),n.jsxs(Ph,{title:"Open issues",subtitle:`${a.open} open · ${a.inProgress} in progress${a.oldestOpenAgeDays>0?` · oldest ${a.oldestOpenAgeDays}d`:""}`,icon:n.jsx(oi,{className:"w-3.5 h-3.5"}),headerLink:{href:"/admin/issues",label:"All issues"},children:[a.topOpen.length===0?n.jsx(Tx,{icon:n.jsx(oi,{className:"w-4 h-4"}),text:"No open issues."}):n.jsx("ul",{className:"divide-y divide-[#f0ece2]",children:a.topOpen.map(g=>n.jsxs("li",{className:"py-2 flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[n.jsx(wR,{p:g.priority}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-[13px] text-ink truncate",children:g.subject}),n.jsxs("p",{className:"text-[11px] text-warm-gray truncate",children:[g.companyName," · ",g.ageDays,"d old"]})]})]}),n.jsxs(Ae,{href:`/admin/issues?clientId=${g.clientId}`,className:"shrink-0 text-[11px] text-warm-gray hover:text-ink inline-flex items-center",children:["View ",n.jsx(no,{className:"w-3 h-3"})]})]},g.id))}),n.jsx(NX,{byPriority:a.byPriority})]}),n.jsx(Ph,{title:"Needs attention",subtitle:"Stuck more than 14 days in a non-final stage",icon:n.jsx(w9,{className:"w-3.5 h-3.5"}),headerLink:{href:"/admin/clients",label:"All clients"},children:r.attention.length===0?n.jsx(Tx,{icon:n.jsx(lo,{className:"w-4 h-4"}),text:"Everyone is moving along nicely."}):n.jsx("ul",{className:"divide-y divide-[#f0ece2]",children:r.attention.map(g=>n.jsxs("li",{className:"py-2 flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"text-[13px] text-ink truncate",children:g.companyName}),n.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[n.jsx(dg,{stage:g.stage}),n.jsxs("span",{className:"text-[11px] text-amber-700 font-semibold",children:[g.daysInStage,"d in stage"]})]})]}),n.jsxs(Ae,{href:`/admin/clients/${g.id}`,className:"shrink-0 text-[11px] text-warm-gray hover:text-ink inline-flex items-center",children:["View ",n.jsx(no,{className:"w-3 h-3"})]})]},g.id))})})]}),n.jsxs("div",{className:"grid lg:grid-cols-3 gap-3",children:[n.jsx("div",{className:"lg:col-span-2",children:n.jsx(EX,{})}),n.jsxs("div",{className:"space-y-3",children:[n.jsx(Yf,{icon:n.jsx(qA,{className:"w-4 h-4 text-amber-600"}),label:"Enhancements open",value:String(l.openTotal),hint:`${l.byStatus.in_progress||0} in progress · ${l.byStatus.planned||0} planned`,href:"/admin/enhancements"}),n.jsx(Yf,{icon:n.jsx(Mi,{className:"w-4 h-4 text-olive-dark"}),label:"Workflows captured",value:String(i.total),hint:`${i.byStatus.approved||0} approved · ${i.byStatus.received||0} pending review`,href:"/admin/documents"}),n.jsx(Yf,{icon:n.jsx(Zm,{className:"w-4 h-4 text-olive-dark"}),label:"Emails sent (30d)",value:String(p.emailsSentLast30d),hint:"Bulk + targeted from Mass Messaging",href:"/admin/mass-messaging"}),n.jsx(Yf,{icon:n.jsx(LA,{className:"w-4 h-4 text-olive-dark"}),label:"Waitlist",value:String(m.total),hint:`${m.last7d} new in last 7 days`})]})]})]})}function Kf({label:t,value:e,hint:s,icon:r,tone:i,href:a}){const l=i==="danger"?"border-red-200 bg-red-50/40":i==="warn"?"border-amber-200 bg-amber-50/40":"border-[#e7e3d9] bg-white",d=a?"cursor-pointer hover:shadow-sm hover:border-warm-gray/40 transition-all focus:outline-none focus:ring-2 focus:ring-olive-dark/30":"",u=n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] uppercase tracking-wide text-warm-gray font-semibold",children:[r,t]}),n.jsx("p",{className:"font-serif text-3xl text-ink mt-1",children:e}),s&&n.jsx("p",{className:"text-[11px] text-warm-gray mt-1",children:s})]}),m=`kpi-${t.toLowerCase().replace(/\s+/g,"-")}`;return a?n.jsx(Ae,{href:a,className:`block border rounded-xl p-4 ${l} ${d}`,"data-testid":m,children:u}):n.jsx("div",{className:`border rounded-xl p-4 ${l}`,"data-testid":m,children:u})}function Ph({title:t,subtitle:e,icon:s,children:r,className:i="",headerLink:a}){return n.jsxs("div",{className:`bg-white border border-[#e7e3d9] rounded-xl p-4 ${i}`,children:[n.jsxs("div",{className:"flex items-start justify-between gap-2 mb-3",children:[n.jsxs("div",{children:[n.jsxs("h2",{className:"text-[13px] font-semibold text-ink flex items-center gap-1.5",children:[s,t]}),e&&n.jsx("p",{className:"text-[11px] text-warm-gray mt-0.5",children:e})]}),a&&n.jsxs(Ae,{href:a.href,className:"text-[11px] text-warm-gray hover:text-ink inline-flex items-center shrink-0",children:[a.label," ",n.jsx(no,{className:"w-3 h-3"})]})]}),r]})}function Yf({icon:t,label:e,value:s,hint:r,href:i}){const a=n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-3 hover:border-olive-dark/40 transition-colors",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[t,n.jsx("span",{className:"text-[11px] uppercase tracking-wide text-warm-gray font-semibold",children:e})]}),n.jsx("div",{className:"flex items-baseline justify-between mt-1.5",children:n.jsx("span",{className:"font-serif text-2xl text-ink",children:s})}),r&&n.jsx("p",{className:"text-[11px] text-warm-gray mt-0.5",children:r})]});return i?n.jsx(Ae,{href:i,children:a}):a}function Tx({icon:t,text:e}){return n.jsxs("div",{className:"text-center py-6 text-warm-gray text-[12px] flex flex-col items-center gap-1.5",children:[t,n.jsx("span",{children:e})]})}function wR({p:t}){const e=t==="urgent"?"bg-red-600":t==="high"?"bg-amber-500":t==="low"?"bg-gray-300":"bg-blue-400";return n.jsx("span",{className:`inline-block w-2 h-2 rounded-full shrink-0 ${e}`,title:t})}function NX({byPriority:t}){const e=["urgent","high","normal","low"].filter(s=>(t[s]||0)>0);return e.length===0?null:n.jsx("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-[#f0ece2] text-[11px] text-warm-gray flex-wrap",children:e.map(s=>n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx(wR,{p:s}),n.jsx("span",{className:"font-semibold text-ink",children:t[s]})," ",s]},s))})}function kX({byStatus:t,total:e}){return e===0?null:n.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-[#f0ece2] text-[11px] text-warm-gray flex-wrap",children:[n.jsxs("span",{children:[n.jsx("span",{className:"font-semibold text-ink",children:t.approved||0})," approved"]}),n.jsxs("span",{children:[n.jsx("span",{className:"font-semibold text-ink",children:t.reviewed||0})," reviewed"]}),n.jsxs("span",{children:[n.jsx("span",{className:"font-semibold text-ink",children:t.received||0})," received"]}),n.jsxs("span",{children:[n.jsx("span",{className:"font-semibold text-ink",children:t.requested||0})," requested"]})]})}function SX({data:t}){const e=Math.max(1,...t.map(s=>s.count));return n.jsx("div",{className:"flex items-end gap-1 h-20","data-testid":"chart-signups-bars",children:t.map(s=>{const r=s.count/e*100,i=new Date(s.date);return n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-end h-full",title:`${s.date}: ${s.count}`,children:[n.jsx("div",{className:`w-full rounded-sm ${s.count>0?"bg-olive-dark":"bg-[#f0ece2]"}`,style:{height:`${Math.max(r,s.count>0?8:4)}%`}}),i.getDay()===1&&n.jsx("span",{className:"text-[9px] text-warm-gray mt-1 leading-none",children:i.toLocaleDateString(void 0,{month:"numeric",day:"numeric"})})]},s.date)})})}function CX(t){switch(t){case"gray":return"bg-gray-400";case"blue":return"bg-blue-500";case"teal":return"bg-teal-500";case"green":return"bg-emerald-500";case"amber":return"bg-amber-500";case"red":return"bg-red-500";default:return"bg-gray-400"}}const TX={admin:"Team",client:"Client",system:"System"};function EX(){const[t,e]=j.useState(""),[s,r]=j.useState(""),[i,a]=j.useState(!0),l=new URLSearchParams;t&&l.set("source",t),s&&l.set("action",s),i&&l.set("hideSessionRestores","true"),l.set("limit","50");const d=l.toString(),{data:u,isLoading:m}=ds({queryKey:["/api/admin/activity",d],queryFn:async()=>{const v=await fetch(`/api/admin/activity?${d}`,{credentials:"include"});if(!v.ok)throw new Error("failed");return v.json()},refetchInterval:5*6e4,refetchOnWindowFocus:!0,staleTime:3e4}),p=u?.items||[],x=j.useMemo(()=>u?.actions||[],[u]),g=!!t||!!s||!i;function b(){e(""),r(""),a(!0)}return n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-2 mb-3 flex-wrap",children:[n.jsxs("div",{children:[n.jsxs("h2",{className:"text-[13px] font-semibold text-ink flex items-center gap-1.5",children:[n.jsx(hu,{className:"w-3.5 h-3.5"})," Recent activity"]}),n.jsxs("p",{className:"text-[11px] text-warm-gray mt-0.5",children:[p.length," event",p.length===1?"":"s",g?" (filtered)":""]})]}),g&&n.jsxs("button",{onClick:b,className:"text-[11px] text-warm-gray hover:text-ink inline-flex items-center gap-1","data-testid":"button-clear-activity-filters",children:[n.jsx(ro,{className:"w-3 h-3"})," Clear filters"]})]}),n.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[n.jsx(g9,{className:"w-3.5 h-3.5 text-warm-gray"}),n.jsxs("select",{value:t,onChange:v=>e(v.target.value),className:"text-[12px] border border-[#e7e3d9] rounded-md px-2 py-1 bg-white text-ink focus:outline-none focus:border-olive-dark","data-testid":"select-activity-source",children:[n.jsx("option",{value:"",children:"All sources"}),n.jsx("option",{value:"client",children:"Client portal"}),n.jsx("option",{value:"admin",children:"Team / admin"}),n.jsx("option",{value:"system",children:"System"})]}),n.jsxs("select",{value:s,onChange:v=>r(v.target.value),className:"text-[12px] border border-[#e7e3d9] rounded-md px-2 py-1 bg-white text-ink focus:outline-none focus:border-olive-dark","data-testid":"select-activity-action",children:[n.jsx("option",{value:"",children:"All event types"}
387),x.map(v=>n.jsx("option",{value:v,children:DT(v)},v))]}),n.jsxs("label",{className:"text-[11px] text-warm-gray inline-flex items-center gap-1.5 cursor-pointer ml-auto",children:[n.jsx("input",{type:"checkbox",checked:i,onChange:v=>a(v.target.checked),className:"accent-olive-dark","data-testid":"checkbox-hide-session-restores"}),"Hide noisy events"]})]}),m?n.jsx("p",{className:"text-warm-gray text-[12px] py-6 text-center",children:"Loading…"}):p.length===0?n.jsx(Tx,{icon:n.jsx(hu,{className:"w-4 h-4"}),text:"No activity matches these filters."}):n.jsx("ul",{className:"divide-y divide-[#f0ece2] max-h-[480px] overflow-y-auto",children:p.map(v=>n.jsxs("li",{className:"py-2 flex items-start justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("p",{className:"text-[13px] text-ink",children:[DT(v.action),v.companyName&&n.jsxs("span",{className:"text-warm-gray font-normal",children:[" · ",v.companyName]})]}),n.jsxs("p",{className:"text-[11px] text-warm-gray",children:[v.source?`${TX[v.source]||v.source} · `:"",x1(v.createdAt)]})]}),v.clientId&&n.jsxs(Ae,{href:`/admin/clients/${v.clientId}`,className:"shrink-0 text-[11px] text-warm-gray hover:text-ink inline-flex items-center",children:["Open ",n.jsx(no,{className:"w-3 h-3"})]})]},v.id))})]})}function AX(){const t=nb(),[e,s]=j.useState(null),r=Mt({mutationFn:async()=>{const i=await fetch("/api/admin/stripe/sync-payments",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),a=await i.json();if(!i.ok)throw new Error(a?.error||"Sync failed");return a},onSuccess:i=>{s(`Synced ${i.mirrored} of ${i.processed} paid invoices.`),t.invalidateQueries({queryKey:["/api/admin/dashboard"]}),setTimeout(()=>s(null),6e3)},onError:i=>{s(i?.message||"Sync failed."),setTimeout(()=>s(null),6e3)}});return n.jsxs("div",{className:"flex items-center gap-2",children:[e&&n.jsx("span",{className:"text-[11px] text-warm-gray",children:e}),n.jsxs("button",{onClick:()=>r.mutate(),disabled:r.isPending,className:"text-[12px] px-3 py-1.5 rounded-md border border-[#e7e3d9] text-ink hover:bg-[#f7f5f0] inline-flex items-center gap-1.5 disabled:opacity-60",title:"Pull all paid invoices from Stripe into the admin dashboard.","data-testid":"button-sync-stripe-payments",children:[n.jsx(hb,{className:`w-3.5 h-3.5 ${r.isPending?"animate-spin":""}`}),r.isPending?"Syncing…":"Sync Stripe payments"]})]})}const PT={free:"bg-gray-100 text-gray-700 border-gray-200",pro:"bg-sky-50 text-sky-700 border-sky-200",team:"bg-emerald-50 text-emerald-800 border-emerald-200",business:"bg-violet-50 text-violet-700 border-violet-200",enterprise:"bg-amber-50 text-amber-800 border-amber-200"};function nm({plan:t}){const e=Zc.find(i=>i.key===t)||{key:t,label:t||"—",price:null},s=PT[e.key]||PT.free,r=e.price===0?"$0":e.price==null?"Custom":`$${e.price}/mo`;return n.jsxs("span",{className:`inline-flex items-center gap-1.5 text-[11px] font-semibold px-2 py-0.5 rounded-full border ${s}`,"data-testid":`plan-badge-${e.key}`,children:[n.jsx("span",{children:e.label}),n.jsx("span",{className:"text-[10px] font-normal opacity-70",children:r})]})}const MX=14;function Qf(t){return t.stage==="active"||t.stage==="churned"?!1:t.daysInStage>MX}function _X(){const[,t]=Al(),e=nj(),s=j.useMemo(()=>new URLSearchParams(e),[e]),[r,i]=j.useState(""),[a,l]=j.useState(s.get("stage")||""),[d,u]=j.useState(s.get("plan")||""),[m,p]=j.useState(s.get("attention")==="1"),[x,g]=j.useState(s.get("attention")==="1"?"health":"companyName"),[b,v]=j.useState(s.get("attention")==="1"?"desc":"asc"),[k,N]=j.useState(!1);j.useEffect(()=>{const I=new URLSearchParams(e);l(I.get("stage")||""),u(I.get("plan")||"");const z=I.get("attention")==="1";p(z),k||(g(z?"health":"companyName"),v(z?"desc":"asc"))},[e,k]);const S=j.useMemo(()=>{const I=new URLSearchParams;return r&&I.set("search",r),a&&I.set("stage",a),I.toString()},[r,a]),{data:A,isLoading:E}=ds({queryKey:["/api/admin/clients",S],queryFn:async()=>{const I=await fetch(`/api/admin/clients${S?"?"+S:""}`,{credentials:"include"});if(!I.ok)throw new Error("failed");return I.json()}}),_=A?.clients||[],T=j.useMemo(()=>{let I=_;return d&&(I=I.filter(z=>z.plan===d)),m&&(I=I.filter(Qf)),I},[_,d,m]),$=j.useMemo(()=>{const I=[...T];return I.sort((z,ae)=>{let U="",Y="";return x==="companyName"?(U=z.companyName.toLowerCase(),Y=ae.companyName.toLowerCase()):x==="stage"?(U=z.stage,Y=ae.stage):x==="plan"?(U=z.plan,Y=ae.plan):x==="daysInStage"?(U=z.daysInStage,Y=ae.daysInStage):x==="health"&&(U=Qf(z)?1:0,Y=Qf(ae)?1:0),U<Y?b==="asc"?-1:1:U>Y?b==="asc"?1:-1:0}),I},[T,x,b]);function L(I){N(!0),I===x?v(b==="asc"?"desc":"asc"):(g(I),v(I==="daysInStage"||I==="health"?"desc":"asc"))}function M({k:I,label:z,align:ae}){const U=x===I;return n.jsx("th",{className:`${ae==="right"?"text-right":"text-left"} font-semibold px-4 py-2.5`,children:n.jsxs("button",{type:"button",onClick:()=>L(I),className:`inline-flex items-center gap-1 hover:text-ink ${U?"text-ink":""}`,"data-testid":`sort-${I}`,children:[z,U&&(b==="asc"?n.jsx(xj,{className:"w-3 h-3"}):n.jsx(DA,{className:"w-3 h-3"}))]})})}return n.jsxs("div",{className:"px-6 py-6","data-testid":"page-admin-clients",children:[n.jsx("div",{className:"flex items-end justify-between mb-5",children:n.jsxs("div",{children:[n.jsx("h1",{className:"font-serif text-3xl text-ink tracking-tight",children:"Clients"}),n.jsxs("p",{className:"text-[12px] text-warm-gray mt-1",children:[$.length," clients",m&&n.jsxs(n.Fragment,{children:[" · ",n.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-800",children:[n.jsx(oi,{className:"w-3 h-3"})," needs attention only"]}),n.jsx("button",{type:"button",onClick:()=>{p(!1),t("/admin/clients")},className:"ml-2 text-warm-gray underline hover:text-ink","data-testid":"button-clear-attention",children:"Clear"})]})]})]})}),n.jsxs("div",{className:"flex gap-3 mb-4",children:[n.jsx("input",{type:"search",value:r,onChange:I=>i(I.target.value),placeholder:"Search by company name…",className:"flex-1 max-w-xs bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":"input-clients-search"}),n.jsxs("select",{value:a,onChange:I=>l(I.target.value),className:"bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":"select-clients-stage",children:[n.jsx("option",{value:"",children:"All stages"}),Rc.map(I=>n.jsx("option",{value:I.key,children:I.label},I.key))]}),n.jsxs("select",{value:d,onChange:I=>u(I.target.value),className:"bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":"select-clients-plan",children:[n.jsx("option",{value:"",children:"All plans"}),Zc.map(I=>n.jsx("option",{value:I.key,children:I.label},I.key))]})]}),n.jsx("div",{className:"bg-white border border-[#e7e3d9] rounded-xl overflow-hidden",children:n.jsxs("table",{className:"w-full text-[13px]",children:[n.jsx("thead",{className:"bg-[#fafaf6] border-b border-[#e7e3d9] text-[11px] uppercase tracking-wide text-warm-gray",children:n.jsxs("tr",{children:[n.jsx(M,{k:"companyName",label:"Company"}),n.jsx(M,{k:"stage",label:"Stage"}),n.jsx(M,{k:"plan",label:"Plan"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5",children:"Primary Contact"}),n.jsx(M,{k:"daysInStage",label:"Days in Stage",align:"right"}),n.jsx(M,{k:"health",label:"Health"})]})}),n.jsxs("tbody",{children:[E&&n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-warm-gray text-[12px]",children:"Loading…"})}),!E&&$.length===0&&n.jsx("tr",{children:n.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-warm-gray text-[12px]",children:"No clients match your filters."})}),$.map(I=>{const z=Qf(I);return n.jsxs("tr",{onClick:()=>t(`/admin/clients/${I.id}`),className:"border-b border-[#f0ece2] last:border-0 hover:bg-[#fafaf6] cursor-pointer","data-testid":`row-client-${I.id}`,children:[n.jsx("td",{className:"px-4 py-3",children:n.jsx("span",{className:"font-semibold text-ink","data-testid":`link-client-${I.id}`,children:I.companyName})}),n.jsx("td",{className:"px-4 py-3",children:n.jsx(dg,{stage:I.stage})}),n.jsx("td",{className:"px-4 py-3",children:n.jsx(nm,{plan:I.plan})}),n.jsx("td",{className:"px-4 py-3",children:I.primaryContact?n.jsxs("div",{children:[n.jsx("div",{className:"text-ink",children:I.primaryContact.name}),I.primaryContact.email&&n.jsx("div",{className:"text-[11px] text-warm-gray",children:I.primaryContact.email})]}):n.jsx("span",{className:"text-warm-gray text-[12px]",children:"—"})}),n.jsx("td",{className:`px-4 py-3 text-right tabular-nums ${z?"text-amber-700 font-semibold":"text-warm-gray"}`,children:I.daysInStage}),n.jsx("td",{className:"px-4 py-3",children:z?n.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-semibold px-2 py-0.5 rounded-full bg-amber-50 text-amber-800 border border-amber-200",children:[n.jsx(oi,{className:"w-3 h-3"})," Needs attention"]}):n.jsx("span",{className:"inline-flex items-center gap-1 text-[11px] font-semibold px-2 py-0.5 rounded-full bg-emerald-50 text-emerald-700 border border-emerald-200",children:"Healthy"})})]},I.id)})]})]})})]})}const OX=["Overview","Scripts","Contacts","Billing","Activity"];function il(t){return t?new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):"—"}
387function CN(t){return t?new Date(t).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function RX(){const[,t]=yL("/admin/clients/:id"),[,e]=Al(),s=t?.id||"",[r,i]=j.useState("Overview"),[a,l]=j.useState(!1),{data:d,isLoading:u}=ds({queryKey:["/api/admin/clients",s],queryFn:async()=>{const T=await fetch(`/api/admin/clients/${s}`,{credentials:"include"});if(!T.ok)throw new Error("failed");return T.json()},enabled:!!s}),m=Mt({mutationFn:async T=>{const $=await fetch(`/api/admin/clients/${s}`,{method:"PATCH",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(T)});if(!$.ok)throw new Error((await $.json()).error||"Update failed");return $.json()},onSuccess:()=>{Wt.invalidateQueries({queryKey:["/api/admin/clients",s]}),Wt.invalidateQueries({queryKey:["/api/admin/clients"]})}});if(u)return n.jsx("div",{className:"px-6 py-10 text-center text-warm-gray text-[12px]",children:"Loading…"});if(!d)return n.jsxs("div",{className:"px-6 py-10 text-center",children:[n.jsx("p",{className:"text-warm-gray text-[13px]",children:"Client not found."}),n.jsx(Ae,{href:"/admin/clients",className:"text-olive-dark text-[13px] underline mt-2 inline-block",children:"← Back to Clients"})]});const{client:p,contacts:x,sops:g,activity:b,provisioning:v,billingInfo:k,invoices:N,counts:S,daysInStage:A,health:E}=d,_=x.find(T=>T.isPrimary===1)||x[0];return n.jsxs("div",{className:"px-4 py-4 w-full","data-testid":"page-admin-client-detail",children:[n.jsxs(Ae,{href:"/admin/clients",className:"inline-flex items-center gap-1 text-[12px] text-warm-gray hover:text-ink mb-3","data-testid":"link-back-clients",children:[n.jsx(D8,{className:"w-3.5 h-3.5"})," Clients"]}),n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-6 mb-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-6 flex-wrap",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-3 mb-1.5 flex-wrap",children:[n.jsx("h1",{className:"font-serif text-2xl text-ink tracking-tight","data-testid":"text-client-name",children:p.companyName}),n.jsx(dg,{stage:p.stage}),n.jsx(nm,{plan:p.plan}),n.jsx(jR,{health:E})]}),n.jsxs("div",{className:"flex items-center gap-3 text-[12px] text-warm-gray flex-wrap",children:[n.jsx("span",{children:p.industry}),p.source&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"·"}),n.jsxs("span",{children:["via ",p.source]})]}),n.jsx("span",{children:"·"}),n.jsxs("span",{children:["signed up ",il(p.createdAt)]}),n.jsx("span",{children:"·"}),n.jsxs("span",{className:A>14&&p.stage!=="active"&&p.stage!=="churned"?"text-amber-700 font-semibold":"",children:[A,"d in stage"]}),_&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"·"}),n.jsxs("span",{children:["Primary: ",_.name,_.email?` (${_.email})`:""]})]})]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("select",{value:p.plan,onChange:T=>m.mutate({plan:T.target.value}),disabled:m.isPending,className:"bg-white border border-[#e7e3d9] rounded-full px-3 py-1.5 text-[12px] outline-none focus:ring-2 focus:ring-olive-dark/20","data-testid":"select-client-plan",children:Zc.map(T=>n.jsxs("option",{value:T.key,children:[T.label,T.price===0?" — $0":T.price==null?" — Custom":` — $${T.price}/mo`]},T.key))}),n.jsx("select",{value:p.stage,onChange:T=>m.mutate({stage:T.target.value}),disabled:m.isPending,className:"bg-white border border-[#e7e3d9] rounded-full px-3 py-1.5 text-[12px] outline-none focus:ring-2 focus:ring-olive-dark/20","data-testid":"select-client-stage",children:Rc.map(T=>n.jsx("option",{value:T.key,children:T.label},T.key))})]})]}),n.jsxs("div",{className:"flex items-center gap-2 mt-4 pt-4 border-t border-[#f0ece2] flex-wrap",children:[n.jsxs(Ae,{href:`/admin/documents?clientId=${s}`,className:"inline-flex items-center gap-1.5 text-[12px] px-2.5 py-1 rounded-md bg-[#f7f5f0] border border-[#e7e3d9] text-ink hover:border-olive-dark/40","data-testid":"link-client-documents",children:[n.jsx(Mi,{className:"w-3.5 h-3.5"})," Documents ",n.jsxs("span",{className:"text-warm-gray",children:["(",S.files+S.sops,")"]})]}),n.jsxs(Ae,{href:`/admin/issues?clientId=${s}`,className:"inline-flex items-center gap-1.5 text-[12px] px-2.5 py-1 rounded-md bg-[#f7f5f0] border border-[#e7e3d9] text-ink hover:border-olive-dark/40","data-testid":"link-cl
387ient-issues",children:[n.jsx(Aw,{className:"w-3.5 h-3.5"})," Issues ",n.jsxs("span",{className:S.openIssues>0?"text-red-700 font-semibold":"text-warm-gray",children:["(",S.openIssues,")"]})]})]})]}),n.jsx("div",{className:"flex gap-1 border-b border-[#e7e3d9] mb-4",children:OX.map(T=>{const $=T==="Scripts"?g.length:T==="Contacts"?x.length:T==="Activity"?b.length:0;return n.jsxs("button",{onClick:()=>i(T),className:`px-3 py-2 text-[13px] font-medium border-b-2 -mb-px ${r===T?"border-olive-dark text-ink":"border-transparent text-warm-gray hover:text-ink"}`,"data-testid":`tab-${T.toLowerCase().replace(/\s+/g,"-")}`,children:[T,$>0&&n.jsx("span",{className:"ml-1.5 text-[11px] text-warm-gray/70",children:$})]},T)})}),r==="Overview"&&n.jsx(PX,{client:p,provisioning:v,health:E,activity:b.slice(0,6),onSave:T=>m.mutate(T),saving:m.isPending},p.id),r==="Scripts"&&n.jsx(IX,{sops:g}),r==="Contacts"&&n.jsx(LX,{clientId:s,contacts:x}),r==="Billing"&&n.jsx(BX,{clientId:s,client:p,billingInfo:k,invoices:N,onPatchClient:T=>m.mutate(T)}),r==="Activity"&&n.jsx($X,{clientId:s,entries:b}),n.jsx("div",{className:"mt-8 bg-white border border-red-200 rounded-xl p-5","data-testid":"card-danger-zone",children:n.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-[13px] font-semibold text-red-700 uppercase tracking-wide mb-1",children:"Danger Zone"}),n.jsx("p",{className:"text-[12px] text-warm-gray max-w-xl",children:"Permanently delete this client and all associated data — contacts, scripts, documents, files, tickets, invoices, billing info, and activity history. This cannot be undone."})]}),n.jsxs("button",{type:"button",onClick:()=>l(!0),className:"inline-flex items-center gap-1.5 text-[12px] font-semibold px-3 py-1.5 rounded-md border border-red-300 text-red-700 bg-white hover:bg-red-50","data-testid":"button-delete-client",children:[n.jsx(ep,{className:"w-3.5 h-3.5"})," Delete client"]})]})}),a&&n.jsx(DX,{clientId:s,companyName:p.companyName,onClose:()=>l(!1),onDeleted:()=>{Wt.invalidateQueries({queryKey:["/api/admin/clients"]}),e("/admin/clients")}})]})}function DX({clientId:t,companyName:e,onClose:s,onDeleted:r}){const[i,a]=j.useState(1),[l,d]=j.useState(""),[u,m]=j.useState(null),p=Mt({mutationFn:async()=>{const g=await fetch(`/api/admin/clients/${t}`,{method:"DELETE",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({confirmName:l})});if(!g.ok){const b=await g.json().catch(()=>({}));throw new Error(b.error||"Failed to delete client")}return g.json()},onSuccess:()=>r(),onError:g=>m(g.message||"Failed to delete client")}),x=l.trim().toLowerCase()===e.trim().toLowerCase();return n.jsx("div",{className:"fixed inset-0 z-50 bg-black/40 flex items-center justify-center p-4","data-testid":"modal-delete-client",children:n.jsxs("div",{className:"bg-white rounded-xl shadow-xl max-w-md w-full p-5",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx(oi,{className:"w-5 h-5 text-red-600"}),n.jsx("h3",{className:"font-serif text-lg text-ink",children:"Delete client"})]}),i===1&&n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"text-[13px] text-ink mb-2",children:["You are about to permanently delete ",n.jsx("span",{className:"font-semibold",children:e}),"."]}),n.jsx("p",{className:"text-[12px] text-warm-gray mb-4",children:"This will remove every contact, script, document, file, support ticket, invoice, billing record, and activity log tied to this client. This action cannot be undone."}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:s,className:"px-3 py-1.5 text-[12px] rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0]","data-testid":"button-cancel-delete-1",children:"Cancel"}),n.jsx("button",{type:"button",onClick:()=>a(2),className:"px-3 py-1.5 text-[12px] font-semibold rounded-md bg-red-600 text-white hover:bg-red-700","data-testid":"button-continue-delete",children:"Continue"})]})]}),i===2&&n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"text-[13px] text-ink mb-2",children:["Type the company name ",n.jsx("span",{className:"font-semibold",children:e})," below to confirm."]}
387),n.jsx("input",{type:"text",value:l,onChange:g=>{d(g.target.value),m(null)},placeholder:e,autoFocus:!0,className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-red-500/20 focus:border-red-500 mb-3","data-testid":"input-confirm-client-name"}),u&&n.jsx("p",{className:"text-[12px] text-red-700 mb-3","data-testid":"text-delete-error",children:u}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:s,disabled:p.isPending,className:"px-3 py-1.5 text-[12px] rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] disabled:opacity-50","data-testid":"button-cancel-delete-2",children:"Cancel"}),n.jsx("button",{type:"button",onClick:()=>p.mutate(),disabled:!x||p.isPending,className:"px-3 py-1.5 text-[12px] font-semibold rounded-md bg-red-600 text-white hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"button-confirm-delete",children:p.isPending?"Deleting…":"Delete client"})]})]})]})})}function jR({health:t}){if(t.level==="healthy")return n.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-semibold px-2 py-0.5 rounded-full bg-emerald-50 text-emerald-700 border border-emerald-200","data-testid":"pill-health",children:[n.jsx(vs,{className:"w-3 h-3"})," Healthy"]});const e=t.level==="at_risk"?"bg-red-50 text-red-700 border-red-200":"bg-amber-50 text-amber-800 border-amber-200";return n.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] font-semibold px-2 py-0.5 rounded-full border ${e}`,"data-testid":"pill-health",children:[n.jsx(oi,{className:"w-3 h-3"})," ",t.level==="at_risk"?"At risk":"Needs attention"]})}function Mv({title:t,children:e,action:s}){return n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsx("h3",{className:"text-[13px] font-semibold text-ink uppercase tracking-wide",children:t}),s]}),e]})}function PX({client:t,provisioning:e,health:s,activity:r,onSave:i,saving:a}){return n.jsxs("div",{className:"grid lg:grid-cols-3 gap-4",children:[n.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[n.jsx(Mv,{title:"Client Details",children:n.jsxs("div",{className:"grid sm:grid-cols-2 gap-x-6 gap-y-4",children:[n.jsx(Yo,{label:"Company name",field:"companyName",value:t.companyName,onSave:i,saving:a}),n.jsx(Yo,{label:"Industry",field:"industry",value:t.industry,onSave:i,saving:a}),n.jsx(Yo,{label:"Website",field:"website",value:t.website||"",onSave:i,saving:a}),n.jsx(Yo,{label:"Customer URL",field:"customerUrl",value:t.customerUrl||"",onSave:i,saving:a}),n.jsx(Yo,{label:"Platform",field:"platform",value:t.platform||"",onSave:i,saving:a}),n.jsx(Yo,{label:"Source",field:"source",value:t.source||"",onSave:i,saving:a}),n.jsx(Yo,{label:"Churned reason",field:"churnedReason",value:t.churnedReason||"",onSave:i,saving:a}),n.jsx("div",{className:"sm:col-span-2",children:n.jsx(Yo,{label:"Notes",field:"notes",value:t.notes||"",onSave:i,saving:a,textarea:!0})})]})}),n.jsx(Mv,{title:"Recent Activity",children:r.length===0?n.jsx("p",{className:"text-[12px] text-warm-gray",children:"No activity yet."}):n.jsx("ul",{className:"space-y-2",children:r.map(l=>n.jsxs("li",{className:"text-[12px] text-warm-gray flex items-center justify-between gap-3",children:[n.jsxs("span",{children:[n.jsx("span",{className:"text-ink font-medium",children:l.action.replace(/_/g," ")}),l.details?.text?` — ${l.details.text}`:""]}),n.jsx("span",{className:"text-[11px] tabular-nums",children:CN(l.createdAt)})]},l.id))})})]}),n.jsx("div",{className:"space-y-4",children:n.jsx(Mv,{title:"Health",children:n.jsxs("div",{className:"space-y-2 text-[13px]",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-warm-gray",children:"Status"}),n.jsx(jR,{health:s})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-warm-gray",children:"Days in stage"}),n.jsx("span",{className:"text-ink tabular-nums",children:s.signals.daysInStage})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-warm-gray",children:"Open issues"}),n.jsx("span",{className:"text-ink tabular-nums",children:s.signals.openIssues})]})]})})})]})}function IX({sops:t}){return t.length===0?n.jsx(TN,{title:"No scripts yet",description:"Scripts the client records via the portal or extension will appear here."}):n.jsx("div",{className:"bg-white border border-[#e7e3d9] rounded-xl overflow-hidden",children:n.jsxs("table",{className:"w-full text-[13px]",children:[n.jsx("thead",{className:"bg-[#fafaf6] text-[11px] uppercase text-warm-gray",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left font-semibold px-4 py-2.5",children:"Title"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5 w-[120px]",children:"Status"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5 w-[120px]",children:"Method"}),n.jsx("th",{className:"text-right font-semibold px-4 py-2.5 w-[80px]",children:"Steps"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5 w-[140px]",children:"Captured"}),n.jsx("th",{className:"text-right font-semibold px-4 py-2.5 w-[280px]",children:"Artifacts"})]})}),n.jsx("tbody",{children:t.map(e=>n.jsxs("tr",{className:"border-t border-[#f0ece2]","data-testid":`row-sop-${e.id}`,children:[n.jsx("td",{className:"px-4 py-2.5 text-ink",children:e.title||"Untitled workflow"}),n.jsx("td",{className:"px-4 py-2.5",children:n.jsx("span",{className:"inline-block text-[11px] font-semibold px-2 py-0.5 rounded-full bg-[#f0ece2] text-ink",children:e.status})}),n.jsx("td",{className:"px-4 py-2.5 text-warm-gray",children:e.captureMethod||"—"}),n.jsx("td",{className:"px-4 py-2.5 text-right tabular-nums text-warm-gray",children:e.stepCount}),n.jsx("td",{className:"px-4 py-2.5 text-warm-gray",children:il(e.recordedAt||e.createdAt)}),n.jsx("td",{className:"px-4 py-2.5",children:n.jsxs("div",{className:"flex items-center justify-end gap-1.5 flex-wrap",children:[n.jsxs("a",{href:`/api/admin/sop/${e.id}/export/pdf`,className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`link-sop-pdf-${e.id}`,children:[n.jsx(Mi,{className:"w-3 h-3"})," PDF"]}),n.jsxs("a",{href:`/api/admin/sop/${e.id}/export/markdown`,className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`link-sop-md-${e.id}`,children:[n.jsx(Mi,{className:"w-3 h-3"})," MD"]}),e.hasScript&&n.jsxs("a",{href:`/api/admin/sop/${e.id}/script?download=1`,className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`link-sop-script-${e.id}`,children:[n.jsx(zA,{className:"w-3 h-3"})," Script"]}),e.hasAudio&&n.jsxs("a",{href:`/api/admin/sop/${e.id}/audio`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`link-sop-audio-${e.id}`,children:[n.jsx(BA,{className:"w-3 h-3"})," Audio"]})]})})]},e.id))})]})})}function LX({clientId:t,contacts:e}){const[s,r]=j.useState(!1),[i,a]=j.useState({name:"",email:"",title:"",phone:"",isPrimary:!1}),[l,d]=j.useState({}),[u,m]=j.useState({}),[p,x]=j.useState({}),g=async M=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(M),!0}catch{}try{const I=document.createElement("textarea");I.value=M,I.style.position="fixed",I.style.top="0",I.style.left="0",I.style.opacity="0",document.body.appendChild(I),I.focus(),I.select();const z=document.execCommand("copy");return document.body.removeChild(I),z}catch{return!1}},[b,v]=j.useState(null),[k,N]=j.useState({name:"",email:"",title:"",phone:""}),S=M=>{v(M.id),N({name:M.name||"",email:M.email||"",title:M.title||"",phone:M.p
387hone||""})},A=Mt({mutationFn:async M=>{const I=await fetch(`/api/admin/contacts/${M}`,{method:"PATCH",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(k)});if(!I.ok)throw new Error((await I.json()).error||"Failed");return I.json()},onSuccess:()=>{v(null),Wt.invalidateQueries({queryKey:["/api/admin/clients",t]})}}),E=Mt({mutationFn:async()=>{const M=await fetch(`/api/admin/clients/${t}/contacts`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(i)});if(!M.ok)throw new Error((await M.json()).error||"Failed");return M.json()},onSuccess:()=>{r(!1),a({name:"",email:"",title:"",phone:"",isPrimary:!1}),Wt.invalidateQueries({queryKey:["/api/admin/clients",t]})}}),_=Mt({mutationFn:async M=>{const I=await fetch(`/api/admin/contacts/${M}`,{method:"PATCH",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({isPrimary:!0})});if(!I.ok)throw new Error("failed");return I.json()},onSuccess:()=>Wt.invalidateQueries({queryKey:["/api/admin/clients",t]})}),T=Mt({mutationFn:async M=>{const I=await fetch(`/api/admin/contacts/${M}`,{method:"DELETE",credentials:"include"});if(!I.ok)throw new Error("failed");return I.json()},onSuccess:()=>Wt.invalidateQueries({queryKey:["/api/admin/clients",t]})}),$=Mt({mutationFn:async M=>{const I=await fetch(`/api/admin/contacts/${M}/magic-link`,{method:"POST",credentials:"include"});if(!I.ok)throw new Error((await I.json()).error||"Failed");return I.json()},onSuccess:(M,I)=>{d(z=>({...z,[I]:M.emailed?"Sent ✓":"Generated (email not sent)"})),setTimeout(()=>d(z=>{const ae={...z};return delete ae[I],ae}),4e3)}}),L=Mt({mutationFn:async M=>{const I=await fetch(`/api/admin/contacts/${M}/magic-link`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({sendEmail:!1})});if(!I.ok)throw new Error((await I.json()).error||"Failed");return I.json()},onSuccess:async(M,I)=>{x(ae=>({...ae,[I]:M.magicLink}));const z=await g(M.magicLink);m(ae=>({...ae,[I]:z?"Copied ✓":"Copy manually below"})),setTimeout(()=>m(ae=>{const U={...ae};return delete U[I],U}),5e3)}});return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("p",{className:"text-[12px] text-warm-gray",children:[e.length," contact",e.length===1?"":"s"]}),!s&&n.jsxs("button",{onClick:()=>r(!0),className:"inline-flex items-center gap-1.5 text-[12px] px-2.5 py-1 rounded-md border border-[#e7e3d9] text-ink hover:bg-[#f7f5f0]","data-testid":"button-add-contact",children:[n.jsx(bm,{className:"w-3.5 h-3.5"})," Add contact"]})]}),s&&n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-4 grid sm:grid-cols-2 gap-3",children:[n.jsx("input",{placeholder:"Name",value:i.name,onChange:M=>a({...i,name:M.target.value}),className:"border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark","data-testid":"input-new-contact-name"}),n.jsx("input",{placeholder:"Email",value:i.email,onChange:M=>a({...i,email:M.target.value}),className:"border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark","data-testid":"input-new-contact-email"}),n.jsx("input",{placeholder:"Title",value:i.title,onChange:M=>a({...i,title:M.target.value}),className:"border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark","data-testid":"input-new-contact-title"}),n.jsx("input",{placeholder:"Phone",value:i.phone,onChange:M=>a({...i,phone:M.target.value}),className:"border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark","data-testid":"input-new-contact-phone"}),n.jsxs("label",{className:"flex items-center gap-2 text-[12px] text-warm-gray sm:col-span-2",children:[n.jsx("input",{type:"checkbox",checked:i.isPrimary,onChange:M=>a({...i,isPrimary:M.target.checked})}),"Set as primary contact"]}),n.jsxs("div",{className:"sm:col-span-2 flex gap-2 justify-end",children:[n.jsx("button",{onClick:()=>r(!1),className:"text-[12px] px-3 py-1.5 rounded-md text-warm-gray hover:text-ink",children:"Cancel"}),n.jsx("button",{onClick:()=>E.mutate(),disabled:!i.name||E.isPending,className:"text-[12px] px-3 py-1.5 rounded-md bg-olive-dark text-white disabled:opacity-50","data-testid":"button-save-contact",children:E.isPending?"Saving…":"Add contact"})]}),E.error&&n.jsx("p",{className:"text-[12px] text-red-700 sm:col-span-2",children:E.error.message})]}),e.length===0?n.jsx(TN,{title:"No contacts yet",description:"Add the first contact at this client to enable portal magic-link login."}):n.jsx("div",{className:"bg-white border border-[#e7e3d9] rounded-xl overflow-hidden",children:n.jsxs("table",{className:"w-full text-[13px]",children:[n.jsx("thead",{className:"bg-[#fafaf6] text-[11px] uppercase text-warm-gray",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left font-semibold px-4 py-2.5",children:"Name"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5",children:"Title"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5",children:"Email / Phone"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5 w-[120px]",children:"Verified"}),n.jsx("th",{className:"text-right font-semibold px-4 py-2.5 w-[340px]",children:"Actions"})]})}),n.jsx("tbody",{children:e.map(M=>b===M.id?n.jsxs("tr",{className:"border-t border-[#f0ece2] bg-[#fafaf6]","data-testid":`row-contact-${M.id}`,children:[n.jsx("td",{className:"px-4 py-2.5",children:n.jsx("input",{value:k.name,onChange:z=>N({...k,name:z.target.value}),className:"w-full border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white outline-none focus:border-olive-dark","data-testid":`input-edit-name-${M.id}`})}),n.jsx("td",{className:"px-4 py-2.5",children:n.jsx("input",{value:k.title,onChange:z=>N({...k,title:z.target.value}),placeholder:"Title",className:"w-full border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white outline-none focus:border-olive-dark","data-testid":`input-edit-title-${M.id}`})}),n.jsxs("td",{className:"px-4 py-2.5",colSpan:2,children:[n.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[n.jsx("input",{value:k.email,onChange:z=>N({...k,email:z.target.value}),placeholder:"Email",className:"w-full border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white outline-none focus:border-olive-dark","data-testid":`input-edit-email-${M.id}`}),n.jsx("input",{value:k.phone,onChange:z=>N({...k,phone:z.target.value}),placeholder:"Phone",className:"w-full border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white outline-none focus:border-olive-dark","data-testid":`input-edit-phone-${M.id}`})]}),A.error&&n.jsx("p",{className:"text-[11px] text-red-700 mt-1",children:A.error.message})]}),n.jsx("td",{className:"px-4 py-2.5",children:n.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[n.jsx("button",{onClick:()=>v(null),className:"text-[11px] px-2 py-1 rounded-md text-warm-gray hover:text-ink","data-testid":`button-cancel-edit-${M.id}`,children:"Cancel"}),n.jsx("button",{onClick:()=>A.mutate(M.id),disabled:!k.name.trim()||A.isPending,className:"text-[11px] px-2 py-1 rounded-md bg-olive-dark text-white disabled:opacity-50","data-testid":`button-save-edit-${M.id}`,children:A.isPending?"Saving…":"Save"})]})})]},M.id):n.jsxs(j.Fragment,{children:[n.jsxs("tr",{className:"border-t border-[#f0ece2]","data-testid":`row-contact-${M.id}`,children:[n.jsx("td",{className:"px-4 py-2.5 font-medium text-ink",children:n.jsxs("div",{className:"flex items-center gap-1.5",children:[M.isPrimary===1&&n.jsx(k5,{className:"w-3.5 h-3.5 fill-amber-400 text-amber-400"}),M.name]})}),n.jsx("td",{className:"px-4 py-2.5 text-warm-gray",children:M.title||"—"}),n.jsxs("td",{className:"px-4 py-2.5",children:[n.jsx("div",{children:M.email||"—"}),M.phone&&n.jsx("div",{className:"text-[11px] text-warm-gray",children:M.phone})]}),n.jsx("td",{className:"px-4 py-2.5",children:M.emailVerified?n.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] font-semibold px-2 py-0.5 rounded-full bg-emerald-50 text-emerald-700 border border-emerald-200",children:[n.jsx(vs,{className:"w-3 h-3"})," Verified"]}):n.jsx("span",{className:"text-[11px] text-warm-gray",children:"Not yet"})}),n.jsx("td",{className:"px-4 py-2.5",children:n.jsxs("div",{className:"flex items-center justify-end gap-1.5 flex-wrap",children:[n.jsxs("button",{onClick:()=>S(M),className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`button-edit-contact-${M.id}`,children:[n.jsx(ub,{className:"w-3 h-3"})," Edit"]}),M.email&&n.jsxs("button",{onClick:()=>$.mutate(M.id),disabled:$.isPending,className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink disabled:opacity-50","data-testid":`button-magic-link-${M.id}`,children:[n.jsx(Lx,{className:"w-3 h-3"})," ",l[M.id]||"Send magic link"]}),M.email&&n.jsxs("button",{onClick:()=>L.mutate(M.id),disabled:L.isPending,className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink disabled:opacity-50","data-testid":`button-copy-link-${M.id}`,title:"Generate a sign-in link (valid 24h) you can send yourself",children:[u[M.id]?n.jsx(db,{className:"w-3 h-3"}):n.jsx(j5,{className:"w-3 h-3"})," ",u[M.id]||"Copy link"]}),M.isPrimary!==1&&n.jsxs("button",{onClick:()=>_.mutate(M.id),className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`button-primary-${M.id}`,children:[n.jsx(k5,{className:"w-3 h-3"})," Make primary"]}),n.jsx("button",{onClick:()=>{confirm(`Delete contact ${M.name}?`)&&T.mutate(M.id)},className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-red-700 hover:bg-red-50","data-testid":`button-delete-contact-${M.id}`,children:n.jsx(ep,{className:"w-3 h-3"})})]})})]}),p[M.id]&&n.jsx("tr",{className:"bg-[#faf9f5]","data-testid":`row-copy-link-${M.id}`,children:n.jsx("td",{colSpan:5,className:"px-4 py-2.5",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px] text-warm-gray whitespace-nowrap",children:"Sign-in link (valid 24h, one-time):"}),n.jsx("input",{readOnly:!0,value:p[M.id],onFocus:z=>z.currentTarget.select(),className:"flex-1 text-[11px] font-mono px-2 py-1 rounded-md border border-[#e7e3d9] bg-white text-ink","data-testid":`input-copy-link-${M.id}`}),n.jsxs("button",{onClick:async()=>{const z=await g(p[M.id]);m(ae=>({...ae,[M.id]:z?"Copied ✓":"Select & copy"})),setTimeout(()=>m(ae=>{const U={...ae};return delete U[M.id],U}),5e3)},className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink whitespace-nowrap","data-testid":`button-copy-link-inline-${M.id}`,children:[n.jsx(j5,{className:"w-3 h-3"})," Copy"]}),n.jsx("button",{onClick:()=>x(z=>{const ae={...z};return delete ae[M.id],ae}),className:"text-[11px] px-2 py-1 rounded-md text-warm-gray hover:text-ink","data-testid":`button-dismiss-link-${M.id}`,children:"Dismiss"})]})})})]},M.id))})]})})]})}function $X({clientId:t,entries:e}){const[s,r]=j.useState(""),i=Mt({mutationFn:async()=>{const a=await fetch(`/api/admin/clients/${t}/notes`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({text:s})});if(!a.ok)throw new Error("failed");return a.json()},onSuccess:()=>{r(""),Wt.invalidateQueries({queryKey:["/api/admin/clients",t]})}});return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-4",children:[n.jsx("textarea",{value:s,onChange:a=>r(a.target.value),placeholder:"Add a note for this client…",rows:2,className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark","data-testid":"input-note"}),n.jsx("div",{className:"flex justify-end mt-2",children:n.jsx("button",{onClick:()=>i.mutate(),disabled:!s.trim()||i.isPending,className:"text-[12px] px-3 py-1.5 rounded-md bg-olive-dark text-white disabled:opacity-50","data-testid":"button-add-note",children:i.isPending?"Saving…":"Add note"})})]}),e.length===0?n.jsx(TN,{title:"No activity yet",description:"Notes, status changes, magic-link sends, and other events will appear here."}):n.jsx("div",{className:"bg-white border border-[#e7e3d9] rounded-xl divide-y divide-[#f0ece2]",children:e.map(a=>n.jsxs("div",{className:"px-5 py-3 flex items-start gap-3","data-testid":`row-activity-${a.id}`,children:[n.jsx(hu,{className:"w-3.5 h-3.5 text-warm-gray mt-0.5 shrink-0"}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("span",{className:"text-[13px] font-medium text-ink",children:a.action.replace(/_/g," ")}),a.source&&n.jsx("span",{className:"text-[10px] uppercase tracking-wide text-warm-gray font-semibold px-1.5 py-0.5 rounded bg-[#f0ece2]",children:a.source})]}),a.details?.text&&n.jsx("p",{className:"text-[12px] text-ink mt-0.5",children:a.details.text}),a.details&&!a.details.text&&n.jsx("p",{className:"text-[11px] text-warm-gray mt-0.5 font-mono truncate",children:Object.entries(a.details).filter(([l])=>l!=="authorName").map(([l,d])=>`${l}: ${typeof d=="object"?JSON.stringify(d):d}`).join(" · ")}),n.jsxs("p",{className:"text-[11px] text-warm-gray mt-0.5",children:[CN(a.createdAt),a.details?.authorName?` · by ${a.details.authorName}`:""]})]})]},a.id))})]})}function TN({title:t,description:e}){return n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-10 text-center",children:[n.jsx("h3",{className:"text-[14px] font-semibold text-ink mb-1",children:t}),n.jsx("p",{className:"text-[12px] text-warm-gray",children:e})]})}function Yo({label:t,field:e,value:s,onSave:r,saving:i,textarea:a}){const[l,d]=j.useState(s);j.useEffect(()=>{d(s)},[s]);const u=l!==s,m=()=>{u&&r({[e]:l})};return n.jsxs("div",{children:[n.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:t}
387),a?n.jsx("textarea",{value:l,onChange:p=>d(p.target.value),onBlur:m,disabled:i,rows:4,className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":`field-${e}`}):n.jsx("input",{value:l,onChange:p=>d(p.target.value),onBlur:m,disabled:i,className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":`field-${e}`})]})}function IT(t){return t.toLocaleString(void 0,{style:"currency",currency:"USD",maximumFractionDigits:0})}function Gd(t){if(!t)return"";const e=new Date(t);return isNaN(e.getTime())?"":e.toISOString().slice(0,10)}function BX({clientId:t,client:e,billingInfo:s,invoices:r,onPatchClient:i}){const a=r.filter(d=>d.status==="sent"||d.status==="overdue").reduce((d,u)=>d+(u.amountCents||0),0),l=r.filter(d=>d.status==="paid"&&d.paidAt&&new Date(d.paidAt).getFullYear()===new Date().getFullYear()).reduce((d,u)=>d+(u.amountCents||0),0);return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[n.jsx(LT,{label:"Outstanding",value:IT(a/100),hint:`${r.filter(d=>d.status==="sent"||d.status==="overdue").length} unpaid`,icon:n.jsx(bj,{className:"w-4 h-4 text-olive-dark"})}),n.jsx(LT,{label:`Paid ${new Date().getFullYear()}`,value:IT(l/100)})]}),n.jsx("div",{className:"grid sm:grid-cols-2 gap-3",children:n.jsx(FX,{client:e,onPatchClient:i})}),n.jsx(UX,{clientId:t,info:s}),n.jsx(zX,{client:e}),n.jsx(VX,{clientId:t}),n.jsx(WX,{clientId:t,invoices:r})]})}function zX({client:t}){const[e,s]=j.useState(!1),[r,i]=j.useState("at_period_end"),[a,l]=j.useState(""),[d,u]=j.useState(""),[m,p]=j.useState(null),x=!!t.stripeSubscriptionId,g=t.plan&&t.plan!=="free",b=Mt({mutationFn:async()=>{const v=await fetch(`/api/admin/clients/${t.id}/reset-subscription`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({mode:r,reason:a,confirmCompanyName:d})}),k=await v.json().catch(()=>({}));if(!v.ok)throw new Error(k.error||"Reset failed");return k},onSuccess:()=>{Wt.invalidateQueries({queryKey:["/api/admin/clients",t.id]}),s(!1),l(""),u(""),p(null)},onError:v=>p(v?.message||"Reset failed")});return n.jsxs("div",{className:"bg-white border border-red-200 rounded-xl p-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[n.jsxs("div",{children:[n.jsxs("h3",{className:"text-[13px] font-semibold text-ink mb-1 flex items-center gap-1.5",children:[n.jsx(oi,{className:"w-3.5 h-3.5 text-red-600"}),"Reset subscription"]}),n.jsxs("div",{className:"text-[12px] text-warm-gray space-y-0.5",children:[n.jsxs("div",{children:["Current plan: ",n.jsx("span",{className:"font-semibold text-ink",children:t.plan?.toUpperCase()||"FREE"}),t.stripeStatus&&n.jsxs(n.Fragment,{children:[" · Stripe: ",n.jsx("span",{className:"text-ink",children:t.stripeStatus})]})]}),n.jsxs("div",{children:["Subscription ID: ",n.jsx("span",{className:"font-mono text-[11px]",children:t.stripeSubscriptionId||"— none on file"})]}),t.stripeCurrentPeriodEnd&&n.jsxs("div",{children:["Current period ends: ",il(t.stripeCurrentPeriodEnd)]})]})]}),n.jsx("button",{type:"button",onClick:()=>{s(!0),p(null)},className:"px-3 py-1.5 text-[12px] font-semibold text-white bg-red-600 hover:bg-red-700 rounded-lg disabled:opacity-50","data-testid":"button-open-reset-subscription",disabled:!x&&!g,title:!x&&!g?"Already on Free with no Stripe subscription":"",children:"Reset to Free…"})]}),n.jsx("p",{className:"text-[11px] text-warm-gray mt-2 leading-relaxed",children:"Cancels the Stripe subscription and downgrades the workspace to Free. Refunds for already-paid invoices must be issued separately in the Stripe dashboard."}),e&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:()=>!b.isPending&&s(!1),children:n.jsxs("div",{className:"bg-white rounded-xl shadow-2xl max-w-lg w-full p-5",onClick:v=>v.stopPropagation(),children:[n.jsxs("h3",{className:"text-base font-serif text-ink mb-1",children:["Reset subscription for ",t.companyName,"?"]}
387),n.jsx("p",{className:"text-[12px] text-warm-gray mb-3",children:"This is a destructive admin action. It will be logged with your name."}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-[11px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:"When to cancel"}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("label",{className:"flex items-start gap-2 text-[12px] cursor-pointer",children:[n.jsx("input",{type:"radio",checked:r==="at_period_end",onChange:()=>i("at_period_end"),"data-testid":"radio-cancel-period-end",className:"mt-0.5"}),n.jsxs("span",{children:[n.jsx("span",{className:"font-semibold text-ink",children:"At period end (recommended)"}),n.jsxs("span",{className:"block text-warm-gray text-[11px]",children:["Customer keeps paid plan until ",t.stripeCurrentPeriodEnd?il(t.stripeCurrentPeriodEnd):"the end of the billing cycle",", then auto-downgrades."]})]})]}),n.jsxs("label",{className:"flex items-start gap-2 text-[12px] cursor-pointer",children:[n.jsx("input",{type:"radio",checked:r==="immediate",onChange:()=>i("immediate"),"data-testid":"radio-cancel-immediate",className:"mt-0.5"}),n.jsxs("span",{children:[n.jsx("span",{className:"font-semibold text-ink",children:"Immediate"}),n.jsx("span",{className:"block text-warm-gray text-[11px]",children:"Cancel in Stripe right now and downgrade to Free instantly. Customer loses paid features even though they may have already paid for the period."})]})]})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-[11px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:"Reason (optional)"}),n.jsx("input",{type:"text",value:a,onChange:v=>l(v.target.value),placeholder:"e.g. Refunded by support, account closed at customer request",className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-2 py-1.5 text-[13px] outline-none focus:border-olive-dark","data-testid":"input-reset-reason",maxLength:500})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-[11px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:["Type ",n.jsx("span",{className:"font-mono text-ink",children:t.companyName})," to confirm"]}),n.jsx("input",{type:"text",value:d,onChange:v=>u(v.target.value),placeholder:t.companyName,className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-2 py-1.5 text-[13px] outline-none focus:border-red-400","data-testid":"input-confirm-company-name",autoFocus:!0})]}),m&&n.jsx("div",{className:"text-[12px] text-red-700 bg-red-50 border border-red-200 rounded px-2 py-1.5",children:m})]}),n.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[n.jsx("button",{type:"button",onClick:()=>s(!1),disabled:b.isPending,className:"px-3 py-1.5 text-[12px] font-semibold text-ink bg-white border border-[#e7e3d9] hover:bg-[#f7f4eb] rounded-lg","data-testid":"button-cancel-reset",children:"Cancel"}),n.jsx("button",{type:"button",onClick:()=>b.mutate(),disabled:b.isPending||d!==t.companyName,className:"px-3 py-1.5 text-[12px] font-semibold text-white bg-red-600 hover:bg-red-700 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"button-confirm-reset",children:b.isPending?"Resetting…":r==="immediate"?"Cancel now & downgrade":"Schedule cancellation"})]})]})})]})}function VX({clientId:t}){const{data:e}=ds({queryKey:["/api/admin/clients",t,"plan-consents"],queryFn:async()=>{const r=await fetch(`/api/admin/clients/${t}/plan-consents`,{credentials:"include"});if(!r.ok)throw new Error("Failed to load");return r.json()}}),s=e?.consents||[];return n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold text-ink mb-3",children:"Plan upgrade consents"}),s.length===0?n.jsx("p",{className:"text-[12px] text-warm-gray",children:"No upgrade clicks recorded yet."}):n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-[12px]","data-testid":"table-plan-consents",children:[n.jsx("thead",{className:"text-warm-gray",children:n.jsxs("tr",{className:"border-b border-[#f0ece2]",children:[n.jsx("th",{className:"text-left py-1.5 pr-3 font-semibold",children:"When"}),n.jsx("th",{className:"text-left py-1.5 pr-3 font-semibold",children:"Who"}),n.jsx("th",{className:"text-left py-1.5 pr-3 font-semibold",children:"From → To"}),n.jsx("th",{className:"text-left py-1.5 pr-3 font-semibold",children:"Reason"}),n.jsx("th",{className:"text-left py-1.5 pr-3 font-semibold",children:"Status"}),n.jsx("th",{className:"text-left py-1.5 pr-3 font-semibold",children:"$/mo"})]})}),n.jsx("tbody",{children:s.map(r=>n.jsxs("tr",{className:"border-b border-[#f7f4eb]","data-testid":`consent-row-${r.id}`,children:[n.jsx("td",{className:"py-1.5 pr-3 text-ink whitespace-nowrap",children:CN(r.consentedAt)}),n.jsx("td",{className:"py-1.5 pr-3 text-ink truncate max-w-[180px]",children:r.contactEmail||"—"}),n.jsxs("td",{className:"py-1.5 pr-3 text-ink",children:[r.fromPlan," → ",n.jsx("span",{className:"font-semibold",children:r.toPlan})]}),n.jsxs("td",{className:"py-1.5 pr-3 text-warm-gray",children:[r.reason||"—",r.limitType&&r.limitValue!=null&&r.usageAtConsent!=null&&n.jsxs("div",{className:"text-[11px] opacity-80",children:[r.limitType,": ",r.usageAtConsent,"/",r.limitValue]})]}),n.jsx("td",{className:"py-1.5 pr-3",children:n.jsx("span",{className:`inline-block px-1.5 py-0.5 rounded text-[10px] font-semibold ${r.status==="completed"?"bg-emerald-100 text-emerald-800":r.status==="pending"?"bg-amber-100 text-amber-800":r.status==="abandoned"?"bg-gray-100 text-gray-800":"bg-red-100 text-red-800"}`,children:r.status})}),n.jsx("td",{className:"py-1.5 pr-3 text-ink",children:r.priceAtConsent!=null?`$${r.priceAtConsent}`:"—"})]},r.id))})]})}),n.jsx("p",{className:"text-[11px] text-warm-gray mt-2",children:"Each row is a recorded click in the in-app upgrade modal — captured before the user reaches Stripe, with IP, plan transition, and the limit that triggered it."})]})}function LT({label:t,value:e,hint:s,icon:r}){return n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-4",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:[r,t]}),n.jsx("p",{className:"text-2xl text-ink font-serif",children:e}),s&&n.jsx("p",{className:"text-[11px] text-warm-gray mt-1",children:s})]})}function FX({client:t,onPatchClient:e}){return n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-4",children:[n.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:"Plan"}),n.jsx("select",{value:t.plan,onChange:s=>e({plan:s.target.value}),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-2 py-1.5 text-[13px] outline-none focus:border-olive-dark","data-testid":"select-billing-plan",children:Zc.map(s=>n.jsxs("option",{value:s.key,children:[s.label,s.price!=null?` — $${s.price}/mo`:""]},s.key))}),n.jsxs("p",{className:"text-[11px] text-warm-gray mt-1.5",children:["Stage: ",t.stage]})]})}function UX({clientId:t,info:e}){const[s,r]=j.useState(!e),[i,a]=j.useState({billingContactName:e?.billingContactName||"",billingEmail:e?.billingEmail||"",billingPhone:e?.billingPhone||""});j.useEffect(()=>{a({billingContactName:e?.billingContactName||"",billingEmail:e?.billingEmail||"",billingPhone:e?.billingPhone||""}),r(!e)},[e]);const l=Mt({mutationFn:async()=>{const d=await fetch(`/api/admin/clients/${t}/billing-info`,{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(i)});if(!d.ok)throw new Error((await d.json()).error||"Failed");return d.json()},onSuccess:()=>{r(!1),Wt.invalidateQueries({queryKey:["/api/admin/clients",t]})}});return n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsx("h3",{className:"text-[13px] font-semibold text-ink",children:"Billing contact"}),e&&!s&&n.jsxs("button",{onClick:()=>r(!0),className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":"button-edit-billing-contact",children:[n.jsx(ub,{className:"w-3 h-3"})," Edit"]})]}),s?n.jsxs("div",{className:"grid sm:grid-cols-3 gap-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:"Name"}),n.jsx("input",{value:i.billingContactName,onChange:d=>
387a({...i,billingContactName:d.target.value}),className:"w-full border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark","data-testid":"input-billing-name"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:"Email"}),n.jsx("input",{value:i.billingEmail,onChange:d=>a({...i,billingEmail:d.target.value}),className:"w-full border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark","data-testid":"input-billing-email"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:"Phone"}),n.jsx("input",{value:i.billingPhone,onChange:d=>a({...i,billingPhone:d.target.value}),className:"w-full border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark","data-testid":"input-billing-phone"})]}),n.jsxs("div",{className:"sm:col-span-3 flex items-center justify-end gap-2",children:[e&&n.jsx("button",{onClick:()=>r(!1),className:"text-[12px] px-3 py-1.5 rounded-md text-warm-gray hover:text-ink",children:"Cancel"}),n.jsx("button",{onClick:()=>l.mutate(),disabled:!i.billingContactName.trim()||!i.billingEmail.trim()||l.isPending,className:"text-[12px] px-3 py-1.5 rounded-md bg-olive-dark text-white disabled:opacity-50","data-testid":"button-save-billing-contact",children:l.isPending?"Saving…":"Save"})]}),l.error&&n.jsx("p",{className:"text-[12px] text-red-700 sm:col-span-3",children:l.error.message})]}):n.jsxs("div",{className:"grid sm:grid-cols-3 gap-4 text-[13px]",children:[n.jsx(_v,{label:"Name",value:e?.billingContactName||"—"}),n.jsx(_v,{label:"Email",value:e?.billingEmail||"—"}),n.jsx(_v,{label:"Phone",value:e?.billingPhone||"—"})]})]})}function _v({label:t,value:e}){return n.jsxs("div",{children:[n.jsx("p",{className:"text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:t}),n.jsx("p",{className:"text-ink",children:e})]})}function HX(t,e="usd"){return(t/100).toLocaleString(void 0,{style:"currency",currency:e||"usd"})}function qX(t){switch(t){case"paid":return"bg-emerald-50 text-emerald-700 border-emerald-200";case"sent":return"bg-blue-50 text-blue-700 border-blue-200";case"overdue":return"bg-red-50 text-red-700 border-red-200";case"void":return"bg-gray-100 text-gray-600 border-gray-200";default:return"bg-amber-50 text-amber-700 border-amber-200"}}function WX({clientId:t,invoices:e}){const[s,r]=j.useState(!1),[i,a]=j.useState(null),l={invoiceNumber:"",amountDollars:"",currency:"usd",status:"draft",periodStart:"",periodEnd:"",issuedAt:Gd(new Date().toISOString()),dueAt:"",paidAt:"",externalUrl:"",notes:""},[d,u]=j.useState(l),m=Mt({mutationFn:async()=>{const g={invoiceNumber:d.invoiceNumber.trim()||null,amountCents:Math.round(Number(d.amountDollars||"0")*100),currency:d.currency,status:d.status,periodStart:d.periodStart||null,periodEnd:d.periodEnd||null,issuedAt:d.issuedAt||null,dueAt:d.dueAt||null,paidAt:d.paidAt||null,externalUrl:d.externalUrl.trim()||null,notes:d.notes||null},b=await fetch(`/api/admin/clients/${t}/invoices`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(g)});if(!b.ok)throw new Error((await b.json()).error||"Failed");return b.json()},onSuccess:()=>{r(!1),u(l),Wt.invalidateQueries({queryKey:["/api/admin/clients",t]})}}),p=Mt({mutationFn:async({id:g,body:b})=>{const v=await fetch(`/api/admin/invoices/${g}`,{method:"PATCH",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(b)});if(!v.ok)throw new Error((await v.json()).error||"Failed");return v.json()},onSuccess:()=>{a(null),Wt.invalidateQueries({queryKey:["/api/admin/clients",t]})}}),x=Mt({mutationFn:async g=>{const b=await fetch(`/api/admin/invoices/${g}`,{method:"DELETE",credentials:"include"});if(!b.ok)throw new Error("failed");return b.json()},onSuccess:()=>Wt.invalidateQueries({queryKey:["/api/admin/clients",t]})});return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-[13px] font-semibold text-ink",children:"Invoices"}),!s&&n.jsxs("button",{onClick:()=>r(!0),className:"inline-flex items-center gap-1.5 text-[12px] px-2.5 py-1 rounded-md border border-[#e7e3d9] text-ink hover:bg-[#f7f5f0]","data-testid":"button-add-invoice",children:[n.jsx(bm,{className:"w-3.5 h-3.5"})," Add invoice"]})]}),s&&n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-4 grid sm:grid-cols-4 gap-3",children:[n.jsx("input",{placeholder:"Invoice #",value:d.invoiceNumber,onChange:g=>u({...d,invoiceNumber:g.target.value}),className:"border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark","data-testid":"input-new-invoice-number"}),n.jsx("input",{type:"number",step:"0.01",placeholder:"Amount (USD)",value:d.amountDollars,onChange:g=>u({...d,amountDollars:g.target.value}),className:"border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark","data-testid":"input-new-invoice-amount"}),n.jsx("select",{value:d.status,onChange:g=>u({...d,status:g.target.value}),className:"border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] bg-white outline-none focus:border-olive-dark","data-testid":"select-new-invoice-status",children:vR.map(g=>n.jsx("option",{value:g,children:g},g))}),n.jsx("input",{value:d.currency,onChange:g=>u({...d,currency:g.target.value.toLowerCase()}),className:"border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark uppercase",placeholder:"USD",maxLength:3}),n.jsxs("div",{className:"sm:col-span-2",children:[n.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:"Period"}),n.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[n.jsx("input",{type:"date",value:d.periodStart,onCh
387ange:g=>u({...d,periodStart:g.target.value}),className:"border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark"}),n.jsx("input",{type:"date",value:d.periodEnd,onChange:g=>u({...d,periodEnd:g.target.value}),className:"border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark"})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:"Issued"}),n.jsx("input",{type:"date",value:d.issuedAt,onChange:g=>u({...d,issuedAt:g.target.value}),className:"w-full border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:"Due"}),n.jsx("input",{type:"date",value:d.dueAt,onChange:g=>u({...d,dueAt:g.target.value}),className:"w-full border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark"})]}),n.jsx("input",{placeholder:"Hosted URL (Stripe / PDF link)",value:d.externalUrl,onChange:g=>u({...d,externalUrl:g.target.value}),className:"border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark sm:col-span-4"}),n.jsx("textarea",{placeholder:"Notes",value:d.notes,onChange:g=>u({...d,notes:g.target.value}),rows:2,className:"border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark sm:col-span-4"}),n.jsxs("div",{className:"sm:col-span-4 flex justify-end gap-2",children:[n.jsx("button",{onClick:()=>{r(!1),u(l)},className:"text-[12px] px-3 py-1.5 rounded-md text-warm-gray hover:text-ink",children:"Cancel"}),n.jsx("button",{onClick:()=>m.mutate(),disabled:!d.amountDollars||Number(d.amountDollars)<0||m.isPending,className:"text-[12px] px-3 py-1.5 rounded-md bg-olive-dark text-white disabled:opacity-50","data-testid":"button-save-invoice",children:m.isPending?"Saving…":"Add invoice"})]}),m.error&&n.jsx("p",{className:"text-[12px] text-red-700 sm:col-span-4",children:m.error.message})]}),e.length===0?n.jsx("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-8 text-center",children:n.jsx("p",{className:"text-[13px] text-warm-gray",children:"No invoices yet. Add one to start tracking billing history."})}):n.jsx("div",{className:"bg-white border border-[#e7e3d9] rounded-xl overflow-hidden",children:n.jsxs("table",{className:"w-full text-[13px]",children:[n.jsx("thead",{className:"bg-[#fafaf6] text-[11px] uppercase text-warm-gray",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left font-semibold px-4 py-2.5 w-[140px]",children:"Invoice #"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5",children:"Period"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5 w-[110px]",children:"Issued"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5 w-[110px]",children:"Due"}),n.jsx("th",{className:"text-right font-semibold px-4 py-2.5 w-[110px]",children:"Amount"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5 w-[100px]",children:"Status"}),n.jsx("th",{className:"text-right font-semibold px-4 py-2.5 w-[180px]",children:"Actions"})]})}),n.jsx("tbody",{children:e.map(g=>{if(i===g.id)return n.jsx(GX,{inv:g,onCancel:()=>a(null),onSave:k=>p.mutate({id:g.id,body:k}),saving:p.isPending},g.id);const v=g.status==="sent"&&g.dueAt&&new Date(g.dueAt).getTime()<Date.now()?"overdue":g.status;return n.jsxs("tr",{className:"border-t border-[#f0ece2]","data-testid":`row-invoice-${g.id}`,children:[n.jsx("td",{className:"px-4 py-2.5 font-medium text-ink",children:g.invoiceNumber||n.jsx("span",{className:"text-warm-gray",children:"—"})}),n.jsxs("td",{className:"px-4 py-2.5 text-warm-gray text-[12px]",children:[g.periodStart?il(g.periodStart):"—",g.periodEnd?` → ${il(g.periodEnd)}`:""]}),n.jsx("td",{className:"px-4 py-2.5 text-[12px]",children:il(g.issuedAt)}),n.jsx("td",{className:"px-4 py-2.5 text-[12px]",children:il(g.dueAt)}),n.jsx("td",{className:"px-4 py-2.5 text-right font-medium text-ink",children:HX(g.amountCents,g.currency)}),n.jsx("td",{className:"px-4 py-2.5",children:n.jsx("span",{className:`inline-block text-[10px] uppercase font-semibold px-2 py-0.5 rounded-full border ${qX(v)}`,children:v})}),n.jsx("td",{className:"px-4 py-2.5",children:n.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[g.externalUrl&&n.jsx("a",{href:g.externalUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`link-invoice-url-${g.id}`,children:n.jsx(Px,{className:"w-3 h-3"})}),g.status!=="paid"&&n.jsx("button",{onClick:()=>p.mutate({id:g.id,body:{status:"paid"}}),className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-emerald-700 hover:bg-emerald-50","data-testid":`button-mark-paid-${g.id}`,children:"Mark paid"}),n.jsx("button",{onClick:()=>a(g.id),className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`button-edit-invoice-${g.id}`,children:n.jsx(ub,{className:"w-3 h-3"})}),n.jsx("button",{onClick:()=>{confirm(`Delete invoice ${g.invoiceNumber||""}?`)&&x.mutate(g.id)},className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-red-700 hover:bg-red-50","data-testid":`button-delete-invoice-${g.id}`,children:n.jsx(ep,{className:"w-3 h-3"})})]})})]},g.id)})})]})})]})}function GX({inv:t,onCancel:e,onSave:s,saving:r}){const[i,a]=j.useState({invoiceNumber:t.invoiceNumber||"",amountDollars:(t.amountCents/100).toString(),currency:t.currency||"usd",status:t.status,periodStart:Gd(t.periodStart),periodEnd:Gd(t.periodEnd),issuedAt:Gd(t.issuedAt),dueAt:Gd(t.dueAt),paidAt:Gd(t.paidAt),externalUrl:t.externalUrl||"",notes:t.notes||""}),l=()=>s({invoiceNumber:i.invoiceNumber.trim()||null,amountCents:Math.round(Number(i.amountDollars||"0")*100),currency:i.currency,status:i.status,periodStart:i.periodStart||null,periodEnd:i.periodEnd||null,issuedAt:i.issuedAt||null,dueAt:i.dueAt||null,paidAt:i.paidAt||null,externalUrl:i.externalUrl.trim()||null,notes:i.notes||null});return n.jsx("tr",{className:"border-t border-[#f0ece2] bg-[#fafaf6]",children:n.jsx("td",{className:"px-4 py-2.5",colSpan:7,children:n.jsxs("div",{className:"grid sm:grid-cols-4 gap-2",children:[n.jsx("input",{value:i.invoiceNumber,onChange:d=>
387a({...i,invoiceNumber:d.target.value}),placeholder:"Invoice #",className:"border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white outline-none focus:border-olive-dark"}),n.jsx("input",{type:"number",step:"0.01",value:i.amountDollars,onChange:d=>a({...i,amountDollars:d.target.value}),placeholder:"Amount",className:"border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white outline-none focus:border-olive-dark"}),n.jsx("select",{value:i.status,onChange:d=>a({...i,status:d.target.value}),className:"border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white outline-none focus:border-olive-dark",children:vR.map(d=>n.jsx("option",{value:d,children:d},d))}),n.jsx("input",{value:i.currency,onChange:d=>a({...i,currency:d.target.value.toLowerCase()}),maxLength:3,className:"border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white uppercase outline-none focus:border-olive-dark"}),n.jsx("input",{type:"date",value:i.periodStart,onChange:d=>a({...i,periodStart:d.target.value}),className:"border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white outline-none focus:border-olive-dark"}),n.jsx("input",{type:"date",value:i.periodEnd,onChange:d=>a({...i,periodEnd:d.target.value}),className:"border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white outline-none focus:border-olive-dark"}),n.jsx("input",{type:"date",value:i.issuedAt,onChange:d=>a({...i,issuedAt:d.target.value}),className:"border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white outline-none focus:border-olive-dark"}),n.jsx("input",{type:"date",value:i.dueAt,onChange:d=>a({...i,dueAt:d.target.value}),className:"border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white outline-none focus:border-olive-dark"}),n.jsx("input",{value:i.externalUrl,onChange:d=>a({...i,externalUrl:d.target.value}),placeholder:"Hosted URL",className:"border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white sm:col-span-4 outline-none focus:border-olive-dark"}),n.jsx("textarea",{value:i.notes,onChange:d=>a({...i,notes:d.target.value}),placeholder:"Notes",rows:2,className:"border border-[#e7e3d9] rounded-md px-2 py-1 text-[13px] bg-white sm:col-span-4 outline-none focus:border-olive-dark"}),n.jsxs("div",{className:"sm:col-span-4 flex justify-end gap-2",children:[n.jsx("button",{onClick:e,className:"text-[11px] px-3 py-1 rounded-md text-warm-gray hover:text-ink",children:"Cancel"}),n.jsx("button",{onClick:l,disabled:r,className:"text-[11px] px-3 py-1 rounded-md bg-olive-dark text-white disabled:opacity-50","data-testid":`button-save-invoice-${t.id}`,children:r?"Saving…":"Save"})]})]})})})}function KX(){const{data:t,isLoading:e}=ds({queryKey:["/api/admin/team"],queryFn:async()=>{const v=await fetch("/api/admin/team",{credentials:"include"});if(!v.ok)throw new Error("failed");return v.json()}}),{data:s}=ds({queryKey:["/api/admin/me"],queryFn:async()=>{const v=await fetch("/api/admin/me",{credentials:"include"});if(!v.ok)throw new Error("failed");return v.json()}}),r=s?.admin?.id,[i,a]=j.useState(!1),[l,d]=j.useState(null),[u,m]=j.useState(null),p=v=>{m(v),window.setTimeout(()=>m(null),2400)},x=t?.members||[],g=x.filter(v=>v.isActive===1),b=x.filter(v=>v.isActive!==1);return n.jsxs("div",{className:"px-6 py-6 max-w-[1400px] mx-auto","data-testid":"page-admin-team",children:[n.jsxs("div",{className:"flex items-end justify-between mb-5",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"font-serif text-3xl text-ink tracking-tight",children:"Team"}),n.jsxs("p",{className:"text-[12px] text-warm-gray mt-1",children:[g.length," active · ",b.length," inactive"]})]}),n.jsxs("button",{type:"button",onClick:()=>a(!0),className:"inline-flex items-center gap-1.5 bg-olive-dark hover:bg-olive text-white px-4 py-2 rounded-full font-semibold text-[12px]","data-testid":"button-invite-team-member",children:[n.jsx(XA,{className:"w-3.5 h-3.5"})," Invite team member"]})]}),u&&n.jsx("div",{className:"mb-3 text-[12px] bg-emerald-50 border border-emerald-200 text-emerald-800 rounded-lg px-3 py-2",children:u}),n.jsx("div",{className:"bg-white border border-[#e7e3d9] rounded-xl overflow-hidden",children:n.jsxs("table",{className:"w-full text-[13px]",children:[n.jsx("thead",{className:"bg-[#fafaf6] border-b border-[#e7e3d9] text-[11px] uppercase tracking-wide text-warm-gray",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left font-semibold px-4 py-2.5",children:"Name"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5",children:"Email"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5",children:"Role"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5",children:"Slack"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5",children:"Sign-in"}),n.jsx("th",{className:"text-left font-semibold px-4 py-2.5",children:"Status"}),n.jsx("th",{className:"text-right font-semibold px-4 py-2.5",children:"Actions"})]})}),n.jsxs("tbody",{children:[e&&n.jsx("tr",{children:n.jsx("td",{colSpan:7,className:"px-4 py-10 text-center text-warm-gray text-[12px]",children:"Loading…"})}),!e&&x.length===0&&n.jsx("tr",{children:n.jsx("td",{colSpan:7,className:"px-4 py-10 text-center text-warm-gray text-[12px]",children:"No team members yet."})}
387),x.map(v=>n.jsx(YX,{member:v,isSelf:v.id===r,onEdit:()=>d(v),onFlash:p},v.id))]})]})}),i&&n.jsx(QX,{onClose:()=>a(!1),onFlash:p}),l&&n.jsx(JX,{member:l,onClose:()=>d(null),onFlash:p})]})}function YX({member:t,isSelf:e,onEdit:s,onFlash:r}){const i=Mt({mutationFn:async d=>{const u=await fetch(`/api/admin/team/${t.id}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!u.ok)throw new Error((await u.json().catch(()=>({}))).error||"Save failed");return u.json()},onSuccess:()=>Wt.invalidateQueries({queryKey:["/api/admin/team"]})}),a=Mt({mutationFn:async()=>{const d=await fetch(`/api/admin/team/${t.id}/reset-password`,{method:"POST",credentials:"include"});if(!d.ok)throw new Error((await d.json().catch(()=>({}))).error||"Failed");return d.json()},onSuccess:d=>{r(d.kind==="reset"?"Reset email sent.":"Invite re-sent.")}}),l=()=>{confirm(t.isActive===1?`Deactivate ${t.name}? They will not be able to sign in.`:`Reactivate ${t.name}?`)&&i.mutate({isActive:t.isActive!==1},{onSuccess:()=>r(t.isActive===1?"Member deactivated.":"Member reactivated.")})};return n.jsxs("tr",{className:"border-b border-[#f0ece2] last:border-0 hover:bg-[#fafaf6]","data-testid":`row-team-${t.id}`,children:[n.jsx("td",{className:"px-4 py-3 font-semibold text-ink",children:t.name}),n.jsx("td",{className:"px-4 py-3 text-warm-gray",children:t.email}),n.jsx("td",{className:"px-4 py-3",children:n.jsx("span",{className:"inline-flex items-center text-[11px] font-medium px-2 py-0.5 rounded-full border bg-[#f0ece2] text-ink border-[#e7e3d9]",children:t.role||"—"})}),n.jsx("td",{className:"px-4 py-3 text-warm-gray",children:t.slackHandle||"—"}),n.jsx("td",{className:"px-4 py-3",children:t.hasPassword?n.jsx("span",{className:"text-emerald-700 text-[12px]",children:"Enabled"}):n.jsx("span",{className:"text-warm-gray text-[12px]",children:"Pending invite"})}),n.jsx("td",{className:"px-4 py-3",children:t.isActive===1?n.jsx("span",{className:"inline-flex items-center text-[11px] font-semibold px-2 py-0.5 rounded-full border bg-emerald-50 text-emerald-700 border-emerald-200",children:"Active"}):n.jsx("span",{className:"inline-flex items-center text-[11px] font-semibold px-2 py-0.5 rounded-full border bg-gray-100 text-gray-600 border-gray-200",children:"Inactive"})}),n.jsx("td",{className:"px-4 py-3 text-right whitespace-nowrap",children:n.jsxs("div",{className:"inline-flex items-center gap-1",children:[n.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] hover:bg-[#fafaf6] text-ink","data-testid":`button-edit-${t.id}`,title:"Edit",children:[n.jsx(ub,{className:"w-3 h-3"})," Edit"]}),n.jsxs("button",{type:"button",onClick:()=>{confirm(t.hasPassword?`Send a password reset link to ${t.email}?`:`Re-send the invite to ${t.email}?`)&&a.mutate()},disabled:a.isPending,className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] hover:bg-[#fafaf6] text-ink disabled:opacity-60","data-testid":`button-reset-${t.id}`,title:t.hasPassword?"Send reset link":"Re-send invite",children:[n.jsx(yj,{className:"w-3 h-3"})," ",t.hasPassword?"Reset":"Re-invite"]}),n.jsxs("button",{type:"button",onClick:l,disabled:i.isPending||e&&t.isActive===1,className:`inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border disabled:opacity-60 disabled:cursor-not-allowed ${t.isActive===1?"border-red-200 text-red-700 hover:bg-red-50":"border-emerald-200 text-emerald-700 hover:bg-emerald-50"}`,"data-testid":`button-toggle-active-${t.id}`,title:e&&t.isActive===1?"You can't deactivate yourself":t.isActive===1?"Deactivate":"Reactivate",children:[n.jsx(i$,{className:"w-3 h-3"})," ",t.isActive===1?"Deactivate":"Reactivate"]})]})})]})}function QX({onClose:t,onFlash:e}){const[s,r]=j.useState(""),[i,a]=j.useState(""),[l,d]=j.useState("Admin"),[u,m]=j.useState(null),[p,x]=j.useState(null),g=Mt({mutationFn:async()=>{const b=await fetch("/api/admin/team",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s.trim(),email:i.trim(),role:l.trim()})}),v=await b.json();if(!b.ok)throw new Error(v.error||"Failed");return v},onSuccess:b=>{Wt.invalidateQueries({queryKey:["/api/admin/team"]}),e(`Invite sent to ${i.trim()}.`),b.inviteLink?x(b.inviteLink):t()},onError:b=>m(b?.message||"Failed to invite team member.")});return n.jsx(NR,{onClose:t,title:"Invite team member",children:p?n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-[13px] text-warm-gray",children:"Invite created. In production this would be emailed; in dev you can copy the link below:"}),n.jsx("input",{readOnly:!0,value:p,onFocus:b=>b.currentTarget.select(),className:"w-full bg-[#fafaf6] border border-[#e7e3d9] rounded-lg px-3 py-2 text-[12px] font-mono","data-testid":"input-dev-invite-link"}),n.jsx("div",{className:"flex justify-end",children:n.jsx("button",{onClick:t,className:"bg-olive-dark hover:bg-olive text-white px-4 py-2 rounded-full text-[12px] font-semibold",children:"Done"})})]}):n.jsxs("form",{onSubmit:b=>{if(b.preventDefault(),m(null),!s.trim()||!i.trim()){m("Name and email are required.");return}g.mutate()},className:"space-y-3",children:[n.jsx(kc,{label:"Name",children:n.jsx("input",{value:s,onChange:b=>r(b.target.value),required:!0,autoFocus:!0,className:Sc,"data-testid":"input-invite-name"})}),n.jsx(kc,{label:"Email",children:n.jsx("input",{type:"email",value:i,onChange:b=>a(b.target.value),required:!0,className:Sc,"data-testid":"input-invite-email"})}),n.jsx(kc,{label:"Role",hint:"Free-text label (e.g. Admin, Owner, Support).",children:n.jsx("input",{value:l,onCh
387ange:b=>d(b.target.value),className:Sc,"data-testid":"input-invite-role"})}),u&&n.jsx("div",{className:"text-red-700 text-[12px] bg-red-50 border border-red-100 rounded-lg px-3 py-2",children:u}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-full text-[12px] border border-[#e7e3d9] text-ink",children:"Cancel"}),n.jsx("button",{type:"submit",disabled:g.isPending,className:"px-4 py-2 rounded-full text-[12px] bg-olive-dark hover:bg-olive disabled:opacity-60 text-white font-semibold","data-testid":"button-invite-submit",children:g.isPending?"Sending…":"Send invite"})]})]})})}function JX({member:t,onClose:e,onFlash:s}){const[r,i]=j.useState(t.name),[a,l]=j.useState(t.email),[d,u]=j.useState(t.role||""),[m,p]=j.useState(t.slackHandle||""),[x,g]=j.useState(null);j.useEffect(()=>{i(t.name),l(t.email),u(t.role||""),p(t.slackHandle||"")},[t.id]);const b=Mt({mutationFn:async()=>{const v=await fetch(`/api/admin/team/${t.id}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r.trim(),email:a.trim(),role:d.trim(),slackHandle:m.trim()})}),k=await v.json();if(!v.ok)throw new Error(k.error||"Failed");return k},onSuccess:()=>{Wt.invalidateQueries({queryKey:["/api/admin/team"]}),s("Team member updated."),e()},onError:v=>g(v?.message||"Failed to save.")});return n.jsx(NR,{onClose:e,title:`Edit ${t.name}`,children:n.jsxs("form",{onSubmit:v=>{v.preventDefault(),g(null),b.mutate()},className:"space-y-3",children:[n.jsx(kc,{label:"Name",children:n.jsx("input",{value:r,onChange:v=>i(v.target.value),required:!0,className:Sc,"data-testid":"input-edit-name"})}),n.jsx(kc,{label:"Email",children:n.jsx("input",{type:"email",value:a,onChange:v=>l(v.target.value),required:!0,className:Sc,"data-testid":"input-edit-email"})}),n.jsx(kc,{label:"Role",children:n.jsx("input",{value:d,onChange:v=>u(v.target.value),className:Sc,"data-testid":"input-edit-role"})}),n.jsx(kc,{label:"Slack handle",children:n.jsx("input",{value:m,onChange:v=>p(v.target.value),placeholder:"U0123456789",className:Sc+" font-mono text-[12px]","data-testid":"input-edit-slack"})}),x&&n.jsx("div",{className:"text-red-700 text-[12px] bg-red-50 border border-red-100 rounded-lg px-3 py-2",children:x}),n.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[n.jsx("button",{type:"button",onClick:e,className:"px-4 py-2 rounded-full text-[12px] border border-[#e7e3d9] text-ink",children:"Cancel"}),n.jsx("button",{type:"submit",disabled:b.isPending,className:"px-4 py-2 rounded-full text-[12px] bg-olive-dark hover:bg-olive disabled:opacity-60 text-white font-semibold","data-testid":"button-edit-submit",children:b.isPending?"Saving…":"Save changes"})]})]})})}function NR({children:t,onClose:e,title:s}){return n.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center","data-testid":"modal-team",children:[n.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:e}),n.jsxs("div",{className:"relative w-full max-w-md mx-4 bg-white rounded-2xl border border-[#ddd9d1] overflow-hidden",children:[n.jsxs("div",{className:"px-5 py-3 border-b border-[#e7e3d9] flex items-center justify-between",children:[n.jsx("h3",{className:"font-serif text-lg text-ink",children:s}),n.jsx("button",{onClick:e,className:"p-1 rounded-md hover:bg-[#f0ece2] text-warm-gray","data-testid":"button-modal-close",children:n.jsx(ro,{className:"w-4 h-4"})})]}),n.jsx("div",{className:"p-5",children:t})]})]})}function kc({label:t,hint:e,children:s}){return n.jsxs("div",{children:[n.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:t}),s,e&&n.jsx("p",{className:"text-[11px] text-warm-gray mt-1",children:e})]})}const Sc="w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:border-olive-dark",XX=[{key:"active",label:"Active"},{key:"all",label:"All"},{key:"open",label:"Open"},{key:"in_progress",label:"In Progress"},{key:"resolved",label:"Resolved"},{key:"closed",label:"Closed"}],$T={open:"bg-red-50 text-red-700 border-red-200",in_progress:"bg-amber-50 text-amber-800 border-amber-200",resolved:"bg-emerald-50 text-emerald-700 border-emerald-200",closed:"bg-gray-100 text-gray-600 border-gray-200"},kR={open:"Open",in_progress:"In Progress",resolved:"Resolved",closed:"Closed"},BT={low:"bg-gray-100 text-gray-600 border-gray-200",normal:"bg-sky-50 text-sky-700 border-sky-200",high:"bg-orange-50 text-orange-700 border-orange-200",urgent:"bg-red-50 text-red-700 border-red-200"};function g1(t){const e=Date.now()-new Date(t).getTime(),s=Math.floor(e/1e3);if(s<60)return`${s}s ago`;const r=Math.floor(s/60);if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function ZX(){const[t,e]=j.useState("active"),[s,r]=j.useState(null),i=nj(),a=new URLSearchParams(i).get("clientId")||"",{data:l,isLoading:d}=ds({queryKey:["/api/admin/tickets",t,a],queryFn:async()=>{const x=new URLSearchParams({status:t});a&&x.set("clientId",a);const g=await fetch(`/api/admin/tickets?${x.toString()}`,{credentials:"include"});if(!g.ok)throw new Error("failed");return g.json()},refetchInterval:3e4}),u=l?.tickets||[],m=l?.totalsByStatus||{};j.useEffect(()=>{!s&&u[0]&&r(u[0].id),s&&!u.find(x=>x.id===s)&&r(u[0]?.id||null)},[u,s]);const p=j.useMemo(()=>({active:(m.open||0)+(m.in_progress||0),all:Object.values(m).reduce((x,g)=>x+g,0),open:m.open||0,in_progress:m.in_progress||0,resolved:m.resolved||0,closed:m.closed||0}),[m]);return n.jsxs("div",{className:"px-6 py-6 max-w-[1600px] mx-auto","data-testid":"page-admin-issues",children:[n.jsx("div",{className:"flex items-end justify-between mb-4",children:n.jsxs("div",{children:[n.jsx("h1",{className:"font-serif text-3xl text-ink tracking-tight",children:"Issues"}),n.jsxs("p",{className:"text-[12px] text-warm-gray mt-1",children:[p.active," active · ",p.all," total"]})]})}),a&&n.jsxs("div",{className:"mb-3 flex items-center gap-3 px-3 py-2 rounded-lg bg-amber-50 border border-amber-200 text-[12px] text-amber-900",children:[n.jsx("span",{children:"Filtered to one client."}),n.jsx(Ae,{href:"/admin/issues",className:"underline","data-testid":"link-clear-client-filter",children:"Clear filter"})]}),n.jsx("div",{className:"flex gap-1 border-b border-[#e7e3d9] mb-4",children:XX.map(x=>n.jsxs("button",{onClick:()=>e(x.key),className:`px-3 py-2 text-[13px] font-medium border-b-2 -mb-px ${t===x.key?"border-olive-dark text-ink":"border-transparent text-warm-gray hover:text-ink"}`,"data-testid":`filter-${x.key}`,children:[x.label,n.jsx("span",{className:"ml-1.5 text-[11px] text-warm-gray/70",children:p[x.key]||0})]},x.key))}),n.jsxs("div",{className:"grid grid-cols-[380px_1fr] gap-4 min-h-[600px]",children:[n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl overflow-hidden flex flex-col",children:[d&&n.jsx("div",{className:"px-4 py-10 text-center text-warm-gray text-[12px]",children:"Loading…"}),!d&&u.length===0&&n.jsx("div",{className:"px-4 py-10 text-center text-warm-gray text-[12px]",children:"No tickets in this view."}),n.jsx("div",{className:"overflow-y-auto",children:u.map(x=>{const g=x.id===s;return n.jsxs("button",{onClick:()=>r(x.id),className:`w-full text-left px-4 py-3 border-b border-[#f0ece2] hover:bg-[#fafaf6] ${g?"bg-[#f0ece2]":""}`,"data-testid":`row-ticket-${x.id}`,children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[n.jsx("span",{className:"text-[12px] font-bold text-ink truncate",children:x.companyName||"—"}),n.jsx("span",{className:"text-[10px] text-warm-gray shrink-0",children:g1(x.updatedAt)})]}),n.jsx("div",{className:"text-[13px] text-ink line-clamp-1 mb-1.5",children:x.subject}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-full border ${$T[x.status]||$T.closed}`,children:kR[x.status]||x.status}),n.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-full border ${BT[x.priority]||BT.normal}`,children:x.priority}),n.jsxs("span",{className:"text-[10px] text-warm-gray ml-auto",children:[x.messageCount," msg"]})]})]},x.id)})})]}),n.jsx("div",{className:"bg-white border border-[#e7e3d9] rounded-xl flex flex-col min-h-[600px]",children:s?n.jsx(eZ,{id:s}):n.jsx("div",{className:"flex-1 flex items-center justify-center text-warm-gray text-[13px]",children:"Select a ticket to view the conversation."})})]})]})}function eZ({id:t}){const[e,s]=j.useState(""),{data:r}=ds({queryKey:["/api/admin/tickets","detail",t],queryFn:async()=>{const m=await fetch(`/api/admin/tickets/${t}`,{credentials:"include"});if(!m.ok)throw new Error("failed");return m.json()},refetchInterval:15e3}),i=ds({queryKey:["/api/admin/team"],queryFn:async()=>{const m=await fetch("/api/admin/team",{credentials:"include"});if(!m.ok)throw new Error("failed");return m.json()}}),a=Mt({mutationFn:async m=>{const p=await fetch(`/api/admin/tickets/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(m)});if(!p.ok)throw new Error((await p.json()).error||"Update failed");return p.json()},onSuccess:()=>{Wt.invalidateQueries({queryKey:["/api/admin/tickets"]})}}),l=Mt({mutationFn:async m=>{const p=await fetch(`/api/admin/tickets/${t}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({message:m})});if(!p.ok)throw new Error((await p.json()).error||"Send failed");return p.json()},onSuccess:()=>{s(""),Wt.invalidateQueries({queryKey:["/api/admin/tickets"]})}});if(!r)return n.jsx("div",{className:"p-6 text-warm-gray text-[13px]",children:"Loading…"});const{ticket:d,messages:u}=r;return n.jsxs("div",{className:"flex flex-col flex-1 min-h-0","data-testid":"ticket-detail",children:[n.jsxs("div",{className:"px-5 py-4 border-b border-[#e7e3d9]",children:[n.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-warm-gray font-semibold",children:d.companyName}),n.jsx("h2",{className:"font-serif text-xl text-ink mt-0.5 truncate",children:d.subject}),n.jsxs("div",{className:"text-[12px] text-warm-gray mt-0.5",children:["From ",d.contactName," ",d.contactEmail&&`(${d.contactEmail})`," · opened ",g1(d.createdAt)]})]})}),n.jsxs("div",{className:"flex flex-wrap gap-2 mt-3",children:[n.jsx("select",{value:d.status,onChange:m=>a.mutate({status:m.target.value}),className:"bg-white border border-[#e7e3d9] rounded-full px-3 py-1 text-[12px] font-medium outline-none focus:ring-2 focus:ring-olive-dark/20","data-testid":"select-ticket-status",children:Object.entries(kR).map(([m,p])=>n.jsx("option",{value:m,children:p},m))}),n.jsxs("select",{value:d.priority,onChange:m=>a.mutate({priority:m.target.value}),className:"bg-white border border-[#e7e3d9] rounded-full px-3 py-1 text-[12px] font-medium outline-none focus:ring-2 focus:ring-olive-dark/20","data-testid":"select-ticket-priority",children:[n.jsx("option",{value:"low",children:"Low"}),n.jsx("option",{value:"normal",children:"Normal"}),n.jsx("option",{value:"high",children:"High"}),n.jsx("option",{value:"urgent",children:"Urgent"})]}),n.jsxs("select",{value:d.assignedTo||"",onChange:m=>a.mutate({assignedTo:m.target.value}),className:"bg-white border border-[#e7e3d9] rounded-full px-3 py-1 text-[12px] font-medium outline-none focus:ring-2 focus:ring-olive-dark/20","data-testid":"select-ticket-assignee",children:[n.jsx("option",{value:"",children:"Unassigned"}),(i.data?.members||[]).map(m=>n.jsx("option",{value:m.id,children:m.name},m.id))]})]})]}),n.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-4 min-h-0",children:u.map(m=>{const p=m.senderType==="team";return n.jsx("div",{className:`flex ${p?"justify-end":"justify-start"}`,"data-testid":`message-${m.id}`,children:n.jsxs("div",{className:`max-w-[80%] rounded-2xl px-4 py-2.5 border text-[13px] ${p?"bg-olive-dark text-white border-olive-dark":"bg-[#fafaf6] text-ink border-[#e7e3d9]"}`,children:[n.jsxs("div",{className:`text-[10px] font-semibold mb-0.5 ${p?"text-white/70":"text-warm-gray"}`,children:[m.senderName," · ",g1(m.createdAt)]}),n.jsx("div",{className:"whitespace-pre-wrap leading-relaxed",children:m.message})]})},m.id)})}),n.jsx("div",{className:"px-5 py-4 border-t border-[#e7e3d9]",children:d.status==="closed"?n.jsx("div",{className:"text-[12px] text-warm-gray italic",children:"Ticket closed. Reopen by changing status."}):n.jsxs("div",{className:"flex gap-2 items-end",children:[n.jsx("textarea",{value:e,onCh
387ange:m=>s(m.target.value),onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),e.trim()&&l.mutate(e.trim()))},rows:2,placeholder:"Reply to client… (Enter to send, Shift+Enter for newline)",className:"flex-1 bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark resize-none","data-testid":"textarea-reply"}),n.jsx("button",{onClick:()=>e.trim()&&l.mutate(e.trim()),disabled:!e.trim()||l.isPending,className:"bg-olive-dark hover:bg-olive disabled:opacity-50 text-white px-5 py-2 rounded-lg font-semibold text-[13px]","data-testid":"button-send-reply",children:l.isPending?"Sending…":"Send"})]})})]})}const EN=[{key:"internal",label:"Internal"},{key:"client_facing",label:"Client-Facing"}],ug=[{key:"low",label:"Low",color:"bg-gray-100 text-gray-700 border-gray-200"},{key:"normal",label:"Normal",color:"bg-sky-50 text-sky-700 border-sky-200"},{key:"high",label:"High",color:"bg-orange-50 text-orange-700 border-orange-200"},{key:"critical",label:"Critical",color:"bg-red-50 text-red-700 border-red-200"}],hg=[{key:"idea",label:"Idea",color:"bg-gray-100 text-gray-700 border-gray-200"},{key:"planned",label:"Planned",color:"bg-sky-50 text-sky-700 border-sky-200"},{key:"in_progress",label:"In Progress",color:"bg-amber-50 text-amber-800 border-amber-200"},{key:"done",label:"Done",color:"bg-emerald-50 text-emerald-700 border-emerald-200"},{key:"cancelled",label:"Cancelled",color:"bg-gray-100 text-gray-500 border-gray-200"}],rm=t=>ug.find(e=>e.key===t)||ug[1],Ov=t=>hg.find(e=>e.key===t)||hg[0],tZ=t=>t==="client_facing"?"Client-Facing":"Internal";async function Xa(t,e={}){const s=await fetch(t,{credentials:"include",headers:{"Content-Type":"application/json",...e.headers||{}},...e});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error||"Request failed");return s.json()}function sZ(){const[t,e]=j.useState(""),[s,r]=j.useState("all"),[i,a]=j.useState("all"),[l,d]=j.useState(new Set),[u,m]=j.useState(new Set),[p,x]=j.useState(null),{data:g,isLoading:b}=ds({queryKey:["/api/admin/enhancements"],queryFn:()=>Xa("/api/admin/enhancements")}),v=()=>Wt.invalidateQueries({queryKey:["/api/admin/enhancements"]}),k=Mt({mutationFn:P=>Xa("/api/admin/enhancements/epics",{method:"POST",body:JSON.stringify(P)}),onSuccess:v}),N=Mt({mutationFn:({id:P,...ne})=>Xa(`/api/admin/enhancements/epics/${P}`,{method:"PATCH",body:JSON.stringify(ne)}),onSuccess:v}),S=Mt({mutationFn:P=>Xa(`/api/admin/enhancements/epics/${P}`,{method:"DELETE"}),onSuccess:v}),A=Mt({mutationFn:P=>Xa("/api/admin/enhancements/items",{method:"POST",body:JSON.stringify(P)}),onSuccess:v}),E=Mt({mutationFn:({id:P,...ne})=>Xa(`/api/admin/enhancements/items/${P}`,{method:"PATCH",body:JSON.stringify(ne)}),onSuccess:P=>{v(),p&&P?.item&&x(P.item)}}),_=Mt({mutationFn:P=>Xa(`/api/admin/enhancements/items/${P}`,{method:"DELETE"}),onSuccess:()=>{v(),x(null)}}),T=g?.versions||[],$=g?.epics||[],L=g?.items||[],M=j.useMemo(()=>{const P={};return L.forEach(ne=>{const q=ne.epicId||"__triage__";(P[q]||=[]).push(ne)}),Object.values(P).forEach(ne=>ne.sort((q,W)=>q.sortOrder-W.sortOrder)),P},[L]),I=P=>{if(s!=="all"&&P.type!==s)return!1;if(t){const ne=t.toLowerCase();if(!P.title.toLowerCase().includes(ne)&&!(P.description||"").toLowerCase().includes(ne))return!1}return!0},z=j.useMemo(()=>{const P={};return L.forEach(ne=>{ne.epicId&&I(ne)&&(P[ne.epicId]||=[]).push(ne)}),Object.values(P).forEach(ne=>ne.sort((q,W)=>q.sortOrder-W.sortOrder)),P},[L,t,s]),ae=j.useMemo(()=>{const P={};return $.forEach(ne=>{const q=I(ne),W=(z[ne.id]||[]).length>0;!q&&!W||(P[ne.versionKey]||=[]).push(ne)}),Object.values(P).forEach(ne=>ne.sort((q,W)=>q.sortOrder-W.sortOrder)),P},[$,z,t,s]),U=j.useMemo(()=>{const P={};return L.forEach(ne=>{ne.epicId||I(ne)&&(P[ne.versionTarget]||=[]).push(ne)}),Object.values(P).forEach(ne=>ne.sort((q,W)=>q.sortOrder-W.sortOrder)),P},[L,t,s]),Y=T.filter(P=>i==="all"||P.key===i);return n.jsxs("div",{className:"px-6 py-6 max-w-[1800px] mx-auto","data-testid":"page-admin-enhancements",children:[n.jsxs("div",{className:"flex items-end justify-between mb-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"font-serif text-3xl text-ink tracking-tight",children:"Enhancements"}),n.jsxs("p",{className:"text-[12px] text-warm-gray mt-1",children:[$.length," epics · ",L.length," items"]})]}),n.jsxs("button",{onClick:()=>{const P=window.prompt("Epic title?");P?.trim()&&k.mutate({title:P.trim(),versionKey:"triage"})},className:"bg-olive-dark hover:bg-olive text-white px-4 py-2 rounded-lg text-[13px] font-semibold flex items-center gap-1.5","data-testid":"button-new-epic",children:[n.jsx(bm,{className:"w-4 h-4"})," New Epic"]})]}),n.jsxs("div",{className:"flex flex-wrap gap-2 items-center mb-4",children:[n.jsx("input",{value:t,onChange:P=>e(P.target.value),placeholder:"Search epics & items…",className:"bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark min-w-[260px]","data-testid":"input-search"}),n.jsxs("select",{value:s,onChange:P=>r(P.target.value),className:"bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px]","data-testid":"select-type-filter",children:[n.jsx("option",{value:"all",children:"All types"}),EN.map(P=>n.jsx("option",{value:P.key,children:P.label},P.key))]}),n.jsxs("select",{value:i,onChange:P=>a(P.target.value),className:"bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px]","data-testid":"select-version-filter",children:[n.jsx("option",{value:"all",children:"All versions"}),T.map(P=>n.jsx("option",{value:P.key,children:P.label},P.key))]})]}),b&&n.jsx("div",{className:"text-warm-gray text-[13px]",children:"Loading…"}),n.jsx("div",{className:"flex gap-4 overflow-x-auto pb-6 items-start",children:Y.map(P=>{const ne=l.has(P.key),q=ae[P.key]||[],W=U[P.key]||[],ie=q.length+W.length;return n.jsxs("div",{className:`shrink-0 ${ne?"w-[60px]":"w-[320px]"} bg-[#fafaf6] border border-[#e7e3d9] rounded-xl flex flex-col max-h-[calc(100vh-220px)]`,"data-testid":`column-${P.key}`,children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-[#e7e3d9]",children:[n.jsx("button",{onClick:()=>{const he=new Set(l);he.has(P.key)?he.delete(P.key):he.add(P.key),d(he)},className:"text-warm-gray hover:text-ink","data-testid":`button-collapse-${P.key}`,children:ne?n.jsx(no,{className:"w-4 h-4"}):n.jsx(mo,{className:"w-4 h-4"})}),!ne&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:P.color}}),n.jsx("span",{className:"text-[13px] font-bold text-ink uppercase tracking-wide flex-1 truncate",children:P.label}),n.jsx("span",{className:"text-[11px] text-warm-gray bg-white border border-[#e7e3d9] rounded-full px-2 py-0.5",children:ie})]}),ne&&n.jsx("span",{className:"text-[10px] font-bold text-ink uppercase rotate-180 [writing-mode:vertical-rl] mt-2",children:P.label})]}),!ne&&n.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-2",children:[W.map(he=>n.jsxs("button",{onClick:()=>x(he),className:"w-full text-left bg-white border border-dashed border-amber-300 rounded-lg p-2.5 hover:border-amber-400 hover:shadow-sm transition","data-testid":`orphan-item-${he.id}`,children:[n.jsx("div",{className:"text-[10px] uppercase tracking-wide text-amber-700 font-semibold mb-1",children:he.clientName?`From ${he.clientName}`:"Unassigned item"}),n.jsx("div",{className:"text-[13px] text-ink line-clamp-2",children:he.title}),n.jsxs("div",{className:"flex gap-1 mt-1.5",children:[n.jsx(mg,{className:rm(he.priority).color,children:rm(he.priority).label}),n.jsx(mg,{className:"bg-blue-50 text-blue-700 border-blue-200",children:tZ(he.type)})]})]},he.id)),q.map((he,se)=>n.jsx(nZ,{epic:he,isFirst:se===0,isLast:se===q.length-1,onMoveUp:()=>{const B=q[se-1];B&&(N.mutate({id:he.id,sortOrder:B.sortOrder}),N.mutate({id:B.id,sortOrder:he.sortOrder}))},onMoveDown:()=>{const B=q[se+1];B&&(N.mutate({id:he.id,sortOrder:B.sortOrder}),N.mutate({id:B.id,sortOrder:he.sortOrder}))},items:z[he.id]||M[he.id]||[],versions:T,expanded:u.has(he.id),onToggleExpand:()=>{const B=new Set(u);B.has(he.id)?B.delete(he.id):B.add(he.id),m(B)},onUpdate:B=>N.mutate({id:he.id,...B}),onDelete:()=>{confirm(`Delete epic "${he.title}"? Items will be unassigned.`)&&S.mutate(he.id)},onAddItem:B=>A.mutate({title:B,epicId:he.id,versionTarget:he.versionKey,type:he.type}),onItemClick:B=>x(B)},he.id)),n.jsxs("button",{onClick:()=>{const he=window.prompt(`New epic in ${P.label}?`);he?.trim()&&k.mutate({title:he.trim(),versionKey:P.key})},className:"w-full border border-dashed border-[#d4cfc0] rounded-lg py-2 text-[12px] text-warm-gray hover:text-ink hover:border-warm-gray flex items-center justify-center gap-1","data-testid":`button-add-epic-${P.key}`,children:[n.jsx(bm,{className:"w-3.5 h-3.5"})," Add epic"]})]})]},P.key)})}),p&&n.jsx(rZ,{item:p,epics:$,versions:T,onClose:()=>x(null),onSave:P=>E.mutate({id:p.id,...P}),onDelete:()=>{confirm("Delete this item?")&&_.mutate(p.id)}})]})}function mg({className:t,children:e}){return n.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-full border ${t}`,children:e})}
387function nZ({epic:t,items:e,versions:s,expanded:r,isFirst:i,isLast:a,onToggleExpand:l,onUpdate:d,onDelete:u,onMoveUp:m,onMoveDown:p,onAddItem:x,onItemClick:g}){return n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-lg shadow-sm","data-testid":`epic-${t.id}`,children:[n.jsxs("div",{className:"p-2.5",children:[n.jsxs("div",{className:"flex items-start gap-1.5",children:[n.jsx("button",{onClick:l,className:"text-warm-gray hover:text-ink mt-0.5",children:r?n.jsx(mo,{className:"w-3.5 h-3.5"}):n.jsx(no,{className:"w-3.5 h-3.5"})}),n.jsx("input",{defaultValue:t.title,onBlur:b=>b.target.value!==t.title&&d({title:b.target.value}),className:"text-[13px] font-bold text-ink flex-1 bg-transparent outline-none focus:bg-[#fafaf6] rounded px-1 -mx-1"}),n.jsx("button",{onClick:m,disabled:i,className:"text-warm-gray/40 hover:text-ink disabled:opacity-20 disabled:hover:text-warm-gray/40","data-testid":`button-up-epic-${t.id}`,children:n.jsx(xj,{className:"w-3.5 h-3.5"})}),n.jsx("button",{onClick:p,disabled:a,className:"text-warm-gray/40 hover:text-ink disabled:opacity-20 disabled:hover:text-warm-gray/40","data-testid":`button-down-epic-${t.id}`,children:n.jsx(DA,{className:"w-3.5 h-3.5"})}),n.jsx("button",{onClick:u,className:"text-warm-gray/40 hover:text-red-500","data-testid":`button-delete-epic-${t.id}`,children:n.jsx(ep,{className:"w-3.5 h-3.5"})})]}),n.jsxs("div",{className:"flex flex-wrap gap-1 mt-1.5 ml-5",children:[n.jsx("select",{value:t.versionKey,onChange:b=>d({versionKey:b.target.value}),className:"text-[10px] font-semibold border rounded-full px-1.5 py-0.5 bg-white",children:s.map(b=>n.jsx("option",{value:b.key,children:b.label},b.key))}),n.jsx("select",{value:t.priority,onChange:b=>d({priority:b.target.value}),className:`text-[10px] font-semibold border rounded-full px-1.5 py-0.5 ${rm(t.priority).color}`,children:ug.map(b=>n.jsx("option",{value:b.key,children:b.label},b.key))}),n.jsx("select",{value:t.status,onChange:b=>d({status:b.target.value}),className:`text-[10px] font-semibold border rounded-full px-1.5 py-0.5 ${Ov(t.status).color}`,children:hg.map(b=>n.jsx("option",{value:b.key,children:b.label},b.key))}),n.jsx("select",{value:t.type,onChange:b=>d({type:b.target.value}),className:"text-[10px] font-semibold border rounded-full px-1.5 py-0.5 bg-blue-50 text-blue-700 border-blue-200",children:EN.map(b=>n.jsx("option",{value:b.key,children:b.label},b.key))}),n.jsxs("span",{className:"text-[10px] text-warm-gray ml-auto",children:[e.length," ",e.length===1?"item":"items"]})]})]}),r&&n.jsxs("div",{className:"border-t border-[#f0ece2] p-2 space-y-1 bg-[#fafaf6]",children:[e.map(b=>n.jsx("button",{onClick:()=>g(b),className:"w-full text-left bg-white border border-[#f0ece2] rounded px-2 py-1.5 hover:border-[#e7e3d9] hover:shadow-sm transition","data-testid":`item-${b.id}`,children:n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-[12px] text-ink flex-1 truncate",children:b.title}),n.jsx(mg,{className:rm(b.priority).color,children:rm(b.priority).label}),n.jsx(mg,{className:Ov(b.status).color,children:Ov(b.status).label})]})},b.id)),n.jsxs("button",{onClick:()=>{const b=window.prompt("Item title?");b?.trim()&&x(b.trim())},className:"w-full border border-dashed border-[#d4cfc0] rounded py-1 text-[11px] text-warm-gray hover:text-ink flex items-center justify-center gap-1","data-testid":`button-add-item-${t.id}`,children:[n.jsx(bm,{className:"w-3 h-3"})," Add item"]})]})]})}function rZ({item:t,epics:e,versions:s,onClose:r,onSave:i,onDelete:a}){const l=ds({queryKey:["/api/admin/team"],queryFn:()=>Xa("/api/admin/team")}),d=ds({queryKey:["/api/admin/clients"],queryFn:()=>Xa("/api/admin/clients")});return n.jsxs("div",{className:"fixed inset-0 z-50 flex","data-testid":"item-drawer",children:[n.jsx("div",{className:"flex-1 bg-black/30",onClick:r}),n.jsxs("div",{className:"w-[480px] bg-white border-l border-[#e7e3d9] flex flex-col h-screen overflow-y-auto",children:[n.jsxs("div",{className:"flex items-start justify-between p-5 border-b border-[#e7e3d9]",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] uppercase tracking-wide text-warm-gray font-semibold",children:"Item"}),n.jsx("input",{defaultValue:t.title,onBlur:u=>u.target.value!==t.title&&i({title:u.target.value}),className:"font-serif text-xl text-ink bg-transparent outline-none focus:bg-[#fafaf6] rounded px-1 -mx-1 mt-0.5 w-full","data-testid":"input-item-title"}),t.clientName&&n.jsxs("div",{className:"text-[12px] text-warm-gray mt-1",children:["From: ",t.clientName]})]}),n.jsx("button",{onClick:r,className:"text-warm-gray hover:text-ink p-1","data-testid":"button-close-drawer",children:n.jsx(ro,{className:"w-5 h-5"})})]}),n.jsxs("div",{className:"flex-1 p-5 space-y-4",children:[n.jsx(qa,{label:"Description",children:n.jsx("textarea",{defaultValue:t.description||"",onBlur:u=>(u.target.value||null)!==t.description&&i({description:u.target.value||null}),rows:4,placeholder:"Add a description…",className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":"textarea-item-description"})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(qa,{label:"Epic",children:n.jsxs("select",{value:t.epicId||"",onChange:u=>i({epicId:u.target.value||null}),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-2 py-1.5 text-[13px]",children:[n.jsx("option",{value:"",children:"— None —"}),e.map(u=>n.jsx("option",{value:u.id,children:u.title},u.id))]})}),n.jsx(qa,{label:"Version",children:n.jsx("select",{value:t.versionTarget,onCh
387ange:u=>i({versionTarget:u.target.value}),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-2 py-1.5 text-[13px]",children:s.map(u=>n.jsx("option",{value:u.key,children:u.label},u.key))})}),n.jsx(qa,{label:"Type",children:n.jsx("select",{value:t.type,onChange:u=>i({type:u.target.value}),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-2 py-1.5 text-[13px]",children:EN.map(u=>n.jsx("option",{value:u.key,children:u.label},u.key))})}),n.jsx(qa,{label:"Priority",children:n.jsx("select",{value:t.priority,onChange:u=>i({priority:u.target.value}),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-2 py-1.5 text-[13px]",children:ug.map(u=>n.jsx("option",{value:u.key,children:u.label},u.key))})}),n.jsx(qa,{label:"Status",children:n.jsx("select",{value:t.status,onChange:u=>i({status:u.target.value}),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-2 py-1.5 text-[13px]",children:hg.map(u=>n.jsx("option",{value:u.key,children:u.label},u.key))})}),n.jsx(qa,{label:"Due date",children:n.jsx("input",{type:"date",defaultValue:t.dueDate?t.dueDate.slice(0,10):"",onBlur:u=>i({dueDate:u.target.value||null}),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-2 py-1.5 text-[13px]"})}),n.jsx(qa,{label:"Assigned to",children:n.jsxs("select",{value:t.assignedTo||"",onChange:u=>i({assignedTo:u.target.value||null}),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-2 py-1.5 text-[13px]","data-testid":"select-item-assignee",children:[n.jsx("option",{value:"",children:"— Unassigned —"}),(l.data?.members||[]).map(u=>n.jsx("option",{value:u.id,children:u.name},u.id))]})}),n.jsx(qa,{label:"Linked client",children:n.jsxs("select",{value:t.clientId||"",onChange:u=>i({clientId:u.target.value||null}),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-2 py-1.5 text-[13px]","data-testid":"select-item-client",children:[n.jsx("option",{value:"",children:"— None —"}),(d.data?.clients||[]).map(u=>n.jsx("option",{value:u.id,children:u.companyName},u.id))]})})]}),n.jsxs("div",{className:"text-[11px] text-warm-gray pt-2 border-t border-[#f0ece2]",children:["Created ",new Date(t.createdAt).toLocaleString()," ",t.createdBy&&`by ${t.createdBy}`]})]}),n.jsx("div",{className:"p-5 border-t border-[#e7e3d9]",children:n.jsxs("button",{onClick:a,className:"text-[12px] text-red-600 hover:text-red-700 font-semibold flex items-center gap-1","data-testid":"button-delete-item",children:[n.jsx(ep,{className:"w-3.5 h-3.5"})," Delete item"]})})]})]})}function qa({label:t,children:e}){return n.jsxs("label",{className:"block",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:t}),e]})}function iZ({title:t}){return n.jsxs("div",{className:"px-6 py-6 max-w-[1400px] mx-auto","data-testid":`page-admin-${t.toLowerCase().replace(/\s+/g,"-")}`,children:[n.jsx("h1",{className:"font-serif text-3xl text-ink tracking-tight mb-2",children:t}),n.jsx("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-12 text-center",children:n.jsx("p",{className:"text-warm-gray text-[13px]",children:"This section is coming soon."})})]})}function aZ({onAdminUpdated:t}){const{data:e}=ds({queryKey:["/api/admin/me"],queryFn:async()=>{const T=await fetch("/api/admin/me",{credentials:"include"});if(!T.ok)throw new Error("Not authenticated");return T.json()}}),s=e?.admin,[r,i]=j.useState(""),[a,l]=j.useState(""),[d,u]=j.useState(""),[m,p]=j.useState(null);j.useEffect(()=>{s&&(i(s.name),l(s.email),u(s.role))},[s?.id]);const[x,g]=j.useState(""),[b,v]=j.useState(""),[k,N]=j.useState(""),[S,A]=j.useState(null),E=Mt({mutationFn:async()=>{const T=await fetch("/api/admin/me",{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r,email:a,role:d})}),$=await T.json();if(!T.ok)throw new Error($.error||"Update failed");return $},onSuccess:T=>{p({ok:!0,text:"Profile saved."}),t?.(T.admin),Wt.invalidateQueries({queryKey:["/api/admin/me"]}),Wt.invalidateQueries({queryKey:["/api/admin/team"]})},onError:T=>p({ok:!1,text:T.message})}),_=Mt({mutationFn:async()=>
387{if(b!==k)throw new Error("Passwords don't match.");const T=await fetch("/api/admin/me/password",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:x,newPassword:b})}),$=await T.json();if(!T.ok)throw new Error($.error||"Update failed");return $},onSuccess:()=>{A({ok:!0,text:"Password updated."}),g(""),v(""),N("")},onError:T=>A({ok:!1,text:T.message})});return s?n.jsxs("div",{className:"max-w-2xl mx-auto px-6 py-8","data-testid":"page-account-settings",children:[n.jsxs("div",{className:"mb-6",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-wide text-warm-gray font-semibold",children:"Account"}),n.jsx("h1",{className:"font-serif text-2xl text-ink mt-1",children:"Your settings"}),n.jsx("p",{className:"text-[13px] text-warm-gray mt-1",children:"Manage your name, email, title, and password."})]}),n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl divide-y divide-[#f0ece2]",children:[n.jsxs("section",{className:"p-6 space-y-4",children:[n.jsx("h2",{className:"text-[12px] uppercase tracking-wide text-warm-gray font-bold",children:"Profile"}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsx(zd,{label:"Name",children:n.jsx("input",{value:r,onChange:T=>i(T.target.value),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":"input-name"})}),n.jsx(zd,{label:"Title",children:n.jsx("input",{value:d,onChange:T=>u(T.target.value),placeholder:"e.g. Director of Technology",className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":"input-title"})}),n.jsx(zd,{label:"Email",full:!0,children:n.jsx("input",{type:"email",value:a,onChange:T=>l(T.target.value),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":"input-email"})})]}),m&&n.jsx("div",{className:`text-[12px] ${m.ok?"text-emerald-700":"text-red-600"}`,children:m.text}),n.jsx("div",{children:n.jsx("button",{onClick:()=>E.mutate(),disabled:E.isPending,className:"bg-olive-dark hover:bg-olive disabled:opacity-50 text-white px-4 py-2 rounded-lg text-[13px] font-semibold","data-testid":"button-save-profile",children:E.isPending?"Saving…":"Save profile"})})]}),n.jsxs("section",{className:"p-6 space-y-4",children:[n.jsx("h2",{className:"text-[12px] uppercase tracking-wide text-warm-gray font-bold",children:"Password"}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsx(zd,{label:"Current password",full:!0,children:n.jsx("input",{type:"password",value:x,onChange:T=>g(T.target.value),placeholder:"Leave blank if you've never set one",className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":"input-current-password"})}),n.jsx(zd,{label:"New password",children:n.jsx("input",{type:"password",value:b,onChange:T=>v(T.target.value),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":"input-new-password"})}),n.jsx(zd,{label:"Confirm new password",children:n.jsx("input",{type:"password",value:k,onChange:T=>N(T.target.value),className:"w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":"input-confirm-password"})})]}),S&&n.jsx("div",{className:`text-[12px] ${S.ok?"text-emerald-700":"text-red-600"}`,children:S.text}),n.jsx("div",{children:n.jsx("button",{onClick:()=>_.mutate(),disabled:_.isPending||!b,className:"bg-olive-dark hover:bg-olive disabled:opacity-50 text-white px-4 py-2 rounded-lg text-[13px] font-semibold","data-testid":"button-save-password",children:_.isPending?"Upd
387ating…":"Update password"})})]})]})]}):n.jsx("div",{className:"p-8 text-warm-gray text-[13px]",children:"Loading…"})}function zd({label:t,children:e,full:s}){return n.jsxs("label",{className:`block ${s?"sm:col-span-2":""}`,children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:t}),e]})}const zT=[{id:"company",label:"Company & Branding"},{id:"signup",label:"Signup & Access"},{id:"plans",label:"Plans & Billing"},{id:"billing-gate",label:"Billing Allowlist"},{id:"slack",label:"Slack Integration"},{id:"notifications",label:"Notifications Routing"},{id:"team",label:"Team Management"},{id:"health",label:"System Health"},{id:"soon",label:"Coming Soon"}],oZ=[{key:"newSignup",label:"New signup",desc:"Self-service signup completed"},{key:"newTicket",label:"New issue",desc:"Client opened a support ticket"},{key:"ticketReply",label:"Issue reply",desc:"Client replied to an existing ticket"},{key:"paymentFailed",label:"Payment failed",desc:"Stripe charge failed for a client"}];function lZ(){const{data:t,isLoading:e}=ds({queryKey:["/api/admin/app-settings"],queryFn:async()=>{const v=await fetch("/api/admin/app-settings",{credentials:"include"});if(!v.ok)throw new Error("Failed to load settings");return v.json()}}),{data:s,refetch:r}=ds({queryKey:["/api/admin/system-health"],queryFn:async()=>{const v=await fetch("/api/admin/system-health",{credentials:"include"});if(!v.ok)throw new Error("Failed to load health");return v.json()}}),{data:i}=ds({queryKey:["/api/admin/team"],queryFn:async()=>{const v=await fetch("/api/admin/team",{credentials:"include"});if(!v.ok)throw new Error("Failed to load team");return v.json()}}),[a,l]=j.useState(null),d=j.useRef(null),u=Mt({mutationFn:async({section:v,value:k})=>{const N=await fetch("/api/admin/app-settings",{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({section:v,value:k})});if(!N.ok)throw new Error((await N.json()).error||"Save failed");return N.json()},onSuccess:(v,k)=>{l(`Saved ${cZ(k.section)}`),d.current&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>l(null),1800),Wt.invalidateQueries({queryKey:["/api/admin/app-settings"]})}}),m=j.useRef({}),[p,x]=j.useState("company");if(j.useEffect(()=>{const v=zT.map(N=>N.id),k=new IntersectionObserver(N=>{const S=N.filter(A=>A.isIntersecting).sort((A,E)=>E.intersectionRatio-A.intersectionRatio);S[0]&&x(S[0].target.id)},{rootMargin:"-80px 0px -60% 0px",threshold:[0,.25,.5,1]});return v.forEach(N=>{const S=m.current[N];S&&k.observe(S)}),()=>k.disconnect()},[t]),e||!t)return n.jsx("div",{className:"p-8 text-warm-gray text-[13px]",children:"Loading…"});const g=t.settings,b=t.plans;return n.jsxs("div",{className:"flex h-full",children:[n.jsxs("aside",{className:"w-[200px] shrink-0 border-r border-[#e7e3d9] bg-[#fafaf6] p-4 sticky top-0 self-start max-h-screen overflow-y-auto",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-wide text-warm-gray font-bold mb-3",children:"Settings"}),n.jsx("nav",{className:"space-y-0.5",children:zT.map(v=>n.jsx("button",{onClick:()=>m.current[v.id]?.scrollIntoView({behavior:"smooth",block:"start"}),className:`w-full text-left px-2 py-1.5 rounded text-[12px] ${p===v.id?"bg-[#f0ece2] text-ink font-semibold":"text-warm-gray hover:bg-[#f0ece2] hover:text-ink"}`,"data-testid":`nav-section-${v.id}`,children:v.label},v.id))})]}),n.jsxs("div",{className:"flex-1 min-w-0 px-8 py-8 max-w-3xl",children:[n.jsxs("div",{className:"flex items-start justify-between mb-6",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] uppercase tracking-wide text-warm-gray font-semibold",children:"Admin"}),n.jsx("h1",{className:"font-serif text-2xl text-ink mt-1",children:"App Settings"}),n.jsx("p",{className:"text-[13px] text-warm-gray mt-1",children:"Application-wide configuration. Changes save on blur."})]}),a&&n.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] text-emerald-700 bg-emerald-50 border border-emerald-200 px-3 py-1.5 rounded-full","data-testid":"text-saved-flash",children:[n.jsx(db,{className:"w-3.5 h-3.5"})," ",a]})]}),n.jsxs("div",{className:"space-y-6",children:[n.jsx(Wa,{id:"company",title:"Company & Branding",description:"Used in outbound emails, invoices, and the public site.",innerRef:v=>m.current.company=v,children:n.jsx(dZ,{value:g["app:company"],onSave:v=>u.mutate({section:"app:company",value:v})})}),n.jsx(Wa,{id:"signup",title:"Signup & Access",description:"Controls how new self-service customers can sign themselves up.",innerRef:v=>m.current.signup=v,children:n.jsx(uZ,{value:g["app:signup"],plans:b,team:i?.members||[],onSave:v=>u.mutate({section:"app:signup",value:v})})}),n.jsx(Wa,{id:"plans",title:"Plans & Billing",description:"Plans available at signup. Edit prices in Stripe; this view is read-only.",innerRef:v=>m.current.plans=v,children:n.jsx(hZ,{plans:b,stripeOk:s?.checks.find(v=>
387v.name==="Stripe")?.ok||!1})}),n.jsx(Wa,{id:"billing-gate",title:"Billing Allowlist",description:"When ON, only the listed emails can complete a Stripe checkout. Use this to safely test live billing in production without exposing it to clients.",innerRef:v=>m.current["billing-gate"]=v,children:n.jsx(bZ,{value:g["app:billing"]||{allowlistEnabled:!1,allowedEmails:[]},onSave:v=>u.mutate({section:"app:billing",value:v})})}),n.jsx(Wa,{id:"slack",title:"Slack Integration",description:"Paste an incoming webhook URL and send a test ping to verify it works.",innerRef:v=>m.current.slack=v,children:n.jsx(mZ,{value:g["app:notifications"],onSave:v=>u.mutate({section:"app:notifications",value:v})})}),n.jsx(Wa,{id:"notifications",title:"Notifications Routing",description:"Where to send each event class. Slack uses the webhook configured above.",innerRef:v=>m.current.notifications=v,children:n.jsx(xZ,{value:g["app:notifications"],onSave:v=>u.mutate({section:"app:notifications",value:v})})}),n.jsx(Wa,{id:"team",title:"Team Management",description:"Edit each member's Slack user ID (e.g. U0123456789) so the app can @-mention them.",innerRef:v=>m.current.team=v,children:n.jsx(pZ,{members:i?.members||[]})}),n.jsx(Wa,{id:"health",title:"System Health",description:"Live status of integrations and storage. Reads only.",innerRef:v=>m.current.health=v,children:n.jsx(gZ,{checks:s?.checks||[],onRefresh:()=>r()})}),n.jsx(Wa,{id:"soon",title:"Coming Soon",description:"Upcoming sections. Tell us which to ship next.",innerRef:v=>m.current.soon=v,children:n.jsxs("ul",{className:"text-[13px] text-warm-gray space-y-1.5",children:[n.jsx("li",{children:"• AWS Environment Defaults"}),n.jsx("li",{children:"• Public Chatbot Configuration"}),n.jsx("li",{children:"• AI / OpenAI Model Settings"}),n.jsx("li",{children:"• Workflow Capture Defaults (audio retention, max length)"}),n.jsx("li",{children:"• Lifecycle Email Sequences"}),n.jsx("li",{children:"• Email Templates (centralized library)"}),n.jsx("li",{children:"• Internal Digest"}),n.jsx("li",{children:"• Legal & Compliance Links"}),n.jsx("li",{children:"• Audit Log"})]})})]})]})]})}function cZ(t){return t==="app:company"?"company info":t==="app:signup"?"signup settings":t==="app:notifications"?"notifications":t==="app:billing"?"billing allowlist":"settings"}function Wa({id:t,title:e,description:s,children:r,innerRef:i}){return n.jsxs("div",{id:t,ref:i,className:"bg-white border border-[#e7e3d9] rounded-xl scroll-mt-6",children:[n.jsxs("div",{className:"px-6 py-4 border-b border-[#f0ece2]",children:[n.jsx("h2",{className:"font-serif text-lg text-ink",children:e}),n.jsx("p",{className:"text-[12px] text-warm-gray mt-0.5",children:s})]}),n.jsx("div",{className:"p-6",children:r})]})}function ta({label:t,hint:e,children:s,full:r}){return n.jsxs("label",{className:`block ${r?"sm:col-span-2":""}`,children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:t}),s,e&&n.jsx("div",{className:"text-[11px] text-warm-gray mt-1",children:e})]})}const Ni="w-full bg-white border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark";function dZ({value:t,onSave:e}){const[s,r]=j.useState(t);j.useEffect(()=>r(t),[t]);const i=()=>{JSON.stringify(s)!==JSON.stringify(t)&&e(s)};return n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsx(ta,{label:"Company name",children:n.jsx("input",{className:Ni,value:s.name,onChange:a=>r({...s,name:a.target.value}),onBlur:i,"data-testid":"input-company-name"})}),n.jsx(ta,{label:"Reply-to email",children:n.jsx("input",{type:"email",className:Ni,value:s.email,onChange:a=>r({...s,email:a.target.value}),onBlur:i,"data-testid":"input-company-email"})}),n.jsx(ta,{label:"Mailing address",full:!0,children:n.jsx("textarea",{className:Ni,rows:2,value:s.address,onChange:a=>r({...s,address:a.target.value}),onBlur:i,"data-testid":"input-company-address"})}),n.jsx(ta,{label:"Primary brand color",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"color",value:s.primaryColor,onChange:a=>r({...s,primaryColor:a.target.value}),onBlur:i,className:"w-10 h-9 border border-[#e7e3d9] rounded","data-testid":"input-company-color"}),n.jsx("input",{className:Ni,value:s.primaryColor,onChange:a=>r({...s,primaryColor:a.target.value}),onBlur:i})]})}),n.jsx(ta,{label:"Logo URL",hint:"Public URL to your logo (PNG/SVG)",children:n.jsx("input",{className:Ni,value:s.logoUrl,onChange:a=>r({...s,logoUrl:a.target.value}),onBlur:i,placeholder:"https://…","data-testid":"input-company-logo"})})]})}function uZ({value:t,plans:e,team:s,onSave:r}){const[i,a]=j.useState(t);j.useEffect(()=>a(t),[t]);const l=()=>{JSON.stringify(i)!==JSON.stringify(t)&&r(i)},d=j.useMemo(()=>s.filter(u=>u.isActive===1),[s]);return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsx(b1,{label:"Self
387-service signup",desc:"When off, the public signup form is hidden.",checked:i.enabled,onChange:u=>{const m={...i,enabled:u};a(m),r(m)},testId:"toggle-signup-enabled"}),n.jsx(b1,{label:"Require email verification",desc:"New accounts must confirm their email before logging in.",checked:i.requireEmailVerify,onChange:u=>{const m={...i,requireEmailVerify:u};a(m),r(m)},testId:"toggle-signup-verify"})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n.jsx(ta,{label:"Allowed email domains",hint:"Comma-separated. Blank = allow any.",children:n.jsx("input",{className:Ni,value:i.allowedDomains,onChange:u=>a({...i,allowedDomains:u.target.value}),onBlur:l,placeholder:"acme.com, example.org","data-testid":"input-signup-domains"})}),n.jsx(ta,{label:"Default plan",children:n.jsx("select",{className:Ni,value:i.defaultPlan,onChange:u=>{const m={...i,defaultPlan:u.target.value};a(m),r(m)},"data-testid":"select-signup-plan",children:e.map(u=>n.jsx("option",{value:u.key,children:u.label},u.key))})}),n.jsx(ta,{label:"Auto-assigned owner",hint:"Team member who owns new self-service signups.",children:n.jsxs("select",{className:Ni,value:i.defaultOwnerId,onChange:u=>{const m={...i,defaultOwnerId:u.target.value};a(m),r(m)},"data-testid":"select-signup-owner",children:[n.jsx("option",{value:"",children:"— Unassigned —"}),d.map(u=>n.jsx("option",{value:u.id,children:u.name},u.id))]})})]})]})}function hZ({plans:t,stripeOk:e}){return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:`text-[12px] px-3 py-2 rounded-lg border ${e?"bg-emerald-50 border-emerald-200 text-emerald-800":"bg-amber-50 border-amber-200 text-amber-800"}`,children:["Stripe: ",e?"Connected":"Not connected — set STRIPE_ENABLED and STRIPE_SECRET_KEY"]}),n.jsx("div",{className:"border border-[#e7e3d9] rounded-lg overflow-hidden",children:n.jsxs("table",{className:"w-full text-[13px]",children:[n.jsx("thead",{className:"bg-[#fafaf6] text-warm-gray",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Plan"}),n.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Key"}),n.jsx("th",{className:"text-right px-3 py-2 font-semibold",children:"Monthly price"})]})}),n.jsx("tbody",{children:t.map(s=>n.jsxs("tr",{className:"border-t border-[#f0ece2]",children:[n.jsx("td",{className:"px-3 py-2 font-semibold text-ink",children:s.label}),n.jsx("td",{className:"px-3 py-2 text-warm-gray font-mono text-[12px]",children:s.key}),n.jsx("td",{className:"px-3 py-2 text-right text-ink",children:s.price===null?"Custom":`$${s.price}`})]},s.key))})]})})]})}function mZ({value:t,onSave:e}){const[s,r]=j.useState(t);j.useEffect(()=>r(t),[t]);const[i,a]=j.useState({status:"idle"}),l=()=>{(s.slackWebhookUrl||"")!==(t.slackWebhookUrl||"")&&e({slackWebhookUrl:s.slackWebhookUrl})},d=async()=>{a({status:"loading"});try{const u=await fetch("/api/admin/slack/test",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({webhookUrl:s.slackWebhookUrl})}),m=await u.json().catch(()=>({}));if(!u.ok)throw new Error(m?.error||`Request failed (${u.status})`);a({status:"ok",message:"Test message sent."})}catch(u){a({status:"error",message:u?.message||"Failed to send test."})}window.setTimeout(()=>a({status:"idle"}),4e3)};return n.jsxs("div",{className:"space-y-4",children:[n.jsx(ta,{label:"Webhook URL",hint:"Leave blank to disable Slack notifications globally.",children:n.jsx("input",{className:Ni,value:s.slackWebhookUrl,onChange:u=>r({...s,slackWebhookUrl:u.target.value}),onBlur:l,placeholder:"https://hooks.slack.com/services/…","data-testid":"input-slack-webhook"})}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{type:"button",onClick:d,disabled:i.status==="loading"||!s.slackWebhookUrl,className:"text-[12px] px-3 py-1.5 rounded-lg border border-[#e7e3d9] bg-white hover:bg-[#fafaf6] text-ink disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"button-test-slack",children:i.status==="loading"?"Sending…":"Test Webhook"}),i.status==="ok"&&n.jsxs("span",{className:"text-[12px] text-emerald-700 flex items-center gap-1.5","data-testid":"text-slack-test-ok",children:[n.jsx(db,{className:"w-3.5 h-3.5"})," ",i.message]}),i.status==="error"&&n.jsxs("span",{className:"text-[12px] text-red-700 flex items-center gap-1.5","data-testid":"text-slack-test-error",children:[n.jsx(oi,{className:"w-3.5 h-3.5"})," ",i.message]})]})]})}function pZ({members:t}){return n.jsx("div",{className:"border border-[#e7e3d9] rounded-lg overflow-hidden",children:n.jsxs("table",{className:"w-full text-[13px]",children:[n.jsx("thead",{className:"bg-[#fafaf6] text-warm-gray",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Name"}),n.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Email"}),n.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Role"}),n.jsx("th",{className:"text-left px-3 py-2 font-semibold w-44",children:"Slack"}),n.jsx("th",{className:"text-center px-3 py-2 font-semibold w-24",children:"Status"})]})}),n.jsxs("tbody",{children:[t.length===0&&n.jsx("tr",{children:n.jsx("td",{colSpan:5,className:"px-3 py-6 text-center text-warm-gray",children:"No team members."})}),t.map(e=>n.jsx(fZ,{member:e},e.id))]})]})})}function fZ({member:t}){const[e,s]=j.useState(t.slackHandle||""),[r,i]=j.useState(t.isActive===1),[a,l]=j.useState(null);j.useEffect(()=>{s(t.slackHandle||""),i(t.isActive===1)},[t.id,t.slackHandle,t.isActive]);const d=async p=>{try{const x=await fetch(`/api/admin/team/${t.id}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!x.ok)throw new Error((await x.json().catch(()=>({}))).error||"Save failed");l(null),Wt.invalidateQueries({queryKey:["/api/admin/team"]})}catch(x){l(x?.message||"Save failed")}},u=()=>{const p=e.trim();p!==(t.slackHandle||"")&&d({slackHandle:p})},m=async()=>{const p=r,x=!p;i(x);try{const g=await fetch(`/api/admin/team/${t.id}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:x})});if(!g.ok)throw new Error((await g.json().catch(()=>({}))).error||"Save failed");l(null),Wt.invalidateQueries({queryKey:["/api/admin/team"]})}catch(g){i(p),l(g?.message||"Save failed")}};return n.jsxs("tr",{className:"border-t border-[#f0ece2]",children:[n.jsx("td",{className:"px-3 py-2 font-semibold text-ink",children:t.name}),n.jsx("td",{className:"px-3 py-2 text-warm-gray",children:t.email}),n.jsx("td",{className:"px-3 py-2 text-warm-gray",children:t.role||"—"}),n.jsxs("td",{className:"px-3 py-2",children:[n.jsx("input",{className:Ni+" font-mono text-[12px]",value:e,onCh
387ange:p=>s(p.target.value),onBlur:u,placeholder:"U0123456789","data-testid":`input-slack-handle-${t.id}`}),a&&n.jsx("div",{className:"text-[11px] text-red-700 mt-1",children:a})]}),n.jsx("td",{className:"text-center px-3 py-2",children:n.jsx("button",{type:"button",onClick:m,className:`text-[11px] font-semibold px-2.5 py-1 rounded-full border ${r?"bg-emerald-50 border-emerald-200 text-emerald-700":"bg-warm-gray/10 border-warm-gray/20 text-warm-gray"}`,"data-testid":`button-team-active-${t.id}`,children:r?"Active":"Inactive"})})]})}function xZ({value:t,onSave:e}){const[s,r]=j.useState(t);j.useEffect(()=>r(t),[t]);const i=(a,l,d)=>{const u={...s.routes,[a]:{...s.routes[a],[l]:d}};r({...s,routes:u}),e({routes:u})};return n.jsx("div",{className:"space-y-5",children:n.jsx("div",{className:"border border-[#e7e3d9] rounded-lg overflow-hidden",children:n.jsxs("table",{className:"w-full text-[13px]",children:[n.jsx("thead",{className:"bg-[#fafaf6] text-warm-gray",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Event"}),n.jsx("th",{className:"text-center px-3 py-2 font-semibold w-20",children:"Slack"}),n.jsx("th",{className:"text-center px-3 py-2 font-semibold w-20",children:"Email"})]})}),n.jsx("tbody",{children:oZ.map(a=>{const l=s.routes[a.key]||{slack:!1,email:!1};return n.jsxs("tr",{className:"border-t border-[#f0ece2]",children:[n.jsxs("td",{className:"px-3 py-2",children:[n.jsx("div",{className:"font-semibold text-ink",children:a.label}),n.jsx("div",{className:"text-[11px] text-warm-gray",children:a.desc})]}),n.jsx("td",{className:"text-center px-3 py-2",children:n.jsx("input",{type:"checkbox",checked:l.slack,onChange:d=>i(a.key,"slack",d.target.checked),className:"w-4 h-4 accent-olive-dark","data-testid":`checkbox-${a.key}-slack`})}),n.jsx("td",{className:"text-center px-3 py-2",children:n.jsx("input",{type:"checkbox",checked:l.email,onChange:d=>i(a.key,"email",d.target.checked),className:"w-4 h-4 accent-olive-dark","data-testid":`checkbox-${a.key}-email`})})]},a.key)})})]})})})}function gZ({checks:t,onRefresh:e}){return n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"flex justify-end",children:n.jsxs("button",{onClick:e,className:"text-[12px] text-warm-gray hover:text-ink flex items-center gap-1","data-testid":"button-refresh-health",children:[n.jsx(Xh,{className:"w-3 h-3"})," Refresh"]})}),n.jsxs("div",{className:"border border-[#e7e3d9] rounded-lg divide-y divide-[#f0ece2]",children:[t.length===0&&n.jsx("div",{className:"p-4 text-[13px] text-warm-gray",children:"Loading…"}),t.map(s=>n.jsxs("div",{className:"flex items-center justify-between px-4 py-3","data-testid":`health-${s.name.toLowerCase().replace(/\s+/g,"-")}`,children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${s.ok?"bg-emerald-500":"bg-red-500"}`}),n.jsxs("div",{children:[n.jsx("div",{className:"font-semibold text-ink text-[13px]",children:s.name}),s.detail&&n.jsx("div",{className:"text-[11px] text-warm-gray",children:s.detail})]})]}),!s.ok&&n.jsx(oi,{className:"w-4 h-4 text-amber-500"})]},s.name))]})]})}function bZ({value:t,onSave:e}){const[s,r]=j.useState(t),[i,a]=j.useState((t.allowedEmails||[]).join(`
388`));j.useEffect(()=>{r(t),a((t.allowedEmails||[]).join(`
389`))},[t]);const l=p=>p.split(/[\s,;]+/).map(x=>x.trim().toLowerCase()).filter(x=>x.includes("@")),d=()=>{const p=l(i),x={...s,allowedEmails:p};JSON.stringify(p)!==JSON.stringify(t.allowedEmails||[])&&(r(x),e(x))},u=l(i),m=s.allowlistEnabled&&u.length===0;return n.jsxs("div",{className:"space-y-4",children:[n.jsx(b1,{label:"Billing allowlist enabled",desc:"When ON, only the emails listed below can complete a Stripe checkout. Everyone else sees a maintenance message.",checked:s.allowlistEnabled,onChange:p=>{const x={...s,allowlistEnabled:p,allowedEmails:l(i)};r(x),e(x)},testId:"toggle-billing-allowlist"}),s.allowlistEnabled&&n.jsx("div",{className:`text-[12px] px-3 py-2 rounded-lg border ${m?"bg-amber-50 border-amber-200 text-amber-800":"bg-emerald-50 border-emerald-200 text-emerald-800"}`,children:m?n.jsxs(n.Fragment,{children:["⚠️ Allowlist is ON but empty — ",n.jsx("strong",{children:"nobody"})," can complete a checkout right now. Add at least one email below."]}):n.jsxs(n.Fragment,{children:["🔒 Allowlist active — only ",u.length," email",u.length===1?"":"s"," can complete a checkout. All other clients are blocked."]})}),n.jsx(ta,{label:"Allowed emails",hint:"One per line, or comma-separated. Match is case-insensitive on the contact's portal email.",children:n.jsx("textarea",{className:Ni+" font-mono text-[12px]",rows:5,value:i,onChange:p=>
389a(p.target.value),onBlur:d,placeholder:`[email protected]
390[email protected]`,"data-testid":"input-billing-allowed-emails"})}),n.jsxs("div",{className:"text-[11px] text-warm-gray border-l-2 border-[#e7e3d9] pl-3",children:[n.jsx("strong",{children:"How to use:"})," turn this ON before publishing → log in to the portal as one of the allowed emails → click upgrade and run a real Stripe checkout (you'll be charged real money — refund yourself in the Stripe dashboard) → turn it OFF when you're done testing to open billing to all clients."]})]})}function b1({label:t,desc:e,checked:s,onChange:r,testId:i}){return n.jsxs("div",{className:"flex items-start justify-between gap-3 px-3 py-2 border border-[#e7e3d9] rounded-lg bg-[#fafaf6]",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[13px] font-semibold text-ink",children:t}),n.jsx("div",{className:"text-[11px] text-warm-gray",children:e})]}),n.jsx("button",{type:"button",role:"switch","aria-checked":s,onClick:()=>r(!s),className:`relative shrink-0 w-9 h-5 rounded-full transition-colors ${s?"bg-olive-dark":"bg-warm-gray/30"}`,"data-testid":i,children:n.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${s?"translate-x-4":""}`})})]})}function yZ(t){return t==="audio"?BA:t==="script"?zA:t==="workflow"?tM:t==="client_upload"||t==="upload"?WA:Mi}function VT(t){switch(t){case"audio":return"Audio";case"script":return"Script";case"workflow":return"Workflow";case"client_upload":return"Client Upload";case"upload":return"Upload";case"sop":return"Script";case"checklist":return"Checklist";case"process_guide":return"Process Guide";case"reference":return"Reference";case"training":return"Training";case"policy":return"Policy";case"other":return"Other";default:return t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}}function vZ(t){return!t||t<=0?null:t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`}function wZ(t){return t?new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):"—"}function jZ(){const t=nj(),s=new URLSearchParams(t).get("clientId")||"",[r,i]=j.useState(""),[a,l]=j.useState(""),d=s,{data:u,isLoading:m}=ds({queryKey:["/api/admin/documents",{clientId:d,q:r,type:a}],queryFn:async()=>{const b=new URLSearchParams;d&&b.set("clientId",d),r&&b.set("q",r),a&&b.set("type",a);const v=await fetch(`/api/admin/documents?${b.toString()}`,{credentials:"include"});if(!v.ok)throw new Error("Failed to load documents");return v.json()}}),p=u?.documents||[],x=u?.types||[],g=j.useMemo(()=>d?p[0]?.clientName||d:null,[d,p]);return n.jsxs("div",{className:"px-8 py-8 max-w-[1200px]",children:[n.jsxs("div",{className:"mb-6",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-wide text-warm-gray font-semibold",children:"Library"}),n.jsx("h1",{className:"font-serif text-2xl text-ink mt-1",children:"Documents"}),n.jsx("p",{className:"text-[13px] text-warm-gray mt-1",children:d?n.jsxs(n.Fragment,{children:["All documents for ",n.jsx("span",{className:"font-semibold text-ink",children:g})," · ",n.jsx(Ae,{href:"/admin/documents",className:"underline",children:"clear filter"})]}):"All client uploads, system-generated workflow exports, and audio recordings."})]}),n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-3 mb-4 flex flex-wrap items-center gap-2",children:[n.jsxs("div",{className:"relative flex-1 min-w-[220px]",children:[n.jsx(YA,{className:"w-3.5 h-3.5 text-warm-gray absolute left-3 top-1/2 -translate-y-1/2"}),n.jsx("input",{value:r,onChange:b=>i(b.target.value),placeholder:"Search title or client…",className:"w-full bg-[#f7f5f0] border border-[#e7e3d9] rounded-lg pl-9 pr-3 py-1.5 text-[13px] outline-none focus:ring-2 focus:ring-olive-dark/20 focus:border-olive-dark","data-testid":"input-documents-search"})]}),n.jsxs("select",{value:a,onChange:b=>l(b.target.value),className:"bg-white border border-[#e7e3d9] rounded-lg px-3 py-1.5 text-[13px] outline-none","data-testid":"select-documents-type",children:[n.jsx("option",{value:"",children:"All types"}),x.map(b=>n.jsx("option",{value:b,children:VT(b)},b))]}),n.jsx("div",{className:"text-[12px] text-warm-gray ml-auto","data-testid":"text-documents-count",children:m?"Loading…":`${p.length} document${p.length===1?"":"s"}`})]}),n.jsx("div",{className:"bg-white border border-[#e7e3d9] rounded-xl overflow-hidden",children:n.jsxs("table",{className:"w-full text-[13px]",children:[n.jsx("thead",{className:"bg-[#fafaf6] text-warm-gray",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left px-4 py-2.5 font-semibold w-[160px]",children:"Type"}),n.jsx("th",{className:"text-left px-4 py-2.5 font-semibold w-[200px]",children:"Client"}),n.jsx("th",{className:"text-left px-4 py-2.5 font-semibold",children:"Title"}),n.jsx("th",{className:"text-left px-4 py-2.5 font-semibold w-[120px]",children:"Date"}),n.jsx("th",{className:"text-right px-4 py-2.5 font-semibold w-[220px]",children:"Actions"})]})}),n.jsxs("tbody",{children:[!m&&p.length===0&&n.jsx("tr",{children:n.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-warm-gray text-[13px]",children:"No documents match your filters."})}),p.map(b=>{const v=yZ(b.type),k=vZ(b.sizeBytes);return n.jsxs("tr",{className:"border-t border-[#f0ece2] hover:bg-[#fafaf6]","data-testid":`row-document-${b.id}`,children:[n.jsx("td",{className:"px-4 py-2.5",children:n.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-[#f0ece2] text-[11px] font-semibold text-ink",children:[n.jsx(v,{className:"w-3 h-3"}),VT(b.type)]})}),n.jsx("td",{className:"px-4 py-2.5",children:n.jsxs(Ae,{href:`/admin/clients/${b.clientId}`,className:"inline-flex items-center gap-1 text-ink hover:text-olive-dark hover:underline",children:[n.jsx(PA,{className:"w-3 h-3 text-warm-gray"}),b.clientName]})}),n.jsxs("td",{className:"px-4 py-2.5",children:[n.jsx("div",{className:"text-ink",children:b.title}),k&&n.jsx("div",{className:"text-[11px] text-warm-gray",children:k})]}),n.jsx("td",{className:"px-4 py-2.5 text-warm-gray",children:wZ(b.createdAt)}),n.jsx("td",{className:"px-4 py-2.5",children:n.jsx("div",{className:"flex items-center justify-end gap-1.5",children:b.kind==="sop_workflow"?n.jsxs(n.Fragment,{children:[b.viewUrl&&n.jsxs(Ae,{href:b.viewUrl,className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`link-view-${b.id}`,children:[n.jsx(Ix,{className:"w-3 h-3"})," Open"]}),b.exportUrls&&n.jsxs(n.Fragment,{children:[n.jsxs("a",{href:b.exportUrls.pdf,className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`link-export-pdf-${b.id}`,children:[n.jsx(na,{className:"w-3 h-3"})," PDF"]}),n.jsxs("a",{href:b.exportUrls.markdown,className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`link-export-md-${b.id}`,children:[n.jsx(na,{className:"w-3 h-3"})," MD"]})]})]}):n.jsxs(n.Fragment,{children:[b.viewUrl&&n.jsxs("a",{href:b.viewUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`link-view-${b.id}`,children:[n.jsx(Px,{className:"w-3 h-3"})," View"]}),b.downloadUrl&&n.jsxs("a",{href:b.downloadUrl,className:"inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded-md border border-[#e7e3d9] text-warm-gray hover:bg-[#f7f5f0] hover:text-ink","data-testid":`link-download-${b.id}`,children:[n.jsx(na,{className:"w-3 h-3"})," Download"]})]})})})]},b.id)})]})]})})]})}const{entries:SR,setPrototypeOf:FT,isFrozen:NZ,getPrototypeOf:kZ,getOwnPropertyDescriptor:SZ}=Object;let{freeze:er,seal:ui,create:Kd}=Object,{apply:y1,construct:v1}=typeof Reflect<"u"&&Reflect;er||(er=function(e){return e});ui||(ui=function(e){return e});y1||(y1=function(e,s){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a];return e.apply(s,i)});v1||(v1=function(e){for(var s=arguments.length,r=new Array(s>1?s-1:0),i=1;i<s;i++)r[i-1]=arguments[i];return new e(...r)});const Ih=qs(Array.prototype.forEach),CZ=qs(Array.prototype.lastIndexOf),UT=qs(Array.prototype.pop),Lh=qs(Array.prototype.push),TZ=qs(Array.prototype.splice),Wn=Array.isArray,qh=qs(String.prototype.toLowerCase),Rv=qs(String.prototype.toString),HT=qs(String.prototype.match),Vd=qs(String.prototype.replace),qT=qs(String.prototype.indexOf),EZ=qs(String.prototype.trim),AZ=qs(Number.prototype.toString),MZ=qs(Boolean.prototype.toString),WT=typeof BigInt>"u"?null:qs(BigInt.prototype.toString),GT=typeof Symbol>"u"?null:qs(Symbol.prototype.toString),Cs=qs(Object.prototype.hasOwnProperty),$h=qs(Object.prototype.toString),bn=qs(RegExp.prototype.test),Jf=_Z(TypeError);function qs(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var s=arguments.length,r=new Array(s>1?s-1:0),i=1;i<s;i++)r[i-1]=arguments[i];return y1(t,e,r)}}function _Z(t){return function(){for(var e=arguments.length,s=new Array(e),r=0;r<e;r++)s[r]=arguments[r];return v1(t,s)}}function pt(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qh;if(FT&&FT(t,null),!Wn(e))return t;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const a=s(i);a!==i&&(NZ(e)||(e[r]=a),i=a)}t[i]=!0}return t}function OZ(t){for(let e=0;e<t.length;e++)Cs(t,e)||(t[e]=null);return t}function ur(t){const e=Kd(null);for(const[s,r]of SR(t))Cs(t,s)&&(Wn(r)?e[s]=OZ(r):r&&typeof r=="object"&&r.constructor===Object?e[s]=ur(r):e[s]=r);return e}function RZ(t){switch(typeof t){case"string":return t;case"number":return AZ(t);case"boolean":return MZ(t);case"bigint":return WT?WT(t):"0";case"symbol":return GT?GT(t):"Symbol()";case"undefined":return $h(t);case"function":case"object":{if(t===null)return $h(t);const e=t,s=Yd(e,"toString");if(typeof s=="function"){const r=s(e);return typeof r=="string"?r:$h(r)}return $h(t)}default:return $h(t)}}function Yd(t,e){for(;t!==null;){const r=SZ(t,e);if(r){if(r.get)return qs(r.get);if(typeof r.value=="function")return qs(r.value)}t=kZ(t)}function s(){return null}return s}function DZ(t){try{return bn(t,""),!0}catch{return!1}}const KT=er(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Dv=er(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Pv=er(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),PZ=er(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Iv=er(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),IZ=er(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),YT=er(["#text"]),QT=er(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","
390spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Lv=er(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),JT=er(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Xf=er(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),LZ=ui(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$Z=ui(/<%[\w\W]*|[\w\W]*%>/gm),BZ=ui(/\$\{[\w\W]*/gm),zZ=ui(/^data-[\-\w.\u00B7-\uFFFF]+$/),VZ=ui(/^aria-[\-\w]+$/),CR=ui(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),FZ=ui(/^(?:\w+script|data):/i),UZ=ui(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),TR=ui(/^html$/i),HZ=ui(/^[a-z][.\w]*(-[.\w]+)+$/i);var XT=Object.freeze({__proto__:null,ARIA_ATTR:VZ,ATTR_WHITESPACE:UZ,CUSTOM_ELEMENT:HZ,DATA_ATTR:zZ,DOCTYPE_NAME:TR,ERB_EXPR:$Z,IS_ALLOWED_URI:CR,IS_SCRIPT_OR_DATA:FZ,MUSTACHE_EXPR:LZ,TMPLIT_EXPR:BZ});const Bh={element:1,text:3,progressingInstruction:7,comment:8,document:9},qZ=function(){return typeof window>"u"?null:window},WZ=function(e,s){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;
vendor: 4,682 bytes, line 390
390const i="data-tt-policy-suffix";s&&s.hasAttribute(i)&&(r=s.getAttribute(i));const a="dompurify"+(r?"#"+r:"");try{return e.createPolicy(a,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},ZT=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ER(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qZ();const e=Ue=>ER(Ue);if(e.version="3.4.2",e.removed=[],!t||!t.document||t.document.nodeType!==Bh.document||!t.Element)return e.isSupported=!1,e;let{document:s}=t;const r=s,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:l,Node:d,Element:u,NodeFilter:m,NamedNodeMap:p=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:x,DOMParser:g,trustedTypes:b}=t,v=u.prototype,k=Yd(v,"cloneNode"),N=Yd(v,"remove"),S=Yd(v,"nextSibling"),A=Yd(v,"childNodes"),E=Yd(v,"parentNode");if(typeof l=="function"){const Ue=s.createElement("template");Ue.content&&Ue.content.ownerDocument&&(s=Ue.content.ownerDocument)}let _,T="";const{implementation:$,createNodeIterator:L,createDocumentFragment:M,getElementsByTagName:I}=s,{importNode:z}=r;let ae=ZT();e.isSupported=typeof SR=="function"&&typeof E=="function"&&$&&$.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:U,ERB_EXPR:Y,TMPLIT_EXPR:P,DATA_ATTR:ne,ARIA_ATTR:q,IS_SCRIPT_OR_DATA:W,ATTR_WHITESPACE:ie,CUSTOM_ELEMENT:he}=XT;let{IS_ALLOWED_URI:se}=XT,B=null;const le=pt({},[...KT,...Dv,...Pv,...Iv,...YT]);let pe=null;const Oe=pt({},[...QT,...Lv,...JT,...Xf]);let Se=Object.seal(Kd(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),D=null,V=null;const ge=Object.seal(Kd(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ue=!0,Me=!0,We=!1,_e=!0,Re=!1,ze=!0,Fe=!1,Kt=!1,us=!1,ht=!1,is=!1,Yt=!1,un=!0,Di=!1;const Il="user-content-";let js=!0,Pi=!1,nr={},Tn=null;const xr=pt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ll=null;const pa=pt({},["audio","video","img","source","image","track"]);let Ii=null;const Vn=pt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ks="http://www.w3.org/1998/Math/MathML",we="http://www.w3.org/2000/svg",Rs="http://www.w3.org/1999/xhtml";let Zt=Rs,$l=!1,fa=null;const Pu=pt({},[Ks,we,Rs],Rv);let Li=pt({},["mi","mo","mn","ms","mtext"]),gr=pt({},["annotation-xml"]);const hs=pt({},["title","style","font","a","script"]);let Ys=null;const $r=["application/xhtml+xml","text/html"],xa="text/html";let Qt=null,Br=null;const go=s.createElement("form"),hi=function(F){return F instanceof RegExp||F instanceof Function},bo=function(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Br&&Br===F)return;(!F||typeof F!="object")&&(F={}),F=ur(F),Ys=$r.indexOf(F.PARSER_MEDIA_TYPE)===-1?xa:F.PARSER_MEDIA_TYPE,Qt=Ys==="application/xhtml+xml"?Rv:qh,B=Cs(F,"ALLOWED_TAGS")&&Wn(F.ALLOWED_TAGS)?pt({},F.ALLOWED_TAGS,Qt):le,pe=Cs(F,"ALLOWED_ATTR")&&Wn(F.ALLOWED_ATTR)?pt({},F.ALLOWED_ATTR,Qt):Oe,fa=Cs(F,"ALLOWED_NAMESPACES")&&Wn(F.ALLOWED_NAMESPACES)?pt({},F.ALLOWED_NAMESPACES,Rv):Pu,Ii=Cs(F,"ADD_URI_SAFE_ATTR")&&Wn(F.ADD_URI_SAFE_ATTR)?pt(ur(Vn),F.ADD_URI_SAFE_ATTR,Qt):Vn,Ll=Cs(F,"ADD_DATA_URI_TAGS")&&Wn(F.ADD_DATA_URI_TAGS)?pt(ur(pa),F.ADD_DATA_URI_TAGS,Qt):pa,Tn=Cs(F,"FORBID_CONTENTS")&&Wn(F.FORBID_CONTENTS)?pt({},F.FORBID_CONTENTS,Qt):xr,D=Cs(F,"FORBID_TAGS")&&Wn(F.FORBID_TAGS)?pt({},F.FORBID_TAGS,Qt):ur({}),V=Cs(F,"FORBID_ATTR")&&Wn(F.FORBID_ATTR)?pt({},F.FORBID_ATTR,Qt):ur({}),nr=Cs(F,"USE_PROFILES")?F.USE_PROFILES&&typeof F.USE_PROFILES=="object"?ur(F.USE_PROFILES):F.USE_PROFILES:!1,ue=F.ALLOW_ARIA_ATTR!==!1,Me=F.ALLOW_DATA_ATTR!==!1,We=F.ALLOW_UNKNOWN_PROTOCOLS||!1,_e=F.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Re=F.SAFE_FOR_TEMPLATES||!1,ze=F.SAFE_FOR_XML!==!1,Fe=F.WHOLE_DOCUMENT||!1,ht=F.RETURN_DOM||!1,is=F.RETURN_DOM_FRAGMENT||!1,Yt=F.RETURN_TRUSTED_TYPE||!1,us=F.FORCE_BODY||!1,un=F.SANITIZE_DOM!==!1,Di=F.SANITIZE_NAMED_PROPS||!1,js=F.KEEP_CONTENT!==!1,Pi=F.IN_PLACE||!1,se=DZ(F.ALLOWED_URI_REGEXP)?F.ALLOWED_URI_REGEXP:CR,Zt=typeof F.NAMESPACE=="str
390ing"?F.NAMESPACE:Rs,Li=Cs(F,"MATHML_TEXT_INTEGRATION_POINTS")&&F.MATHML_TEXT_INTEGRATION_POINTS&&typeof F.MATHML_TEXT_INTEGRATION_POINTS=="object"?ur(F.MATHML_TEXT_INTEGRATION_POINTS):pt({},["mi","mo","mn","ms","mtext"]),gr=Cs(F,"HTML_INTEGRATION_POINTS")&&F.HTML_INTEGRATION_POINTS&&typeof F.HTML_INTEGRATION_POINTS=="object"?ur(F.HTML_INTEGRATION_POINTS):pt({},["annotation-xml"]);const fe=Cs(F,"CUSTOM_ELEMENT_HANDLING")&&F.CUSTOM_ELEMENT_HANDLING&&typeof F.CUSTOM_ELEMENT_HANDLING=="object"?ur(F.CUSTOM_ELEMENT_HANDLING):Kd(null);if(Se=Kd(null),Cs(fe,"tagNameCheck")&&hi(fe.tagNameCheck)&&(Se.tagNameCheck=fe.tagNameCheck),Cs(fe,"attributeNameCheck")&&hi(fe.attributeNameCheck)&&(Se.attributeNameCheck=fe.attributeNameCheck),Cs(fe,"allowCustomizedBuiltInElements")&&typeof fe.allowCustomizedBuiltInElements=="boolean"&&(Se.allowCustomizedBuiltInElements=fe.allowCustomizedBuiltInElements),Re&&(Me=!1),is&&(ht=!0),nr&&(B=pt({},YT),pe=Kd(null),nr.html===!0&&(pt(B,KT),pt(pe,QT)),nr.svg===!0&&(pt(B,Dv),pt(pe,Lv),pt(pe,Xf)),nr.svgFilters===!0&&(pt(B,Pv),pt(pe,Lv),pt(pe,Xf)),nr.mathMl===!0&&(pt(B,Iv),pt(pe,JT),pt(pe,Xf))),ge.tagCheck=null,ge.attributeCheck=null,Cs(F,"ADD_TAGS")&&(typeof F.ADD_TAGS=="function"?ge.tagCheck=F.ADD_TAGS:Wn(F.ADD_TAGS)&&(B===le&&(B=ur(B)),pt(B,F.ADD_TAGS,Qt))),Cs(F,"ADD_ATTR")&&(typeof F.ADD_ATTR=="function"?ge.attributeCheck=F.ADD_ATTR:Wn(F.ADD_ATTR)&&(pe===Oe&&(pe=ur(pe)),pt(pe,F.ADD_ATTR,Qt))),Cs(F,"ADD_URI_SAFE_ATTR")&&Wn(F.ADD_URI_SAFE_ATTR)&&pt(Ii,F.ADD_URI_SAFE_ATTR,Qt),Cs(F,"FORBID_CONTENTS")&&Wn(F.FORBID_CONTENTS)&&(Tn===xr&&(Tn=ur(Tn)),pt(Tn,F.FORBID_CONTENTS,Qt)),Cs(F,"ADD_FORBID_CONTENTS")&&Wn(F.ADD_FORBID_CONTENTS)&&(Tn===xr&&(Tn=ur(Tn)),pt(Tn,F.ADD_FORBID_CONTENTS,Qt)),js&&(B["#text"]=!0),Fe&&pt(B,["html","head","body"]),B.table&&(pt(B,["tbody"]),delete D.tbody),F.TRUSTED_TYPES_POLICY){if(typeof F.TRUSTED_TYPES_POLICY.createHTML!="function")throw Jf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof F.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Jf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=F.TRUSTED_TYPES_POLICY,T=_.createHTML("")}else _===void 0&&(_=WZ(b,i)),_!==null&&typeof T=="string"&&(T=_.createHTML(""));er&&er(F),Br=F},yo=pt({},[...Dv,...Pv,...PZ]),vo=pt({},[...Iv,...IZ]),Bl=function(F){let fe=E(F);(!fe||!fe.tagName)&&(fe={namespaceURI:Zt,tagName:"template"});const Ie=qh(F.tagName),Et=qh(fe.tagName);return fa[F.namespaceURI]?F.namespaceURI===we?fe.namespaceURI===Rs?Ie==="svg":fe.namespaceURI===Ks?Ie==="svg"&&(Et==="annotation-xml"||Li[Et]):!!yo[Ie]:F.namespaceURI===Ks?fe.namespaceURI===Rs?Ie==="math":fe.namespaceURI===we?Ie==="math"&&gr[Et]:!!vo[Ie]:F.namespaceURI===Rs?fe.namespaceURI===we&&!gr[Et]||fe.namespaceURI===Ks&&!Li[Et]?!1:!vo[Ie]&&(hs[Ie]||!yo[Ie]):!!(Ys==="application/xhtml+xml"&&fa[F.namespaceURI]):!1},nn=function(F){Lh(e.removed,{element:F});try{E(F).removeChild(F)}catch{N(F)}},rr=function(F,fe){try{Lh(e.removed,{attribute:fe.getAttributeNode(F),from:fe})}catch{Lh(e.removed,{attribute:null,from:fe})}if(fe.removeAttribute(F),F==="is")if(ht||is)try{nn(fe)}catch{}else try{fe.setAttribute(F,"")}catch{}},Fn=function(F){let fe=null,Ie=null;if(us)F="<remove></remove>"+F;else{const as=HT(F,/^[\r\n\t ]+/);Ie=as&&as[0]}Ys==="application/xhtml+xml"&&Zt===Rs&&(F='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+F+"</body></html>");const Et=_?_.createHTML(F):F;if(Zt===Rs)try{fe=new g().parseFromString(Et,Ys)}catch{}if(!fe||!fe.documentElement){fe=$.createDocument(Zt,"template",null);try{fe.documentElement.innerHTML=$l?T:Et}catch{}}const lt=fe.body||fe.documentElement;return F&&Ie&&lt.insertBefore(s.createTextNode(Ie),lt.childNodes[0]||null),Zt===Rs?I.call(fe,Fe?"html":"body")[0]:Fe?fe.documentElement:lt},hn=function(F){return L.call(F.ownerDocument||F,F,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT|m.SHOW_PROCESSING_INSTRUCTION|m.SHOW_CDATA_SECTION,null)},Un=function(F){return F instanceof x&&(typeof F.nodeName!="string"||typeof F.textContent!="string"||typeof F.removeChild!="function"||!(F.attributes instanceof p)||typeof F.removeAttribute!="function"||typeof F.setAttribute!="function"||typeof F.namespaceURI!="string"||typeof F.insertBefore!="function"||typeof F.hasChildNodes!="function")},ms=function(F){return typeof d=="function"&&F instanceof d};function Jt(Ue,F,fe){Ih(Ue,Ie=>{Ie.call(e,F,fe,Br)})}const En=function(F){let fe=null;if(Jt(ae.beforeSanitizeElements,F,null),Un(F))return nn(F),!0;const Ie=Qt(F.nodeName);if(Jt(ae.uponSanitizeElement,F,{tagName:Ie,allowedTags:B}),ze&&F.hasChildNodes()&&!ms(F.firstElementChild)&&bn(/<[/\w!]/g,F.innerHTML)&&bn(/<[/\w!]/g,F.textContent)||ze&&F.namespaceURI===Rs&&Ie==="style"&&ms(F.firstElementChild)||F.nodeType===Bh.progressingInstruction||ze&&F.nodeType===Bh.comment&&bn(/<[/\w]/g,F.data))return nn(F),!0;if(D[Ie]||!(ge.tagCheck instanceof Function&&ge.tagCheck(Ie))&&!B[Ie]){if(!D[Ie]&&zl(Ie)&&(Se.tagNameCheck instanceof RegExp&&bn(Se.tagNameCheck,Ie)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(Ie)))return!1;if(js&&!Tn[Ie]){const Et=E(F)||F.parentNode,lt=A(F)||F.childNodes;if(lt&&Et){const as=lt.length;for(let fs=as-1;fs>=0;--fs){const Ut=k(lt[fs],!0);Et.insertBefore(Ut,S(F))}}}return nn(F),!0}return F instanceof u&&!Bl(F)||(Ie==="noscript"||Ie==="noembed"||Ie==="noframes")&&bn(/<\/no(script|embed|frames)/i,F.innerHTML)?(nn(F),!0):(Re&&F.nodeType===Bh.text&&(fe=F.textContent,Ih([U,Y,P],Et=>{fe=Vd(fe,Et," ")}),F.textContent!==fe&&(Lh(e.removed,{element:F.cloneNode()}),F.textContent=fe)),Jt(ae.afterSanitizeElements,F,null),!1)},ps=function(F,fe,Ie){if(V[fe]||un&&(fe==="id"||fe==="name")&&(Ie in s||Ie in go))return!1;const Et=pe[fe]||ge.attributeCheck instanceof Function&&ge.attributeCheck(fe,F);
vendor: 4,850 bytes, lines 390-391
390if(!(Me&&!V[fe]&&bn(ne,fe))){if(!(ue&&bn(q,fe))){if(!Et||V[fe]){if(!(zl(F)&&(Se.tagNameCheck instanceof RegExp&&bn(Se.tagNameCheck,F)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(F))&&(Se.attributeNameCheck instanceof RegExp&&bn(Se.attributeNameCheck,fe)||Se.attributeNameCheck instanceof Function&&Se.attributeNameCheck(fe,F))||fe==="is"&&Se.allowCustomizedBuiltInElements&&(Se.tagNameCheck instanceof RegExp&&bn(Se.tagNameCheck,Ie)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(Ie))))return!1}else if(!Ii[fe]){if(!bn(se,Vd(Ie,ie,""))){if(!((fe==="src"||fe==="xlink:href"||fe==="href")&&F!=="script"&&qT(Ie,"data:")===0&&Ll[F])){if(!(We&&!bn(W,Vd(Ie,ie,"")))){if(Ie)return!1}}}}}}return!0},$i=pt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),zl=function(F){return!$i[qh(F)]&&bn(he,F)},ga=function(F){Jt(ae.beforeSanitizeAttributes,F,null);const{attributes:fe}=F;if(!fe||Un(F))return;const Ie={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:pe,forceKeepAttr:void 0};let Et=fe.length;for(;Et--;){const lt=fe[Et],{name:as,namespaceURI:fs,value:Ut}=lt,Ds=Qt(as),wo=Ut;let xs=as==="value"?wo:EZ(wo);if(Ie.attrName=Ds,Ie.attrValue=xs,Ie.keepAttr=!0,Ie.forceKeepAttr=void 0,Jt(ae.uponSanitizeAttribute,F,Ie),xs=Ie.attrValue,Di&&(Ds==="id"||Ds==="name")&&qT(xs,Il)!==0&&(rr(as,F),xs=Il+xs),ze&&bn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,xs)){rr(as,F);continue}if(Ds==="attributename"&&HT(xs,"href")){rr(as,F);continue}if(Ie.forceKeepAttr)continue;if(!Ie.keepAttr){rr(as,F);continue}if(!_e&&bn(/\/>/i,xs)){rr(as,F);continue}Re&&Ih([U,Y,P],nd=>{xs=Vd(xs,nd," ")});const ba=Qt(F.nodeName);if(!ps(ba,Ds,xs)){rr(as,F);continue}if(_&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!fs)switch(b.getAttributeType(ba,Ds)){case"TrustedHTML":{xs=_.createHTML(xs);break}case"TrustedScriptURL":{xs=_.createScriptURL(xs);break}}if(xs!==wo)try{fs?F.setAttributeNS(fs,as,xs):F.setAttribute(as,xs),Un(F)?nn(F):UT(e.removed)}catch{rr(as,F)}}Jt(ae.afterSanitizeAttributes,F,null)},rn=function(F){let fe=null;const Ie=hn(F);for(Jt(ae.beforeSanitizeShadowDOM,F,null);fe=Ie.nextNode();)Jt(ae.uponSanitizeShadowNode,fe,null),En(fe),ga(fe),fe.content instanceof a&&rn(fe.content);Jt(ae.afterSanitizeShadowDOM,F,null)};return e.sanitize=function(Ue){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},fe=null,Ie=null,Et=null,lt=null;if($l=!Ue,$l&&(Ue="<!-->"),typeof Ue!="string"&&!ms(Ue)&&(Ue=RZ(Ue),typeof Ue!="string"))throw Jf("dirty is not a string, aborting");if(!e.isSupported)return Ue;if(Kt||bo(F),e.removed=[],typeof Ue=="string"&&(Pi=!1),Pi){const Ut=Ue.nodeName;if(typeof Ut=="string"){const Ds=Qt(Ut);if(!B[Ds]||D[Ds])throw Jf("root node is forbidden and cannot be sanitized in-place")}}else if(Ue instanceof d)fe=Fn("<!---->"),Ie=fe.ownerDocument.importNode(Ue,!0),Ie.nodeType===Bh.element&&Ie.nodeName==="BODY"||Ie.nodeName==="HTML"?fe=Ie:fe.appendChild(Ie);else{if(!ht&&!Re&&!Fe&&Ue.indexOf("<")===-1)return _&&Yt?_.createHTML(Ue):Ue;if(fe=Fn(Ue),!fe)return ht?null:Yt?T:""}fe&&us&&nn(fe.firstChild);const as=hn(Pi?Ue:fe);for(;Et=as.nextNode();)En(Et),ga(Et),Et.content instanceof a&&rn(Et.content);if(Pi)return Ue;if(ht){if(Re){fe.normalize();let Ut=fe.innerHTML;Ih([U,Y,P],Ds=>{Ut=Vd(Ut,Ds," ")}),fe.innerHTML=Ut}if(is)for(lt=M.call(fe.ownerDocument);fe.firstChild;)lt.appendChild(fe.firstChild);else lt=fe;return(pe.shadowroot||pe.shadowrootmode)&&(lt=z.call(r,lt,!0)),lt}let fs=Fe?fe.outerHTML:fe.innerHTML;return Fe&&B["!doctype"]&&fe.ownerDocument&&fe.ownerDocument.doctype&&fe.ownerDocument.doctype.name&&bn(TR,fe.ownerDocument.doctype.name)&&(fs="<!DOCTYPE "+fe.ownerDocument.doctype.name+`>
391`+fs),Re&&Ih([U,Y,P],Ut=>{fs=Vd(fs,Ut," ")}),_&&Yt?_.createHTML(fs):fs},e.setConfig=function(){let Ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};bo(Ue),Kt=!0},e.clearConfig=function(){Br=null,Kt=!1},e.isValidAttribute=function(Ue,F,fe){Br||bo({});const Ie=Qt(Ue),Et=Qt(F);return ps(Ie,Et,fe)},e.addHook=function(Ue,F){typeof F=="function"&&Lh(ae[Ue],F)},e.removeHook=function(Ue,F){if(F!==void 0){const fe=CZ(ae[Ue],F);return fe===-1?void 0:TZ(ae[Ue],fe,1)[0]}return UT(ae[Ue])},e.removeHooks=function(Ue){ae[Ue]=[]},e.removeAllHooks=function(){ae=ZT()},e}var GZ=ER();function vn(t){this.content=t}vn.prototype={constructor:vn,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,s){var r=s&&s!=t?this.remove(s):this,i=r.find(t),a=r.content.slice();return i==-1?a.push(s||t,e):(a[i+1]=e,s&&(a[i]=s)),new vn(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var s=this.content.slice();return s.splice(e,2),new vn(s)}
vendor: 9,559 bytes, line 391
391,addToStart:function(t,e){return new vn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var s=this.remove(t).content.slice();return s.push(t,e),new vn(s)},addBefore:function(t,e,s){var r=this.remove(e),i=r.content.slice(),a=r.find(t);return i.splice(a==-1?i.length:a,0,e,s),new vn(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=vn.from(t),t.size?new vn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=vn.from(t),t.size?new vn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=vn.from(t);for(var s=0;s<t.content.length;s+=2)e=e.remove(t.content[s]);return e},toObject:function(){var t={};return this.forEach(function(e,s){t[e]=s}),t},get size(){return this.content.length>>1}};vn.from=function(t){if(t instanceof vn)return t;var e=[];if(t)for(var s in t)e.push(s,t[s]);return new vn(e)};function AR(t,e,s){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:s;let i=t.child(r),a=e.child(r);if(i==a){s+=i.nodeSize;continue}if(!i.sameMarkup(a))return s;if(i.isText&&i.text!=a.text){for(let l=0;i.text[l]==a.text[l];l++)s++;return s}if(i.content.size||a.content.size){let l=AR(i.content,a.content,s+1);if(l!=null)return l}s+=i.nodeSize}}function MR(t,e,s,r){for(let i=t.childCount,a=e.childCount;;){if(i==0||a==0)return i==a?null:{a:s,b:r};let l=t.child(--i),d=e.child(--a),u=l.nodeSize;if(l==d){s-=u,r-=u;continue}if(!l.sameMarkup(d))return{a:s,b:r};if(l.isText&&l.text!=d.text){let m=0,p=Math.min(l.text.length,d.text.length);for(;m<p&&l.text[l.text.length-m-1]==d.text[d.text.length-m-1];)m++,s--,r--;return{a:s,b:r}}if(l.content.size||d.content.size){let m=MR(l.content,d.content,s-1,r-1);if(m)return m}s-=u,r-=u}}class Ne{constructor(e,s){if(this.content=e,this.size=s||0,s==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,s,r,i=0,a){for(let l=0,d=0;d<s;l++){let u=this.content[l],m=d+u.nodeSize;if(m>e&&r(u,i+d,a||null,l)!==!1&&u.content.size){let p=d+1;u.nodesBetween(Math.max(0,e-p),Math.min(u.content.size,s-p),r,i+p)}d=m}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,s,r,i){let a="",l=!0;return this.nodesBetween(e,s,(d,u)=>{let m=d.isText?d.text.slice(Math.max(e,u)-u,s-u):d.isLeaf?i?typeof i=="function"?i(d):i:d.type.spec.leafText?d.type.spec.leafText(d):"":"";d.isBlock&&(d.isLeaf&&m||d.isTextblock)&&r&&(l?l=!1:a+=r),a+=m},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let s=this.lastChild,r=e.firstChild,i=this.content.slice(),a=0;for(s.isText&&s.sameMarkup(r)&&(i[i.length-1]=s.withText(s.text+r.text),a=1);a<e.content.length;a++)i.push(e.content[a]);return new Ne(i,this.size+e.size)}cut(e,s=this.size){if(e==0&&s==this.size)return this;let r=[],i=0;if(s>e)for(let a=0,l=0;l<s;a++){let d=this.content[a],u=l+d.nodeSize;u>e&&((l<e||u>s)&&(d.isText?d=d.cut(Math.max(0,e-l),Math.min(d.text.length,s-l)):d=d.cut(Math.max(0,e-l-1),Math.min(d.content.size,s-l-1))),r.push(d),i+=d.nodeSize),l=u}return new Ne(r,i)}cutByIndex(e,s){return e==s?Ne.empty:e==0&&s==this.content.length?this:new Ne(this.content.slice(e,s))}replaceChild(e,s){let r=this.content[e];if(r==s)return this;let i=this.content.slice(),a=this.size+s.nodeSize-r.nodeSize;return i[e]=s,new Ne(i,a)}addToStart(e){return new Ne([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ne(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let s=0;s<this.content.length;s++)if(!this.content[s].eq(e.content[s]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let s=this.content[e];if(!s)throw new RangeError("Index "+e+" out of range for "+this);return s}maybeChild(e){return this.content[e]||null}forEach(e){for(let s=0,r=0;s<this.content.length;s++){let i=this.content[s];e(i,r,s),r+=i.nodeSize}}findDiffStart(e,s=0){return AR(this,e,s)}findDiffEnd(e,s=this.size,r=e.size){return MR(this,e,s,r)}findIndex(e){if(e==0)return Zf(0,e);if(e==this.size)return Zf(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let s=0,r=0;;s++){let i=this.child(s),a=r+i.nodeSize;if(a>=e)return a==e?Zf(s+1,a):Zf(s,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,s){if(!s)return Ne.empty;if(!Array.isArray(s))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ne(s.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ne.empty;let s,r=0;for(let i=0;i<e.length;i++){let a=e[i];r+=a.nodeSize,i&&a.isText&&e[i-1].sameMarkup(a)?(s||(s=e.slice(0,i)),s[s.length-1]=a.withText(s[s.length-1].text+a.text)):s&&s.push(a)}return new Ne(s||e,r)}static from(e){if(!e)return Ne.empty;if(e instanceof Ne)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Ne([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ne.empty=new Ne([],0);const $v={index:0,offset:0};function Zf(t,e){return $v.index=t,$v.offset=e,$v}function pg(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let s=Array.isArray(t);if(Array.isArray(e)!=s)return!1;if(s){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!pg(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!pg(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let qt=class w1{constructor(e,s){this.type=e,this.attrs=s}addToSet(e){let s,r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(this.eq(a))return e;if(this.type.excludes(a.type))s||(s=e.slice(0,i));else{if(a.type.excludes(this.type))return e;!r&&a.type.rank>this.type.rank&&(s||(s=e.slice(0,i)),s.push(this),r=!0),s&&s.push(a)}}return s||(s=e.slice()),r||s.push(this),s}removeFromSet(e){for(let s=0;s<e.length;s++)if(this.eq(e[s]))return e.slice(0,s).concat(e.slice(s+1));return e}isInSet(e){for(let s=0;s<e.length;s++)if(this.eq(e[s]))return!0;return!1}eq(e){return this==e||this.type==e.type&&pg(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let s in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,s){if(!s)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[s.type];if(!r)throw new RangeError(`There is no mark type ${s.type} in this schema`);let i=r.create(s.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,s){if(e==s)return!0;if(e.length!=s.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(s[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return w1.none;if(e instanceof w1)return[e];let s=e.slice();return s.sort((r,i)=>r.type.rank-i.type.rank),s}};qt.none=[];class fg extends Error{}class $e{constructor(e,s,r){this.content=e,this.openStart=s,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,s){let r=OR(this.content,e+this.openStart,s);return r&&new $e(r,this.openStart,this.openEnd)}removeBetween(e,s){return new $e(_R(this.content,e+this.openStart,s+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,s){if(!s)return $e.empty;let r=s.openStart||0,i=s.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new $e(Ne.fromJSON(e,s.content),r,i)}static maxOpen(e,s=!0){let r=0,i=0;for(let a=e.firstChild;a&&!a.isLeaf&&(s||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(s||!a.type.spec.isolating);a=a.lastChild)i++;return new $e(e,r,i)}}$e.empty=new $e(Ne.empty,0,0);function _R(t,e,s){let{index:r,offset:i}=t.findIndex(e),a=t.maybeChild(r),{index:l,offset:d}=t.findIndex(s);if(i==e||a.isText){if(d!=s&&!t.child(l).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(s))}if(r!=l)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(_R(a.content,e-i-1,s-i-1)))}function OR(t,e,s,r){let{index:i,offset:a}=t.findIndex(e),l=t.maybeChild(i);if(a==e||l.isText)return r&&!r.canReplace(i,i,s)?null:t.cut(0,e).append(s).append(t.cut(e));let d=OR(l.content,e-a-1,s,l);return d&&t.replaceChild(i,l.copy(d))}function KZ(t,e,s){if(s.openStart>t.depth)throw new fg("Inserted content deeper than insertion position");if(t.depth-s.openStart!=e.depth-s.openEnd)throw new fg("Inconsistent open depths");return RR(t,e,s,0)}function RR(t,e,s,r){let i=t.index(r),a=t.node(r);if(i==e.index(r)&&r<t.depth-s.openStart){let l=RR(t,e,s,r+1);return a.copy(a.content.replaceChild(i,l))}else if(s.content.size)if(!s.openStart&&!s.openEnd&&t.depth==r&&e.depth==r){let l=t.parent,d=l.content;return Pc(l,d.cut(0,t.parentOffset).append(s.content).append(d.cut(e.parentOffset)))}else{let{start:l,end:d}=YZ(s,t);return Pc(a,PR(t,l,d,e,r))}else return Pc(a,xg(t,e,r))}function DR(t,e){if(!e.type.compatibleContent(t.type))throw new fg("Cannot join "+e.type.name+" onto "+t.type.name)}
vendor: 12,232 bytes, lines 391-392
391function j1(t,e,s){let r=t.node(s);return DR(r,e.node(s)),r}function Dc(t,e){let s=e.length-1;s>=0&&t.isText&&t.sameMarkup(e[s])?e[s]=t.withText(e[s].text+t.text):e.push(t)}function im(t,e,s,r){let i=(e||t).node(s),a=0,l=e?e.index(s):i.childCount;t&&(a=t.index(s),t.depth>s?a++:t.textOffset&&(Dc(t.nodeAfter,r),a++));for(let d=a;d<l;d++)Dc(i.child(d),r);e&&e.depth==s&&e.textOffset&&Dc(e.nodeBefore,r)}function Pc(t,e){return t.type.checkContent(e),t.copy(e)}function PR(t,e,s,r,i){let a=t.depth>i&&j1(t,e,i+1),l=r.depth>i&&j1(s,r,i+1),d=[];return im(null,t,i,d),a&&l&&e.index(i)==s.index(i)?(DR(a,l),Dc(Pc(a,PR(t,e,s,r,i+1)),d)):(a&&Dc(Pc(a,xg(t,e,i+1)),d),im(e,s,i,d),l&&Dc(Pc(l,xg(s,r,i+1)),d)),im(r,null,i,d),new Ne(d)}function xg(t,e,s){let r=[];if(im(null,t,s,r),t.depth>s){let i=j1(t,e,s+1);Dc(Pc(i,xg(t,e,s+1)),r)}return im(e,null,s,r),new Ne(r)}function YZ(t,e){let s=e.depth-t.openStart,i=e.node(s).copy(t.content);for(let a=s-1;a>=0;a--)i=e.node(a).copy(Ne.from(i));return{start:i.resolveNoCache(t.openStart+s),end:i.resolveNoCache(i.content.size-t.openEnd-s)}}class Bm{constructor(e,s,r){this.pos=e,this.path=s,this.parentOffset=r,this.depth=s.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,s=this.index(this.depth);if(s==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(s);return r?e.child(s).cut(r):i}get nodeBefore(){let e=this.index(this.depth),s=this.pos-this.path[this.path.length-1];return s?this.parent.child(e).cut(0,s):e==0?null:this.parent.child(e-1)}posAtIndex(e,s){s=this.resolveDepth(s);let r=this.path[s*3],i=s==0?0:this.path[s*3-1]+1;for(let a=0;a<e;a++)i+=r.child(a).nodeSize;return i}marks(){let e=this.parent,s=this.index();if(e.content.size==0)return qt.none;if(this.textOffset)return e.child(s).marks;let r=e.maybeChild(s-1),i=e.maybeChild(s);if(!r){let d=r;r=i,i=d}let a=r.marks;for(var l=0;l<a.length;l++)a[l].type.spec.inclusive===!1&&(!i||!a[l].isInSet(i.marks))&&(a=a[l--].removeFromSet(a));return a}marksAcross(e){let s=this.parent.maybeChild(this.index());if(!s||!s.isInline)return null;let r=s.marks,i=e.parent.maybeChild(e.index());for(var a=0;a<r.length;a++)r[a].type.spec.inclusive===!1&&(!i||!r[a].isInSet(i.marks))&&(r=r[a--].removeFromSet(r));return r}sharedDepth(e){for(let s=this.depth;s>0;s--)if(this.start(s)<=e&&this.end(s)>=e)return s;return 0}blockRange(e=this,s){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!s||s(this.node(r))))return new gg(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let s=1;s<=this.depth;s++)e+=(e?"/":"")+this.node(s).type.name+"_"+this.index(s-1);return e+":"+this.parentOffset}static resolve(e,s){if(!(s>=0&&s<=e.content.size))throw new RangeError("Position "+s+" out of range");let r=[],i=0,a=s;for(let l=e;;){let{index:d,offset:u}=l.content.findIndex(a),m=a-u;if(r.push(l,d,i+u),!m||(l=l.child(d),l.isText))break;a=m-1,i+=u+1}return new Bm(s,r,a)}static resolveCached(e,s){let r=e4.get(e);if(r)for(let a=0;a<r.elts.length;a++){let l=r.elts[a];if(l.pos==s)return l}else e4.set(e,r=new QZ);let i=r.elts[r.i]=Bm.resolve(e,s);return r.i=(r.i+1)%JZ,i}}class QZ{constructor(){this.elts=[],this.i=0}}const JZ=12,e4=new WeakMap;class gg{constructor(e,s,r){this.$from=e,this.$to=s,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const XZ=Object.create(null);let dl=class N1{constructor(e,s,r,i=qt.none){this.type=e,this.attrs=s,this.marks=i,this.content=r||Ne.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,s,r,i=0){this.content.nodesBetween(e,s,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,s,r,i){return this.content.textBetween(e,s,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,s,r){return this.type==e&&pg(this.attrs,s||e.defaultAttrs||XZ)&&qt.sameSet(this.marks,r||qt.none)}copy(e=null){return e==this.content?this:new N1(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new N1(this.type,this.attrs,this.content,e)}cut(e,s=this.content.size){return e==0&&s==this.content.size?this:this.copy(this.content.cut(e,s))}slice(e,s=this.content.size,r=!1){if(e==s)return $e.empty;let i=this.resolve(e),a=this.resolve(s),l=r?0:i.sharedDepth(s),d=i.start(l),m=i.node(l).content.cut(i.pos-d,a.pos-d);return new $e(m,i.depth-l,a.depth-l)}replace(e,s,r){return KZ(this.resolve(e),this.resolve(s),r)}nodeAt(e){for(let s=this;;){let{index:r,offset:i}=s.content.findIndex(e);if(s=s.maybeChild(r),!s)return null;if(i==e||s.isText)return s;e-=i+1}}childAfter(e){let{index:s,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(s),index:s,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:s,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(s),index:s,offset:r};let i=this.content.child(s-1);return{node:i,index:s-1,offset:r-i.nodeSize}}resolve(e){return Bm.resolveCached(this,e)}resolveNoCache(e){return Bm.resolve(this,e)}rangeHasMark(e,s,r){let i=!1;return s>e&&this.nodesBetween(e,s,a=>(r.isInSet(a.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),IR(this.marks,e)}contentMatchAt(e){let s=this.type.contentMatch.matchFragment(this.content,0,e);if(!s)throw new Error("Called contentMatchAt on a node with invalid content");return s}canReplace(e,s,r=Ne.empty,i=0,a=r.childCount){let l=this.contentMatchAt(e).matchFragment(r,i,a),d=l&&l.matchFragment(this.content,s);if(!d||!d.validEnd)return!1;for(let u=i;u<a;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(e,s,r,i){if(i&&!this.type.allowsMarks(i))return!1;let a=this.contentMatchAt(e).matchType(r),l=a&&a.matchFragment(this.content,s);return l?l.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=qt.none;for(let s=0;s<this.marks.length;s++){let r=this.marks[s];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!qt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(s=>s.type.name)}`);this.content.forEach(s=>s.check())}toJSON(){let e={type:this.type.name};for(let s in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(s=>s.toJSON())),e}static fromJSON(e,s){if(!s)throw new RangeError("Invalid input for Node.fromJSON");let r;if(s.marks){if(!Array.isArray(s.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=s.marks.map(e.markFromJSON)}if(s.type=="text"){if(typeof s.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(s.text,r)}let i=Ne.fromJSON(e,s.content),a=e.nodeType(s.type).create(s.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};dl.prototype.text=void 0;class bg extends dl{constructor(e,s,r,i){if(super(e,s,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):IR(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,s){return this.text.slice(e,s)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new bg(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new bg(this.type,this.attrs,e,this.marks)}cut(e=0,s=this.text.length){return e==0&&s==this.text.length?this:this.withText(this.text.slice(e,s))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function IR(t,e){for(let s=t.length-1;s>=0;s--)e=t[s].type.name+"("+e+")";return e}class qc{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,s){let r=new ZZ(e,s);if(r.next==null)return qc.empty;let i=LR(r);r.next&&r.err("Unexpected trailing text");let a=aee(iee(i));return oee(a,r),a}matchType(e){for(let s=0;s<this.next.length;s++)if(this.next[s].type==e)return this.next[s].next;return null}matchFragment(e,s=0,r=e.childCount){let i=this;for(let a=s;i&&a<r;a++)i=i.matchType(e.child(a).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:s}=this.next[e];if(!(s.isText||s.hasRequiredAttrs()))return s}return null}compatible(e){for(let s=0;s<this.next.length;s++)for(let r=0;r<e.next.length;r++)if(this.next[s].type==e.next[r].type)return!0;return!1}fillBefore(e,s=!1,r=0){let i=[this];function a(l,d){let u=l.matchFragment(e,r);if(u&&(!s||u.validEnd))return Ne.from(d.map(m=>m.createAndFill()));for(let m=0;m<l.next.length;m++){let{type:p,next:x}=l.next[m];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(x)==-1){i.push(x);let g=a(x,d.concat(p));if(g)return g}}return null}return a(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let s=this.computeWrapping(e);return this.wrapCache.push(e,s),s}computeWrapping(e){let s=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),a=i.match;if(a.matchType(e)){let l=[];for(let d=i;d.type;d=d.via)l.push(d.type);return l.reverse()}for(let l=0;l<a.next.length;l++){let{type:d,next:u}=a.next[l];!d.isLeaf&&!d.hasRequiredAttrs()&&!(d.name in s)&&(!i.type||u.validEnd)&&(r.push({match:d.contentMatch,type:d,via:i}),s[d.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function s(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&s(r.next[i].next)}return s(this),e.map((r,i)=>{let a=i+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)a+=(l?", ":"")+r.next[l].type.name+"->"+e.indexOf(r.next[l].next);return a}).join(`
392`)}}qc.empty=new qc(!0);class ZZ{constructor(e,s){this.string=e,this.nodeTypes=s,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?
vendor: 5,524 bytes, line 392
392=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function LR(t){let e=[];do e.push(eee(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function eee(t){let e=[];do e.push(tee(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function tee(t){let e=ree(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=see(t,e);else break;return e}function t4(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function see(t,e){let s=t4(t),r=s;return t.eat(",")&&(t.next!="}"?r=t4(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:s,max:r,expr:e}}function nee(t,e){let s=t.nodeTypes,r=s[e];if(r)return[r];let i=[];for(let a in s){let l=s[a];l.isInGroup(e)&&i.push(l)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function ree(t){if(t.eat("(")){let e=LR(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=nee(t,t.next).map(s=>(t.inline==null?t.inline=s.isInline:t.inline!=s.isInline&&t.err("Mixing inline and block content"),{type:"name",value:s}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function iee(t){let e=[[]];return i(a(t,0),s()),e;function s(){return e.push([])-1}function r(l,d,u){let m={term:u,to:d};return e[l].push(m),m}function i(l,d){l.forEach(u=>u.to=d)}function a(l,d){if(l.type=="choice")return l.exprs.reduce((u,m)=>u.concat(a(m,d)),[]);if(l.type=="seq")for(let u=0;;u++){let m=a(l.exprs[u],d);if(u==l.exprs.length-1)return m;i(m,d=s())}else if(l.type=="star"){let u=s();return r(d,u),i(a(l.expr,u),u),[r(u)]}else if(l.type=="plus"){let u=s();return i(a(l.expr,d),u),i(a(l.expr,u),u),[r(u)]}else{if(l.type=="opt")return[r(d)].concat(a(l.expr,d));if(l.type=="range"){let u=d;for(let m=0;m<l.min;m++){let p=s();i(a(l.expr,u),p),u=p}if(l.max==-1)i(a(l.expr,u),u);else for(let m=l.min;m<l.max;m++){let p=s();r(u,p),i(a(l.expr,u),p),u=p}return[r(u)]}else{if(l.type=="name")return[r(d,void 0,l.value)];throw new Error("Unknown expr type")}}}}function $R(t,e){return e-t}function s4(t,e){let s=[];return r(e),s.sort($R);function r(i){let a=t[i];if(a.length==1&&!a[0].term)return r(a[0].to);s.push(i);for(let l=0;l<a.length;l++){let{term:d,to:u}=a[l];!d&&s.indexOf(u)==-1&&r(u)}}}function aee(t){let e=Object.create(null);return s(s4(t,0));function s(r){let i=[];r.forEach(l=>{t[l].forEach(({term:d,to:u})=>{if(!d)return;let m;for(let p=0;p<i.length;p++)i[p][0]==d&&(m=i[p][1]);s4(t,u).forEach(p=>{m||i.push([d,m=[]]),m.indexOf(p)==-1&&m.push(p)})})});let a=e[r.join(",")]=new qc(r.indexOf(t.length-1)>-1);for(let l=0;l<i.length;l++){let d=i[l][1].sort($R);a.next.push({type:i[l][0],next:e[d.join(",")]||s(d)})}return a}}function oee(t,e){for(let s=0,r=[t];s<r.length;s++){let i=r[s],a=!i.validEnd,l=[];for(let d=0;d<i.next.length;d++){let{type:u,next:m}=i.next[d];l.push(u.name),a&&!(u.isText||u.hasRequiredAttrs())&&(a=!1),r.indexOf(m)==-1&&r.push(m)}a&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function BR(t){let e=Object.create(null);for(let s in t){let r=t[s];if(!r.hasDefault)return null;e[s]=r.default}return e}function zR(t,e){let s=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let a=t[r];if(a.hasDefault)i=a.default;else throw new RangeError("No value supplied for attribute "+r)}s[r]=i}return s}function VR(t,e,s,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${s} of type ${i}`);for(let i in t){let a=t[i];a.validate&&a.validate(e[i])}}function FR(t,e){let s=Object.create(null);if(e)for(let r in e)s[r]=new cee(t,r,e[r]);return s}let n4=class UR{constructor(e,s,r){this.name=e,this.schema=s,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=FR(e,r.attrs),this.defaultAttrs=BR(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==qc.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:zR(this.attrs,e)}create(e=null,s,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new dl(this,this.computeAttrs(e),Ne.from(s),qt.setFrom(r))}createChecked(e=null,s,r){return s=Ne.from(s),this.checkContent(s),new dl(this,this.computeAttrs(e),s,qt.setFrom(r))}createAndFill(e=null,s,r){if(e=this.computeAttrs(e),s=Ne.from(s),s.size){let l=this.contentMatch.fillBefore(s);if(!l)return null;s=l.append(s)}let i=this.contentMatch.matchFragment(s),a=i&&i.fillBefore(Ne.empty,!0);return a?new dl(this,e,s.append(a),qt.setFrom(r)):null}validContent(e){let s=this.contentMatch.matchFragment(e);
vendor: 10,946 bytes, lines 392-394
392if(!s||!s.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){VR(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let s=0;s<e.length;s++)if(!this.allowsMarkType(e[s].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let s;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?s&&s.push(e[r]):s||(s=e.slice(0,r));return s?s.length?s:qt.none:e}static compile(e,s){let r=Object.create(null);e.forEach((a,l)=>r[a]=new UR(a,s,l));let i=s.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function lee(t,e,s){let r=s.split("|");return i=>{let a=i===null?"null":typeof i;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class cee{constructor(e,s,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?lee(e,s,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Tb{constructor(e,s,r,i){this.name=e,this.rank=s,this.schema=r,this.spec=i,this.attrs=FR(e,i.attrs),this.excluded=null;let a=BR(this.attrs);this.instance=a?new qt(this,a):null}create(e=null){return!e&&this.instance?this.instance:new qt(this,zR(this.attrs,e))}static compile(e,s){let r=Object.create(null),i=0;return e.forEach((a,l)=>r[a]=new Tb(a,i++,s,l)),r}removeFromSet(e){for(var s=0;s<e.length;s++)e[s].type==this&&(e=e.slice(0,s).concat(e.slice(s+1)),s--);return e}isInSet(e){for(let s=0;s<e.length;s++)if(e[s].type==this)return e[s]}checkAttrs(e){VR(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class HR{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let s=this.spec={};for(let i in e)s[i]=e[i];s.nodes=vn.from(e.nodes),s.marks=vn.from(e.marks||{}),this.nodes=n4.compile(this.spec.nodes,this),this.marks=Tb.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let a=this.nodes[i],l=a.spec.content||"",d=a.spec.marks;if(a.contentMatch=r[l]||(r[l]=qc.parse(l,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=d=="_"?null:d?r4(this,d.split(" ")):d==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],l=a.spec.excludes;a.excluded=l==null?[a]:l==""?[]:r4(this,l.split(" "))}this.nodeFromJSON=i=>dl.fromJSON(this,i),this.markFromJSON=i=>qt.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,s=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof n4){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(s,r,i)}text(e,s){let r=this.nodes.text;return new bg(r,r.defaultAttrs,e,qt.setFrom(s))}mark(e,s){return typeof e=="string"&&(e=this.marks[e]),e.create(s)}nodeType(e){let s=this.nodes[e];if(!s)throw new RangeError("Unknown node type: "+e);return s}}function r4(t,e){let s=[];for(let r=0;r<e.length;r++){let i=e[r],a=t.marks[i],l=a;if(a)s.push(a);else for(let d in t.marks){let u=t.marks[d];(i=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(i)>-1)&&s.push(l=u)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return s}function dee(t){return t.tag!=null}function uee(t){return t.style!=null}class ul{constructor(e,s){this.schema=e,this.rules=s,this.tags=[],this.styles=[];let r=this.matchedStyles=[];s.forEach(i=>{if(dee(i))this.tags.push(i);else if(uee(i)){let a=/[^=]*/.exec(i.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=e.nodes[i.node];return a.contentMatch.matchType(a)})}parse(e,s={}){let r=new a4(this,s,!1);return r.addAll(e,qt.none,s.from,s.to),r.finish()}parseSlice(e,s={}){let r=new a4(this,s,!0);return r.addAll(e,qt.none,s.from,s.to),$e.maxOpen(r.finish())}matchTag(e,s,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let a=this.tags[i];if(pee(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||s.matchesContext(a.context))){if(a.getAttrs){let l=a.getAttrs(e);if(l===!1)continue;a.attrs=l||void 0}return a}}}matchStyle(e,s,r,i){for(let a=i?this.styles.indexOf(i)+1:0;a<this.styles.length;a++){let l=this.styles[a],d=l.style;if(!(d.indexOf(e)!=0||l.context&&!r.matchesContext(l.context)||d.length>e.length&&(d.charCodeAt(e.length)!=61||d.slice(e.length+1)!=s))){if(l.getAttrs){let u=l.getAttrs(s);if(u===!1)continue;l.attrs=u||void 0}return l}}}static schemaRules(e){let s=[];function r(i){let a=i.priority==null?50:i.priority,l=0;for(;l<s.length;l++){let d=s[l];if((d.priority==null?50:d.priority)<a)break}s.splice(l,0,i)}for(let i in e.marks){let a=e.marks[i].spec.parseDOM;a&&a.forEach(l=>{r(l=o4(l)),l.mark||l.ignore||l.clearMark||(l.mark=i)})}for(let i in e.nodes){let a=e.nodes[i].spec.parseDOM;a&&a.forEach(l=>{r(l=o4(l)),l.node||l.ignore||l.mark||(l.node=i)})}return s}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ul(e,ul.schemaRules(e)))}}const qR={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},hee={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},WR={ol:!0,ul:!0},zm=1,k1=2,am=4;function i4(t,e,s){return e!=null?(e?zm:0)|(e==="full"?k1:0):t&&t.whitespace=="pre"?zm|k1:s&~am}class ex{constructor(e,s,r,i,a,l){this.type=e,this.attrs=s,this.marks=r,this.solid=i,this.options=l,this.content=[],this.activeMarks=qt.none,this.match=a||(l&am?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let s=this.type.contentMatch.fillBefore(Ne.from(e));if(s)this.match=this.type.contentMatch.matchFragment(s);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&zm)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let s=Ne.from(this.content);return!e&&this.match&&(s=s.append(this.match.fillBefore(Ne.empty,!0))),this.type?this.type.create(this.attrs,s,this.marks):s}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!qR.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class a4{constructor(e,s,r){this.parser=e,this.options=s,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=s.topNode,a,l=i4(null,s.preserveWhitespace,0)|(r?am:0);i?a=new ex(i.type,i.attrs,qt.none,!0,s.topMatch||i.type.contentMatch,l):r?a=new ex(null,null,qt.none,!0,null,l):a=new ex(e.schema.topNodeType,null,qt.none,!0,null,l),this.nodes=[a],this.find=s.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,s){e.nodeType==3?this.addTextNode(e,s):e.nodeType==1&&this.addElement(e,s)}addTextNode(e,s){let r=e.nodeValue,i=this.top,a=i.options&k1?"full":this.localPreserveWS||(i.options&zm)>0,{schema:l}=this.parser;if(a==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,`
393`);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let d=r.split(/\r?\n|\r/);for(let u=0;u<d.length;u++)u&&this.insertNode(l.linebreakReplacement.create(),s,!0),d[u]&&this.insertNode(l.text(d[u]),s,!/\S/.test(d[u]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let d=i.content[i.content.length-1],u=e.previousSibling;(!d||u&&u.nodeName=="BR"||d.isText&&/[ \t\r\n\u000c]$/.test(d.text))&&(r=r.slice(1))}r&&this.insertNode(l.text(r),s,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,s,r){let i=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),d;WR.hasOwnProperty(l)&&this.parser.normalizeLists&&mee(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(d=this.parser.matchTag(e,this,r));e:if(u?u.ignore:hee.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,s);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let m,p=this.needsBlock;if(qR.hasOwnProperty(l))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),m=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,s);break e}let x=u&&u.skip?s:this.readStyles(e,s);x&&this.addAll(e,x),m&&this.sync(a),this.needsBlock=p}else{let m=this.readStyles(e,s);m&&this.addElementByRule(e,u,m,u.consuming===!1?d:void 0)}this.localPreserveWS=i}leafFallback(e,s){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
394`),s)}ignoreFallback(e,s){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),s,!0)}readStyles(e,s){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let a=this.parser.matchedStyles[i],l=r.getPropertyValue(a);if(l)for(let d=void 0;;){let u=this.parser.matchStyle(a,l,this,d);if(!u)break;if(u.ignore)return null;if(u.clearMark?s=s.filter(m=>!u.clearMark(m)):s=s.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)d=u;else break}}return s}addElementByRule(e,s,r,i){let a,l;if(s.node)if(l=this.parser.schema.nodes[s.node],l.isLeaf)this.insertNode(l.create(s.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(l,s.attrs||null,r,s.preserveWhitespace);u&&(a=!0,r=u)}else{let u=this.parser.schema.marks[s.mark];r=r.concat(u.create(s.attrs))}let d=this.top;if(l&&l.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(s.getContent)this.findInside(e),s.getContent(e,this.parser.schema).forEac
vendor: 4,077 bytes, line 394
394h(u=>this.insertNode(u,r,!1));else{let u=e;typeof s.contentElement=="string"?u=e.querySelector(s.contentElement):typeof s.contentElement=="function"?u=s.contentElement(e):s.contentElement&&(u=s.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}a&&this.sync(d)&&this.open--}addAll(e,s,r,i){let a=r||0;for(let l=r?e.childNodes[r]:e.firstChild,d=i==null?null:e.childNodes[i];l!=d;l=l.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(l,s);this.findAtPoint(e,a)}findPlace(e,s,r){let i,a;for(let l=this.open,d=0;l>=0;l--){let u=this.nodes[l],m=u.findWrapping(e);if(m&&(!i||i.length>m.length+d)&&(i=m,a=u,!m.length))break;if(u.solid){if(r)break;d+=2}}if(!i)return null;this.sync(a);for(let l=0;l<i.length;l++)s=this.enterInner(i[l],null,s,!1);return s}insertNode(e,s,r){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(s=this.enterInner(a,null,s))}let i=this.findPlace(e,s,r);if(i){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let l=qt.none;for(let d of i.concat(e.marks))(a.type?a.type.allowsMarkType(d.type):l4(d.type,e.type))&&(l=d.addToSet(l));return a.content.push(e.mark(l)),!0}return!1}enter(e,s,r,i){let a=this.findPlace(e.create(s),r,!1);return a&&(a=this.enterInner(e,s,r,!0,i)),a}enterInner(e,s,r,i=!1,a){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let d=i4(e,a,l.options);l.options&am&&l.content.length==0&&(d|=am);let u=qt.none;return r=r.filter(m=>(l.type?l.type.allowsMarkType(m.type):l4(m.type,e))?(u=m.addToSet(u),!1):!0),this.nodes.push(new ex(e,s,u,i,null,d)),this.open++,r}closeExtra(e=!1){let s=this.nodes.length-1;if(s>this.open){for(;s>this.open;s--)this.nodes[s-1].content.push(this.nodes[s].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let s=this.open;s>=0;s--){if(this.nodes[s]==e)return this.open=s,!0;this.localPreserveWS&&(this.nodes[s].options|=zm)}return!1}get currentPos(){this.closeExtra();let e=0;for(let s=this.open;s>=0;s--){let r=this.nodes[s].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;s&&e++}return e}findAtPoint(e,s){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==s&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&(this.find[s].pos=this.currentPos)}findAround(e,s,r){if(e!=s&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&s.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let s=0;s<this.find.length;s++)this.find[s].node==e&&(this.find[s].pos=this.currentPos-(e.nodeValue.length-this.find[s].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let s=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?0:1),l=(d,u)=>{for(;d>=0;d--){let m=s[d];if(m==""){if(d==s.length-1||d==0)continue;for(;u>=a;u--)if(l(d-1,u))return!0;return!1}else{let p=u>0||u==0&&i?this.nodes[u].type:r&&u>=a?r.node(u-a).type:null;if(!p||p.name!=m&&!p.isInGroup(m))return!1;u--}}return!0};return l(s.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let s=e.depth;s>=0;s--){let r=e.node(s).contentMatchAt(e.indexAfter(s)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let s in this.parser.schema.nodes){let r=this.parser.schema.nodes[s];if(r.isTextblock&&r.defaultAttrs)return r}}}function mee(t){for(let e=t.firstChild,s=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&WR.hasOwnProperty(r)&&s?(s.appendChild(e),e=s):r=="li"?s=e:r&&(s=null)}}function pee(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function o4(t){let e={};for(let s in t)e[s]=t[s];return e}
vendor: 7,423 bytes, line 394
394function l4(t,e){let s=e.schema.nodes;for(let r in s){let i=s[r];if(!i.allowsMarkType(t))continue;let a=[],l=d=>{a.push(d);for(let u=0;u<d.edgeCount;u++){let{type:m,next:p}=d.edge(u);if(m==e||a.indexOf(p)<0&&l(p))return!0}};if(l(i.contentMatch))return!0}}class ed{constructor(e,s){this.nodes=e,this.marks=s}serializeFragment(e,s={},r){r||(r=Bv(s).createDocumentFragment());let i=r,a=[];return e.forEach(l=>{if(a.length||l.marks.length){let d=0,u=0;for(;d<a.length&&u<l.marks.length;){let m=l.marks[u];if(!this.marks[m.type.name]){u++;continue}if(!m.eq(a[d][0])||m.type.spec.spanning===!1)break;d++,u++}for(;d<a.length;)i=a.pop()[1];for(;u<l.marks.length;){let m=l.marks[u++],p=this.serializeMark(m,l.isInline,s);p&&(a.push([m,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(l,s))}),r}serializeNodeInner(e,s){let{dom:r,contentDOM:i}=Ex(Bv(s),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,s,i)}return r}serializeNode(e,s={}){let r=this.serializeNodeInner(e,s);for(let i=e.marks.length-1;i>=0;i--){let a=this.serializeMark(e.marks[i],e.isInline,s);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,s,r={}){let i=this.marks[e.type.name];return i&&Ex(Bv(r),i(e,s),null,e.attrs)}static renderSpec(e,s,r=null,i){return Ex(e,s,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ed(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let s=c4(e.nodes);return s.text||(s.text=r=>r.text),s}static marksFromSchema(e){return c4(e.marks)}}function c4(t){let e={};for(let s in t){let r=t[s].spec.toDOM;r&&(e[s]=r)}return e}function Bv(t){return t.document||window.document}const d4=new WeakMap;function fee(t){let e=d4.get(t);return e===void 0&&d4.set(t,e=xee(t)),e}function xee(t){let e=null;function s(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)s(r[i]);else for(let i in r)s(r[i])}return s(t),e}function Ex(t,e,s,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],a;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(a=fee(r))&&a.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=i.indexOf(" ");l>0&&(s=i.slice(0,l),i=i.slice(l+1));let d,u=s?t.createElementNS(s,i):t.createElement(i),m=e[1],p=1;if(m&&typeof m=="object"&&m.nodeType==null&&!Array.isArray(m)){p=2;for(let x in m)if(m[x]!=null){let g=x.indexOf(" ");g>0?u.setAttributeNS(x.slice(0,g),x.slice(g+1),m[x]):x=="style"&&u.style?u.style.cssText=m[x]:u.setAttribute(x,m[x])}}for(let x=p;x<e.length;x++){let g=e[x];if(g===0){if(x<e.length-1||x>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:b,contentDOM:v}=Ex(t,g,s,r);if(u.appendChild(b),v){if(d)throw new RangeError("Multiple content holes");d=v}}}return{dom:u,contentDOM:d}}const GR=65535,KR=Math.pow(2,16);function gee(t,e){return t+e*KR}function u4(t){return t&GR}function bee(t){return(t-(t&GR))/KR}const YR=1,QR=2,Ax=4,JR=8;class S1{constructor(e,s,r){this.pos=e,this.delInfo=s,this.recover=r}get deleted(){return(this.delInfo&JR)>0}get deletedBefore(){return(this.delInfo&(YR|Ax))>0}get deletedAfter(){return(this.delInfo&(QR|Ax))>0}get deletedAcross(){return(this.delInfo&Ax)>0}}class Mr{constructor(e,s=!1){if(this.ranges=e,this.inverted=s,!e.length&&Mr.empty)return Mr.empty}recover(e){let s=0,r=u4(e);if(!this.inverted)for(let i=0;i<r;i++)s+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+s+bee(e)}mapResult(e,s=1){return this._map(e,s,!1)}map(e,s=1){return this._map(e,s,!0)}_map(e,s,r){let i=0,a=this.inverted?2:1,l=this.inverted?1:2;for(let d=0;d<this.ranges.length;d+=3){let u=this.ranges[d]-(this.inverted?i:0);if(u>e)break;let m=this.ranges[d+a],p=this.ranges[d+l],x=u+m;if(e<=x){let g=m?e==u?-1:e==x?1:s:s,b=u+i+(g<0?0:p);if(r)return b;let v=e==(s<0?u:x)?null:gee(d/3,e-u),k=e==u?QR:e==x?YR:Ax;return(s<0?e!=u:e!=x)&&(k|=JR),new S1(b,k,v)}i+=p-m}return r?e+i:new S1(e+i,0,null)}touches(e,s){let r=0,i=u4(s),a=this.inverted?2:1,l=this.inverted?1:2;for(let d=0;d<this.ranges.length;d+=3){let u=this.ranges[d]-(this.inverted?r:0);if(u>e)break;let m=this.ranges[d+a],p=u+m;if(e<=p&&d==i*3)return!0;r+=this.ranges[d+l]-m}return!1}forEach(e){let s=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,a=0;i<this.ranges.length;i+=3){let l=this.ranges[i],d=l-(this.inverted?a:0),u=l+(this.inverted?0:a),m=this.ranges[i+s],p=this.ranges[i+r];e(d,d+m,u,u+p),a+=p-m}}invert(){return new Mr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Mr.empty:new Mr(e<0?[0,-e,0]:[0,0,e])}}Mr.empty=new Mr([]);class Vm{constructor(e,s,r=0,i=e?e.length:0){this.mirror=s,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||s)}get maps(){return this._maps}slice(e=0,s=this.maps.length){return new Vm(this._maps,this.mirror,e,s)}appendMap(e,s){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),s!=null&&this.setMirror(this._maps.length-1,s)}appendMapping(e){for(let s=0,r=this._maps.length;s<e._maps.length;s++){let i=e.getMirror(s);this.appendMap(e._maps[s],i!=null&&i<s?r+i:void 0)}}getMirror(e){if(this.mirror){for(let s=0;s<this.mirror.length;s++)if(this.mirror[s]==e)return this.mirror[s+(s%2?-1:1)]}}setMirror(e,s){this.mirror||(this.mirror=[]),this.mirror.push(e,s)}appendMappingInverted(e){for(let s=e.maps.length-1,r=this._maps.length+e._maps.length;s>=0;s--){let i=e.getMirror(s);this.appendMap(e._maps[s].invert(),i!=null&&i>s?r-i-1:void 0)}}invert(){let e=new Vm;return e.appendMappingInverted(this),e}map(e,s=1){if(this.mirror)return this._map(e,s,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,s);return e}mapResult(e,s=1){return this._map(e,s,!1)}_map(e,s,r){let i=0;for(let a=this.from;a<this.to;a++){let l=this._maps[a],d=l.mapResult(e,s);if(d.recover!=null){let u=this.getMirror(a);if(u!=null&&u>a&&u<this.to){a=u,e=this._maps[u].recover(d.recover);continue}}i|=d.delInfo,e=d.pos}return r?e:new S1(e,i,null)}}const zv=Object.create(null);class zn{getMap(){return Mr.empty}merge(e){return null}static fromJSON(e,s){if(!s||!s.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=zv[s.stepType];if(!r)throw new RangeError(`No step type ${s.stepType} defined`);return r.fromJSON(e,s)}static jsonID(e,s){if(e in zv)throw new RangeError("Duplicate use of step JSON ID "+e);return zv[e]=s,s.prototype.jsonID=e,s}}class Hs{constructor(e,s){this.doc=e,this.failed=s}static ok(e){return new Hs(e,null)}static fail(e){return new Hs(null,e)}static fromReplace(e,s,r,i){try{return Hs.ok(e.replace(s,r,i))}catch(a){if(a instanceof fg)return Hs.fail(a.message);throw a}}}function AN(t,e,s){let r=[];for(let i=0;i<t.childCount;i++){let a=t.child(i);a.content.size&&(a=a.copy(AN(a.content,e,a))),a.isInline&&(a=e(a,s,i)),r.push(a)}return Ne.fromArray(r)}class al extends zn{constructor(e,s,r){super(),this.from=e,this.to=s,this.mark=r}apply(e){let s=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.no
vendor: 11,361 bytes, line 394
394de(r.sharedDepth(this.to)),a=new $e(AN(s.content,(l,d)=>!l.isAtom||!d.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),s.openStart,s.openEnd);return Hs.fromReplace(e,this.from,this.to,a)}invert(){return new Ci(this.from,this.to,this.mark)}map(e){let s=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return s.deleted&&r.deleted||s.pos>=r.pos?null:new al(s.pos,r.pos,this.mark)}merge(e){return e instanceof al&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new al(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,s){if(typeof s.from!="number"||typeof s.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new al(s.from,s.to,e.markFromJSON(s.mark))}}zn.jsonID("addMark",al);class Ci extends zn{constructor(e,s,r){super(),this.from=e,this.to=s,this.mark=r}apply(e){let s=e.slice(this.from,this.to),r=new $e(AN(s.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),s.openStart,s.openEnd);return Hs.fromReplace(e,this.from,this.to,r)}invert(){return new al(this.from,this.to,this.mark)}map(e){let s=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return s.deleted&&r.deleted||s.pos>=r.pos?null:new Ci(s.pos,r.pos,this.mark)}merge(e){return e instanceof Ci&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ci(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,s){if(typeof s.from!="number"||typeof s.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ci(s.from,s.to,e.markFromJSON(s.mark))}}zn.jsonID("removeMark",Ci);class ol extends zn{constructor(e,s){super(),this.pos=e,this.mark=s}apply(e){let s=e.nodeAt(this.pos);if(!s)return Hs.fail("No node at mark step's position");let r=s.type.create(s.attrs,null,this.mark.addToSet(s.marks));return Hs.fromReplace(e,this.pos,this.pos+1,new $e(Ne.from(r),0,s.isLeaf?0:1))}invert(e){let s=e.nodeAt(this.pos);if(s){let r=this.mark.addToSet(s.marks);if(r.length==s.marks.length){for(let i=0;i<s.marks.length;i++)if(!s.marks[i].isInSet(r))return new ol(this.pos,s.marks[i]);return new ol(this.pos,this.mark)}}return new Wc(this.pos,this.mark)}map(e){let s=e.mapResult(this.pos,1);return s.deletedAfter?null:new ol(s.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,s){if(typeof s.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ol(s.pos,e.markFromJSON(s.mark))}}zn.jsonID("addNodeMark",ol);class Wc extends zn{constructor(e,s){super(),this.pos=e,this.mark=s}apply(e){let s=e.nodeAt(this.pos);if(!s)return Hs.fail("No node at mark step's position");let r=s.type.create(s.attrs,null,this.mark.removeFromSet(s.marks));return Hs.fromReplace(e,this.pos,this.pos+1,new $e(Ne.from(r),0,s.isLeaf?0:1))}invert(e){let s=e.nodeAt(this.pos);return!s||!this.mark.isInSet(s.marks)?this:new ol(this.pos,this.mark)}map(e){let s=e.mapResult(this.pos,1);return s.deletedAfter?null:new Wc(s.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,s){if(typeof s.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Wc(s.pos,e.markFromJSON(s.mark))}}zn.jsonID("removeNodeMark",Wc);class Us extends zn{constructor(e,s,r,i=!1){super(),this.from=e,this.to=s,this.slice=r,this.structure=i}apply(e){return this.structure&&C1(e,this.from,this.to)?Hs.fail("Structure replace would overwrite content"):Hs.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Mr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Us(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let s=e.mapResult(this.to,-1),r=this.from==this.to&&Us.MAP_BIAS<0?s:e.mapResult(this.from,1);return r.deletedAcross&&s.deletedAcross?null:new Us(r.pos,Math.max(r.pos,s.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Us)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let s=this.slice.size+e.slice.size==0?$e.empty:new $e(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Us(this.from,this.to+(e.to-e.from),s,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let s=this.slice.size+e.slice.size==0?$e.empty:new $e(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Us(e.from,this.to,s,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,s){if(typeof s.from!="number"||typeof s.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Us(s.from,s.to,$e.fromJSON(e,s.slice),!!s.structure)}}Us.MAP_BIAS=1;zn.jsonID("replace",Us);class ln extends zn{constructor(e,s,r,i,a,l,d=!1){super(),this.from=e,this.to=s,this.gapFrom=r,this.gapTo=i,this.slice=a,this.insert=l,this.structure=d}apply(e){if(this.structure&&(C1(e,this.from,this.gapFrom)||C1(e,this.gapTo,this.to)))return Hs.fail("Structure gap-replace would overwrite content");let s=e.slice(this.gapFrom,this.gapTo);if(s.openStart||s.openEnd)return Hs.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,s.content);return r?Hs.fromReplace(e,this.from,this.to,r):Hs.fail("Content does not fit in gap")}getMap(){return new Mr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let s=this.gapTo-this.gapFrom;return new ln(this.from,this.from+this.slice.size+s,this.from+this.insert,this.from+this.insert+s,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let s=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?s.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return s.deletedAcross&&r.deletedAcross||i<s.pos||a>r.pos?null:new ln(s.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,s){if(typeof s.from!="number"||typeof s.to!="number"||typeof s.gapFrom!="number"||typeof s.gapTo!="number"||typeof s.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ln(s.from,s.to,s.gapFrom,s.gapTo,$e.fromJSON(e,s.slice),s.insert,!!s.structure)}}zn.jsonID("replaceAround",ln);function C1(t,e,s){let r=t.resolve(e),i=s-e,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let l=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function yee(t,e,s,r){let i=[],a=[],l,d;t.doc.nodesBetween(e,s,(u,m,p)=>{if(!u.isInline)return;let x=u.marks;if(!r.isInSet(x)&&p.type.allowsMarkType(r.type)){let g=Math.max(m,e),b=Math.min(m+u.nodeSize,s),v=r.addToSet(x);for(let k=0;k<x.length;k++)x[k].isInSet(v)||(l&&l.to==g&&l.mark.eq(x[k])?l.to=b:i.push(l=new Ci(g,b,x[k])));d&&d.to==g?d.to=b:a.push(d=new al(g,b,r))}}),i.forEach(u=>t.step(u)),a.forEach(u=>t.step(u))}function vee(t,e,s,r){let i=[],a=0;t.doc.nodesBetween(e,s,(l,d)=>{if(!l.isInline)return;a++;let u=null;if(r instanceof Tb){let m=l.marks,p;for(;p=r.isInSet(m);)(u||(u=[])).push(p),m=p.removeFromSet(m)}else r?r.isInSet(l.marks)&&(u=[r]):u=l.marks;if(u&&u.length){let m=Math.min(d+l.nodeSize,s);for(let p=0;p<u.length;p++){let x=u[p],g;for(let b=0;b<i.length;b++){let v=i[b];v.step==a-1&&x.eq(i[b].style)&&(g=v)}g?(g.to=m,g.step=a):i.push({style:x,from:Math.max(d,e),to:m,step:a})}}}),i.forEach(l=>t.step(new Ci(l.from,l.to,l.style)))}function MN(t,e,s,r=s.contentMatch,i=!0){let a=t.doc.nodeAt(e),l=[],d=e+1;for(let u=0;u<a.childCount;u++){let m=a.child(u),p=d+m.nodeSize,x=r.matchType(m.type);if(!x)l.push(new Us(d,p,$e.empty));else{r=x;for(let g=0;g<m.marks.length;g++)s.allowsMarkType(m.marks[g].type)||t.step(new Ci(d,p,m.marks[g]));if(i&&m.isText&&s.whitespace!="pre"){let g,b=/\r?\n|\r/g,v;for(;g=b.exec(m.text);)v||(v=new $e(Ne.from(s.schema.text(" ",s.allowedMarks(m.marks))),0,0)),l.push(new Us(d+g.index,d+g.index+g[0].length,v))}}d=p}if(!r.validEnd){let u=r.fillBefore(Ne.empty,!0);t.replace(d,d,new $e(u,0,0))}for(let u=l.length-1;u>=0;u--)t.step(l[u])}function wee(t,e,s){return(e==0||t.canReplace(e,t.childCount))&&(s==t.childCount||t.canReplace(0,s))}function Du(t){let s=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,a=0;;--r){let l=t.$from.node(r),d=t.$from.index(r)+i,u=t.$to.indexAfter(r)-a;if(r<t.depth&&l.canReplace(d,u,s))return r;if(r==0||l.type.spec.isolating||!wee(l,d,u))break;d&&(i=1),u<l.childCount&&(a=1)}return null}function jee(t,e,s){let{$from:r,$to:i,depth:a}=e,l=r.before(a+1),d=i.after(a+1),u=l,m=d,p=Ne.empty,x=0;for(let v=a,k=!1;v>s;v--)k||r.index(v)>0?(k=!0,p=Ne.from(r.node(v).copy(p)),x++):u--;let g=Ne.empty,b=0;for(let v=a,k=!1;v>s;v--)k||i.after(v+1)<i.end(v)?(k=!0,g=Ne.from(i.node(v).copy(g)),b++):m++;t.step(new ln(u,m,l,d,new $e(p.append(g),x,b),p.size-x,!0))}function _N(t,e,s=null,r=t){let i=Nee(t,e),a=i&&kee(r,e);return a?i.map(h4).concat({type:e,attrs:s}).concat(a.map(h4)):null}function h4(t){return{type:t,attrs:null}}function Nee(t,e){let{parent:s,startIndex:r,endIndex:i}=t,a=s.contentMatchAt(r).findWrapping(e);if(!a)return null;let l=a.length?a[0]:e;return s.canReplaceWith(r,i,l)?a:null}function kee(t,e){let{parent:s,startIndex:r,endIndex:i}=t,a=s.child(r),l=e.contentMatch.findWrapping(a.type);if(!l)return null;let u=(l.length?l[l.length-1]:e).contentMatch;for(let m=r;u&&m<i;m++)u=u.matchType(s.child(m).type);return!u||!u.validEnd?null:l}function See(t,e,s){let r=Ne.empty;for(let l=s.length-1;l>=0;l--){if(r.size){let d=s[l].type.contentMatch.matchFragment(r);if(!d||!d.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ne.from(s[l].type.create(s[l].attrs,r))}let i=e.start,a=e.end;t.step(new ln(i,a,i,a,new $e(r,0,0),s.length,!0))}function Cee(t,e,s,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,s,(l,d)=>{let u=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,u)&&Tee(t.doc,t.mapping.slice(a).map(d),r)){let m=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!v?m=!1:!b&&v&&(m=!0)}m===!1&&ZR(t,l,d,a),MN(t,t.mapping.slice(a).map(d,1),r,void 0,m===null);let p=t.mapping.slice(a),x=p.map(d,1),g=p.map(d+l.nodeSize,1);return t.step(new ln(x,g,x+1,g-1,new $e(Ne.from(r.create(u,null,l.marks)),0,0),1,!0)),m===!0&&XR(t,l,d,a),!1}})}function XR(t,e,s,r){e.forEach((i,a)=>{if(i.isText){let l,d=/\r?\n|\r/g;for(;l=d.exec(i.text);){let u=t.mapping.slice(r).map(s+1+a+l.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function ZR(t,e,s,r){e.forEach((i,a)=>
vendor: 4,806 bytes, lines 394-395
394{if(i.type==i.type.schema.linebreakReplacement){let l=t.mapping.slice(r).map(s+1+a);t.replaceWith(l,l+1,e.type.schema.text(`
395`))}})}function Tee(t,e,s){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,s)}function Eee(t,e,s,r,i){let a=t.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");s||(s=a.type);let l=s.create(r,null,i||a.marks);if(a.isLeaf)return t.replaceWith(e,e+a.nodeSize,l);if(!s.validContent(a.content))throw new RangeError("Invalid content for node type "+s.name);t.step(new ln(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new $e(Ne.from(l),0,0),1,!0))}function io(t,e,s=1,r){let i=t.resolve(e),a=i.depth-s,l=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let m=i.depth-1,p=s-2;m>a;m--,p--){let x=i.node(m),g=i.index(m);if(x.type.spec.isolating)return!1;let b=x.content.cutByIndex(g,x.childCount),v=r&&r[p+1];v&&(b=b.replaceChild(0,v.type.create(v.attrs)));let k=r&&r[p]||x;if(!x.canReplace(g+1,x.childCount)||!k.type.validContent(b))return!1}let d=i.indexAfter(a),u=r&&r[0];return i.node(a).canReplaceWith(d,d,u?u.type:i.node(a+1).type)}function Aee(t,e,s=1,r){let i=t.doc.resolve(e),a=Ne.empty,l=Ne.empty;for(let d=i.depth,u=i.depth-s,m=s-1;d>u;d--,m--){a=Ne.from(i.node(d).copy(a));let p=r&&r[m];l=Ne.from(p?p.type.create(p.attrs,l):i.node(d).copy(l))}t.step(new Us(e,e,new $e(a.append(l),s,s),!0))}function Rl(t,e){let s=t.resolve(e),r=s.index();return eD(s.nodeBefore,s.nodeAfter)&&s.parent.canReplace(r,r+1)}function Mee(t,e){e.content.size||t.type.compatibleContent(e.type);let s=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let a=e.child(i),l=a.type==r?t.type.schema.nodes.text:a.type;if(s=s.matchType(l),!s||!t.type.allowsMarks(a.marks))return!1}return s.validEnd}function eD(t,e){return!!(t&&e&&!t.isLeaf&&Mee(t,e))}function Eb(t,e,s=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let a,l,d=r.index(i);if(i==r.depth?(a=r.nodeBefore,l=r.nodeAfter):s>0?(a=r.node(i+1),d++,l=r.node(i).maybeChild(d)):(a=r.node(i).maybeChild(d-1),l=r.node(i+1)),a&&!a.isTextblock&&eD(a,l)&&r.node(i).canReplace(d,d+1))return e;if(i==0)break;e=s<0?r.before(i):r.after(i)}}function _ee(t,e,s){let r=null,{linebreakReplacement:i}=t.doc.type.schema,a=t.doc.resolve(e-s),l=a.node().type;if(i&&l.inlineContent){let p=l.whitespace=="pre",x=!!l.contentMatch.matchType(i);p&&!x?r=!1:!p&&x&&(r=!0)}let d=t.steps.length;if(r===!1){let p=t.doc.resolve(e+s);ZR(t,p.node(),p.before(),d)}l.inlineContent&&MN(t,e+s-1,l,a.node().contentMatchAt(a.index()),r==null);let u=t.mapping.slice(d),m=u.map(e-s);if(t.step(new Us(m,u.map(e+s,-1),$e.empty,!0)),r===!0){let p=t.doc.resolve(m);XR(t,p.node(),p.before(),t.steps.length)}return t}function Oee(t,e,s){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),s))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let a=r.index(i);if(r.node(i).canReplaceWith(a,a,s))return r.before(i+1);if(a>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let a=r.indexAfter(i);if(r.node(i).canReplaceWith(a,a,s))return r.after(i+1);if(a<r.node(i).childCount)return null}return null}function tD(t,e,s){let r=t.resolve(e);if(!s.content.size)return e;let i=s.content;for(let a=0;a<s.openStart;a++)i=i.firstChild.content;for(let a=1;a<=(s.openStart==0&&s.size?2:1);a++)for(let l=r.depth;l>=0;l--){let d=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,u=r.index(l)+(d>0?1:0),m=r.node(l),p=!1;if(a==1)p=m.canReplace(u,u,i);else{let x=m.contentMatchAt(u).findWrapping(i.firstChild.type);p=x&&m.canReplaceWith(u,u,x[0])}if(p)return d==0?r.pos:d<0?r.before(l+1):r.after(l+1)}return null}function Ab(t,e,s=e,r=$e.empty){if(e==s&&!r.size)return null;let i=t.resolve(e),a=t.resolve(s);return sD(i,a,r)?new Us(e,s,r):new Ree(i,a,r).fit()}function sD(t,e,s){return!s.openStart&&!s.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),s.content)}class Ree{constructor(e,s,r){this.$from=e,this.$to=s,this.unplaced=r,this.frontier=[],this.placed=Ne.empty;for(let i=0;i<=e.depth;i++){let a=e.node(i);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=Ne.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let m=this.findFittable();m?this.placeNodes(m):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),s=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let a=this.placed,l=r.depth,d=i.depth;for(;l&&d&&a.childCount==1;)a=a.firstChild.content,l--,d--;let u=new $e(a,l,d);return e>
vendor: 5,780 bytes, line 395
395-1?new ln(r.pos,e,this.$to.pos,this.$to.end(),u,s):u.size||r.pos!=this.$to.pos?new Us(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let s=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let a=s.firstChild;if(s.childCount>1&&(i=0),a.type.spec.isolating&&i<=r){e=r;break}s=a.content}for(let s=1;s<=2;s++)for(let r=s==1?e:this.unplaced.openStart;r>=0;r--){let i,a=null;r?(a=Vv(this.unplaced.content,r-1).firstChild,i=a.content):i=this.unplaced.content;let l=i.firstChild;for(let d=this.depth;d>=0;d--){let{type:u,match:m}=this.frontier[d],p,x=null;if(s==1&&(l?m.matchType(l.type)||(x=m.fillBefore(Ne.from(l),!1)):a&&u.compatibleContent(a.type)))return{sliceDepth:r,frontierDepth:d,parent:a,inject:x};if(s==2&&l&&(p=m.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:d,parent:a,wrap:p};if(a&&m.matchType(a.type))break}}}openMore(){let{content:e,openStart:s,openEnd:r}=this.unplaced,i=Vv(e,s);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new $e(e,s+1,Math.max(r,i.size+s>=e.size-r?s+1:0)),!0)}dropNode(){let{content:e,openStart:s,openEnd:r}=this.unplaced,i=Vv(e,s);if(i.childCount<=1&&s>0){let a=e.size-s<=s+i.size;this.unplaced=new $e(Wh(e,s-1,1),s-1,a?s-1:r)}else this.unplaced=new $e(Wh(e,s,1),s,r)}placeNodes({sliceDepth:e,frontierDepth:s,parent:r,inject:i,wrap:a}){for(;this.depth>s;)this.closeFrontierNode();if(a)for(let k=0;k<a.length;k++)this.openFrontierNode(a[k]);let l=this.unplaced,d=r?r.content:l.content,u=l.openStart-e,m=0,p=[],{match:x,type:g}=this.frontier[s];if(i){for(let k=0;k<i.childCount;k++)p.push(i.child(k));x=x.matchFragment(i)}let b=d.size+e-(l.content.size-l.openEnd);for(;m<d.childCount;){let k=d.child(m),N=x.matchType(k.type);if(!N)break;m++,(m>1||u==0||k.content.size)&&(x=N,p.push(nD(k.mark(g.allowedMarks(k.marks)),m==1?u:0,m==d.childCount?b:-1)))}let v=m==d.childCount;v||(b=-1),this.placed=Gh(this.placed,s,Ne.from(p)),this.frontier[s].match=x,v&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let k=0,N=d;k<b;k++){let S=N.lastChild;this.frontier.push({type:S.type,match:S.contentMatchAt(S.childCount)}),N=S.content}this.unplaced=v?e==0?$e.empty:new $e(Wh(l.content,e-1,1),e-1,b<0?l.openEnd:e-1):new $e(Wh(l.content,e,m),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],s;if(!e.type.isTextblock||!Fv(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(s=this.findCloseLevel(this.$to))&&s.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let s=Math.min(this.depth,e.depth);s>=0;s--){let{match:r,type:i}=this.frontier[s],a=s<e.depth&&e.end(s+1)==e.pos+(e.depth-(s+1)),l=Fv(e,s,i,r,a);if(l){for(let d=s-1;d>=0;d--){let{match:u,type:m}=this.frontier[d],p=Fv(e,d,m,u,!0);if(!p||p.childCount)continue e}return{depth:s,fit:l,move:a?e.doc.resolve(e.after(s+1)):e}}}}close(e){let s=this.findCloseLevel(e);if(!s)return null;for(;this.depth>s.depth;)this.closeFrontierNode();s.fit.childCount&&(this.placed=Gh(this.placed,s.depth,s.fit)),e=s.move;for(let r=s.depth+1;r<=e.depth;r++){let i=e.node(r),a=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,a)}return e}openFrontierNode(e,s=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Gh(this.placed,this.depth,Ne.from(e.create(s,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let s=this.frontier.pop().match.fillBefore(Ne.empty,!0);s.childCount&&(this.placed=Gh(this.placed,this.frontier.length,s))}}function Wh(t,e,s){return e==0?t.cutByIndex(s,t.childCount):t.replaceChild(0,t.firstChild.copy(Wh(t.firstChild.content,e-1,s)))}function Gh(t,e,s){return e==0?t.append(s):t.replaceChild(t.childCount-1,t.lastChild.copy(Gh(t.lastChild.content,e-1,s)))}function Vv(t,e){for(let s=0;s<e;s++)t=t.firstChild.content;return t}function nD(t,e,s){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,nD(r.firstChild,e-1,r.childCount==1?s-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),s<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Ne.empty,!0)))),t.copy(r)}function Fv(t,e,s,r,i){let a=t.node(e),l=i?t.indexAfter(e):t.index(e);if(l==a.childCount&&!s.compatibleContent(a.type))return null;let d=r.fillBefore(a.content,!0,l);return d&&!Dee(s,a.content,l)?d:null}function Dee(t,e,s){for(let r=s;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Pee(t){return t.spec.defining||t.spec.definingForContent}function Iee(t,e,s,r){if(!r.size)return t.deleteRange(e,s);let i=t.doc.resolve(e),a=t.doc.resolve(s);if(sD(i,a,r))return t.step(new Us(e,s,r));let l=iD(i,a);l[l.length-1]==0&&l.pop();let d=-(i.depth+1);l.unshift(d);for(let g=i.depth,b=i.pos-1;g>0;g--,b--){let v=i.node(g).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;l.indexOf(g)>-1?d=g:i.before(g)==b&&l.splice(1,0,-g)}let u=l.indexOf(d),m=[],p=r.openStart;for(let g=r.content,b=0;;b++){let v=g.firstChild;if(m.push(v),b==r.openStart)break;g=v.content}for(let g=p-1;g>=0;g--){let b=m[g],v=Pee(b.type);if(v&&!b.sameMarkup(i.node(Math.abs(d)-1)))p=g;else if(v||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+p+1)%(r.openStart+1),v=m[b];if(v)for(let k=0;k<l.length;k++){let N=l[(k+u)%l.length],S=!0;N<0&&(S=!1,N=-N);let A=i.node(N-1),E=i.index(N-1);if(A.canReplaceWith(E,E,v.type,v.marks))return t.replace(i.before(N),S?a.after(N):s,new $e(rD(r.content,0,r.openStart,b),b,r.openEnd))}}let x=t.steps.length;for(let g=l.length-1;g>=0&&(t.replace(e,s,r),!(t.steps.length>x));g--){let b=l[g];b<0||(e=i.before(b),s=a.after(b))}}function rD(t,e,s,r,i){if(e<s){let a=t.firstChild;
vendor: 5,318 bytes, line 395
395t=t.replaceChild(0,a.copy(rD(a.content,e+1,s,r,a)))}if(e>r){let a=i.contentMatchAt(0),l=a.fillBefore(t).append(t);t=l.append(a.matchFragment(l).fillBefore(Ne.empty,!0))}return t}function Lee(t,e,s,r){if(!r.isInline&&e==s&&t.doc.resolve(e).parent.content.size){let i=Oee(t.doc,e,r.type);i!=null&&(e=s=i)}t.replaceRange(e,s,new $e(Ne.from(r),0,0))}function $ee(t,e,s){let r=t.doc.resolve(e),i=t.doc.resolve(s);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let l=r.sharedDepth(s),d=!1;for(let u=r.depth;u>l;u--)r.node(u).type.spec.isolating&&(d=!0);for(let u=i.depth;u>l;u--)i.node(u).type.spec.isolating&&(d=!0);if(!d){for(let u=r.depth;u>0&&e==r.start(u);u--)e=r.before(u);for(let u=i.depth;u>0&&s==i.start(u);u--)s=i.before(u);r=t.doc.resolve(e),i=t.doc.resolve(s)}}let a=iD(r,i);for(let l=0;l<a.length;l++){let d=a[l],u=l==a.length-1;if(u&&d==0||r.node(d).type.contentMatch.validEnd)return t.delete(r.start(d),i.end(d));if(d>0&&(u||r.node(d-1).canReplace(r.index(d-1),i.indexAfter(d-1))))return t.delete(r.before(d),i.after(d))}for(let l=1;l<=r.depth&&l<=i.depth;l++)if(e-r.start(l)==r.depth-l&&s>r.end(l)&&i.end(l)-s!=i.depth-l&&r.start(l-1)==i.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),i.index(l-1)))return t.delete(r.before(l),s);t.delete(e,s)}function iD(t,e){let s=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let a=t.start(i);if(a<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(a==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==a-1)&&s.push(i)}return s}class du extends zn{constructor(e,s,r){super(),this.pos=e,this.attr=s,this.value=r}apply(e){let s=e.nodeAt(this.pos);if(!s)return Hs.fail("No node at attribute step's position");let r=Object.create(null);for(let a in s.attrs)r[a]=s.attrs[a];r[this.attr]=this.value;let i=s.type.create(r,null,s.marks);return Hs.fromReplace(e,this.pos,this.pos+1,new $e(Ne.from(i),0,s.isLeaf?0:1))}getMap(){return Mr.empty}invert(e){return new du(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let s=e.mapResult(this.pos,1);return s.deletedAfter?null:new du(s.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,s){if(typeof s.pos!="number"||typeof s.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new du(s.pos,s.attr,s.value)}}zn.jsonID("attr",du);class Fm extends zn{constructor(e,s){super(),this.attr=e,this.value=s}apply(e){let s=Object.create(null);for(let i in e.attrs)s[i]=e.attrs[i];s[this.attr]=this.value;let r=e.type.create(s,e.content,e.marks);return Hs.ok(r)}getMap(){return Mr.empty}invert(e){return new Fm(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,s){if(typeof s.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Fm(s.attr,s.value)}}zn.jsonID("docAttr",Fm);let wu=class extends Error{};wu=function t(e){let s=Error.call(this,e);return s.__proto__=t.prototype,s};wu.prototype=Object.create(Error.prototype);wu.prototype.constructor=wu;wu.prototype.name="TransformError";class aD{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Vm}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let s=this.maybeStep(e);if(s.failed)throw new wu(s.failed);return this}maybeStep(e){let s=e.apply(this.doc);return s.failed||this.addStep(e,s.doc),s}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,s=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),s=i.map(s,-1)),i.forEach((a,l,d,u)=>{e=Math.min(e,d),s=Math.max(s,u)})}return e==1e9?null:{from:e,to:s}}addStep(e,s){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=s}replace(e,s=e,r=$e.empty){let i=Ab(this.doc,e,s,r);return i&&this.step(i),this}replaceWith(e,s,r){return this.replace(e,s,new $e(Ne.from(r),0,0))}delete(e,s){return this.replace(e,s,$e.empty)}insert(e,s){return this.replaceWith(e,e,s)}replaceRange(e,s,r){return Iee(this,e,s,r),this}replaceRangeWith(e,s,r){return Lee(this,e,s,r),this}deleteRange(e,s){return $ee(this,e,s),this}lift(e,s){return jee(this,e,s),this}join(e,s=1){return _ee(this,e,s),this}wrap(e,s){return See(this,e,s),this}setBlockType(e,s=e,r,i=null){return Cee(this,e,s,r,i),this}setNodeMarkup(e,s,r=null,i){return Eee(this,e,s,r,i),this}setNodeAttribute(e,s,r){return this.step(new du(e,s,r)),this}setDocAttribute(e,s){return this.step(new Fm(e,s)),this}addNodeMark(e,s){return this.step(new ol(e,s)),this}removeNodeMark(e,s){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(s instanceof qt)s.isInSet(r.marks)&&this.step(new Wc(e,s));else{let i=r.marks,a,l=[];for(;a=s.isInSet(i);)l.push(new Wc(e,a)),i=a.removeFromSet(i);for(let d=l.length-1;d>=0;d--)this.step(l[d])}return this}split(e,s=1,r){return Aee(this,e,s,r),this}addMark(e,s,r){return yee(this,e,s,r),this}removeMark(e,s,r){return vee(this,e,s,r),this}clearIncompatible(e,s,r){return MN(this,e,s,r),this}}const Uv=Object.create(null);class gt{constructor(e,s,r){this.$anchor=e,this.$head=s,this.ranges=r||[new Bee
vendor: 4,515 bytes, line 395
395(e.min(s),e.max(s))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let s=0;s<e.length;s++)if(e[s].$from.pos!=e[s].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,s=$e.empty){let r=s.content.lastChild,i=null;for(let d=0;d<s.openEnd;d++)i=r,r=r.lastChild;let a=e.steps.length,l=this.ranges;for(let d=0;d<l.length;d++){let{$from:u,$to:m}=l[d],p=e.mapping.slice(a);e.replaceRange(p.map(u.pos),p.map(m.pos),d?$e.empty:s),d==0&&f4(e,a,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,s){let r=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){let{$from:l,$to:d}=i[a],u=e.mapping.slice(r),m=u.map(l.pos),p=u.map(d.pos);a?e.deleteRange(m,p):(e.replaceRangeWith(m,p,s),f4(e,r,s.isInline?-1:1))}}static findFrom(e,s,r=!1){let i=e.parent.inlineContent?new it(e):Qd(e.node(0),e.parent,e.pos,e.index(),s,r);if(i)return i;for(let a=e.depth-1;a>=0;a--){let l=s<0?Qd(e.node(0),e.node(a),e.before(a+1),e.index(a),s,r):Qd(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,s,r);if(l)return l}return null}static near(e,s=1){return this.findFrom(e,s)||this.findFrom(e,-s)||new Ir(e.node(0))}static atStart(e){return Qd(e,e,0,0,1)||new Ir(e)}static atEnd(e){return Qd(e,e,e.content.size,e.childCount,-1)||new Ir(e)}static fromJSON(e,s){if(!s||!s.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Uv[s.type];if(!r)throw new RangeError(`No selection type ${s.type} defined`);return r.fromJSON(e,s)}static jsonID(e,s){if(e in Uv)throw new RangeError("Duplicate use of selection JSON ID "+e);return Uv[e]=s,s.prototype.jsonID=e,s}getBookmark(){return it.between(this.$anchor,this.$head).getBookmark()}}gt.prototype.visible=!0;class Bee{constructor(e,s){this.$from=e,this.$to=s}}let m4=!1;function p4(t){!m4&&!t.parent.inlineContent&&(m4=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class it extends gt{constructor(e,s=e){p4(e),p4(s),super(e,s)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,s){let r=e.resolve(s.map(this.head));if(!r.parent.inlineContent)return gt.near(r);let i=e.resolve(s.map(this.anchor));return new it(i.parent.inlineContent?i:r,r)}replace(e,s=$e.empty){if(super.replace(e,s),s==$e.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof it&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Mb(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,s){if(typeof s.anchor!="number"||typeof s.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new it(e.resolve(s.anchor),e.resolve(s.head))}static create(e,s,r=s){let i=e.resolve(s);return new this(i,r==s?i:e.resolve(r))}static between(e,s,r){let i=e.pos-s.pos;if((!r||i)&&(r=i>=0?1:-1),!s.parent.inlineContent){let a=gt.findFrom(s,r,!0)||gt.findFrom(s,-r,!0);if(a)s=a.$head;else return gt.near(s,r)}return e.parent.inlineContent||(i==0?e=s:(e=(gt.findFrom(e,-r,!0)||gt.findFrom(e,r,!0)).$anchor,e.pos<s.pos!=i<0&&(e=s))),new it(e,s)}}gt.jsonID("text",it);class Mb{constructor(e,s){this.anchor=e,this.head=s}map(e){return new Mb(e.map(this.anchor),e.map(this.head))}resolve(e){return it.between(e.resolve(this.anchor),e.resolve(this.head))}}class Xe extends gt{constructor(e){let s=e.nodeAfter,r=e.node(0).resolve(e.pos+s.nodeSize);super(e,r),this.node=s}map(e,s){let{deleted:r,pos:i}=s.mapResult(this.anchor),a=e.resolve(i);return r?gt.near(a):new Xe(a)}content(){return new $e(Ne.from(this.node),0,0)}eq(e){return e instanceof Xe&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ON(this.anchor)}static fromJSON(e,s){if(typeof s.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Xe(e.resolve(s.anchor))}static create(e,s){return new Xe(e.resolve(s))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Xe.prototype.visible=!1;gt.jsonID("node",Xe);class ON{constructor(e){this.anchor=e}map(e){let{deleted:s,pos:r}=e.mapResult(this.anchor);return s?new Mb(r,r):new ON(r)}resolve(e){let s=e.resolve(this.anchor),r=s.nodeAfter;return r&&Xe.isSelectable(r)?new Xe(s):gt.near(s)}}class Ir extends gt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}
vendor: 4,248 bytes, line 395
395replace(e,s=$e.empty){if(s==$e.empty){e.delete(0,e.doc.content.size);let r=gt.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,s)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ir(e)}map(e){return new Ir(e)}eq(e){return e instanceof Ir}getBookmark(){return zee}}gt.jsonID("all",Ir);const zee={map(){return this},resolve(t){return new Ir(t)}};function Qd(t,e,s,r,i,a=!1){if(e.inlineContent)return it.create(t,s);for(let l=r-(i>0?0:1);i>0?l<e.childCount:l>=0;l+=i){let d=e.child(l);if(d.isAtom){if(!a&&Xe.isSelectable(d))return Xe.create(t,s-(i<0?d.nodeSize:0))}else{let u=Qd(t,d,s+i,i<0?d.childCount:0,i,a);if(u)return u}s+=d.nodeSize*i}return null}function f4(t,e,s){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Us||i instanceof ln))return;let a=t.mapping.maps[r],l;a.forEach((d,u,m,p)=>{l==null&&(l=p)}),t.setSelection(gt.near(t.doc.resolve(l),s))}const x4=1,tx=2,g4=4;class Vee extends aD{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|x4)&~tx,this.storedMarks=null,this}get selectionSet(){return(this.updated&x4)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=tx,this}ensureMarks(e){return qt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&tx)>0}addStep(e,s){super.addStep(e,s),this.updated=this.updated&~tx,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,s=!0){let r=this.selection;return s&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||qt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,s,r){let i=this.doc.type.schema;if(s==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=s),!e)return this.deleteRange(s,r);let a=this.storedMarks;if(!a){let l=this.doc.resolve(s);a=r==s?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(s,r,i.text(e,a)),!this.selection.empty&&this.selection.to==s+e.length&&this.setSelection(gt.near(this.selection.$to)),this}}setMeta(e,s){return this.meta[typeof e=="string"?e:e.key]=s,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=g4,this}get scrolledIntoView(){return(this.updated&g4)>0}}function b4(t,e){return!e||!t?t:t.bind(e)}class Kh{constructor(e,s,r){this.name=e,this.init=b4(s.init,r),this.apply=b4(s.apply,r)}}const Fee=[new Kh("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Kh("selection",{init(t,e){return t.selection||gt.atStart(e.doc)},apply(t){return t.selection}}),new Kh("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,s,r){return r.selection.$cursor?t.storedMarks:null}}),new Kh("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Hv{constructor(e,s){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Fee.slice(),s&&s.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Kh(r.key,r.spec.state,r))})}}class iu{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}
vendor: 4,629 bytes, line 395
395apply(e){return this.applyTransaction(e).state}filterTransaction(e,s=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=s){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let s=[e],r=this.applyInner(e),i=null;for(;;){let a=!1;for(let l=0;l<this.config.plugins.length;l++){let d=this.config.plugins[l];if(d.spec.appendTransaction){let u=i?i[l].n:0,m=i?i[l].state:this,p=u<s.length&&d.spec.appendTransaction.call(d,u?s.slice(u):s,m,r);if(p&&r.filterTransaction(p,l)){if(p.setMeta("appendedTransaction",e),!i){i=[];for(let x=0;x<this.config.plugins.length;x++)i.push(x<l?{state:r,n:s.length}:{state:this,n:0})}s.push(p),r=r.applyInner(p),a=!0}i&&(i[l]={state:r,n:s.length})}}if(!a)return{state:r,transactions:s}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let s=new iu(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let a=r[i];s[a.name]=a.apply(e,this[a.name],this,s)}return s}get tr(){return new Vee(this)}static create(e){let s=new Hv(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new iu(s);for(let i=0;i<s.fields.length;i++)r[s.fields[i].name]=s.fields[i].init(e,r);return r}reconfigure(e){let s=new Hv(this.schema,e.plugins),r=s.fields,i=new iu(s);for(let a=0;a<r.length;a++){let l=r[a].name;i[l]=this.hasOwnProperty(l)?this[l]:r[a].init(e,i)}return i}toJSON(e){let s={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(s.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],a=i.spec.state;a&&a.toJSON&&(s[r]=a.toJSON.call(i,this[i.key]))}return s}static fromJSON(e,s,r){if(!s)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Hv(e.schema,e.plugins),a=new iu(i);return i.fields.forEach(l=>{if(l.name=="doc")a.doc=dl.fromJSON(e.schema,s.doc);else if(l.name=="selection")a.selection=gt.fromJSON(a.doc,s.selection);else if(l.name=="storedMarks")s.storedMarks&&(a.storedMarks=s.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let d in r){let u=r[d],m=u.spec.state;if(u.key==l.name&&m&&m.fromJSON&&Object.prototype.hasOwnProperty.call(s,d)){a[l.name]=m.fromJSON.call(u,e,s[d],a);return}}a[l.name]=l.init(e,a)}}),a}}function oD(t,e,s){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=oD(i,e,{})),s[r]=i}return s}class ws{constructor(e){this.spec=e,this.props={},e.props&&oD(e.props,this,this.props),this.key=e.key?e.key.key:lD("plugin")}getState(e){return e[this.key]}}const qv=Object.create(null);function lD(t){return t in qv?t+"$"+ ++qv[t]:(qv[t]=0,t+"$")}class sn{constructor(e="key"){this.key=lD(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const RN=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function cD(t,e){let{$cursor:s}=t.selection;return!s||(e?!e.endOfTextblock("backward",t):s.parentOffset>0)?null:s}const dD=(t,e,s)=>{let r=cD(t,s);if(!r)return!1;let i=DN(r);if(!i){let l=r.blockRange(),d=l&&Du(l);return d==null?!1:(e&&e(t.tr.lift(l,d).scrollIntoView()),!0)}let a=i.nodeBefore;if(yD(t,i,e,-1))return!0;if(r.parent.content.size==0&&(ju(a,"end")||Xe.isSelectable(a)))for(let l=r.depth;;l--){let d=Ab(t.doc,r.before(l),r.after(l),$e.empty);if(d&&d.slice.size<d.to-d.from){if(e){let u=t.tr.step(d);u.setSelection(ju(a,"end")?gt.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):Xe.create(u.doc,i.pos-a.nodeSize)),e(u.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Uee=(t,e,s)=>{let r=cD(t,s);if(!r)return!1;let i=DN(r);return i?uD(t,i,e):!1},Hee=(t,e,s)=>{let r=mD(t,s);if(!r)return!1;let i=PN(r);return i?uD(t,i,e):!1};function uD(t,e,s){let r=e.nodeBefore,i=r,a=e.pos-1;for(;!i.isTextblock;a--){if(i.type.spec.isolating)return!1;let p=i.lastChild;if(!p)return!1;i=p}let l=e.nodeAfter,d=l,u=e.pos+1;for(;!d.isTextblock;u++){if(d.type.spec.isolating)return!1;let p=d.firstChild;if(!p)return!1;d=p}let m=Ab(t.doc,a,u,$e.empty);if(!m||m.from!=a||m instanceof Us&&m.slice.size>=u-a)return!1;if(s){let p=t.tr.step(m);p.setSelection(it.create(p.doc,a)),s(p.scrollIntoView())}return!0}function ju(t,e,s=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;
vendor: 15,931 bytes, lines 395-396
395if(s&&r.childCount!=1)return!1}return!1}const hD=(t,e,s)=>{let{$head:r,empty:i}=t.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(s?!s.endOfTextblock("backward",t):r.parentOffset>0)return!1;a=DN(r)}let l=a&&a.nodeBefore;return!l||!Xe.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Xe.create(t.doc,a.pos-l.nodeSize)).scrollIntoView()),!0)};function DN(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function mD(t,e){let{$cursor:s}=t.selection;return!s||(e?!e.endOfTextblock("forward",t):s.parentOffset<s.parent.content.size)?null:s}const pD=(t,e,s)=>{let r=mD(t,s);if(!r)return!1;let i=PN(r);if(!i)return!1;let a=i.nodeAfter;if(yD(t,i,e,1))return!0;if(r.parent.content.size==0&&(ju(a,"start")||Xe.isSelectable(a))){let l=Ab(t.doc,r.before(),r.after(),$e.empty);if(l&&l.slice.size<l.to-l.from){if(e){let d=t.tr.step(l);d.setSelection(ju(a,"start")?gt.findFrom(d.doc.resolve(d.mapping.map(i.pos)),1):Xe.create(d.doc,d.mapping.map(i.pos))),e(d.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},fD=(t,e,s)=>{let{$head:r,empty:i}=t.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(s?!s.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;a=PN(r)}let l=a&&a.nodeAfter;return!l||!Xe.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Xe.create(t.doc,a.pos)).scrollIntoView()),!0)};function PN(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let s=t.node(e);if(t.index(e)+1<s.childCount)return t.doc.resolve(t.after(e+1));if(s.type.spec.isolating)break}return null}const qee=(t,e)=>{let s=t.selection,r=s instanceof Xe,i;if(r){if(s.node.isTextblock||!Rl(t.doc,s.from))return!1;i=s.from}else if(i=Eb(t.doc,s.from,-1),i==null)return!1;if(e){let a=t.tr.join(i);r&&a.setSelection(Xe.create(a.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},Wee=(t,e)=>{let s=t.selection,r;if(s instanceof Xe){if(s.node.isTextblock||!Rl(t.doc,s.to))return!1;r=s.to}else if(r=Eb(t.doc,s.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Gee=(t,e)=>{let{$from:s,$to:r}=t.selection,i=s.blockRange(r),a=i&&Du(i);return a==null?!1:(e&&e(t.tr.lift(i,a).scrollIntoView()),!0)},xD=(t,e)=>{let{$head:s,$anchor:r}=t.selection;return!s.parent.type.spec.code||!s.sameParent(r)?!1:(e&&e(t.tr.insertText(`
396`).scrollIntoView()),!0)};function IN(t){for(let e=0;e<t.edgeCount;e++){let{type:s}=t.edge(e);if(s.isTextblock&&!s.hasRequiredAttrs())return s}return null}const Kee=(t,e)=>{let{$head:s,$anchor:r}=t.selection;if(!s.parent.type.spec.code||!s.sameParent(r))return!1;let i=s.node(-1),a=s.indexAfter(-1),l=IN(i.contentMatchAt(a));if(!l||!i.canReplaceWith(a,a,l))return!1;if(e){let d=s.after(),u=t.tr.replaceWith(d,d,l.createAndFill());u.setSelection(gt.near(u.doc.resolve(d),1)),e(u.scrollIntoView())}return!0},gD=(t,e)=>{let s=t.selection,{$from:r,$to:i}=s;if(s instanceof Ir||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=IN(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let l=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,d=t.tr.insert(l,a.createAndFill());d.setSelection(it.create(d.doc,l+1)),e(d.scrollIntoView())}return!0},bD=(t,e)=>{let{$cursor:s}=t.selection;if(!s||s.parent.content.size)return!1;if(s.depth>1&&s.after()!=s.end(-1)){let a=s.before();if(io(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let r=s.blockRange(),i=r&&Du(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function Yee(t){return(e,s)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Xe&&e.selection.node.isBlock)return!r.parentOffset||!io(e.doc,r.pos)?!1:(s&&s(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],l,d,u=!1,m=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){u=r.end(b)==r.pos+(r.depth-b),m=r.start(b)==r.pos-(r.depth-b),d=IN(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),a.unshift(u&&d?{type:d}:null),l=b;break}else{if(b==1)return!1;a.unshift(null)}let p=e.tr;(e.selection instanceof it||e.selection instanceof Ir)&&p.deleteSelection();let x=p.mapping.map(r.pos),g=io(p.doc,x,a.length,a);if(g||(a[0]=d?{type:d}:null,g=io(p.doc,x,a.length,a)),!g)return!1;if(p.split(x,a.length,a),!u&&m&&r.node(l).type!=d){let b=p.mapping.map(r.before(l)),v=p.doc.resolve(b);d&&r.node(l-1).canReplaceWith(v.index(),v.index()+1,d)&&p.setNodeMarkup(p.mapping.map(r.before(l)),d)}return s&&s(p.scrollIntoView()),!0}}const Qee=Yee(),Jee=(t,e)=>{let{$from:s,to:r}=t.selection,i,a=s.sharedDepth(r);return a==0?!1:(i=s.before(a),e&&e(t.tr.setSelection(Xe.create(t.doc,i))),!0)};function Xee(t,e,s){let r=e.nodeBefore,i=e.nodeAfter,a=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(a-1,a)?(s&&s(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(a,a+1)||!(i.isTextblock||Rl(t.doc,e.pos))?!1:(s&&s(t.tr.join(e.pos).scrollIntoView()),!0)}function yD(t,e,s,r){let i=e.nodeBefore,a=e.nodeAfter,l,d,u=i.type.spec.isolating||a.type.spec.isolating;if(!u&&Xee(t,e,s))return!0;let m=!u&&e.parent.canReplace(e.index(),e.index()+1);if(m&&(l=(d=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&d.matchType(l[0]||a.type).validEnd){if(s){let b=e.pos+a.nodeSize,v=Ne.empty;for(let S=l.length-1;S>=0;S--)v=Ne.from(l[S].create(null,v));v=Ne.from(i.copy(v));let k=t.tr.step(new ln(e.pos-1,b,e.pos,b,new $e(v,1,0),l.length,!0)),N=k.doc.resolve(b+2*l.length);N.nodeAfter&&N.nodeAfter.type==i.type&&Rl(k.doc,N.pos)&&k.join(N.pos),s(k.scrollIntoView())}return!0}let p=a.type.spec.isolating||r>0&&u?null:gt.findFrom(e,1),x=p&&p.$from.blockRange(p.$to),g=x&&Du(x);if(g!=null&&g>=e.depth)return s&&s(t.tr.lift(x,g).scrollIntoView()),!0;if(m&&ju(a,"start",!0)&&ju(i,"end")){let b=i,v=[];for(;v.push(b),!b.isTextblock;)b=b.lastChild;let k=a,N=1;for(;!k.isTextblock;k=k.firstChild)N++;if(b.canReplace(b.childCount,b.childCount,k.content)){if(s){let S=Ne.empty;for(let E=v.length-1;E>=0;E--)S=Ne.from(v[E].copy(S));let A=t.tr.step(new ln(e.pos-v.length,e.pos+a.nodeSize,e.pos+N,e.pos+a.nodeSize-N,new $e(S,v.length,0),0,!0));s(A.scrollIntoView())}return!0}}return!1}function vD(t){return function(e,s){let r=e.selection,i=t<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(s&&s(e.tr.setSelection(it.create(e.doc,t<0?i.start(a):i.end(a)))),!0):!1}}const Zee=vD(-1),ete=vD(1);function tte(t,e=null){return function(s,r){let{$from:i,$to:a}=s.selection,l=i.blockRange(a),d=l&&_N(l,t,e);return d?(r&&r(s.tr.wrap(l,d).scrollIntoView()),!0):!1}}function y4(t,e=null){return function(s,r){let i=!1;for(let a=0;a<s.selection.ranges.length&&!i;a++){let{$from:{pos:l},$to:{pos:d}}=s.selection.ranges[a];s.doc.nodesBetween(l,d,(u,m)=>{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let p=s.doc.resolve(m),x=p.index();i=p.parent.canReplaceWith(x,x+1,t)}})}if(!i)return!1;if(r){let a=s.tr;for(let l=0;l<s.selection.ranges.length;l++){let{$from:{pos:d},$to:{pos:u}}=s.selection.ranges[l];a.setBlockType(d,u,t,e)}r(a.scrollIntoView())}return!0}}function LN(...t){return function(e,s,r){for(let i=0;i<t.length;i++)if(t[i](e,s,r))return!0;return!1}}LN(RN,dD,hD);LN(RN,pD,fD);LN(xD,gD,bD,Qee);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function ste(t,e=null){return function(s,r){let{$from:i,$to:a}=s.selection,l=i.blockRange(a);if(!l)return!1;let d=r?s.tr:null;return nte(d,l,t,e)?(r&&r(d.scrollIntoView()),!0):!1}}function nte(t,e,s,r=null){let i=!1,a=e,l=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(s)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=l.resolve(e.start-2);a=new gg(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new gg(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let d=_N(a,s,r,e);return d?(t&&rte(t,e,d,i,s),!0):!1}function rte(t,e,s,r,i){let a=Ne.empty;for(let p=s.length-1;p>=0;p--)a=Ne.from(s[p].type.create(s[p].attrs,a));t.step(new ln(e.start-(r?2:0),e.end,e.start,e.end,new $e(a,0,0),s.length,!0));let l=0;for(let p=0;p<s.length;p++)s[p].type==i&&(l=p+1);let d=s.length-l,u=e.start+s.length-(r?2:0),m=e.parent;for(let p=e.startIndex,x=e.endIndex,g=!0;p<x;p++,g=!1)!g&&io(t.doc,u,d)&&(t.split(u,d),u+=2*d),u+=m.child(p).nodeSize;return t}function ite(t){return function(e,s){let{$from:r,$to:i}=e.selection,a=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==t);return a?s?r.node(a.depth-1).type==t?ate(e,s,t,a):ote(e,s,a):!0:!1}}function ate(t,e,s,r){let i=t.tr,a=r.end,l=r.$to.end(r.depth);a<l&&(i.step(new ln(a-1,l,a,l,new $e(Ne.from(s.create(null,r.parent.copy())),1,0),1,!0)),r=new gg(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const d=Du(r);if(d==null)return!1;i.lift(r,d);let u=i.doc.resolve(i.mapping.map(a,-1)-1);return Rl(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&i.join(u.pos),e(i.scrollIntoView()),!0}function ote(t,e,s){let r=t.tr,i=s.parent;for(let b=s.end,v=s.endIndex-1,k=s.startIndex;v>k;v--)b-=i.child(v).nodeSize,r.delete(b-1,b+1);let a=r.doc.resolve(s.start),l=a.nodeAfter;if(r.mapping.map(s.end)!=s.start+a.nodeAfter.nodeSize)return!1;let d=s.startIndex==0,u=s.endIndex==i.childCount,m=a.node(-1),p=a.index(-1);if(!m.canReplace(p+(d?0:1),p+1,l.content.append(u?Ne.empty:Ne.from(i))))return!1;let x=a.pos,g=x+l.nodeSize;return r.step(new ln(x-(d?1:0),g+(u?1:0),x+1,g-1,new $e((d?Ne.empty:Ne.from(i.copy(Ne.empty))).append(u?Ne.empty:Ne.from(i.copy(Ne.empty))),d?0:1,u?0:1),d?0:1)),e(r.scrollIntoView()),!0}function lte(t){return function(e,s){let{$from:r,$to:i}=e.selection,a=r.blockRange(i,m=>m.childCount>0&&m.firstChild.type==t);if(!a)return!1;let l=a.startIndex;if(l==0)return!1;let d=a.parent,u=d.child(l-1);if(u.type!=t)return!1;if(s){let m=u.lastChild&&u.lastChild.type==d.type,p=Ne.from(m?t.create():null),x=new $e(Ne.from(t.create(null,Ne.from(d.type.create(null,p)))),m?3:1,0),g=a.start,b=a.end;s(e.tr.step(new ln(g-(m?3:1),b,g,b,x,1,!0)).scrollIntoView())}return!0}}const jn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Nu=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let T1=null;const Za=function(t,e,s){let r=T1||(T1=document.createRange());return r.setEnd(t,s??t.nodeValue.length),r.setStart(t,e||0),r},cte=function(){T1=null},Gc=function(t,e,s,r){return s&&(v4(t,e,s,r,-1)||v4(t,e,s,r,1))},dte=/^(img|br|input|textarea|hr)$/i;function v4(t,e,s,r,i){for(var a;;){if(t==s&&e==r)return!0;if(e==(i<0?0:ri(t))){let l=t.parentNode;if(!l||l.nodeType!=1||hp(t)||dte.test(t.nodeName)||t.contentEditable=="false")return!1;e=jn(t)+(i<0?0:1),t=l}else if(t.nodeType==1){let l=t.childNodes[e+(i<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((a=l.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)e+=i;else return!1;else t=l,e=i<0?ri(t):0}else return!1}}function ri(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ute(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=ri(t)}else if(t.parentNode&&!hp(t))e=jn(t),t=t.parentNode;else return null}}function hte(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!hp(t))e=jn(t)+1,t=t.parentNode;else return null}}function mte(t,e,s){for(let r=e==0,i=e==ri(t);r||i;){if(t==s)return!0;let a=jn(t);if(t=t.parentNode,!t)return!1;r=r&&a==0,i=i&&a==ri(t)}}function hp(t){let e;for(let s=t;s&&!(e=s.pmViewDesc);s=s.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const _b=function(t){return t.focusNode&&Gc(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function yc(t,e){let s=document.createEvent("Event");return s.initEvent("keydown",!0,!0),s.keyCode=t,s.key=s.code=e,s}function pte(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function fte(t,e,s){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,s);if(r)return{node:r.offsetNode,offset:Math.min(ri(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,s);if(r)return{node:r.startContainer,offset:Math.min(ri(r.startContainer),r.startOffset)}}}const ua=typeof navigator<"u"?navigator:null,w4=typeof document<"u"?document:null,Dl=ua&&ua.userAgent||"",E1=/Edge\/(\d+)/.exec(Dl),wD=/MSIE \d/.exec(Dl),A1=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Dl),mr=!!(wD||A1||E1),hl=wD?document.documentMode:A1?+A1[1]:E1?+E1[1]:0,ci=!mr&&/gecko\/(\d+)/i.test(Dl);ci&&+(/Firefox\/(\d+)/.exec(Dl)||[0,0])[1];const M1=!mr&&/Chrome\/(\d+)/.exec(Dl),Cn=!!M1,jD=M1?+M1[1]:0,Bn=!mr&&!!ua&&/Apple Computer/.test(ua.vendor),ku=Bn&&(/Mobile\/\w+/.test(Dl)||!!ua&&ua.maxTouchPoints>2),ni=ku||(ua?/Mac/.test(ua.platform):!1),ND=ua?/Win/.test(ua.platform):!1,so=/Android \d/.test(Dl),mp=!!w4&&"webkitFontSmoothing"in w4.documentElement.style,xte=mp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function gte(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Ga(t,e){return typeof t=="number"?t:t[e]}function bte(t){let e=t.getBoundingClientRect(),s=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*s,top:e.top,bottom:e.top+t.clientHeight*r}}function j4(t,e,s){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let l=s||t.dom;l;){if(l.nodeType!=1){l=Nu(l);continue}let d=l,u=d==a.body,m=u?gte(a):bte(d),p=0,x=0;if(e.top<m.top+Ga(r,"top")?x=-(m.top-e.top+Ga(i,"top")):e.bottom>m.bottom-Ga(r,"bottom")&&(x=e.bottom-e.top>m.bottom-m.top?e.top+Ga(i,"top")-m.top:e.bottom-m.bottom+Ga(i,"bottom")),e.left<m.left+Ga(r,"left")?p=-(m.left-e.left+Ga(i,"left")):e.right>m.right-Ga(r,"right")&&(p=e.right-m.right+Ga(i,"right")),p||x)if(u)a.defaultView.scrollBy(p,x);else{let b=d.scrollLeft,v=d.scrollTop;x&&(d.scrollTop+=x),p&&(d.scrollLeft+=p);let k=d.scrollLeft-b,N=d.scrollTop-v;e={left:e.left-k,top:e.top-N,right:e.right-k,bottom:e.bottom-N}}let g=u?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(g))break;l=g=="absolute"?l.offsetParent:Nu(l)}}function yte(t){let e=t.dom.getBoundingClientRect(),s=Math.max(0,e.top),r,i;for(let a=(e.left+e.right)/2,l=s+1;l<Math.min(innerHeight,e.bottom);l+=5){let d=t.root.elementFromPoint(a,l);if(!d||d==t.dom||!t.dom.contains(d))continue;let u=d.getBoundingClientRect();if(u.top>=s-20){r=d,i=u.top;break}}return{refDOM:r,refTop:i,stack:kD(t.dom)}}function kD(t){let e=[],s=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=s);r=Nu(r));return e}function vte({refDOM:t,refTop:e,stack:s}){let r=t?t.getBoundingClientRect().top:0;SD(s,r==0?0:r-e)}function SD(t,e){for(let s=0;s<t.length;s++){let{dom:r,top:i,left:a}=t[s];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=a&&(r.scrollLeft=a)}}let Fd=null;function wte(t){if(t.setActive)return t.setActive();if(Fd)return t.focus(Fd);let e=kD(t);t.focus(Fd==null?{get preventScroll(){return Fd={preventScroll:!0},!0}}:void 0),Fd||(Fd=!1,SD(e,0))}function CD(t,e){let s,r=2e8,i,a=0,l=e.top,d=e.top,u,m;for(let p=t.firstChild,x=0;p;p=p.nextSibling,x++){let g;if(p.nodeType==1)g=p.getClientRects();else if(p.nodeType==3)g=Za(p).getClientRects();else continue;for(let b=0;b<g.length;b++){let v=g[b];if(v.top<=l&&v.bottom>=d){l=Math.max(v.bottom,l),d=Math.min(v.top,d);let k=v.left>e.left?v.left-e.left:v.right<e.left?e.left-v.right:0;if(k<r){s=p,r=k,i=k&&s.nodeType==3?{left:v.right<e.left?v.right:v.left,top:e.top}:e,p.nodeType==1&&k&&(a=x+(e.left>=(v.left+v.right)/2?1:0));continue}}
vendor: 4,186 bytes, line 396
396else v.top>e.top&&!u&&v.left<=e.left&&v.right>=e.left&&(u=p,m={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!s&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(a=x+1)}}return!s&&u&&(s=u,i=m,r=0),s&&s.nodeType==3?jte(s,i):!s||r&&s.nodeType==1?{node:t,offset:a}:CD(s,i)}function jte(t,e){let s=t.nodeValue.length,r=document.createRange(),i;for(let a=0;a<s;a++){r.setEnd(t,a+1),r.setStart(t,a);let l=Xo(r,1);if(l.top!=l.bottom&&$N(e,l)){i={node:t,offset:a+(e.left>=(l.left+l.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function $N(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Nte(t,e){let s=t.parentNode;return s&&/^li$/i.test(s.nodeName)&&e.left<t.getBoundingClientRect().left?s:t}function kte(t,e,s){let{node:r,offset:i}=CD(e,s),a=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();a=l.left!=l.right&&s.left>(l.left+l.right)/2?1:-1}return t.docView.posFromDOM(r,i,a)}function Ste(t,e,s,r){let i=-1;for(let a=e,l=!1;a!=t.dom;){let d=t.docView.nearestDesc(a,!0),u;if(!d)return null;if(d.dom.nodeType==1&&(d.node.isBlock&&d.parent||!d.contentDOM)&&((u=d.dom.getBoundingClientRect()).width||u.height)&&(d.node.isBlock&&d.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(d.dom.nodeName)&&(!l&&u.left>r.left||u.top>r.top?i=d.posBefore:(!l&&u.right<r.left||u.bottom<r.top)&&(i=d.posAfter),l=!0),!d.contentDOM&&i<0&&!d.node.isText))return(d.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?d.posBefore:d.posAfter;a=d.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,s,-1)}function TD(t,e,s){let r=t.childNodes.length;if(r&&s.top<s.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-s.top)/(s.bottom-s.top))-2)),a=i;;){let l=t.childNodes[a];if(l.nodeType==1){let d=l.getClientRects();for(let u=0;u<d.length;u++){let m=d[u];if($N(e,m))return TD(l,e,m)}}if((a=(a+1)%r)==i)break}return t}function Cte(t,e){let s=t.dom.ownerDocument,r,i=0,a=fte(s,e.left,e.top);a&&({node:r,offset:i}=a);let l=(t.root.elementFromPoint?t.root:s).elementFromPoint(e.left,e.top),d;if(!l||!t.dom.contains(l.nodeType!=1?l.parentNode:l)){let m=t.dom.getBoundingClientRect();if(!$N(e,m)||(l=TD(t.dom,e,m),!l))return null}if(Bn)for(let m=l;r&&m;m=Nu(m))m.draggable&&(r=void 0);if(l=Nte(l,e),r){if(ci&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let p=r.childNodes[i],x;p.nodeName=="IMG"&&(x=p.getBoundingClientRect()).right<=e.left&&x.bottom>e.top&&i++}let m;mp&&i&&r.nodeType==1&&(m=r.childNodes[i-1]).nodeType==1&&m.contentEditable=="false"&&m.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?d=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(d=Ste(t,r,i,e))}d==null&&(d=kte(t,l,e));let u=t.docView.nearestDesc(l,!0);return{pos:d,inside:u?u.posAtStart-u.border:-1}}function N4(t){return t.top<t.bottom||t.left<t.right}function Xo(t,e){let s=t.getClientRects();if(s.length){let r=s[e<0?0:s.length-1];if(N4(r))return r}return Array.prototype.find.call(s,N4)||t.getBoundingClientRect()}const Tte=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ED(t,e,s){let{node:r,offset:i,atom:a}=t.docView.domFromPos(e,s<0?-1:1),l=mp||ci;if(r.nodeType==3)if(l&&(Tte.test(r.nodeValue)||(s<0?!i:i==r.nodeValue.length))){let u=Xo(Za(r,i,i),s);if(ci&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let m=Xo(Za(r,i-1,i-1),-1);if(m.top==u.top){let p=Xo(Za(r,i,i+1),-1);if(p.top!=u.top)return zh(p,p.left<m.left)}}return u}else{let u=i,m=i,p=s<0?1:-1;return s<0&&!i?(m++,p=-1):s>=0&&i==r.nodeValue.length?(u--,p=1):s<0?u--:m++,zh(Xo(Za(r,u,m),p),p<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&i&&(s<0||i==ri(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return Wv(u.getBoundingClientRect(),!1)}if(a==null&&i<ri(r)){let u=r.childNodes[i];if(u.nodeType==1)return Wv(u.getBoundingClientRect(),!0)}return Wv(r.getBoundingClientRect(),s>=0)}if(a==null&&i&&(s<0||i==ri(r))){let u=r.childNodes[i-1],m=u.nodeType==3?Za(u,ri(u)-(l?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(m)return zh(Xo(m,1),!1)}
vendor: 4,220 bytes, line 396
396if(a==null&&i<ri(r)){let u=r.childNodes[i];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let m=u?u.nodeType==3?Za(u,0,l?0:1):u.nodeType==1?u:null:null;if(m)return zh(Xo(m,-1),!0)}return zh(Xo(r.nodeType==3?Za(r):r,-s),s>=0)}function zh(t,e){if(t.width==0)return t;let s=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:s,right:s}}function Wv(t,e){if(t.height==0)return t;let s=e?t.top:t.bottom;return{top:s,bottom:s,left:t.left,right:t.right}}function AD(t,e,s){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return s()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function Ete(t,e,s){let r=e.selection,i=s=="up"?r.$from:r.$to;return AD(t,e,()=>{let{node:a}=t.docView.domFromPos(i.pos,s=="up"?-1:1);for(;;){let d=t.docView.nearestDesc(a,!0);if(!d)break;if(d.node.isBlock){a=d.contentDOM||d.dom;break}a=d.dom.parentNode}let l=ED(t,i.pos,1);for(let d=a.firstChild;d;d=d.nextSibling){let u;if(d.nodeType==1)u=d.getClientRects();else if(d.nodeType==3)u=Za(d,0,d.nodeValue.length).getClientRects();else continue;for(let m=0;m<u.length;m++){let p=u[m];if(p.bottom>p.top+1&&(s=="up"?l.top-p.top>(p.bottom-l.top)*2:p.bottom-l.bottom>(l.bottom-p.top)*2))return!1}}return!0})}const Ate=/[\u0590-\u08ac]/;function Mte(t,e,s){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,l=i==r.parent.content.size,d=t.domSelection();return d?!Ate.test(r.parent.textContent)||!d.modify?s=="left"||s=="backward"?a:l:AD(t,e,()=>{let{focusNode:u,focusOffset:m,anchorNode:p,anchorOffset:x}=t.domSelectionRange(),g=d.caretBidiLevel;d.modify("move",s,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:k}=t.domSelectionRange(),N=v&&!b.contains(v.nodeType==1?v:v.parentNode)||u==v&&m==k;try{d.collapse(p,x),u&&(u!=p||m!=x)&&d.extend&&d.extend(u,m)}catch{}return g!=null&&(d.caretBidiLevel=g),N}):r.pos==r.start()||r.pos==r.end()}let k4=null,S4=null,C4=!1;function _te(t,e,s){return k4==e&&S4==s?C4:(k4=e,S4=s,C4=s=="up"||s=="down"?Ete(t,e,s):Mte(t,e,s))}const di=0,T4=1,Cc=2,ha=3;class pp{constructor(e,s,r,i){this.parent=e,this.children=s,this.dom=r,this.contentDOM=i,this.dirty=di,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,s,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let s=0;s<this.children.length;s++)e+=this.children[s].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let s=0,r=this.posAtStart;;s++){let i=this.children[s];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,s,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let a,l;if(e==this.contentDOM)a=e.childNodes[s-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.previousSibling}for(;a&&!((l=a.pmViewDesc)&&l.parent==this);)a=a.previousSibling;return a?this.posBeforeChild(l)+l.size:this.posAtStart}else{let a,l;if(e==this.contentDOM)a=e.childNodes[s];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.nextSibling}for(;a&&!((l=a.pmViewDesc)&&l.parent==this);)a=a.nextSibling;return a?this.posBeforeChild(l):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=s>jn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(s==0)for(let a=e;;a=a.parentNode){if(a==this.dom){i=!1;break}if(a.previousSibling)break}if(i==null&&s==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){i=!0;break}if(a.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,s=!1){for(let r=!0,i=e;i;i=i.parentNode){let a=this.getDesc(i),l;if(a&&(!s||a.node))if(r&&(l=a.nodeDOM)&&!(l.nodeType==1?l.contains(e.nodeType==1?e:e.parentNode):l
vendor: 4,166 bytes, lines 396-397
396==e))r=!1;else return a}}getDesc(e){let s=e.pmViewDesc;for(let r=s;r;r=r.parent)if(r==this)return s}posFromDOM(e,s,r){for(let i=e;i;i=i.parentNode){let a=this.getDesc(i);if(a)return a.localPosFromDOM(e,s,r)}return-1}descAt(e){for(let s=0,r=0;s<this.children.length;s++){let i=this.children[s],a=r+i.size;if(r==e&&a!=r){for(;!i.border&&i.children.length;)for(let l=0;l<i.children.length;l++){let d=i.children[l];if(d.size){i=d;break}}return i}if(e<a)return i.descAt(e-r-i.border);r=a}}domFromPos(e,s){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let a=0;r<this.children.length;r++){let l=this.children[r],d=a+l.size;if(d>e||l instanceof _D){i=e-a;break}a=d}if(i)return this.children[r].domFromPos(i-this.children[r].border,s);for(let a;r&&!(a=this.children[r-1]).size&&a instanceof MD&&a.side>=0;r--);if(s<=0){let a,l=!0;for(;a=r?this.children[r-1]:null,!(!a||a.dom.parentNode==this.contentDOM);r--,l=!1);return a&&s&&l&&!a.border&&!a.domAtom?a.domFromPos(a.size,s):{node:this.contentDOM,offset:a?jn(a.dom)+1:0}}else{let a,l=!0;for(;a=r<this.children.length?this.children[r]:null,!(!a||a.dom.parentNode==this.contentDOM);r++,l=!1);return a&&l&&!a.border&&!a.domAtom?a.domFromPos(0,s):{node:this.contentDOM,offset:a?jn(a.dom):this.contentDOM.childNodes.length}}}parseRange(e,s,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:s,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,a=-1;for(let l=r,d=0;;d++){let u=this.children[d],m=l+u.size;if(i==-1&&e<=m){let p=l+u.border;if(e>=p&&s<=m-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,s,p);e=l;for(let x=d;x>0;x--){let g=this.children[x-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){i=jn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(m>s||d==this.children.length-1)){s=m;for(let p=d+1;p<this.children.length;p++){let x=this.children[p];if(x.size&&x.dom.parentNode==this.contentDOM&&!x.emptyChildAt(-1)){a=jn(x.dom);break}s+=x.size}a==-1&&(a=this.contentDOM.childNodes.length);break}l=m}return{node:this.contentDOM,from:e,to:s,fromOffset:i,toOffset:a}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let s=this.children[e<0?0:this.children.length-1];return s.size==0||s.emptyChildAt(e)}domAfterPos(e){let{node:s,offset:r}=this.domFromPos(e,0);if(s.nodeType!=1||r==s.childNodes.length)throw new RangeError("No node after pos "+e);return s.childNodes[r]}setSelection(e,s,r,i=!1){let a=Math.min(e,s),l=Math.max(e,s);for(let b=0,v=0;b<this.children.length;b++){let k=this.children[b],N=v+k.size;if(a>v&&l<N)return k.setSelection(e-v-k.border,s-v-k.border,r,i);v=N}let d=this.domFromPos(e,e?-1:1),u=s==e?d:this.domFromPos(s,s?-1:1),m=r.root.getSelection(),p=r.domSelectionRange(),x=!1;if((ci||Bn)&&e==s){let{node:b,offset:v}=d;if(b.nodeType==3){if(x=!!(v&&b.nodeValue[v-1]==`
397`),x&&v==b.nodeValue.length)for(let k=b,N;k;k=k.parentNode){if(N=k.nextSibling){N.nodeName=="BR"&&(d=u={node:N.parentNode,offset:jn(N)+1});break}let S=k.pmViewDesc;if(S&&S.node&&S.node.isBlock)break}}else{let k=b.childNodes[v-1];x=k&&(k.nodeName=="BR"||k.contentEditable=="false")}}if(ci&&p.focusNode&&p.focusNode!=u.node&&p.focusNode.nodeType==1){let b=p.focusNode.childNodes[p.focusOffset];b&&b.contentEditable=="false"&&(i=!0)}if(!(i||x&&Bn)&&Gc(d.node,d.offset,p.anchorNode,p.anchorOffset)&&Gc(u.node,u.offset,p.focusNode,p.focusOffset))return;let g=!1;if((m.extend||e==s)&&!(x&&ci)){m.collapse(d.node,d.offset);try{e!=s&&m.extend(u.node,u.offset),g=!0}catch{}}if(!g){if(e>s){let v=d;d=u,u=v}let b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(d.node,d.offset),m.removeAllRanges(),m.addRange(b)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,s){for(let r=0,i=0;i<this.children.length;i++){let a=this.children[i],l=r+a.size;if(r==l?e<=l&&s>=r:e<l&&s>r){let d=r+a.border,u=l-a.border;if(e>=d&&s<=u){this.dirty=e==r||s==l?Cc:T4,e==d&&s==u&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=ha:a.markDirty(e-d,s-d);return}
vendor: 5,187 bytes, line 397
397else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Cc:ha}r=l}this.dirty=Cc}markParentsDirty(){let e=1;for(let s=this.parent;s;s=s.parent,e++){let r=e==1?Cc:T4;s.dirty<r&&(s.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class MD extends pp{constructor(e,s,r,i){let a,l=s.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)})),!s.type.spec.raw){if(l.nodeType!=1){let d=document.createElement("span");d.appendChild(l),l=d}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=s,this.widget=s,a=this}matchesWidget(e){return this.dirty==di&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let s=this.widget.spec.stopEvent;return s?s(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Ote extends pp{constructor(e,s,r,i){super(e,[],s,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,s){return e!=this.textDOM?this.posAtStart+(s?this.size:0):this.posAtStart+s}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Kc extends pp{constructor(e,s,r,i,a){super(e,[],r,i),this.mark=s,this.spec=a}static create(e,s,r,i){let a=i.nodeViews[s.type.name],l=a&&a(s,i,r);return(!l||!l.dom)&&(l=ed.renderSpec(document,s.type.spec.toDOM(s,r),null,s.attrs)),new Kc(e,s,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&ha||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ha&&this.mark.eq(e)}markDirty(e,s){if(super.markDirty(e,s),this.dirty!=di){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=di}}slice(e,s,r){let i=Kc.create(this.parent,this.mark,!0,r),a=this.children,l=this.size;s<l&&(a=O1(a,s,l,r)),e>0&&(a=O1(a,0,e,r));for(let d=0;d<a.length;d++)a[d].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ml extends pp{constructor(e,s,r,i,a,l,d,u,m){super(e,[],a,l),this.node=s,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=d}static create(e,s,r,i,a,l){let d=a.nodeViews[s.type.name],u,m=d&&d(s,a,()=>{if(!u)return l;if(u.parent)return u.parent.posBeforeChild(u)},r,i),p=m&&m.dom,x=m&&m.contentDOM;if(s.isText){if(!p)p=document.createTextNode(s.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:x}=ed.renderSpec(document,s.type.spec.toDOM(s),null,s.attrs));!x&&!s.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),s.type.spec.draggable&&(p.draggable=!0));let g=p;return p=DD(p,r,s),m?u=new Rte(e,s,r,i,p,x||null,g,m,a,l+1):s.isText?new Ob(e,s,r,i,p,g,a):new ml(e,s,r,i,p,x||null,g,a,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let s=this.children.length-1;s>=0;s--){let r=this.children[s];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Ne.empty)}return e}matchesNode(e,s,r){return this.dirty==di&&e.eq(this.node)&&yg(s,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,s){let r=this.node.inlineContent,i=s,a=e.composing?this.localCompositionInfo(e,s):null,l=a&&a.pos>-1?a:null,d=a&&a.pos<0,u=new Pte(this,l&&l.node,e);$te(this.node,this.innerDeco,(m,p,x)=>{m.spec.marks?u.syncToMarks(m.spec.marks,r,e,p):m.type.side>=0&&!x&&u.syncToMarks(p==this.node.childCount?qt.none:this.node.child(p).marks,r,e,p),u.placeWidget(m,e,i)},(m,p,x,g)=>{u.syncToMarks(m.marks,r,e,g);let b;u.findNodeMatch(m,p,x,g)||d&&e.state.selection.from>i&&e.state.selection.to<i+m.nodeSize&&(b=u.findIndexWithChild(a.node))>-1&&u.updateNodeAt(m,p,x,b,e)||u.updateNextNode(m,p,x,e,g,i)||u.addNode(m,p,x,e,i),i+=m.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Cc)&&(l&&this.protectLocalComposition(e,l),OD(this.contentDOM,this.children,e),ku&&Bte(this.dom))}localCompositionInfo(e,s){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof it)||r<s||i>s+this.node.content.size)return null;let a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let l=a.nodeValue,d=zte(this.node.content,l,r-s,i-s);return d<0?null:{node:a,pos:d,text:l}}else return{node:a,pos:-1,text:""}}
vendor: 4,648 bytes, line 397
397protectLocalComposition(e,{node:s,pos:r,text:i}){if(this.getDesc(s))return;let a=s;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let l=new Ote(this,a,s,i);e.input.compositionNodes.push(l),this.children=O1(this.children,r,r+i.length,e,l)}update(e,s,r,i){return this.dirty==ha||!e.sameMarkup(this.node)?!1:(this.updateInner(e,s,r,i),!0)}updateInner(e,s,r,i){this.updateOuterDeco(s),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=di}updateOuterDeco(e){if(yg(e,this.outerDeco))return;let s=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=RD(this.dom,this.nodeDOM,_1(this.outerDeco,this.node,s),_1(e,this.node,s)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function E4(t,e,s,r,i){DD(r,e,t);let a=new ml(void 0,t,e,s,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}class Ob extends ml{constructor(e,s,r,i,a,l,d){super(e,s,r,i,a,null,l,d,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,s,r,i){return this.dirty==ha||this.dirty!=di&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(s),(this.dirty!=di||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=di,!0)}inParent(){let e=this.parent.contentDOM;for(let s=this.nodeDOM;s;s=s.parentNode)if(s==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,s,r){return e==this.nodeDOM?this.posAtStart+Math.min(s,this.node.text.length):super.localPosFromDOM(e,s,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,s,r){let i=this.node.cut(e,s),a=document.createTextNode(i.text);return new Ob(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,s){super.markDirty(e,s),this.dom!=this.nodeDOM&&(e==0||s==this.nodeDOM.nodeValue.length)&&(this.dirty=ha)}get domAtom(){return!1}isText(e){return this.node.text==e}}class _D extends pp{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==di&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Rte extends ml{constructor(e,s,r,i,a,l,d,u,m,p){super(e,s,r,i,a,l,d,m,p),this.spec=u}update(e,s,r,i){if(this.dirty==ha)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let a=this.spec.update(e,s,r);return a&&this.updateInner(e,s,r,i),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,s,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,s,r,i){this.spec.setSelection?this.spec.setSelection(e,s,r.root):super.setSelection(e,s,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function OD(t,e,s){let r=t.firstChild,i=!1;for(let a=0;a<e.length;a++){let l=e[a],d=l.dom;if(d.parentNode==t){for(;d!=r;)r=A4(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(d,r);if(l instanceof Kc){let u=r?r.previousSibling:t.lastChild;OD(l.contentDOM,l.children,s),r=u?u.nextSibling:t.firstChild}}for(;r;)r=A4(r),i=!0;i&&s.trackWrites==t&&(s.trackWrites=null)}const om=function(t){t&&(this.nodeName=t)};om.prototype=Object.create(null);const Tc=[new om];function _1(t,e,s){if(t.length==0)return Tc;let r=s?Tc[0]:new om,i=[r];for(let a=0;a<t.length;a++){let l=t[a].type.attrs;if(l){l.nodeName&&i.push(r=new om(l.nodeName));for(let d in l){let u=l[d];u!=null&&(s&&i.length==1&&i.push(r=new om(e.isInline?"span":"div")),d=="class"?r.class=(r.class?r.class+" ":"")+u:d=="style"?r.style=(r.style?r.style+";":"")+u:d!="nodeName"&&(r[d]=u))}}}return i}function RD(t,e,s,r){if(s==Tc&&r==Tc)return e;let i=e;for(let a=0;a<r.length;a++){let l=r[a],d=s[a];if(a){let u;d&&d.nodeName==l.nodeName&&i!=t&&(u=i.parentNode)&&u.nodeName.toLowerCase()==l.n
vendor: 6,508 bytes, line 397
397odeName||(u=document.createElement(l.nodeName),u.pmIsDeco=!0,u.appendChild(i),d=Tc[0]),i=u}Dte(i,d||Tc[0],l)}return i}function Dte(t,e,s){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in s)&&t.removeAttribute(r);for(let r in s)r!="class"&&r!="style"&&r!="nodeName"&&s[r]!=e[r]&&t.setAttribute(r,s[r]);if(e.class!=s.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=s.class?s.class.split(" ").filter(Boolean):[];for(let a=0;a<r.length;a++)i.indexOf(r[a])==-1&&t.classList.remove(r[a]);for(let a=0;a<i.length;a++)r.indexOf(i[a])==-1&&t.classList.add(i[a]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=s.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}s.style&&(t.style.cssText+=s.style)}}function DD(t,e,s){return RD(t,t,Tc,_1(e,s,t.nodeType!=1))}function yg(t,e){if(t.length!=e.length)return!1;for(let s=0;s<t.length;s++)if(!t[s].type.eq(e[s].type))return!1;return!0}function A4(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Pte{constructor(e,s,r){this.lock=s,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Ite(e.node.content,e)}destroyBetween(e,s){if(e!=s){for(let r=e;r<s;r++)this.top.children[r].destroy();this.top.children.splice(e,s-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,s,r,i){let a=0,l=this.stack.length>>1,d=Math.min(l,e.length);for(;a<d&&(a==l-1?this.top:this.stack[a+1<<1]).matchesMark(e[a])&&e[a].type.spec.spanning!==!1;)a++;for(;a<l;)this.destroyRest(),this.top.dirty=di,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let u=-1,m=this.top.children.length;i<this.preMatch.index&&(m=Math.min(this.index+3,m));for(let p=this.index;p<m;p++){let x=this.top.children[p];if(x.matchesMark(e[l])&&!this.isLocked(x.dom)){u=p;break}}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let p=Kc.create(this.top,e[l],s,r);this.top.children.splice(this.index,0,p),this.top=p,this.changed=!0}this.index=0,l++}}findNodeMatch(e,s,r,i){let a=-1,l;if(i>=this.preMatch.index&&(l=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&l.matchesNode(e,s,r))a=this.top.children.indexOf(l,this.index);else for(let d=this.index,u=Math.min(this.top.children.length,d+5);d<u;d++){let m=this.top.children[d];if(m.matchesNode(e,s,r)&&!this.preMatch.matched.has(m)){a=d;break}}return a<0?!1:(this.destroyBetween(this.index,a),this.index++,!0)}updateNodeAt(e,s,r,i,a){let l=this.top.children[i];return l.dirty==ha&&l.dom==l.contentDOM&&(l.dirty=Cc),l.update(e,s,r,a)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let s=e.parentNode;if(!s)return-1;if(s==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=s}}updateNextNode(e,s,r,i,a,l){for(let d=this.index;d<this.top.children.length;d++){let u=this.top.children[d];if(u instanceof ml){let m=this.preMatch.matched.get(u);if(m!=null&&m!=a)return!1;let p=u.dom,x,g=this.isLocked(p)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=ha&&yg(s,u.outerDeco));if(!g&&u.update(e,s,r,i))return this.destroyBetween(this.index,d),u.dom!=p&&(this.changed=!0),this.index++,!0;if(!g&&(x=this.recreateWrapper(u,e,s,r,i,l)))return this.destroyBetween(this.index,d),this.top.children[this.index]=x,x.contentDOM&&(x.dirty=Cc,x.updateChildren(i,l+1),x.dirty=di),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,s,r,i,a,l){if(e.dirty||s.isAtom||!e.children.length||!e.node.content.eq(s.content)||!yg(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let d=ml.create(this.top,s,r,i,a,l);if(d.contentDOM){d.children=e.children,e.children=[];for(let u of d.children)u.parent=d}return e.destroy(),d}addNode(e,s,r,i,a){let l=ml.create(this.top,e,s,r,i,a);l.contentDOM&&l.updateChildren(i,a+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(e,s,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let a=new MD(this.top,e,s,r);this.top.children.splice(this.index++,0,a),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],s=this.top;for(;e instanceof Kc;)s=e,e=s.children[s.children.length-1];(!e||!(e instanceof Ob)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Bn||Cn)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",s),this.addHackNode("BR",this.top))}addHackNode(e,s){if(s==this.top&&this.index<s.children.length&&s.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new _D(this.top,[],r,null);s!=this.top?s.children.push(i):s.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Ite(t,e){let s=e,r=s.children.length,i=t.childCount,a=new Map,l=[];e:for(;i>0;){let d;for(;;)if(r){let m=s.children[r-1];if(m instanceof Kc)s=m,r=m.children.length;else{d=m,r--;break}}else{if(s==e)break e;r=s.parent.children.indexOf(s),s=s.parent}let u=d.node;if(u){if(u!=t.child(i-1))break;--i,a.set(d,i),l.push(d)}}return{index:i,matched:a,matches:l.reverse()}}function Lte(t,e){return t.type.side-e.type.side}function $te(t,e,s,r){let i=e.locals(t),a=0;if(i.length==0){for(let m=0;m<t.childCount;m++){let p=t.child(m);r(p,i,e.forChild(a,p),m),a+=p.nodeSize}return}let l=0,d=[],u=null;for(let m=0;;){let p,x;for(;l<i.length&&i[l].to==a;){let N=i[l++];N.widget&&(p?(x||(x=[p])).push(N):p=N)}if(p)if(x){x.sort(Lte);for(let N=0;N<x.length;N++)s(x[N],m,!!u)}else s(p,m,!!u);let g,b;if(u)b=-1,g=u,u=null;else if(m<t.childCount)b=m,g=t.child(m++);else break;for(let N=0;N<d.length;N++)d[N].to<=a&&d.splice(N--,1);for(;l<i.length&&i[l].from<=a&&i[l].to>a;)d.push(i[l++]);let v=a+g.nodeSize;if(g.isText){let N=v;l<i.length&&i[l].from<N&&(N=i[l].from);for(let S=0;S<d.length;S++)d[S].to<N&&(N=d[S].to);N<v&&(u=g.cut(N-a),g=g.cut(0,N-a),v=N,b=-1)}else for(;l<i.length&&i[l].to<v;)l++;let k=g.isInline&&!g.isLeaf?d.filter(N=>!N.inline):d.slice();r(g,k,e.forChild(a,g),b),a=v}}
vendor: 3,546 bytes, line 397
397function Bte(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function zte(t,e,s,r){for(let i=0,a=0;i<t.childCount&&a<=r;){let l=t.child(i++),d=a;if(a+=l.nodeSize,!l.isText)continue;let u=l.text;for(;i<t.childCount;){let m=t.child(i++);if(a+=m.nodeSize,!m.isText)break;u+=m.text}if(a>=s){if(a>=r&&u.slice(r-e.length-d,r-d)==e)return r-e.length;let m=d<r?u.lastIndexOf(e,r-d-1):-1;if(m>=0&&m+e.length+d>=s)return d+m;if(s==r&&u.length>=r+e.length-d&&u.slice(r-d,r-d+e.length)==e)return r}}return-1}function O1(t,e,s,r,i){let a=[];for(let l=0,d=0;l<t.length;l++){let u=t[l],m=d,p=d+=u.size;m>=s||p<=e?a.push(u):(m<e&&a.push(u.slice(0,e-m,r)),i&&(a.push(i),i=void 0),p>s&&a.push(u.slice(s-m,u.size,r)))}return a}function BN(t,e=null){let s=t.domSelectionRange(),r=t.state.doc;if(!s.focusNode)return null;let i=t.docView.nearestDesc(s.focusNode),a=i&&i.size==0,l=t.docView.posFromDOM(s.focusNode,s.focusOffset,1);if(l<0)return null;let d=r.resolve(l),u,m;if(_b(s)){for(u=l;i&&!i.node;)i=i.parent;let x=i.node;if(i&&x.isAtom&&Xe.isSelectable(x)&&i.parent&&!(x.isInline&&mte(s.focusNode,s.focusOffset,i.dom))){let g=i.posBefore;m=new Xe(l==g?d:r.resolve(g))}}else{if(s instanceof t.dom.ownerDocument.defaultView.Selection&&s.rangeCount>1){let x=l,g=l;for(let b=0;b<s.rangeCount;b++){let v=s.getRangeAt(b);x=Math.min(x,t.docView.posFromDOM(v.startContainer,v.startOffset,1)),g=Math.max(g,t.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(x<0)return null;[u,l]=g==t.state.selection.anchor?[g,x]:[x,g],d=r.resolve(l)}else u=t.docView.posFromDOM(s.anchorNode,s.anchorOffset,1);if(u<0)return null}let p=r.resolve(u);if(!m){let x=e=="pointer"||t.state.selection.head<d.pos&&!a?1:-1;m=zN(t,p,d,x)}return m}function PD(t){return t.editable?t.hasFocus():LD(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function ao(t,e=!1){let s=t.state.selection;if(ID(t,s),!!PD(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Cn){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Gc(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Fte(t);else{let{anchor:r,head:i}=s,a,l;M4&&!(s instanceof it)&&(s.$from.parent.inlineContent||(a=_4(t,s.from)),!s.empty&&!s.$from.parent.inlineContent&&(l=_4(t,s.to))),t.docView.setSelection(r,i,t,e),M4&&(a&&O4(a),l&&O4(l)),s.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Vte(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const M4=Bn||Cn&&jD<63;function _4(t,e){let{node:s,offset:r}=t.docView.domFromPos(e,0),i=r<s.childNodes.length?s.childNodes[r]:null,a=r?s.childNodes[r-1]:null;if(Bn&&i&&i.contentEditable=="false")return Gv(i);if((!i||i.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(i)return Gv(i);if(a)return Gv(a)}}function Gv(t){return t.contentEditable="true",Bn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function O4(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Vte(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let s=t.domSelectionRange(),r=s.anchorNode,i=s.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>
vendor: 9,806 bytes, lines 397-400
397{(s.anchorNode!=r||s.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!PD(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Fte(t){let e=t.domSelection();if(!e)return;let s=t.cursorWrapper.dom,r=s.nodeName=="IMG";r?e.collapse(s.parentNode,jn(s)+1):e.collapse(s,0),!r&&!t.state.selection.visible&&mr&&hl<=11&&(s.disabled=!0,s.disabled=!1)}function ID(t,e){if(e instanceof Xe){let s=t.docView.descAt(e.from);s!=t.lastSelectedViewDesc&&(R4(t),s&&s.selectNode(),t.lastSelectedViewDesc=s)}else R4(t)}function R4(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function zN(t,e,s,r){return t.someProp("createSelectionBetween",i=>i(t,e,s))||it.between(e,s,r)}function D4(t){return t.editable&&!t.hasFocus()?!1:LD(t)}function LD(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ute(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),s=t.domSelectionRange();return Gc(e.node,e.offset,s.anchorNode,s.anchorOffset)}function R1(t,e){let{$anchor:s,$head:r}=t.selection,i=e>0?s.max(r):s.min(r),a=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return a&&gt.findFrom(a,e)}function Zo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function P4(t,e,s){let r=t.state.selection;if(r instanceof it)if(s.indexOf("s")>-1){let{$head:i}=r,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let l=t.state.doc.resolve(i.pos+a.nodeSize*(e<0?-1:1));return Zo(t,new it(r.$anchor,l))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=R1(t.state,e);return i&&i instanceof Xe?Zo(t,i):!1}else if(!(ni&&s.indexOf("m")>-1)){let i=r.$head,a=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,l;if(!a||a.isText)return!1;let d=e<0?i.pos-a.nodeSize:i.pos;return a.isAtom||(l=t.docView.descAt(d))&&!l.contentDOM?Xe.isSelectable(a)?Zo(t,new Xe(e<0?t.state.doc.resolve(i.pos-a.nodeSize):i)):mp?Zo(t,new it(t.state.doc.resolve(e<0?d:d+a.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Xe&&r.node.isInline)return Zo(t,new it(e>0?r.$to:r.$from));{let i=R1(t.state,e);return i?Zo(t,i):!1}}}function vg(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function lm(t,e){let s=t.pmViewDesc;return s&&s.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ud(t,e){return e<0?Hte(t):qte(t)}function Hte(t){let e=t.domSelectionRange(),s=e.focusNode,r=e.focusOffset;if(!s)return;let i,a,l=!1;for(ci&&s.nodeType==1&&r<vg(s)&&lm(s.childNodes[r],-1)&&(l=!0);;)if(r>0){if(s.nodeType!=1)break;{let d=s.childNodes[r-1];if(lm(d,-1))i=s,a=--r;else if(d.nodeType==3)s=d,r=s.nodeValue.length;else break}}else{if($D(s))break;{let d=s.previousSibling;for(;d&&lm(d,-1);)i=s.parentNode,a=jn(d),d=d.previousSibling;if(d)s=d,r=vg(s);else{if(s=s.parentNode,s==t.dom)break;r=0}}}l?D1(t,s,r):i&&D1(t,i,a)}function qte(t){let e=t.domSelectionRange(),s=e.focusNode,r=e.focusOffset;if(!s)return;let i=vg(s),a,l;for(;;)if(r<i){if(s.nodeType!=1)break;let d=s.childNodes[r];if(lm(d,1))a=s,l=++r;else break}else{if($D(s))break;{let d=s.nextSibling;for(;d&&lm(d,1);)a=d.parentNode,l=jn(d)+1,d=d.nextSibling;if(d)s=d,r=0,i=vg(s);else{if(s=s.parentNode,s==t.dom)break;r=i=0}}}a&&D1(t,a,l)}function $D(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Wte(t,e){for(;t&&e==t.childNodes.length&&!hp(t);)e=jn(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let s=t.childNodes[e];if(s.nodeType==3)return s;if(s.nodeType==1&&s.contentEditable=="false")break;t=s,e=0}}function Gte(t,e){for(;t&&!e&&!hp(t);)e=jn(t),t=t.parentNode;for(;t&&e;){let s=t.childNodes[e-1];if(s.nodeType==3)return s;if(s.nodeType==1&&s.contentEditable=="false")break;t=s,e=t.childNodes.length}}function D1(t,e,s){if(e.nodeType!=3){let a,l;(l=Wte(e,s))?(e=l,s=0):(a=Gte(e,s))&&(e=a,s=a.nodeValue.length)}let r=t.domSelection();if(!r)return;if(_b(r)){let a=document.createRange();a.setEnd(e,s),a.setStart(e,s),r.removeAllRanges(),r.addRange(a)}else r.extend&&r.extend(e,s);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&ao(t)},50)}function I4(t,e){let s=t.state.doc.resolve(e);if(!(Cn||ND)&&s.parent.inlineContent){let i=t.coordsAtPos(e);if(e>s.start()){let a=t.coordsAtPos(e-1),l=(a.top+a.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(a.left-i.left)>1)return a.left<i.left?"ltr":"rtl"}if(e<s.end()){let a=t.coordsAtPos(e+1),l=(a.top+a.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(a.left-i.left)>1)return a.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function L4(t,e,s){let r=t.state.selection;if(r instanceof it&&!r.empty||s.indexOf("s")>-1||ni&&s.indexOf("m")>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=R1(t.state,e);if(l&&l instanceof Xe)return Zo(t,l)}if(!i.parent.inlineContent){let l=e<0?i:a,d=r instanceof Ir?gt.near(l,e):gt.findFrom(l,e);return d?Zo(t,d):!1}return!1}function $4(t,e){if(!(t.state.selection instanceof it))return!0;let{$head:s,$anchor:r,empty:i}=t.state.selection;if(!s.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!s.textOffset&&(e<0?s.nodeBefore:s.nodeAfter);if(a&&!a.isText){let l=t.state.tr;return e<0?l.delete(s.pos-a.nodeSize,s.pos):l.delete(s.pos,s.pos+a.nodeSize),t.dispatch(l),!0}return!1}function B4(t,e,s){t.domObserver.stop(),e.contentEditable=s,t.domObserver.start()}function Kte(t){if(!Bn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:s}=t.domSelectionRange();if(e&&e.nodeType==1&&s==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;B4(t,r,"true"),setTimeout(()=>B4(t,r,"false"),20)}return!1}function Yte(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Qte(t,e){let s=e.keyCode,r=Yte(e);if(s==8||ni&&s==72&&r=="c")return $4(t,-1)||Ud(t,-1);if(s==46&&!e.shiftKey||ni&&s==68&&r=="c")return $4(t,1)||Ud(t,1);if(s==13||s==27)return!0;if(s==37||ni&&s==66&&r=="c"){let i=s==37?I4(t,t.state.selection.from)=="ltr"?-1:1:-1;return P4(t,i,r)||Ud(t,i)}else if(s==39||ni&&s==70&&r=="c"){let i=s==39?I4(t,t.state.selection.from)=="ltr"?1:-1:1;return P4(t,i,r)||Ud(t,i)}else{if(s==38||ni&&s==80&&r=="c")return L4(t,-1,r)||Ud(t,-1);if(s==40||ni&&s==78&&r=="c")return Kte(t)||L4(t,1,r)||Ud(t,1);if(r==(ni?"m":"c")&&(s==66||s==73||s==89||s==90))return!0}return!1}function VN(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let s=[],{content:r,openStart:i,openEnd:a}=e;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let b=r.firstChild;s.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let l=t.someProp("clipboardSerializer")||ed.fromSchema(t.state.schema),d=HD(),u=d.createElement("div");u.appendChild(l.serializeFragment(r,{document:d}));let m=u.firstChild,p,x=0;for(;m&&m.nodeType==1&&(p=UD[m.nodeName.toLowerCase()]);){for(let b=p.length-1;b>=0;b--){let v=d.createElement(p[b]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),x++}m=u.firstChild}m&&m.nodeType==1&&m.setAttribute("data-pm-slice",`${i} ${a}${x?` -${x}`:""} ${JSON.stringify(s)}`);let g=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
398
399`);return{dom:u,text:g,slice:e}}function BD(t,e,s,r,i){let a=i.parent.type.spec.code,l,d;if(!s&&!e)return null;let u=!!e&&(r||a||!s);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,a||r,t)}),a)return d=new $e(Ne.from(t.state.schema.text(e.replace(/\r\n?/g,`
400`))),0,0),t.someProp("transformPasted",g=>{d=g(d,t,!0)}),d;let x=t.someProp("clipboardTextParser",g=>g(e,i,r,t));if(x)d=x;else{let g=i.marks(),{schema:b}=t.state,v=ed.fromSchema(b);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(k=>{let N=l.appendChild(document.createElement("p"));k&&N.appendChild(v.serializeNode(b.text(k,g)))})}}else t.someProp("transformPastedHTML",x=>{s=x(s,t)}),l=ese(s),mp&&tse(l);let m=l&&l.querySelector("[data-pm-slice]"),p=m&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(m.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let x=+p[3];x>0;x--){let g=l.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;l=g}if(d||(d=(t.someProp("clipboardParser")||t.someProp("domParser")||ul.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(u||p),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!Jte.test(g.parentNode.nodeName)?{ignore:!0}:null}})),p)d=sse(z4(d,+p[1],+p[2]),p[4]);else if(d=$e.maxOpen(Xte(d.content,i),!0),d.openStart||d.openEnd){let x=0,g=0;for(let b=d.content.firstChild;x<d.openStart&&!b.type.spec.isolating;x++,b=b.firstChild);for(let b=d.content.lastChild;g<d.openEnd&&!b.type.spec.isolating;g++,b=b.lastChild);d=z4(d,x,g)}return t.someProp("transformPasted",x=>{d=x(d,t,u)}),d}const Jte=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Xte(t,e){if(t.childCount<2)return t;for(let s=e.depth;s>=0;s--){let i=e.node(s).contentMatchAt(e.index(s)),a,l=[];if(t.forEach(d=>{if(!l)return;let u=i.findWrapping(d.type),m;if(!u)return l=null;if(m=l.length&&a.length&&VD(u,a,d,l[l.length-1],0))l[l.length-1]=m;else{l.length&&(l[l.length-1]=FD(l[l.length-1],a.length));let p=zD(d,u);l.push(p),i=i.matchType(p.type),a=u}}),l)return Ne.from(l)}return t}function zD(t,e,s=0){for(let r=e.length-1;r>=s;r--)t=e[r].create(null,Ne.from(t));return t}function VD(t,e,s,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let a=VD(t,e,s,r.last
vendor: 12,009 bytes, line 400
400Child,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?s.type:t[i+1]))return r.copy(r.content.append(Ne.from(zD(s,t,i+1))))}}function FD(t,e){if(e==0)return t;let s=t.content.replaceChild(t.childCount-1,FD(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(Ne.empty,!0);return t.copy(s.append(r))}function P1(t,e,s,r,i,a){let l=e<0?t.firstChild:t.lastChild,d=l.content;return t.childCount>1&&(a=0),i<r-1&&(d=P1(d,e,s,r,i+1,a)),i>=s&&(d=e<0?l.contentMatchAt(0).fillBefore(d,a<=i).append(d):d.append(l.contentMatchAt(l.childCount).fillBefore(Ne.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(d))}function z4(t,e,s){return e<t.openStart&&(t=new $e(P1(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),s<t.openEnd&&(t=new $e(P1(t.content,1,s,t.openEnd,0,0),t.openStart,s)),t}const UD={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let V4=null;function HD(){return V4||(V4=document.implementation.createHTMLDocument("title"))}let Kv=null;function Zte(t){let e=window.trustedTypes;return e?(Kv||(Kv=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:s=>s})),Kv.createHTML(t)):t}function ese(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let s=HD().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&UD[r[1].toLowerCase()])&&(t=i.map(a=>"<"+a+">").join("")+t+i.map(a=>"</"+a+">").reverse().join("")),s.innerHTML=Zte(t),i)for(let a=0;a<i.length;a++)s=s.querySelector(i[a])||s;return s}function tse(t){let e=t.querySelectorAll(Cn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let s=0;s<e.length;s++){let r=e[s];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function sse(t,e){if(!t.size)return t;let s=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:a,openEnd:l}=t;for(let d=r.length-2;d>=0;d-=2){let u=s.nodes[r[d]];if(!u||u.hasRequiredAttrs())break;i=Ne.from(u.create(r[d+1],i)),a++,l++}return new $e(i,a,l)}const tr={},sr={},nse={touchstart:!0,touchmove:!0};class rse{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function ise(t){for(let e in tr){let s=tr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{ose(t,r)&&!FN(t,r)&&(t.editable||!(r.type in sr))&&s(t,r)},nse[e]?{passive:!0}:void 0)}Bn&&t.dom.addEventListener("input",()=>null),I1(t)}function ll(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function ase(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function I1(t){t.someProp("handleDOMEvents",e=>{for(let s in e)t.input.eventHandlers[s]||t.dom.addEventListener(s,t.input.eventHandlers[s]=r=>FN(t,r))})}function FN(t,e){return t.someProp("handleDOMEvents",s=>{let r=s[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function ose(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let s=e.target;s!=t.dom;s=s.parentNode)if(!s||s.nodeType==11||s.pmViewDesc&&s.pmViewDesc.stopEvent(e))return!1;return!0}function lse(t,e){!FN(t,e)&&tr[e.type]&&(t.editable||!(e.type in sr))&&tr[e.type](t,e)}sr.keydown=(t,e)=>{let s=e;if(t.input.shiftKey=s.keyCode==16||s.shiftKey,!WD(t,s)&&(t.input.lastKeyCode=s.keyCode,t.input.lastKeyCodeTime=Date.now(),!(so&&Cn&&s.keyCode==13)))if(s.keyCode!=229&&t.domObserver.forceFlush(),ku&&s.keyCode==13&&!s.ctrlKey&&!s.altKey&&!s.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,yc(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,s))||Qte(t,s)?s.preventDefault():ll(t,"key")};sr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};sr.keypress=(t,e)=>{let s=e;if(WD(t,s)||!s.charCode||s.ctrlKey&&!s.altKey||ni&&s.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,s))){s.preventDefault();return}let r=t.state.selection;if(!(r instanceof it)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(s.charCode),a=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",l=>l(t,r.$from.pos,r.$to.pos,i,a))&&t.dispatch(a()),s.preventDefault()}};function Rb(t){return{left:t.clientX,top:t.clientY}}function cse(t,e){let s=e.x-t.clientX,r=e.y-t.clientY;return s*s+r*r<100}function UN(t,e,s,r,i){if(r==-1)return!1;let a=t.state.doc.resolve(r);for(let l=a.depth+1;l>0;l--)if(t.someProp(e,d=>l>a.depth?d(t,s,a.nodeAfter,a.before(l),i,!0):d(t,s,a.node(l),a.before(l),i,!1)))return!0;return!1}function uu(t,e,s){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function dse(t,e){if(e==-1)return!1;let s=t.state.doc.resolve(e),r=s.nodeAfter;return r&&r.isAtom&&Xe.isSelectable(r)?(uu(t,new Xe(s)),!0):!1}function use(t,e){if(e==-1)return!1;let s=t.state.selection,r,i;s instanceof Xe&&(r=s.node);let a=t.state.doc.resolve(e);for(let l=a.depth+1;l>0;l--){let d=l>a.depth?a.nodeAfter:a.node(l);if(Xe.isSelectable(d)){r&&s.$from.depth>0&&l>=s.$from.depth&&a.before(s.$from.depth+1)==s.$from.pos?i=a.before(s.$from.depth):i=a.before(l);break}}return i!=null?(uu(t,Xe.create(t.state.doc,i)),!0):!1}function hse(t,e,s,r,i){return UN(t,"handleClickOn",e,s,r)||t.someProp("handleClick",a=>a(t,e,r))||(i?use(t,s):dse(t,s))}function mse(t,e,s,r){return UN(t,"handleDoubleClickOn",e,s,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function pse(t,e,s,r){return UN(t,"handleTripleClickOn",e,s,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||fse(t,s,r)}function fse(t,e,s){if(s.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(uu(t,it.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let a=i.depth+1;a>0;a--){let l=a>i.depth?i.nodeAfter:i.node(a),d=i.before(a);if(l.inlineContent)uu(t,it.create(r,d+1,d+1+l.content.size));else if(Xe.isSelectable(l))uu(t,Xe.create(r,d));else continue;return!0}}function HN(t){return wg(t)}const qD=ni?"metaKey":"ctrlKey";tr.mousedown=(t,e)=>{let s=e;t.input.shiftKey=s.shiftKey;let r=HN(t),i=Date.now(),a="singleClick";i-t.input.lastClick.time<500&&cse(s,t.input.lastClick)&&!s[qD]&&t.input.lastClick.button==s.button&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:i,x:s.clientX,y:s.clientY,type:a,button:s.button};let l=t.posAtCoords(Rb(s));l&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new xse(t,l,s,!!r)):(a=="doubleClick"?mse:pse)(t,l.pos,l.inside,s)?s.preventDefault():ll(t,"pointer"))};class xse{constructor(e,s,r,i){this.view=e,this.pos=s,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[qD],this.allowDefault=r.shiftKey;let a,l;if(s.inside>-1)a=e.state.doc.nodeAt(s.inside),l=s.inside;else{let p=e.state.doc.resolve(s.pos);a=p.parent,l=p.depth?p.before():0}const d=i?null:r.target,u=d?e.docView.nearestDesc(d,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:m}=e.state;r.button==0&&(a.type.spec.draggable&&a.type.spec.selectable!==!1||m instanceof Xe&&m.from<=l&&m.to>l)&&(this.mightDrag={node:a,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ci&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ll(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ao(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let s=this.pos;this.view.state.doc!=this.startDoc&&(s=this.view.posAtCoords(Rb(e))),this.updateAllowDefault(e),this.allowDefault||!s?ll(this.view,"pointer"):hse(this.view,s.pos,s.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Bn&&this.mightDrag&&!this.mightDrag.node.isAtom||Cn&&!this.view.state.selection.visible&&Math.min(Math.abs(s.pos-this.view.state.selection.from),Math.abs(s.pos-this.view.state.selection.to))<=2)?(uu(this.view,gt.near(this.view.state.doc.resolve(s.pos))),e.preventDefault()):ll(this.view,"pointer")}move(e){this.updateAllowDefault(e),ll(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}tr.touchstart=t=>{t.input.lastTouch=Date.now(),HN(t),ll(t,"pointer")};tr.touchmove=t=>{t.input.lastTouch=Date.now(),ll(t,"pointer")};tr.contextmenu=t=>HN(t);function WD(t,e){return t.composing?!0:Bn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const gse=so?5e3:-1;sr.compositionstart=sr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,s=e.selection.$to;if(e.selection instanceof it&&(e.storedMarks||!s.textOffset&&s.parentOffset&&s.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Cn&&ND&&bse(t)))t.markCursor=t.state.storedMarks||s.marks(),wg(t,!0),t.markCursor=null;else if(wg(t,!e.selection.empty),ci&&e.selection.empty&&s.parentOffset&&!s.textOffset&&s.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,a=r.focusOffset;i&&i.nodeType==1&&a!=0;){let l=a<0?i.lastChild:i.childNodes[a-1];if(!l)break;if(l.nodeType==3){let d=t.domSelection();d&&d.collapse(l,l.nodeValue.length);break}else i=l,a=-1}}t.input.composing=!0}GD(t,gse)};function bse(t){let{focusNode:e,focusOffset:s}=t.domSelectionRange();if(!e||e.nodeType!=1||s>=e.childNodes.length)return!1;let r=e.childNodes[s];return r.nodeType==1&&r.contentEditable=="false"}sr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,GD(t,20))};function GD(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>wg(t),e))}function KD(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=vse());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function yse(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let s=ute(e.focusNode,e.focusOffset),r=hte(e.focusNode,e.focusOffset);
vendor: 4,720 bytes, line 400
400if(s&&r&&s!=r){let i=r.pmViewDesc,a=t.domObserver.lastChangedTextNode;if(s==a||r==a)return a;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let l=s.pmViewDesc;if(!(!l||!l.isText(s.nodeValue)))return r}}return s||r}function vse(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function wg(t,e=!1){if(!(so&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),KD(t),e||t.docView&&t.docView.dirty){let s=BN(t),r=t.state.selection;return s&&!s.eq(r)?t.dispatch(t.state.tr.setSelection(s)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function wse(t,e){if(!t.dom.parentNode)return;let s=t.dom.parentNode.appendChild(document.createElement("div"));s.appendChild(e),s.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{s.parentNode&&s.parentNode.removeChild(s),t.focus()},50)}const Um=mr&&hl<15||ku&&xte<604;tr.copy=sr.cut=(t,e)=>{let s=e,r=t.state.selection,i=s.type=="cut";if(r.empty)return;let a=Um?null:s.clipboardData,l=r.content(),{dom:d,text:u}=VN(t,l);a?(s.preventDefault(),a.clearData(),a.setData("text/html",d.innerHTML),a.setData("text/plain",u)):wse(t,d),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function jse(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Nse(t,e){if(!t.dom.parentNode)return;let s=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(s?"textarea":"div"));s||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),s?Hm(t,r.value,null,i,e):Hm(t,r.textContent,r.innerHTML,i,e)},50)}function Hm(t,e,s,r,i){let a=BD(t,e,s,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,a||$e.empty)))return!0;if(!a)return!1;let l=jse(a),d=l?t.state.tr.replaceSelectionWith(l,r):t.state.tr.replaceSelection(a);return t.dispatch(d.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function YD(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let s=t.getData("text/uri-list");return s?s.replace(/\r?\n/g," "):""}sr.paste=(t,e)=>{let s=e;if(t.composing&&!so)return;let r=Um?null:s.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Hm(t,YD(r),r.getData("text/html"),i,s)?s.preventDefault():Nse(t,s)};class QD{constructor(e,s,r){this.slice=e,this.move=s,this.node=r}}const kse=ni?"altKey":"ctrlKey";function JD(t,e){let s;return t.someProp("dragCopies",r=>{s=s||r(e)}),s!=null?!s:!e[kse]}tr.dragstart=(t,e)=>{let s=e,r=t.input.mouseDown;if(r&&r.done(),!s.dataTransfer)return;let i=t.state.selection,a=i.empty?null:t.posAtCoords(Rb(s)),l;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof Xe?i.to-1:i.to))){if(r&&r.mightDrag)l=Xe.create(t.state.doc,r.mightDrag.pos);else if(s.target&&s.target.nodeType==1){let x=t.docView.nearestDesc(s.target,!0);x&&x.node.type.spec.draggable&&x!=t.docView&&(l=Xe.create(t.state.doc,x.posBefore))}}let d=(l||t.state.selection).content(),{dom:u,text:m,slice:p}=VN(t,d);(!s.dataTransfer.files.length||!Cn||jD>120)&&s.dataTransfer.clearData(),s.dataTransfer.setData(Um?"Text":"text/html",u.innerHTML),s.dataTransfer.effectAllowed="copyMove",Um||s.dataTransfer.setData("text/plain",m),t.dragging=new QD(p,JD(t,s),l)};tr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};sr.dragover=sr.dragenter=(t,e)=>e.preventDefault();sr.drop=(t,e)=>{try{Sse(t,e,t.dragging)}finally{t.dragging=null}};function Sse(t,e,s){if(!e.dataTransfer)return;let r=t.posAtCoords(Rb(e));if(!r)return;let i=t.state.doc.resolve(r.pos),a=s&&s.slice;a?t.someProp("transformPasted",b=>{a=b(a,t,!1)}):a=BD(t,YD(e.dataTransfer),Um?null:e.dataTransfer.getData("text/html"),!1,i);let l=!!(s&&JD(t,e));if(t.someProp("handleDrop",b=>b(t,e,a||$e.empty,l))){e.preventDefault();return}if(!a)return;e.preventDefault();let d=a?tD(t.state.doc,i.pos,a):i.pos;d==null&&(d=i.pos);let u=t.state.tr;if(l){let{node:b}=s;b?b.replace(u):u.deleteSelection()}let m=u.mapping.map(d),p=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,x=u.doc;if(p?u.replaceRangeWith(m,m,a.content.firstChild):u.replaceRange(m,m,a),u.doc.eq(x))return;let g=u.doc.resolve(m);if(p&&Xe.isSelectable(a.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(a.content.firstChild))u.setSelection(new Xe(g));else{let b=u.mapping.map(d);
vendor: 9,334 bytes, line 400
400u.mapping.maps[u.mapping.maps.length-1].forEach((v,k,N,S)=>b=S),u.setSelection(zN(t,g,u.doc.resolve(b)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}tr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&ao(t)},20))};tr.blur=(t,e)=>{let s=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),s.relatedTarget&&t.dom.contains(s.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};tr.beforeinput=(t,e)=>{if(Cn&&so&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",a=>a(t,yc(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in sr)tr[t]=sr[t];function qm(t,e){if(t==e)return!0;for(let s in t)if(t[s]!==e[s])return!1;for(let s in e)if(!(s in t))return!1;return!0}class jg{constructor(e,s){this.toDOM=e,this.spec=s||Ic,this.side=this.spec.side||0}map(e,s,r,i){let{pos:a,deleted:l}=e.mapResult(s.from+i,this.side<0?-1:1);return l?null:new Xn(a-r,a-r,this)}valid(){return!0}eq(e){return this==e||e instanceof jg&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&qm(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class pl{constructor(e,s){this.attrs=e,this.spec=s||Ic}map(e,s,r,i){let a=e.map(s.from+i,this.spec.inclusiveStart?-1:1)-r,l=e.map(s.to+i,this.spec.inclusiveEnd?1:-1)-r;return a>=l?null:new Xn(a,l,this)}valid(e,s){return s.from<s.to}eq(e){return this==e||e instanceof pl&&qm(this.attrs,e.attrs)&&qm(this.spec,e.spec)}static is(e){return e.type instanceof pl}destroy(){}}class qN{constructor(e,s){this.attrs=e,this.spec=s||Ic}map(e,s,r,i){let a=e.mapResult(s.from+i,1);if(a.deleted)return null;let l=e.mapResult(s.to+i,-1);return l.deleted||l.pos<=a.pos?null:new Xn(a.pos-r,l.pos-r,this)}valid(e,s){let{index:r,offset:i}=e.content.findIndex(s.from),a;return i==s.from&&!(a=e.child(r)).isText&&i+a.nodeSize==s.to}eq(e){return this==e||e instanceof qN&&qm(this.attrs,e.attrs)&&qm(this.spec,e.spec)}destroy(){}}class Xn{constructor(e,s,r){this.from=e,this.to=s,this.type=r}copy(e,s){return new Xn(e,s,this.type)}eq(e,s=0){return this.type.eq(e.type)&&this.from+s==e.from&&this.to+s==e.to}map(e,s,r){return this.type.map(e,this,s,r)}static widget(e,s,r){return new Xn(e,e,new jg(s,r))}static inline(e,s,r,i){return new Xn(e,s,new pl(r,i))}static node(e,s,r,i){return new Xn(e,s,new qN(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof pl}get widget(){return this.type instanceof jg}}const Jd=[],Ic={};class ys{constructor(e,s){this.local=e.length?e:Jd,this.children=s.length?s:Jd}static create(e,s){return s.length?Ng(s,e,0,Ic):In}find(e,s,r){let i=[];return this.findInner(e??0,s??1e9,i,0,r),i}findInner(e,s,r,i,a){for(let l=0;l<this.local.length;l++){let d=this.local[l];d.from<=s&&d.to>=e&&(!a||a(d.spec))&&r.push(d.copy(d.from+i,d.to+i))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<s&&this.children[l+1]>e){let d=this.children[l]+1;this.children[l+2].findInner(e-d,s-d,r,i+d,a)}}map(e,s,r){return this==In||e.maps.length==0?this:this.mapInner(e,s,0,0,r||Ic)}mapInner(e,s,r,i,a){let l;for(let d=0;d<this.local.length;d++){let u=this.local[d].map(e,r,i);u&&u.type.valid(s,u)?(l||(l=[])).push(u):a.onRemove&&a.onRemove(this.local[d].spec)}return this.children.length?Cse(this.children,l||[],e,s,r,i,a):l?new ys(l.sort(Lc),Jd):In}add(e,s){return s.length?this==In?ys.create(e,s):this.addInner(e,s,0):this}addInner(e,s,r){let i,a=0;e.forEach((d,u)=>{let m=u+r,p;if(p=ZD(s,d,m)){for(i||(i=this.children.slice());a<i.length&&i[a]<u;)a+=3;i[a]==u?i[a+2]=i[a+2].addInner(d,p,m+1):i.splice(a,0,u,u+d.nodeSize,Ng(p,d,m+1,Ic)),a+=3}});let l=XD(a?e6(s):s,-r);for(let d=0;d<l.length;d++)l[d].type.valid(e,l[d])||l.splice(d--,1);return new ys(l.length?this.local.concat(l).sort(Lc):this.local,i||this.children)}remove(e){return e.length==0||this==In?this:this.removeInner(e,0)}removeInner(e,s){let r=this.children,i=this.local;for(let a=0;a<r.length;a+=3){let l,d=r[a]+s,u=r[a+1]+s;for(let p=0,x;p<e.length;p++)(x=e[p])&&x.from>d&&x.to<u&&(e[p]=null,(l||(l=[])).push(x));if(!l)continue;r==this.children&&(r=this.children.slice());let m=r[a+2].removeInner(l,d+1);m!=In?r[a+2]=m:(r.splice(a,3),a-=3)}if(i.length){for(let a=0,l;a<e.length;a++)if(l=e[a])for(let d=0;d<i.length;d++)i[d].eq(l,s)&&(i==this.local&&(i=this.local.slice()),i.splice(d--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ys(i,r):In}forChild(e,s){if(this==In)return this;if(s.isLeaf)return ys.empty;let r,i;for(let d=0;d<this.children.length;d+=3)if(this.children[d]>=e){this.children[d]==e&&(r=this.children[d+2]);break}let a=e+1,l=a+s.content.size;for(let d=0;d<this.local.length;d++){let u=this.local[d];if(u.from<l&&u.to>a&&u.type instanceof pl){let m=Math.max(a,u.from)-a,p=Math.min(l,u.to)-a;m<p&&(i||(i=[])).push(u.copy(m,p))}}if(i){let d=new ys(i.sort(Lc),Jd);return r?new sl([d,r]):d}return r||In}eq(e){if(this==e)return!0;if(!(e instanceof ys)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let s=0;s<this.local.length;s++)if(!this.local[s].eq(e.local[s]))return!1;for(let s=0;s<this.children.length;s+=3)if(this.children[s]!=e.children[s]||this.children[s+1]!=e.children[s+1]||!this.children[s+2].eq(e.children[s+2]))return!1;return!0}locals(e){return WN(this.localsInner(e))}localsInner(e){if(this==In)return Jd;if(e.inlineContent||!this.local.some(pl.is))return this.local;let s=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof pl||s.push(this.local[r]);return s}forEachSet(e){e(this)}}ys.empty=new ys([],[]);ys.removeOverlap=WN;const In=ys.empty;class sl{constructor(e){this.members=e}map(e,s){const r=this.members.map(i=>i.map(e,s,Ic));return sl.from(r)}forChild(e,s){if(s.isLeaf)return ys.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(e,s);a!=In&&(a instanceof sl?r=r.concat(a.members):r.push(a))}return sl.from(r)}eq(e){if(!(e instanceof sl)||e.members.length!=this.members.length)return!1;for(let s=0;s<this.members.length;s++)if(!this.members[s].eq(e.members[s]))return!1;return!0}locals(e){let s,r=!0;for(let i=0;i<this.members.length;i++){let a=this.members[i].localsInner(e);if(a.length)if(!s)s=a;else{r&&(s=s.slice(),r=!1);for(let l=0;l<a.length;l++)s.push(a[l])}}return s?WN(r?s:s.sort(Lc)):Jd}static from(e){switch(e.length){case 0:return In;case 1:return e[0];default:return new sl(e.every(s=>s instanceof ys)?e:e.reduce((s,r)=>s.concat(r instanceof ys?r:r.members),[]))}}forEachSet(e){for(let s=0;s<this.members.length;s++)this.members[s].forEachSet(e)}}function Cse(t,e,s,r,i,a,l){let d=t.slice();for(let m=0,p=a;m<s.maps.length;m++){let x=0;s.maps[m].forEach((g,b,v,k)=>{let N=k-v-(b-g);for(let S=0;S<d.length;S+=3){let A=d[S+1];if(A<0||g>A+p-x)continue;let E=d[S]+p-x;b>=E?d[S+1]=g<=E?-2:-1:g>=p&&N&&(d[S]+=N,d[S+1]+=N)}x+=N}),p=s.maps[m].map(p,-1)}let u=!1;for(let m=0;m<d.length;m+=3)if(d[m+1]<0){if(d[m+1]==-2){u=!0,d[m+1]=-1;continue}let p=s.map(t[m]+a),x=p-i;if(x<0||x>=r.content.size){u=!0;continue}let g=s.map(t[m+1]+a,-1),b=g-i,{index:v,offset:k}=r.content.findIndex(x),N=r.maybeChild(v);if(N&&k==x&&k+N.nodeSize==b){let S=d[m+2].mapInner(s,N,p+1,t[m]+a+1,l);S!=In?(d[m]=x,d[m+1]=b,d[m+2]=S):(d[m+1]=-2,u=!0)}else u=!0}if(u){let m=Tse(d,t,e,s,i,a,l),p=Ng(m,r,0,l);e=p.local;for(let x=0;x<d.length;x+=3)d[x+1]<0&&(d.splice(x,3),x-=3);for(let x=0,g=0;x<p.children.length;x+=3){let b=p.children[x];for(;g<d.length&&d[g]<b;)g+=3;d.splice(g,0,p.children[x],p.children[x+1],p.children[x+2])}}return new ys(e.sort(Lc),d)}function XD(t,e){if(!e||!t.length)return t;let s=[];for(let r=0;r<t.length;r++){let i=t[r];s.push(new Xn(i.from+e,i.to+e,i.type))}return s}function Tse(t,e,s,r,i,a,l){function d(u,m){for(let p=0;p<u.local.length;p++){let x=u.local[p].map(r,i,m);x?s.push(x):l.onRemove&&l.onRemove(u.local[p].spec)}for(let p=0;p<u.children.length;p+=3)d(u.children[p+2],u.children[p]+m+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&d(t[u+2],e[u]+a+1);return s}function ZD(t,e,s){if(e.isLeaf)return null;let r=s+e.nodeSize,i=null;for(let a=0,l;a<t.length;a++)(l=t[a])&&l.from>s&&l.to<r&&((i||(i=[])).push(l),t[a]=null);return i}function e6(t){let e=[];for(let s=0;s<t.length;s++)t[s]!=null&&e.push(t[s]);return e}function Ng(t,e,s,r){let i=[],a=!1;e.forEach((d,u)=>{let m=ZD(t,d,u+s);if(m){a=!0;let p=Ng(m,d,s+u+1,r);p!=In&&i.push(u,u+d.nodeSize,p)}});let l=XD(a?e6(t):t,-s).sort(Lc);for(let d=0;d<l.length;d++)l[d].type.valid(e,l[d])||(r.onRemove&&r.onRemove(l[d].spec),l.splice(d--,1));return l.length||i.length?new ys(l,i):In}function Lc(t,e){return t.from-e.from||t.to-e.to}function WN(t){let e=t;for(let s=0;s<e.length-1;s++){let r=e[s];if(r.from!=r.to)for(let i=s+1;i<e.length;i++){let a=e[i];if(a.from==r.from){a.to!=r.to&&(e==t&&(e=t.slice()),e[i]=a.copy(a.from,r.to),F4(e,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(e==t&&(e=t.slice()),e[s]=r.copy(r.from,a.from),F4(e,i,r.copy(a.from,r.to)));break}}}return e}
vendor: 8,025 bytes, line 400
400function F4(t,e,s){for(;e<t.length&&Lc(s,t[e])>0;)e++;t.splice(e,0,s)}function Yv(t){let e=[];return t.someProp("decorations",s=>{let r=s(t.state);r&&r!=In&&e.push(r)}),t.cursorWrapper&&e.push(ys.create(t.state.doc,[t.cursorWrapper.deco])),sl.from(e)}const Ese={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ase=mr&&hl<=11;class Mse{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class _se{constructor(e,s){this.view=e,this.handleDOMChange=s,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Mse,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);mr&&hl<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Bn&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Ase&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Ese)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let s=0;s<e.length;s++)this.queue.push(e[s]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(D4(this.view)){if(this.suppressingSelectionUpdates)return ao(this.view);if(mr&&hl<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Gc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let s=new Set,r;for(let a=e.focusNode;a;a=Nu(a))s.add(a);for(let a=e.anchorNode;a;a=Nu(a))if(s.has(a)){r=a;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let s=this.pendingRecords();s.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&D4(e)&&!this.ignoreSelectionChange(r),a=-1,l=-1,d=!1,u=[];if(e.editable)for(let p=0;p<s.length;p++){let x=this.registerMutation(s[p],u);x&&(a=a<0?x.from:Math.min(x.from,a),l=l<0?x.to:Math.max(x.to,l),x.typeOver&&(d=!0))}if(u.some(p=>p.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let p of u)if(p.nodeName=="BR"&&p.parentNode){let x=p.nextSibling;for(;x&&x.nodeType==1;){if(x.contentEditable=="false"){p.parentNode.removeChild(p);break}x=x.firstChild}}}else if(ci&&u.length){let p=u.filter(x=>x.nodeName=="BR");if(p.length==2){let[x,g]=p;x.parentNode&&x.parentNode.parentNode==g.parentNode?g.remove():x.remove()}else{let{focusNode:x}=this.currentSelection;for(let g of p){let b=g.parentNode;b&&b.nodeName=="LI"&&(!x||Dse(e,x)!=b)&&g.remove()}}}let m=null;a<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&_b(r)&&(m=BN(e))&&m.eq(gt.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ao(e),this.currentSelection.set(r),e.scrollToSelection()):(a>-1||i)&&(a>-1&&(e.docView.markDirty(a,l),Ose(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Pse(e,u)),this.handleDOMChange(a,l,d,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ao(e),this.currentSelection.set(r))}registerMutation(e,s){if(s.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let p=0;p<e.addedNodes.length;p++){let x=e.addedNodes[p];s.push(x),x.nodeType==3&&(this.lastChangedTextNode=x)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,a=e.nextSibling;if(mr&&hl<=11&&e.addedNodes.length)for(let p=0;p<e.addedNodes.length;p++){let{previousSibling:x,nextSibling:g}=e.addedNodes[p];(!x||Array.prototype.indexOf.call(e.addedNodes,x)<0)&&(i=x),(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(a=g)}let l=i&&i.parentNode==e.target?jn(i)+1:0,d=r.localPosFromDOM(e.target,l,-1),u=a&&a.parentNode==e.target?jn(a):e.target.childNodes.length,m=r.localPosFromDOM(e.target,u,1);return{from:d,to:m}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let U4=new WeakMap,H4=!1;function Ose(t){if(!U4.has(t)&&(U4.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=ci,H4)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),H4=!0}}function q4(t,e){let s=e.startContainer,r=e.startOffset,i=e.endContainer,a=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return Gc(l.node,l.offset,i,a)&&([s,r,i,a]=[i,a,s,r]),{anchorNode:s,anchorOffset:r,focusNode:i,focusOffset:a}}function Rse(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return q4(t,i)}let s;function r(i){i.preventDefault(),i.stopImmediatePropagation(),s=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),s?q4(t,s):null}function Dse(t,e){for(let s=e.parentNode;s&&s!=t.dom;s=s.parentNode){let r=t.docView.nearestDesc(s,!0);if(r&&r.node.isBlock)return s}return null}function Pse(t,e){var s;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let a of e)if(((s=a.parentNode)===null||s===void 0?void 0:s.nodeName)=="TR"){let l=a.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let d=l;for(;;){let u=d.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;d=u}d.insertBefore(a,d.firstChild),r==a&&t.domSelection().collapse(a,i)}else a.parentNode.removeChild(a)}}function Ise(t,e,s){let{node:r,fromOffset:i,toOffset:a,from:l,to:d}=t.docView.parseRange(e,s),u=t.domSelectionRange(),m,p=u.anchorNode;if(p&&t.dom.contains(p.nodeType==1?p:p.parentNode)&&(m=[{node:p,offset:u.anchorOffset}
vendor: 8,556 bytes, line 400
400],_b(u)||m.push({node:u.focusNode,offset:u.focusOffset})),Cn&&t.input.lastKeyCode===8)for(let N=a;N>i;N--){let S=r.childNodes[N-1],A=S.pmViewDesc;if(S.nodeName=="BR"&&!A){a=N;break}if(!A||A.size)break}let x=t.state.doc,g=t.someProp("domParser")||ul.fromSchema(t.state.schema),b=x.resolve(l),v=null,k=g.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:i,to:a,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:m,ruleFromNode:Lse,context:b});if(m&&m[0].pos!=null){let N=m[0].pos,S=m[1]&&m[1].pos;S==null&&(S=N),v={anchor:N+l,head:S+l}}return{doc:k,sel:v,from:l,to:d}}function Lse(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Bn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let s=document.createElement("div");return s.appendChild(document.createElement("li")),{skip:s}}else if(t.parentNode.lastChild==t||Bn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const $se=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Bse(t,e,s,r,i){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let L=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=BN(t,L);if(M&&!t.state.selection.eq(M)){if(Cn&&so&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",z=>z(t,yc(13,"Enter"))))return;let I=t.state.tr.setSelection(M);L=="pointer"?I.setMeta("pointer",!0):L=="key"&&I.scrollIntoView(),a&&I.setMeta("composition",a),t.dispatch(I)}return}let l=t.state.doc.resolve(e),d=l.sharedDepth(s);e=l.before(d+1),s=t.state.doc.resolve(s).after(d+1);let u=t.state.selection,m=Ise(t,e,s),p=t.state.doc,x=p.slice(m.from,m.to),g,b;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(g=t.state.selection.to,b="end"):(g=t.state.selection.from,b="start"),t.input.lastKeyCode=null;let v=Fse(x.content,m.doc.content,m.from,g,b);if(v&&t.input.domChangeCount++,(ku&&t.input.lastIOSEnter>Date.now()-225||so)&&i.some(L=>L.nodeType==1&&!$se.test(L.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",L=>L(t,yc(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof it&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(m.sel&&m.sel.anchor!=m.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(m.sel){let L=W4(t,t.state.doc,m.sel);if(L&&!L.eq(t.state.selection)){let M=t.state.tr.setSelection(L);a&&M.setMeta("composition",a),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&v.start==v.endB&&t.state.selection instanceof it&&(v.start>t.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=m.from?v.start=t.state.selection.from:v.endA<t.state.selection.to&&v.endA>=t.state.selection.to-2&&t.state.selection.to<=m.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),mr&&hl<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>m.from&&m.doc.textBetween(v.start-m.from-1,v.start-m.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let k=m.doc.resolveNoCache(v.start-m.from),N=m.doc.resolveNoCache(v.endB-m.from),S=p.resolve(v.start),A=k.sameParent(N)&&k.parent.inlineContent&&S.end()>=v.endA;if((ku&&t.input.lastIOSEnter>Date.now()-225&&(!A||i.some(L=>L.nodeName=="DIV"||L.nodeName=="P"))||!A&&k.pos<m.doc.content.size&&(!k.sameParent(N)||!k.parent.inlineContent)&&k.pos<N.pos&&!/\S/.test(m.doc.textBetween(k.pos,N.pos,"","")))&&t.someProp("handleKeyDown",L=>L(t,yc(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&Vse(p,v.start,v.endA,k,N)&&t.someProp("handleKeyDown",L=>L(t,yc(8,"Backspace")))){so&&Cn&&t.domObserver.suppressSelectionUpdates();return}Cn&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),so&&!A&&k.start()!=N.start()&&N.parentOffset==0&&k.depth==N.depth&&m.sel&&m.sel.anchor==m.sel.head&&m.sel.head==v.endA&&(v.endB-=2,N=m.doc.resolveNoCache(v.endB-m.from),setTimeout(()=>{t.someProp("handleKeyDown",function(L){return L(t,yc(13,"Enter"))})},20));let E=v.start,_=v.endA,T=L=>{let M=L||t.state.tr.replace(E,_,m.doc.slice(v.start-m.from,v.endB-m.from));if(m.sel){let I=W4(t,M.doc,m.sel);I&&!(Cn&&t.composing&&I.empty&&(v.start!=v.endB||t.input.lastChromeDelete<Date.now()-100)&&(I.head==E||I.head==M.mapping.map(_)-1)||mr&&I.empty&&I.head==E)&&M.setSelection(I)}return a&&M.setMeta("composition",a),M.scrollIntoView()},$;if(A)if(k.pos==N.pos){mr&&hl<=11&&k.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>ao(t),20));let L=T(t.state.tr.delete(E,_)),M=p.resolve(v.start).marksAcross(p.resolve(v.endA));M&&L.ensureMarks(M),t.dispatch(L)}else if(v.endA==v.endB&&($=zse(k.parent.content.cut(k.parentOffset,N.parentOffset),S.parent.content.cut(S.parentOffset,v.endA-S.start())))){let L=T(t.state.tr);$.type=="add"?L.addMark(E,_,$.mark):L.removeMark(E,_,$.mark),t.dispatch(L)}else if(k.parent.child(k.index()).isText&&k.index()==N.index()-(N.textOffset?0:1)){let L=k.parent.textBetween(k.parentOffset,N.parentOffset),M=()=>T(t.state.tr.insertText(L,E,_));t.someProp("handleTextInput",I=>I(t,E,_,L,M))||t.dispatch(M())}else t.dispatch(T());else t.dispatch(T())}function W4(t,e,s){return Math.max(s.anchor,s.head)>e.content.size?null:zN(t,e.resolve(s.anchor),e.resolve(s.head))}function zse(t,e){let s=t.firstChild.marks,r=e.firstChild.marks,i=s,a=r,l,d,u;for(let p=0;p<r.length;p++)i=r[p].removeFromSet(i);for(let p=0;p<s.length;p++)a=s[p].removeFromSet(a);if(i.length==1&&a.length==0)d=i[0],l="add",u=p=>p.mark(d.addToSet(p.marks));else if(i.length==0&&a.length==1)d=a[0],l="remove",u=p=>p.mark(d.removeFromSet(p.marks));else return null;let m=[];for(let p=0;p<e.childCount;p++)m.push(u(e.child(p)));if(Ne.from(m).eq(t))return{mark:d,type:l}}function Vse(t,e,s,r,i){if(s-e<=i.pos-r.pos||Qv(r,!0,!1)<i.pos)return!1;let a=t.resolve(e);if(!r.parent.isTextblock){let d=a.nodeAfter;return d!=null&&s==e+d.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let l=t.resolve(Qv(a,!0,!0));return!l.parent.isTextblock||l.pos>s||Qv(l,!0,!1)<s?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function Qv(t,e,s){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(s){let a=t.node(r).maybeChild(t.indexAfter(r));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function Fse(t,e,s,r,i){let a=t.findDiffStart(e,s);if(a==null)return null;let{a:l,b:d}=t.findDiffEnd(e,s+t.size,s+e.size);if(i=="end"){let u=Math.max(0,a-Math.min(l,d));r-=l+u-a}if(l<a&&t.size<e.size){let u=r<=a&&r>=l?a-r:0;a-=u,a&&a<e.size&&G4(e.textBetween(a-1,a+1))&&(a+=u?1:-1),d=a+(d-l),l=a}else if(d<a){let u=r<=a&&r>=d?a-r:0;a-=u,a&&a<t.size&&G4(t.textBetween(a-1,a+1))&&(a+=u?1:-1),l=a+(l-d),d=a}return{start:a,endA:l,endB:d}}function G4(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),s=t.charCodeAt(1);return e>=56320&&e<=57343&&s>=55296&&s<=56319}class t6{constructor(e,s){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new rse,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=s,this.state=s.state,this.directPlugins=s.plugins||[],this.directPlugins.forEach(X4),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Q4(this),Y4(this),this.nodeViews=J4(this),this.docView=E4(this.state.doc,K4(this),Yv(this),this.dom,this),this.domObserver=new _se(this,(r,i,a,l)=>Bse(this,r,i,a,l)),this.domObserver.start(),ise(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let s in e)this._props[s]=e[s];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&I1(this);let s=this._props;this._props=e,e.plugins&&(e.plugins.forEach(X4),this.directPlugins=e.plugins),this.updateStateInner(e.state,s)}setProps(e){let s={};for(let r in this._props)s[r]=this._props[r];s.state=this.state;for(let r in e)s[r]=e[r];this.update(s)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,s){var r;let i=this.state,a=!1,l=!1;
vendor: 4,911 bytes, line 400
400e.storedMarks&&this.composing&&(KD(this),l=!0),this.state=e;let d=i.plugins!=e.plugins||this._props.plugins!=s.plugins;if(d||this._props.plugins!=s.plugins||this._props.nodeViews!=s.nodeViews){let b=J4(this);Hse(b,this.nodeViews)&&(this.nodeViews=b,a=!0)}(d||s.handleDOMEvents!=this._props.handleDOMEvents)&&I1(this),this.editable=Q4(this),Y4(this);let u=Yv(this),m=K4(this),p=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",x=a||!this.docView.matchesNode(e.doc,m,u);(x||!e.selection.eq(i.selection))&&(l=!0);let g=p=="preserve"&&l&&this.dom.style.overflowAnchor==null&&yte(this);if(l){this.domObserver.stop();let b=x&&(mr||Cn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Use(i.selection,e.selection);if(x){let v=Cn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=yse(this)),(a||!this.docView.update(e.doc,m,u,this))&&(this.docView.updateOuterDeco(m),this.docView.destroy(),this.docView=E4(e.doc,m,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Ute(this))?ao(this,b):(ID(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():g&&vte(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",s=>s(this)))if(this.state.selection instanceof Xe){let s=this.docView.domAfterPos(this.state.selection.from);s.nodeType==1&&j4(this,s.getBoundingClientRect(),e)}else j4(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let s=0;s<this.directPlugins.length;s++){let r=this.directPlugins[s];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let s=0;s<this.state.plugins.length;s++){let r=this.state.plugins[s];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let s=0;s<this.pluginViews.length;s++){let r=this.pluginViews[s];r.update&&r.update(this,e)}}updateDraggedNode(e,s){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let a=r.from+(this.state.doc.content.size-s.doc.content.size);(a>0&&a<this.state.doc.content.size&&this.state.doc.nodeAt(a))==r.node&&(i=a)}this.dragging=new QD(e.slice,e.move,i<0?void 0:Xe.create(this.state.doc,i))}someProp(e,s){let r=this._props&&this._props[e],i;if(r!=null&&(i=s?s(r):r))return i;for(let l=0;l<this.directPlugins.length;l++){let d=this.directPlugins[l].props[e];if(d!=null&&(i=s?s(d):d))return i}let a=this.state.plugins;if(a)for(let l=0;l<a.length;l++){let d=a[l].props[e];if(d!=null&&(i=s?s(d):d))return i}}hasFocus(){if(mr){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&wte(this.dom),ao(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let s=this.dom.parentNode;s;s=s.parentNode)if(s.nodeType==9||s.nodeType==11&&s.host)return s.getSelection||(Object.getPrototypeOf(s).getSelection=()=>s.ownerDocument.getSelection()),this._root=s}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Cte(this,e)}coordsAtPos(e,s=1){return ED(this,e,s)}domAtPos(e,s=0){return this.docView.domFromPos(e,s)}nodeDOM(e){let s=this.docView.descAt(e);return s?s.nodeDOM:null}posAtDOM(e,s,r=-1){let i=this.docView.posFromDOM(e,s,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,s){return _te(this,s||this.state,e)}pasteHTML(e,s){return Hm(this,"",e,!1,s||new ClipboardEvent("paste"))}pasteText(e,s){return Hm(this,e,null,!0,s||new ClipboardEvent("paste"))}serializeForClipboard(e){return VN(this,e)}destroy(){this.docView&&(ase(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Yv(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,cte())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return lse(this,e)}domSelectionRange(){let e=this.domSelection();return e?Bn&&this.root.nodeType===11&&pte(this.dom.ownerDocument)==this.dom&&Rse(this,e)||e:{focusNode:null,focusOffset:0,anch
vendor: 4,492 bytes, line 400
400orNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}t6.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function K4(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",s=>{if(typeof s=="function"&&(s=s(t.state)),s)for(let r in s)r=="class"?e.class+=" "+s[r]:r=="style"?e.style=(e.style?e.style+";":"")+s[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(s[r]))}),e.translate||(e.translate="no"),[Xn.node(0,t.state.doc.content.size,e)]}function Y4(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Xn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Q4(t){return!t.someProp("editable",e=>e(t.state)===!1)}function Use(t,e){let s=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(s)!=e.$anchor.start(s)}function J4(t){let e=Object.create(null);function s(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",s),t.someProp("markViews",s),e}function Hse(t,e){let s=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;s++}for(let i in e)r++;return s!=r}function X4(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Cl={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},kg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},qse=typeof navigator<"u"&&/Mac/.test(navigator.platform),Wse=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Nn=0;Nn<10;Nn++)Cl[48+Nn]=Cl[96+Nn]=String(Nn);for(var Nn=1;Nn<=24;Nn++)Cl[Nn+111]="F"+Nn;for(var Nn=65;Nn<=90;Nn++)Cl[Nn]=String.fromCharCode(Nn+32),kg[Nn]=String.fromCharCode(Nn);for(var Jv in Cl)kg.hasOwnProperty(Jv)||(kg[Jv]=Cl[Jv]);function Gse(t){var e=qse&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Wse&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",s=!e&&t.key||(t.shiftKey?kg:Cl)[t.keyCode]||t.key||"Unidentified";return s=="Esc"&&(s="Escape"),s=="Del"&&(s="Delete"),s=="Left"&&(s="ArrowLeft"),s=="Up"&&(s="ArrowUp"),s=="Right"&&(s="ArrowRight"),s=="Down"&&(s="ArrowDown"),s}const Kse=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Yse=typeof navigator<"u"&&/Win/.test(navigator.platform);function Qse(t){let e=t.split(/-(?!$)/),s=e[e.length-1];s=="Space"&&(s=" ");let r,i,a,l;for(let d=0;d<e.length-1;d++){let u=e[d];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))a=!0;else if(/^mod$/i.test(u))Kse?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(s="Alt-"+s),i&&(s="Ctrl-"+s),l&&(s="Meta-"+s),a&&(s="Shift-"+s),s}function Jse(t){let e=Object.create(null);for(let s in t)e[Qse(s)]=t[s];return e}function Xv(t,e,s=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),s&&e.shiftKey&&(t="Shift-"+t),t}function Xse(t){return new ws({props:{handleKeyDown:s6(t)}})}function s6(t){let e=Jse(t);return function(s,r){let i=Gse(r),a,l=e[Xv(i,r)];if(l&&l(s.state,s.dispatch,s))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let d=e[Xv(i,r,!1)];if(d&&d(s.state,s.dispatch,s))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Yse&&r.ctrlKey&&r.altKey)&&(a=Cl[r.keyCode])&&a!=i){let d=e[Xv(a,r)];if(d&&d(s.state,s.dispatch,s))return!0}}return!1}}var Zse=Object.defineProperty,GN=(t,e)=>{for(var s in e)Zse(t,s,{get:e[s],enumerable:!0})};function Db(t){const{state:e,transaction:s}=t;let{selection:r}=s,{doc:i}=s,{storedMarks:a}=s;
vendor: 17,245 bytes, line 400
400return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=s.selection,i=s.doc,a=s.storedMarks,s}}}var Pb=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:s}=this,{view:r}=e,{tr:i}=s,a=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([l,d])=>[l,(...m)=>{const p=d(...m)(a);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:s,editor:r,state:i}=this,{view:a}=r,l=[],d=!!t,u=t||i.tr,m=()=>(!d&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(u),l.every(x=>x===!0)),p={...Object.fromEntries(Object.entries(s).map(([x,g])=>[x,(...v)=>{const k=this.buildProps(u,e),N=g(...v)(k);return l.push(N),p}])),run:m};return p}createCan(t){const{rawCommands:e,state:s}=this,r=!1,i=t||s.tr,a=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([d,u])=>[d,(...m)=>u(...m)({...a,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:s,editor:r,state:i}=this,{view:a}=r,l={tr:t,editor:r,view:a,state:Db({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(s).map(([d,u])=>[d,(...m)=>u(...m)(l)]))}};return l}},n6={};GN(n6,{blur:()=>ene,clearContent:()=>tne,clearNodes:()=>sne,command:()=>nne,createParagraphNear:()=>rne,cut:()=>ine,deleteCurrentNode:()=>ane,deleteNode:()=>one,deleteRange:()=>lne,deleteSelection:()=>cne,enter:()=>dne,exitCode:()=>une,extendMarkRange:()=>hne,first:()=>mne,focus:()=>fne,forEach:()=>xne,insertContent:()=>gne,insertContentAt:()=>vne,joinBackward:()=>Nne,joinDown:()=>jne,joinForward:()=>kne,joinItemBackward:()=>Sne,joinItemForward:()=>Cne,joinTextblockBackward:()=>Tne,joinTextblockForward:()=>Ene,joinUp:()=>wne,keyboardShortcut:()=>Mne,lift:()=>_ne,liftEmptyBlock:()=>One,liftListItem:()=>Rne,newlineInCode:()=>Dne,resetAttributes:()=>Pne,scrollIntoView:()=>Ine,selectAll:()=>Lne,selectNodeBackward:()=>$ne,selectNodeForward:()=>Bne,selectParentNode:()=>zne,selectTextblockEnd:()=>Vne,selectTextblockStart:()=>Fne,setContent:()=>Une,setMark:()=>dre,setMeta:()=>ure,setNode:()=>hre,setNodeSelection:()=>mre,setTextDirection:()=>pre,setTextSelection:()=>fre,sinkListItem:()=>xre,splitBlock:()=>gre,splitListItem:()=>bre,toggleList:()=>vre,toggleMark:()=>wre,toggleNode:()=>jre,toggleWrap:()=>Nre,undoInputRule:()=>kre,unsetAllMarks:()=>Sre,unsetMark:()=>Cre,unsetTextDirection:()=>Tre,updateAttributes:()=>Ere,wrapIn:()=>Are,wrapInList:()=>Mre});var ene=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var s;t.isDestroyed||(e.dom.blur(),(s=window?.getSelection())==null||s.removeAllRanges())}),!0),tne=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),sne=()=>({state:t,tr:e,dispatch:s})=>{const{selection:r}=e,{ranges:i}=r;return s&&i.forEach(({$from:a,$to:l})=>{t.doc.nodesBetween(a.pos,l.pos,(d,u)=>{if(d.type.isText)return;const{doc:m,mapping:p}=e,x=m.resolve(p.map(u)),g=m.resolve(p.map(u+d.nodeSize)),b=x.blockRange(g);if(!b)return;const v=Du(b);if(d.type.isTextblock){const{defaultType:k}=x.parent.contentMatchAt(x.index());e.setNodeMarkup(b.start,k)}(v||v===0)&&e.lift(b,v)})}),!0},nne=t=>e=>t(e),rne=()=>({state:t,dispatch:e})=>gD(t,e),ine=(t,e)=>({editor:s,tr:r})=>{const{state:i}=s,a=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const l=r.mapping.map(e);return r.insert(l,a.content),r.setSelection(new it(r.doc.resolve(Math.max(l-1,0)))),!0},ane=()=>({tr:t,dispatch:e})=>{const{selection:s}=t,r=s.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===r.type){if(e){const d=i.before(a),u=i.after(a);t.delete(d,u).scrollIntoView()}return!0}return!1};function Ws(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var one=t=>({tr:e,state:s,dispatch:r})=>{const i=Ws(t,s.schema),a=e.selection.$anchor;for(let l=a.depth;l>0;l-=1)if(a.node(l).type===i){if(r){const u=a.before(l),m=a.after(l);e.delete(u,m).scrollIntoView()}return!0}return!1},lne=t=>({tr:e,dispatch:s})=>{const{from:r,to:i}=t;return s&&e.delete(r,i),!0},cne=()=>({state:t,dispatch:e})=>RN(t,e),dne=()=>({commands:t})=>t.keyboardShortcut("Enter"),une=()=>({state:t,dispatch:e})=>Kee(t,e);function KN(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Sg(t,e,s={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>s.strict?e[i]===t[i]:KN(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function r6(t,e,s={}){return t.find(r=>r.type===e&&Sg(Object.fromEntries(Object.keys(s).map(i=>[i,r.attrs[i]])),s))}function Z4(t,e,s={}){return!!r6(t,e,s)}function YN(t,e,s){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(m=>m.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(m=>m.type===e))return;if(!s){const m=r.node.marks.find(p=>p.type===e);m&&(s=m.attrs)}if(!r6([...r.node.marks],e,s))return;let a=r.index,l=t.start()+r.offset,d=a+1,u=l+r.node.nodeSize;for(;a>0&&Z4([...t.parent.child(a-1).marks],e,s);)a-=1,l-=t.parent.child(a).nodeSize;for(;d<t.parent.childCount&&Z4([...t.parent.child(d).marks],e,s);)u+=t.parent.child(d).nodeSize,d+=1;return{from:l,to:u}}function xo(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var hne=(t,e)=>({tr:s,state:r,dispatch:i})=>{const a=xo(t,r.schema),{doc:l,selection:d}=s,{$from:u,from:m,to:p}=d;if(i){const x=YN(u,a,e);if(x&&x.from<=m&&x.to>=p){const g=it.create(l,x.from,x.to);s.setSelection(g)}}return!0},mne=t=>e=>{const s=typeof t=="function"?t(e):t;for(let r=0;r<s.length;r+=1)if(s[r](e))return!0;return!1};function i6(t){return t instanceof it}function Ec(t=0,e=0,s=0){return Math.min(Math.max(t,e),s)}function a6(t,e=null){if(!e)return null;const s=gt.atStart(t),r=gt.atEnd(t);if(e==="start"||e===!0)return s;if(e==="end")return r;const i=s.from,a=r.to;return e==="all"?it.create(t,Ec(0,i,a),Ec(t.content.size,i,a)):it.create(t,Ec(e,i,a),Ec(e,i,a))}function eE(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Cg(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function pne(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var fne=(t=null,e={})=>({editor:s,view:r,tr:i,dispatch:a})=>{e={scrollIntoView:!0,...e};const l=()=>{(Cg()||eE())&&r.dom.focus(),pne()&&!Cg()&&!eE()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{s.isDestroyed||(r.focus(),e?.scrollIntoView&&s.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(a&&t===null&&!i6(s.state.selection))return l(),!0;const d=a6(i.doc,t)||s.state.selection,u=s.state.selection.eq(d);return a&&(u||i.setSelection(d),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},xne=(t,e)=>s=>t.every((r,i)=>e(r,{...s,index:i})),gne=(t,e)=>({tr:s,commands:r})=>r.insertContentAt({from:s.selection.from,to:s.selection.to},t,e),o6=t=>{const e=t.childNodes;for(let s=e.length-1;s>=0;s-=1){const r=e[s];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&o6(r)}return t};function sx(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,s=new window.DOMParser().parseFromString(e,"text/html").body;return o6(s)}function Wm(t,e,s){if(t instanceof dl||t instanceof Ne)return t;s={slice:!0,parseOptions:{},...s};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return Ne.fromArray(t.map(d=>e.nodeFromJSON(d)));const l=e.nodeFromJSON(t);return s.errorOnInvalidContent&&l.check(),l}catch(a){if(s.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",a),Wm("",e,s)}if(i){if(s.errorOnInvalidContent){let l=!1,d="";const u=new HR({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:m=>(l=!0,d=typeof m=="string"?m:m.outerHTML,null)}]}})});if(s.slice?ul.fromSchema(u).parseSlice(sx(t),s.parseOptions):ul.fromSchema(u).parse(sx(t),s.parseOptions),s.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${d}`)})}const a=ul.fromSchema(e);return s.slice?a.parseSlice(sx(t),s.parseOptions).content:a.parse(sx(t),s.parseOptions)}return Wm("",e,s)}function bne(t,e,s){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Us||i instanceof ln))return;const a=t.mapping.maps[r];let l=0;a.forEach((d,u,m,p)=>{l===0&&(l=p)}),t.setSelection(gt.near(t.doc.resolve(l),s))}var yne=t=>!("type"in t),vne=(t,e,s)=>({tr:r,dispatch:i,editor:a})=>{var l;if(i){s={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...s};let d;const u=N=>{a.emit("contentError",{editor:a,error:N,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},m={preserveWhitespace:"full",...s.parseOptions};if(!s.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{Wm(e,a.schema,{parseOptions:m,errorOnInvalidContent:!0})}catch(N){u(N)}try{d=Wm(e,a.schema,{parseOptions:m,errorOnInvalidContent:(l=s.errorOnInvalidContent)!=null?l:a.options.enableContentCheck})}catch(N){return u(N),!1}let{from:p,to:x}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,b=!0;if((yne(d)?d:[d]).forEach(N=>{N.check(),g=g?N.isText&&N.marks.length===0:!1,b=b?N.isBlock:!1}),p===x&&b){const{parent:N}=r.doc.resolve(p);N.isTextblock&&!N.type.spec.code&&!N.childCount&&(p-=1,x+=1)}let k;if(g){if(Array.isArray(e))k=e.map(N=>N.text||"").join("");else if(e instanceof Ne){let N="";e.forEach(S=>{S.text&&(N+=S.text)}),k=N}else typeof e=="object"&&e&&e.text?k=e.text:k=e;r.insertText(k,p,x)}else{k=d;const N=r.doc.resolve(p),S=N.node(),A=N.parentOffset===0,E=S.isText||S.isTextblock,_=S.content.size>0;A&&E&&_&&b&&(p=Math.max(0,p-1)),r.replaceWith(p,x,k)}s.updateSelection&&bne(r,r.steps.length-1,-1),s.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:k}),s.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:k})}return!0},wne=()=>({state:t,dispatch:e})=>qee(t,e),jne=()=>({state:t,dispatch:e})=>Wee(t,e),Nne=()=>({state:t,dispatch:e})=>dD(t,e),kne=()=>({state:t,dispatch:e})=>pD(t,e),Sne=()=>({state:t,dispatch:e,tr:s})=>{try{const r=Eb(t.doc,t.selection.$from.pos,-1);return r==null?!1:(s.join(r,2),e&&e(s),!0)}catch{return!1}},Cne=()=>({state:t,dispatch:e,tr:s})=>{try{const r=Eb(t.doc,t.selection.$from.pos,1);return r==null?!1:(s.join(r,2),e&&e(s),!0)}catch{return!1}},Tne=()=>({state:t,dispatch:e})=>Uee(t,e),Ene=()=>({state:t,dispatch:e})=>Hee(t,e);function l6(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Ane(t){const e=t.split(/-(?!$)/);let s=e[e.length-1];s==="Space"&&(s=" ");let r,i,a,l;for(let d=0;d<e.length-1;d+=1){const u=e[d];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))a=!0;else if(/^mod$/i.test(u))Cg()||l6()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(s=`Alt-${s}`),i&&(s=`Ctrl-${s}`),l&&(s=`Meta-${s}`),a&&(s=`Shift-${s}`),s}var Mne=t=>({editor:e,view:s,tr:r,dispatch:i})=>{const a=Ane(t).split(/-(?!$)/),l=a.find(m=>!["Alt","Ctrl","Meta","Shift"].includes(m)),d=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{s.someProp("handleKeyDown",m=>m(s,d))});return u?.steps.forEach(m=>{const p=m.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function Tl(t,e,s={}){const{from:r,to:i,empty:a}=t.selection,l=e?Ws(e,t.schema):null,d=[];t.doc.nodesBetween(r,i,(x,g)=>{if(x.isText)return;const b=Math.max(r,g),v=Math.min(i,g+x.nodeSize);d.push({node:x,from:b,to:v})});const u=i-r,m=d.filter(x=>l?l.name===x.node.type.name:!0).filter(x=>Sg(x.node.attrs,s,{strict:!1}));return a?!!m.length:m.reduce((x,g)=>x+g.to-g.from,0)>=u}var _ne=(t,e={})=>({state:s,dispatch:r})=>{const i=Ws(t,s.schema);return Tl(s,i,e)?Gee(s,r):!1},One=()=>({state:t,dispatch:e})=>bD(t,e),Rne=t=>({state:e,dispatch:s})=>{const r=Ws(t,e.schema);return ite(r)(e,s)},Dne=()=>({state:t,dispatch:e})=>xD(t,e);function Ib(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function tE(t,e){const s=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(s.includes(i)||(r[i]=t[i]),r),{})}var Pne=(t,e)=>({tr:s,state:r,dispatch:i})=>{let a=null,l=null;const d=Ib(typeof t=="string"?t:t.name,r.schema);if(!d)return!1;d==="node"&&(a=Ws(t,r.schema)),d==="mark"&&(l=xo(t,r.schema));let u=!1;return s.selection.ranges.forEach(m=>{r.doc.nodesBetween(m.$from.pos,m.$to.pos,(p,x)=>{a&&a===p.type&&(u=!0,i&&s.setNodeMarkup(x,void 0,tE(p.attrs,e))),l&&p.marks.length&&p.marks.forEach(g=>{l===g.type&&(u=!0,i&&s.addMark(x,x+p.nodeSize,l.create(tE(g.attrs,e))))})})}),u},Ine=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Lne=()=>({tr:t,dispatch:e})=>{if(e){const s=new Ir(t.doc);t.setSelection(s)}return!0},$ne=()=>({state:t,dispatch:e})=>hD(t,e),Bne=()=>({state:t,dispatch:e})=>fD(t,e),zne=()=>({state:t,dispatch:e})=>Jee(t,e),Vne=()=>({state:t,dispatch:e})=>ete(t,e),Fne=()=>({state:t,dispatch:e})=>Zee(t,e);function L1(t,e,s={},r={}){return Wm(t,e,{slice:!1,parseOptions:s,errorOnInvalidContent:r.errorOnInvalidContent})}var Une=(t,{errorOnInvalidContent:e,emitUpdate:s=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:l,commands:d})=>{const{doc:u}=a;if(r.preserveWhitespace!=="full"){const m=L1(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return l&&a.replaceWith(0,u.content.size,m).setMeta("preventUpdate",!s),!0}return l&&a.setMeta("preventUpdate",!s),d.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function c6(t,e){const s=xo(e,t.schema),{from:r,to:i,empty:a}=t.selection,l=[];a?(t.storedMarks&&l.push(...t.storedMarks),l.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{l.push(...u.marks)});const d=l.find(u=>u.type.name===s.name);return d?{...d.attrs}:{}}function d6(t,e){const s=new aD(t);return e.forEach(r=>{r.steps.forEach(i=>{s.step(i)})}),s}function Hne(t){for(let e=0;e<t.edgeCount;e+=1){const{type:s}=t.edge(e);if(s.isTextblock&&!s.hasRequiredAttrs())return s}return null}function qne(t,e,s){const r=[];return t.nodesBetween(e.from,e.to,(i,a)=>{s(i)&&r.push({node:i,pos:a})}),r}function Wne(t,e){for(let s=t.depth;s>0;s-=1){const r=t.node(s);if(e(r))return{pos:s>0?t.before(s):0,start:t.start(s),depth:s,node:r}}}function Lb(t){return e=>Wne(e.$from,t)}function Qe(t,e,s){return t.config[e]===void 0&&t.parent?Qe(t.parent,e,s):typeof t.config[e]=="function"?t.config[e].bind({...s,parent:t.parent?Qe(t.parent,e,s):null}):t.config[e]}function QN(t){return t.map(e=>{const s={name:e.name,options:e.options,storage:e.storage},r=Qe(e,"addExtensions",s);return r?[e,...QN(r())]:e}).flat(10)}function JN(t,e){const s=ed.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(s),i.innerHTML}function u6(t){return typeof t=="function"}function $t(t,e=void 0,...s){return u6(t)?e?t.bind(e)(...s):t(...s):t}function Gne(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Su(t){const e=t.filter(i=>i.type==="extension"),s=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:s,markExtensions:r}}function h6(t){const e=[],{nodeExtensions:s,markExtensions:r}=Su(t),i=[...s,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},l=s.filter(m=>m.name!=="text").map(m=>m.name),d=r.map(m=>m.name),u=[...l,...d];return t.forEach(m=>{const p={name:m.name,options:m.options,storage:m.storage,extensions:i},x=Qe(m,"addGlobalAttributes",p);if(!x)return;x().forEach(b=>{let v;Array.isArray(b.types)?v=b.types:b.types==="*"?v=u:b.types==="nodes"?v=l:b.types==="marks"?v=d:v=[],v.forEach(k=>{Object.entries(b.attributes).forEach(([N,S])=>{e.push({type:k,name:N,attribute:{...a,...S}})})})})}
400),i.forEach(m=>{const p={name:m.name,options:m.options,storage:m.storage},x=Qe(m,"addAttributes",p);if(!x)return;const g=x();Object.entries(g).forEach(([b,v])=>{const k={...a,...v};typeof k?.default=="function"&&(k.default=k.default()),k?.isRequired&&k?.default===void 0&&delete k.default,e.push({type:m.name,name:b,attribute:k})})}),e}function Kne(t){const e=[];let s="",r=!1,i=!1,a=0;const l=t.length;for(let d=0;d<l;d+=1){const u=t[d];if(u==="'"&&!i){r=!r,s+=u;continue}if(u==='"'&&!r){i=!i,s+=u;continue}if(!r&&!i){if(u==="("){a+=1,s+=u;continue}if(u===")"&&a>0){a-=1,s+=u;continue}if(u===";"&&a===0){e.push(s),s="";continue}}s+=u}return s&&e.push(s),e}function sE(t){const e=[],s=Kne(t||""),r=s.length;for(let i=0;i<r;i+=1){const a=s[i],l=a.indexOf(":");if(l===-1)continue;const d=a.slice(0,l).trim(),u=a.slice(l+1).trim();d&&u&&e.push([d,u])}return e}function Gs(...t){return t.filter(e=>!!e).reduce((e,s)=>{const r={...e};return Object.entries(s).forEach(([i,a])=>{if(!r[i]){r[i]=a;return}if(i==="class"){const d=a?String(a).split(" "):[],u=r[i]?r[i].split(" "):[],m=d.filter(p=>!u.includes(p));r[i]=[...u,...m].join(" ")}else if(i==="style"){const d=new Map([...sE(r[i]),...sE(a)]);r[i]=Array.from(d.entries()).map(([u,m])=>`${u}: ${m}`).join("; ")}else r[i]=a}),r},{})}function Gm(t,e){return e.filter(s=>s.type===t.type.name).filter(s=>s.attribute.rendered).map(s=>s.attribute.renderHTML?s.attribute.renderHTML(t.attrs)||{}:{[s.name]:t.attrs[s.name]}).reduce((s,r)=>Gs(s,r),{})}function Yne(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function nE(t,e){return"style"in t?t:{...t,getAttrs:s=>{const r=t.getAttrs?t.getAttrs(s):t.attrs;if(r===!1)return!1;const i=e.reduce((a,l)=>{const d=l.attribute.parseHTML?l.attribute.parseHTML(s):Yne(s.getAttribute(l.name));return d==null?a:{...a,[l.name]:d}},{});return{...r,...i}}}}function rE(t){return Object.fromEntries(Object.entries(t).filter(([e,s])=>e==="attrs"&&Gne(s)?!1:s!=null))}function iE(t){var e,s;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((s=t?.attribute)==null?void 0:s.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function Qne(t,e){var s;const r=h6(t),{nodeExtensions:i,markExtensions:a}=Su(t),l=(s=i.find(m=>Qe(m,"topNode")))==null?void 0:s.name,d=Object.fromEntries(i.map(m=>{const p=r.filter(S=>S.type===m.name),x={name:m.name,options:m.options,storage:m.storage,editor:e},g=t.reduce((S,A)=>{const E=Qe(A,"extendNodeSchema",x);return{...S,...E?E(m):{}}},{}),b=rE({...g,content:$t(Qe(m,"content",x)),marks:$t(Qe(m,"marks",x)),group:$t(Qe(m,"group",x)),inline:$t(Qe(m,"inline",x)),atom:$t(Qe(m,"atom",x)),selectable:$t(Qe(m,"selectable",x)),draggable:$t(Qe(m,"draggable",x)),code:$t(Qe(m,"code",x)),whitespace:$t(Qe(m,"whitespace",x)),linebreakReplacement:$t(Qe(m,"linebreakReplacement",x)),defining:$t(Qe(m,"defining",x)),isolating:$t(Qe(m,"isolating",x)),attrs:Object.fromEntries(p.map(iE))}),v=$t(Qe(m,"parseHTML",x));v&&(b.parseDOM=v.map(S=>nE(S,p)));const k=Qe(m,"renderHTML",x);k&&(b.toDOM=S=>k({node:S,HTMLAttributes:Gm(S,p)}));const N=Qe(m,"renderText",x);return N&&(b.toText=N),[m.name,b]})),u=Object.fromEntries(a.map(m=>{const p=r.filter(N=>N.type===m.name),x={name:m.name,options:m.options,storage:m.storage,editor:e},g=t.reduce((N,S)=>{const A=Qe(S,"extendMarkSchema",x);return{...N,...A?A(m):{}}},{}),b=rE({...g,inclusive:$t(Qe(m,"inclusive",x)),excludes:$t(Qe(m,"excludes",x)),group:$t(Qe(m,"group",x)),spanning:$t(Qe(m,"spanning",x)),code:$t(Qe(m,"code",x)),attrs:Object.fromEntries(p.map(iE))}),v=$t(Qe(m,"parseHTML",x));v&&(b.parseDOM=v.map(N=>nE(N,p)));const k=Qe(m,"renderHTML",x);return k&&(b.toDOM=N=>k({mark:N,HTMLAttributes:Gm(N,p)})),[m.name,b]}));return new HR({topNode:l,nodes:d,marks:u})}function Jne(t){const e=t.filter((s,r)=>t.indexOf(s)!==r);return Array.from(new Set(e))}function cm(t){return t.sort((s,r)=>{const i=Qe(s,"priority")||100,a=Qe(r,"priority")||100;return i>a?-1:i<a?1:0})}function m6(t){const e=cm(QN(t)),s=Jne(e.map(r=>r.name));return s.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${s.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function p6(t,e,s){const{from:r,to:i}=e,{blockSeparator:a=`
401
402`,textSerializers:l={}}=s||{};let d="";return t.nodesBetween(r,i,(u,m,p,x)=>{var g;u.isBlock&&m>r&&(d+=a);const b=l?.[u.type.name];if(b)return p&&(d+=b({node:u,pos:m,parent:p,index:x,range:e})),!1;u.isText&&(d+=(g=u?.text)==null?void 0:g.slice(Math.max(r,m)-m,i-m))}),d}function Xne(t,e){const s={from:0,to:t.content.size};return p6(t,s,e)}function f6(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,s])=>[e,s.spec.toText]))}function Zne(t,e){const s=Ws(e,t.schema),{from:r,to:i}=t.selection,a=[];t.doc.nodesBetween(r,i,d=>{a.push(d)});const l=a.reverse().find(d=>d.type.name===s.name);return l?{...l.attrs}:{}}function x6(t,e){const s=Ib(typeof e=="string"?e:e.name,t.schema);return s==="node"?Zne(t,e):s==="mark"?c6(t,e):{}}function ere(t,e=JSON.stringify){const s={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(s,i)?!1:s[i]=!0})}function tre(t){const e=ere(t);return e.length===1?e:e.filter((s,r)=>!e.filter((a,l)=>l!==r).some(a=>s.oldRange.from>=a.oldRange.from&&s.oldRange.to<=a.oldRange.to&&s.newRange.from>=a.newRange.from&&s.newRange.to<=a.newRange.to))}function g6(t){const{mapping:e,steps:s}=t,r=[];return e.maps.forEach((i,a)=>{const l=[];if(i.ranges.length)i.forEach((d,u)=>{l.push({from:d,to:u})});else{const{from:d,to:u}=s[a];if(d===void 0||u===void 0)return;l.push({from:d,to:u})}l.forEach(({from:d,to:u})=>{const m=e.slice(a).map(d,-1),p=e.slice(a).map(u),x=e.invert().map(m,-1),g=e.invert().map(p);r.push({oldRange:{from:x,to:g},newRange:{from:m,to:p}})})}),tre(r)}function XN(t,e,s){const r=[];return t===e?s.resolve(t).marks().forEach(i=>{const a=s.resolve(t),l=YN(a,i.type);l&&r.push({mark:i,...l})}):s.nodesBetween(t,e,(i,a)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(l=>({from:a,to:a+i.nodeSize,mark:l})))}),r}var sre=(t,e,s,r=20)=>{const i=t.doc.resolve(s);let a=r,l=null;for(;a>0&&l===null;){const d=i.node(a);d?.type.name===e?l=d:a-=1}return[l,a]};function Vh(t,e){return e.nodes[t]||e.marks[t]||null}function Mx(t,e,s){return Object.fromEntries(Object.entries(s).filter(([r])=>{const i=t.find(a=>a.type===e&&a.name===r);return i?i.attribute.keepOnSplit:!1}))}var nre=(t,e=500)=>{let s="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,a,l,d)=>{var u,m;const p=((m=(u=i.type.spec).toText)==null?void 0:m.call(u,{node:i,pos:a,parent:l,index:d}))||i.textContent||"%leaf%";s+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-a))}),s};function $1(t,e,s={}){const{empty:r,ranges:i}=t.selection,a=e?xo(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(x=>a?a.name===x.type.name:!0).find(x=>Sg(x.attrs,s,{strict:!1}));let l=0;const d=[];if(i.forEach(({$from:x,$to:g})=>{const b=x.pos,v=g.pos;t.doc.nodesBetween(b,v,(k,N)=>{if(a&&k.inlineContent&&!k.type.allowsMarkType(a))return!1;if(!k.isText&&!k.marks.length)return;const S=Math.max(b,N),A=Math.min(v,N+k.nodeSize),E=A-S;l+=E,d.push(...k.marks.map(_=>({mark:_,from:S,to:A})))})}),l===0)return!1;const u=d.filter(x=>a?a.name===x.mark.type.name:!0).filter(x=>Sg(x.mark.attrs,s,{strict:!1})).reduce((x,g)=>x+g.to-g.from,0),m=d.filter(x=>a?x.mark.type!==a&&x.mark.type.excludes(a):!0).reduce((x,g)=>x+g.to-g.from,0);return(u>0?u+m:u)>=l}function rre(t,e,s={}){if(!e)return Tl(t,null,s)||$1(t,null,s);const r=Ib(e,t.schema);return r==="node"?Tl(t,e,s):r==="mark"?$1(t,e,s):!1}var ire=(t,e)=>{const{$from:s,$to:r,$anchor:i}=t.selection;if(e){const a=Lb(d=>d.type.name===e)(t.selection);if(!a)return!1;const l=t.doc.resolve(a.pos+1);return i.pos+1===l.end()}return!(r.parentOffset<r.parent.nodeSize-2||s.pos!==r.pos)},are=t=>{const{$from:e,$to:s}=t.selection;return!(e.parentOffset>0||e.pos!==s.pos)};function aE(t,e){return Array.isArray(e)?e.some(s=>(typeof s=="string"?s:s.name)===t.name):e}function Zv(t,e){const{nodeExtensions:s}=Su(e),r=s.find(l=>l.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},a=$t(Qe(r,"group",i));return typeof a!="string"?!1:a.split(" ").includes("list")}function $b(t,{checkChildren:e=!0,ignoreWhitespace:s=!1}={}){var r;if(s){if(t.type.name==="hardBreak")return!0;
vendor: 6,355 bytes, line 402
402if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(a=>{i!==!1&&($b(a,{ignoreWhitespace:s,checkChildren:e})||(i=!1))}),i}return!1}function b6(t){return t instanceof Xe}var y6=class v6{constructor(e){this.position=e}static fromJSON(e){return new v6(e.position)}toJSON(){return{position:this.position}}};function ore(t,e){const s=e.mapping.mapResult(t.position);return{position:new y6(s.pos),mapResult:s}}function lre(t){return new y6(t)}function cre(t,e,s){var r;const{selection:i}=e;let a=null;if(i6(i)&&(a=i.$cursor),a){const d=(r=t.storedMarks)!=null?r:a.marks();return a.parent.type.allowsMarkType(s)&&(!!s.isInSet(d)||!d.some(m=>m.type.excludes(s)))}const{ranges:l}=i;return l.some(({$from:d,$to:u})=>{let m=d.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(s):!1;return t.doc.nodesBetween(d.pos,u.pos,(p,x,g)=>{if(m)return!1;if(p.isInline){const b=!g||g.type.allowsMarkType(s),v=!!s.isInSet(p.marks)||!p.marks.some(k=>k.type.excludes(s));m=b&&v}return!m}),m})}var dre=(t,e={})=>({tr:s,state:r,dispatch:i})=>{const{selection:a}=s,{empty:l,ranges:d}=a,u=xo(t,r.schema);if(i)if(l){const m=c6(r,u);s.addStoredMark(u.create({...m,...e}))}else d.forEach(m=>{const p=m.$from.pos,x=m.$to.pos;r.doc.nodesBetween(p,x,(g,b)=>{const v=Math.max(b,p),k=Math.min(b+g.nodeSize,x);g.marks.find(S=>S.type===u)?g.marks.forEach(S=>{u===S.type&&s.addMark(v,k,u.create({...S.attrs,...e}))}):s.addMark(v,k,u.create(e))})});return cre(r,s,u)},ure=(t,e)=>({tr:s})=>(s.setMeta(t,e),!0),hre=(t,e={})=>({state:s,dispatch:r,chain:i})=>{const a=Ws(t,s.schema);let l;return s.selection.$anchor.sameParent(s.selection.$head)&&(l=s.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:d})=>y4(a,{...l,...e})(s)?!0:d.clearNodes()).command(({state:d})=>y4(a,{...l,...e})(d,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},mre=t=>({tr:e,dispatch:s})=>{if(s){const{doc:r}=e,i=Ec(t,0,r.content.size),a=Xe.create(r,i);e.setSelection(a)}return!0},pre=(t,e)=>({tr:s,state:r,dispatch:i})=>{const{selection:a}=r;let l,d;return typeof e=="number"?(l=e,d=e):e&&"from"in e&&"to"in e?(l=e.from,d=e.to):(l=a.from,d=a.to),i&&s.doc.nodesBetween(l,d,(u,m)=>{u.isText||s.setNodeMarkup(m,void 0,{...u.attrs,dir:t})}),!0},fre=t=>({tr:e,dispatch:s})=>{if(s){const{doc:r}=e,{from:i,to:a}=typeof t=="number"?{from:t,to:t}:t,l=it.atStart(r).from,d=it.atEnd(r).to,u=Ec(i,l,d),m=Ec(a,l,d),p=it.create(r,u,m);e.setSelection(p)}return!0},xre=t=>({state:e,dispatch:s})=>{const r=Ws(t,e.schema);return lte(r)(e,s)};function oE(t,e){const s=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(s){const r=s.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var gre=({keepMarks:t=!0}={})=>({tr:e,state:s,dispatch:r,editor:i})=>{const{selection:a,doc:l}=e,{$from:d,$to:u}=a,m=i.extensionManager.attributes,p=Mx(m,d.node().type.name,d.node().attrs);if(a instanceof Xe&&a.node.isBlock)return!d.parentOffset||!io(l,d.pos)?!1:(r&&(t&&oE(s,i.extensionManager.splittableMarks),e.split(d.pos).scrollIntoView()),!0);if(!d.parent.isBlock)return!1;const x=u.parentOffset===u.parent.content.size,g=d.depth===0?void 0:Hne(d.node(-1).contentMatchAt(d.indexAfter(-1)));let b=x&&g?[{type:g,attrs:p}]:void 0,v=io(e.doc,e.mapping.map(d.pos),1,b);if(!b&&!v&&io(e.doc,e.mapping.map(d.pos),1,g?[{type:g}]:void 0)&&(v=!0,b=g?[{type:g,attrs:p}]:void 0),r){if(v&&(a instanceof it&&e.deleteSelection(),e.split(e.mapping.map(d.pos),1,b),g&&!x&&!d.parentOffset&&d.parent.type!==g)){const k=e.mapping.map(d.before()),N=e.doc.resolve(k);d.node(-1).canReplaceWith(N.index(),N.index()+1,g)&&e.setNodeMarkup(e.mapping.map(d.before()),g)}t&&oE(s,i.extensionManager.splittableMarks),e.scrollIntoView()}return v},bre=(t,e={})=>({tr:s,state:r,dispatch:i,editor:a})=>{var l;const d=Ws(t,r.schema),{$from:u,$to:m}=r.selection,p=r.selection.node;if(p&&p.isBlock||u.depth<2||!u.sameParent(m))return!1;const x=u.node(-1);if(x.type!==d)return!1;const g=a.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==d||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let S=Ne.empty;const A=u.index(-1)?1:u.index(-2)?2:3;for(let M=u.depth-A;M>=u.depth-3;M-=1)S=Ne.from(u.node(M).copy(S));const E=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,_={...Mx(g,u.node().type.name,u.node().attrs),...e},T=((l=d.contentMatch.defaultType)==null?void 0:l.createAndFill(_))||void 0;S=S.append(Ne.from(d.createAndFill(null,T)||void 0));const $=u.before(u.depth-(A-1));s.replace($,u.after(-E),new $e(S,4-A,0));let L=-1;s.doc.nodesBetween($,s.doc.content.size,(M,I)=>{if(L>-1)return!1;M.isTextblock&&M.content.size===0&&(L=I+1)}),L>-1&&s.setSelection(it.near(s.doc.resolve(L))),s.scrollIntoView()}return!0}const b=m.pos===u.end()?x.contentMatchAt(0).defaultType:null,v={...Mx(g,x.type.name,x.attrs),...e},k={...Mx(g,u.node().type.name,u.node().attrs),...e};s.delete(u.pos,m.pos);const N=b?[{type:d,attrs:v},{type:b,attrs:k}]:[{type:d,attrs:v}];if(!io(s.doc,u.pos,2))return!1;if(i){const{selection:S,storedMarks:A}=r,{splittableMarks:E}=a.extensionManager,_=A||S.$to.parentOffset&&S.$from.marks();if(s.split(u.pos,2,N).scrollIntoView(),!_||!i)return!0;const T=_.filter($=>E.includes($.type.name));s.ensureMarks(T)}return!0},ew=(t,e)=>{const s=Lb(l=>l.type===e)(t.selection);if(!s)return!0;const r=t.doc.resolve(Math.max(0,s.pos-1)).before(s.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return s.node.type===i?.type&&Rl(t.doc,s.pos)&&t.join(s.pos),!0},tw=(t,e)=>{const s=Lb(l=>l.type===e)(t.selection);if(!s)return!0;const r=t.doc.resolve(s.start).after(s.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return s.node.type===i?.type&&Rl(t.doc,r)&&t.join(r),!0};function yre(t){const e=t.doc,s=e.firstChild;if(!s)return null;const r=e.resolve(1),i=e.resolve(s.nodeSize-1);return it.between(r,i)}var vre=(t,e,s,r={})=>({editor:i,tr:a,state:l,dispatch:d,chain:u,commands:m,can:p})=>{const{extensions:x,splittableMarks:g}=i.extensionManager,b=Ws(t,l.schema),v=Ws(e,l.schema),{selection:k,storedMarks:N}=l,{$from:S,$to:A}=k,E=S.blockRange(A),_=N||k.$to.parentOffset&&k.$from.marks();if(!E)return!1;const T=Lb(Y=>
402Zv(Y.type.name,x))(k),$=k.from===0&&k.to===l.doc.content.size,L=l.doc.content.content,M=L.length===1?L[0]:null,I=$&&M&&Zv(M.type.name,x)?{node:M,pos:0}:null,z=T??I,ae=!!T&&E.depth>=1&&E.depth-T.depth<=1,U=!!I;if((ae||U)&&z){if(z.node.type===b)return $&&U?u().command(({tr:Y,dispatch:P})=>{const ne=yre(Y);return ne?(Y.setSelection(ne),P&&P(Y),!0):!1}).liftListItem(v).run():m.liftListItem(v);if(Zv(z.node.type.name,x)&&b.validContent(z.node.content))return u().command(()=>(a.setNodeMarkup(z.pos,b),!0)).command(()=>ew(a,b)).command(()=>tw(a,b)).run()}return!s||!_||!d?u().command(()=>p().wrapInList(b,r)?!0:m.clearNodes()).wrapInList(b,r).command(()=>ew(a,b)).command(()=>tw(a,b)).run():u().command(()=>{const Y=p().wrapInList(b,r),P=_.filter(ne=>g.includes(ne.type.name));return a.ensureMarks(P),Y?!0:m.clearNodes()}).wrapInList(b,r).command(()=>ew(a,b)).command(()=>tw(a,b)).run()},wre=(t,e={},s={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:a=!1}=s,l=xo(t,r.schema);return $1(r,l,e)?i.unsetMark(l,{extendEmptyMarkRange:a}):i.setMark(l,e)},jre=(t,e,s={})=>({state:r,commands:i})=>{const a=Ws(t,r.schema),l=Ws(e,r.schema),d=Tl(r,a,s);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),d?i.setNode(l,u):i.setNode(a,{...u,...s})},Nre=(t,e={})=>({state:s,commands:r})=>{const i=Ws(t,s.schema);return Tl(s,i,e)?r.lift(i):r.wrapIn(i,e)},kre=()=>({state:t,dispatch:e})=>{const s=t.plugins;for(let r=0;r<s.length;r+=1){const i=s[r];let a;if(i.spec.isInputRules&&(a=i.getState(t))){if(e){const l=t.tr,d=a.transform;for(let u=d.steps.length-1;u>=0;u-=1)l.step(d.steps[u].invert(d.docs[u]));if(a.text){const u=l.doc.resolve(a.from).marks();l.replaceWith(a.from,a.to,t.schema.text(a.text,u))}else l.delete(a.from,a.to)}return!0}}return!1},Sre=()=>({tr:t,dispatch:e})=>{const{selection:s}=t,{empty:r,ranges:i}=s;return r||e&&i.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},Cre=(t,e={})=>({tr:s,state:r,dispatch:i})=>{var a;const{extendEmptyMarkRange:l=!1}=e,{selection:d}=s,u=xo(t,r.schema),{$from:m,empty:p,ranges:x}=d;if(!i)return!0;if(p&&l){let{from:g,to:b}=d;const v=(a=m.marks().find(N=>N.type===u))==null?void 0:a.attrs,k=YN(m,u,v);k&&(g=k.from,b=k.to),s.removeMark(g,b,u)}else x.forEach(g=>{s.removeMark(g.$from.pos,g.$to.pos,u)});return s.removeStoredMark(u),!0},Tre=t=>({tr:e,state:s,dispatch:r})=>{const{selection:i}=s;let a,l;return typeof t=="number"?(a=t,l=t):t&&"from"in t&&"to"in t?(a=t.from,l=t.to):(a=i.from,l=i.to),r&&e.doc.nodesBetween(a,l,(d,u)=>{if(d.isText)return;const m={...d.attrs};delete m.dir,e.setNodeMarkup(u,void 0,m)}),!0},Ere=(t,e={})=>({tr:s,state:r,dispatch:i})=>{let a=null,l=null;const d=Ib(typeof t=="string"?t:t.name,r.schema);if(!d)return!1;d==="node"&&(a=Ws(t,r.schema)),d==="mark"&&(l=xo(t,r.schema));let u=!1;return s.selection.ranges.forEach(m=>{const p=m.$from.pos,x=m.$to.pos;let g,b,v,k;s.selection.empty?r.doc.nodesBetween(p,x,(N,S)=>{a&&a===N.type&&(u=!0,v=Math.max(S,p),k=Math.min(S+N.nodeSize,x),g=S,b=N)}):r.doc.nodesBetween(p,x,(N,S)=>{S<p&&a&&a===N.type&&(u=!0,v=Math.max(S,p),k=Math.min(S+N.nodeSize,x),g=S,b=N),S>=p&&S<=x&&(a&&a===N.type&&(u=!0,i&&s.setNodeMarkup(S,void 0,{...N.attrs,...e})),l&&N.marks.length&&N.marks.forEach(A=>{if(l===A.type&&(u=!0,i)){const E=Math.max(S,p),_=Math.min(S+N.nodeSize,x);s.addMark(E,_,l.create({...A.attrs,...e}))}}))}),b&&(g!==void 0&&i&&s.setNodeMarkup(g,void 0,{...b.attrs,...e}),l&&b.marks.length&&b.marks.forEach(N=>{l===N.type&&i&&s.addMark(v,k,l.create({...N.attrs,...e}))}))}),u},Are=(t,e={})=>({state:s,dispatch:r})=>{const i=Ws(t,s.schema);return tte(i,e)(s,r)},Mre=(t,e={})=>({state:s,dispatch:r})=>{const i=Ws(t,s.schema);return ste(i,e)(s,r)},_re=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const s=this.callbacks[t];return s&&s.forEach(r=>r.apply(this,e)),this}off(t,e){const s=this.callbacks[t];return s&&(e?this.callbacks[t]=s.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const s=(...r)=>{this.off(t,s),e.apply(this,r)};return this.on(t,s)}removeAllListeners(){this.callbacks={}}},Bb=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},Ore=(t,e)=>{if(KN(e))return e.exec(t);const s=e(t);if(!s)return null;const r=[s.text];
vendor: 32,276 bytes, lines 402-475
402return r.index=s.index,r.input=t,r.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(s.replaceWith)),r};function nx(t){var e;const{editor:s,from:r,to:i,text:a,rules:l,plugin:d}=t,{view:u}=s;if(u.composing)return!1;const m=u.state.doc.resolve(r);if(m.parent.type.spec.code||(e=m.nodeBefore||m.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let p=!1;const x=nre(m)+a;return l.forEach(g=>{if(p)return;const b=Ore(x,g.find);if(!b)return;const v=u.state.tr,k=Db({state:u.state,transaction:v}),N={from:r-(b[0].length-a.length),to:i},{commands:S,chain:A,can:E}=new Pb({editor:s,state:k});g.handler({state:k,range:N,match:b,commands:S,chain:A,can:E})===null||!v.steps.length||(g.undoable&&v.setMeta(d,{transform:v,from:r,to:i,text:a}),u.dispatch(v),p=!0)}),p}function Rre(t){const{editor:e,rules:s}=t,r=new ws({state:{init(){return null},apply(i,a,l){const d=i.getMeta(r);if(d)return d;const u=i.getMeta("applyInputRules");return u&&setTimeout(()=>{let{text:p}=u;typeof p=="string"?p=p:p=JN(Ne.from(p),l.schema);const{from:x}=u,g=x+p.length;nx({editor:e,from:x,to:g,text:p,rules:s,plugin:r})}),i.selectionSet||i.docChanged?null:a}},props:{handleTextInput(i,a,l,d){return nx({editor:e,from:a,to:l,text:d,rules:s,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:a}=i.state.selection;a&&nx({editor:e,from:a.pos,to:a.pos,text:"",rules:s,plugin:r})}),!1)},handleKeyDown(i,a){if(a.key!=="Enter")return!1;const{$cursor:l}=i.state.selection;return l?nx({editor:e,from:l.pos,to:l.pos,text:`
403`,rules:s,plugin:r}):!1}},isInputRules:!0});return r}function Dre(t){return Object.prototype.toString.call(t).slice(8,-1)}function rx(t){return Dre(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function w6(t,e){const s={...t};return rx(t)&&rx(e)&&Object.keys(e).forEach(r=>{rx(e[r])&&rx(t[r])?s[r]=w6(t[r],e[r]):s[r]=e[r]}),s}var ZN=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...$t(Qe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...$t(Qe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>w6(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},td=class j6 extends ZN{constructor(){super(...arguments),this.type="mark"}static create(e={}){const s=typeof e=="function"?e():e;return new j6(s)}static handleExit({editor:e,mark:s}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const l=i.marks();if(!!!l.find(m=>m?.type.name===s.name))return!1;const u=l.find(m=>m?.type.name===s.name);return u&&r.removeStoredMark(u),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const s=typeof e=="function"?e():e;return super.extend(s)}};function Pre(t){return typeof t=="number"}var Ire=class{constructor(t){this.find=t.find,this.handler=t.handler}},Lre=(t,e,s)=>{if(KN(e))return[...t.matchAll(e)];const r=e(t,s);return r?r.map(i=>{const a=[i.text];return a.index=i.index,a.input=t,a.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(i.replaceWith)),a}):[]};function $re(t){const{editor:e,state:s,from:r,to:i,rule:a,pasteEvent:l,dropEvent:d}=t,{commands:u,chain:m,can:p}=new Pb({editor:e,state:s}),x=[];return s.doc.nodesBetween(r,i,(b,v)=>{var k,N,S,A,E;if((N=(k=b.type)==null?void 0:k.spec)!=null&&N.code||!(b.isText||b.isTextblock||b.isInline))return;const _=(E=(A=(S=b.content)==null?void 0:S.size)!=null?A:b.nodeSize)!=null?E:0,T=Math.max(r,v),$=Math.min(i,v+_);if(T>=$)return;const L=b.isText?b.text||"":b.textBetween(T-v,$-v,void 0,"");Lre(L,a.find,l).forEach(I=>{if(I.index===void 0)return;const z=T+I.index+1,ae=z+I[0].length,U={from:s.tr.mapping.map(z),to:s.tr.mapping.map(ae)},Y=a.handler({state:s,range:U,match:I,commands:u,chain:m,can:p,pasteEvent:l,dropEvent:d});x.push(Y)})}),x.every(b=>b!==null)}var ix=null,Bre=t=>{var e;const s=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=s.clipboardData)==null||e.setData("text/html",t),s};function zre(t){const{editor:e,rules:s}=t;let r=null,i=!1,a=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,d;try{d=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{d=null}const u=({state:p,from:x,to:g,rule:b,pasteEvt:v})=>{const k=p.tr,N=Db({state:p,transaction:k});if(!(!$re({editor:e,state:N,from:Math.max(x-1,0),to:g.b-1,rule:b,pasteEvent:v,dropEvent:d})||!k.steps.length)){try{d=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{d=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,k}};return s.map(p=>new ws({view(x){const g=v=>{var k;r=(k=x.dom.parentElement)!=null&&k.contains(v.target)?x.dom.parentElement:null,r&&(ix=e)},b=()=>{ix&&(ix=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(x,g)=>{if(a=r===x.dom.parentElement,d=g,!a){const b=ix;b?.isEditable&&setTimeout(()=>{const v=b.state.selection;v&&b.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(x,g)=>{var b;const v=(b=g.clipboardData)==null?void 0:b.getData("text/html");return l=g,i=!!v?.includes("data-pm-slice"),!1}}},appendTransaction:(x,g,b)=>{const v=x[0],k=v.getMeta("uiEvent")==="paste"&&!i,N=v.getMeta("uiEvent")==="drop"&&!a,S=v.getMeta("applyPasteRules"),A=!!S;if(!k&&!N&&!A)return;if(A){let{text:T}=S;typeof T=="string"?T=T:T=JN(Ne.from(T),b.schema);const{from:$}=S,L=$+T.length,M=Bre(T);return u({rule:p,state:b,from:$,to:{b:L},pasteEvt:M})}const E=g.doc.content.findDiffStart(b.doc.content),_=g.doc.content.findDiffEnd(b.doc.content);if(!(!Pre(E)||!_||E===_.b))return u({rule:p,state:b,from:E,to:_,pasteEvt:l})}}))}var zb=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=m6(t),this.schema=Qne(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const s={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vh(e.name,this.schema)},r=Qe(e,"addCommands",s);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return cm([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Vh(r.name,this.schema)},a=[],l=Qe(r,"addKeyboardShortcuts",i);let d={};if(r.type==="mark"&&Qe(r,"exitable",i)&&(d.ArrowRight=()=>td.handleExit({editor:t,mark:r})),l){const g=Object.fromEntries(Object.entries(l()).map(([b,v])=>[b,()=>v({editor:t})]));d={...d,...g}}const u=Xse(d);a.push(u);const m=Qe(r,"addInputRules",i);if(aE(r,t.options.enableInputRules)&&m){const g=m();if(g&&g.length){const b=Rre({editor:t,rules:g}),v=Array.isArray(b)?b:[b];a.push(...v)}}const p=Qe(r,"addPasteRules",i);if(aE(r,t.options.enablePasteRules)&&p){const g=p();if(g&&g.length){const b=zre({editor:t,rules:g});a.push(...b)}}const x=Qe(r,"addProseMirrorPlugins",i);if(x){const g=x();a.push(...g)}return a})}get attributes(){return h6(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Su(this.extensions);return Object.fromEntries(e.filter(s=>!!Qe(s,"addNodeView")).map(s=>{const r=this.attributes.filter(u=>u.type===s.name),i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:t,type:Ws(s.name,this.schema)},a=Qe(s,"addNodeView",i);if(!a)return[];const l=a();if(!l)return[];const d=(u,m,p,x,g)=>{const b=Gm(u,r);return l({node:u,view:m,getPos:p,decorations:x,innerDecorations:g,editor:t,extension:s,HTMLAttributes:b})};return[s.name,d]}))}dispatchTransaction(t){const{editor:e}=this;return cm([...this.extensions].reverse()).reduceRight((r,i)=>{const a={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Vh(i.name,this.schema)},l=Qe(i,"dispatchTransaction",a);return l?d=>{l.call(a,{transaction:d,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return cm([...this.extensions]).reduce((r,i)=>{const a={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Vh(i.name,this.schema)},l=Qe(i,"transformPastedHTML",a);return l?(d,u)=>{const m=r(d,u);return l.call(a,m)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=Su(this.extensions);return Object.fromEntries(e.filter(s=>!!Qe(s,"addMarkView")).map(s=>{const r=this.attributes.filter(d=>d.type===s.name),i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:t,type:xo(s.name,this.schema)},a=Qe(s,"addMarkView",i);if(!a)return[];const l=(d,u,m)=>{const p=Gm(d,r);return a()({mark:d,view:u,inline:m,editor:t,extension:s,HTMLAttributes:p,updateAttributes:x=>{eie(d,t,x)}})};return[s.name,l]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var s;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Vh(e.name,this.schema)};e.type==="mark"&&((s=$t(Qe(e,"keepOnSplit",r)))==null||s)&&this.splittableMarks.push(e.name);const i=Qe(e,"onBeforeCreate",r),a=Qe(e,"onCreate",r),l=Qe(e,"onUpdate",r),d=Qe(e,"onSelectionUpdate",r),u=Qe(e,"onTransaction",r),m=Qe(e,"onFocus",r),p=Qe(e,"onBlur",r),x=Qe(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),a&&this.editor.on("create",a),l&&this.editor.on("update",l),d&&this.editor.on("selectionUpdate",d),u&&this.editor.on("transaction",u),m&&this.editor.on("focus",m),p&&this.editor.on("blur",p),x&&this.editor.on("destroy",x)})}};zb.resolve=m6;zb.sort=cm;zb.flatten=QN;var Vre={};GN(Vre,{ClipboardTextSerializer:()=>k6,Commands:()=>S6,Delete:()=>C6,Drop:()=>T6,Editable:()=>E6,FocusEvents:()=>M6,Keymap:()=>_6,Paste:()=>O6,Tabindex:()=>R6,TextDirection:()=>D6,focusEventsPluginKey:()=>A6});var Os=class N6 extends ZN{constructor(){super(...arguments),this.type="extension"}static create(e={}){const s=typeof e=="function"?e():e;return new N6(s)}configure(e){return super.configure(e)}extend(e){const s=typeof e=="function"?e():e;return super.extend(s)}},k6=Os.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ws({key:new sn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:s}=t,{doc:r,selection:i}=e,{ranges:a}=i,l=Math.min(...a.map(p=>p.$from.pos)),d=Math.max(...a.map(p=>p.$to.pos)),u=f6(s);return p6(r,{from:l,to:d},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),S6=Os.create({name:"commands",addCommands(){return{...n6}}}),C6=Os.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var s,r,i;const a=()=>{var l,d,u,m;if((m=(u=(d=(l=this.editor.options.coreExtensionOptions)==null?void 0:l.delete)==null?void 0:d.filterTransaction)==null?void 0:u.call(d,t))!=null?m:t.getMeta("y-sync$"))return;const p=d6(t.before,[t,...e]);g6(p).forEach(b=>{p.mapping.mapResult(b.oldRange.from).deletedAfter&&p.mapping.mapResult(b.oldRange.to).deletedBefore&&p.before.nodesBetween(b.oldRange.from,b.oldRange.to,(v,k)=>{const N=k+v.nodeSize-2,S=b.oldRange.from<=k&&N<=b.oldRange.to;this.editor.emit("delete",{type:"node",node:v,from:k,to:N,newFrom:p.mapping.map(k),newTo:p.mapping.map(N),deletedRange:b.oldRange,newRange:b.newRange,partial:!S,editor:this.editor,transaction:t,combinedTransform:p})})});const g=p.mapping;p.steps.forEach((b,v)=>{var k,N;if(b instanceof Ci){const S=g.slice(v).map(b.from,-1),A=g.slice(v).map(b.to),E=g.invert().map(S,-1),_=g.invert().map(A),T=S>0?(k=p.doc.nodeAt(S-1))==null?void 0:k.marks.some(L=>L.eq(b.mark)):!1,$=(N=p.doc.nodeAt(A))==null?void 0:N.marks.some(L=>L.eq(b.mark));this.editor.emit("delete",{type:"mark",mark:b.mark,from:b.from,to:b.to,deletedRange:{from:E,to:_},newRange:{from:S,to:A},partial:!!($||T),editor:this.editor,transaction:t,combinedTransform:p})}})};(i=(r=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:r.async)==null||i?setTimeout(a,0):a()}}),T6=Os.create({name:"drop",addProseMirrorPlugins(){return[new ws({key:new sn("tiptapDrop"),props:{handleDrop:(t,e,s,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:s,moved:r})}}})]}}),E6=Os.create({name:"editable",addProseMirrorPlugins(){return[new ws({key:new sn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),A6=new sn("focusEvents"),M6=Os.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ws({key:A6,props:{handleDOMEvents:{focus:(e,s)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:s}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,s)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:s}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),_6=Os.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:d})=>{const{selection:u,doc:m}=d,{empty:p,$anchor:x}=u,{pos:g,parent:b}=x,v=x.parent.isTextblock&&g>0?d.doc.resolve(g-1):x,k=v.parent.type.spec.isolating,N=x.pos-x.parentOffset,S=k&&v.parent.childCount===1?N===x.pos:gt.atStart(m).from===g;return!p||!b.type.isTextblock||b.textContent.length||!S||S&&x.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},a={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Cg()||l6()?a:i},addProseMirrorPlugins(){return[new ws({key:new sn("clearDocument"),appendTransaction:(t,e,s)=>{if(t.some(k=>k.getMeta("composition")))return;const r=t.some(k=>k.docChanged)&&!e.doc.eq(s.doc),i=t.some(k=>k.getMeta("preventClearDocument"));if(!r||i)return;const{empty:a,from:l,to:d}=e.selection,u=gt.atStart(e.doc).from,m=gt.atEnd(e.doc).to;if(a||!(l===u&&d===m)||!$b(s.doc))return;const g=s.tr,b=Db({state:s,transaction:g}),{commands:v}=new Pb({editor:this.editor,state:b});if(v.clearNodes(),!!g.steps.length)return g}})]}}),O6=Os.create({name:"paste",addProseMirrorPlugins(){return[new ws({key:new sn("tiptapPaste"),props:{handlePaste:(t,e,s)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:s})}}})]}}),R6=Os.create({name:"tabindex",addProseMirrorPlugins(){return[new ws({key:new sn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),D6=Os.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Su(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const s=e.getAttribute("dir");return s&&(s==="ltr"||s==="rtl"||s==="auto")?s:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ws({key:new sn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),Fre=class Yh{constructor(e,s,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=s,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let s=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}s=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:s,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),s=this.resolvedPos.doc.resolve(e);return new Yh(s,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Yh(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Yh(e,this.editor)}get children(){const e=[];return this.node.content.forEach((s,r)=>{const i=s.isBlock&&!s.isTextblock,a=s.isAtom&&!s.isText,l=s.isInline,d=this.pos+r+(a?0:1);if(d<0||d>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(d);if(!i&&!l&&u.depth<=this.depth)return;const m=new Yh(u,this.editor,i,i||l?s:null);i&&(m.actualDepth=this.depth+1),e.push(m)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,s={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(s).length>0){const a=i.node.attrs,l=Object.keys(s);for(let d=0;d<l.length;d+=1){const u=l[d];if(a[u]!==s[u])break}}else r=i;i=i.parent}return r}querySelector(e,s={}){return this.querySelectorAll(e,s,!0)[0]||null}querySelectorAll(e,s={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const a=Object.keys(s);return this.children.forEach(l=>{r&&i.length>0||(l.node.type.name===e&&a.every(u=>s[u]===l.node.attrs[u])&&i.push(l),!(r&&i.length>0)&&(i=i.concat(l.querySelectorAll(e,s,r))))}),i}setAttribute(e){const{tr:s}=this.editor.state;s.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(s)}},Ure=`.ProseMirror {
404  position: relative;
405}
406
407.ProseMirror {
408  word-wrap: break-word;
409  white-space: pre-wrap;
410  white-space: break-spaces;
411  -webkit-font-variant-ligatures: none;
412  font-variant-ligatures: none;
413  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
414}
415
416.ProseMirror [contenteditable="false"] {
417  white-space: normal;
418}
419
420.ProseMirror [contenteditable="false"] [contenteditable="true"] {
421  white-space: pre-wrap;
422}
423
424.ProseMirror pre {
425  white-space: pre-wrap;
426}
427
428img.ProseMirror-separator {
429  display: inline !important;
430  border: none !important;
431  margin: 0 !important;
432  width: 0 !important;
433  height: 0 !important;
434}
435
436.ProseMirror-gapcursor {
437  display: none;
438  pointer-events: none;
439  position: absolute;
440  margin: 0;
441}
442
443.ProseMirror-gapcursor:after {
444  content: "";
445  display: block;
446  position: absolute;
447  top: -2px;
448  width: 20px;
449  border-top: 1px solid black;
450  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
451}
452
453@keyframes ProseMirror-cursor-blink {
454  to {
455    visibility: hidden;
456  }
457}
458
459.ProseMirror-hideselection *::selection {
460  background: transparent;
461}
462
463.ProseMirror-hideselection *::-moz-selection {
464  background: transparent;
465}
466
467.ProseMirror-hideselection * {
468  caret-color: transparent;
469}
470
471.ProseMirror-focused .ProseMirror-gapcursor {
472  display: block;
473}`;function Hre(t,e,s){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var qre=class extends _re{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:ore,createMappablePosition:lre},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:a})=>this.options.onDrop(r,i,a)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),s=a6(e,this.options.autofocus);this.editorState=iu.create({doc:e,schema:this.schema,selection:s||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Hre(Ure,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const s=u6(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:s});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let s=e;if([].concat(t).forEach(i=>{const a=typeof i=="string"?`${i}$`:i.key;s=s.filter(l=>!l.key.startsWith(a))}),e.length===s.length)return;const r=this.state.reconfigure({plugins:s});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[E6,k6.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),S6,M6,_6,R6,T6,O6,C6,D6.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new zb(r,this)}createCommandManager(){this.commandManager=new Pb({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=L1(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(s=>s.name!=="collaboration"),this.createExtensionManager()}}),t=L1(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:s}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=s?this.extensionManager.dispatchTransaction(r):r,a=e.transformPastedHTML,l=this.extensionManager.transformPastedHTML(a);this.editorView=new t6(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:l,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const d=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(d),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(m=>{var p;return(p=this.capturedTransaction)==null?void 0:p.step(m)});return}const{state:e,transactions:s}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=s.includes(t),a=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:s.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const l=s.findLast(m=>m.getMeta("focus")||m.getMeta("blur")),d=l?.getMeta("focus"),u=l?.getMeta("blur");d&&this.emit("focus",{editor:this,event:d.event,transaction:l}),u&&this.emit("blur",{editor:this,event:u.event,transaction:l}),!(t.getMeta("preventUpdate")||!s.some(m=>m.docChanged)||a.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:s.slice(1)})}getAttributes(t){return x6(this.state,t)}isActive(t,e){const s=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return rre(this.state,s,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return JN(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
474
475`,textSerializers:s={}}=t||{};return Xne(this.state.doc,{blockSeparator:e,textSerializers:{...f6(this.schema),...s}})}get isEmpty(){return $b(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var s;return((s=this.$doc)==null?void 0:s.querySelector(t,e))||null}$nodes(t,e){var s;return((s=this.$doc)==null?void 0:s.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new Fre(e,this)}get $doc(){return this.$pos(0)}};function Cu(t){return new Bb({find:t.find,handler:({state:e,range:s,match:r})=>{const i=$t(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:a}=e,l=r[r.length-1],d=r[0];if(l){const u=d.search(/\S/),m=s.from+d.indexOf(l),p=m+l.length;if(XN(s.from,s.to,e.doc).filter(b=>b.mark.type.excluded.find(k=>k===t.type&&k!==b.mark.type)).filter(b=>b.to>m).length)return null;p<s.to&&a.delete(p,s.to),m>s.from&&a.delete(s.from+u,m);const g=s.from+u+l.length;a.addMark(s.from+u,g,t.type.create(i||{})),a.removeStoredMark(t.type)}},undoable:t.undoable})}function Wre(t){return new Bb({find:t.find,handler:({state:e,range:s,match:r})=>{const i=$t(t.getAttributes,void 0,r)||{},{tr:a}=e,l=s.from;let d=s.to;const u=t.type.create(i);if(r[1]){const m=r[0].lastIndexOf(r[1]);let p=l+m;p>d?p=d:d=p+r[1].length;const x=r[0][r[0].length-1];a.insertText(x,l+r[0].length-1),a.replaceWith(p,d,u)}else if(r[0]){const m=t.type.isInline?l:l-1;a.insert(m,t.type.create(i)).delete(a.mapping.map(l),a.mapping.map(d))}a.scrollIntoView()},undoable:t.undoable})}function B1(t){return new Bb({find:t.find,handler:({state:e,range:s,match:r})=>{const i=e.doc.resolve(s.from),a=$t(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(s.from,s.to).setBlockType(s.from,s.from,t.type,a)},undoable:t.undoable})}function Tu(t){return new Bb({find:t.find,handler:({state:e,range:s,match:r,chain:i})=>{const a=$t(t.getAttributes,void 0,r)||{},l=e.tr.delete(s.from,s.to),u=l.doc.resolve(s.from).blockRange(),m=u&&_N(u,t.type,a);if(!m)return null;if(l.wrap(u,m),t.keepMarks&&t.editor){const{selection:x,storedMarks:g}=e,{splittableMarks:b}=t.editor.extensionManager,v=g||x.$to.parentOffset&&x.$from.marks();if(v){const k=v.filter(N=>b.includes(N.type.name));l.ensureMarks(k)}}if(t.keepAttributes){const x=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(x,a).run()}const p=l.doc.resolve(s.from-1).nodeBefore;p&&p.type===t.type&&Rl(l.doc,s.from-1)&&(!t.joinPredicate||t.joinPredicate(r,p))&&l.join(s.from-1)},undoable:t.undoable})}function Gre(t,e){const{selection:s}=t,{$from:r}=s;if(s instanceof Xe){const a=r.index();return r.parent.canReplaceWith(a,a+1,e)}let i=r.depth;for(;i>=0;){const a=r.index(i);if(r.node(i).contentMatchAt(a).matchType(e))return!0;i-=1}return!1}var Kre={};GN(Kre,{createAtomBlockMarkdownSpec:()=>Yre,createBlockMarkdownSpec:()=>Qre,createInlineMarkdownSpec:()=>Zre,parseAttributes:()=>ek,parseIndentedBlocks:()=>z1,renderNestedMarkdownContent:()=>sk,serializeAttributes:()=>tk});function ek(t){if(!t?.trim())return{};const e={},s=[],r=t.replace(/["']([^"']*)["']/g,m=>(s.push(m),`__QUOTED_${s.length-1}
475__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const m=i.map(p=>p.trim().slice(1));e.class=m.join(" ")}const a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(e.id=a[1]);const l=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(l)).forEach(([,m,p])=>{var x;const g=parseInt(((x=p.match(/__QUOTED_(\d+)__/))==null?void 0:x[1])||"0",10),b=s[g];b&&(e[m]=b.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(p=>{p.match(/^[a-zA-Z][\w-]*$/)&&(e[p]=!0)}),e}function tk(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([s,r])=>{s==="class"||s==="id"||(r===!0?e.push(s):r!==!1&&r!=null&&e.push(`${s}="${String(r)}"`))}),e.join(" ")}function Yre(t){const{nodeName:e,name:s,parseAttributes:r=ek,serializeAttributes:i=tk,defaultAttributes:a={},requiredAttributes:l=[],allowedAttributes:d}=t,u=s||e,m=p=>{if(!d)return p;const x={};return d.forEach(g=>{g in p&&(x[g]=p[g])}),x};return{parseMarkdown:(p,x)=>{const g={...a,...p.attributes};return x.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(p){var x;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),b=(x=p.match(g))==null?void 0:x.index;return b!==void 0?b:-1},tokenize(p,x,g){const b=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),v=p.match(b);if(!v)return;const k=v[1]||"",N=r(k);if(!l.find(A=>!(A in N)))return{type:e,raw:v[0],attributes:N}}},renderMarkdown:p=>{const x=m(p.attrs||{}),g=i(x),b=g?` {${g}}`:"";return`:::${u}${b} :::`}}}function Qre(t){const{nodeName:e,name:s,getContent:r,parseAttributes:i=ek,serializeAttributes:a=tk,defaultAttributes:l={},content:d="block",allowedAttributes:u}=t,m=s||e,p=x=>
vendor: 4,311 bytes, lines 475-491
475{if(!u)return x;const g={};return u.forEach(b=>{b in x&&(g[b]=x[b])}),g};return{parseMarkdown:(x,g)=>{let b;if(r){const k=r(x);b=typeof k=="string"?[{type:"text",text:k}]:k}else d==="block"?b=g.parseChildren(x.tokens||[]):b=g.parseInline(x.tokens||[]);const v={...l,...x.attributes};return g.createNode(e,v,b)},markdownTokenizer:{name:e,level:"block",start(x){var g;const b=new RegExp(`^:::${m}`,"m"),v=(g=x.match(b))==null?void 0:g.index;return v!==void 0?v:-1},tokenize(x,g,b){var v;const k=new RegExp(`^:::${m}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),N=x.match(k);if(!N)return;const[S,A=""]=N,E=i(A);let _=1;const T=S.length;let $="";const L=/^:::([\w-]*)(\s.*)?/gm,M=x.slice(T);for(L.lastIndex=0;;){const I=L.exec(M);if(I===null)break;const z=I.index,ae=I[1];if(!((v=I[2])!=null&&v.endsWith(":::"))){if(ae)_+=1;else if(_-=1,_===0){const U=M.slice(0,z);$=U.trim();const Y=x.slice(0,T+z+I[0].length);let P=[];if($)if(d==="block")for(P=b.blockTokens(U),P.forEach(ne=>{ne.text&&(!ne.tokens||ne.tokens.length===0)&&(ne.tokens=b.inlineTokens(ne.text))});P.length>0;){const ne=P[P.length-1];if(ne.type==="paragraph"&&(!ne.text||ne.text.trim()===""))P.pop();else break}else P=b.inlineTokens($);return{type:e,raw:Y,attributes:E,content:$,tokens:P}}}}}},renderMarkdown:(x,g)=>{const b=p(x.attrs||{}),v=a(b),k=v?` {${v}}`:"",N=g.renderChildren(x.content||[],`
476
477`);return`:::${m}${k}
478
479${N}
480
481:::`}}}function Jre(t){if(!t.trim())return{};const e={},s=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=s.exec(t);for(;r!==null;){const[,i,a,l]=r;e[i]=a||l,r=s.exec(t)}return e}function Xre(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,s])=>`${e}="${s}"`).join(" ")}function Zre(t){const{nodeName:e,name:s,getContent:r,parseAttributes:i=Jre,serializeAttributes:a=Xre,defaultAttributes:l={},selfClosing:d=!1,allowedAttributes:u}=t,m=s||e,p=g=>{if(!u)return g;const b={};return u.forEach(v=>{const k=typeof v=="string"?v:v.name,N=typeof v=="string"?void 0:v.skipIfDefault;if(k in g){const S=g[k];if(N!==void 0&&S===N)return;b[k]=S}}),b},x=m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,b)=>{const v={...l,...g.attributes};if(d)return b.createNode(e,v);const k=r?r(g):g.content||"";return k?b.createNode(e,v,[b.createTextNode(k)]):b.createNode(e,v,[])},markdownTokenizer:{name:e,level:"inline",start(g){const b=d?new RegExp(`\\[${x}\\s*[^\\]]*\\]`):new RegExp(`\\[${x}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${x}\\]`),v=g.match(b),k=v?.index;return k!==void 0?k:-1},tokenize(g,b,v){const k=d?new RegExp(`^\\[${x}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${x}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${x}\\]`),N=g.match(k);if(!N)return;let S="",A="";if(d){const[,_]=N;A=_}else{const[,_,T]=N;A=_,S=T||""}const E=i(A.trim());return{type:e,raw:N[0],content:S.trim(),attributes:E}}},renderMarkdown:g=>{let b="";r?b=r(g):g.content&&g.content.length>0&&(b=g.content.filter(S=>S.type==="text").map(S=>S.text).join(""));const v=p(g.attrs||{}),k=a(v),N=k?` ${k}`:"";return d?`[${m}${N}]`:`[${m}${N}]${b}[/${m}]`}}}function z1(t,e,s){var r,i,a,l;const d=t.split(`
482`),u=[];let m="",p=0;const x=e.baseIndentSize||2;for(;p<d.length;){const g=d[p],b=g.match(e.itemPattern);if(!b){if(u.length>0)break;if(g.trim()===""){p+=1,m=`${m}${g}
483`;continue}else return}const v=e.extractItemData(b),{indentLevel:k,mainContent:N}=v;m=`${m}${g}
484`;const S=[N];for(p+=1;p<d.length;){const T=d[p];if(T.trim()===""){const L=d.slice(p+1).findIndex(z=>z.trim()!=="");if(L===-1)break;if((((i=(r=d[p+1+L].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>k){S.push(T),m=`${m}${T}
485`,p+=1;continue}else break}if((((l=(a=T.match(/^(\s*)/))==null?void 0:a[1])==null?void 0:l.length)||0)>k)S.push(T),m=`${m}${T}
486`,p+=1;else break}let A;const E=S.slice(1);if(E.length>0){const T=E.map($=>$.slice(k+x)).join(`
487`);T.trim()&&(e.customNestedParser?A=e.customNestedParser(T):A=s.blockTokens(T))}const _=e.createToken(v,A);u.push(_)}if(u.length!==0)return{items:u,raw:m}}function sk(t,e,s,r){if(!t||!Array.isArray(t.content))return"";const i=typeof s=="function"?s(r):s,[a,...l]=t.content,d=e.renderChildren([a]);let u=`${i}${d}`;return l&&l.length>0&&l.forEach((m,p)=>{var x,g;const b=(g=(x=e.renderChild)==null?void 0:x.call(e,m,p+1))!=null?g:e.renderChildren([m]);if(b!=null){const v=b.split(`
488`).map(k=>k?e.indent(k):e.indent("")).join(`
489`);u+=m.type==="paragraph"?`
490
491${v}
491`:`
492${v}`}}),u}function eie(t,e,s={}){const{state:r}=e,{doc:i,tr:a}=r,l=t;i.descendants((d,u)=>{const m=a.mapping.map(u),p=a.mapping.map(u)+d.nodeSize;let x=null;if(d.marks.forEach(b=>{if(b!==l)return!1;x=b}),!x)return;let g=!1;if(Object.keys(s).forEach(b=>{s[b]!==x.attrs[b]&&(g=!0)}),g){const b=t.type.create({...t.attrs,...s});a.removeMark(m,p,t.type),a.addMark(m,p,b)}}),a.docChanged&&e.view.dispatch(a)}var Lr=class P6 extends ZN{constructor(){super(...arguments),this.type="node"}static create(e={}){const s=typeof e=="function"?e():e;return new P6(s)}configure(e){return super.configure(e)}extend(e){const s=typeof e=="function"?e():e;return super.extend(s)}};function Yc(t){return new Ire({find:t.find,handler:({state:e,range:s,match:r,pasteEvent:i})=>{const a=$t(t.getAttributes,void 0,r,i);if(a===!1||a===null)return null;const{tr:l}=e,d=r[r.length-1],u=r[0];let m=s.to;if(d){const p=u.search(/\S/),x=s.from+u.indexOf(d),g=x+d.length;if(XN(s.from,s.to,e.doc).filter(k=>k.mark.type.excluded.find(S=>S===t.type&&S!==k.mark.type)).filter(k=>k.to>x).length)return null;g<s.to&&l.delete(g,s.to),x>s.from&&l.delete(s.from+p,x),m=s.from+p+d.length,l.addMark(s.from+p,m,t.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||l.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:tie,getOwnPropertySymbols:sie}=Object,{hasOwnProperty:nie}=Object.prototype;function sw(t,e){return function(r,i,a){return t(r,i,a)&&e(r,i,a)}}function ax(t){return function(s,r,i){if(!s||!r||typeof s!="object"||typeof r!="object")return t(s,r,i);const{cache:a}=i,l=a.get(s),d=a.get(r);if(l&&d)return l===r&&d===s;a.set(s,r),a.set(r,s);const u=t(s,r,i);return a.delete(s),a.delete(r),u}}function rie(t){return t?.[Symbol.toStringTag]}function lE(t){return tie(t).concat(sie(t))}const iie=Object.hasOwn||((t,e)=>nie.call(t,e));function sd(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const aie="__v",oie="__o",lie="_owner",{getOwnPropertyDescriptor:cE,keys:dE}=Object;function cie(t,e){return t.byteLength===e.byteLength&&Tg(new Uint8Array(t),new Uint8Array(e))}function die(t,e,s){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!s.equals(t[r],e[r],r,r,t,e,s))return!1;return!0}function uie(t,e){return t.byteLength===e.byteLength&&Tg(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function hie(t,e){return sd(t.getTime(),e.getTime())}function mie(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function pie(t,e){return t===e}function uE(t,e,s){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),a=t.entries();let l,d,u=0;for(;(l=a.next())&&!l.done;){const m=e.entries();let p=!1,x=0;for(;(d=m.next())&&!d.done;){if(i[x]){x++;continue}const g=l.value,b=d.value;if(s.equals(g[0],b[0],u,x,t,e,s)&&s.equals(g[1],b[1],g[0],b[0],t,e,s)){p=i[x]=!0;break}x++}if(!p)return!1;u++}return!0}const fie=sd;function xie(t,e,s){const r=dE(t);let i=r.length;if(dE(e).length!==i)return!1;for(;i-- >0;)if(!I6(t,e,s,r[i]))return!1;return!0}function Fh(t,e,s){const r=lE(t);let i=r.length;if(lE(e).length!==i)return!1;let a,l,d;for(;i-- >0;)if(a=r[i],!I6(t,e,s,a)||(l=cE(t,a),d=cE(e,a),(l||d)&&(!l||!d||l.configurable!==d.configurable||l.enumerable!==d.enumerable||l.writable!==d.writable)))return!1;return!0}function gie(t,e){return sd(t.valueOf(),e.valueOf())}function bie(t,e){return t.source===e.source&&t.flags===e.flags}function hE(t,e,s){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),a=t.values();let l,d;for(;(l=a.next())&&!l.done;){const u=e.values();let m=!1,p=0;for(;(d=u.next())&&!d.done;){if(!i[p]&&s.equals(l.value,d.value,l.value,d.value,t,e,s)){m=i[p]=!0;break}p++}if(!m)return!1}return!0}function Tg(t,e){let s=t.byteLength;if(e.byteLength!==s||t.byteOffset!==e.byteOffset)return!1;for(;s-- >0;)if(t[s]!==e[s])return!1;return!0}function yie(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function I6(t,e,s,r){return(r===lie||r===oie||r===aie)&&(t.$$typeof||e.$$typeof)?!0:iie(e,r)&&s.equals(t[r],e[r],r,r,t,e,s)}const vie="[object ArrayBuffer]",wie="[object Arguments]",jie="[object Boolean]",Nie="[object DataView]",kie="[object Date]",Sie="[object Error]",Cie="[object Map]",Tie="[object Number]",Eie="[object Object]",Aie="[object RegExp]",Mie="[object Set]",_ie="[object String]",Oie={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array
492]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Rie="[object URL]",Die=Object.prototype.toString;function Pie({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:s,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:l,areNumbersEqual:d,areObjectsEqual:u,arePrimitiveWrappersEqual:m,areRegExpsEqual:p,areSetsEqual:x,areTypedArraysEqual:g,areUrlsEqual:b,unknownTagComparators:v}){return function(N,S,A){if(N===S)return!0;if(N==null||S==null)return!1;const E=typeof N;if(E!==typeof S)return!1;if(E!=="object")return E==="number"?d(N,S,A):E==="function"?a(N,S,A):!1;const _=N.constructor;if(_!==S.constructor)return!1;if(_===Object)return u(N,S,A);if(Array.isArray(N))return e(N,S,A);if(_===Date)return r(N,S,A);if(_===RegExp)return p(N,S,A);if(_===Map)return l(N,S,A);if(_===Set)return x(N,S,A);const T=Die.call(N);if(T===kie)return r(N,S,A);if(T===Aie)return p(N,S,A);if(T===Cie)return l(N,S,A);if(T===Mie)return x(N,S,A);if(T===Eie)return typeof N.then!="function"&&typeof S.then!="function"&&u(N,S,A);if(T===Rie)return b(N,S,A);if(T===Sie)return i(N,S,A);if(T===wie)return u(N,S,A);if(Oie[T])return g(N,S,A);if(T===vie)return t(N,S,A);if(T===Nie)return s(N,S,A);if(T===jie||T===Tie||T===_ie)return m(N,S,A);if(v){let $=v[T];if(!$){const L=rie(N);L&&($=v[L])}if($)return $(N,S,A)}return!1}}function Iie({circular:t,createCustomConfig:e,strict:s}){let r={areArrayBuffersEqual:cie,areArraysEqual:s?Fh:die,areDataViewsEqual:uie,areDatesEqual:hie,areErrorsEqual:mie,areFunctionsEqual:pie,areMapsEqual:s?sw(uE,Fh):uE,areNumbersEqual:fie,areObjectsEqual:s?Fh:xie,arePrimitiveWrappersEqual:gie,areRegExpsEqual:bie,areSetsEqual:s?sw(hE,Fh):hE,areTypedArraysEqual:s?sw(Tg,Fh):Tg,areUrlsEqual:yie,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=ax(r.areArraysEqual),a=ax(r.areMapsEqual),l=ax(r.areObjectsEqual),d=ax(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:l,areSetsEqual:d})}return r}function Lie(t){return function(e,s,r,i,a,l,d){return t(e,s,d)}}function $ie({circular:t,comparator:e,createState:s,equals:r,strict:i}){if(s)return function(d,u){const{cache:m=t?new WeakMap:void 0,meta:p}=s();return e(d,u,{cache:m,equals:r,meta:p,strict:i})};if(t)return function(d,u){return e(d,u,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const a={cache:void 0,equals:r,meta:void 0,strict:i};return function(d,u){return e(d,u,a)}}const Bie=Pl();Pl({strict:!0});Pl({circular:!0});Pl({circular:!0,strict:!0});Pl({createInternalComparator:()=>sd});Pl({strict:!0,createInternalComparator:()=>sd});Pl({circular:!0,createInternalComparator:()=>sd});Pl({circular:!0,createInternalComparator:()=>sd,strict:!0});function Pl(t={}){const{circular:e=!1,createInternalComparator:s,createState:r,strict:i=!1}=t,a=Iie(t),l=Pie(a),d=s?s(l):Lie(l);return $ie({circular:e,comparator:l,createState:r,equals:d,strict:i})}var nw={exports:{}},rw={};var mE;function zie(){if(mE)return rw;mE=1;var t=Qm(),e=BE();function s(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}var r=typeof Object.is=="function"?Object.is:s,i=e.useSyncExternalStore,a=t.useRef,l=t.useEffect,d=t.useMemo,u=t.useDebugValue;return rw.useSyncExternalStoreWithSelector=function(m,p,x,g,b){var v=a(null);if(v.current===null){var k={hasValue:!1,value:null};v.current=k}else k=v.current;v=d(function(){function S($){if(!A){if(A=!0,E=$,$=g($),b!==void 0&&k.hasValue){var L=k.value;if(b(L,$))return _=L}return _=$}if(L=_,r(E,$))return L;var M=g($);return b!==void 0&&b(L,M)?(E=$,L):(E=$,_=M)}var A=!1,E,_,T=x===void 0?null:x;return[function(){return S(p())},T===null?void 0:function(){return S(T())}]},[p,x,g,b]);var N=i(m,v[0],v[1]);return l(function(){k.hasValue=!0,k.value=N},[N]),u(N),N},rw}var pE;function Vie(){return pE||(pE=1,nw.exports=zie()),nw.exports}var Fie=Vie(),Uie=(...t)=>e=>{t.forEach(s=>{typeof s=="function"?s(e):s&&(s.current=e)})},Hie=({contentComponent:t})=>{const e=Z1.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return n.jsx(n.Fragment,{children:Object.values(e)})};function qie(){const t=new Set;let e={};return{subscribe(s){return t.add(s),()=>{t.delete(s)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(s,r){e={...e,[s]:iA.createPortal(r.reactElement,r.element,s)},t.forEach(i=>
492i())},removeRenderer(s){const r={...e};delete r[s],e=r,t.forEach(i=>i())}}}var Wie=class extends Kn.Component{constructor(t){super(t),this.editorContentRef=Kn.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const s=this.editorContentRef.current;s.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:s}),e.contentComponent=qie(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var t;const e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const s=document.createElement("div");s.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:s})}catch{}}}render(){const{editor:t,innerRef:e,...s}=this.props;return n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:Uie(e,this.editorContentRef),...s}),t?.contentComponent&&n.jsx(Hie,{contentComponent:t.contentComponent})]})}},Gie=j.forwardRef((t,e)=>{const s=Kn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Kn.createElement(Wie,{key:s,innerRef:e,...t})}),L6=Kn.memo(Gie),Kie=typeof window<"u"?j.useLayoutEffect:j.useEffect,Yie=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},s=this.editor;return s.on("transaction",e),()=>{s.off("transaction",e)}}}};function Qie(t){var e;const[s]=j.useState(()=>new Yie(t.editor)),r=Fie.useSyncExternalStoreWithSelector(s.subscribe,s.getSnapshot,s.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:Bie);return Kie(()=>s.watch(t.editor),[t.editor,s]),j.useDebugValue(r),r}var Jie=!1,V1=typeof window>"u",Xie=V1||!!(typeof window<"u"&&window.next),Zie=class $6{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(s=>s())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?V1||Xie?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onBeforeCreate)==null?void 0:a.call(i,...r)},onBlur:(...r)=>{var i,a;return(a=(i=this.options.current).onBlur)==null?void 0:a.call(i,...r)},onCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onCreate)==null?void 0:a.call(i,...r)},onDestroy:(...r)=>{var i,a;return(a=(i=this.options.current).onDestroy)==null?void 0:a.call(i,...r)},onFocus:(...r)=>{var i,a;return(a=(i=this.options.current).onFocus)==null?void 0:a.call(i,...r)},onSelectionUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onSelectionUpdate)==null?void 0:a.call(i,...r)},onTransaction:(...r)=>{var i,a;return(a=(i=this.options.current).onTransaction)==null?void 0:a.call(i,...r)}
492,onUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onUpdate)==null?void 0:a.call(i,...r)},onContentError:(...r)=>{var i,a;return(a=(i=this.options.current).onContentError)==null?void 0:a.call(i,...r)},onDrop:(...r)=>{var i,a;return(a=(i=this.options.current).onDrop)==null?void 0:a.call(i,...r)},onPaste:(...r)=>{var i,a;return(a=(i=this.options.current).onPaste)==null?void 0:a.call(i,...r)},onDelete:(...r)=>{var i,a;return(a=(i=this.options.current).onDelete)==null?void 0:a.call(i,...r)}};return new qre(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,s){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&s.extensions?e.extensions.length!==s.extensions.length?!1:e.extensions.every((i,a)=>{var l;return i===((l=s.extensions)==null?void 0:l[a])}):e[r]===s[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?$6.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,s=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){s&&s.setOptions(this.options.current);return}s&&!s.isDestroyed&&(s.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function eae(t={},e=[]){const s=j.useRef(t);s.current=t;const[r]=j.useState(()=>new Zie(s)),i=Z1.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return j.useDebugValue(i),j.useEffect(r.onRender(e)),Qie({editor:i,selector:({transactionNumber:a})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&a===0?0:a+1}),i}var B6=j.createContext({editor:null});B6.Consumer;var tae=j.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),sae=()=>j.useContext(tae);Kn.forwardRef((t,e)=>{const{onDragStart:s}=sae(),r=t.as||"div";return n.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:s,style:{whiteSpace:"normal",...t.style}})});Kn.createContext({markViewContentRef:()=>{}});var nk=j.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});nk.displayName="TiptapContext";var nae=()=>j.useContext(nk);function z6({editor:t,instance:e,children:s}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=j.useMemo(()=>({editor:r}),[r]),a=j.useMemo(()=>({editor:r}),[r]);return n.jsx(B6.Provider,{value:a,children:n.jsx(nk.Provider,{value:i,children:s})})}z6.displayName="Tiptap";function V6({...t}){const{editor:e}=nae();return n.jsx(L6,{editor:e,...t})}V6.displayName="Tiptap.Content";Object.assign(z6,{Content:V6});var Eg=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:s,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,s]},rae=/^\s*>\s$/,iae=Lr.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Eg("blockquote",{...Gs(this.options.HTMLAttributes,t),children:Eg("slot",{})})},parseMarkdown:(t,e)=>{var s;const r=(s=e.parseBlockChildren)!=null?s:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const s=">",r=[];return t.content.forEach((i,a)=>{var l,d;const p=((d=(l=e.renderChild)==null?void 0:l.call(e,i,a))!=null?d:e.renderChildren([i])).split(`
493`).map(x=>x.trim()===""?s:`${s} ${x}`);r.push(p.join(`
494`))}),r.join(`
495${s}
496`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}}
vendor: 10,306 bytes, lines 496-517
496,addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Tu({find:rae,type:this.type})]}}),aae=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,oae=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,lae=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,cae=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,dae=td.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Eg("strong",{...Gs(this.options.HTMLAttributes,t),children:Eg("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Cu({find:aae,type:this.type}),Cu({find:lae,type:this.type})]},addPasteRules(){return[Yc({find:oae,type:this.type}),Yc({find:cae,type:this.type})]}}),uae=/(^|[^`])`([^`]+)`(?!`)$/,hae=/(^|[^`])`([^`]+)`(?!`)/g,mae=td.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Gs(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Cu({find:uae,type:this.type})]},addPasteRules(){return[Yc({find:hae,type:this.type})]}}),iw=4,pae=/^```([a-z]+)?[\s\n]$/,fae=/^~~~([a-z]+)?[\s\n]$/,xae=Lr.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:iw,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:s}=this.options;if(!s)return null;const a=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(l=>l.startsWith(s)).map(l=>l.replace(s,""))[0];return a||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Gs(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var s,r;return((s=t.raw)==null?void 0:s.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var s;let r="";const i=((s=t.attrs)==null?void 0:s.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
497`):r=`\`\`\`${i}
498
499\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,s=e.pos===1;return!t||e.parent.type.name!==this.name?!1:s||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const s=(e=this.options.tabSize)!=null?e:iw,{state:r}=t,{selection:i}=r,{$from:a,empty:l}=i;if(a.parent.type!==this.type)return!1;const d=" ".repeat(s);return l?t.commands.insertContent(d):t.commands.command(({tr:u})=>{const{from:m,to:p}=i,b=r.doc.textBetween(m,p,`
500`,`
501`).split(`
502`).map(v=>d+v).join(`
503`);return u.replaceWith(m,p,r.schema.text(b)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const s=(e=this.options.tabSize)!=null?e:iw,{state:r}=t,{selection:i}=r,{$from:a,empty:l}=i;return a.parent.type!==this.type?!1:l?t.commands.command(({tr:d})=>{var u;const{pos:m}=a,p=a.start(),x=a.end(),b=r.doc.textBetween(p,x,`
504`,`
505`).split(`
506`);let v=0,k=0;const N=m-p;for(let $=0;$<b.length;$+=1){if(k+b[$].length>=N){v=$;break}k+=b[$].length+1}const A=((u=b[v].match(/^ */))==null?void 0:u[0])||"",E=Math.min(A.length,s);if(E===0)return!0;let _=p;for(let $=0;$<v;$+=1)_+=b[$].length+1;return d.delete(_,_+E),m-_<=E&&d.setSelection(it.create(d.doc,_)),!0}):t.commands.command(({tr:d})=>{const{from:u,to:m}=i,g=r.doc.textBetween(u,m,`
507`,`
508`).split(`
509`).map(b=>{var v;const k=((v=b.match(/^ */))==null?void 0:v[0])||"",N=Math.min(k.length,s);return b.slice(N)}).join(`
510`);return d.replaceWith(u,m,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:s}=e,{$from:r,empty:i}=s;if(!i||r.parent.type!==this.type)return!1;const a=r.parentOffset===r.parent.nodeSize-2,l=r.parent.textContent.endsWith(`
511
512`);return!a||!l?!1:t.chain().command(({tr:d})=>(d.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:s,doc:r}=e,{$from:i,empty:a}=s;if(!a||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const d=i.after();return d===void 0?!1:r.nodeAt(d)?t.commands.command(({tr:m})=>(m.setSelection(gt.near(r.resolve(d))),!0)):t.commands.exitCode()}}},addInputRules(){return[B1({find:pae,type:this.type,getAttributes:t=>({language:t[1]})}),B1({find:fae,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new ws({key:new sn("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const s=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,a=i?.mode;if(!s||!a)return!1;const{tr:l,schema:d}=t.state,u=d.text(s.replace(/\r\n?/g,`
513`));return l.replaceSelectionWith(this.type.create({language:a},u)),l.selection.$from.parent.type!==this.type&&l.setSelection(it.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),gae=Lr.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
514
515`):""}),bae=Lr.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Gs(this.options.HTMLAttributes,t)]},renderText(){return`
516`},renderMarkdown:()=>`  
517`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:s,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:a}=s;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:d}=r.extensionManager,u=a||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:m,dispatch:p})=>{if(p&&u&&l){const x=u.filter(g=>d.includes(g.type.name));m.ensureMarks(x)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),yae=Lr.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Gs(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var s;const r=(s=t.attrs)!=null&&s.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>B1({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),vae=Lr.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Gs(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!Gre(e,e.schema.nodes[this.name]))return!1;const{selection:s}=e,{$to:r}=s,i=t();return b6(s)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:a,tr:l,dispatch:d})=>{if(d){const{$to:u}=l.selection,m=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?l.setSelection(it.create(l.doc,u.pos+1)):u.nodeAfter.isBlock?l.setSelection(Xe.create(l.doc,u.pos)):l.setSelection(it.create(l.doc,u.pos));else{const p=a.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,x=p?.create();x&&(l.insert(m,x),l.setSelection(it.create(l.doc,m+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Wre({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.t
vendor: 4,520 bytes, line 517
517ype})]}}),wae=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,jae=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Nae=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,kae=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Sae=td.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Gs(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Cu({find:wae,type:this.type}),Cu({find:Nae,type:this.type})]},addPasteRules(){return[Yc({find:jae,type:this.type}),Yc({find:kae,type:this.type})]}});const Cae="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
517ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Tae="ελ1υ2бг1ел3дети4ею2католик6ом3мÐ
517ºÐ´2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3Õ°Õ¡Õµ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1ì»´2삼성2한국2",F1="numeric",U1="ascii",H1="alpha",dm="asciinumeric",Qh="alphanumeric",q1="domain",F6="emoji",Eae="scheme",Aae="slashscheme",aw="whitespace";function Mae(t,e){return t in e||(e[t]=[]),e[t]}function Ac(t,e,s){e[F1]&&(e[dm]=!0,e[Qh]=!0),e[U1]&&(e[dm]=!0,e[H1]=!0),e[dm]&&(e[Qh]=!0),e[H1]&&(e[Qh]=!0),e[Qh]&&(e[q1]=!0),e[F6]&&(e[q1]=!0);for(const r in e){const i=Mae(r,s);i.indexOf(t)<0&&i.push(t)}}function _ae(t,e){const s={};for(const r in e)e[r].indexOf(t)>=0&&(s[r]=!0);return s}function hr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}hr.groups={};hr.prototype={accepts(){return!!this.t},go(t){const e=this,s=e.j[t];if(s)return s;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],a=e.jr[r][1];if(a&&i.test(t))return a}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,s,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,s,r)},tr(t,e,s,r){r=r||hr.groups;let i;return e&&e.j?i=e:(i=new hr(e),s&&r&&Ac(e,s,r)),this.jr.push([t,i]),i},ts(t,e,s,r){let i=this;const a=t.length;if(!a)return i;for(let l=0;l<a-1;l++)i=i.tt(t[l]);return i.tt(t[a-1],e,s,r)},tt(t,e,s,r){r=r||hr.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const a=e;let l,d=i.go(t);if(d?(l=new hr,Object.assign(l.j,d.j),l.jr.push.apply(l.jr,d.jr),l.jd=d.jd,l.t=d.t):l=new hr,a){if(r)if(l.t&&typeof l.t=="string"){const u=Object.assign(_ae(l.t,r),s);Ac(a,u,r)}else s&&Ac(a,s,r);l.t=a}return i.j[t]=l,l}};const xt=(t,e,s,r,i)=>t.ta(e,s,r,i),Ss=(t,e,s,r,i)=>t.tr(e,s,r,i),fE=(t,e,s,r,i)=>t.ts(e,s,r,i),Te=(t,e,s,r,i)=>t.tt(e,s,r,i),Ja="WORD",W1="UWORD",U6="ASCIINUMERICAL",H6="ALPHANUMERICAL",Km="LOCALHOST",G1="TLD",K1="UTLD",_x="SCHEME",Xd="SLASH_SCHEME",rk="NUM",Y1="WS",ik="NL",um="OPENBRACE",hm="CLOSEBRACE",Ag="OPENBRACKET",Mg="CLOSEBRACKET",_g="OPENPAREN",Og="CLOSEPAREN",Rg="OPENANGLEBRACKET",Dg="CLOSEANGLEBRACKET",Pg="FULLWIDTHLEFTPAREN",Ig="FULLWIDTHRIGHTPAREN",Lg="LEFTCORNERBRACKET",$g="RIGHTCORNERBRACKET",Bg="LEFTWHITECORNERBRACKET",zg="RIGHTWHITECORNERBRACKET",Vg="FULLWIDTHLESSTHAN",Fg="FULLWIDTHGREATERTHAN",Ug="AMPERSAND",Hg="APOSTROPHE",qg="ASTERISK",el="AT",Wg="BACKSLASH",Gg="BACKTICK",Kg="CARET",nl="COLON",ak="COMMA",Yg="DOLLAR",Ji="DOT",Qg="EQUALS",ok="EXCLAMATION",ei="HYPHEN",mm="PERCENT",Jg="PIPE",Xg="PLUS",Zg="POUND",pm="QUERY",lk="QUOTE",q6="FULLWIDTHMIDDLEDOT",ck="SEMI",Xi="SLASH",fm="TILDE",eb="UNDERSCORE",W6="EMOJI",tb="SYM";var G6=Object.freeze({__proto__:null,ALPHANUMERICAL:H6,AMPERSAND:Ug,APOSTROPHE:Hg,ASCIINUMERICAL:U6,ASTERISK:qg,AT:el,BACKSLASH:Wg,BACKTICK:Gg,CARET:Kg,CLOSEANGLEBRACKET:Dg,CLOSEBRACE:hm,CLOSEBRACKET:Mg,CLOSEPAREN:Og,COLON:nl,COMMA:ak,DOLLAR:Yg,DOT:Ji,EMOJI:W6,EQUALS:Qg,EXCLAMATION:ok,FULLWIDTHGREATERTHAN:Fg,FULLWIDTHLEFTPAREN:Pg,FULLWIDTHLESSTHAN:Vg,FULLWIDTHMIDDLEDOT:q6,FULLWIDTHRIGHTPAREN:Ig,HYPHEN:ei,LEFTCORNERBRACKET:Lg,LEFTWHITECORNERBRACKET:Bg,LOCALHOST:Km,NL:ik,NUM:rk,OPENANGLEBRACKET:Rg,OPENBRACE:um,OPENBRACKET:Ag,OPENPAREN:_g,PERCENT:mm,PIPE:Jg,P
vendor: 9,353 bytes, lines 517-521
517LUS:Xg,POUND:Zg,QUERY:pm,QUOTE:lk,RIGHTCORNERBRACKET:$g,RIGHTWHITECORNERBRACKET:zg,SCHEME:_x,SEMI:ck,SLASH:Xi,SLASH_SCHEME:Xd,SYM:tb,TILDE:fm,TLD:G1,UNDERSCORE:eb,UTLD:K1,UWORD:W1,WORD:Ja,WS:Y1});const Ka=/[a-z]/,Uh=new RegExp("\\p{L}","u"),ow=new RegExp("\\p{Emoji}","u"),Ya=/\d/,lw=/\s/,xE="\r",cw=`
518`,Oae="️",Rae="‍",dw="";let ox=null,lx=null;function Dae(t=[]){const e={};hr.groups=e;const s=new hr;ox==null&&(ox=gE(Cae)),lx==null&&(lx=gE(Tae)),Te(s,"'",Hg),Te(s,"{",um),Te(s,"}",hm),Te(s,"[",Ag),Te(s,"]",Mg),Te(s,"(",_g),Te(s,")",Og),Te(s,"<",Rg),Te(s,">",Dg),Te(s,"(",Pg),Te(s,")",Ig),Te(s,"「",Lg),Te(s,"」",$g),Te(s,"『",Bg),Te(s,"』",zg),Te(s,"<",Vg),Te(s,">",Fg),Te(s,"&",Ug),Te(s,"*",qg),Te(s,"@",el),Te(s,"`",Gg),Te(s,"^",Kg),Te(s,":",nl),Te(s,",",ak),Te(s,"$",Yg),Te(s,".",Ji),Te(s,"=",Qg),Te(s,"!",ok),Te(s,"-",ei),Te(s,"%",mm),Te(s,"|",Jg),Te(s,"+",Xg),Te(s,"#",Zg),Te(s,"?",pm),Te(s,'"',lk),Te(s,"/",Xi),Te(s,";",ck),Te(s,"~",fm),Te(s,"_",eb),Te(s,"\\",Wg),Te(s,"・",q6);const r=Ss(s,Ya,rk,{[F1]:!0});Ss(r,Ya,r);const i=Ss(r,Ka,U6,{[dm]:!0}),a=Ss(r,Uh,H6,{[Qh]:!0}),l=Ss(s,Ka,Ja,{[U1]:!0});Ss(l,Ya,i),Ss(l,Ka,l),Ss(i,Ya,i),Ss(i,Ka,i);const d=Ss(s,Uh,W1,{[H1]:!0});Ss(d,Ka),Ss(d,Ya,a),Ss(d,Uh,d),Ss(a,Ya,a),Ss(a,Ka),Ss(a,Uh,a);const u=Te(s,cw,ik,{[aw]:!0}),m=Te(s,xE,Y1,{[aw]:!0}),p=Ss(s,lw,Y1,{[aw]:!0});Te(s,dw,p),Te(m,cw,u),Te(m,dw,p),Ss(m,lw,p),Te(p,xE),Te(p,cw),Ss(p,lw,p),Te(p,dw,p);const x=Ss(s,ow,W6,{[F6]:!0});Te(x,"#"),Ss(x,ow,x),Te(x,Oae,x);const g=Te(x,Rae);Te(g,"#"),Ss(g,ow,x);const b=[[Ka,l],[Ya,i]],v=[[Ka,null],[Uh,d],[Ya,a]];for(let k=0;k<ox.length;k++)Qo(s,ox[k],G1,Ja,b);for(let k=0;k<lx.length;k++)Qo(s,lx[k],K1,W1,v);Ac(G1,{tld:!0,ascii:!0},e),Ac(K1,{utld:!0,alpha:!0},e),Qo(s,"file",_x,Ja,b),Qo(s,"mailto",_x,Ja,b),Qo(s,"http",Xd,Ja,b),Qo(s,"https",Xd,Ja,b),Qo(s,"ftp",Xd,Ja,b),Qo(s,"ftps",Xd,Ja,b),Ac(_x,{scheme:!0,ascii:!0},e),Ac(Xd,{slashscheme:!0,ascii:!0},e),t=t.sort((k,N)=>k[0]>N[0]?1:-1);for(let k=0;k<t.length;k++){const N=t[k][0],A=t[k][1]?{[Eae]:!0}:{[Aae]:!0};N.indexOf("-")>=0?A[q1]=!0:Ka.test(N)?Ya.test(N)?A[dm]=!0:A[U1]=!0:A[F1]=!0,fE(s,N,N,A)}return fE(s,"localhost",Km,{ascii:!0}),s.jd=new hr(tb),{start:s,tokens:Object.assign({groups:e},G6)}}function K6(t,e){const s=Pae(e.replace(/[A-Z]/g,d=>d.toLowerCase())),r=s.length,i=[];let a=0,l=0;for(;l<r;){let d=t,u=null,m=0,p=null,x=-1,g=-1;for(;l<r&&(u=d.go(s[l]));)d=u,d.accepts()?(x=0,g=0,p=d):x>=0&&(x+=s[l].length,g++),m+=s[l].length,a+=s[l].length,l++;a-=x,l-=g,m-=x,i.push({t:p.t,v:e.slice(a-m,a),s:a-m,e:a})}return i}function Pae(t){const e=[],s=t.length;let r=0;for(;r<s;){let i=t.charCodeAt(r),a,l=i<55296||i>56319||r+1===s||(a=t.charCodeAt(r+1))<56320||a>57343?t[r]:t.slice(r,r+2);e.push(l),r+=l.length}return e}function Qo(t,e,s,r,i){let a;const l=e.length;for(let d=0;d<l-1;d++){const u=e[d];t.j[u]?a=t.j[u]:(a=new hr(r),a.jr=i.slice(),t.j[u]=a),t=a}return a=new hr(s),a.jr=i.slice(),t.j[e[l-1]]=a,a}function gE(t){const e=[],s=[];let r=0,i="0123456789";for(;r<t.length;){let a=0;for(;i.indexOf(t[r+a])>=0;)a++;if(a>0){e.push(s.join(""));for(let l=parseInt(t.substring(r,r+a),10);l>0;l--)s.pop();r+=a}else s.push(t[r]),r++}return e}const Ym={defaultProtocol:"http",events:null,format:bE,formatHref:bE,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function dk(t,e=null){let s=Object.assign({},Ym);t&&(s=Object.assign(s,t instanceof dk?t.o:t));const r=s.ignoreTags,i=[];for(let a=0;a<r.length;a++)i.push(r[a].toUpperCase());this.o=s,e&&(this.defaultRender=e),this.ignoreTags=i}dk.prototype={o:Ym,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,s){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=s.t in i?i[s.t]:Ym[t],typeof i=="function"&&r&&(i=i(e,s))):typeof i=="function"&&r&&(i=i(e,s.t,s)),i)},getObj(t,e,s){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,s.t,s)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function bE(t){return t}function Y6(t,e){this.t="token",this.v=t,this.tk=e}Y6.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),s=t.get("truncate",e,this),r=t.get("format",e,this);return s&&r.length>s?r.substring(0,s)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Ym.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,s=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",s,this),i=t.get("tagName",s,e),a=this.toFormattedString(t),l={},d=t.get("className",s,e),u=t.get("target",s,e),m=t.get("rel",s,e),p=t.getObj("attributes",s,e),x=t.getObj("events",s,e);return l.href=r,d&&(l.class=d),u&&(l.target=u),m&&(l.rel=m),p&&Object.assign(l,p),{tagName:i,attributes:l,content:a,eventListeners:x}}};function Vb(t,e){class s extends Y6{constructor(i,a){super(i,a),this.t=t}}for(const r in e)s.prototype[r]=e[r];return s.t=t,s}const yE=Vb("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),vE=Vb("text"),Iae=Vb("nl"),cx=Vb("url",{isLink:!0,toHref(t=Ym.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Km&&t[1].t===nl}}),Zr=t=>new hr(t);function Lae({groups:t}){const e=t.domain.concat([Ug,qg,el,Wg,Gg,Kg,Yg,Qg,ei,rk,mm,Jg,Xg,Zg,Xi,tb,fm,eb]),s=[Hg,nl,ak,Ji,ok,mm,pm,lk,ck,Rg,Dg,um,hm,Mg,Ag,_g,Og,Pg,Ig,Lg,$g,Bg,zg,Vg,Fg],r=[Ug,Hg,qg,Wg,Gg,Kg,Yg,Qg,ei,um,hm,mm,Jg,Xg,Zg,pm,Xi,tb,fm,eb],i=Zr(),a=Te(i,fm);xt(a,r,a),xt(a,t.domain,a);const l=Zr(),d=Zr(),u=Zr();xt(i,t.domain,l),xt(i,t.scheme,d),xt(i,t.slashscheme,u),xt(l,r,a),xt(l,t.domain,l);const m=Te(l,el);Te(a,el,m),Te(d,el,m),Te(u,el,m);const p=Te(a,Ji);xt(p,r,a),xt(p,t.domain,a);const x=Zr();xt(m,t.domain,x),xt(x,t.domain,x);const g=Te(x,Ji);xt(g,t.domain,x);const b=Zr(yE);xt(g,t.tld,b),xt(g,t.utld,b),Te(m,Km,b);const v=Te(x,ei);Te(v,ei,v),xt(v,t.domain,x),xt(b,t.domain,x),Te(b,Ji,g),Te(b,ei,v);const k=Te(b,nl);xt(k,t.numeric,yE);const N=Te(l,ei),S=Te(l,Ji);Te(N,ei,N),xt(N,t.domain,l),xt(S,r,a),xt(S,t.domain,l);const A=Zr(cx);xt(S,t.tld,A),xt(S,t.utld,A),xt(A,t.domain,l),xt(A,r,a),Te(A,Ji,S),Te(A,ei,N),Te(A,el,m);const E=Te(A,nl),_=Zr(cx);xt(E,t.numeric,_);const T=Zr(cx),$=Zr();xt(T,e,T),xt(T,s,$),xt($,e,T),xt($,s,$),Te(A,Xi,T),Te(_,Xi,T);const L=Te(d,nl),M=Te(u,nl),I=Te(M,Xi),z=Te(I,Xi);xt(d,t.domain,l),Te(d,Ji,S),Te(d,ei,N),xt(u,t.domain,l),Te(u,Ji,S),Te(u,ei,N),xt(L,t.domain,T),Te(L,Xi,T),Te(L,pm,T),xt(z,t.domain,T),xt(z,e,T),Te(z,Xi,T);const ae=[[um,hm],[Ag,Mg],[_g,Og],[Rg,Dg],[Pg,Ig],[Lg,$g],[Bg,zg],[Vg,Fg]];for(let U=0;U<ae.length;U++){const[Y,P]=ae[U],ne=Te(T,Y);Te($,Y,ne),Te(ne,P,T);const q=Zr(cx);xt(ne,e,q);const W=Zr();xt(ne,s),xt(q,e,q),xt(q,s,W),xt(W,e,q),xt(W,s,W),Te(q,P,T),Te(W,P,T)}return Te(i,Km,A),Te(i,ik,Iae),{start:i,tokens:G6}}function $ae(t,e,s){let r=s.length,i=0,a=[],l=[];for(;i<r;){let d=t,u=null,m=null,p=0,x=null,g=-1;for(;i<r&&!(u=d.go(s[i].t));)l.push(s[i++]);for(;i<r&&(m=u||d.go(s[i].t));)u=null,d=m,d.accepts()?(g=0,x=d):g>=0&&g++,i++,p++;if(g<0)i-=p,i<r&&(l.push(s[i]),i++);else{l.length>0&&(a.push(uw(vE,e,l)),l=[]),i-=g,p-=g;const b=x.t,v=s.slice(i-p,i);a.push(uw(b,e,v))}}return l.length>0&&a.push(uw(vE,e,l)),a}function uw(t,e,s){const r=s[0].s,i=s[s.length-1].e,a=e.slice(r,i);return new t(a,s)}const Bae=typeof console<"u"&&console&&console.warn||(()=>{}),zae="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ss={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Vae(){return hr.groups={},ss.scanner=null,ss.parser=null,ss.tokenQueue=[],ss.pluginQueue=[],ss.customSchemes=[],ss.initialized=!1,ss}function wE(t,e=!1){if(ss.initialized&&Bae(`linkifyjs: already initialized - will not register custom scheme "${t}" ${zae}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
5191. Must only contain digits, lowercase ASCII letters or "-"
5202. Cannot start or end with "-"
5213. "-" cannot repeat`);ss.customSchemes.push([t,e])}function Fae(){ss.scanner=Dae(ss.customSchemes);for(let t=0;t<ss.tokenQueue.length;t++)ss.tokenQueue[t][1]({scanner:ss.scanner});ss.parser=Lae(ss.scanner.tokens);for(let t=0;t<ss.pluginQueue.length;t++)ss.pluginQueue[t][1]({scanner:ss.scanner,parser:ss.parser});return ss.initialized=!0,ss}function uk(t){return ss.initialized||Fae(),$ae(ss.parser.start,t,K6(ss.scanner.start,t))}uk.scan=K6;function Q6(t,e=null,s=null){if(e&&typeof e=="object"){if(s)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);s=e,e=null}const r=new dk(s),i=uk(t),a=[];for(let l=0;l<i.length;l++){const d=i[l];d.isLink&&(!e||d.t===e)&&r.check(d)&&a.push(d.toFormattedObject(r))}return a}var hk="[\0-   ᠎ -\u2029  ]",Uae=new RegExp(hk),Hae=new RegExp(`${hk}
521$`),qae=new RegExp(hk,"g");function Wae(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Gae(t){return new ws({key:new sn("autolink"),appendTransaction:(e,s,r)=>{const i=e.some(m=>m.docChanged)&&!s.doc.eq(r.doc),a=e.some(m=>m.getMeta("preventAutolink"));if(!i||a)return;const{tr:l}=r,d=d6(s.doc,[...e]);if(g6(d).forEach(({newRange:m})=>{const p=qne(r.doc,m,b=>b.isTextblock);let x,g;if(p.length>1)x=p[0],g=r.doc.textBetween(x.pos,x.pos+x.node.nodeSize,void 0," ");else if(p.length){const b=r.doc.textBetween(m.from,m.to," "," ");if(!Hae.test(b))return;x=p[0],g=r.doc.textBetween(x.pos,m.to,void 0," ")}if(x&&g){const b=g.split(Uae).filter(Boolean);if(b.length<=0)return!1;const v=b[b.length-1],k=x.pos+g.lastIndexOf(v);if(!v)return!1;const N=uk(v).map(S=>S.toObject(t.defaultProtocol));if(!Wae(N))return!1;N.filter(S=>S.isLink).map(S=>({...S,from:k+S.start+1,to:k+S.end+1})).filter(S=>r.schema.marks.code?!r.doc.rangeHasMark(S.from,S.to,r.schema.marks.code):!0).filter(S=>t.validate(S.value)).filter(S=>t.shouldAutoLink(S.value)).forEach(S=>{XN(S.from,S.to,r.doc).some(A=>A.mark.type===t.type)||l.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!l.steps.length)return l}})}function Kae(t){return new ws({key:new sn("handleClickLink"),props:{handleClick:(e,s,r)=>{var i,a;if(r.button!==0||!e.editable)return!1;let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{const u=r.target;if(!u)return!1;const m=t.editor.view.dom;l=u.closest("a"),l&&!m.contains(l)&&(l=null)}if(!l)return!1;let d=!1;if(t.enableClickSelection&&(d=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=x6(e.state,t.type.name),m=(i=l.href)!=null?i:u.href,p=(a=l.target)!=null?a:u.target;m&&(window.open(m,p),d=!0)}return d}}})}function Yae(t){return new ws({key:new sn("handlePasteLink"),props:{handlePaste:(e,s,r)=>{const{shouldAutoLink:i}=t,{state:a}=e,{selection:l}=a,{empty:d}=l;if(d)return!1;let u="";r.content.forEach(p=>{u+=p.textContent});const m=Q6(u,{defaultProtocol:t.defaultProtocol}).find(p=>p.isLink&&p.value===u);return!u||!m||i!==void 0&&!i(m.value)?!1:t.editor.commands.setMark(t.type,{href:m.href})}}})}function gc(t,e){const s=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&s.push(i)}),!t||t.replace(qae,"").match(new RegExp(`^(?:(?:${s.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var J6=td.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){wE(t);return}wE(t.scheme,t.optionalSlashes)})},onDestroy(){Vae()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!gc(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),s=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||s&&!t.includes("@"))return!0;const i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:s=>!!gc(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!gc(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Gs(this.options.HTMLAttributes,t),0]:["a",Gs(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>
521e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var s,r,i,a;const l=(r=(s=t.attrs)==null?void 0:s.href)!=null?r:"",d=(a=(i=t.attrs)==null?void 0:i.title)!=null?a:"",u=e.renderChildren(t);return d?`[${u}](${l} "${d}")`:`[${u}](${l})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:s}=t;return this.options.isAllowedUri(s,{defaultValidate:r=>!!gc(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:s}=t||{};return s&&!this.options.isAllowedUri(s,{defaultValidate:r=>!!gc(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Yc({find:t=>{const e=[];if(t){const{protocols:s,defaultProtocol:r}=this.options,i=Q6(t).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:l=>!!gc(l,s),protocols:s,defaultProtocol:r}));i.length&&i.forEach(a=>{this.options.shouldAutoLink(a.value)&&e.push({text:a.value,data:{href:a.href},index:a.start})})}return e}
vendor: 5,938 bytes, lines 521-522
521,type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:s}=this.options;return this.options.autolink&&t.push(Gae({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!gc(i,e),protocols:e,defaultProtocol:s}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Kae({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Yae({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Qae=J6,Jae=Object.defineProperty,Xae=(t,e)=>{for(var s in e)Jae(t,s,{get:e[s],enumerable:!0})},Zae="listItem",jE="textStyle",NE=/^\s*([-+*])\s$/,X6=Lr.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Gs(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
522`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Zae,this.editor.getAttributes(jE)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Tu({find:NE,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Tu({find:NE,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(jE),editor:this.editor})),[t]}}),Z6=Lr.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Gs(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var s;if(t.type!=="list_item")return[];const r=(s=e.parseBlockChildren)!=null?s:e.parseChildren;let i=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(l=>l.type==="paragraph"))i=r(t.tokens);else{const l=t.tokens[0];if(l&&l.type==="text"&&l.tokens&&l.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(l.tokens)}],t.tokens.length>1){const u=t.tokens.slice(1),m=r(u);i.push(...m)}}else i=r(t.tokens)}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,s)=>sk(t,e,r=>{var i,a;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((a=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:a.start)||1)+r.index}. `:"- "},s),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),eoe={};Xae(eoe,{findListItemPos:()=>fp,getNextListDepth:()=>mk,handleBackspace:()=>Q1,handleDelete:()=>J1,hasListBefore:()=>eP,hasListItemAfter:()=>toe,hasListItemBefore:()=>tP,listItemHasSubList:()=>sP,nextListIsDeeper:()=>nP,nextListIsHigher:()=>rP});var fp=(t,e)=>{const{$from:s}=e.selection,r=Ws(t,e.schema);let i=null,a=s.depth,l=s.pos,d=null;for(;a>0&&d===null;)i=s.node(a),i.type===r?d=a:(a-=1,l-=1);return d===null?null:{$pos:e.doc.resolve(l),depth:d}},mk=(t,e)=>{const s=fp(t,e);if(!s)return!1;const[,r]=sre(e,t,s.$pos.pos+4);return r},eP=(t,e,s)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),a=t.doc.resolve(i).node();return!(!a||!s.includes(a.type.name))},tP=(t,e)=>{var s;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((s=i.nodeBefore)==null?void 0:s.type.name)!==t)},sP=(t,e,s)=>{if(!s)return!1;const r=Ws(t,e.schema);let i=!1;return s.descendants(a=>{a.type===r&&(i=!0)}),i},Q1=(t,e,s)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Tl(t.state,e)&&eP(t.state,e,s)){const{$anchor:d}=t.state.selection,u=t.state.doc.resolve(d.before()-1),m=[];u.node().descendants((g,b)=>{g.type.name===e&&m.push({node:g,pos:b})});const p=m.at(-1);if(!p)return!1;const x=t.state.doc.resolve(u.start()+p.pos+1);return t.chain().cut({from:d.start()-1,to:d.end()+1},x.end()).joinForward().run()}if(!Tl(t.state,e)||!are(t.state))return!1;const r=fp(e,t.state);if(!r)return!1;const a=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=sP(e,t.state,a);return tP(e,t.state)&&!l?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},nP=(t,e)=>{const s=mk(t,e),r=fp(t,e);return!r||!s?!1:s>r.depth},rP=(t,e)=>{const s=mk(t,e),r=fp(t,e);return!r||!s?!1:s<r.depth},J1=(t,e)=>{if(!Tl(t.state,e)||!ire(t.state,e))return!1;const{selection:s}=t.state,{$from:r,$to:i}=s;return!s.empty&&r.sameParent(i)?!1:nP(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():rP(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},toe=(t,e)=>{var s;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((s=i.nodeAfter)==null?void 0:s.type.name)!==t)},iP=Os.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:s})=>
522{t.state.schema.nodes[s]!==void 0&&J1(t,s)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:s})=>{t.state.schema.nodes[s]!==void 0&&J1(t,s)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:s,wrapperNames:r})=>{t.state.schema.nodes[s]!==void 0&&Q1(t,s,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:s,wrapperNames:r})=>{t.state.schema.nodes[s]!==void 0&&Q1(t,s,r)&&(e=!0)}),e}}}}),kE=/^(\s*)(\d+)\.\s+(.*)$/,soe=/^\s/;function noe(t){const e=t.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function roe(t){const e=[],s=[];let r=!1;return t.forEach(i=>{if(r){s.push(i);return}if(i.trim()===""){r=!0,s.push(i);return}if(e.length>0&&noe(i)){r=!0,s.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:s}}function ioe(t){const e=[];let s=0,r=0;for(;s<t.length;){const i=t[s],a=i.match(kE);if(!a)break;const[,l,d,u]=a,m=l.length,p=[u];let x=s+1;const g=[i];let b=!1;for(;x<t.length;){const v=t[x];if(v.match(kE))break;if(v.trim()==="")g.push(v),p.push(""),b=!0,x+=1;else if(v.match(soe))g.push(v),p.push(v.slice(m+2)),x+=1;else{if(b)break;g.push(v),p.push(v),x+=1}}e.push({indent:m,number:parseInt(d,10),content:p.join(`
523`).trim(),contentLines:p,raw:g.join(`
524`)}),r=x,s=x}return[e,r]}function aP(t,e,s){const r=[];let i=0;for(;i<t.length;){const a=t[i];if(a.indent===e){const{paragraphLines:l,blockLines:d}=roe(a.contentLines),u=l.join(`
525`).trim(),m=[];u&&m.push({type:"paragraph",raw:u,tokens:s.inlineTokens(u)});const p=d.join(`
526`).trim();if(p){const b=s.blockTokens(p);m.push(...b)}let x=i+1;const g=[];for(;x<t.length&&t[x].indent>e;)g.push(t[x]),x+=1;if(g.length>0){const b=Math.min(...g.map(k=>k.indent)),v=aP(g,b,s);m.push({type:"list",ordered:!0,start:g[0].number,items:v,raw:g.map(k=>k.raw).join(`
527`)})}r.push({type:"list_item",raw:a.raw,tokens:m}),i=x}else i+=1}return r}function aoe(t,e){return t.map(s=>{if(s.type!=="list_item")return e.parseChildren([s])[0];const r=[];return s.tokens&&s.tokens.length>0&&s.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const a=e.parseChildren([i]);r.push({type:"paragraph",content:a})}else{const a=e.parseChildren([i]);a.length>0&&r.push(...a)}}),{type:"listItem",content:r}})}var ooe="listItem",SE="textStyle",CE=/^(\d+)\.\s$/,oP=Lr.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...s}=t;return e===1?["ol",Gs(this.options.HTMLAttributes,s),0]:["ol",Gs(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const s=t.start||1,r=t.items?aoe(t.items,e):[];return s!==1?{type:"orderedList",attrs:{start:s},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
528`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),s=e?.index;return s!==void 0?s:-1},tokenize:(t,e,s)=>{var r;const i=t.split(`
529`),[a,l]=ioe(i);if(a.length===0)return;const d=aP(a,0,s);return d.length===0?void 0:{type:"list",ordered:!0,start:((r=a[0])==null?void 0:r.number)||1,items:d,raw:i.slice(0,l).join(`
530`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ooe,this.editor.getAttributes(SE)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}}
vendor: 4,995 bytes, lines 530-531
530,addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Tu({find:CE,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,s)=>s.childCount+s.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Tu({find:CE,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(SE)}),joinPredicate:(e,s)=>s.childCount+s.attrs.start===+e[1],editor:this.editor})),[t]}}),loe=/^\s*(\[([( |x])?\])\s$/,coe=Lr.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Gs(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const s=[];if(t.tokens&&t.tokens.length>0?s.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?s.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):s.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);s.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},s)},renderMarkdown:(t,e)=>{var s;const i=`- [${(s=t.attrs)!=null&&s.checked?"x":" "}] `;return sk(t,e,i)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:s,editor:r})=>{const i=document.createElement("li"),a=document.createElement("label"),l=document.createElement("span"),d=document.createElement("input"),u=document.createElement("div"),m=x=>{var g,b;d.ariaLabel=((b=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:b.call(g,x,d.checked))||`Task item checkbox for ${x.textContent||"empty task item"}`};m(t),a.contentEditable="false",d.type="checkbox",d.addEventListener("mousedown",x=>x.preventDefault()),d.addEventListener("change",x=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){d.checked=!d.checked;return}const{checked:g}=x.target;r.isEditable&&typeof s=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:b})=>{const v=s();if(typeof v!="number")return!1;const k=b.doc.nodeAt(v);return b.setNodeMarkup(v,void 0,{...k?.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(d.checked=!d.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([x,g])=>{i.setAttribute(x,g)}),i.dataset.checked=t.attrs.checked,d.checked=t.attrs.checked,a.append(d,l),i.append(a,u),Object.entries(e).forEach(([x,g])=>{i.setAttribute(x,g)});let p=new Set(Object.keys(e));return{dom:i,contentDOM:u,update:x=>{if(x.type!==this.type)return!1;i.dataset.checked=x.attrs.checked,d.checked=x.attrs.checked,m(x);const g=r.extensionManager.attributes,b=Gm(x,g),v=new Set(Object.keys(b)),k=this.options.HTMLAttributes;return p.forEach(N=>{v.has(N)||(N in k?i.setAttribute(N,k[N]):i.removeAttribute(N))}),Object.entries(b).forEach(([N,S])=>{S==null?N in k?i.setAttribute(N,k[N]):i.removeAttribute(N):i.setAttribute(N,S)}),p=v,!0}}}},addInputRules(){return[Tu({find:loe,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),doe=Lr.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Gs(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
531`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const s=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return s!==void 0?s:-1},tokenize(t,e,s){const r=a=>{const l=z1(a,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:d=>({indentLevel:d[1].length,mainContent:d[4],checked:d[3].toLowerCase()==="x"}),createToken:(d,u)=>({type:"taskItem",raw:"",mainContent:d.mainContent,indentLevel:d.indentLevel,checked:d.checked,text:d.mainContent,tokens:s.inlineTokens(d.mainContent),nestedTokens:u}),customNestedParser:r},s);return l?[{type:"taskList",raw:l.raw,items:l.items}]:s.blockTokens(a)},i=z1(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>
531({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:s.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},s);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Os.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(X6.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Z6.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(iP.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(oP.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(coe.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(doe.configure(this.options.taskList)),t}});var dx="&nbsp;",hw=" ",uoe=Lr.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Gs(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const s=t.tokens||[];if(s.length===1&&s[0].type==="image")return e.parseChildren([s[0]]);const r=e.parseInline(s);return s.length===1&&s[0].type==="text"&&(s[0].raw===dx||s[0].text===dx||s[0].raw===hw||s[0].text===hw)&&r.length===1&&r[0].type==="text"&&(r[0].text===dx||r[0].text===hw)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,s)=>{var r,i;if(!t)return"";const a=Array.isArray(t.content)?t.content:[];if(a.length===0){const l=Array.isArray((r=s?.previousNode)==null?void 0:r.content)?s.previousNode.content:[];return((i=s?.previousNode)==null?void 0:i.type)==="paragraph"&&l.length===0?dx:""}return e.renderChildren(a)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),hoe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,moe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,poe=td.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Gs(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Cu({find:hoe,type:this.type})]},addPasteRules(){return[Yc({find:moe,type:this.type})]}}),foe=Lr.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),lP=td.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Gs(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,s){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const a=i[2].trim();return{type:"underline",raw:i[0],text:a,tokens:s.inlineTokens(a)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),xoe=lP;function goe(t={}){return new ws({view(e){return new boe(e,t)}})}class boe{constructor(e,s){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=s.width)!==null&&r!==void 0?r:1,this.color=s.color===!1?void 0:s.color||"black",this.class=s.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let a=l=>{this[i](l)};return e.dom.addEventListener(i,a),{name:i,handler:a}})}
vendor: 4,302 bytes, line 531
531destroy(){this.handlers.forEach(({name:e,handler:s})=>this.editorView.dom.removeEventListener(e,s))}update(e,s){this.cursorPos!=null&&s.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),s=!e.parent.inlineContent,r,i=this.editorView.dom,a=i.getBoundingClientRect(),l=a.width/i.offsetWidth,d=a.height/i.offsetHeight;if(s){let x=e.nodeBefore,g=e.nodeAfter;if(x||g){let b=this.editorView.nodeDOM(this.cursorPos-(x?x.nodeSize:0));if(b){let v=b.getBoundingClientRect(),k=x?v.bottom:v.top;x&&g&&(k=(k+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let N=this.width/2*d;r={left:v.left,right:v.right,top:k-N,bottom:k+N}}}}if(!r){let x=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*l;r={left:x.left-g,right:x.left+g,top:x.top,bottom:x.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",s),this.element.classList.toggle("prosemirror-dropcursor-inline",!s);let m,p;if(!u||u==document.body&&getComputedStyle(u).position=="static")m=-pageXOffset,p=-pageYOffset;else{let x=u.getBoundingClientRect(),g=x.width/u.offsetWidth,b=x.height/u.offsetHeight;m=x.left-u.scrollLeft*g,p=x.top-u.scrollTop*b}this.element.style.left=(r.left-m)/l+"px",this.element.style.top=(r.top-p)/d+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/d+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let s=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=s&&s.inside>=0&&this.editorView.state.doc.nodeAt(s.inside),i=r&&r.type.spec.disableDropCursor,a=typeof i=="function"?i(this.editorView,s,e):i;if(s&&!a){let l=s.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let d=tD(this.editorView.state.doc,l,this.editorView.dragging.slice);d!=null&&(l=d)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class As extends gt{constructor(e){super(e,e)}map(e,s){let r=e.resolve(s.map(this.head));return As.valid(r)?new As(r):gt.near(r)}content(){return $e.empty}eq(e){return e instanceof As&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,s){if(typeof s.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new As(e.resolve(s.pos))}getBookmark(){return new pk(this.anchor)}static valid(e){let s=e.parent;if(s.inlineContent||!yoe(e)||!voe(e))return!1;let r=s.type.spec.allowGapCursor;if(r!=null)return r;let i=s.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,s,r=!1){e:for(;;){if(!r&&As.valid(e))return e;let i=e.pos,a=null;for(let l=e.depth;;l--){let d=e.node(l);if(s>0?e.indexAfter(l)<d.childCount:e.index(l)>0){a=d.child(s>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;i+=s;let u=e.doc.resolve(i);if(As.valid(u))return u}for(;;){let l=s>0?a.firstChild:a.lastChild;if(!l){if(a.isAtom&&!a.isText&&!Xe.isSelectable(a)){e=e.doc.resolve(i+a.nodeSize*s),r=!1;continue e}break}a=l,i+=s;let d=e.doc.resolve(i);if(As.valid(d))return d}return null}}}As.prototype.visible=!1;As.findFrom=As.findGapCursorFrom;gt.jsonID("gapcursor",As);class pk{constructor(e){this.pos=e}map(e){return new pk(e.map(this.pos))}resolve(e){let s=e.resolve(this.pos);return As.valid(s)?new As(s):gt.near(s)}}function cP(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function yoe(t){for(let e=t.depth;e>=0;e--){let s=t.index(e),r=t.node(e);if(s==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(s-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||cP(i.type))return!0;
vendor: 15,914 bytes, line 531
531if(i.inlineContent)return!1}}return!0}function voe(t){for(let e=t.depth;e>=0;e--){let s=t.indexAfter(e),r=t.node(e);if(s==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(s);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||cP(i.type))return!0;if(i.inlineContent)return!1}}return!0}function woe(){return new ws({props:{decorations:Soe,createSelectionBetween(t,e,s){return e.pos==s.pos&&As.valid(s)?new As(s):null},handleClick:Noe,handleKeyDown:joe,handleDOMEvents:{beforeinput:koe}}})}const joe=s6({ArrowLeft:ux("horiz",-1),ArrowRight:ux("horiz",1),ArrowUp:ux("vert",-1),ArrowDown:ux("vert",1)});function ux(t,e){const s=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,a){let l=r.selection,d=e>0?l.$to:l.$from,u=l.empty;if(l instanceof it){if(!a.endOfTextblock(s)||d.depth==0)return!1;u=!1,d=r.doc.resolve(e>0?d.after():d.before())}let m=As.findGapCursorFrom(d,e,u);return m?(i&&i(r.tr.setSelection(new As(m))),!0):!1}}function Noe(t,e,s){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!As.valid(r))return!1;let i=t.posAtCoords({left:s.clientX,top:s.clientY});return i&&i.inside>-1&&Xe.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new As(r))),!0)}function koe(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof As))return!1;let{$from:s}=t.state.selection,r=s.parent.contentMatchAt(s.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=Ne.empty;for(let l=r.length-1;l>=0;l--)i=Ne.from(r[l].createAndFill(null,i));let a=t.state.tr.replace(s.pos,s.pos,new $e(i,0,0));return a.setSelection(it.near(a.doc.resolve(s.pos+1))),t.dispatch(a),!1}function Soe(t){if(!(t.selection instanceof As))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ys.create(t.doc,[Xn.widget(t.selection.head,e,{key:"gapcursor"})])}var sb=200,cn=function(){};cn.prototype.append=function(e){return e.length?(e=cn.from(e),!this.length&&e||e.length<sb&&this.leafAppend(e)||this.length<sb&&e.leafPrepend(this)||this.appendInner(e)):this};cn.prototype.prepend=function(e){return e.length?cn.from(e).append(this):this};cn.prototype.appendInner=function(e){return new Coe(this,e)};cn.prototype.slice=function(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.length),e>=s?cn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,s))};cn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};cn.prototype.forEach=function(e,s,r){s===void 0&&(s=0),r===void 0&&(r=this.length),s<=r?this.forEachInner(e,s,r,0):this.forEachInvertedInner(e,s,r,0)};cn.prototype.map=function(e,s,r){s===void 0&&(s=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(a,l){return i.push(e(a,l))},s,r),i};cn.from=function(e){return e instanceof cn?e:e&&e.length?new dP(e):cn.empty};var dP=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var s={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,a){return i==0&&a==this.length?this:new e(this.values.slice(i,a))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,a,l,d){for(var u=a;u<l;u++)if(i(this.values[u],d+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,a,l,d){for(var u=a-1;u>=l;u--)if(i(this.values[u],d+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=sb)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=sb)return new e(i.flatten().concat(this.values))},s.length.get=function(){return this.values.length},s.depth.get=function(){return 0},Object.defineProperties(e.prototype,s),e})(cn);cn.empty=new dP([]);var Coe=(function(t){function e(s,r){t.call(this),this.left=s,this.right=r,this.length=s.length+r.length,this.depth=Math.max(s.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,a,l){var d=this.left.length;if(i<d&&this.left.forEachInner(r,i,Math.min(a,d),l)===!1||a>d&&this.right.forEachInner(r,Math.max(i-d,0),Math.min(this.length,a)-d,l+d)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,a,l){var d=this.left.length;if(i>d&&this.right.forEachInvertedInner(r,i-d,Math.max(a,d)-d,l+d)===!1||a<d&&this.left.forEachInvertedInner(r,Math.min(i,d),a,l)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var a=this.left.length;return i<=a?this.left.slice(r,i):r>=a?this.right.slice(r-a,i-a):this.left.slice(r,a).append(this.right.slice(0,i-a))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(cn);const Toe=500;class ki{constructor(e,s){this.items=e,this.eventCount=s}popEvent(e,s){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;s&&(i=this.remapping(r,this.items.length),a=i.maps.length);let l=e.tr,d,u,m=[],p=[];return this.items.forEach((x,g)=>{if(!x.step){i||(i=this.remapping(r,g+1),a=i.maps.length),a--,p.push(x);return}if(i){p.push(new Zi(x.map));let b=x.step.map(i.slice(a)),v;b&&l.maybeStep(b).doc&&(v=l.mapping.maps[l.mapping.maps.length-1],m.push(new Zi(v,void 0,void 0,m.length+p.length))),a--,v&&i.appendMap(v,a)}else l.maybeStep(x.step);if(x.selection)return d=i?x.selection.map(i.slice(a)):x.selection,u=new ki(this.items.slice(0,r).append(p.reverse().concat(m)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:d}}addTransform(e,s,r,i){let a=[],l=this.eventCount,d=this.items,u=!i&&d.length?d.get(d.length-1):null;for(let p=0;p<e.steps.length;p++){let x=e.steps[p].invert(e.docs[p]),g=new Zi(e.mapping.maps[p],x,s),b;(b=u&&u.merge(g))&&(g=b,p?a.pop():d=d.slice(0,d.length-1)),a.push(g),s&&(l++,s=void 0),i||(u=g)}let m=l-r.depth;return m>Aoe&&(d=Eoe(d,m),l-=m),new ki(d.append(a),l)}remapping(e,s){let r=new Vm;return this.items.forEach((i,a)=>{let l=i.mirrorOffset!=null&&a-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,l)},e,s),r}addMaps(e){return this.eventCount==0?this:new ki(this.items.append(e.map(s=>new Zi(s))),this.eventCount)}rebased(e,s){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-s),a=e.mapping,l=e.steps.length,d=this.eventCount;this.items.forEach(g=>{g.selection&&d--},i);let u=s;this.items.forEach(g=>{let b=a.getMirror(--u);if(b==null)return;l=Math.min(l,b);let v=a.maps[b];if(g.step){let k=e.steps[b].invert(e.docs[b]),N=g.selection&&g.selection.map(a.slice(u+1,b));N&&d++,r.push(new Zi(v,k,N))}else r.push(new Zi(v))},i);let m=[];for(let g=s;g<l;g++)m.push(new Zi(a.maps[g]));let p=this.items.slice(0,i).append(m).append(r),x=new ki(p,d);return x.emptyItemCount()>Toe&&(x=x.compress(this.items.length-r.length)),x}emptyItemCount(){let e=0;return this.items.forEach(s=>{s.step||e++}),e}compress(e=this.items.length){let s=this.remapping(0,e),r=s.maps.length,i=[],a=0;return this.items.forEach((l,d)=>{if(d>=e)i.push(l),l.selection&&a++;else if(l.step){let u=l.step.map(s.slice(r)),m=u&&u.getMap();if(r--,m&&s.appendMap(m,r),u){let p=l.selection&&l.selection.map(s.slice(r));p&&a++;let x=new Zi(m.invert(),u,p),g,b=i.length-1;(g=i.length&&i[b].merge(x))?i[b]=g:i.push(x)}}else l.map&&r--},this.items.length,0),new ki(cn.from(i.reverse()),a)}}ki.empty=new ki(cn.empty,0);function Eoe(t,e){let s;return t.forEach((r,i)=>{if(r.selection&&e--==0)return s=i,!1}),t.slice(s)}class Zi{constructor(e,s,r,i){this.map=e,this.step=s,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let s=e.step.merge(this.step);if(s)return new Zi(s.getMap().invert(),s,this.selection)}}}class tl{constructor(e,s,r,i,a){this.done=e,this.undone=s,this.prevRanges=r,this.prevTime=i,this.prevComposition=a}}const Aoe=20;function Moe(t,e,s,r){let i=s.getMeta($c),a;if(i)return i.historyState;s.getMeta(Roe)&&(t=new tl(t.done,t.undone,null,0,-1));let l=s.getMeta("appendedTransaction");if(s.steps.length==0)return t;if(l&&l.getMeta($c))return l.getMeta($c).redo?new tl(t.done.addTransform(s,void 0,r,Ox(e)),t.undone,TE(s.mapping.maps),t.prevTime,t.prevComposition):new tl(t.done,t.undone.addTransform(s,void 0,r,Ox(e)),null,t.prevTime,t.prevComposition);if(s.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let d=s.getMeta("composition"),u=t.prevTime==0||!l&&t.prevComposition!=d&&(t.prevTime<(s.time||0)-r.newGroupDelay||!_oe(s,t.prevRanges)),m=l?mw(t.prevRanges,s.mapping):TE(s.mapping.maps);return new tl(t.done.addTransform(s,u?e.selection.getBookmark():void 0,r,Ox(e)),ki.empty,m,s.time,d??t.prevComposition)}else return(a=s.getMeta("rebased"))?new tl(t.done.rebased(s,a),t.undone.rebased(s,a),mw(t.prevRanges,s.mapping),t.prevTime,t.prevComposition):new tl(t.done.addMaps(s.mapping.maps),t.undone.addMaps(s.mapping.maps),mw(t.prevRanges,s.mapping),t.prevTime,t.prevComposition)}function _oe(t,e){if(!e)return!1;if(!t.docChanged)return!0;let s=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let a=0;a<e.length;a+=2)r<=e[a+1]&&i>=e[a]&&(s=!0)}),s}function TE(t){let e=[];for(let s=t.length-1;s>=0&&e.length==0;s--)t[s].forEach((r,i,a,l)=>e.push(a,l));return e}function mw(t,e){if(!t)return null;let s=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),a=e.map(t[r+1],-1);i<=a&&s.push(i,a)}return s}function Ooe(t,e,s){let r=Ox(e),i=$c.get(e).spec.config,a=(s?t.undone:t.done).popEvent(e,r);if(!a)return null;let l=a.selection.resolve(a.transform.doc),d=(s?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),i,r),u=new tl(s?d:a.remaining,s?a.remaining:d,null,0,-1);return a.transform.setSelection(l).setMeta($c,{redo:s,historyState:u})}let pw=!1,EE=null;function Ox(t){let e=t.plugins;if(EE!=e){pw=!1,EE=e;for(let s=0;s<e.length;s++)if(e[s].spec.historyPreserveItems){pw=!0;break}}return pw}const $c=new sn("history"),Roe=new sn("closeHistory");function Doe(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new ws({key:$c,state:{init(){return new tl(ki.empty,ki.empty,null,0,-1)},apply(e,s,r){return Moe(s,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,s){let r=s.inputType,i=r=="historyUndo"?hP:r=="historyRedo"?mP:null;return!i||!e.editable?!1:(s.preventDefault(),i(e.state,e.dispatch))}}}})}function uP(t,e){return(s,r)=>{let i=$c.getState(s);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let a=Ooe(i,s,t);a&&r(e?a.scrollIntoView():a)}return!0}}const hP=uP(!1,!0),mP=uP(!0,!0);Os.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,s=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(s)}},addProseMirrorPlugins(){let t=!1;return[new ws({key:new sn("characterCount"),appendTransaction:(e,s,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const a=this.storage.characters({node:r.doc});if(a>i){const l=a-i,d=0,u=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const m=r.tr.deleteRange(d,u);return t=!0,m}t=!0},filterTransaction:(e,s)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:s.doc}),a=this.storage.characters({node:e.doc});if(a<=r||i>r&&a>r&&a<=i)return!0;if(i>r&&a>r&&a>i||!e.getMeta("paste"))return!1;const d=e.selection.$head.pos,u=a-r,m=d-u,p=d;return e.deleteRange(m,p),!(this.storage.characters({node:e.doc})>r)}})]}});var Poe=Os.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[goe(this.options)]}});Os.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ws({key:new sn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:s,isFocused:r}=this.editor,{anchor:i}=e,a=[];if(!s||!r)return ys.create(t,[]);let l=0;this.options.mode==="deepest"&&t.descendants((u,m)=>{if(u.isText)return;if(!(i>=m&&i<=m+u.nodeSize-1))return!1;l+=1});let d=0;return t.descendants((u,m)=>{if(u.isText||!(i>=m&&i<=m+u.nodeSize-1))return!1;if(d+=1,this.options.mode==="deepest"&&l-d>0||this.options.mode==="shallowest"&&d>1)return this.options.mode==="deepest";a.push(Xn.node(m,m+u.nodeSize,{class:this.options.className}))}),ys.create(t,a)}}})]}});var Ioe=Os.create({name:"gapCursor",addProseMirrorPlugins(){return[woe()]},extendNodeSchema(t){var e;const s={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=$t(Qe(t,"allowGapCursor",s)))!=null?e:null}}}),AE="placeholder";function Loe(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var $oe=Os.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:AE,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${Loe(this.options.dataAttribute)}`:`data-${AE}`;return[new ws({key:new sn("placeholder"),props:{decorations:({doc:e,selection:s})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=s,a=[];if(!r)return null;const l=this.editor.isEmpty;return e.descendants((d,u)=>{const m=i>=u&&i<=u+d.nodeSize,p=!d.isLeaf&&$b(d);if(!d.type.isTextblock)return this.options.includeChildren;if((m||!this.options.showOnlyCurrent)&&p){const x=[this.options.emptyNodeClass];l&&x.push(this.options.emptyEditorClass);const g=Xn.node(u,u+d.nodeSize,{class:x.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:d,pos:u,hasAnchor:m}):this.options.placeholder});a.push(g)}return this.options.includeChildren}),ys.create(e,a)}}})]}});Os.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new ws({key:new sn("selection"),props:{decorations(s){return s.selection.empty||t.isFocused||!t.isEditable||b6(s.selection)||t.view.dragging?null:ys.create(s.doc,[Xn.inline(s.selection.from,s.selection.to,{class:e.className})])}}})]}});var Boe="skipTrailingNode";function ME({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var zoe=Os.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new sn(this.name),s=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(s).includes(i.name));return[new ws({key:e,appendTransaction:(i,a,l)=>{const{doc:d,tr:u,schema:m}=l,p=e.getState(l),x=d.content.size,g=m.nodes[s];if(!i.some(b=>b.getMeta(Boe))&&p)return u.insert(x,g.create())},state:{init:(i,a)=>{const l=a.tr.doc.lastChild;return!ME({node:l,types:r})},apply:(i,a)=>
531{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return a;const l=i.doc.lastChild;return!ME({node:l,types:r})}}})]}}),Voe=Os.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>hP(t,e),redo:()=>({state:t,dispatch:e})=>mP(t,e)}},addProseMirrorPlugins(){return[Doe(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Foe=Os.create({name:"starterKit",addExtensions(){var t,e,s,r;const i=[];return this.options.bold!==!1&&i.push(dae.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(iae.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(X6.configure(this.options.bulletList)),this.options.code!==!1&&i.push(mae.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(xae.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(gae.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(Poe.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(Ioe.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(bae.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(yae.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(Voe.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(vae.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(Sae.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Z6.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(iP.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(J6.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(oP.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(uoe.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(poe.configure(this.options.strike)),this.options.text!==!1&&i.push(foe.configure(this.options.text)),this.options.underline!==!1&&i.push(lP.configure((s=this.options)==null?void 0:s.underline)),this.options.trailingNode!==!1&&i.push(zoe.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),Uoe=Foe,Hoe=Os.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(s=>e.updateAttributes(s,{textAlign:t})).some(s=>s):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:s})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?s.unsetTextAlign():s.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),qoe=Hoe,Woe=$oe;function Goe({editor:t}){if(!t)return null;const e=r=>`p-1.5 rounded-lg text-sm transition-colors ${r?"bg-olive text-white":"text-warm-gray hover:bg-cream-dark hover:text-ink"}`,s=j.useCallback(()=>{const r=window.prompt("Enter URL:");r&&t.chain().focus().extendMarkRange("link").setLink({href:r}).run()},[t]);return n.jsxs("div",{className:"flex flex-wrap gap-1 px-3 py-2 border-b border-warm-border bg-cream-light/50 rounded-t-xl",children:[n.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleBold().run(),className:e(t.isActive("bold")),title:"Bold","data-testid":"editor-bold",children:n.jsx("strong",{children:"B"})}),n.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleItalic().run(),className:e(t.isActive("italic")),title:"Italic","data-testid":"editor-italic",children:n.jsx("em",{children:"I"})}),n.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleUnderline().run(),className:e(t.isActive("underline")),title:"Underline","data-testid":"editor-underline",children:n.jsx("u",{children:"U"})}),n.jsx("div",{className:"w-px bg-warm-border mx-1"}),n.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),className:e(t.isActive("heading",{level:2})),title:"Heading","data-testid":"editor-heading",children:"H"}),n.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleBulletList().run(),className:e(t.isActive("bulletList")),title:"Bullet List","data-testid":"editor-bullet-list",children:"• List"}),n.jsx("button",{type:"button",onClick:()=>t.chain().focus().toggleOrderedList().run(),className:e(t.isActive("orderedList")),title:"Numbered List","data-testid":"editor-ordered-list",children:"1. List"}),n.jsx("div",{className:"w-px bg-warm-border mx-1"}),n.jsx("button",{type:"button",onClick:s,className:e(t.isActive("link")),title:"Add Link","data-testid":"editor-link",children:"🔗"}),t.isActive("link")&&n.jsx("button",{type:"button",onClick:()=>t.chain().focus().unsetLink().run(),className:e(!1),title:"Remove Link","data-testid":"editor-unlink",children:"✕"}),n.jsx("div",{className:"w-px bg-warm-border mx-1"}),n.jsx("button",{type:"button",onClick:()=>t.chain().focus().setTextAlign("left").run(),className:e(t.isActive({textAlign:"left"})),title:"Align Left","data-testid":"editor-align-left",children:"≡"}),n.jsx("button",{type:"button",onClick:()=>t.chain().focus().setTextAlign("center").run(),className:e(t.isActive({textAlign:"center"})),title:"Align Center","data-testid":"editor-align-center",children:"≡"}),n.jsx("button",{type:"button",onClick:()=>t.chain().focus().setHorizontalRule().run(),className:e(!1),title:"Horizontal Rule","data-testid":"editor-hr",children:"—"})]})}function Koe({value:t,onChange:e,placeholder:s}){const r=eae({extensions:[Uoe.configure({heading:{levels:[2,3]}}),xoe,Qae.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener noreferrer"}}),qoe.configure({types:["heading","paragraph"]}),Woe.configure({placeholder:s||"Write your message here..."})],content:t||"",onUpdate:({editor:i})=>{e(i.getHTML())}});return j.useEffect(()=>{if(!r)return;if(t===""){r.commands.clearContent();return}const i=r.getHTML();t!==i&&r.commands.setContent(t,!1)},[t,r]),n.jsxs("div",{className:"border border-warm-border rounded-xl overflow-hidden focu
531s-within:ring-2 focus-within:ring-olive/30 focus-within:border-olive",children:[n.jsx(Goe,{editor:r}),n.jsx(L6,{editor:r,className:"prose prose-sm max-w-none px-4 py-3 min-h-[200px] bg-cream-light text-ink [&_.tiptap]:outline-none [&_.tiptap]:min-h-[180px] [&_.tiptap_p.is-editor-empty:first-child::before]:text-warm-gray/50 [&_.tiptap_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)] [&_.tiptap_p.is-editor-empty:first-child::before]:float-left [&_.tiptap_p.is-editor-empty:first-child::before]:h-0 [&_.tiptap_p.is-editor-empty:first-child::before]:pointer-events-none","data-testid":"editor-content"})]})}function Yoe(){const[t,e]=j.useState("stages"),[s,r]=j.useState([]),[i,a]=j.useState(""),[l,d]=j.useState(""),[u,m]=j.useState(""),[p,x]=j.useState(!1),[g,b]=j.useState(""),[v,k]=j.useState(!1),[N,S]=j.useState(null),[A,E]=j.useState(null),[_,T]=j.useState(null),$=ds({queryKey:["/api/admin/clients","for-mass"],queryFn:async()=>{const W=await fetch("/api/admin/clients",{credentials:"include"});if(!W.ok)throw new Error("failed");return W.json()}}),L=ds({queryKey:["/api/admin/mass-emails"],queryFn:async()=>{const W=await fetch("/api/admin/mass-emails",{credentials:"include"});if(!W.ok)throw new Error("failed");return W.json()}}),M=!u||u==="<p></p>"||u.replace(/<[^>]*>/g,"").trim()==="";function I(){return t==="stages"?{mode:"stages",stages:s.length===0?Rc.map(W=>W.key):s}:{mode:"client",clientId:i}}function z(){return l.trim()?M?"Message body is required.":t==="client"&&!i?"Pick a client to send to.":null:"Subject is required."}const ae=Mt({mutationFn:async()=>{const W=await fetch("/api/admin/mass-emails/preview",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(I())}),ie=await W.json();if(!W.ok)throw new Error(ie.error||"Preview failed");return ie},onSuccess:W=>{S(W),k(!0)},onError:W=>T(W.message)}),U=Mt({mutationFn:async()=>{const W=await fetch("/api/admin/mass-emails/send",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...I(),subject:l.trim(),bodyHtml:u})}),ie=await W.json();if(!W.ok)throw new Error(ie.error||"Send failed");return ie},onSuccess:W=>{k(!1),E({kind:"success",message:`Email sent to ${W.totalSent} recipient${W.totalSent===1?"":"s"}${W.totalFailed>0?` (${W.totalFailed} failed)`:""}.`,errors:W.errors}),Wt.invalidateQueries({queryKey:["/api/admin/mass-emails"]}),d(""),m("")},onError:W=>{k(!1),E({kind:"error",message:W.message})}}),Y=Mt({mutationFn:async()=>{const W=await fetch("/api/admin/mass-emails/ai-draft",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({prompt:g,currentSubject:l,currentBodyHtml:u})}),ie=await W.json();if(!W.ok)throw new Error(ie.error||"AI draft failed");return ie},onSuccess:W=>{m(W.bodyHtml),x(!1),b("")}});function P(){T(null),E(null);const W=z();if(W){T(W);return}ae.mutate()}function ne(W){if(W==="all"){r([]);return}r(ie=>ie.includes(W)?ie.filter(he=>he!==W):[...ie,W])}const q=j.useMemo(()=>{if(t==="client"){const ie=$.data?.clients.find(he=>he.id===i);return ie?`Client: ${ie.companyName}`:"Pick a client"}return s.length===0?"All clients (every stage)":`Stages: ${s.map(ie=>Rc.find(he=>he.key===ie)?.label||ie).join(", ")}`},[t,s,i,$.data]);return n.jsxs("div",{className:"px-6 py-8 max-w-4xl mx-auto","data-testid":"page-mass-messaging",children:[n.jsxs("header",{className:"mb-6",children:[n.jsxs("div",{className:"flex items-center gap-2.5 mb-1",children:[n.jsx(Zm,{className:"w-5 h-5 text-olive-dark"}),n.jsx("h1",{className:"text-[20px] font-semibold text-ink",children:"Mass Messaging"})]}),n.jsx("p",{className:"text-[13px] text-warm-gray",children:"Send emails to client contacts by stage or to a specific client."})]}),n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-5 space-y-5",children:[n.jsxs("div",{className:"inline-flex items-center bg-[#f4f1eb] rounded-full p-0.5 text-[12px] font-medium",children:[n.jsx("button",{onClick:()=>{e("stages"),a("")},className:`px-3.5 py-1.5 rounded-full transition-colors ${t==="stages"?"bg-white text-ink shadow-sm":"text-warm-gray hover:text-ink"}`,"data-testid":"mode-stages",children:"By Stage"}),n.jsx("button",{onClick:()=>{e("client"),r([])},className:`px-3.5 py-1.5 rounded-full transition-colors ${t==="client"?"bg-white text-ink shadow-sm":"text-warm-gray hover:text-ink"}`,"data-testid":"mode-client",children:"Single Client"})]}),t==="stages"?n.jsxs("div",{children:[n.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-2",children:"Audience"}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsxs(_E,{active:s.length===0,onClick:()=>ne("all"),testId:"chip-stage-all",children:[n.jsx(wj,{className:"w-3 h-3"})," All Clients"]}),Rc.map(W=>n.jsx(_E,{active:s.includes(W.key),onClick:()=>ne(W.key),testId:`chip-stage-${W.key}`,children:W.label},W.key))]})]}):n.jsxs("div",{children:[n.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-2",children:"Client"}),n.jsxs("select",{value:i,onChange:W=>a(W.target.value),className:"w-full border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] bg-white outline-none focus:border-olive-dark","data-testid":"select-client",children:[n.jsx("option",{value:"",children:"— Select a client —"}),($.data?.clients||[]).slice().sort((W,ie)=>W.companyName.localeCompare(ie.companyName)).map(W=>n.jsx("option",{value:W.id,children:W.companyName},W.id))]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-2",children:"Subject"}
531),n.jsx("input",{value:l,onChange:W=>d(W.target.value),placeholder:"Subject line — supports {{contact_name}} and {{company_name}}",className:"w-full border border-[#e7e3d9] rounded-lg px-3 py-2.5 text-[13px] outline-none focus:border-olive-dark","data-testid":"input-subject"})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"text-[10px] uppercase tracking-wide text-warm-gray font-semibold",children:"Message"}),n.jsxs("button",{onClick:()=>x(W=>!W),className:"inline-flex items-center gap-1.5 text-[11px] px-2.5 py-1 rounded-md border border-[#e7e3d9] text-olive-dark hover:bg-[#f7f5f0]","data-testid":"button-ai-toggle",children:[n.jsx(lo,{className:"w-3.5 h-3.5"})," AI Assist",p?n.jsx(mo,{className:"w-3 h-3"}):n.jsx(no,{className:"w-3 h-3"})]})]}),n.jsx(Koe,{value:u,onChange:m,placeholder:"Compose your message. Use {{contact_name}} or {{company_name}} for personalization."})]}),p&&n.jsxs("div",{className:"bg-[#fafaf6] border border-[#e7e3d9] rounded-xl p-4 space-y-3",children:[n.jsx("p",{className:"text-[12px] text-warm-gray",children:"Tell the AI what to write — if there's already body content, it will rewrite based on your prompt."}),n.jsx("textarea",{value:g,onChange:W=>b(W.target.value),rows:3,placeholder:"e.g. Friendly check-in for free-plan clients about their second week, mention they can book a call",className:"w-full border border-[#e7e3d9] rounded-lg px-3 py-2 text-[13px] bg-white outline-none focus:border-olive-dark","data-testid":"input-ai-prompt"}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{onClick:()=>{x(!1),b("")},className:"text-[12px] px-3 py-1.5 rounded-md text-warm-gray hover:text-ink",children:"Cancel"}),n.jsx("button",{onClick:()=>Y.mutate(),disabled:!g.trim()||Y.isPending,className:"inline-flex items-center gap-1.5 text-[12px] px-3 py-1.5 rounded-md bg-olive-dark text-white disabled:opacity-50","data-testid":"button-ai-generate",children:Y.isPending?n.jsxs(n.Fragment,{children:[n.jsx(Xh,{className:"w-3.5 h-3.5 animate-spin"})," Generating…"]}):n.jsxs(n.Fragment,{children:[n.jsx(lo,{className:"w-3.5 h-3.5"})," Generate Draft"]})})]}),Y.error&&n.jsx("p",{className:"text-[12px] text-red-700",children:Y.error.message})]}),n.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-[#f0ece2]",children:[n.jsx("p",{className:"text-[12px] text-warm-gray",children:q}),n.jsx("button",{onClick:P,disabled:ae.isPending||U.isPending,className:"inline-flex items-center gap-1.5 text-[13px] px-4 py-2 rounded-md bg-olive-dark text-white font-medium disabled:opacity-50","data-testid":"button-preview",children:ae.isPending?n.jsxs(n.Fragment,{children:[n.jsx(Xh,{className:"w-4 h-4 animate-spin"})," Checking…"]}):n.jsxs(n.Fragment,{children:[n.jsx(Lx,{className:"w-4 h-4"})," Preview & Send"]})})]}),_&&n.jsxs("div",{className:"flex items-start gap-2 text-[12px] text-red-700 bg-red-50 border border-red-200 rounded-lg px-3 py-2",children:[n.jsx(Aw,{className:"w-4 h-4 mt-0.5 shrink-0"})," ",_]})]}),A&&n.jsx("div",{className:`mt-4 rounded-xl border p-4 ${A.kind==="success"?"bg-emerald-50 border-emerald-200":"bg-red-50 border-red-200"}`,children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-start gap-2.5",children:[A.kind==="success"?n.jsx(vs,{className:"w-5 h-5 text-emerald-700 mt-0.5 shrink-0"}):n.jsx(Aw,{className:"w-5 h-5 text-red-700 mt-0.5 shrink-0"}),n.jsxs("div",{children:[n.jsx("p",{className:`text-[13px] font-medium ${A.kind==="success"?"text-emerald-800":"text-red-800"}`,children:A.message}),A.errors&&A.errors.length>0&&n.jsxs("details",{className:"mt-2",children:[n.jsxs("summary",{className:"text-[12px] text-warm-gray cursor-pointer",children:["Show ",A.errors.length," failure",A.errors.length===1?"":"s"]}),n.jsx("ul",{className:"mt-2 space-y-1 text-[12px]",children:A.errors.map((W,ie)=>n.jsxs("li",{className:"text-red-800",children:[n.jsx("span",{className:"font-mono",children:W.email})," — ",W.error]},ie))})]})]})]}),n.jsx("button",{onClick:()=>E(null),className:"text-warm-gray hover:text-ink","data-testid":"button-dismiss-banner",children:n.jsx(ro,{className:"w-4 h-4"})})]})}),n.jsxs("section",{className:"mt-8",children:[n.jsx("h2",{className:"text-[14px] font-semibold text-ink mb-3",children:"Sent log"}),L.isLoading?n.jsx("p",{className:"text-[12px] text-warm-gray",children:"Loading…"}):(L.data?.sends||[]).length===0?n.jsx("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-8 text-center",children:n.jsx("p",{className:"text-[13px] text-warm-gray",children:"No mass emails sent yet."})}):n.jsx("div",{className:"space-y-2",children:(L.data?.sends||[]).map(W=>n.jsx(Qoe,{entry:W},W.id))})]}),v&&N&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:()=>!U.isPending&&k(!1),children:n.jsxs("div",{className:"bg-white rounded-2xl border border-[#e7e3d9] p-6 max-w-md w-full",onClick:W=>W.stopPropagation(),"data-testid":"modal-confirm",children:[n.jsx("h3",{className:"text-[16px] font-semibold text-ink mb-1",children:"About to send…"}
531),n.jsx("p",{className:"text-[12px] text-warm-gray mb-4",children:N.targetDescription}),n.jsxs("div",{className:"bg-[#fafaf6] border border-[#e7e3d9] rounded-xl p-5 text-center mb-4",children:[n.jsx("p",{className:"text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:"Recipients"}),n.jsx("p",{className:"text-[40px] font-semibold text-ink leading-none","data-testid":"text-recipient-count",children:N.count}),n.jsxs("p",{className:"text-[12px] text-warm-gray mt-1",children:["unique contact email",N.count===1?"":"s"]})]}),N.count===0?n.jsx("p",{className:"text-[12px] text-amber-800 bg-amber-50 border border-amber-200 rounded-lg px-3 py-2 mb-3",children:"No contacts match this audience. Adjust your selection or add contacts to these clients."}):null,n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{onClick:()=>k(!1),disabled:U.isPending,className:"text-[13px] px-4 py-2 rounded-md text-warm-gray hover:text-ink",children:"Cancel"}),n.jsx("button",{onClick:()=>U.mutate(),disabled:U.isPending||N.count===0,className:"inline-flex items-center gap-1.5 text-[13px] px-4 py-2 rounded-md bg-olive-dark text-white font-medium disabled:opacity-50","data-testid":"button-send-now",children:U.isPending?n.jsxs(n.Fragment,{children:[n.jsx(Xh,{className:"w-4 h-4 animate-spin"})," Sending…"]}):n.jsxs(n.Fragment,{children:[n.jsx(Lx,{className:"w-4 h-4"})," Send Now"]})})]})]})})]})}function _E({active:t,onClick:e,children:s,testId:r}){return n.jsx("button",{onClick:e,"data-testid":r,className:`inline-flex items-center gap-1.5 text-[12px] px-3 py-1.5 rounded-full border transition-colors ${t?"bg-olive-dark text-white border-olive-dark":"bg-white text-ink border-[#e7e3d9] hover:bg-[#f7f5f0]"}`,children:s})}function Qoe({entry:t}){const[e,s]=j.useState(!1),r=new Date(t.createdAt);return n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl","data-testid":`log-entry-${t.id}`,children:[n.jsxs("button",{onClick:()=>s(i=>!i),className:"w-full text-left px-4 py-3 flex items-start gap-3 hover:bg-[#fafaf6] rounded-xl",children:[n.jsx("div",{className:"mt-0.5 text-warm-gray",children:e?n.jsx(mo,{className:"w-4 h-4"}):n.jsx(no,{className:"w-4 h-4"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("p",{className:"text-[13px] font-medium text-ink truncate",children:t.subject}),n.jsxs("span",{className:"text-[11px] text-emerald-700",children:[t.totalSent," sent"]}),t.totalFailed>0&&n.jsxs("span",{className:"text-[11px] text-red-700",children:[t.totalFailed," failed"]})]}),n.jsxs("p",{className:"text-[11px] text-warm-gray mt-0.5",children:[t.targetDescription," · ",t.sentByName," · ",n.jsx("span",{title:r.toLocaleString(),children:Joe(r)})]})]})]}),e&&n.jsxs("div",{className:"border-t border-[#f0ece2] px-4 py-4 space-y-3",children:[n.jsxs("div",{children:[n.jsxs("p",{className:"text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:["Recipients (",t.recipientEmails.length,")"]}),n.jsx("div",{className:"text-[11px] text-ink font-mono bg-[#fafaf6] border border-[#e7e3d9] rounded-lg p-2 max-h-28 overflow-auto",children:t.recipientEmails.join(", ")})]}),n.jsxs("div",{children:[n.jsx("p",{className:"text-[10px] uppercase tracking-wide text-warm-gray font-semibold mb-1",children:"Body"}),n.jsx("div",{className:"prose prose-sm max-w-none text-ink bg-[#fafaf6] border border-[#e7e3d9] rounded-lg p-3",dangerouslySetInnerHTML:{__html:GZ.sanitize(t.bodyHtml,{ALLOWED_TAGS:["p","br","hr","strong","b","em","i","u","s","blockquote","ul","ol","li","a","h1","h2","h3","h4","h5","h6","span","div","code","pre"],ALLOWED_ATTR:["href","target","rel","style","class"]})}})]}),t.errors&&t.errors.length>0&&n.jsxs("div",{children:[n.jsx("p",{className:"text-[10px] uppercase tracking-wide text-red-700 font-semibold mb-1",children:"Failures"}),n.jsx("ul",{className:"text-[11px] space-y-0.5",children:t.errors.map((i,a)=>n.jsxs("li",{className:"text-red-800",children:[n.jsx("span",{className:"font-mono",children:i.email})," — ",i.error]},a))})]})]})]})}function Joe(t){const e=Date.now()-t.getTime(),s=Math.round(e/1e3);if(s<60)return`${s}s ago`;const r=Math.round(s/60);if(r<60)return`${r}m ago`;const i=Math.round(r/60);if(i<24)return`${i}h ago`;const a=Math.round(i/24);return a<7?`${a}d ago`:t.toLocaleDateString()}function Xoe(t,e){return t&&/filename="?([^"]+)"?/i.exec(t)?.[1]||e}async function OE(t,e){const s=await fetch(t,{credentials:"include"});if(!s.ok)throw new Error(`Download failed (${s.status})`);const r=Xoe(s.headers.get("Content-Disposition"),e),i=await s.blob(),a=URL.createObjectURL(i),l=document.createElement("a");l.href=a,l.download=r,document.body.appendChild(l),l.click(),l.remove(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}
531function fw(t){return t.toLocaleString()}function Zoe(){const{data:t,isLoading:e,error:s}=ds({queryKey:["/api/admin/data-export/tables"],queryFn:async()=>{const m=await fetch("/api/admin/data-export/tables",{credentials:"include"});if(!m.ok)throw new Error("Failed to load tables");return m.json()}}),[r,i]=j.useState({}),a=(m,p)=>i(x=>({...x,[m]:p})),l=t?.tables||[],d=async(m,p)=>{const x=`${m}:${p}`;a(x,!0);try{await OE(`/api/admin/data-export/${m}?format=${p}`,`${m}.${p}`)}catch(g){console.error(g),alert("Download failed. Please try again.")}finally{a(x,!1)}},u=async()=>{a("all",!0);try{await OE("/api/admin/data-export/all","workflow-as-export.json")}catch(m){console.error(m),alert("Export failed. Please try again.")}finally{a("all",!1)}};return n.jsxs("div",{className:"px-8 py-8 max-w-[1100px]","data-testid":"page-admin-data-export",children:[n.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] uppercase tracking-wide text-warm-gray font-semibold",children:"Library"}),n.jsx("h1",{className:"font-serif text-2xl text-ink mt-1",children:"Data Export"}),n.jsx("p",{className:"text-[13px] text-warm-gray mt-1",children:"Download your data as CSV or JSON files for backup or analysis."})]}),n.jsxs("button",{onClick:u,disabled:r.all||e||l.length===0,className:"inline-flex items-center gap-2 bg-olive-dark text-white text-[13px] font-semibold px-4 py-2 rounded-lg hover:bg-olive-dark/90 disabled:opacity-50 disabled:cursor-not-allowed","data-testid":"button-export-all",children:[n.jsx(na,{className:"w-4 h-4"}),r.all?"…":"Export All (JSON)"]})]}),n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-4 mb-4 flex items-center gap-8",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-warm-gray font-semibold",children:"Total Tables"}),n.jsx("div",{className:"text-2xl font-serif text-ink mt-0.5","data-testid":"text-total-tables",children:e?"—":fw(t?.totalTables??0)})]}),n.jsx("div",{className:"h-10 w-px bg-[#e7e3d9]"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-warm-gray font-semibold",children:"Total Records"}),n.jsx("div",{className:"text-2xl font-serif text-ink mt-0.5","data-testid":"text-total-records",children:e?"—":fw(t?.totalRecords??0)})]})]}),s&&n.jsx("div",{className:"bg-red-50 border border-red-200 rounded-xl p-4 text-[13px] text-red-700 mb-4",children:"Couldn't load tables. Try refreshing."}),e&&n.jsx("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-12 text-center text-warm-gray text-[13px]",children:"Loading…"}),!e&&l.length>0&&n.jsx("div",{className:"space-y-2",children:l.map(m=>{const p=r[`${m.key}:csv`],x=r[`${m.key}:json`],g=m.recordCount===0;return n.jsxs("div",{className:"bg-white border border-[#e7e3d9] rounded-xl p-4 flex items-center gap-4","data-testid":`row-export-${m.key}`,children:[n.jsx("div",{className:"w-9 h-9 rounded-lg bg-[#f0ece2] flex items-center justify-center text-warm-gray flex-shrink-0",children:n.jsx($A,{className:"w-4 h-4"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"text-ink font-semibold text-[14px]",children:m.label}),n.jsxs("span",{className:`inline-block px-2 py-0.5 rounded-full text-[11px] font-semibold ${g?"bg-[#f0ece2] text-warm-gray":"bg-olive-dark/10 text-olive-dark"}`,"data-testid":`text-count-${m.key}`,children:[fw(m.recordCount)," record",m.recordCount===1?"":"s"]})]}),n.jsx("div",{className:"text-[12px] text-warm-gray mt-0.5",children:m.description})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsxs("button",{onClick:()=>d(m.key,"csv"),disabled:g||p,className:"inline-flex items-center gap-1.5 text-[12px] font-semibold px-3 py-1.5 rounded-full border border-[#e7e3d9] text-ink hover:bg-[#f7f5f0] disabled:opacity-40 disabled:cursor-not-allowed","data-testid":`button-csv-${m.key}`,children:[n.jsx(h9,{className:"w-3.5 h-3.5"}),p?"…":"CSV"]}),n.jsxs("button",{onClick:()=>d(m.key,"json"),disabled:g||x,className:"inline-flex items-center gap-1.5 text-[12px] font-semibold px-3 py-1.5 rounded-full border border-[#e7e3d9] text-ink hover:bg-[#f7f5f0] disabled:opacity-40 disabled:cursor-not-allowed","data-testid":`button-json-${m.key}`,children:[n.jsx(l9,{className:"w-3.5 h-3.5"}),x?"…":"JSON"]})]})]},m.key)})})]})}function RE(t){const e=Date.now()-new Date(t).getTime(),s=Math.floor(e/1e3);if(s<60)return`${s}s ago`;const r=Math.floor(s/60);if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}const DE={requested:"bg-amber-50 text-amber-800 border-amber-200",notified:"bg-emerald-50 text-emerald-700 border-emerald-200",dismissed:"bg-gray-100 text-gray-600 border-gray-200"};function ele(){const[t,e]=j.useState("all"),[s,r]=j.useState("all"),{data:i,isLoading:a}=ds({queryKey:["/api/admin/integration-requests"],queryFn:async()=>{const u=await fetch("/api/admin/integration-requests",{credentials:"include"});if(!u.ok)throw new Error("Failed to load");return u.json()}}),l=Mt({mutationFn:async({id:u,status:m})=>{const p=await fetch(`/api/admin/integration-requests/${u}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:m})});if(!p.ok)throw new Error("Failed to update");return p.json()},onSuccess:()=>{Wt.invalidateQueries({queryKey:["/api/admin/integration-requests"]})}}),d=j.useMemo(()=>(i?.requests||[]).filter(m=>!(t!=="all"&&m.integrationKey!==t||s!=="all"&&m.status!==s)),[i,t,s]);return n.jsxs("div",{className:"px-6 py-6 space-y-6","data-testid":"page-integration-requests",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-[22px] font-black text-ink",children:"Integration Requests"}),n.jsx("p",{className:"text-[13px] text-warm-gray mt-0.5",children:"Early-access requests from portal users for upcoming integrations."})]}),n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[n.jsx(hx,{label:"Total requests",value:i?.totals.totalRequests??
5310}),n.jsx(hx,{label:"Unique clients",value:i?.totals.uniqueClients??0}),n.jsx(hx,{label:"Unique contacts",value:i?.totals.uniqueContacts??0}),n.jsx(hx,{label:"Pending",value:i?.totals.pending??0,accent:"amber"})]}),n.jsxs("section",{className:"bg-white rounded-xl border border-[#e7e3d9] overflow-hidden",children:[n.jsx("header",{className:"px-5 py-3 border-b border-[#f0ece2]",children:n.jsx("h2",{className:"text-[14px] font-bold text-ink",children:"By integration"})}),a?n.jsx("div",{className:"p-6 text-sm text-warm-gray",children:"Loading…"}):(i?.stats.length||0)===0?n.jsx("div",{className:"p-6 text-sm text-warm-gray",children:"No requests yet."}):n.jsxs("table",{className:"w-full text-[13px]",children:[n.jsx("thead",{className:"bg-[#f7f5f0] text-warm-gray",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left px-5 py-2 font-semibold",children:"Integration"}),n.jsx("th",{className:"text-right px-3 py-2 font-semibold",children:"Requests"}),n.jsx("th",{className:"text-right px-3 py-2 font-semibold",children:"Clients"}),n.jsx("th",{className:"text-right px-3 py-2 font-semibold",children:"Contacts"}),n.jsx("th",{className:"text-right px-5 py-2 font-semibold",children:"Last requested"})]})}),n.jsx("tbody",{children:i?.stats.map(u=>n.jsxs("tr",{className:"border-t border-[#f0ece2] hover:bg-[#fbfaf6] cursor-pointer",onClick:()=>e(u.key),"data-testid":`row-integration-${u.key}`,children:[n.jsx("td",{className:"px-5 py-2.5 font-semibold text-ink",children:u.label}),n.jsx("td",{className:"px-3 py-2.5 text-right tabular-nums",children:u.total}),n.jsx("td",{className:"px-3 py-2.5 text-right tabular-nums",children:u.uniqueClients}),n.jsx("td",{className:"px-3 py-2.5 text-right tabular-nums",children:u.uniqueContacts}),n.jsx("td",{className:"px-5 py-2.5 text-right text-warm-gray",children:u.lastRequestedAt?RE(u.lastRequestedAt):"—"})]},u.key))})]})]}),n.jsxs("section",{className:"bg-white rounded-xl border border-[#e7e3d9] overflow-hidden",children:[n.jsxs("header",{className:"px-5 py-3 border-b border-[#f0ece2] flex items-center gap-3 flex-wrap",children:[n.jsx("h2",{className:"text-[14px] font-bold text-ink mr-auto",children:"Requests"}),n.jsxs("select",{className:"text-[12px] bg-[#f7f5f0] border border-[#e7e3d9] rounded-md px-2 py-1",value:t,onChange:u=>e(u.target.value),"data-testid":"select-filter-integration",children:[n.jsx("option",{value:"all",children:"All integrations"}),i?.stats.map(u=>n.jsx("option",{value:u.key,children:u.label},u.key))]}),n.jsxs("select",{className:"text-[12px] bg-[#f7f5f0] border border-[#e7e3d9] rounded-md px-2 py-1",value:s,onChange:u=>r(u.target.value),"data-testid":"select-filter-status",children:[n.jsx("option",{value:"all",children:"All statuses"}),n.jsx("option",{value:"requested",children:"Requested"}),n.jsx("option",{value:"notified",children:"Notified"}),n.jsx("option",{value:"dismissed",children:"Dismissed"})]})]}),d.length===0?n.jsx("div",{className:"p-6 text-sm text-warm-gray",children:"No requests match these filters."}):n.jsxs("table",{className:"w-full text-[13px]",children:[n.jsx("thead",{className:"bg-[#f7f5f0] text-warm-gray",children:n.jsxs("tr",{children:[n.jsx("th",{className:"text-left px-5 py-2 font-semibold",children:"When"}),n.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Integration"}),n.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Client"}),n.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Contact"}),n.jsx("th",{className:"text-left px-3 py-2 font-semibold",children:"Status"}),n.jsx("th",{className:"px-5 py-2"})]})}),n.jsx("tbody",{children:d.map(u=>n.jsxs("tr",{className:"border-t border-[#f0ece2] hover:bg-[#fbfaf6]","data-testid":`row-request-${u.id}`,children:[n.jsx("td",{className:"px-5 py-2.5 text-warm-gray whitespace-nowrap",title:new Date(u.requestedAt).toLocaleString(),children:RE(u.requestedAt)}),n.jsx("td",{className:"px-3 py-2.5 font-semibold text-ink",children:u.integrationLabel}),n.jsxs("td",{className:"px-3 py-2.5",children:[u.companyName?n.jsx(Ae,{href:`/admin/clients/${u.clientId}`,className:"text-olive-dark hover:underline",children:u.companyName}):n.jsx("span",{className:"text-warm-gray",children:"—"}),u.plan&&n.jsx("span",{className:"ml-2 text-[10px] uppercase tracking-wide text-warm-gray/70",children:u.plan})]}),n.jsxs("td",{className:"px-3 py-2.5",children:[n.jsx("div",{className:"text-ink",children:u.contactName||u.contactEmail.split("@")[0]}),n.jsx("div",{className:"text-[11px] text-warm-gray",children:u.contactEmail})]}),n.jsx("td",{className:"px-3 py-2.5",children:n.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[11px] font-semibold border ${DE[u.status]||DE.requested}`,children:u.status})}),n.jsxs("td",{className:"px-5 py-2.5 text-right whitespace-nowrap",children:[u.status!=="notified"&&n.jsx("button",{onClick:()=>l.mutate({id:u.id,status:"notified"}),className:"text-[11px] font-semibold text-olive-dark hover:underline mr-3","data-testid":`button-mark-notified-${u.id}`,children:"Mark notified"}
531),u.status!=="dismissed"&&n.jsx("button",{onClick:()=>l.mutate({id:u.id,status:"dismissed"}),className:"text-[11px] text-warm-gray hover:text-ink hover:underline","data-testid":`button-dismiss-${u.id}`,children:"Dismiss"})]})]},u.id))})]})]})]})}function hx({label:t,value:e,accent:s}){return n.jsxs("div",{className:"bg-white rounded-xl border border-[#e7e3d9] px-4 py-3",children:[n.jsx("div",{className:"text-[11px] uppercase tracking-wide text-warm-gray font-semibold",children:t}),n.jsx("div",{className:`text-[26px] font-black tabular-nums ${s==="amber"?"text-amber-700":"text-ink"}`,children:e})]})}function dr(t,e={}){return(t/100).toLocaleString(void 0,{style:"currency",currency:"USD",maximumFractionDigits:e.fractional?2:0})}function xw(t){return t?new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):"—"}function gw(t){if(!t)return"—";const e=Date.now()-new Date(t).getTime(),s=Math.floor(e/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const r=Math.floor(s/60);if(r<24)return`${r}h ago`;const i=Math.floor(r/24);return i<30?`${i}d ago`:new Date(t).toLocaleDateString()}function PE({status:t}){if(!t)return n.jsx("span",{className:"text-warm-gray text-[11px]",children:"—"});const s={active:"bg-emerald-50 text-emerald-700 border-emerald-200",trialing:"bg-blue-50 text-blue-700 border-blue-200",past_due:"bg-amber-50 text-amber-800 border-amber-200",unpaid:"bg-red-50 text-red-700 border-red-200",canceled:"bg-[#f0ece2] text-warm-gray border-[#e7e3d9]",incomplete:"bg-[#f0ece2] text-warm-gray border-[#e7e3d9]",incomplete_expired:"bg-[#f0ece2] text-warm-gray border-[#e7e3d9]"}[t]||"bg-[#f0ece2] text-warm-gray border-[#e7e3d9]";return n.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-semibold border ${s}`,children:t.replace(/_/g," ")})}function mx({label:t,value:e,hint:s,icon:r,tone:i}){const a=i==="danger"?"border-red-200 bg-red-50/40":i==="warn"?"border-amber-200 bg-amber-50/40":i==="success"?"border-emerald-200 bg-emerald-50/40":"border-[#e7e3d9] bg-white";return n.jsxs("div",{className:`rounded-xl border ${a} p-4`,"data-testid":`kpi-${t.toLowerCase().replace(/\s+/g,"-")}`,children:[n.jsxs("div",{className:"flex items-center gap-2 text-[11px] uppercase tracking-wide text-warm-gray font-semibold",children:[r,n.jsx("span",{children:t})]}),n.jsx("div",{className:"font-serif text-2xl text-ink mt-1 tabular-nums",children:e}),s&&n.jsx("div",{className:"text-[11px] text-warm-gray mt-1",children:s})]})}function Hd({title:t,subtitle:e,action:s,children:r,className:i=""}){return n.jsxs("div",{className:`bg-white border border-[#e7e3d9] rounded-xl p-4 ${i}`,children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-[13px] font-semibold text-ink",children:t}),e&&n.jsx("p",{className:"text-[11px] text-warm-gray mt-0.5",children:e})]}),s]}),r]})}function tle(){const t=nb(),[e,s]=j.useState(null),r=Mt({mutationFn:async()=>{const i=await fetch("/api/admin/stripe/sync-payments",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({maxPages:20})});if(!i.ok)throw new Error((await i.json().catch(()=>({}))).error||"Sync failed");return i.json()},onSuccess:i=>{s(`Synced ${i.mirrored} of ${i.processed} Stripe invoices`),t.invalidateQueries({queryKey:["/api/admin/billing"]}),setTimeout(()=>s(null),5e3)},onError:i=>{s(i?.message||"Sync failed"),setTimeout(()=>s(null),6e3)}});return n.jsxs("div",{className:"flex items-center gap-2",children:[e&&n.jsx("span",{className:"text-[11px] text-warm-gray",children:e}),n.jsxs("button",{onClick:()=>r.mutate(),disabled:r.isPending,className:"text-[12px] px-3 py-1.5 rounded-md border border-[#e7e3d9] text-ink hover:bg-[#f7f5f0] inline-flex items-center gap-1.5 disabled:opacity-60","data-testid":"button-sync-stripe",children:[n.jsx(hb,{className:`w-3.5 h-3.5 ${r.isPending?"animate-spin":""}`}),r.isPending?"Syncing…":"Sync from Stripe"]})]})}function sle(){const{data:t,isLoading:e,error:s}=ds({queryKey:["/api/admin/billing"],queryFn:async()=>{const x=await fetch("/api/admin/billing",{credentials:"include"});if(!x.ok)throw new Error("failed");return x.json()},refetchInterval:3e5,refetchOnWindowFocus:!0,staleTime:3e4}),r=j.useMemo(()=>{const x={};for(const g of Zc)x[g.key]=g.label;return x},[]);if(e||!t)return n.jsx("div",{className:"px-6 py-10 max-w-[1400px] mx-auto","data-testid":"page-admin-billing",children:n.jsx("p",{className:"text-warm-gray text-sm",children:s?"Failed to load billing.":"Loading billing…"})});const{revenue:i,invoices:a,plans:l,subscribers:d,pastDueClients:u,recentPayments:m,recentConsents:p}=t;return n.jsxs("div",{className:"px-6 py-6 max-w-[1400px] mx-auto","data-testid":"page-admin-billing",children:[n.jsxs("div",{className:"flex items-end justify-between mb-6 flex-wrap gap-2",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"font-serif text-3xl text-ink tracking-tight",children:"Billing"}),n.jsxs("p",{className:"text-[12px] text-warm-gray mt-1",children:["Updated ",gw(t.generatedAt)," · ",t.stripeEnabled?"Stripe live":"Stripe disabled"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[t.stripeEnabled&&n.jsx(tle,{}),n.jsx(Ae,{href:"/admin/clients",className:"text-[12px] px-3 py-1.5 rounded-md bg-olive-dark text-white hover:opacity-90",children:"View clients"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-5",children:[n.jsx(mx,{label:"MRR",value:dr(i.mrrCents),hint:`${i.activeSubscribers} active${i.trialingCount?` · ${i.trialingCount} trialing`:""} · ARR ${dr(i.arrCents)}`,icon:n.jsx(bj,{className:"w-4 h-4 text-olive-dark"})}),n.jsx(mx,{label:"Paid YTD",value:dr(i.paidYtdCents),hint:`${dr(i.stripePaidLast30dCents)} via Stripe last 30d`,icon:n.jsx($x,{className:"w-4 h-4 text-emerald-700"}),tone:"success"}),n.jsx(mx,{label:"Past due",value:String(i.pastDueCount),hint:i.pastDueCount>0?`${dr(i.pastDueCents)} at risk`:"No subscriptions past due",icon:n.jsx(oi,{className:`w-4 h-4 ${i.pastDueCount>0?"text-red-700":"text-warm-gray"}`}),tone:i.pastDueCount>0?"danger":void 0}),n.jsx(mx,{label:"Outstanding invoices",value:dr(a.outstandingCents),hint:a.unpaidCount>0?`${a.unpaidCount} unpaid · ${a.overdueCount} overdue · ${a.dueSoonCount} due in 7d`:"Nothing outstanding",icon:n.jsx(c$,{className:`w-4 h-4 ${a.overdueCount>0?"text-amber-700":"text-olive-dark"}`}),tone:a.overdueCount>0?"warn":void 0})]}
531),n.jsx(Hd,{title:"Revenue by plan",subtitle:"Stripe-billable subscriptions only",className:"mb-5",children:n.jsx("div",{className:"overflow-x-auto -mx-4 px-4",children:n.jsxs("table",{className:"w-full text-[12px]",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"text-left text-[10px] uppercase tracking-wide text-warm-gray border-b border-[#f0ece2]",children:[n.jsx("th",{className:"py-2 pr-3 font-semibold",children:"Plan"}),n.jsx("th",{className:"py-2 pr-3 font-semibold",children:"List price"}),n.jsx("th",{className:"py-2 pr-3 font-semibold text-right",children:"Clients"}),n.jsx("th",{className:"py-2 pr-3 font-semibold text-right",children:"Billable subs"}),n.jsx("th",{className:"py-2 pr-3 font-semibold text-right",children:"MRR contribution"})]})}),n.jsxs("tbody",{children:[l.map(x=>n.jsxs("tr",{className:"border-b border-[#f7f5f0] last:border-0","data-testid":`plan-row-${x.plan}`,children:[n.jsx("td",{className:"py-2 pr-3",children:n.jsx(nm,{plan:x.plan})}),n.jsx("td",{className:"py-2 pr-3 text-warm-gray tabular-nums",children:x.priceCents===null?"Custom":x.priceCents===0?"Free":`${dr(x.priceCents)}/mo`}),n.jsx("td",{className:"py-2 pr-3 text-right tabular-nums",children:x.clients}),n.jsx("td",{className:"py-2 pr-3 text-right tabular-nums",children:x.activeSubs}),n.jsx("td",{className:"py-2 pr-3 text-right tabular-nums font-semibold text-ink",children:x.mrrCents>0?dr(x.mrrCents):"—"})]},x.plan)),n.jsxs("tr",{className:"border-t border-[#e7e3d9]",children:[n.jsx("td",{className:"py-2 pr-3 text-[11px] uppercase tracking-wide text-warm-gray font-semibold",children:"Total"}),n.jsx("td",{className:"py-2 pr-3"}),n.jsx("td",{className:"py-2 pr-3 text-right tabular-nums font-semibold",children:l.reduce((x,g)=>x+g.clients,0)}),n.jsx("td",{className:"py-2 pr-3 text-right tabular-nums font-semibold",children:l.reduce((x,g)=>x+g.activeSubs,0)}),n.jsx("td",{className:"py-2 pr-3 text-right tabular-nums font-bold text-ink",children:dr(i.mrrCents)})]})]})]})})}),n.jsxs("div",{className:"grid lg:grid-cols-2 gap-3 mb-5",children:[n.jsx(Hd,{title:"Past-due subscriptions",subtitle:u.length?`${u.length} need attention in Stripe`:"All subscriptions current",children:u.length===0?n.jsx("p",{className:"text-[12px] text-warm-gray",children:"No past-due or unpaid subscriptions."}):n.jsx("div",{className:"space-y-1.5",children:u.map(x=>n.jsxs(Ae,{href:`/admin/clients/${x.id}`,className:"flex items-center justify-between gap-3 px-2 py-2 rounded hover:bg-[#f7f5f0] -mx-2","data-testid":`past-due-${x.id}`,children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[13px] text-ink font-medium truncate",children:x.companyName}),n.jsxs("div",{className:"text-[11px] text-warm-gray flex items-center gap-2",children:[n.jsx(nm,{plan:x.plan}),n.jsx(PE,{status:x.stripeStatus}),x.currentPeriodEnd&&n.jsxs("span",{children:["· period ends ",xw(x.currentPeriodEnd)]})]})]}),n.jsx("div",{className:"text-right text-[12px] tabular-nums text-ink font-semibold shrink-0",children:x.mrrCents>0?`${dr(x.mrrCents)}/mo`:"—"})]},x.id))})}),n.jsx(Hd,{title:"Outstanding invoices",subtitle:a.items.length?`${a.unpaidCount} unpaid · ${dr(a.outstandingCents)} total`:"Nothing outstanding",children:a.items.length===0?n.jsx("p",{className:"text-[12px] text-warm-gray",children:"No unpaid manual invoices on the ledger."}):n.jsx("div",{className:"space-y-1.5",children:a.items.slice(0,8).map(x=>n.jsxs(Ae,{href:`/admin/clients/${x.clientId}?tab=Billing`,className:"flex items-center justify-between gap-3 px-2 py-2 rounded hover:bg-[#f7f5f0] -mx-2","data-testid":`outstanding-inv-${x.id}`,children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"text-[13px] text-ink font-medium truncate",children:[x.companyName,x.invoiceNumber&&n.jsxs("span",{className:"text-warm-gray font-normal",children:[" · ",x.invoiceNumber]})]}),n.jsxs("div",{className:"text-[11px] text-warm-gray flex items-center gap-1.5 flex-wrap",children:[n.jsx("span",{className:"capitalize",children:x.status}),x.dueAt&&n.jsxs(n.Fragment,{children:["· due ",xw(x.dueAt)]}),x.overdue&&n.jsx("span",{className:"px-1 py-0.5 rounded bg-red-50 text-red-700 border border-red-200 text-[10px] font-semibold",children:"OVERDUE"}),x.dueSoon&&n.jsx("span",{className:"px-1 py-0.5 rounded bg-amber-50 text-amber-800 border border-amber-200 text-[10px] font-semibold",children:"DUE SOON"})]})]}),n.jsxs("div",{className:"text-right shrink-0",children:[n.jsx("div",{className:"text-[12px] tabular-nums text-ink font-semibold",children:dr(x.amountCents)}),x.externalUrl&&n.jsxs("a",{href:x.externalUrl,target:"_blank",rel:"noopener noreferrer",onClick:g=>g.stopPropagation(),className:"text-[10px] text-olive-dark hover:underline inline-flex items-center gap-0.5",children:["View ",n.jsx(Px,{className:"w-2.5 h-2.5"})]})]})]},x.id))})})]}),n.jsx(Hd,{title:"Active subscribers",subtitle:`${d.length} client${d.length===1?"":"s"} with a Stripe subscription on file`,className:"mb-5",children:d.length===0?n.jsx("p",{className:"text-[12px] text-warm-gray",children:"No Stripe subscriptions yet."}):n.jsxs("div",{className:"overflow-x-auto -mx-4 px-4",children:[n.jsxs("table",{className:"w-full text-[12px]",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"text-left text-[10px] uppercase tracking-wide text-warm-gray border-b border-[#f0ece2]",children:[n.jsx("th",{className:"py-2 pr-3 font-semibold",children:"Client"}),n.jsx("th",{className:"py-2 pr-3 font-semibold",children:"Plan"}),n.jsx("th",{className:"py-2 pr-3 font-semibold",children:"Status"}),n.jsx("th",{className:"py-2 pr-3 font-semibold",children:"Period ends"}),n.jsx("th",{className:"py-2 pr-3 font-semibold text-right",children:"MRR"})]})}),n.jsx("tbody",{children:d.slice(0,25).map(x=>n.jsxs("tr",{className:"border-b border-[#f7f5f0] last:border-0 hover:bg-[#f7f5f0]/40","data-testid":`subscriber-${x.id}`,children:[n.jsx("td",{className:"py-2 pr-3",children:n.jsx(Ae,{href:`/admin/clients/${x.id}`,className:"text-ink hover:underline font-medium",children:x.companyName})}),n.jsx("td",{className:"py-2 pr-3",children:n.jsx(nm,{plan:x.plan})}),n.jsx("td",{className:"py-2 pr-3",children:n.jsx(PE,{status:x.stripeStatus})}),n.jsx("td",{className:"py-2 pr-3 text-warm-gray",children:xw(x.currentPeriodEnd)}),n.jsx("td",{className:"py-2 pr-3 text-right tabular-nums font-semibold text-ink",children:x.mrrCents>0?dr(x.mrrCents):"—"})]},x.id))})]}),d.length>25&&n.jsxs("p",{className:"text-[11px] text-warm-gray mt-2",children:["Showing 25 of ",d.length,"."]})]})}),n.jsxs("div",{className:"grid lg:grid-cols-2 gap-3",children:[n.jsx(Hd,{title:"Recent Stripe payments",subtitle:"Mirrored from paid Stripe invoices",children:m.length===0?n.jsxs("p",{className:"text-[12px] text-warm-gray",children:["No Stripe payments mirrored yet.",t.stripeEnabled&&" Run “Sync from Stripe” to backfill."]}):n.jsx("div",{className:"space-y-1.5",children:m.map(x=>n.jsxs("div",{className:"flex items-center justify-between gap-3 px-2 py-2 rounded hover:bg-[#f7f5f0] -mx-2","data-testid":`payment-${x.id}`,children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[13px] text-ink font-medium truncate",children:x.clientId?n.jsx(Ae,{href:`/admin/clients/${x.clientId}`,className:"hover:underline",children:x.companyName}):x.companyName}),n.jsxs("div",{className:"text-[11px] text-warm-gray flex items-center gap-2 flex-wrap",children:[n.jsx("span",{children:gw(x.paidAt)}),x.status!=="paid"&&n.jsxs("span",{className:"capitalize",children:["· ",x.status.replace(/_/g," ")
531]}),x.description&&n.jsxs("span",{className:"truncate",children:["· ",x.description]})]})]}),n.jsxs("div",{className:"text-right shrink-0",children:[n.jsx("div",{className:`text-[12px] tabular-nums font-semibold ${x.amountRefundedCents>0?"text-amber-800":"text-ink"}`,children:dr(x.netCents,{fractional:!0})}),x.hostedInvoiceUrl&&n.jsxs("a",{href:x.hostedInvoiceUrl,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-olive-dark hover:underline inline-flex items-center gap-0.5",children:["See receipt ",n.jsx(Px,{className:"w-2.5 h-2.5"})]})]})]},x.id))})}),n.jsx(Hd,{title:"Recent upgrade clicks",subtitle:"In-app paid-conversion attempts (audit trail)",children:p.length===0?n.jsx("p",{className:"text-[12px] text-warm-gray",children:"No upgrade attempts logged yet."}):n.jsx("div",{className:"space-y-1.5",children:p.map(x=>n.jsxs(Ae,{href:`/admin/clients/${x.clientId}?tab=Billing`,className:"flex items-center justify-between gap-3 px-2 py-2 rounded hover:bg-[#f7f5f0] -mx-2","data-testid":`consent-${x.id}`,children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-[13px] text-ink font-medium truncate",children:x.companyName}),n.jsxs("div",{className:"text-[11px] text-warm-gray flex items-center gap-1.5 flex-wrap",children:[n.jsxs("span",{children:[r[x.fromPlan]||x.fromPlan," → ",r[x.toPlan]||x.toPlan]}),x.reason&&n.jsxs("span",{children:["· ",x.reason.replace(/_/g," ")]}),n.jsxs("span",{children:["· ",gw(x.consentedAt)]})]})]}),n.jsx("div",{className:"text-right shrink-0",children:n.jsx("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-semibold border ${x.status==="completed"?"bg-emerald-50 text-emerald-700 border-emerald-200":x.status==="abandoned"?"bg-[#f0ece2] text-warm-gray border-[#e7e3d9]":x.status==="failed"?"bg-red-50 text-red-700 border-red-200":"bg-amber-50 text-amber-800 border-amber-200"}`,children:x.status})})]},x.id))})})]})]})}function IE(){const[t,e]=j.useState(null),[s,r]=j.useState(!0);j.useEffect(()=>{(async()=>{try{const a=await fetch("/api/admin/me",{credentials:"include"});if(a.ok){const l=await a.json();e(l.admin)}}finally{r(!1)}})()},[]);const i=async()=>{await fetch("/api/admin/signout",{method:"POST",credentials:"include"}),e(null)};return s?n.jsx("div",{className:"min-h-screen bg-[#f4f1eb] flex items-center justify-center",children:n.jsx("p",{className:"text-warm-gray text-sm",children:"Loading…"})}):t?n.jsx(RK,{admin:t,onSignOut:i,onAdminUpdated:e,children:n.jsxs(ij,{children:[n.jsx(tt,{path:"/admin",component:jX}),n.jsx(tt,{path:"/admin/clients",component:_X}),n.jsx(tt,{path:"/admin/clients/:id",component:RX}),n.jsx(tt,{path:"/admin/team",component:KX}),n.jsx(tt,{path:"/admin/billing",component:sle}),n.jsx(tt,{path:"/admin/documents",component:jZ}),n.jsx(tt,{path:"/admin/issues",component:ZX}),n.jsx(tt,{path:"/admin/enhancements",component:sZ}),n.jsx(tt,{path:"/admin/data-export",component:Zoe}),n.jsx(tt,{path:"/admin/integration-requests",component:ele}),n.jsx(tt,{path:"/admin/mass-messaging",component:Yoe}),n.jsx(tt,{path:"/admin/app-settings",component:lZ}),n.jsx(tt,{path:"/admin/settings",children:()=>n.jsx(aZ,{onAdminUpdated:e})}),n.jsx(tt,{children:()=>n.jsx(iZ,{title:"Not Found"})})]})}):n.jsx(DK,{onSignIn:e})}function nle(){const[t,e]=j.useState(null),[s,r]=j.useState(null),[i,a]=j.useState(!0),[l,d]=j.useState(null),[u,m]=j.useState(""),[p,x]=j.useState(""),[g,b]=j.useState(!1),[v,k]=j.useState(!1);j.useEffect(()=>{const A=new URLSearchParams(window.location.search).get("token");if(!A){d("Missing token. Please use the link from your email."),a(!1);return}e(A),(async()=>{try{const E=await fetch(`/api/admin/team/token/${encodeURIComponent(A)}`),_=await E.json();E.ok?r(_):d(_.error||"This link is no longer valid.")}catch{d("Network error.")}finally{a(!1)}})()},[]);const N=async S=>{if(S.preventDefault(),d(null),u.length<8){d("Password must be at least 8 characters.");return}if(u!==p){d("Passwords do not match.");return}b(!0);try{const A=await fetch(`/api/admin/team/token/${encodeURIComponent(t)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:u})}),E=await A.json();if(!A.ok){d(E.error||"Failed to set password."),b(!1);return}k(!0)}catch{d("Network error."),b(!1)}};return n.jsx("div",{className:"min-h-screen bg-[#f4f1eb] flex items-center justify-center p-4","data-testid":"page-admin-set-password",children:n.jsxs("div",{className:"w-full max-w-md bg-white border border-[#ddd9d1] rounded-2xl p-8",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-olive-dark flex items-center justify-center text-white font-black",children:"W"}),n.jsx("span",{className:"font-black text-lg text-ink",children:"Workflow Capture"})]}),i&&n.jsx("p",{className:"text-warm-gray text-sm",children:"Validating link…"}),!i&&l&&!s&&n.jsxs(n.Fragment,{children:[n.jsx("h1",{className:"font-serif text-2xl text-ink mb-1",children:"Link unavailable"}),n.jsx("p",{className:"text-warm-gray text-sm mb-6","data-testid":"text-set-password-error",children:l}),n.jsx("a",{href:"/admin",className:"inline-flex items-center justify-center w-full bg-olive-dark hover:bg-olive text-white px-6 py-3 rounded-full font-semibold text-sm",children:"Back to sign in"})]}),!i&&s&&v&&n.jsxs(n.Fragment,{children:[n.jsx("h1",{className:"font-serif text-2xl text-ink mb-1",children:"Password set"}),n.jsx("p",{className:"text-warm-gray text-sm mb-6",children:"You can now sign in to the admin panel with your new password."}),n.jsx("a",{href:"/admin",className:"inline-flex items-center justify-center w-full bg-olive-dark hover:bg-olive text-white px-6 py-3 rounded-full font-semibold text-sm","data-testid":"link-set-password-signin",children:"Go to sign in"})]}),!i&&s&&!v&&n.jsxs("form",{onSubmit:N,children:[n.jsx("h1",{className:"font-serif text-2xl text-ink mb-1",children:s.purpose==="reset"?"Reset your password":"Welcome to the team"}),n.jsxs("p",{className:"text-warm-gray text-sm mb-6",children:[s.purpose==="reset"?"Choose a new password for ":"Set a password for ",n.jsx("span",{className:"font-semibold text-ink",children:s.email}),"."]}),n.jsx("label",{className:"block text-xs font-semibold text-ink mb-1",children:"New password"}),n.jsx("input",{type:"password",value:u,onChange:S=>m(S.target.value),required:!0,minLength:8,autoFocus:!0,className:"w-full bg-white border border-[#ddd9d1] text-ink rounded-lg px-3 py-2.5 text-sm mb-4 outline-none focus:ring-2 focus:ring-olive-dark/30 focus:border-olive-dark","data-testid":"input-set-password"}),n.jsx("label",{className:"block text-xs font-semibold text-ink mb-1",children:"Confirm password"}),n.jsx("input",{type:"password",value:p,onChange:S=>x(S.target.value),required:!0,minLength:8,className:"w-full bg-white border border-[#ddd9d1] text-ink rounded-lg px-3 py-2.5 text-sm mb-4 outline-none focus:ring-2 focus:ring-olive-dark/30 focus:border-olive-dark","data-testid":"input-set-password-confirm"}),l&&n.jsx("div",{role:"alert",className:"text-red-700 text-xs bg-red-50 border border-red-100 rounded-lg px-3 py-2 mb-4","data-testid":"text-set-password-error",children:l}),n.jsx("button",{type:"submit",disabled:g,className:"w-full bg-olive-dark hover:bg-olive disabled:opacity-60 text-white px-6 py-3 rounded-full font-semibold text-sm","data-testid":"button-set-password-submit",children:g?"Saving…":"Set password"})]})]})})}function rle({durations:t}){const[e,s]=j.useState(0);return j.useEffect(()=>{let r,i=!1;const a=Object.values(t),l=d=>{s(d),d===0&&!i&&window.startRecording?.();const u=a[d];r=setTimeout(()=>{const m=d+1;m>=a.length?(i||(window.stopRecording?.(),i=!0),l(0)):l(m)},u)};return l(0),()=>clearTimeout(r)},[]),{currentScene:e}}function ile(){const[t,e]=j.useState(0);return j.useEffect(()=>{const s=[setTimeout(()=>e(1),300),setTimeout(()=>e(2),800),setTimeout(()=>e(3),1500),setTimeout(()=>e(4),2e3),setTimeout(()=>e(5),3200)];return()=>s.forEach(r=>clearTimeout(r))},[]),n.jsxs(G.div,{className:"absolute inset-0 flex",initial:{opacity:0,scale:.95}
531,animate:{opacity:1,scale:1},exit:{opacity:0,x:-50,scale:.98},transition:{duration:.8,ease:[.16,1,.3,1]},children:[n.jsxs(G.div,{className:"w-[18vw] h-full bg-white border-r border-[#E5E2DB] p-6 flex flex-col gap-6",initial:{x:"-100%"},animate:{x:0},transition:{duration:.8,ease:[.16,1,.3,1]},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-[#3D5A3D] to-[#2F472F] flex items-center justify-center text-white font-black text-xl",children:"W"}),n.jsx("div",{className:"h-4 w-24 bg-[#E5E2DB] rounded-full"})]}),n.jsx("div",{className:"flex flex-col gap-3 mt-8",children:[1,2,3,4,5].map(s=>n.jsx("div",{className:`h-10 rounded-lg ${s===1?"bg-[#3D5A3D]/10":"bg-transparent"} flex items-center px-4`,children:n.jsx("div",{className:`h-3 rounded-full ${s===1?"bg-[#3D5A3D] w-20":"bg-[#E5E2DB] w-24"}`})},s))})]}),n.jsxs("div",{className:"flex-1 p-12 flex flex-col relative",children:[n.jsxs(G.div,{className:"mb-8",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,delay:.4},children:[n.jsx("h1",{className:"text-[3vw] font-black text-[#1D1D1F] leading-none mb-2 tracking-tight",style:{fontFamily:"var(--font-display)"},children:"Welcome to Workflow Capture"}),n.jsx("p",{className:"text-[1vw] text-[#6B6B6B]",children:"ACME Corp · Pro Plan · 12 workflows"})]}),n.jsx("div",{className:"flex gap-8",children:n.jsx(G.div,{className:"flex-1 bg-white rounded-2xl border border-[#E5E2DB] shadow-sm overflow-hidden",initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.8,delay:.6,type:"spring",bounce:.2},children:n.jsxs("div",{className:"p-8 bg-gradient-to-br from-[#F5F3EE] via-white to-[#3D5A3D]/5",children:[n.jsxs("div",{className:"flex gap-4",children:[n.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#3D5A3D] to-[#2F472F] text-white flex items-center justify-center font-black text-lg",children:"B"}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-bold text-[#1D1D1F] text-[1.2vw]",children:"Betty"}),n.jsx("p",{className:"text-[0.9vw] text-[#6B6B6B]",children:"Your Workflow Capture assistant"})]})]}),n.jsx(G.div,{className:"mt-6 p-4 rounded-xl bg-white border border-[#E5E2DB] inline-block shadow-sm",initial:{opacity:0,scale:.9},animate:t>=2?{opacity:1,scale:1}:{opacity:0,scale:.9},transition:{duration:.4,type:"spring"},children:n.jsx("p",{className:"text-[#1D1D1F] text-[1vw]",children:"Tell me about a process you want to document..."})})]})})}),n.jsxs(G.div,{className:"mt-8 bg-white rounded-2xl border border-[#E5E2DB] p-6 shadow-sm flex-1",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,delay:1.2},children:[n.jsx("div",{className:"h-6 w-32 bg-[#E5E2DB] rounded-md mb-6"}),n.jsx("div",{className:"space-y-4",children:[1,2].map(s=>n.jsxs("div",{className:"flex items-center justify-between border-b border-[#E5E2DB] pb-4",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-[#3D5A3D]/10"}),n.jsxs("div",{children:[n.jsx("div",{className:"h-4 w-48 bg-[#E5E2DB] rounded-md mb-2"}),n.jsx("div",{className:"h-3 w-24 bg-[#E5E2DB]/50 rounded-md"})]})]}),n.jsx("div",{className:"h-6 w-20 bg-[#3D5A3D]/10 rounded-full"})]},s))})]})]})]})}function ale(){const[t,e]=j.useState(0);return j.useEffect(()=>{const s=[setTimeout(()=>e(1),500),setTimeout(()=>e(2),1200),setTimeout(()=>e(3),2e3),setTimeout(()=>e(4),2800)];return()=>s.forEach(r=>clearTimeout(r))},[]),n.jsxs(G.div,{className:"absolute inset-0 flex items-center justify-center bg-[#1D1D1F]",initial:{clipPath:"circle(0% at 50% 50%)"},animate:{clipPath:"circle(150% at 50% 50%)"},exit:{opacity:0,scale:1.05},transition:{duration:1,ease:[.76,0,.24,1]},children:[n.jsxs("div",{className:"relative w-[70vw] h-[45vw] bg-white rounded-xl shadow-2xl overflow-hidden flex flex-col",children:[n.jsxs("div",{className:"h-12 bg-[#F5F3EE] border-b border-[#E5E2DB] flex items-center px-4 gap-3 relative",children:[n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full bg-red-400"}),n.jsx("div",{className:"w-3 h-3 rounded-full bg-amber-400"}),n.jsx("div",{className:"w-3 h-3 rounded-full bg-green-400"})]}),n.jsx("div",{className:"flex-1 max-w-xl mx-auto h-7 bg-white rounded-md border border-[#
531E5E2DB] flex items-center px-3",children:n.jsx("span",{className:"text-[10px] text-[#6B6B6B]",children:"acmecorp.com/dashboard"})}),n.jsx(G.div,{className:"w-7 h-7 bg-[#3D5A3D] rounded flex items-center justify-center shadow-sm relative z-20",animate:t>=2?{scale:[1,1.2,1],rotate:[0,-10,10,0]}:{},transition:{duration:.5},children:n.jsx("span",{className:"text-white text-[12px] font-bold",children:"W"})})]}),n.jsxs("div",{className:"flex-1 bg-white p-8 relative",children:[n.jsx("div",{className:"w-full h-32 bg-[#F5F3EE] rounded-xl mb-6"}),n.jsxs("div",{className:"flex gap-6",children:[n.jsx("div",{className:"flex-1 h-48 bg-[#F5F3EE] rounded-xl"}),n.jsx("div",{className:"flex-1 h-48 bg-[#F5F3EE] rounded-xl"})]}),t>=3&&n.jsx(G.div,{className:"absolute top-[30%] left-[20%] w-[20vw] h-[10vw] border-4 border-[#3D5A3D]/40 rounded-xl bg-[#3D5A3D]/10",initial:{opacity:0,scale:1.1},animate:{opacity:1,scale:1},transition:{duration:.4}}),t>=4&&n.jsx(G.div,{className:"absolute bottom-[20%] right-[30%] w-[15vw] h-[5vw] border-4 border-[#3D5A3D]/40 rounded-xl bg-[#3D5A3D]/10",initial:{opacity:0,scale:1.1},animate:{opacity:1,scale:1},transition:{duration:.4}}),t>=1&&n.jsxs(G.div,{className:"absolute top-2 right-4 w-72 bg-white rounded-xl shadow-2xl border border-[#E5E2DB] overflow-hidden z-30",initial:{opacity:0,y:-20,scale:.9},animate:{opacity:1,y:0,scale:1},transition:{duration:.4,type:"spring",bounce:.4},children:[n.jsx("div",{className:"p-4 border-b border-[#E5E2DB]",children:n.jsx("h4",{className:"font-bold text-[#1D1D1F]",children:"Workflow Capture"})}),n.jsx("div",{className:"p-4 flex flex-col gap-3",children:n.jsx("div",{className:"h-10 bg-[#3D5A3D] rounded-lg flex items-center justify-center",children:n.jsx("span",{className:"text-white text-sm font-semibold flex items-center gap-2",children:t>=2?n.jsxs(n.Fragment,{children:[n.jsx(G.span,{className:"w-2 h-2 rounded-full bg-red-500 block",animate:{opacity:[1,.5,1]},transition:{repeat:1/0,duration:1}}),"Recording... 0:14"]}):"Start Capture"})})})]}),t>=2&&n.jsxs(G.div,{className:"absolute bottom-6 left-6 bg-[#1D1D1F] text-white px-4 py-2 rounded-full shadow-lg flex items-center gap-3 z-40",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:[n.jsx(G.div,{className:"w-3 h-3 rounded-full bg-red-500",animate:{scale:[1,1.2,1]},transition:{repeat:1/0,duration:1.5}}),n.jsx("span",{className:"text-xs font-mono",children:"REC 00:14"}),n.jsx("div",{className:"w-px h-4 bg-white/20 mx-1"}),n.jsx("span",{className:"text-xs font-semibold text-white/80",children:"Stop"})]})]})]}),n.jsx("div",{className:"absolute bottom-[10vh] left-0 w-full text-center z-50",children:n.jsx(G.h2,{className:"text-[3.5vw] font-black text-white tracking-tight drop-shadow-lg",initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.8,delay:.6},children:"Capture in seconds"})})]})}function ole(){const[t,e]=j.useState(0);return j.useEffect(()=>{const s=[setTimeout(()=>e(1),400),setTimeout(()=>e(2),1e3),setTimeout(()=>e(3),1800),setTimeout(()=>e(4),2500),setTimeout(()=>e(5),3200)];return()=>s.forEach(r=>clearTimeout(r))},[]),n.jsxs(G.div,{className:"absolute inset-0 bg-[#F5F3EE] flex flex-col p-12",initial:{x:"100%"},animate:{x:0},exit:{x:"-100%",opacity:0}
531,transition:{duration:.8,ease:[.16,1,.3,1]},children:[n.jsxs(G.div,{className:"flex items-center justify-between mb-8",initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.6,delay:.3},children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[n.jsx("h1",{className:"text-[2.5vw] font-black text-[#1D1D1F] leading-none tracking-tight",children:"Onboarding New Client"}),n.jsx(G.div,{className:"px-3 py-1 rounded-full bg-amber-50 border border-amber-200 text-amber-800 text-[1vw] font-bold",initial:{scale:0},animate:t>=1?{scale:1}:{scale:0},transition:{type:"spring"},children:"Needs Review"})]}),n.jsx("p",{className:"text-[1vw] text-[#6B6B6B]",children:"14 steps · 2 decision points · Captured 2 mins ago"})]}),n.jsxs("div",{className:"flex gap-3",children:[n.jsx("div",{className:"px-6 py-3 rounded-xl bg-white border border-[#E5E2DB] text-[#1D1D1F] font-semibold text-[1vw]",children:"Edit"}),n.jsx(G.div,{className:"px-6 py-3 rounded-xl bg-[#3D5A3D] text-white font-semibold text-[1vw]",animate:t>=4?{scale:[1,1.05,1],boxShadow:["0px 0px 0px rgba(61,90,61,0)","0px 0px 20px rgba(61,90,61,0.5)","0px 0px 0px rgba(61,90,61,0)"]}:{},transition:{duration:.5},children:"Approve"})]})]}),n.jsxs("div",{className:"flex gap-8 flex-1 min-h-0",children:[n.jsx("div",{className:"flex-[2] bg-white rounded-2xl border border-[#E5E2DB] p-8 shadow-sm overflow-hidden flex flex-col gap-4",children:[{n:1,title:"Navigate to CRM Dashboard",desc:"Open the client portal and click 'New Client'"},{n:2,title:"Enter Company Details",desc:"Fill in the exact legal name and tax ID"},{n:3,title:"Assign Account Manager",type:"logic",desc:"Select from the drop-down based on region"},{n:4,title:"Send Welcome Email",desc:"Trigger the automated welcome sequence"}].map((s,r)=>n.jsxs(G.div,{className:"flex gap-4 p-4 rounded-xl border border-[#E5E2DB] relative overflow-hidden",initial:{opacity:0,x:-20},animate:t>=(r>1?3:2)?{opacity:1,x:0}:{opacity:0,x:-20},transition:{duration:.5,delay:r*.1},children:[t>=4&&r===2&&n.jsx(G.div,{className:"absolute inset-0 bg-[#3D5A3D]/5",initial:{opacity:0}
531,animate:{opacity:1}}),n.jsx("div",{className:"w-8 h-8 rounded-lg bg-[#3D5A3D]/10 text-[#3D5A3D] flex items-center justify-center font-black text-[1vw] shrink-0 z-10",children:s.n}),n.jsxs("div",{className:"z-10",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx("h3",{className:"font-bold text-[#1D1D1F] text-[1.2vw]",children:s.title}),s.type&&n.jsx("span",{className:"px-2 py-0.5 bg-blue-50 text-blue-700 border border-blue-200 rounded text-[0.8vw] font-bold uppercase",children:"Logic"})]}),n.jsx("p",{className:"text-[#6B6B6B] text-[1vw]",children:s.desc})]})]},r))}),n.jsxs(G.div,{className:"flex-1 bg-white rounded-2xl border border-[#E5E2DB] shadow-sm flex flex-col",initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.6,delay:.6},children:[n.jsx("div",{className:"p-4 border-b border-[#E5E2DB] bg-gradient-to-r from-[#F5F3EE] to-white",children:n.jsx("h3",{className:"font-bold text-[#1D1D1F] text-[1vw] uppercase tracking-wider",children:"Narration Transcript"})}),n.jsxs("div",{className:"p-6 flex flex-col gap-6 relative",children:[n.jsx("div",{className:"absolute left-8 top-6 bottom-6 w-px bg-[#E5E2DB]"}),[{time:"0:05",text:"First I go to the CRM and hit New Client."},{time:"0:12",text:"Make sure you use the legal name here, it causes billing issues later if you don't."},{time:"0:24",text:"Then assign the manager based on their timezone."}].map((s,r)=>n.jsxs(G.div,{className:"flex gap-4 relative z-10",initial:{opacity:0}
531,animate:t>=2?{opacity:1}:{opacity:0},transition:{duration:.4,delay:.8+r*.2},children:[n.jsx("div",{className:"w-8 h-4 mt-1 bg-white flex justify-center",children:n.jsx("div",{className:"w-2 h-2 rounded-full bg-[#3D5A3D]"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[0.8vw] font-bold text-[#6B6B6B] mb-1",children:s.time}),n.jsx("div",{className:"text-[1vw] text-[#1D1D1F] bg-slate-50 p-3 rounded-lg border border-slate-100",children:s.text})]})]},r))]})]})]})]})}function lle(){const[t,e]=j.useState(0);return j.useEffect(()=>{const s=[setTimeout(()=>e(1),300),setTimeout(()=>e(2),1e3),setTimeout(()=>e(3),1600),setTimeout(()=>e(4),2400),setTimeout(()=>e(5),3e3)];return()=>s.forEach(r=>clearTimeout(r))},[]),n.jsxs(G.div,{className:"absolute inset-0 bg-[#3D5A3D] flex flex-col p-12 overflow-hidden",initial:{y:"100%"},animate:{y:0},exit:{opacity:0,scale:1.1},transition:{duration:.8,ease:[.16,1,.3,1]},children:[n.jsx(G.div,{className:"absolute top-0 right-0 w-[50vw] h-[50vw] bg-white/5 rounded-full blur-3xl -translate-y-1/2 translate-x-1/4",animate:{scale:[1,1.2,1]},transition:{duration:8,repeat:1/0}}),n.jsxs(G.div,{className:"text-center mt-8 mb-16 relative z-10",initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{delay:.4},children:[n.jsx("h1",{className:"text-[4vw] font-black text-white leading-none tracking-tight",children:"Outputs Generated"}),n.jsx("p",{className:"text-[1.5vw] text-white/70 mt-4",children:"One workflow, three ready-to-use formats."})]}),n.jsx("div",{className:"flex justify-center gap-8 relative z-10 px-12",children:[{title:"Standard SOP",desc:"Step-by-step document for compliance",icon:"📄",format:"PDF / MD"},{title:"Training Guide",desc:"Interactive guide for new hires",icon:"🎓",format:"Web / Embed"},{title:"AI-Ready Script",desc:"Structured JSON for agent automation",icon:"🤖",format:"JSON"}].map((s,r)=>n.jsxs(G.div,{className:"flex-1 bg-white rounded-2xl p-8 shadow-2xl flex flex-col",initial:{opacity:0,y:50,rotateX:-20},animate:t>=2?{opacity:1,y:0,rotateX:0}:{opacity:0,y:50,rotateX:-20},transition:{duration:.6,delay:r*.15,type:"spring",bounce:.3},style:{perspective:1e3},children:[n.jsx("div",{className:"text-[3vw] mb-4",children:s.icon}),n.jsx("h3",{className:"text-[1.8vw] font-black text-[#1D1D1F] leading-tight mb-2",children:s.title}),n.jsx("p",{className:"text-[1vw] text-[#6B6B6B] flex-1",children:s.desc}),n.jsxs(G.div,{className:"mt-6 pt-6 border-t border-[#E5E2DB] flex items-center justify-between",initial:{opacity:0}
531,animate:t>=3?{opacity:1}:{opacity:0},transition:{delay:.8+r*.1},children:[n.jsx("span",{className:"text-[0.9vw] font-bold text-[#6B6B6B]",children:s.format}),n.jsx("div",{className:"w-8 h-8 rounded-full bg-[#3D5A3D]/10 flex items-center justify-center text-[#3D5A3D]",children:n.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})})]})]},r))}),t>=4&&n.jsxs(G.div,{className:"absolute bottom-16 left-1/2 -translate-x-1/2 bg-emerald-500 text-white px-8 py-4 rounded-full shadow-2xl flex items-center gap-4 z-20",initial:{opacity:0,y:20,scale:.8},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",bounce:.5},children:[n.jsx("div",{className:"w-6 h-6 rounded-full bg-white text-emerald-500 flex items-center justify-center font-bold text-sm",children:"✓"}),n.jsx("span",{className:"text-[1.2vw] font-bold tracking-wide uppercase",children:"Workflow Exported"})]})]})}function cle(){const[t,e]=j.useState(0);return j.useEffect(()=>{const s=[setTimeout(()=>e(1),500),setTimeout(()=>e(2),1200)];return()=>s.forEach(r=>clearTimeout(r))},[]),n.jsxs(G.div,{className:"absolute inset-0 bg-[#F5F3EE] flex items-center justify-center",initial:{opacity:0}
531,animate:{opacity:1},exit:{opacity:0},transition:{duration:1},children:[n.jsxs("div",{className:"flex items-center gap-6",children:[n.jsx(G.div,{className:"w-24 h-24 rounded-3xl bg-gradient-to-br from-[#3D5A3D] to-[#2F472F] flex items-center justify-center text-white font-black text-5xl shadow-2xl",initial:{scale:0,rotate:-45},animate:{scale:1,rotate:0},transition:{duration:.8,type:"spring",bounce:.5},children:"W"}),n.jsx(G.div,{className:"overflow-hidden",initial:{width:0},animate:t>=1?{width:"auto"}:{width:0},transition:{duration:.8,ease:[.16,1,.3,1]},children:n.jsx("h1",{className:"text-[5vw] font-black text-[#1D1D1F] whitespace-nowrap px-2",style:{fontFamily:"var(--font-display)"},children:"Workflow Capture"})})]}),n.jsx(G.p,{className:"absolute bottom-[20vh] text-[#6B6B6B] text-[1.5vw] tracking-wider",initial:{opacity:0,y:20},animate:t>=2?{opacity:1,y:0}:{opacity:0,y:20},transition:{duration:.6},children:"workflowcapture.ai"})]})}const dle={dashboard:4e3,capture:4500,review:5e3,export:4500,end:3500};function ule(){const{currentScene:t}=rle({durations:dle});return n.jsxs("div",{className:"relative w-full h-screen overflow-hidden bg-[#F5F3EE] font-sans",children:[n.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[n.jsx(G.div,{className:"absolute w-[80vw] h-[80vw] rounded-full blur-[100px] opacity-10",style:{background:"radial-gradient(circle, #3D5A3D, transparent)"},animate:{x:["-20%","10%","-10%"],y:["-20%","-10%","0%"],scale:[1,1.1,.9]},transition:{duration:15,repeat:1/0,ease:"easeInOut"}}),n.jsx(G.div,{className:"absolute right-0 bottom-0 w-[60vw] h-[60vw] rounded-full blur-[80px] opacity-10",style:{background:"radial-gradient(circle, #6B6B6B, transparent)"},animate:{x:["10%","-10%","0%"],y:["10%","-5%","5%"],scale:[.9,1.1,1]},transition:{duration:12,repeat:1/0,ease:"easeInOut"}})]}),n.jsxs(Rr,{mode:"popLayout",children:[t===0&&n.jsx(ile,{},"dashboard"),t===1&&n.jsx(ale,{},"capture"),t===2&&n.jsx(ole,{},"review"),t===3&&n.jsx(lle,{},"export"),t===4&&n.jsx(cle,{},"end")]})]})}function hle(){const[t]=Al();return j.useEffect(()=>{"scrollRestoration"in history&&(history.scrollRestoration="manual"),window.scrollTo(0,0);const e=setTimeout(()=>window.scrollTo(0,0),0);return()=>clearTimeout(e)},[t]),null}function mle(){return j.useEffect(()=>{window.location.href="/signin"},[]),null}function ple(){return n.jsxs(ij,{children:[n.jsx(tt,{path:"/video",component:ule}),n.jsx(tt,{path:"/workflow-capture",component:MK}),n.jsx(tt,{path:"/workflowcapture",component:Cx}),n.jsx(tt,{path:"/extension-support",component:PG}),n.jsx(tt,{path:"/sop-portal",component:wT}),n.jsx(tt,{path:"/scripts",component:wT}),n.jsx(tt,{path:"/login",component:mle}),n.jsx(tt,{path:"/admin/set-password",component:nle}),n.jsx(tt,{path:"/admin",component:IE}),n.jsx(tt,{path:"/admin/*?",component:IE}),n.jsx(tt,{children:()=>n.jsx(kG,{})})]})}function fle(){return n.jsx(SV,{children:n.jsx(GL,{client:Wt,children:n.jsxs(jV,{children:[n.jsx(hle,{}),n.jsx(zB,{}),n.jsx(ple,{})]})})})}eL.createRoot(document.getElementById("root")).render(n.jsx(fle,{}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.