@qwanyx/stack 0.2.48 → 0.2.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +5 -5
- package/dist/index.esm.js +77 -46
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -44,12 +44,12 @@ ${s}
|
|
|
44
44
|
*/var Hi;function au(){return Hi||(Hi=1,process.env.NODE_ENV!=="production"&&function(){var r=w,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,m="@@iterator";function x(y){if(y===null||typeof y!="object")return null;var R=g&&y[g]||y[m];return typeof R=="function"?R:null}var C=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(y){{for(var R=arguments.length,U=new Array(R>1?R-1:0),Y=1;Y<R;Y++)U[Y-1]=arguments[Y];E("error",y,U)}}function E(y,R,U){{var Y=C.ReactDebugCurrentFrame,oe=Y.getStackAddendum();oe!==""&&(R+="%s",U=U.concat([oe]));var ge=U.map(function(se){return String(se)});ge.unshift("Warning: "+R),Function.prototype.apply.call(console[y],console,ge)}}var D=!1,k=!1,b=!1,_=!1,S=!1,A;A=Symbol.for("react.module.reference");function I(y){return!!(typeof y=="string"||typeof y=="function"||y===n||y===o||S||y===s||y===u||y===c||_||y===h||D||k||b||typeof y=="object"&&y!==null&&(y.$$typeof===f||y.$$typeof===d||y.$$typeof===i||y.$$typeof===l||y.$$typeof===a||y.$$typeof===A||y.getModuleId!==void 0))}function B(y,R,U){var Y=y.displayName;if(Y)return Y;var oe=R.displayName||R.name||"";return oe!==""?U+"("+oe+")":U}function N(y){return y.displayName||"Context"}function j(y){if(y==null)return null;if(typeof y.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof y=="function")return y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case n:return"Fragment";case t:return"Portal";case o:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof y=="object")switch(y.$$typeof){case l:var R=y;return N(R)+".Consumer";case i:var U=y;return N(U._context)+".Provider";case a:return B(y,y.render,"ForwardRef");case d:var Y=y.displayName||null;return Y!==null?Y:j(y.type)||"Memo";case f:{var oe=y,ge=oe._payload,se=oe._init;try{return j(se(ge))}catch{return null}}}return null}var L=Object.assign,z=0,X,ce,ve,le,Le,me,he;function ye(){}ye.__reactDisabledLog=!0;function xe(){{if(z===0){X=console.log,ce=console.info,ve=console.warn,le=console.error,Le=console.group,me=console.groupCollapsed,he=console.groupEnd;var y={configurable:!0,enumerable:!0,value:ye,writable:!0};Object.defineProperties(console,{info:y,log:y,warn:y,error:y,group:y,groupCollapsed:y,groupEnd:y})}z++}}function De(){{if(z--,z===0){var y={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},y,{value:X}),info:L({},y,{value:ce}),warn:L({},y,{value:ve}),error:L({},y,{value:le}),group:L({},y,{value:Le}),groupCollapsed:L({},y,{value:me}),groupEnd:L({},y,{value:he})})}z<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var pe=C.ReactCurrentDispatcher,Ce;function Ne(y,R,U){{if(Ce===void 0)try{throw Error()}catch(oe){var Y=oe.stack.trim().match(/\n( *(at )?)/);Ce=Y&&Y[1]||""}return`
|
|
45
45
|
`+Ce+y}}var ae=!1,Re;{var ot=typeof WeakMap=="function"?WeakMap:Map;Re=new ot}function St(y,R){if(!y||ae)return"";{var U=Re.get(y);if(U!==void 0)return U}var Y;ae=!0;var oe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ge;ge=pe.current,pe.current=null,xe();try{if(R){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(rt){Y=rt}Reflect.construct(y,[],se)}else{try{se.call()}catch(rt){Y=rt}y.call(se.prototype)}}else{try{throw Error()}catch(rt){Y=rt}y()}}catch(rt){if(rt&&Y&&typeof rt.stack=="string"){for(var ie=rt.stack.split(`
|
|
46
46
|
`),Ye=Y.stack.split(`
|
|
47
|
-
`),
|
|
48
|
-
`+ie[
|
|
47
|
+
`),Me=ie.length-1,$e=Ye.length-1;Me>=1&&$e>=0&&ie[Me]!==Ye[$e];)$e--;for(;Me>=1&&$e>=0;Me--,$e--)if(ie[Me]!==Ye[$e]){if(Me!==1||$e!==1)do if(Me--,$e--,$e<0||ie[Me]!==Ye[$e]){var ft=`
|
|
48
|
+
`+ie[Me].replace(" at new "," at ");return y.displayName&&ft.includes("<anonymous>")&&(ft=ft.replace("<anonymous>",y.displayName)),typeof y=="function"&&Re.set(y,ft),ft}while(Me>=1&&$e>=0);break}}}finally{ae=!1,pe.current=ge,De(),Error.prepareStackTrace=oe}var _r=y?y.displayName||y.name:"",ir=_r?Ne(_r):"";return typeof y=="function"&&Re.set(y,ir),ir}function Mt(y,R,U){return St(y,!1)}function tt(y){var R=y.prototype;return!!(R&&R.isReactComponent)}function pt(y,R,U){if(y==null)return"";if(typeof y=="function")return St(y,tt(y));if(typeof y=="string")return Ne(y);switch(y){case u:return Ne("Suspense");case c:return Ne("SuspenseList")}if(typeof y=="object")switch(y.$$typeof){case a:return Mt(y.render);case d:return pt(y.type,R,U);case f:{var Y=y,oe=Y._payload,ge=Y._init;try{return pt(ge(oe),R,U)}catch{}}}return""}var ct=Object.prototype.hasOwnProperty,Ht={},It=C.ReactDebugCurrentFrame;function Et(y){if(y){var R=y._owner,U=pt(y.type,y._source,R?R.type:null);It.setExtraStackFrame(U)}else It.setExtraStackFrame(null)}function kt(y,R,U,Y,oe){{var ge=Function.call.bind(ct);for(var se in y)if(ge(y,se)){var ie=void 0;try{if(typeof y[se]!="function"){var Ye=Error((Y||"React class")+": "+U+" type `"+se+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof y[se]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ye.name="Invariant Violation",Ye}ie=y[se](R,se,Y,U,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Me){ie=Me}ie&&!(ie instanceof Error)&&(Et(oe),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Y||"React class",U,se,typeof ie),Et(null)),ie instanceof Error&&!(ie.message in Ht)&&(Ht[ie.message]=!0,Et(oe),v("Failed %s type: %s",U,ie.message),Et(null))}}}var lt=Array.isArray;function gt(y){return lt(y)}function G(y){{var R=typeof Symbol=="function"&&Symbol.toStringTag,U=R&&y[Symbol.toStringTag]||y.constructor.name||"Object";return U}}function Ee(y){try{return ke(y),!1}catch{return!0}}function ke(y){return""+y}function Se(y){if(Ee(y))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",G(y)),ke(y)}var At=C.ReactCurrentOwner,Tt={key:!0,ref:!0,__self:!0,__source:!0},$t,K;function J(y){if(ct.call(y,"ref")){var R=Object.getOwnPropertyDescriptor(y,"ref").get;if(R&&R.isReactWarning)return!1}return y.ref!==void 0}function Ae(y){if(ct.call(y,"key")){var R=Object.getOwnPropertyDescriptor(y,"key").get;if(R&&R.isReactWarning)return!1}return y.key!==void 0}function Pe(y,R){typeof y.ref=="string"&&At.current}function Oe(y,R){{var U=function(){$t||($t=!0,v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",R))};U.isReactWarning=!0,Object.defineProperty(y,"key",{get:U,configurable:!0})}}function mt(y,R){{var U=function(){K||(K=!0,v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",R))};U.isReactWarning=!0,Object.defineProperty(y,"ref",{get:U,configurable:!0})}}var q=function(y,R,U,Y,oe,ge,se){var ie={$$typeof:e,type:y,key:R,ref:U,props:se,_owner:ge};return ie._store={},Object.defineProperty(ie._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ie,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Y}),Object.defineProperty(ie,"_source",{configurable:!1,enumerable:!1,writable:!1,value:oe}),Object.freeze&&(Object.freeze(ie.props),Object.freeze(ie)),ie};function T(y,R,U,Y,oe){{var ge,se={},ie=null,Ye=null;U!==void 0&&(Se(U),ie=""+U),Ae(R)&&(Se(R.key),ie=""+R.key),J(R)&&(Ye=R.ref,Pe(R,oe));for(ge in R)ct.call(R,ge)&&!Tt.hasOwnProperty(ge)&&(se[ge]=R[ge]);if(y&&y.defaultProps){var Me=y.defaultProps;for(ge in Me)se[ge]===void 0&&(se[ge]=Me[ge])}if(ie||Ye){var $e=typeof y=="function"?y.displayName||y.name||"Unknown":y;ie&&Oe(se,$e),Ye&&mt(se,$e)}return q(y,ie,Ye,oe,Y,At.current,se)}}var H=C.ReactCurrentOwner,Q=C.ReactDebugCurrentFrame;function O(y){if(y){var R=y._owner,U=pt(y.type,y._source,R?R.type:null);Q.setExtraStackFrame(U)}else Q.setExtraStackFrame(null)}var re;re=!1;function Z(y){return typeof y=="object"&&y!==null&&y.$$typeof===e}function ee(){{if(H.current){var y=j(H.current.type);if(y)return`
|
|
49
49
|
|
|
50
50
|
Check the render method of \``+y+"`."}return""}}function de(y){return""}var we={};function te(y){{var R=ee();if(!R){var U=typeof y=="string"?y:y.displayName||y.name;U&&(R=`
|
|
51
51
|
|
|
52
|
-
Check the top-level render call using <`+U+">.")}return R}}function ne(y,R){{if(!y._store||y._store.validated||y.key!=null)return;y._store.validated=!0;var U=te(R);if(we[U])return;we[U]=!0;var Y="";y&&y._owner&&y._owner!==H.current&&(Y=" It was passed a child from "+j(y._owner.type)+"."),O(y),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',U,Y),O(null)}}function Ie(y,R){{if(typeof y!="object")return;if(gt(y))for(var U=0;U<y.length;U++){var Y=y[U];Z(Y)&&ne(Y,R)}else if(Z(y))y._store&&(y._store.validated=!0);else if(y){var oe=x(y);if(typeof oe=="function"&&oe!==y.entries)for(var ge=oe.call(y),se;!(se=ge.next()).done;)Z(se.value)&&ne(se.value,R)}}}function qe(y){{var R=y.type;if(R==null||typeof R=="string")return;var U;if(typeof R=="function")U=R.propTypes;else if(typeof R=="object"&&(R.$$typeof===a||R.$$typeof===d))U=R.propTypes;else return;if(U){var Y=j(R);kt(U,y.props,"prop",Y,y)}else if(R.PropTypes!==void 0&&!re){re=!0;var oe=j(R);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",oe||"Unknown")}typeof R.getDefaultProps=="function"&&!R.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Te(y){{for(var R=Object.keys(y.props),U=0;U<R.length;U++){var Y=R[U];if(Y!=="children"&&Y!=="key"){O(y),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Y),O(null);break}}y.ref!==null&&(O(y),v("Invalid attribute `ref` supplied to `React.Fragment`."),O(null))}}var be={};function He(y,R,U,Y,oe,ge){{var se=I(y);if(!se){var ie="";(y===void 0||typeof y=="object"&&y!==null&&Object.keys(y).length===0)&&(ie+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ye=de();Ye?ie+=Ye:ie+=ee();var
|
|
52
|
+
Check the top-level render call using <`+U+">.")}return R}}function ne(y,R){{if(!y._store||y._store.validated||y.key!=null)return;y._store.validated=!0;var U=te(R);if(we[U])return;we[U]=!0;var Y="";y&&y._owner&&y._owner!==H.current&&(Y=" It was passed a child from "+j(y._owner.type)+"."),O(y),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',U,Y),O(null)}}function Ie(y,R){{if(typeof y!="object")return;if(gt(y))for(var U=0;U<y.length;U++){var Y=y[U];Z(Y)&&ne(Y,R)}else if(Z(y))y._store&&(y._store.validated=!0);else if(y){var oe=x(y);if(typeof oe=="function"&&oe!==y.entries)for(var ge=oe.call(y),se;!(se=ge.next()).done;)Z(se.value)&&ne(se.value,R)}}}function qe(y){{var R=y.type;if(R==null||typeof R=="string")return;var U;if(typeof R=="function")U=R.propTypes;else if(typeof R=="object"&&(R.$$typeof===a||R.$$typeof===d))U=R.propTypes;else return;if(U){var Y=j(R);kt(U,y.props,"prop",Y,y)}else if(R.PropTypes!==void 0&&!re){re=!0;var oe=j(R);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",oe||"Unknown")}typeof R.getDefaultProps=="function"&&!R.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Te(y){{for(var R=Object.keys(y.props),U=0;U<R.length;U++){var Y=R[U];if(Y!=="children"&&Y!=="key"){O(y),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Y),O(null);break}}y.ref!==null&&(O(y),v("Invalid attribute `ref` supplied to `React.Fragment`."),O(null))}}var be={};function He(y,R,U,Y,oe,ge){{var se=I(y);if(!se){var ie="";(y===void 0||typeof y=="object"&&y!==null&&Object.keys(y).length===0)&&(ie+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ye=de();Ye?ie+=Ye:ie+=ee();var Me;y===null?Me="null":gt(y)?Me="array":y!==void 0&&y.$$typeof===e?(Me="<"+(j(y.type)||"Unknown")+" />",ie=" Did you accidentally export a JSX literal instead of a component?"):Me=typeof y,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Me,ie)}var $e=T(y,R,U,oe,ge);if($e==null)return $e;if(se){var ft=R.children;if(ft!==void 0)if(Y)if(gt(ft)){for(var _r=0;_r<ft.length;_r++)Ie(ft[_r],y);Object.freeze&&Object.freeze(ft)}else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ie(ft,y)}if(ct.call(R,"key")){var ir=j(y),rt=Object.keys(R).filter(function(Ra){return Ra!=="key"}),Cs=rt.length>0?"{key: someKey, "+rt.join(": ..., ")+": ...}":"{key: someKey}";if(!be[ir+Cs]){var La=rt.length>0?"{"+rt.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
|
|
53
53
|
let props = %s;
|
|
54
54
|
<%s {...props} />
|
|
55
55
|
React keys must be passed directly to JSX without using spread:
|
|
@@ -58,7 +58,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
58
58
|
flex items-center gap-4 p-4 border-b border-gray-200
|
|
59
59
|
hover:bg-gray-50 transition-colors
|
|
60
60
|
${e?"cursor-pointer":""}
|
|
61
|
-
`,children:[a&&p.jsx("div",{className:"flex-shrink-0",children:p.jsx("img",{src:a,alt:i,className:"w-16 h-16 object-cover rounded-lg"})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:"font-medium text-gray-900 truncate",children:i}),u&&p.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:u})]}),l&&p.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:l})]}),e&&p.jsx("div",{className:"flex-shrink-0 text-gray-400",children:p.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function du({item:r,onClose:e,title:t=o=>o.title||o.name||o.label||"Detail",image:n=o=>o.image||o.thumbnail||o.photo,fields:s=[]}){if(!r)return null;const o=t(r),i=n(r);return p.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:p.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[p.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[p.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o}),e&&p.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:p.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),p.jsxs("div",{className:"p-6",children:[i&&p.jsx("div",{className:"mb-6",children:p.jsx("img",{src:i,alt:o,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&p.jsx("div",{className:"space-y-4",children:s.map((l,a)=>{const u=l.value(r);return u==null||u===""?null:p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:l.label}),p.jsx("div",{className:"text-base text-gray-900",children:typeof u=="object"?JSON.stringify(u,null,2):String(u)})]},a)})}),s.length===0&&p.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&p.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:p.jsx("button",{onClick:e,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const fu={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function hu({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:o="medium",className:i=""}){const l=Math.min(Math.max(e,1),5),[a,u]=w.useState([]),[c,d]=w.useState([]),[f,h]=w.useState(Array(l).fill(!1)),[g,m]=w.useState(Array(l).fill(!1)),x=w.useRef([]),C=w.useCallback(b=>{const _=r.filter(A=>!b.includes(A._id));if(_.length===0)return null;const S=Math.floor(Math.random()*_.length);return _[S]},[r]),v=w.useCallback(()=>Math.random()*(n-t)+t,[t,n]);w.useEffect(()=>{if(r.length===0){u([]),d([]);return}const b=[],_=[],S=[];for(let A=0;A<l&&A<r.length;A++){const I=C(S);I&&(b.push(I),S.push(I._id))}for(let A=0;A<b.length;A++){const I=[b[A]._id,...b.filter((N,j)=>j!==A).map(N=>N._id)],B=C(I);B?_.push(B):_.push(b[A])}u(b),d(_)},[r,l,C]);const E=w.useCallback(b=>{const _=v(),S=setTimeout(()=>{h(A=>{const I=[...A];return I[b]=!I[b],I}),setTimeout(()=>{m(A=>{const I=[...A];return I[b]=!I[b],I}),setTimeout(()=>{const A=!g[b];A&&u(I=>{const B=[...I];return B[b]=c[b],B}),d(I=>{const B=[...I],j=[(A?c[b]:a[b])._id,...a.filter((z,X)=>X!==b).map(z=>z._id),...I.filter((z,X)=>X!==b).map(z=>z._id)],L=C(j);return L&&(B[b]=L),B}),setTimeout(()=>{E(b)},150)},200)},150)},_);x.current[b]=S},[v,C,a,c,g]),D=w.useRef(!1);w.useEffect(()=>{if(!(a.length===0||r.length<=1)&&!D.current){D.current=!0;for(let b=0;b<a.length;b++)E(b);return()=>{x.current.forEach(b=>clearTimeout(b)),x.current=[],D.current=!1}}},[a.length,r.length]);const k=b=>{s&&s(b)};return r.length===0?p.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:p.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):a.length===0?p.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:p.jsx("p",{className:"text-gray-500",children:"Loading..."})}):p.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${i}`,children:a.map((b,_)=>{const S=c[_],A=g[_];return p.jsx("div",{className:`relative ${fu[o]}`,style:{perspective:"1000px"},onClick:()=>k(A?S:b),children:p.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${f[_]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[p.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:A?0:1},children:p.jsxs("div",{style:{transform:f[_]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[p.jsx("img",{src:b.data.image,alt:b.title,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:p.jsx("p",{className:"text-white text-sm font-medium truncate",children:b.title})})]})}),S&&p.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:A?1:0},children:p.jsxs("div",{style:{transform:f[_]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[p.jsx("img",{src:S.data.image,alt:S.title,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:p.jsx("p",{className:"text-white text-sm font-medium truncate",children:S.title})})]})})]})},`slot-${_}`)})})}function vr(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,o)=>{try{if(s.toUpperCase()==="B"){const i=atob(o);return decodeURIComponent(escape(i))}else if(s.toUpperCase()==="Q"){const i=o.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(l,a)=>String.fromCharCode(parseInt(a,16)));return decodeURIComponent(escape(i))}}catch(i){console.warn("MIME decode error:",i)}return t}).replace(/\s+/g," ").trim()}const pu={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function gu({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:o=!0,showDetail:i=!1,showSearch:l=!0,searchQuery:a,onSearchChange:u,emptyMessage:c="No emails",autoLoad:d=!0,onSelect:f,onSelectionChange:h,onDelete:g,onError:m,onLoad:x,renderItem:C,renderDetail:v,renderActions:E,renderEmpty:D,renderLoading:k,theme:b={}}){const _={...pu,...b},[S,A]=w.useState([]),[I,B]=w.useState(!1),[N,j]=w.useState(null),[L,z]=w.useState(new Set),[X,ce]=w.useState(null),[ve,le]=w.useState(null),[Le,me]=w.useState(null),[he,ye]=w.useState(!1),[xe,De]=w.useState(""),pe=a!==void 0?a:xe,Ce=K=>{u?u(K):De(K)},Ne=w.useMemo(()=>{if(!pe.trim())return S;const K=pe.toLowerCase();return S.filter(J=>vr(J.from).toLowerCase().includes(K)||vr(J.subject).toLowerCase().includes(K))},[S,pe]),ae=w.useMemo(()=>e?new ul({baseUrl:r,system_id:e}):null,[r,e]),Re=w.useCallback(async()=>{if(ae){B(!0),j(null);try{const K=await ae.listEmails(t,n,s);K!=null&&K.messages&&(A(K.messages),x==null||x(K.messages))}catch(K){const J=K instanceof Error?K:new Error("Failed to fetch emails");j(J.message),m==null||m(J)}B(!1)}},[ae,t,n,s,m,x]);w.useEffect(()=>{A([]),z(new Set),le(null),j(null),a===void 0&&De(""),d&&Re()},[s,d]);const ot=w.useCallback(async K=>{if(ae){le(K),me(null),ye(!0);try{const J=await ae.getEmailParsed(t,K.uid,s||"INBOX");J!=null&&J.body&&me(J.body)}catch(J){console.error("Failed to fetch email body:",J)}ye(!1)}},[ae,t,s]),St=w.useCallback(K=>{f==null||f(K),i&&ot(K)},[f,i,ot]),Mt=w.useCallback((K,J,Ae)=>{if(!o){f==null||f(K),i&&ot(K);return}const Pe=K.uid;if(Ae.shiftKey&&X!==null){const Me=Math.min(X,J),mt=Math.max(X,J),q=S.slice(Me,mt+1).map(H=>H.uid),T=new Set(q);z(T),h==null||h(Array.from(T))}else if(Ae.ctrlKey||Ae.metaKey)z(Me=>{const mt=new Set(Me);return mt.has(Pe)?mt.delete(Pe):mt.add(Pe),h==null||h(Array.from(mt)),mt}),ce(J);else{const Me=new Set([Pe]);z(Me),ce(J),h==null||h(Array.from(Me))}},[o,X,S,L,f,h,i]),tt=w.useCallback(async()=>{if(!ae||L.size===0)return;const K=s||"INBOX";try{const J=await ae.trashEmails(t,Array.from(L),K);if(console.log("Trash result:",J),J.success&&J.moved>0){A(Pe=>Pe.filter(Me=>!L.has(Me.uid)));const Ae=Array.from(L);z(new Set),g==null||g(Ae)}else j("Failed to move emails to trash")}catch(J){const Ae=J instanceof Error?J:new Error("Trash failed");console.error("Trash error:",Ae),j(Ae.message),m==null||m(Ae)}},[ae,t,L,s,g,m]),pt=w.useCallback(async()=>{if(!ae||L.size===0)return;const K=s||"INBOX";try{const J=await ae.archiveEmails(t,Array.from(L),K);if(console.log("Archive result:",J),J.success&&J.archived>0){A(Pe=>Pe.filter(Me=>!L.has(Me.uid)));const Ae=Array.from(L);z(new Set),g==null||g(Ae)}else j("Failed to archive emails")}catch(J){const Ae=J instanceof Error?J:new Error("Archive failed");console.error("Archive error:",Ae),j(Ae.message),m==null||m(Ae)}},[ae,t,L,s,g,m]),ct=w.useCallback(()=>{if(L.size===S.length)z(new Set),h==null||h([]);else{const K=new Set(S.map(J=>J.uid));z(K),h==null||h(Array.from(K))}},[S,L.size,h]),Ht=w.useCallback(()=>{z(new Set),h==null||h([])},[h]),It={delete:tt,archive:pt,refresh:Re,selectAll:ct,clearSelection:Ht},Et=K=>{if(!K)return"";const J=new Date(K),Ae=new Date;return J.toDateString()===Ae.toDateString()?J.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):J.toLocaleDateString([],{month:"short",day:"numeric"})},kt=(K,J)=>p.jsx("div",{style:{padding:"12px 16px",background:J?_.selectedBackground:K.seen?_.cardBackground:_.unreadBackground,borderBottom:`1px solid ${_.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:K.seen?400:600,color:_.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:vr(K.from).split("@")[0]}),p.jsx("div",{style:{fontSize:"14px",fontWeight:K.seen?400:500,color:K.seen?_.textSecondary:_.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:vr(K.subject)||"(No subject)"})]}),p.jsx("div",{style:{fontSize:"12px",color:_.textSecondary,flexShrink:0},children:Et(K.date)})]})}),lt=K=>p.jsxs("div",{style:{padding:"24px"},children:[p.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:_.text},children:vr(K.subject)||"(No subject)"}),p.jsxs("div",{style:{fontSize:"14px",color:_.textSecondary,marginBottom:"16px"},children:["From: ",vr(K.from)," • ",new Date(K.date).toLocaleString()]}),he?p.jsx("div",{style:{fontSize:"14px",color:_.textSecondary},children:"Loading..."}):Le?p.jsx("div",{style:{fontSize:"14px",color:_.text},dangerouslySetInnerHTML:{__html:Le}}):p.jsx("div",{style:{fontSize:"14px",color:_.textSecondary},children:"No content available"})]}),gt=(K,J)=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:_.cardBackground,borderBottom:`1px solid ${_.border}`},children:[p.jsx("button",{onClick:J.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:_.text},children:K.length===S.length?"Deselect All":"Select All"}),K.length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("span",{style:{fontSize:"13px",color:_.textSecondary},children:[K.length," selected"]}),p.jsx("button",{onClick:J.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),p.jsx("button",{onClick:J.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),p.jsx("div",{style:{flex:1}}),p.jsx("button",{onClick:J.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),G=()=>p.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:c}),Ee=()=>p.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:"Loading..."}),ke=C||kt,Se=v||lt,At=E||gt,Tt=D||G,$t=k||Ee;return I&&S.length===0?p.jsx("div",{style:{background:_.background,width:"100%",height:"100%"},children:$t()}):p.jsxs("div",{style:{display:"flex",background:_.background,width:"100%",height:"100%"},children:[p.jsxs("div",{style:{flex:i&&ve?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:i&&ve?`1px solid ${_.border}`:"none",overflow:"hidden"},children:[o&&At(Array.from(L),It),l&&p.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${_.border}`,background:_.background},children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",background:"#f5f5f5",borderRadius:"6px"},children:[p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:_.textSecondary,strokeWidth:"2",children:[p.jsx("circle",{cx:"11",cy:"11",r:"8"}),p.jsx("path",{d:"M21 21l-4.35-4.35"})]}),p.jsx("input",{type:"text",placeholder:"Search by email or subject...",value:pe,onChange:K=>Ce(K.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:_.text}}),pe&&p.jsx("button",{onClick:()=>Ce(""),style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center"},children:p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:_.textSecondary,strokeWidth:"2",children:p.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),N&&p.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:_.danger,fontSize:"14px",borderBottom:`1px solid ${_.border}`},children:N}),p.jsx("div",{style:{flex:1,overflowY:"auto"},children:Ne.length===0?Tt():Ne.map((K,J)=>p.jsx("div",{onClick:Ae=>Mt(K,J,Ae),onDoubleClick:()=>St(K),children:ke(K,L.has(K.uid))},K.uid))})]}),i&&ve&&p.jsx("div",{style:{flex:1,overflowY:"auto"},children:Se(ve)})]})}function mu({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:o=[],emptyMessage:i="No items",showSelectAll:l=!0,className:a=""}){const[u,c]=w.useState(new Set),[d,f]=w.useState(-1),h=r.filter(D=>u.has(D.id)),g=d>=0&&d<h.length?h[d]:null,m=w.useCallback(D=>{c(k=>{const b=new Set(k);return b.has(D)?b.delete(D):b.add(D),t==null||t(Array.from(b)),b})},[t]),x=w.useCallback(()=>{if(u.size===r.length)c(new Set),f(-1),t==null||t([]);else{const D=new Set(r.map(k=>k.id));c(D),r.length>0&&(f(0),n==null||n(r[0],0)),t==null||t(r.map(k=>k.id))}},[r,u.size,t,n]),C=w.useCallback(()=>{if(h.length===0)return;const D=d<=0?h.length-1:d-1;f(D),n==null||n(h[D],D)},[h,d,n]),v=w.useCallback(()=>{if(h.length===0)return;const D=d>=h.length-1?0:d+1;f(D),n==null||n(h[D],D)},[h,d,n]),E=w.useCallback(D=>{s==null||s(D,h,g)},[s,h,g]);return w.useEffect(()=>{h.length===0?f(-1):d>=h.length?f(h.length-1):d<0&&h.length>0&&(f(0),n==null||n(h[0],0))},[h.length,d,n]),r.length===0?p.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${a}`,children:i}):p.jsxs("div",{className:`space-y-2 ${a}`,children:[p.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[l&&p.jsxs("button",{onClick:x,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[p.jsx("span",{className:"material-icons text-sm",children:u.size===r.length?"check_box":u.size>0?"indeterminate_check_box":"check_box_outline_blank"}),p.jsx("span",{children:u.size===r.length?"Deselect all":"Select all"})]}),u.size>0&&p.jsxs("span",{className:"text-neutral-400",children:["(",u.size," selected)"]})]}),h.length>1&&p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{onClick:C,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:p.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),p.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[d+1," / ",h.length]}),p.jsx("button",{onClick:v,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:p.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),p.jsx("div",{className:"space-y-1",children:r.map(D=>{const k=u.has(D.id),b=(g==null?void 0:g.id)===D.id;return p.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${b?"bg-blue-50 ring-1 ring-blue-200":k?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(D.id),children:[p.jsx("span",{className:`material-icons text-lg ${k?"text-blue-500":"text-neutral-300"}`,children:k?"check_box":"check_box_outline_blank"}),p.jsx("div",{className:"flex-1 min-w-0",children:e(D,k,b)})]},D.id)})}),o.length>0&&u.size>0&&p.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:o.map(D=>{var b;const k=((b=D.disabled)==null?void 0:b.call(D,h))??!1;return p.jsxs("button",{onClick:()=>E(D.id),disabled:k,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${k?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[D.icon&&p.jsx("span",{className:"material-icons text-sm",children:D.icon}),D.label]},D.id)})})]})}function yu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var xu=yu(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const hl=w.createContext(null);function bu(r,e){return{getTheme:function(){return e??null}}}function wt(){const r=w.useContext(hl);return r==null&&xu(8),r}function hn(r){return{}}const ci={},_u={},pl={},ur={},kr={},on={},Ar={},os={},zs={},ln={},an={},vt={},di={},fi={},vu={},gl={},Cu={},ml={},wu={},yl={},xl={},$n={},Du={},bl={},_l={},vl={},Su={},Eu={},ku={},Ji={},Cl={},Au={},wl={},Dl={},Tu={},ls={},hi={},qs={},Bu={},Nu={},kn={},An={},Fu={},ju={},Lu={},Dt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Ru=Dt&&"documentMode"in document?document.documentMode:null,xt=Dt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),tr=Dt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),zn=!(!Dt||!("InputEvent"in window)||Ru)&&"getTargetRanges"in new window.InputEvent("input"),as=Dt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),pn=Dt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Pu=Dt&&/Android/.test(navigator.userAgent),Sl=Dt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ou=Dt&&Pu&&Sl,pi=Dt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Sl,gn=1,nr=3,fr=0,El=1,Nr=2,Mu=0,Iu=1,$u=2,qn=4,Un=8,gi=128,zu=112|(3|qn|Un)|gi,mi=1,yi=2,xi=3,bi=4,_i=5,vi=6,us=as||pn||pi?" ":"",Wt=`
|
|
61
|
+
`,children:[a&&p.jsx("div",{className:"flex-shrink-0",children:p.jsx("img",{src:a,alt:i,className:"w-16 h-16 object-cover rounded-lg"})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:"font-medium text-gray-900 truncate",children:i}),u&&p.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full",children:u})]}),l&&p.jsx("p",{className:"text-sm text-gray-600 truncate mt-0.5",children:l})]}),e&&p.jsx("div",{className:"flex-shrink-0 text-gray-400",children:p.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})}function du({item:r,onClose:e,title:t=o=>o.title||o.name||o.label||"Detail",image:n=o=>o.image||o.thumbnail||o.photo,fields:s=[]}){if(!r)return null;const o=t(r),i=n(r);return p.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:p.jsxs("div",{className:"bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto shadow-2xl",children:[p.jsxs("div",{className:"sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between",children:[p.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o}),e&&p.jsx("button",{onClick:e,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:p.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),p.jsxs("div",{className:"p-6",children:[i&&p.jsx("div",{className:"mb-6",children:p.jsx("img",{src:i,alt:o,className:"w-full h-64 object-cover rounded-lg"})}),s.length>0&&p.jsx("div",{className:"space-y-4",children:s.map((l,a)=>{const u=l.value(r);return u==null||u===""?null:p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium text-gray-500 mb-1",children:l.label}),p.jsx("div",{className:"text-base text-gray-900",children:typeof u=="object"?JSON.stringify(u,null,2):String(u)})]},a)})}),s.length===0&&p.jsx("pre",{className:"bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto",children:JSON.stringify(r,null,2)})]}),e&&p.jsx("div",{className:"sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4",children:p.jsx("button",{onClick:e,className:"w-full px-4 py-2 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors font-medium",children:"Close"})})]})})}const fu={small:"w-32 h-32",medium:"w-48 h-48",large:"w-64 h-64"};function hu({nodes:r,cardCount:e=2,minInterval:t=1e3,maxInterval:n=3e3,onCardClick:s,cardSize:o="medium",className:i=""}){const l=Math.min(Math.max(e,1),5),[a,u]=w.useState([]),[c,d]=w.useState([]),[f,h]=w.useState(Array(l).fill(!1)),[g,m]=w.useState(Array(l).fill(!1)),x=w.useRef([]),C=w.useCallback(b=>{const _=r.filter(A=>!b.includes(A._id));if(_.length===0)return null;const S=Math.floor(Math.random()*_.length);return _[S]},[r]),v=w.useCallback(()=>Math.random()*(n-t)+t,[t,n]);w.useEffect(()=>{if(r.length===0){u([]),d([]);return}const b=[],_=[],S=[];for(let A=0;A<l&&A<r.length;A++){const I=C(S);I&&(b.push(I),S.push(I._id))}for(let A=0;A<b.length;A++){const I=[b[A]._id,...b.filter((N,j)=>j!==A).map(N=>N._id)],B=C(I);B?_.push(B):_.push(b[A])}u(b),d(_)},[r,l,C]);const E=w.useCallback(b=>{const _=v(),S=setTimeout(()=>{h(A=>{const I=[...A];return I[b]=!I[b],I}),setTimeout(()=>{m(A=>{const I=[...A];return I[b]=!I[b],I}),setTimeout(()=>{const A=!g[b];A&&u(I=>{const B=[...I];return B[b]=c[b],B}),d(I=>{const B=[...I],j=[(A?c[b]:a[b])._id,...a.filter((z,X)=>X!==b).map(z=>z._id),...I.filter((z,X)=>X!==b).map(z=>z._id)],L=C(j);return L&&(B[b]=L),B}),setTimeout(()=>{E(b)},150)},200)},150)},_);x.current[b]=S},[v,C,a,c,g]),D=w.useRef(!1);w.useEffect(()=>{if(!(a.length===0||r.length<=1)&&!D.current){D.current=!0;for(let b=0;b<a.length;b++)E(b);return()=>{x.current.forEach(b=>clearTimeout(b)),x.current=[],D.current=!1}}},[a.length,r.length]);const k=b=>{s&&s(b)};return r.length===0?p.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:p.jsx("p",{className:"text-gray-500",children:"No nodes available"})}):a.length===0?p.jsx("div",{className:`flex items-center justify-center p-8 ${i}`,children:p.jsx("p",{className:"text-gray-500",children:"Loading..."})}):p.jsx("div",{className:`flex gap-4 justify-center items-center flex-wrap ${i}`,children:a.map((b,_)=>{const S=c[_],A=g[_];return p.jsx("div",{className:`relative ${fu[o]}`,style:{perspective:"1000px"},onClick:()=>k(A?S:b),children:p.jsxs("div",{className:"w-full h-full rounded-lg shadow-lg overflow-hidden cursor-pointer hover:shadow-xl",style:{transform:`rotateY(${f[_]?180:0}deg)`,transition:"transform 0.5s",transformStyle:"preserve-3d"},children:[p.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:A?0:1},children:p.jsxs("div",{style:{transform:f[_]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[p.jsx("img",{src:b.data.image,alt:b.title,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:p.jsx("p",{className:"text-white text-sm font-medium truncate",children:b.title})})]})}),S&&p.jsx("div",{className:"absolute inset-0 transition-opacity duration-200",style:{opacity:A?1:0},children:p.jsxs("div",{style:{transform:f[_]?"scaleX(-1)":"scaleX(1)",width:"100%",height:"100%"},children:[p.jsx("img",{src:S.data.image,alt:S.title,className:"w-full h-full object-cover"}),p.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:p.jsx("p",{className:"text-white text-sm font-medium truncate",children:S.title})})]})})]})},`slot-${_}`)})})}function vr(r){if(!r)return"";const e=/=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;return r.replace(e,(t,n,s,o)=>{try{if(s.toUpperCase()==="B"){const i=atob(o);return decodeURIComponent(escape(i))}else if(s.toUpperCase()==="Q"){const i=o.replace(/_/g," ").replace(/=([0-9A-Fa-f]{2})/g,(l,a)=>String.fromCharCode(parseInt(a,16)));return decodeURIComponent(escape(i))}}catch(i){console.warn("MIME decode error:",i)}return t}).replace(/\s+/g," ").trim()}const pu={background:"#ffffff",cardBackground:"#ffffff",selectedBackground:"#f5f5f5",unreadBackground:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",danger:"#ef4444"};function gu({baseUrl:r,systemId:e,accountId:t,limit:n=30,folder:s,selectable:o=!0,showDetail:i=!1,showSearch:l=!0,searchQuery:a,onSearchChange:u,emptyMessage:c="No emails",autoLoad:d=!0,onSelect:f,onSelectionChange:h,onDelete:g,onError:m,onLoad:x,renderItem:C,renderDetail:v,renderActions:E,renderEmpty:D,renderLoading:k,theme:b={}}){const _={...pu,...b},[S,A]=w.useState([]),[I,B]=w.useState(!1),[N,j]=w.useState(null),[L,z]=w.useState(new Set),[X,ce]=w.useState(null),[ve,le]=w.useState(null),[Le,me]=w.useState(null),[he,ye]=w.useState(!1),[xe,De]=w.useState(""),pe=a!==void 0?a:xe,Ce=K=>{u?u(K):De(K)},Ne=w.useMemo(()=>{if(!pe.trim())return S;const K=pe.toLowerCase();return S.filter(J=>vr(J.from).toLowerCase().includes(K)||vr(J.subject).toLowerCase().includes(K))},[S,pe]),ae=w.useMemo(()=>e?new ul({baseUrl:r,system_id:e}):null,[r,e]),Re=w.useCallback(async()=>{if(ae){B(!0),j(null);try{const K=await ae.listEmails(t,n,s);K!=null&&K.messages&&(A(K.messages),x==null||x(K.messages))}catch(K){const J=K instanceof Error?K:new Error("Failed to fetch emails");j(J.message),m==null||m(J)}B(!1)}},[ae,t,n,s,m,x]);w.useEffect(()=>{A([]),z(new Set),le(null),j(null),a===void 0&&De(""),d&&Re()},[s,d]);const ot=w.useCallback(async K=>{if(ae){le(K),me(null),ye(!0);try{const J=await ae.getEmailParsed(t,K.uid,s||"INBOX");J!=null&&J.body&&me(J.body)}catch(J){console.error("Failed to fetch email body:",J)}ye(!1)}},[ae,t,s]),St=w.useCallback(K=>{f==null||f(K),i&&ot(K)},[f,i,ot]),Mt=w.useCallback((K,J,Ae)=>{if(!o){f==null||f(K),i&&ot(K);return}const Pe=K.uid;if(Ae.shiftKey&&X!==null){const Oe=Math.min(X,J),mt=Math.max(X,J),q=S.slice(Oe,mt+1).map(H=>H.uid),T=new Set(q);z(T),h==null||h(Array.from(T))}else if(Ae.ctrlKey||Ae.metaKey)z(Oe=>{const mt=new Set(Oe);return mt.has(Pe)?mt.delete(Pe):mt.add(Pe),h==null||h(Array.from(mt)),mt}),ce(J);else{const Oe=new Set([Pe]);z(Oe),ce(J),h==null||h(Array.from(Oe))}},[o,X,S,L,f,h,i]),tt=w.useCallback(async()=>{if(!ae||L.size===0)return;const K=s||"INBOX";try{const J=await ae.trashEmails(t,Array.from(L),K);if(console.log("Trash result:",J),J.success&&J.moved>0){A(Pe=>Pe.filter(Oe=>!L.has(Oe.uid)));const Ae=Array.from(L);z(new Set),g==null||g(Ae)}else j("Failed to move emails to trash")}catch(J){const Ae=J instanceof Error?J:new Error("Trash failed");console.error("Trash error:",Ae),j(Ae.message),m==null||m(Ae)}},[ae,t,L,s,g,m]),pt=w.useCallback(async()=>{if(!ae||L.size===0)return;const K=s||"INBOX";try{const J=await ae.archiveEmails(t,Array.from(L),K);if(console.log("Archive result:",J),J.success&&J.archived>0){A(Pe=>Pe.filter(Oe=>!L.has(Oe.uid)));const Ae=Array.from(L);z(new Set),g==null||g(Ae)}else j("Failed to archive emails")}catch(J){const Ae=J instanceof Error?J:new Error("Archive failed");console.error("Archive error:",Ae),j(Ae.message),m==null||m(Ae)}},[ae,t,L,s,g,m]),ct=w.useCallback(()=>{if(L.size===S.length)z(new Set),h==null||h([]);else{const K=new Set(S.map(J=>J.uid));z(K),h==null||h(Array.from(K))}},[S,L.size,h]),Ht=w.useCallback(()=>{z(new Set),h==null||h([])},[h]),It={delete:tt,archive:pt,refresh:Re,selectAll:ct,clearSelection:Ht},Et=K=>{if(!K)return"";const J=new Date(K),Ae=new Date;return J.toDateString()===Ae.toDateString()?J.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):J.toLocaleDateString([],{month:"short",day:"numeric"})},kt=(K,J)=>p.jsx("div",{style:{padding:"12px 16px",background:J?_.selectedBackground:K.seen?_.cardBackground:_.unreadBackground,borderBottom:`1px solid ${_.border}`,cursor:"pointer",transition:"background 0.15s ease"},children:p.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},children:[p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx("div",{style:{fontSize:"14px",fontWeight:K.seen?400:600,color:_.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:vr(K.from).split("@")[0]}),p.jsx("div",{style:{fontSize:"14px",fontWeight:K.seen?400:500,color:K.seen?_.textSecondary:_.text,marginTop:"2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:vr(K.subject)||"(No subject)"})]}),p.jsx("div",{style:{fontSize:"12px",color:_.textSecondary,flexShrink:0},children:Et(K.date)})]})}),lt=K=>p.jsxs("div",{style:{padding:"24px"},children:[p.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",color:_.text},children:vr(K.subject)||"(No subject)"}),p.jsxs("div",{style:{fontSize:"14px",color:_.textSecondary,marginBottom:"16px"},children:["From: ",vr(K.from)," • ",new Date(K.date).toLocaleString()]}),he?p.jsx("div",{style:{fontSize:"14px",color:_.textSecondary},children:"Loading..."}):Le?p.jsx("div",{style:{fontSize:"14px",color:_.text},dangerouslySetInnerHTML:{__html:Le}}):p.jsx("div",{style:{fontSize:"14px",color:_.textSecondary},children:"No content available"})]}),gt=(K,J)=>p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",background:_.cardBackground,borderBottom:`1px solid ${_.border}`},children:[p.jsx("button",{onClick:J.selectAll,style:{padding:"6px 12px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",fontSize:"13px",cursor:"pointer",color:_.text},children:K.length===S.length?"Deselect All":"Select All"}),K.length>0&&p.jsxs(p.Fragment,{children:[p.jsxs("span",{style:{fontSize:"13px",color:_.textSecondary},children:[K.length," selected"]}),p.jsx("button",{onClick:J.archive,title:"Archive",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"archive"})}),p.jsx("button",{onClick:J.delete,title:"Delete",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"delete"})})]}),p.jsx("div",{style:{flex:1}}),p.jsx("button",{onClick:J.refresh,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",background:"transparent",border:`1px solid ${_.border}`,borderRadius:"6px",cursor:"pointer",color:_.textSecondary},children:p.jsx("span",{className:"material-icons",style:{fontSize:"18px"},children:"refresh"})})]}),G=()=>p.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:c}),Ee=()=>p.jsx("div",{style:{padding:"48px",textAlign:"center",color:_.textSecondary},children:"Loading..."}),ke=C||kt,Se=v||lt,At=E||gt,Tt=D||G,$t=k||Ee;return I&&S.length===0?p.jsx("div",{style:{background:_.background,width:"100%",height:"100%"},children:$t()}):p.jsxs("div",{style:{display:"flex",background:_.background,width:"100%",height:"100%"},children:[p.jsxs("div",{style:{flex:i&&ve?"0 0 50%":"1",display:"flex",flexDirection:"column",borderRight:i&&ve?`1px solid ${_.border}`:"none",overflow:"hidden"},children:[o&&At(Array.from(L),It),l&&p.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${_.border}`,background:_.background},children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",background:"#f5f5f5",borderRadius:"6px"},children:[p.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:_.textSecondary,strokeWidth:"2",children:[p.jsx("circle",{cx:"11",cy:"11",r:"8"}),p.jsx("path",{d:"M21 21l-4.35-4.35"})]}),p.jsx("input",{type:"text",placeholder:"Search by email or subject...",value:pe,onChange:K=>Ce(K.target.value),style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:"13px",color:_.text}}),pe&&p.jsx("button",{onClick:()=>Ce(""),style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center"},children:p.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:_.textSecondary,strokeWidth:"2",children:p.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})}),N&&p.jsx("div",{style:{padding:"12px 16px",background:"#fef2f2",color:_.danger,fontSize:"14px",borderBottom:`1px solid ${_.border}`},children:N}),p.jsx("div",{style:{flex:1,overflowY:"auto"},children:Ne.length===0?Tt():Ne.map((K,J)=>p.jsx("div",{onClick:Ae=>Mt(K,J,Ae),onDoubleClick:()=>St(K),children:ke(K,L.has(K.uid))},K.uid))})]}),i&&ve&&p.jsx("div",{style:{flex:1,overflowY:"auto"},children:Se(ve)})]})}function mu({items:r,renderItem:e,onSelectionChange:t,onCurrentChange:n,onAction:s,actions:o=[],emptyMessage:i="No items",showSelectAll:l=!0,className:a=""}){const[u,c]=w.useState(new Set),[d,f]=w.useState(-1),h=r.filter(D=>u.has(D.id)),g=d>=0&&d<h.length?h[d]:null,m=w.useCallback(D=>{c(k=>{const b=new Set(k);return b.has(D)?b.delete(D):b.add(D),t==null||t(Array.from(b)),b})},[t]),x=w.useCallback(()=>{if(u.size===r.length)c(new Set),f(-1),t==null||t([]);else{const D=new Set(r.map(k=>k.id));c(D),r.length>0&&(f(0),n==null||n(r[0],0)),t==null||t(r.map(k=>k.id))}},[r,u.size,t,n]),C=w.useCallback(()=>{if(h.length===0)return;const D=d<=0?h.length-1:d-1;f(D),n==null||n(h[D],D)},[h,d,n]),v=w.useCallback(()=>{if(h.length===0)return;const D=d>=h.length-1?0:d+1;f(D),n==null||n(h[D],D)},[h,d,n]),E=w.useCallback(D=>{s==null||s(D,h,g)},[s,h,g]);return w.useEffect(()=>{h.length===0?f(-1):d>=h.length?f(h.length-1):d<0&&h.length>0&&(f(0),n==null||n(h[0],0))},[h.length,d,n]),r.length===0?p.jsx("div",{className:`text-sm text-neutral-400 text-center py-4 ${a}`,children:i}):p.jsxs("div",{className:`space-y-2 ${a}`,children:[p.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[l&&p.jsxs("button",{onClick:x,className:"flex items-center gap-1 hover:text-neutral-700 transition-colors",children:[p.jsx("span",{className:"material-icons text-sm",children:u.size===r.length?"check_box":u.size>0?"indeterminate_check_box":"check_box_outline_blank"}),p.jsx("span",{children:u.size===r.length?"Deselect all":"Select all"})]}),u.size>0&&p.jsxs("span",{className:"text-neutral-400",children:["(",u.size," selected)"]})]}),h.length>1&&p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{onClick:C,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Previous",children:p.jsx("span",{className:"material-icons text-sm",children:"chevron_left"})}),p.jsxs("span",{className:"text-xs min-w-[3rem] text-center",children:[d+1," / ",h.length]}),p.jsx("button",{onClick:v,className:"p-1 hover:bg-neutral-100 rounded transition-colors",title:"Next",children:p.jsx("span",{className:"material-icons text-sm",children:"chevron_right"})})]})]}),p.jsx("div",{className:"space-y-1",children:r.map(D=>{const k=u.has(D.id),b=(g==null?void 0:g.id)===D.id;return p.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${b?"bg-blue-50 ring-1 ring-blue-200":k?"bg-neutral-100":"hover:bg-neutral-50"}`,onClick:()=>m(D.id),children:[p.jsx("span",{className:`material-icons text-lg ${k?"text-blue-500":"text-neutral-300"}`,children:k?"check_box":"check_box_outline_blank"}),p.jsx("div",{className:"flex-1 min-w-0",children:e(D,k,b)})]},D.id)})}),o.length>0&&u.size>0&&p.jsx("div",{className:"flex items-center gap-2 pt-2 border-t border-neutral-100",children:o.map(D=>{var b;const k=((b=D.disabled)==null?void 0:b.call(D,h))??!1;return p.jsxs("button",{onClick:()=>E(D.id),disabled:k,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${k?"bg-neutral-100 text-neutral-400 cursor-not-allowed":"bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,children:[D.icon&&p.jsx("span",{className:"material-icons text-sm",children:D.icon}),D.label]},D.id)})})]})}function yu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var xu=yu(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const hl=w.createContext(null);function bu(r,e){return{getTheme:function(){return e??null}}}function wt(){const r=w.useContext(hl);return r==null&&xu(8),r}function hn(r){return{}}const ci={},_u={},pl={},ur={},kr={},on={},Ar={},os={},zs={},ln={},an={},vt={},di={},fi={},vu={},gl={},Cu={},ml={},wu={},yl={},xl={},$n={},Du={},bl={},_l={},vl={},Su={},Eu={},ku={},Ji={},Cl={},Au={},wl={},Dl={},Tu={},ls={},hi={},qs={},Bu={},Nu={},kn={},An={},Fu={},ju={},Lu={},Dt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Ru=Dt&&"documentMode"in document?document.documentMode:null,xt=Dt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),tr=Dt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),zn=!(!Dt||!("InputEvent"in window)||Ru)&&"getTargetRanges"in new window.InputEvent("input"),as=Dt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),pn=Dt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Pu=Dt&&/Android/.test(navigator.userAgent),Sl=Dt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ou=Dt&&Pu&&Sl,pi=Dt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Sl,gn=1,nr=3,fr=0,El=1,Nr=2,Mu=0,Iu=1,$u=2,qn=4,Un=8,gi=128,zu=112|(3|qn|Un)|gi,mi=1,yi=2,xi=3,bi=4,_i=5,vi=6,us=as||pn||pi?" ":"",Wt=`
|
|
62
62
|
|
|
63
63
|
`,qu=tr?" ":us,kl="֑-߿יִ-﷽ﹰ-ﻼ",Al="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Uu=new RegExp("^[^"+Al+"]*["+kl+"]"),Wu=new RegExp("^[^"+kl+"]*["+Al+"]"),hr={bold:1,code:16,highlight:gi,italic:2,strikethrough:qn,subscript:32,superscript:64,underline:Un},Gu={directionless:1,unmergeable:2},Qi={center:yi,end:vi,justify:bi,left:mi,right:xi,start:_i},Ku={[yi]:"center",[vi]:"end",[bi]:"justify",[mi]:"left",[xi]:"right",[_i]:"start"},Vu={normal:0,segmented:2,token:1},Hu={[Mu]:"normal",[$u]:"segmented",[Iu]:"token"};function Ju(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var M=Ju(function(r){const e=new URLSearchParams;e.append("code",r);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${r}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Wn(...r){const e=[];for(const t of r)if(t&&typeof t=="string")for(const[n]of t.matchAll(/\S+/g))e.push(n);return e}const Qu=100;let Us=!1,Ci=0;function Yu(r){Ci=r.timeStamp}function As(r,e,t){const n=r.nodeName==="BR",s=e.__lexicalLineBreak;return s&&(r===s||n&&r.previousSibling===s)||n&&ds(r,t)!==void 0}function Xu(r,e,t){const n=ht(t._window);let s=null,o=null;n!==null&&n.anchorNode===r&&(s=n.anchorOffset,o=n.focusOffset);const i=r.nodeValue;i!==null&&ki(e,i,s,o,!1)}function Zu(r,e,t){if(P(r)){const n=r.anchor.getNode();if(n.is(t)&&r.format!==n.getFormat())return!1}return e.nodeType===nr&&t.isAttached()}function ec(r,e,t,n){for(let s=r;s&&!hc(s);s=yn(s)){const o=ds(s,e);if(o!==void 0){const i=Qe(o,t);if(i)return _e(i)?void 0:[s,i]}else if(s===n)return[n,Ol(t)]}}function Tl(r,e,t){Us=!0;const n=performance.now()-Ci>Qu;try{at(r,()=>{const s=V()||function(f){return f.getEditorState().read(()=>{const h=V();return h!==null?h.clone():null})}(r),o=new Map,i=r.getRootElement(),l=r._editorState,a=r._blockCursorElement;let u=!1,c="";for(let f=0;f<e.length;f++){const h=e[f],g=h.type,m=h.target,x=ec(m,r,l,i);if(!x)continue;const[C,v]=x;if(g==="characterData")n&&$(v)&&Zu(s,m,v)&&Xu(m,v,r);else if(g==="childList"){u=!0;const E=h.addedNodes;for(let b=0;b<E.length;b++){const _=E[b],S=Rl(_),A=_.parentNode;if(A!=null&&_!==a&&S===null&&!As(_,A,r)){if(tr){const I=_.innerText||_.nodeValue;I&&(c+=I)}A.removeChild(_)}}const D=h.removedNodes,k=D.length;if(k>0){let b=0;for(let _=0;_<k;_++){const S=D[_];(As(S,m,r)||a===S)&&(m.appendChild(S),b++)}k!==b&&o.set(C,v)}}}if(o.size>0)for(const[f,h]of o)h.reconcileObservedMutation(f,r);const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],g=h.addedNodes,m=h.target;for(let x=0;x<g.length;x++){const C=g[x],v=C.parentNode;v==null||C.nodeName!=="BR"||As(C,m,r)||v.removeChild(C)}}t.takeRecords()}s!==null&&(u&&(s.dirty=!0,Lt(s)),tr&&zl(r)&&s.insertRawText(c))})}finally{Us=!1}}function Bl(r){const e=r._observer;e!==null&&Tl(r,e.takeRecords(),e)}function Nl(r){(function(e){Ci===0&&hs(e).addEventListener("textInput",Yu,!0)})(r),r._observer=new MutationObserver((e,t)=>{Tl(r,e,t)})}function Yi(r,e){const t=r.__mode,n=r.__format,s=r.__style,o=e.__mode,i=e.__format,l=e.__style;return!(t!==null&&t!==o||n!==null&&n!==i||s!==null&&s!==l)}function Xi(r,e){const t=r.mergeWithSibling(e),n=je()._normalizedNodes;return n.add(r.__key),n.add(e.__key),t}function Zi(r){let e,t,n=r;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&$(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Yi(e,n)){n=Xi(e,n);break}break}e.remove()}for(;(t=n.getNextSibling())!==null&&$(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Yi(n,t)){n=Xi(n,t);break}break}t.remove()}}else n.remove()}function Fl(r){return eo(r.anchor),eo(r.focus),r}function eo(r){for(;r.type==="element";){const e=r.getNode(),t=r.offset;let n,s;if(t===e.getChildrenSize()?(n=e.getChildAtIndex(t-1),s=!0):(n=e.getChildAtIndex(t),s=!1),$(n)){r.set(n.__key,s?n.getTextContentSize():0,"text");break}if(!F(n))break;r.set(n.__key,s?n.getChildrenSize():0,"element")}}let tc=1;const rc=typeof queueMicrotask=="function"?queueMicrotask:r=>{Promise.resolve().then(r)};function wi(r){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return _e(Fr(r))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&cs(e)==null)}function mn(r,e,t){const n=r.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(t)&&e!==null&&!wi(e)&&jl(e)===r}catch{return!1}}function Di(r){return r instanceof xs}function jl(r){let e=r;for(;e!=null;){const t=cs(e);if(Di(t))return t;e=yn(e)}return null}function cs(r){return r?r.__lexicalEditor:null}function lr(r){return r.isToken()||r.isSegmented()}function nc(r){return r.nodeType===nr}function Gn(r){let e=r;for(;e!=null;){if(nc(e))return e;e=e.firstChild}return null}function Kn(r,e,t){const n=hr[e];if(t!==null&&(r&n)==(t&n))return r;let s=r^n;return e==="subscript"?s&=-65:e==="superscript"&&(s&=-33),s}function Ll(r){return $(r)||dr(r)||_e(r)}function sc(r,e){if(e!=null)return void(r.__key=e);nt(),aa();const t=je(),n=Kt(),s=""+tc++;n._nodeMap.set(s,r),F(r)?t._dirtyElements.set(s,!0):t._dirtyLeaves.add(s),t._cloneNotNeeded.add(s),t._dirtyType=El,r.__key=s}function cr(r){const e=r.getParent();if(e!==null){const t=r.getWritable(),n=e.getWritable(),s=r.getPreviousSibling(),o=r.getNextSibling();if(s===null)if(o!==null){const i=o.getWritable();n.__first=o.__key,i.__prev=null}else n.__first=null;else{const i=s.getWritable();if(o!==null){const l=o.getWritable();l.__prev=i.__key,i.__next=l.__key}else i.__next=null;t.__prev=null}if(o===null)if(s!==null){const i=s.getWritable();n.__last=s.__key,i.__next=null}else n.__last=null;else{const i=o.getWritable();if(s!==null){const l=s.getWritable();l.__next=i.__key,i.__prev=l.__key}else i.__prev=null;t.__next=null}n.__size--,t.__parent=null}}function Vn(r){aa();const e=r.getLatest(),t=e.__parent,n=Kt(),s=je(),o=n._nodeMap,i=s._dirtyElements;t!==null&&function(a,u,c){let d=a;for(;d!==null;){if(c.has(d))return;const f=u.get(d);if(f===void 0)break;c.set(d,!1),d=f.__parent}}(t,o,i);const l=e.__key;s._dirtyType=El,F(r)?i.set(l,!0):s._dirtyLeaves.add(l)}function Ve(r){nt();const e=je(),t=e._compositionKey;if(r!==t){if(e._compositionKey=r,t!==null){const n=Qe(t);n!==null&&n.getWritable()}if(r!==null){const n=Qe(r);n!==null&&n.getWritable()}}}function Xt(){return Cn()?null:je()._compositionKey}function Qe(r,e){const t=(e||Kt())._nodeMap.get(r);return t===void 0?null:t}function Rl(r,e){const t=ds(r,je());return t!==void 0?Qe(t,e):null}function ds(r,e){return r[`__lexicalKey_${e._key}`]}function Fr(r,e){let t=r;for(;t!=null;){const n=Rl(t,e);if(n!==null)return n;t=yn(t)}return null}function Pl(r){const e=r._decorators,t=Object.assign({},e);return r._pendingDecorators=t,t}function to(r){return r.read(()=>Be().getTextContent())}function Be(){return Ol(Kt())}function Ol(r){return r._nodeMap.get("root")}function Lt(r){nt();const e=Kt();r!==null&&(r.dirty=!0,r.setCachedNodes(null)),e._selection=r}function Sr(r){const e=je(),t=function(n,s){let o=n;for(;o!=null;){const i=ds(o,s);if(i!==void 0)return i;o=yn(o)}return null}(r,e);return t===null?r===e.getRootElement()?Qe("root"):null:Qe(t)}function ro(r,e){return e?r.getTextContentSize():0}function Ml(r){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(r)}function Si(r){const e=[];let t=r;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Il(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function $l(r){return r.nodeType===nr?r.nodeValue:null}function Ei(r,e,t){const n=ht(e._window);if(n===null)return;const s=n.anchorNode;let{anchorOffset:o,focusOffset:i}=n;if(s!==null){let l=$l(s);const a=Fr(s);if(l!==null&&$(a)){if(l===us&&t){const u=t.length;l=t,o=u,i=u}l!==null&&ki(a,l,o,i,r)}}}function ki(r,e,t,n,s){let o=r;if(o.isAttached()&&(s||!o.isDirty())){const i=o.isComposing();let l=e;(i||s)&&e[e.length-1]===us&&(l=e.slice(0,-1));const a=o.getTextContent();if(s||l!==a){if(l===""){if(Ve(null),as||pn||pi)o.remove();else{const m=je();setTimeout(()=>{m.update(()=>{o.isAttached()&&o.remove()})},20)}return}const u=o.getParent(),c=vn(),d=o.getTextContentSize(),f=Xt(),h=o.getKey();if(o.isToken()||f!==null&&h===f&&!i||P(c)&&(u!==null&&!u.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===r.__key&&c.anchor.offset===0&&!o.canInsertTextBefore()&&!i||c.focus.key===r.__key&&c.focus.offset===d&&!o.canInsertTextAfter()&&!i))return void o.markDirty();const g=V();if(!P(g)||t===null||n===null)return void o.setTextContent(l);if(g.setTextNodeRange(o,t,o,n),o.isSegmented()){const m=Ue(o.getTextContent());o.replace(m),o=m}o.setTextContent(l)}}}function ic(r,e){if(e.isSegmented())return!0;if(!r.isCollapsed())return!1;const t=r.anchor.offset,n=e.getParentOrThrow(),s=e.isToken();return t===0?!e.canInsertTextBefore()||!n.canInsertTextBefore()&&!e.isComposing()||s||function(o){const i=o.getPreviousSibling();return($(i)||F(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!n.canInsertTextAfter()&&!e.isComposing()||s)}function no(r){return r==="ArrowLeft"}function so(r){return r==="ArrowRight"}function Vr(r,e){return xt?r:e}function io(r){return r==="Enter"}function zr(r){return r==="Backspace"}function qr(r){return r==="Delete"}function oo(r,e,t){return r.toLowerCase()==="a"&&Vr(e,t)}function oc(){const r=Be();Lt(Fl(r.select(0,r.getChildrenSize())))}function Zr(r,e){r.__lexicalClassNameCache===void 0&&(r.__lexicalClassNameCache={});const t=r.__lexicalClassNameCache,n=t[e];if(n!==void 0)return n;const s=r[e];if(typeof s=="string"){const o=Wn(s);return t[e]=o,o}return s}function Ai(r,e,t,n,s){if(t.size===0)return;const o=n.__type,i=n.__key,l=e.get(o);l===void 0&&M(33,o);const a=l.klass;let u=r.get(a);u===void 0&&(u=new Map,r.set(a,u));const c=u.get(i),d=c==="destroyed"&&s==="created";(c===void 0||d)&&u.set(i,d?"updated":s)}function lo(r,e,t){const n=r.getParent();let s=t,o=r;return n!==null&&(e&&t===0?(s=o.getIndexWithinParent(),o=n):e||t!==o.getChildrenSize()||(s=o.getIndexWithinParent()+1,o=n)),o.getChildAtIndex(e?s-1:s)}function un(r,e){const t=r.offset;if(r.type==="element")return lo(r.getNode(),e,t);{const n=r.getNode();if(e&&t===0||!e&&t===n.getTextContentSize()){const s=e?n.getPreviousSibling():n.getNextSibling();return s===null?lo(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):s}}return null}function zl(r){const e=hs(r).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function W(r,e,t){return da(r,e,t)}function fs(r){return!Ze(r)&&!r.isLastChild()&&!r.isInline()}function Hn(r,e){const t=r._keyToDOMMap.get(e);return t===void 0&&M(75,e),t}function yn(r){const e=r.assignedSlot||r.parentElement;return e!==null&&e.nodeType===11?e.host:e}function en(r,e){let t=r.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function hs(r){const e=r._window;return e===null&&M(78),e}function lc(r){let e=r.getParentOrThrow();for(;e!==null;){if(Rt(e))return e;e=e.getParentOrThrow()}return e}function Rt(r){return Ze(r)||F(r)&&r.isShadowRoot()}function Ot(r){const e=je(),t=r.constructor.getType(),n=e._nodes.get(t);n===void 0&&M(200,r.constructor.name,t);const{replace:s,replaceWithKlass:o}=n;if(s!==null){const i=s(r),l=i.constructor;return o!==null?i instanceof o||M(201,o.name,o.getType(),l.name,l.getType(),r.constructor.name,t):i instanceof r.constructor&&l!==r.constructor||M(202,l.name,l.getType(),r.constructor.name,t),i.__key===r.__key&&M(203,r.constructor.name,t,l.name,l.getType()),i}return r}function Ts(r,e){!Ze(r.getParent())||F(e)||_e(e)||M(99)}function Bs(r){return(_e(r)||F(r)&&!r.canBeEmpty())&&!r.isInline()}function Ti(r,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const n=r.parentElement;n!==null&&n.removeChild(r)}function ac(r,e,t){let n=r._blockCursorElement;if(P(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const s=t.anchor,o=s.getNode(),i=s.offset;let l=!1,a=null;if(i===o.getChildrenSize())Bs(o.getChildAtIndex(i-1))&&(l=!0);else{const u=o.getChildAtIndex(i);if(u!==null&&Bs(u)){const c=u.getPreviousSibling();(c===null||Bs(c))&&(l=!0,a=r.getElementByKey(u.__key))}}if(l){const u=r.getElementByKey(o.__key);return n===null&&(r._blockCursorElement=n=function(c){const d=c.theme,f=document.createElement("div");f.contentEditable="false",f.setAttribute("data-lexical-cursor","true");let h=d.blockCursor;if(h!==void 0){if(typeof h=="string"){const g=Wn(h);h=d.blockCursor=g}h!==void 0&&f.classList.add(...h)}return f}(r._config)),e.style.caretColor="transparent",void(a===null?u.appendChild(n):u.insertBefore(n,a))}}n!==null&&Ti(n,r,e)}function ht(r){return Dt?(r||window).getSelection():null}function uc(r){return Gt(r)&&r.tagName==="A"}function Gt(r){return r.nodeType===1}function ao(r){return r.nodeType===11}function Ws(r){const e=new RegExp(/^(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|#text)$/,"i");return r.nodeName.match(e)!==null}function Jn(r){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return r.nodeName.match(e)!==null}function Qt(r){if(_e(r)&&!r.isInline())return!0;if(!F(r)||Rt(r))return!1;const e=r.getFirstChild(),t=e===null||dr(e)||$(e)||e.isInline();return!r.isInline()&&r.canBeEmpty()!==!1&&t}function Ur(r,e){let t=r;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function cc(){return je()}const uo=new WeakMap,dc=new Map;function fc(r){if(!r._readOnly&&r.isEmpty())return dc;r._readOnly||M(192);let e=uo.get(r);if(!e){e=new Map,uo.set(r,e);for(const[t,n]of r._nodeMap){const s=n.__type;let o=e.get(s);o||(o=new Map,e.set(s,o)),o.set(t,n)}}return e}function Bi(r){const e=r.constructor.clone(r);return e.afterCloneFrom(r),e}function Ni(r,e){const t=(parseInt(r.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function hc(r){return r.__lexicalUnmanaged===!0}function ql(r,e,t,n,s,o){let i=r.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(F(i)&&ql(i,l,t,n,s,o),t.has(l)||o.delete(l),s.push(l)),i=i.getNextSibling()}}let rr,et,cn,ps,Gs,Ks,pr,Ct,Vs,dn,We="",Xe="",Bt=null,bt="",Ut="",Ul=!1,fn=!1,Pn=null;function Qn(r,e){const t=pr.get(r);if(e!==null){const n=Qs(r);n.parentNode===e&&e.removeChild(n)}if(Ct.has(r)||et._keyToDOMMap.delete(r),F(t)){const n=Xn(t,pr);Hs(n,0,n.length-1,null)}t!==void 0&&Ai(dn,cn,ps,t,"destroyed")}function Hs(r,e,t,n){let s=e;for(;s<=t;++s){const o=r[s];o!==void 0&&Qn(o,n)}}function or(r,e){r.setProperty("text-align",e)}const pc="40px";function Wl(r,e){const t=rr.theme.indent;if(typeof t=="string"){const s=r.classList.contains(t);e>0&&!s?r.classList.add(t):e<1&&s&&r.classList.remove(t)}const n=getComputedStyle(r).getPropertyValue("--lexical-indent-base-value")||pc;r.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function Gl(r,e){const t=r.style;e===0?or(t,""):e===mi?or(t,"left"):e===yi?or(t,"center"):e===xi?or(t,"right"):e===bi?or(t,"justify"):e===_i?or(t,"start"):e===vi&&or(t,"end")}function Yn(r,e){const t=Ct.get(r);t===void 0&&M(60);const n=t.createDOM(rr,et);if(function(s,o,i){const l=i._keyToDOMMap;(function(a,u,c){a[`__lexicalKey_${u._key}`]=c})(o,i,s),l.set(s,o)}(r,n,et),$(t)?n.setAttribute("data-lexical-text","true"):_e(t)&&n.setAttribute("data-lexical-decorator","true"),F(t)){const s=t.__indent,o=t.__size;if(s!==0&&Wl(n,s),o!==0){const l=o-1;(function(a,u,c,d){const f=Xe;Xe="",Js(a,c,0,u,c.getDOMSlot(d)),Vl(c,d),Xe=f})(Xn(t,Ct),l,t,n)}const i=t.__format;i!==0&&Gl(n,i),t.isInline()||Kl(null,t,n),fs(t)&&(We+=Wt,Ut+=Wt)}else{const s=t.getTextContent();if(_e(t)){const o=t.decorate(et,rr);o!==null&&Hl(r,o),n.contentEditable="false"}else $(t)&&(t.isDirectionless()||(Xe+=s));We+=s,Ut+=s}return e!==null&&e.insertChild(n),Ai(dn,cn,ps,t,"created"),n}function Js(r,e,t,n,s){const o=We;We="";let i=t;for(;i<=n;++i){Yn(r[i],s);const l=Ct.get(r[i]);l!==null&&$(l)&&(Bt===null&&(Bt=l.getFormat()),bt===""&&(bt=l.getStyle()))}fs(e)&&(We+=Wt),s.element.__lexicalTextContent=We,We=o+We}function co(r,e){if(r){const t=r.__last;if(t){const n=e.get(t);if(n)return dr(n)?"line-break":_e(n)&&n.isInline()?"decorator":null}return"empty"}return null}function Kl(r,e,t){const n=co(r,pr),s=co(e,Ct);n!==s&&e.getDOMSlot(t).setManagedLineBreak(s)}function Vl(r,e){const t=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(t!==Xe||n!==Pn){const o=Xe==="",i=o?Pn:(s=Xe,Uu.test(s)?"rtl":Wu.test(s)?"ltr":null);if(i!==n){const l=e.classList,a=rr.theme;let u=n!==null?a[n]:void 0,c=i!==null?a[i]:void 0;if(u!==void 0){if(typeof u=="string"){const d=Wn(u);u=a[n]=d}l.remove(...u)}if(i===null||o&&i==="ltr")e.removeAttribute("dir");else{if(c!==void 0){if(typeof c=="string"){const d=Wn(c);c=a[i]=d}c!==void 0&&l.add(...c)}e.dir=i}fn||(r.getWritable().__dir=i)}Pn=i,e.__lexicalDirTextContent=Xe,e.__lexicalDir=i}var s}function gc(r,e,t){const n=Xe;var s;Xe="",Bt=null,bt="",function(o,i,l){const a=We,u=o.__size,c=i.__size;We="";const d=l.element;if(u===1&&c===1){const f=o.__first,h=i.__first;if(f===h)Hr(f,d);else{const m=Qs(f),x=Yn(h,null);try{d.replaceChild(x,m)}catch(C){if(typeof C=="object"&&C!=null){const v=`${C.toString()} Parent: ${d.tagName}, new child: {tag: ${x.tagName} key: ${h}}, old child: {tag: ${m.tagName}, key: ${f}}.`;throw new Error(v)}throw C}Qn(f,null)}const g=Ct.get(h);$(g)&&(Bt===null&&(Bt=g.getFormat()),bt===""&&(bt=g.getStyle()))}else{const f=Xn(o,pr),h=Xn(i,Ct);if(f.length!==u&&M(227),h.length!==c&&M(228),u===0)c!==0&&Js(h,i,0,c-1,l);else if(c===0){if(u!==0){const g=l.after==null&&l.before==null&&l.element.__lexicalLineBreak==null;Hs(f,0,u-1,g?null:d),g&&(d.textContent="")}}else(function(g,m,x,C,v,E){const D=C-1,k=v-1;let b,_,S=E.getFirstChild(),A=0,I=0;for(;A<=D&&I<=k;){const j=m[A],L=x[I];if(j===L)S=Ns(Hr(L,E.element)),A++,I++;else{b===void 0&&(b=new Set(m)),_===void 0&&(_=new Set(x));const X=_.has(j),ce=b.has(L);if(X)if(ce){const ve=Hn(et,L);ve===S?S=Ns(Hr(L,E.element)):(E.withBefore(S).insertChild(ve),Hr(L,E.element)),A++,I++}else Yn(L,E.withBefore(S)),I++;else S=Ns(Qs(j)),Qn(j,E.element),A++}const z=Ct.get(L);z!==null&&$(z)&&(Bt===null&&(Bt=z.getFormat()),bt===""&&(bt=z.getStyle()))}const B=A>D,N=I>k;if(B&&!N){const j=x[k+1],L=j===void 0?null:et.getElementByKey(j);Js(x,g,I,k,E.withBefore(L))}else N&&!B&&Hs(m,A,D,E.element)})(i,f,h,u,c,l)}fs(i)&&(We+=Wt),d.__lexicalTextContent=We,We=a+We}(r,e,e.getDOMSlot(t)),Vl(e,t),jr(s=e)&&Bt!=null&&Bt!==s.__textFormat&&!fn&&(s.setTextFormat(Bt),s.setTextStyle(bt)),function(o){jr(o)&&bt!==""&&bt!==o.__textStyle&&!fn&&o.setTextStyle(bt)}(e),Xe=n}function Xn(r,e){const t=[];let n=r.__first;for(;n!==null;){const s=e.get(n);s===void 0&&M(101),t.push(n),n=s.__next}return t}function Hr(r,e){const t=pr.get(r);let n=Ct.get(r);t!==void 0&&n!==void 0||M(61);const s=Ul||Ks.has(r)||Gs.has(r),o=Hn(et,r);if(t===n&&!s){if(F(t)){const i=o.__lexicalTextContent;i!==void 0&&(We+=i,Ut+=i);const l=o.__lexicalDirTextContent;l!==void 0&&(Xe+=l)}else{const i=t.getTextContent();$(t)&&!t.isDirectionless()&&(Xe+=i),Ut+=i,We+=i}return o}if(t!==n&&s&&Ai(dn,cn,ps,n,"updated"),n.updateDOM(t,o,rr)){const i=Yn(r,null);return e===null&&M(62),e.replaceChild(i,o),Qn(r,null),i}if(F(t)&&F(n)){const i=n.__indent;i!==t.__indent&&Wl(o,i);const l=n.__format;l!==t.__format&&Gl(o,l),s&&(gc(t,n,o),Ze(n)||n.isInline()||Kl(t,n,o)),fs(n)&&(We+=Wt,Ut+=Wt)}else{const i=n.getTextContent();if(_e(n)){const l=n.decorate(et,rr);l!==null&&Hl(r,l)}else $(n)&&!n.isDirectionless()&&(Xe+=i);We+=i,Ut+=i}if(!fn&&Ze(n)&&n.__cachedText!==Ut){const i=n.getWritable();i.__cachedText=Ut,n=i}return o}function Hl(r,e){let t=et._pendingDecorators;const n=et._decorators;if(t===null){if(n[r]===e)return;t=Pl(et)}t[r]=e}function Ns(r){let e=r.nextSibling;return e!==null&&e===et._blockCursorElement&&(e=e.nextSibling),e}function mc(r,e,t,n,s,o){We="",Ut="",Xe="",Ul=n===Nr,Pn=null,et=t,rr=t._config,cn=t._nodes,ps=et._listeners.mutation,Gs=s,Ks=o,pr=r._nodeMap,Ct=e._nodeMap,fn=e._readOnly,Vs=new Map(t._keyToDOMMap);const i=new Map;return dn=i,Hr("root",null),et=void 0,cn=void 0,Gs=void 0,Ks=void 0,pr=void 0,Ct=void 0,rr=void 0,Vs=void 0,dn=void 0,i}function Qs(r){const e=Vs.get(r);return e===void 0&&M(75,r),e}const qt=Object.freeze({}),Ys=30,Xs=[["keydown",function(r,e){if(tn=r.timeStamp,Jl=r.key,e.isComposing())return;const{key:t,shiftKey:n,ctrlKey:s,metaKey:o,altKey:i}=r;if(!W(e,vu,r)&&t!=null){if(function(l,a,u,c){return so(l)&&!a&&!c&&!u}(t,s,i,o))W(e,gl,r);else if(function(l,a,u,c,d){return so(l)&&!c&&!u&&(a||d)}(t,s,n,i,o))W(e,Cu,r);else if(function(l,a,u,c){return no(l)&&!a&&!c&&!u}(t,s,i,o))W(e,ml,r);else if(function(l,a,u,c,d){return no(l)&&!c&&!u&&(a||d)}(t,s,n,i,o))W(e,wu,r);else if(function(l,a,u){return function(c){return c==="ArrowUp"}(l)&&!a&&!u}(t,s,o))W(e,yl,r);else if(function(l,a,u){return function(c){return c==="ArrowDown"}(l)&&!a&&!u}(t,s,o))W(e,xl,r);else if(function(l,a){return io(l)&&a}(t,n))rn=!0,W(e,$n,r);else if(function(l){return l===" "}(t))W(e,Du,r);else if(function(l,a){return xt&&a&&l.toLowerCase()==="o"}(t,s))r.preventDefault(),rn=!0,W(e,kr,!0);else if(function(l,a){return io(l)&&!a}(t,n))rn=!1,W(e,$n,r);else if(function(l,a,u,c){return xt?!a&&!u&&(zr(l)||l.toLowerCase()==="h"&&c):!(c||a||u)&&zr(l)}(t,i,o,s))zr(t)?W(e,bl,r):(r.preventDefault(),W(e,ur,!0));else if(function(l){return l==="Escape"}(t))W(e,_l,r);else if(function(l,a,u,c,d){return xt?!(u||c||d)&&(qr(l)||l.toLowerCase()==="d"&&a):!(a||c||d)&&qr(l)}(t,s,n,i,o))qr(t)?W(e,vl,r):(r.preventDefault(),W(e,ur,!1));else if(function(l,a,u){return zr(l)&&(xt?a:u)}(t,i,s))r.preventDefault(),W(e,ln,!0);else if(function(l,a,u){return qr(l)&&(xt?a:u)}(t,i,s))r.preventDefault(),W(e,ln,!1);else if(function(l,a){return xt&&a&&zr(l)}(t,o))r.preventDefault(),W(e,an,!0);else if(function(l,a){return xt&&a&&qr(l)}(t,o))r.preventDefault(),W(e,an,!1);else if(function(l,a,u,c){return l.toLowerCase()==="b"&&!a&&Vr(u,c)}(t,i,o,s))r.preventDefault(),W(e,vt,"bold");else if(function(l,a,u,c){return l.toLowerCase()==="u"&&!a&&Vr(u,c)}(t,i,o,s))r.preventDefault(),W(e,vt,"underline");else if(function(l,a,u,c){return l.toLowerCase()==="i"&&!a&&Vr(u,c)}(t,i,o,s))r.preventDefault(),W(e,vt,"italic");else if(function(l,a,u,c){return l==="Tab"&&!a&&!u&&!c}(t,i,s,o))W(e,Su,r);else if(function(l,a,u,c){return l.toLowerCase()==="z"&&!a&&Vr(u,c)}(t,n,o,s))r.preventDefault(),W(e,di,void 0);else if(function(l,a,u,c){return xt?l.toLowerCase()==="z"&&u&&a:l.toLowerCase()==="y"&&c||l.toLowerCase()==="z"&&c&&a}(t,n,o,s))r.preventDefault(),W(e,fi,void 0);else{const l=e._editorState._selection;l===null||P(l)?!tr&&oo(t,o,s)&&(r.preventDefault(),W(e,qs,r)):function(a,u,c,d){return!u&&a.toLowerCase()==="c"&&(xt?c:d)}(t,n,o,s)?(r.preventDefault(),W(e,ls,r)):function(a,u,c,d){return!u&&a.toLowerCase()==="x"&&(xt?c:d)}(t,n,o,s)?(r.preventDefault(),W(e,hi,r)):oo(t,o,s)&&(r.preventDefault(),W(e,qs,r))}(function(l,a,u,c){return l||a||u||c})(s,n,i,o)&&W(e,Lu,r)}}],["pointerdown",function(r,e){const t=r.target,n=r.pointerType;t instanceof Node&&n!=="touch"&&at(e,()=>{_e(Fr(t))||(ei=!0)})}],["compositionstart",function(r,e){at(e,()=>{const t=V();if(P(t)&&!e.isComposing()){const n=t.anchor,s=t.anchor.getNode();Ve(n.key),(r.timeStamp<tn+Ys||n.type==="element"||!t.isCollapsed()||s.getFormat()!==t.format||$(s)&&s.getStyle()!==t.style)&&W(e,Ar,qu)}})}],["compositionend",function(r,e){tr?Wr=!0:at(e,()=>{Fs(e,r.data)})}],["input",function(r,e){r.stopPropagation(),at(e,()=>{const t=V(),n=r.data,s=Zl(r);if(n!=null&&P(t)&&Xl(t,s,n,r.timeStamp,!1)){Wr&&(Fs(e,n),Wr=!1);const o=t.anchor.getNode(),i=ht(e._window);if(i===null)return;const l=t.isBackward(),a=l?t.anchor.offset:t.focus.offset,u=l?t.focus.offset:t.anchor.offset;zn&&!t.isCollapsed()&&$(o)&&i.anchorNode!==null&&o.getTextContent().slice(0,a)+n+o.getTextContent().slice(a+u)===$l(i.anchorNode)||W(e,Ar,n);const c=n.length;tr&&c>1&&r.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=c),as||pn||pi||!e.isComposing()||(tn=0,Ve(null))}else Ei(!1,e,n!==null?n:void 0),Wr&&(Fs(e,n||void 0),Wr=!1);nt(),Bl(je())}),Dr=null}],["click",function(r,e){at(e,()=>{const t=V(),n=ht(e._window),s=vn();if(n){if(P(t)){const o=t.anchor,i=o.getNode();o.type==="element"&&o.offset===0&&t.isCollapsed()&&!Ze(i)&&Be().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&s!==null&&t.is(s)?(n.removeAllRanges(),t.dirty=!0):r.detail===3&&!t.isCollapsed()&&i!==t.focus.getNode()&&(F(i)?i.select(0):i.getParentOrThrow().select(0))}else if(r.pointerType==="touch"){const o=n.anchorNode;if(o!==null){const i=o.nodeType;(i===gn||i===nr)&&Lt(ji(s,n,e,r))}}}W(e,pl,r)})}],["cut",qt],["copy",qt],["dragstart",qt],["dragover",qt],["dragend",qt],["paste",qt],["focus",qt],["blur",qt],["drop",qt]];zn&&Xs.push(["beforeinput",(r,e)=>function(t,n){const s=t.inputType,o=Zl(t);s==="deleteCompositionText"||tr&&zl(n)||s!=="insertCompositionText"&&at(n,()=>{const i=V();if(s==="deleteContentBackward"){if(i===null){const h=vn();if(!P(h))return;Lt(h.clone())}if(P(i)){const h=i.anchor.key===i.focus.key;if(l=t.timeStamp,Jl==="MediaLast"&&l<tn+Ys&&n.isComposing()&&h){if(Ve(null),tn=0,setTimeout(()=>{at(n,()=>{Ve(null)})},Ys),P(i)){const g=i.anchor.getNode();g.markDirty(),i.format=g.getFormat(),$(g)||M(142),i.style=g.getStyle()}}else{Ve(null),t.preventDefault();const g=i.anchor.getNode(),m=g.getTextContent(),x=g.canInsertTextAfter(),C=i.anchor.offset===0&&i.focus.offset===m.length;Ou&&h&&!C&&x||W(n,ur,!0)}return}}var l;if(!P(i))return;const a=t.data;Dr!==null&&Ei(!1,n,Dr),i.dirty&&Dr===null||!i.isCollapsed()||Ze(i.anchor.getNode())||o===null||i.applyDOMRange(o),Dr=null;const u=i.anchor,c=i.focus,d=u.getNode(),f=c.getNode();if(s!=="insertText"&&s!=="insertTranspose")switch(t.preventDefault(),s){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":W(n,Ar,t);break;case"insertFromComposition":Ve(null),W(n,Ar,t);break;case"insertLineBreak":Ve(null),W(n,kr,!1);break;case"insertParagraph":Ve(null),rn&&!pn?(rn=!1,W(n,kr,!1)):W(n,on,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":W(n,os,t);break;case"deleteByComposition":(function(h,g){return h!==g||F(h)||F(g)||!h.isToken()||!g.isToken()})(d,f)&&W(n,zs,t);break;case"deleteByDrag":case"deleteByCut":W(n,zs,t);break;case"deleteContent":W(n,ur,!1);break;case"deleteWordBackward":W(n,ln,!0);break;case"deleteWordForward":W(n,ln,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":W(n,an,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":W(n,an,!1);break;case"formatStrikeThrough":W(n,vt,"strikethrough");break;case"formatBold":W(n,vt,"bold");break;case"formatItalic":W(n,vt,"italic");break;case"formatUnderline":W(n,vt,"underline");break;case"historyUndo":W(n,di,void 0);break;case"historyRedo":W(n,fi,void 0)}else{if(a===`
|
|
64
64
|
`)t.preventDefault(),W(n,kr,!1);else if(a===Wt)t.preventDefault(),W(n,on,void 0);else if(a==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),i.insertRawText(h)}else a!=null&&Xl(i,o,a,t.timeStamp,!0)?(t.preventDefault(),W(n,Ar,a)):Dr=a;Ql=t.timeStamp}})}(r,e)]);let tn=0,Jl=null,Ql=0,Dr=null;const Zn=new WeakMap;let Zs=!1,ei=!1,rn=!1,Wr=!1,Yl=[0,"",0,"root",0];function Xl(r,e,t,n,s){const o=r.anchor,i=r.focus,l=o.getNode(),a=je(),u=ht(a._window),c=u!==null?u.anchorNode:null,d=o.key,f=a.getElementByKey(d),h=t.length;return d!==i.key||!$(l)||(!s&&(!zn||Ql<n+50)||l.isDirty()&&h<2||Ml(t))&&o.offset!==i.offset&&!l.isComposing()||lr(l)||l.isDirty()&&h>1||(s||!zn)&&f!==null&&!l.isComposing()&&c!==Gn(f)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||l.getFormat()!==r.format||l.getStyle()!==r.style||ic(r,l)}function fo(r,e){return r!==null&&r.nodeValue!==null&&r.nodeType===nr&&e!==0&&e!==r.nodeValue.length}function ho(r,e,t){const{anchorNode:n,anchorOffset:s,focusNode:o,focusOffset:i}=r;Zs&&(Zs=!1,fo(n,s)&&fo(o,i))||at(e,()=>{if(!t)return void Lt(null);if(!mn(e,n,o))return;const l=V();if(P(l)){const a=l.anchor,u=a.getNode();if(l.isCollapsed()){r.type==="Range"&&r.anchorNode===r.focusNode&&(l.dirty=!0);const c=hs(e).event,d=c?c.timeStamp:performance.now(),[f,h,g,m,x]=Yl,C=Be(),v=e.isComposing()===!1&&C.getTextContent()==="";if(d<x+200&&a.offset===g&&a.key===m)l.format=f,l.style=h;else if(a.type==="text")$(u)||M(141),l.format=u.getFormat(),l.style=u.getStyle();else if(a.type==="element"&&!v){const E=a.getNode();l.style="",E instanceof Rr&&E.getChildrenSize()===0?(l.format=E.getTextFormat(),l.style=E.getTextStyle()):l.format=0}}else{const c=a.key,d=l.focus.key,f=l.getNodes(),h=f.length,g=l.isBackward(),m=g?i:s,x=g?s:i,C=g?d:c,v=g?c:d;let E=zu,D=!1;for(let k=0;k<h;k++){const b=f[k],_=b.getTextContentSize();if($(b)&&_!==0&&!(k===0&&b.__key===C&&m===_||k===h-1&&b.__key===v&&x===0)&&(D=!0,E&=b.getFormat(),E===0))break}l.format=D?E:0}}W(e,ci,void 0)})}function Zl(r){if(!r.getTargetRanges)return null;const e=r.getTargetRanges();return e.length===0?null:e[0]}function Fs(r,e){const t=r._compositionKey;if(Ve(null),t!==null&&e!=null){if(e===""){const n=Qe(t),s=Gn(r.getElementByKey(t));return void(s!==null&&s.nodeValue!==null&&$(n)&&ki(n,s.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
|
@@ -150,4 +150,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
150
150
|
from { transform: rotate(0deg); }
|
|
151
151
|
to { transform: rotate(360deg); }
|
|
152
152
|
}
|
|
153
|
-
`})]})}const cf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function df({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:o,allowDelete:i=!1,onDelete:l,label:a,disabled:u=!1,max:c=0,theme:d={},className:f=""}){const h={...cf,...d},[g,m]=w.useState(!1),[x,C]=w.useState(""),v=w.useRef(null),E=w.useRef(null);w.useEffect(()=>{function B(N){v.current&&!v.current.contains(N.target)&&(m(!1),C(""))}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);const D=r.filter(B=>{var N;return((N=B.label)==null?void 0:N.toLowerCase().includes(x.toLowerCase()))&&!e.includes(B.id)}),k=s&&x.trim()&&!r.some(B=>{var N;return((N=B.label)==null?void 0:N.toLowerCase())===x.toLowerCase()}),b=e.map(B=>r.find(N=>N.id===B)).filter(Boolean),_=w.useCallback(B=>{var N;c>0&&e.length>=c||(t([...e,B]),C(""),(N=E.current)==null||N.focus())},[e,t,c]),S=w.useCallback(B=>{t(e.filter(N=>N!==B))},[e,t]),A=w.useCallback(async()=>{if(!k)return;const B=await(o==null?void 0:o(x.trim()));B&&_(B.id),C("")},[k,x,o,_]),I=w.useCallback(B=>{B.key==="Enter"?(B.preventDefault(),k?A():D.length>0&&_(D[0].id)):B.key==="Backspace"&&!x&&e.length>0?S(e[e.length-1]):B.key==="Escape"&&(m(!1),C(""))},[k,D,x,e,A,_,S]);return p.jsxs("div",{ref:v,className:f,style:{position:"relative"},children:[a&&p.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:a}),p.jsxs("div",{onClick:()=>!u&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${g?h.primary:h.border}`,borderRadius:"8px",background:u?h.hoverBackground:h.background,cursor:u?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[b.map(B=>p.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",fontSize:"13px",background:B.color||h.chipBackground,color:B.color?"#fff":h.chipText},children:[B.label,!u&&p.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),S(B.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},B.id)),p.jsx("input",{ref:E,type:"text",value:x,onChange:B=>{C(B.target.value),g||m(!0)},onFocus:()=>m(!0),onKeyDown:I,placeholder:b.length===0?n:"",disabled:u||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),g&&!u&&p.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:h.background,border:`1px solid ${h.border}`,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",maxHeight:"200px",overflowY:"auto",zIndex:50},children:D.length===0&&!k?p.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:x?"No matches":"No options available"}):p.jsxs(p.Fragment,{children:[D.map(B=>p.jsxs("div",{onClick:()=>_(B.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:N=>{N.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:N=>{N.currentTarget.style.background=""},children:[B.label,i&&l&&p.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),l(B.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:N=>{N.currentTarget.style.opacity="1",N.currentTarget.style.color="#ef4444"},onMouseLeave:N=>{N.currentTarget.style.opacity="0.5",N.currentTarget.style.color=h.textSecondary||""},children:"×"})]},B.id)),k&&p.jsxs("div",{onClick:A,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:D.length>0?`1px solid ${h.border}`:"none"},onMouseEnter:B=>{B.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:B=>{B.currentTarget.style.background=""},children:['+ Create "',x.trim(),'"']})]})})]})}function ff({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:o,onItemMove:i,onItemReorder:l,onItemClick:a,renderColumnHeader:u,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[g,m]=w.useState(null),[x,C]=w.useState(null),[v,E]=w.useState(null),D=w.useRef(null),k=e.reduce((N,j)=>{let L=r.filter(z=>n(z)===j.id);return s&&(L=L.sort((z,X)=>s(z)-s(X))),N[j.id]=L,N},{}),b=w.useCallback((N,j)=>{const L=t(j),z=n(j);m(L),D.current=z,N.dataTransfer.effectAllowed="move",N.dataTransfer.setData("text/plain",L),requestAnimationFrame(()=>{const X=N.target;X.style.opacity="0.5"})},[t,n]),_=w.useCallback(N=>{const j=N.target;j.style.opacity="1",m(null),C(null),E(null),D.current=null},[]),S=w.useCallback((N,j,L)=>{N.preventDefault(),N.dataTransfer.dropEffect="move",C(j),E(L)},[]),A=w.useCallback(N=>{const j=N.relatedTarget;j!=null&&j.closest("[data-kanban-column]")||(C(null),E(null))},[]),I=w.useCallback((N,j,L)=>{if(N.preventDefault(),!g)return;const z=D.current;z===j?l==null||l(g,j,L):z&&i(g,z,j,L),m(null),C(null),E(null),D.current=null},[g,i,l]),B=(N,j)=>p.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[N.color&&p.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:N.color}}),p.jsx("span",{className:"font-medium text-sm text-neutral-700",children:N.label})]}),p.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:j})]});return p.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(N=>{const j=k[N.id]||[],L=x===N.id;return p.jsxs("div",{"data-kanban-column":N.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:z=>{z.preventDefault(),g&&!L&&C(N.id)},onDragLeave:A,onDrop:z=>I(z,N.id,v??j.length),children:[p.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(N,j.length):B(N,j.length)}),p.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${L?"bg-blue-50":""}`,children:[j.map((z,X)=>{const ce=t(z),ve=g===ce,le=L&&v===X&&!ve;return p.jsxs("div",{children:[le&&p.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),p.jsx("div",{draggable:!0,onDragStart:Le=>b(Le,z),onDragEnd:_,onDragOver:Le=>S(Le,N.id,X),onClick:()=>a==null?void 0:a(z),className:`cursor-grab active:cursor-grabbing transition-all ${ve?"opacity-50 scale-95":""} ${h}`,children:o(z,ve)})]},ce)}),p.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:z=>{z.preventDefault(),S(z,N.id,j.length)},children:L&&v===j.length&&p.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),j.length===0&&L&&p.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:p.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&p.jsx("div",{className:"flex-shrink-0 border-t border-neutral-200 p-2",children:c(N)})]},N.id)})})}const hf={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function pf(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function gf(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function mf(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function yf({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:o,getItemDuration:i,getItemIsAllDay:l,getItemId:a,renderItem:u,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:g={}}){const m={...hf,...g},{allDayItems:x,timedItems:C}=w.useMemo(()=>{const _=[],S=[];for(const A of r)l(A)?_.push(A):S.push(A);return{allDayItems:_,timedItems:S}},[r,l]),v=w.useMemo(()=>{const _=[];for(let S=t;S<=n;S++)_.push(S);return _},[t,n]),E=(n-t+1)*s,D=w.useCallback(_=>{const S=o(_);if(!S)return null;const A=pf(S);if(!A)return null;const{hours:I,minutes:B}=A,N=Math.max(t,Math.min(n,I)),j=I<t?0:B,L=(N-t)*s+j/60*s,z=i(_),X=Math.max(20,z/60*s);return{top:L,height:X}},[o,i,t,n,s]),k=w.useMemo(()=>{if(!f||!mf(e))return null;const _=new Date,S=_.getHours(),A=_.getMinutes();return S<t||S>n?null:(S-t)*s+A/60*s},[e,f,t,n,s]),b=w.useCallback(_=>{if(!d)return;const S=_.currentTarget.getBoundingClientRect(),I=(_.clientY-S.top)/s*60,B=Math.floor(I/60)+t,N=Math.round(I%60/15)*15,j=Math.min(n,Math.max(t,B)),L=N>=60?0:N,z=`${j.toString().padStart(2,"0")}:${L.toString().padStart(2,"0")}`;d(z)},[d,s,t,n]);return p.jsxs("div",{className:h,style:{background:m.background},children:[x.length>0&&p.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[p.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:x.map(_=>p.jsx("div",{onClick:()=>c==null?void 0:c(_),style:{cursor:c?"pointer":"default"},children:u(_)},a(_)))})]}),p.jsxs("div",{style:{position:"relative",height:E},children:[v.map((_,S)=>p.jsxs("div",{style:{position:"absolute",top:S*s,left:0,right:0},children:[p.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:gf(_)}),p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),S<v.length-1&&p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},_)),p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:b}),k!==null&&p.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:k,zIndex:20,pointerEvents:"none"},children:[p.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),p.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),C.map(_=>{const S=D(_);return S?p.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:S.top,height:S.height,zIndex:10,cursor:c?"pointer":"default"},onClick:A=>{A.stopPropagation(),c==null||c(_)},children:u(_)},a(_)):null})]})]})}function xf({onComplete:r,onCancel:e,onTranscribe:t,onTranscriptionComplete:n,variant:s="widget",hideSaveButton:o=!1,maxDuration:i=180}){const l=s==="widget",[a,u]=w.useState("idle"),[c,d]=w.useState(0),[f,h]=w.useState(0),[g,m]=w.useState(!1),[x,C]=w.useState(0),[v,E]=w.useState(null),[D,k]=w.useState(!1),[b,_]=w.useState(null),[S,A]=w.useState(!1),[I,B]=w.useState([]),[N,j]=w.useState({completed:0,total:0}),L=w.useRef(!1),z=w.useRef(!1);w.useEffect(()=>{z.current=S},[S]);const X=w.useRef(null),ce=w.useRef(null),ve=w.useRef(null),le=w.useRef(null),Le=w.useRef(null),me=w.useRef([]),he=w.useRef(null),ye=w.useRef(null),xe=w.useRef(null),De=w.useRef(null),pe=w.useRef(!1),Ce=w.useRef([]),Ne=w.useRef(null),ae=w.useRef(null),Re=w.useRef([]),ot=w.useRef([]),St=w.useRef("insert"),Mt=w.useRef(!1),tt=w.useRef(0),pt=w.useRef(0),ct=w.useRef(0),Ht=q=>{const T=Math.floor(q/60),H=Math.floor(q%60);return`${T.toString().padStart(2,"0")}:${H.toString().padStart(2,"0")}`},It=async q=>{const T=await q.arrayBuffer(),H=new AudioContext,Q=await H.decodeAudioData(T);return await H.close(),Q},Et=q=>{const T=q.numberOfChannels,H=q.sampleRate,Q=1,O=16,re=O/8,Z=T*re,ee=H*Z,de=q.length*Z,we=new ArrayBuffer(44+de),te=new DataView(we),ne=(Te,be)=>{for(let He=0;He<be.length;He++)te.setUint8(Te+He,be.charCodeAt(He))};ne(0,"RIFF"),te.setUint32(4,36+de,!0),ne(8,"WAVE"),ne(12,"fmt "),te.setUint32(16,16,!0),te.setUint16(20,Q,!0),te.setUint16(22,T,!0),te.setUint32(24,H,!0),te.setUint32(28,ee,!0),te.setUint16(32,Z,!0),te.setUint16(34,O,!0),ne(36,"data"),te.setUint32(40,de,!0);const Ie=[];for(let Te=0;Te<T;Te++)Ie.push(q.getChannelData(Te));let qe=44;for(let Te=0;Te<q.length;Te++)for(let be=0;be<T;be++){const He=Math.max(-1,Math.min(1,Ie[be][Te])),Je=He<0?He*32768:He*32767;te.setInt16(qe,Je,!0),qe+=2}return new Blob([we],{type:"audio/wav"})},kt=async(q,T,H,Q)=>{const O=new AudioContext,re=q.sampleRate,Z=Math.max(q.numberOfChannels,T.numberOfChannels),ee=Math.min(H,q.length),de=Math.max(0,q.length-H),we=Q==="insert"?ee+T.length+de:ee+T.length,te=O.createBuffer(Z,we,re);for(let ne=0;ne<Z;ne++){const Ie=te.getChannelData(ne),qe=ne<q.numberOfChannels?q.getChannelData(ne):q.getChannelData(0);for(let be=0;be<ee;be++)Ie[be]=qe[be];const Te=ne<T.numberOfChannels?T.getChannelData(ne):T.getChannelData(0);for(let be=0;be<T.length;be++)Ie[ee+be]=Te[be];if(Q==="insert")for(let be=0;be<de;be++)Ie[ee+T.length+be]=qe[H+be]}return await O.close(),te},lt=w.useCallback(()=>{const q=X.current;if(!q)return;const T=q.getContext("2d");if(!T)return;const H=q.getBoundingClientRect(),Q=H.width,O=H.height,re=Ce.current,Z=f||c||1,ee=a==="recording"?c:x;T.fillStyle="#2d3b35",T.fillRect(0,0,Q,O);const de=8,we="rgba(0, 0, 0, 0.4)",te=T.createLinearGradient(0,0,0,de);te.addColorStop(0,we),te.addColorStop(1,"transparent"),T.fillStyle=te,T.fillRect(0,0,Q,de);const ne=T.createLinearGradient(0,O-de,0,O);ne.addColorStop(0,"transparent"),ne.addColorStop(1,we),T.fillStyle=ne,T.fillRect(0,O-de,Q,de);const Ie=T.createLinearGradient(0,0,de,0);Ie.addColorStop(0,we),Ie.addColorStop(1,"transparent"),T.fillStyle=Ie,T.fillRect(0,0,de,O);const qe=T.createLinearGradient(Q-de,0,Q,0);qe.addColorStop(0,"transparent"),qe.addColorStop(1,we),T.fillStyle=qe,T.fillRect(Q-de,0,de,O),T.strokeStyle="#5a6b62",T.lineWidth=1,T.beginPath(),T.moveTo(0,O/2),T.lineTo(Q,O/2),T.stroke();const Te=Q/2;if(re.length>0)if(a==="recording")for(let Je=0;Je<re.length;Je++){const dt=re.length-1-Je,zt=Te-dt*4;if(zt<-3||zt>Q)continue;const yt=re[Je]*(O/2-12),y=O/2-yt;T.fillStyle="#10b981",T.fillRect(zt,y,3,yt*2)}else{const Je=Z>0?ee/Z*re.length:0;for(let dt=0;dt<re.length;dt++){const zt=Je-dt,yt=Te-zt*4;if(yt<-3||yt>Q)continue;const y=re[dt]*(O/2-12),R=O/2-y;T.fillStyle=dt<=Je?"#10b981":"#4b5563",T.fillRect(yt,R,3,y*2)}}T.strokeStyle="#ef4444",T.lineWidth=1,T.beginPath(),T.moveTo(Te,0),T.lineTo(Te,O),T.stroke(),T.fillStyle="#fff",T.font="bold 18px monospace",T.textAlign="center",T.fillText(Ht(ee),Te,O-6),a==="recording"&&(T.fillStyle="#ef4444",T.beginPath(),T.arc(20,20,8,0,Math.PI*2),T.fill(),T.fillStyle="#fff",T.font="10px sans-serif",T.textAlign="left",T.fillText("REC",34,24)),T.textAlign="left"},[a,x,c,f]),gt=()=>{const q=Le.current;if(!q||!pe.current)return;const T=q.frequencyBinCount,H=new Uint8Array(T);q.getByteTimeDomainData(H);let Q=0;for(let Z=0;Z<T;Z++){const ee=(H[Z]-128)/128;Q+=ee*ee}const O=Math.sqrt(Q/T),re=Math.min(1,O*3);Ce.current.push(re),lt(),pe.current&&(ye.current=requestAnimationFrame(gt))},G=async()=>{try{E(null),k(!1),Ne.current===null&&(Ce.current=[]);const q=await navigator.mediaDevices.getUserMedia({audio:!0});ve.current=q;const T=new AudioContext;le.current=T;const H=T.createAnalyser();H.fftSize=2048,Le.current=H,T.createMediaStreamSource(q).connect(H);const O=new MediaRecorder(q);ce.current=O,me.current=[],O.ondataavailable=re=>{re.data.size>0&&me.current.push(re.data)},O.onstop=async()=>{try{if(pe.current=!1,me.current.length===0){E("No audio was recorded. Please try again."),u("idle"),q.getTracks().forEach(te=>te.stop());return}const re=new Blob(me.current,{type:"audio/webm"});let Z,ee;if(Ne.current!==null&&ae.current)try{const te=await It(re),ne=ae.current.sampleRate,Ie=Math.floor(Ne.current*ne),qe=await kt(ae.current,te,Ie,St.current);Z=Et(qe),ee=qe.length/qe.sampleRate,St.current==="insert"&&(Ce.current=[...Ce.current,...ot.current]),Ne.current=null,ae.current=null,Re.current=[],ot.current=[]}catch{Z=re,ee=tt.current>0?tt.current:1}else Z=re,ee=tt.current>0?tt.current:1;if(De.current=Z,q.getTracks().forEach(te=>te.stop()),z.current&&t){B(te=>[...te,Z]),j(te=>({...te,total:te.total+1})),De.current=null,Ce.current=[],C(0),h(0),d(0),u("idle");return}const de=URL.createObjectURL(Z),we=new Audio(de);we.ontimeupdate=()=>{C(we.currentTime)},we.onended=()=>{m(!1)},xe.current=we,h(ee),C(ee),u("editing")}catch{E("Failed to process recording"),u("idle")}},O.start(100),pe.current=!0,u("recording"),d(0),tt.current=0,he.current=setInterval(()=>{tt.current+=1,d(tt.current),tt.current>=i&&(ce.current&&ce.current.state!=="inactive"&&ce.current.stop(),pe.current=!1,_(null),he.current&&(clearInterval(he.current),he.current=null),ye.current&&(cancelAnimationFrame(ye.current),ye.current=null),setTimeout(()=>{alert(`Maximum recording time of ${Math.floor(i/60)} minutes reached.`)},100))},1e3)}catch{E("Could not access microphone. Please allow microphone access.")}},Ee=()=>{pe.current=!1,k(!1),_(null),ye.current&&(cancelAnimationFrame(ye.current),ye.current=null),he.current&&(clearInterval(he.current),he.current=null),ce.current&&ce.current.state!=="inactive"&&ce.current.stop()},ke=q=>{const T=X.current;if(!T)return;const H=f||c;if(H<=0)return;const Q=Ce.current;if(Q.length===0)return;const O=T.getBoundingClientRect(),re=q-pt.current,Z=4,ee=O.width/T.width,de=Q.length/H*Z,we=-re/(de*ee),te=ct.current+we,ne=Math.max(0,Math.min(te,H));xe.current&&(xe.current.currentTime=ne),C(ne)},Se=()=>{xe.current&&(xe.current.currentTime=0),C(0)},At=()=>{const q=f||c;xe.current&&(xe.current.currentTime=q),C(q)},Tt=()=>{const q=xe.current;q&&(g?(q.pause(),C(q.currentTime),m(!1)):(q.currentTime=x,q.play().catch(()=>{}),m(!0)))},$t=async q=>{if(!De.current){G();return}try{xe.current&&(xe.current.pause(),m(!1)),St.current=q,ae.current=await It(De.current);const T=f||c;Ne.current=x;const H=T>0?x/T:0,Q=Math.floor(H*Ce.current.length);Re.current=Ce.current.slice(0,Q),ot.current=Ce.current.slice(Q),Ce.current=[...Re.current],G()}catch{E("Failed to prepare recording. Please try again.")}},K=()=>{xe.current&&(xe.current.pause(),xe.current=null),De.current=null,ae.current=null,Ne.current=null,Re.current=[],m(!1),C(0),h(0),d(0),G()},J=()=>{De.current?r(De.current,f||c):alert("No audio recorded yet!")};w.useEffect(()=>{a==="recording"&&X.current&&Le.current&&pe.current&&(ye.current=requestAnimationFrame(gt))},[a]),w.useEffect(()=>{const q=X.current;if(!q)return;const T=()=>{const H=window.devicePixelRatio||1,Q=q.getBoundingClientRect();q.width=Q.width*H,q.height=Q.height*H;const O=q.getContext("2d");O&&O.scale(H,H)};return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]),w.useEffect(()=>{if(a==="idle"){const q=X.current;if(!q)return;const T=q.getContext("2d");if(!T)return;const H=q.getBoundingClientRect(),Q=H.width,O=H.height;T.fillStyle="#2d3b35",T.fillRect(0,0,Q,O);const re=8,Z="rgba(0, 0, 0, 0.4)",ee=T.createLinearGradient(0,0,0,re);ee.addColorStop(0,Z),ee.addColorStop(1,"transparent"),T.fillStyle=ee,T.fillRect(0,0,Q,re);const de=T.createLinearGradient(0,O-re,0,O);de.addColorStop(0,"transparent"),de.addColorStop(1,Z),T.fillStyle=de,T.fillRect(0,O-re,Q,re);const we=T.createLinearGradient(0,0,re,0);we.addColorStop(0,Z),we.addColorStop(1,"transparent"),T.fillStyle=we,T.fillRect(0,0,re,O);const te=T.createLinearGradient(Q-re,0,Q,0);te.addColorStop(0,"transparent"),te.addColorStop(1,Z),T.fillStyle=te,T.fillRect(Q-re,0,re,O),T.strokeStyle="#5a6b62",T.lineWidth=1,T.beginPath(),T.moveTo(0,O/2),T.lineTo(Q,O/2),T.stroke();const ne=Q/2;T.strokeStyle="#ef4444",T.lineWidth=1,T.beginPath(),T.moveTo(ne,0),T.lineTo(ne,O),T.stroke(),T.fillStyle="#fff",T.font="bold 18px monospace",T.textAlign="center",T.fillText("00:00",ne,O-6)}},[a]);const Ae=w.useCallback(q=>{B(T=>[...T,q]),j(T=>({...T,total:T.total+1}))},[]);if(w.useEffect(()=>{(async()=>{if(L.current||I.length===0||!t)return;L.current=!0;const T=I[0];try{const H=await t(T);H&&n&&n(H)}catch(H){console.error("Transcription failed:",H)}finally{B(H=>H.slice(1)),j(H=>({...H,completed:H.completed+1})),L.current=!1}})()},[I,t,n]),w.useEffect(()=>()=>{pe.current=!1,he.current&&clearInterval(he.current),ye.current&&cancelAnimationFrame(ye.current),ve.current&&ve.current.getTracks().forEach(q=>q.stop()),le.current&&le.current.state!=="closed"&&le.current.close()},[]),w.useEffect(()=>{if(a==="editing"&&g){let q;const T=()=>{const H=xe.current;if(H&&g){const Q=X.current;if(Q){const O=Q.getContext("2d");if(O){const re=Q.getBoundingClientRect(),Z=re.width,ee=re.height,de=Ce.current,we=f||c||1,te=H.currentTime;O.fillStyle="#2d3b35",O.fillRect(0,0,Z,ee);const ne=8,Ie="rgba(0, 0, 0, 0.4)",qe=O.createLinearGradient(0,0,0,ne);qe.addColorStop(0,Ie),qe.addColorStop(1,"transparent"),O.fillStyle=qe,O.fillRect(0,0,Z,ne);const Te=O.createLinearGradient(0,ee-ne,0,ee);Te.addColorStop(0,"transparent"),Te.addColorStop(1,Ie),O.fillStyle=Te,O.fillRect(0,ee-ne,Z,ne);const be=O.createLinearGradient(0,0,ne,0);be.addColorStop(0,Ie),be.addColorStop(1,"transparent"),O.fillStyle=be,O.fillRect(0,0,ne,ee);const He=O.createLinearGradient(Z-ne,0,Z,0);He.addColorStop(0,"transparent"),He.addColorStop(1,Ie),O.fillStyle=He,O.fillRect(Z-ne,0,ne,ee),O.strokeStyle="#5a6b62",O.lineWidth=1,O.beginPath(),O.moveTo(0,ee/2),O.lineTo(Z,ee/2),O.stroke();const Je=Z/2,dt=3,zt=4,yt=we>0?te/we*de.length:0;for(let U=0;U<de.length;U++){const Y=yt-U,oe=Je-Y*zt;if(oe<-dt||oe>Z)continue;const ge=de[U]*(ee/2-12),se=ee/2-ge;O.fillStyle=U<=yt?"#10b981":"#4b5563",O.fillRect(oe,se,dt,ge*2)}O.strokeStyle="#ef4444",O.lineWidth=1,O.beginPath(),O.moveTo(Je,0),O.lineTo(Je,ee),O.stroke(),O.fillStyle="#fff",O.font="bold 18px monospace",O.textAlign="center";const y=Math.floor(te/60),R=Math.floor(te%60);O.fillText(`${y.toString().padStart(2,"0")}:${R.toString().padStart(2,"0")}`,Je,ee-6),O.textAlign="left"}}q=requestAnimationFrame(T)}};return q=requestAnimationFrame(T),()=>cancelAnimationFrame(q)}},[a,g,f,c]),w.useEffect(()=>{a==="editing"&&!g&<()},[a,x,g,lt]),v)return p.jsxs("div",{style:{border:"1px solid #fecaca",borderRadius:"12px",padding:"16px",background:"#fef2f2"},children:[p.jsx("p",{style:{fontSize:"14px",color:"#dc2626",marginBottom:"12px"},children:v}),p.jsx("button",{onClick:()=>{E(null),G()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const Pe={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},Me={...Pe,opacity:.3,cursor:"not-allowed"},mt=l?{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"}:{overflow:"hidden",background:"white",flexShrink:0};return p.jsxs("div",{style:mt,children:[p.jsx("canvas",{ref:X,style:{width:"100%",height:"32px",cursor:"pointer",flexShrink:0},onMouseDown:q=>{if(a==="editing"){Mt.current=!0,pt.current=q.clientX,ct.current=x;const T=Q=>{Mt.current&&ke(Q.clientX)},H=()=>{Mt.current=!1,window.removeEventListener("mousemove",T),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",T),window.addEventListener("mouseup",H)}}}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:l?"6px 8px":"4px",borderTop:"1px solid #d4d4d4",background:"linear-gradient(to bottom, #e0e0e0 0%, #c8c8c8 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.1)",flexShrink:0},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[p.jsx("button",{onClick:Se,disabled:a==="idle"||a==="recording",style:a==="idle"||a==="recording"?Me:Pe,title:"Go to start",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),p.jsx("button",{onClick:()=>{if(a==="recording"){const q=ce.current;q&&(q.state==="recording"?(q.pause(),k(!0)):q.state==="paused"&&(q.resume(),k(!1)))}else Tt()},disabled:a==="idle",style:a==="idle"?Me:Pe,title:g||a==="recording"&&!D?"Pause":"Play",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:g||a==="recording"&&!D?"pause":"play_arrow"})}),p.jsx("button",{onClick:At,disabled:a==="idle"||a==="recording",style:a==="idle"||a==="recording"?Me:Pe,title:"Go to end",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"last_page"})}),p.jsx("div",{style:{width:"1px",height:"24px",margin:"0 4px",background:"linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(0,0,0,0.15))"}}),p.jsx("button",{onClick:()=>{b==="insert"?Ee():a==="idle"?(_("insert"),G()):a==="editing"&&(_("insert"),$t("insert"))},disabled:a==="recording"&&b!=="insert"||g,style:a==="recording"&&b!=="insert"||g?Me:Pe,title:b==="insert"?"Stop recording":"Insert recording",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="insert"?"#ef4444":"#171717"},children:"add"})}),p.jsx("button",{onClick:()=>{b==="mic"?Ee():a==="idle"?(_("mic"),G()):a==="editing"&&(_("mic"),$t("replace"))},disabled:a==="recording"&&b!=="mic"||g,style:a==="recording"&&b!=="mic"||g?Me:Pe,title:b==="mic"?"Stop recording":"Record",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="mic"?"#ef4444":"#171717"},children:"mic"})}),p.jsx("button",{onClick:()=>{b==="startover"?Ee():a==="editing"&&(_("startover"),K())},disabled:a==="idle"||a==="recording"&&b!=="startover"||g,style:a==="idle"||a==="recording"&&b!=="startover"||g?Me:Pe,title:b==="startover"?"Stop recording":"Start over",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[N.total>0&&N.completed<N.total&&p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",background:"rgba(16, 185, 129, 0.1)",borderRadius:"4px",fontSize:"11px",color:"#10b981"},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"14px",animation:"spin 1s linear infinite"},children:"sync"}),N.completed,"/",N.total]}),t&&p.jsx("button",{onClick:()=>{a==="editing"&&De.current&&!S?Ae(De.current):A(!S)},style:{...Pe,background:S?"rgba(16, 185, 129, 0.2)":"transparent",borderRadius:"8px"},title:S?"Auto-transcribe ON (click to turn off)":"Click to enable auto-transcribe",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:S?"#10b981":"#171717"},children:"subtitles"})}),!o&&p.jsx("button",{onClick:J,disabled:a!=="editing",style:a!=="editing"?Me:Pe,title:"Save recording",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]}),N.total>0&&N.completed<N.total&&p.jsx("div",{style:{height:"3px",background:"#e5e5e5",overflow:"hidden"},children:p.jsx("div",{style:{height:"100%",background:"#10b981",width:`${N.completed/N.total*100}%`,transition:"width 0.3s ease"}})})]})}exports.AnimatedCardFlip=hu;exports.ApiClient=dl;exports.AudioEditor=xf;exports.AuthManager=cl;exports.Card=cu;exports.ComboBox=df;exports.DataOperations=Rn;exports.Detail=du;exports.GraphClient=Ia;exports.KanbanBoard=ff;exports.Mail=gu;exports.MailClient=ul;exports.MailComposer=uf;exports.MailEditor=ja;exports.SelectableList=mu;exports.Stack=uu;exports.Timeline=yf;exports.getApiClient=ui;exports.initializeApiClient=iu;exports.useMutation=ou;exports.useQuery=fl;
|
|
153
|
+
`})]})}const cf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function df({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:o,allowDelete:i=!1,onDelete:l,label:a,disabled:u=!1,max:c=0,theme:d={},className:f=""}){const h={...cf,...d},[g,m]=w.useState(!1),[x,C]=w.useState(""),v=w.useRef(null),E=w.useRef(null);w.useEffect(()=>{function B(N){v.current&&!v.current.contains(N.target)&&(m(!1),C(""))}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);const D=r.filter(B=>{var N;return((N=B.label)==null?void 0:N.toLowerCase().includes(x.toLowerCase()))&&!e.includes(B.id)}),k=s&&x.trim()&&!r.some(B=>{var N;return((N=B.label)==null?void 0:N.toLowerCase())===x.toLowerCase()}),b=e.map(B=>r.find(N=>N.id===B)).filter(Boolean),_=w.useCallback(B=>{var N;c>0&&e.length>=c||(t([...e,B]),C(""),(N=E.current)==null||N.focus())},[e,t,c]),S=w.useCallback(B=>{t(e.filter(N=>N!==B))},[e,t]),A=w.useCallback(async()=>{if(!k)return;const B=await(o==null?void 0:o(x.trim()));B&&_(B.id),C("")},[k,x,o,_]),I=w.useCallback(B=>{B.key==="Enter"?(B.preventDefault(),k?A():D.length>0&&_(D[0].id)):B.key==="Backspace"&&!x&&e.length>0?S(e[e.length-1]):B.key==="Escape"&&(m(!1),C(""))},[k,D,x,e,A,_,S]);return p.jsxs("div",{ref:v,className:f,style:{position:"relative"},children:[a&&p.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:a}),p.jsxs("div",{onClick:()=>!u&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${g?h.primary:h.border}`,borderRadius:"8px",background:u?h.hoverBackground:h.background,cursor:u?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[b.map(B=>p.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",fontSize:"13px",background:B.color||h.chipBackground,color:B.color?"#fff":h.chipText},children:[B.label,!u&&p.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),S(B.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},B.id)),p.jsx("input",{ref:E,type:"text",value:x,onChange:B=>{C(B.target.value),g||m(!0)},onFocus:()=>m(!0),onKeyDown:I,placeholder:b.length===0?n:"",disabled:u||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),g&&!u&&p.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:h.background,border:`1px solid ${h.border}`,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",maxHeight:"200px",overflowY:"auto",zIndex:50},children:D.length===0&&!k?p.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:x?"No matches":"No options available"}):p.jsxs(p.Fragment,{children:[D.map(B=>p.jsxs("div",{onClick:()=>_(B.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:N=>{N.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:N=>{N.currentTarget.style.background=""},children:[B.label,i&&l&&p.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),l(B.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:N=>{N.currentTarget.style.opacity="1",N.currentTarget.style.color="#ef4444"},onMouseLeave:N=>{N.currentTarget.style.opacity="0.5",N.currentTarget.style.color=h.textSecondary||""},children:"×"})]},B.id)),k&&p.jsxs("div",{onClick:A,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:D.length>0?`1px solid ${h.border}`:"none"},onMouseEnter:B=>{B.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:B=>{B.currentTarget.style.background=""},children:['+ Create "',x.trim(),'"']})]})})]})}function ff({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:o,onItemMove:i,onItemReorder:l,onItemClick:a,renderColumnHeader:u,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[g,m]=w.useState(null),[x,C]=w.useState(null),[v,E]=w.useState(null),D=w.useRef(null),k=e.reduce((N,j)=>{let L=r.filter(z=>n(z)===j.id);return s&&(L=L.sort((z,X)=>s(z)-s(X))),N[j.id]=L,N},{}),b=w.useCallback((N,j)=>{const L=t(j),z=n(j);m(L),D.current=z,N.dataTransfer.effectAllowed="move",N.dataTransfer.setData("text/plain",L),requestAnimationFrame(()=>{const X=N.target;X.style.opacity="0.5"})},[t,n]),_=w.useCallback(N=>{const j=N.target;j.style.opacity="1",m(null),C(null),E(null),D.current=null},[]),S=w.useCallback((N,j,L)=>{N.preventDefault(),N.dataTransfer.dropEffect="move",C(j),E(L)},[]),A=w.useCallback(N=>{const j=N.relatedTarget;j!=null&&j.closest("[data-kanban-column]")||(C(null),E(null))},[]),I=w.useCallback((N,j,L)=>{if(N.preventDefault(),!g)return;const z=D.current;z===j?l==null||l(g,j,L):z&&i(g,z,j,L),m(null),C(null),E(null),D.current=null},[g,i,l]),B=(N,j)=>p.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[N.color&&p.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:N.color}}),p.jsx("span",{className:"font-medium text-sm text-neutral-700",children:N.label})]}),p.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:j})]});return p.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(N=>{const j=k[N.id]||[],L=x===N.id;return p.jsxs("div",{"data-kanban-column":N.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:z=>{z.preventDefault(),g&&!L&&C(N.id)},onDragLeave:A,onDrop:z=>I(z,N.id,v??j.length),children:[p.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(N,j.length):B(N,j.length)}),p.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${L?"bg-blue-50":""}`,children:[j.map((z,X)=>{const ce=t(z),ve=g===ce,le=L&&v===X&&!ve;return p.jsxs("div",{children:[le&&p.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),p.jsx("div",{draggable:!0,onDragStart:Le=>b(Le,z),onDragEnd:_,onDragOver:Le=>S(Le,N.id,X),onClick:()=>a==null?void 0:a(z),className:`cursor-grab active:cursor-grabbing transition-all ${ve?"opacity-50 scale-95":""} ${h}`,children:o(z,ve)})]},ce)}),p.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:z=>{z.preventDefault(),S(z,N.id,j.length)},children:L&&v===j.length&&p.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),j.length===0&&L&&p.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:p.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&p.jsx("div",{className:"flex-shrink-0 border-t border-neutral-200 p-2",children:c(N)})]},N.id)})})}const hf={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function pf(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function gf(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function mf(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function yf({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:o,getItemDuration:i,getItemIsAllDay:l,getItemId:a,renderItem:u,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:g={}}){const m={...hf,...g},{allDayItems:x,timedItems:C}=w.useMemo(()=>{const _=[],S=[];for(const A of r)l(A)?_.push(A):S.push(A);return{allDayItems:_,timedItems:S}},[r,l]),v=w.useMemo(()=>{const _=[];for(let S=t;S<=n;S++)_.push(S);return _},[t,n]),E=(n-t+1)*s,D=w.useCallback(_=>{const S=o(_);if(!S)return null;const A=pf(S);if(!A)return null;const{hours:I,minutes:B}=A,N=Math.max(t,Math.min(n,I)),j=I<t?0:B,L=(N-t)*s+j/60*s,z=i(_),X=Math.max(20,z/60*s);return{top:L,height:X}},[o,i,t,n,s]),k=w.useMemo(()=>{if(!f||!mf(e))return null;const _=new Date,S=_.getHours(),A=_.getMinutes();return S<t||S>n?null:(S-t)*s+A/60*s},[e,f,t,n,s]),b=w.useCallback(_=>{if(!d)return;const S=_.currentTarget.getBoundingClientRect(),I=(_.clientY-S.top)/s*60,B=Math.floor(I/60)+t,N=Math.round(I%60/15)*15,j=Math.min(n,Math.max(t,B)),L=N>=60?0:N,z=`${j.toString().padStart(2,"0")}:${L.toString().padStart(2,"0")}`;d(z)},[d,s,t,n]);return p.jsxs("div",{className:h,style:{background:m.background},children:[x.length>0&&p.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[p.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),p.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:x.map(_=>p.jsx("div",{onClick:()=>c==null?void 0:c(_),style:{cursor:c?"pointer":"default"},children:u(_)},a(_)))})]}),p.jsxs("div",{style:{position:"relative",height:E},children:[v.map((_,S)=>p.jsxs("div",{style:{position:"absolute",top:S*s,left:0,right:0},children:[p.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:gf(_)}),p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),S<v.length-1&&p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},_)),p.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:b}),k!==null&&p.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:k,zIndex:20,pointerEvents:"none"},children:[p.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),p.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),C.map(_=>{const S=D(_);return S?p.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:S.top,height:S.height,zIndex:10,cursor:c?"pointer":"default"},onClick:A=>{A.stopPropagation(),c==null||c(_)},children:u(_)},a(_)):null})]})]})}function xf({onComplete:r,onCancel:e,onTranscribe:t,onTranscriptionComplete:n,variant:s="widget",hideSaveButton:o=!1,maxDuration:i=180}){const l=s==="widget",[a,u]=w.useState("idle"),[c,d]=w.useState(0),[f,h]=w.useState(0),[g,m]=w.useState(!1),[x,C]=w.useState(0),[v,E]=w.useState(null),[D,k]=w.useState(!1),[b,_]=w.useState(null),[S,A]=w.useState(!1),[I,B]=w.useState([]),[N,j]=w.useState({completed:0,total:0}),L=w.useRef(!1),z=w.useRef(!1);w.useEffect(()=>{z.current=S},[S]);const X=w.useRef(null),ce=w.useRef(null),ve=w.useRef(null),le=w.useRef(null),Le=w.useRef(null),me=w.useRef([]),he=w.useRef(null),ye=w.useRef(null),xe=w.useRef(null),De=w.useRef(null),pe=w.useRef(!1),Ce=w.useRef([]),Ne=w.useRef(null),ae=w.useRef(null),Re=w.useRef([]),ot=w.useRef([]),St=w.useRef("insert"),Mt=w.useRef(!1),tt=w.useRef(0),pt=w.useRef(0),ct=w.useRef(0),Ht=q=>{const T=Math.floor(q/60),H=Math.floor(q%60);return`${T.toString().padStart(2,"0")}:${H.toString().padStart(2,"0")}`},It=async q=>{const T=await q.arrayBuffer(),H=new AudioContext,Q=await H.decodeAudioData(T);return await H.close(),Q},Et=q=>{const T=q.numberOfChannels,H=q.sampleRate,Q=1,O=16,re=O/8,Z=T*re,ee=H*Z,de=q.length*Z,we=new ArrayBuffer(44+de),te=new DataView(we),ne=(Te,be)=>{for(let He=0;He<be.length;He++)te.setUint8(Te+He,be.charCodeAt(He))};ne(0,"RIFF"),te.setUint32(4,36+de,!0),ne(8,"WAVE"),ne(12,"fmt "),te.setUint32(16,16,!0),te.setUint16(20,Q,!0),te.setUint16(22,T,!0),te.setUint32(24,H,!0),te.setUint32(28,ee,!0),te.setUint16(32,Z,!0),te.setUint16(34,O,!0),ne(36,"data"),te.setUint32(40,de,!0);const Ie=[];for(let Te=0;Te<T;Te++)Ie.push(q.getChannelData(Te));let qe=44;for(let Te=0;Te<q.length;Te++)for(let be=0;be<T;be++){const He=Math.max(-1,Math.min(1,Ie[be][Te])),Je=He<0?He*32768:He*32767;te.setInt16(qe,Je,!0),qe+=2}return new Blob([we],{type:"audio/wav"})},kt=async(q,T,H,Q)=>{const O=new AudioContext,re=q.sampleRate,Z=Math.max(q.numberOfChannels,T.numberOfChannels),ee=Math.min(H,q.length),de=Math.max(0,q.length-H),we=Q==="insert"?ee+T.length+de:ee+T.length,te=O.createBuffer(Z,we,re);for(let ne=0;ne<Z;ne++){const Ie=te.getChannelData(ne),qe=ne<q.numberOfChannels?q.getChannelData(ne):q.getChannelData(0);for(let be=0;be<ee;be++)Ie[be]=qe[be];const Te=ne<T.numberOfChannels?T.getChannelData(ne):T.getChannelData(0);for(let be=0;be<T.length;be++)Ie[ee+be]=Te[be];if(Q==="insert")for(let be=0;be<de;be++)Ie[ee+T.length+be]=qe[H+be]}return await O.close(),te},lt=w.useCallback(()=>{const q=X.current;if(!q)return;const T=q.getContext("2d");if(!T)return;const H=q.getBoundingClientRect(),Q=H.width,O=H.height,re=Ce.current,Z=f||c||1,ee=a==="recording"?c:x;T.fillStyle="#2d3b35",T.fillRect(0,0,Q,O);const de=8,we="rgba(0, 0, 0, 0.4)",te=T.createLinearGradient(0,0,0,de);te.addColorStop(0,we),te.addColorStop(1,"transparent"),T.fillStyle=te,T.fillRect(0,0,Q,de);const ne=T.createLinearGradient(0,O-de,0,O);ne.addColorStop(0,"transparent"),ne.addColorStop(1,we),T.fillStyle=ne,T.fillRect(0,O-de,Q,de);const Ie=T.createLinearGradient(0,0,de,0);Ie.addColorStop(0,we),Ie.addColorStop(1,"transparent"),T.fillStyle=Ie,T.fillRect(0,0,de,O);const qe=T.createLinearGradient(Q-de,0,Q,0);qe.addColorStop(0,"transparent"),qe.addColorStop(1,we),T.fillStyle=qe,T.fillRect(Q-de,0,de,O),T.strokeStyle="#5a6b62",T.lineWidth=1,T.beginPath(),T.moveTo(0,O/2),T.lineTo(Q,O/2),T.stroke();const Te=Q/2;if(re.length>0)if(a==="recording")for(let Je=0;Je<re.length;Je++){const dt=re.length-1-Je,zt=Te-dt*4;if(zt<-3||zt>Q)continue;const yt=re[Je]*(O/2-12),y=O/2-yt;T.fillStyle="#10b981",T.fillRect(zt,y,3,yt*2)}else{const Je=Z>0?ee/Z*re.length:0;for(let dt=0;dt<re.length;dt++){const zt=Je-dt,yt=Te-zt*4;if(yt<-3||yt>Q)continue;const y=re[dt]*(O/2-12),R=O/2-y;T.fillStyle=dt<=Je?"#10b981":"#4b5563",T.fillRect(yt,R,3,y*2)}}T.strokeStyle="#ef4444",T.lineWidth=1,T.beginPath(),T.moveTo(Te,0),T.lineTo(Te,O),T.stroke(),T.fillStyle="#fff",T.font="bold 18px monospace",T.textAlign="center",T.fillText(Ht(ee),Te,O-6),a==="recording"&&(T.fillStyle="#ef4444",T.beginPath(),T.arc(20,20,8,0,Math.PI*2),T.fill(),T.fillStyle="#fff",T.font="10px sans-serif",T.textAlign="left",T.fillText("REC",34,24)),T.textAlign="left"},[a,x,c,f]),gt=()=>{const q=Le.current;if(!q||!pe.current)return;const T=q.frequencyBinCount,H=new Uint8Array(T);q.getByteTimeDomainData(H);let Q=0;for(let Z=0;Z<T;Z++){const ee=(H[Z]-128)/128;Q+=ee*ee}const O=Math.sqrt(Q/T),re=Math.min(1,O*3);Ce.current.push(re),lt(),pe.current&&(ye.current=requestAnimationFrame(gt))},G=async()=>{try{E(null),k(!1),Ne.current===null&&(Ce.current=[]);const q=await navigator.mediaDevices.getUserMedia({audio:!0});ve.current=q;const T=new AudioContext;le.current=T;const H=T.createAnalyser();H.fftSize=2048,Le.current=H,T.createMediaStreamSource(q).connect(H);const O=new MediaRecorder(q);ce.current=O,me.current=[],O.ondataavailable=re=>{re.data.size>0&&me.current.push(re.data)},O.onstop=async()=>{try{if(pe.current=!1,me.current.length===0){E("No audio was recorded. Please try again."),u("idle"),q.getTracks().forEach(te=>te.stop());return}const re=new Blob(me.current,{type:"audio/webm"});let Z,ee;if(Ne.current!==null&&ae.current)try{const te=await It(re),ne=ae.current.sampleRate,Ie=Math.floor(Ne.current*ne),qe=await kt(ae.current,te,Ie,St.current);Z=Et(qe),ee=qe.length/qe.sampleRate,St.current==="insert"&&(Ce.current=[...Ce.current,...ot.current]),Ne.current=null,ae.current=null,Re.current=[],ot.current=[]}catch{Z=re,ee=tt.current>0?tt.current:1}else Z=re,ee=tt.current>0?tt.current:1;if(De.current=Z,q.getTracks().forEach(te=>te.stop()),z.current&&t){B(te=>[...te,Z]),j(te=>({...te,total:te.total+1})),De.current=null,Ce.current=[],C(0),h(0),d(0),u("idle");return}const de=URL.createObjectURL(Z),we=new Audio(de);we.ontimeupdate=()=>{C(we.currentTime)},we.onended=()=>{m(!1)},xe.current=we,h(ee),C(ee),u("editing")}catch{E("Failed to process recording"),u("idle")}},O.start(100),pe.current=!0,u("recording"),d(0),tt.current=0,he.current=setInterval(()=>{tt.current+=1,d(tt.current),tt.current>=i&&(ce.current&&ce.current.state!=="inactive"&&ce.current.stop(),pe.current=!1,_(null),he.current&&(clearInterval(he.current),he.current=null),ye.current&&(cancelAnimationFrame(ye.current),ye.current=null),setTimeout(()=>{alert(`Maximum recording time of ${Math.floor(i/60)} minutes reached.`)},100))},1e3)}catch{E("Could not access microphone. Please allow microphone access.")}},Ee=()=>{pe.current=!1,k(!1),_(null),ye.current&&(cancelAnimationFrame(ye.current),ye.current=null),he.current&&(clearInterval(he.current),he.current=null),ce.current&&ce.current.state!=="inactive"&&ce.current.stop()},ke=q=>{const T=X.current;if(!T)return;const H=f||c;if(H<=0)return;const Q=Ce.current;if(Q.length===0)return;const O=T.getBoundingClientRect(),re=q-pt.current,Z=4,ee=O.width/T.width,de=Q.length/H*Z,we=-re/(de*ee),te=ct.current+we,ne=Math.max(0,Math.min(te,H));xe.current&&(xe.current.currentTime=ne),C(ne)},Se=()=>{xe.current&&(xe.current.currentTime=0),C(0)},At=()=>{const q=f||c;xe.current&&(xe.current.currentTime=q),C(q)},Tt=()=>{const q=xe.current;q&&(g?(q.pause(),C(q.currentTime),m(!1)):(q.currentTime=x,q.play().catch(()=>{}),m(!0)))},$t=async q=>{if(!De.current){G();return}try{xe.current&&(xe.current.pause(),m(!1)),St.current=q,ae.current=await It(De.current);const T=f||c;Ne.current=x;const H=T>0?x/T:0,Q=Math.floor(H*Ce.current.length);Re.current=Ce.current.slice(0,Q),ot.current=Ce.current.slice(Q),Ce.current=[...Re.current],G()}catch{E("Failed to prepare recording. Please try again.")}},K=()=>{xe.current&&(xe.current.pause(),xe.current=null),De.current=null,ae.current=null,Ne.current=null,Re.current=[],m(!1),C(0),h(0),d(0),G()},J=()=>{De.current?r(De.current,f||c):alert("No audio recorded yet!")};w.useEffect(()=>{a==="recording"&&X.current&&Le.current&&pe.current&&(ye.current=requestAnimationFrame(gt))},[a]),w.useEffect(()=>{const q=X.current;if(!q)return;const T=()=>{const H=window.devicePixelRatio||1,Q=q.getBoundingClientRect();q.width=Q.width*H,q.height=Q.height*H;const O=q.getContext("2d");O&&O.scale(H,H)};return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]),w.useEffect(()=>{if(a==="idle"){const q=X.current;if(!q)return;const T=q.getContext("2d");if(!T)return;const H=q.getBoundingClientRect(),Q=H.width,O=H.height;T.fillStyle="#2d3b35",T.fillRect(0,0,Q,O);const re=8,Z="rgba(0, 0, 0, 0.4)",ee=T.createLinearGradient(0,0,0,re);ee.addColorStop(0,Z),ee.addColorStop(1,"transparent"),T.fillStyle=ee,T.fillRect(0,0,Q,re);const de=T.createLinearGradient(0,O-re,0,O);de.addColorStop(0,"transparent"),de.addColorStop(1,Z),T.fillStyle=de,T.fillRect(0,O-re,Q,re);const we=T.createLinearGradient(0,0,re,0);we.addColorStop(0,Z),we.addColorStop(1,"transparent"),T.fillStyle=we,T.fillRect(0,0,re,O);const te=T.createLinearGradient(Q-re,0,Q,0);te.addColorStop(0,"transparent"),te.addColorStop(1,Z),T.fillStyle=te,T.fillRect(Q-re,0,re,O),T.strokeStyle="#5a6b62",T.lineWidth=1,T.beginPath(),T.moveTo(0,O/2),T.lineTo(Q,O/2),T.stroke();const ne=Q/2;T.strokeStyle="#ef4444",T.lineWidth=1,T.beginPath(),T.moveTo(ne,0),T.lineTo(ne,O),T.stroke(),T.fillStyle="#fff",T.font="bold 18px monospace",T.textAlign="center",T.fillText("00:00",ne,O-6)}},[a]);const Ae=w.useCallback(q=>{B(T=>[...T,q]),j(T=>({...T,total:T.total+1}))},[]);if(w.useEffect(()=>{(async()=>{if(L.current||I.length===0||!t)return;L.current=!0;const T=I[0];try{const H=await t(T);H&&n&&n(H)}catch(H){console.error("Transcription failed:",H)}finally{B(H=>H.slice(1)),j(H=>({...H,completed:H.completed+1})),L.current=!1}})()},[I,t,n]),w.useEffect(()=>()=>{pe.current=!1,he.current&&clearInterval(he.current),ye.current&&cancelAnimationFrame(ye.current),ve.current&&ve.current.getTracks().forEach(q=>q.stop()),le.current&&le.current.state!=="closed"&&le.current.close()},[]),w.useEffect(()=>{if(a==="editing"&&g){let q;const T=()=>{const H=xe.current;if(H&&g){const Q=X.current;if(Q){const O=Q.getContext("2d");if(O){const re=Q.getBoundingClientRect(),Z=re.width,ee=re.height,de=Ce.current,we=f||c||1,te=H.currentTime;O.fillStyle="#2d3b35",O.fillRect(0,0,Z,ee);const ne=8,Ie="rgba(0, 0, 0, 0.4)",qe=O.createLinearGradient(0,0,0,ne);qe.addColorStop(0,Ie),qe.addColorStop(1,"transparent"),O.fillStyle=qe,O.fillRect(0,0,Z,ne);const Te=O.createLinearGradient(0,ee-ne,0,ee);Te.addColorStop(0,"transparent"),Te.addColorStop(1,Ie),O.fillStyle=Te,O.fillRect(0,ee-ne,Z,ne);const be=O.createLinearGradient(0,0,ne,0);be.addColorStop(0,Ie),be.addColorStop(1,"transparent"),O.fillStyle=be,O.fillRect(0,0,ne,ee);const He=O.createLinearGradient(Z-ne,0,Z,0);He.addColorStop(0,"transparent"),He.addColorStop(1,Ie),O.fillStyle=He,O.fillRect(Z-ne,0,ne,ee),O.strokeStyle="#5a6b62",O.lineWidth=1,O.beginPath(),O.moveTo(0,ee/2),O.lineTo(Z,ee/2),O.stroke();const Je=Z/2,dt=3,zt=4,yt=we>0?te/we*de.length:0;for(let U=0;U<de.length;U++){const Y=yt-U,oe=Je-Y*zt;if(oe<-dt||oe>Z)continue;const ge=de[U]*(ee/2-12),se=ee/2-ge;O.fillStyle=U<=yt?"#10b981":"#4b5563",O.fillRect(oe,se,dt,ge*2)}O.strokeStyle="#ef4444",O.lineWidth=1,O.beginPath(),O.moveTo(Je,0),O.lineTo(Je,ee),O.stroke(),O.fillStyle="#fff",O.font="bold 18px monospace",O.textAlign="center";const y=Math.floor(te/60),R=Math.floor(te%60);O.fillText(`${y.toString().padStart(2,"0")}:${R.toString().padStart(2,"0")}`,Je,ee-6),O.textAlign="left"}}q=requestAnimationFrame(T)}};return q=requestAnimationFrame(T),()=>cancelAnimationFrame(q)}},[a,g,f,c]),w.useEffect(()=>{a==="editing"&&!g&<()},[a,x,g,lt]),v)return p.jsxs("div",{style:{border:"1px solid #fecaca",borderRadius:"12px",padding:"16px",background:"#fef2f2"},children:[p.jsx("p",{style:{fontSize:"14px",color:"#dc2626",marginBottom:"12px"},children:v}),p.jsx("button",{onClick:()=>{E(null),G()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const Pe={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},Oe={...Pe,opacity:.3,cursor:"not-allowed"},mt=l?{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"}:{overflow:"hidden",background:"white",flexShrink:0};return p.jsxs("div",{style:mt,children:[p.jsx("canvas",{ref:X,style:{width:"100%",height:"32px",cursor:"pointer",flexShrink:0},onMouseDown:q=>{if(a==="editing"){Mt.current=!0,pt.current=q.clientX,ct.current=x;const T=Q=>{Mt.current&&ke(Q.clientX)},H=()=>{Mt.current=!1,window.removeEventListener("mousemove",T),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",T),window.addEventListener("mouseup",H)}}}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:l?"6px 8px":"4px",borderTop:"1px solid #d4d4d4",background:"linear-gradient(to bottom, #e0e0e0 0%, #c8c8c8 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.1)",flexShrink:0},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[p.jsx("button",{onClick:Se,disabled:a==="idle"||a==="recording",style:a==="idle"||a==="recording"?Oe:Pe,title:"Go to start",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),p.jsx("button",{onClick:()=>{if(a==="recording"){const q=ce.current;q&&(q.state==="recording"?(q.pause(),k(!0)):q.state==="paused"&&(q.resume(),k(!1)))}else Tt()},disabled:a==="idle",style:a==="idle"?Oe:Pe,title:g||a==="recording"&&!D?"Pause":"Play",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:g||a==="recording"&&!D?"pause":"play_arrow"})}),p.jsx("button",{onClick:At,disabled:a==="idle"||a==="recording",style:a==="idle"||a==="recording"?Oe:Pe,title:"Go to end",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"last_page"})}),p.jsx("div",{style:{width:"1px",height:"24px",margin:"0 4px",background:"linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(0,0,0,0.15))"}}),p.jsx("button",{onClick:()=>{b==="insert"?Ee():a==="idle"?(_("insert"),G()):a==="editing"&&(_("insert"),$t("insert"))},disabled:a==="recording"&&b!=="insert"||g,style:a==="recording"&&b!=="insert"||g?Oe:Pe,title:b==="insert"?"Stop recording":"Insert recording",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="insert"?"#ef4444":"#171717"},children:"add"})}),p.jsx("button",{onClick:()=>{b==="mic"?Ee():a==="idle"?(_("mic"),G()):a==="editing"&&(_("mic"),$t("replace"))},disabled:a==="recording"&&b!=="mic"||g,style:a==="recording"&&b!=="mic"||g?Oe:Pe,title:b==="mic"?"Stop recording":"Record",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="mic"?"#ef4444":"#171717"},children:"mic"})}),p.jsx("button",{onClick:()=>{b==="startover"?Ee():a==="editing"&&(_("startover"),K())},disabled:a==="idle"||a==="recording"&&b!=="startover"||g,style:a==="idle"||a==="recording"&&b!=="startover"||g?Oe:Pe,title:b==="startover"?"Stop recording":"Start over",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[N.total>0&&N.completed<N.total&&p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",background:"rgba(16, 185, 129, 0.1)",borderRadius:"4px",fontSize:"11px",color:"#10b981"},children:[p.jsx("span",{className:"material-icons",style:{fontSize:"14px",animation:"spin 1s linear infinite"},children:"sync"}),N.completed,"/",N.total]}),t&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginRight:"4px"},children:[p.jsx("button",{onClick:()=>A(!S),style:{width:"28px",height:"16px",borderRadius:"8px",border:"none",background:S?"#10b981":"#9ca3af",cursor:"pointer",position:"relative",transition:"background 0.2s",padding:0},title:S?"Auto-transcribe ON":"Auto-transcribe OFF",children:p.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"white",position:"absolute",top:"2px",left:S?"14px":"2px",transition:"left 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.2)"}})}),p.jsx("span",{style:{fontSize:"10px",color:"#666"},children:"auto"})]}),p.jsx("button",{onClick:()=>{a==="editing"&&De.current&&Ae(De.current)},disabled:a!=="editing",style:a!=="editing"?Oe:Pe,title:"Transcribe audio",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:S?"#10b981":"#171717"},children:"subtitles"})})]}),!o&&p.jsx("button",{onClick:J,disabled:a!=="editing",style:a!=="editing"?Oe:Pe,title:"Save recording",children:p.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]}),N.total>0&&N.completed<N.total&&p.jsx("div",{style:{height:"3px",background:"#e5e5e5",overflow:"hidden"},children:p.jsx("div",{style:{height:"100%",background:"#10b981",width:`${N.completed/N.total*100}%`,transition:"width 0.3s ease"}})})]})}exports.AnimatedCardFlip=hu;exports.ApiClient=dl;exports.AudioEditor=xf;exports.AuthManager=cl;exports.Card=cu;exports.ComboBox=df;exports.DataOperations=Rn;exports.Detail=du;exports.GraphClient=Ia;exports.KanbanBoard=ff;exports.Mail=gu;exports.MailClient=ul;exports.MailComposer=uf;exports.MailEditor=ja;exports.SelectableList=mu;exports.Stack=uu;exports.Timeline=yf;exports.getApiClient=ui;exports.initializeApiClient=iu;exports.useMutation=ou;exports.useQuery=fl;
|
package/dist/index.esm.js
CHANGED
|
@@ -4287,18 +4287,18 @@ function pu() {
|
|
|
4287
4287
|
if (ot && Y && typeof ot.stack == "string") {
|
|
4288
4288
|
for (var oe = ot.stack.split(`
|
|
4289
4289
|
`), et = Y.stack.split(`
|
|
4290
|
-
`),
|
|
4290
|
+
`), ze = oe.length - 1, Ue = et.length - 1; ze >= 1 && Ue >= 0 && oe[ze] !== et[Ue]; )
|
|
4291
4291
|
Ue--;
|
|
4292
|
-
for (;
|
|
4293
|
-
if (oe[
|
|
4294
|
-
if (
|
|
4292
|
+
for (; ze >= 1 && Ue >= 0; ze--, Ue--)
|
|
4293
|
+
if (oe[ze] !== et[Ue]) {
|
|
4294
|
+
if (ze !== 1 || Ue !== 1)
|
|
4295
4295
|
do
|
|
4296
|
-
if (
|
|
4296
|
+
if (ze--, Ue--, Ue < 0 || oe[ze] !== et[Ue]) {
|
|
4297
4297
|
var mt = `
|
|
4298
|
-
` + oe[
|
|
4298
|
+
` + oe[ze].replace(" at new ", " at ");
|
|
4299
4299
|
return y.displayName && mt.includes("<anonymous>") && (mt = mt.replace("<anonymous>", y.displayName)), typeof y == "function" && Me.set(y, mt), mt;
|
|
4300
4300
|
}
|
|
4301
|
-
while (
|
|
4301
|
+
while (ze >= 1 && Ue >= 0);
|
|
4302
4302
|
break;
|
|
4303
4303
|
}
|
|
4304
4304
|
}
|
|
@@ -4364,8 +4364,8 @@ function pu() {
|
|
|
4364
4364
|
throw et.name = "Invariant Violation", et;
|
|
4365
4365
|
}
|
|
4366
4366
|
oe = y[ie](L, ie, Y, q, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
4367
|
-
} catch (
|
|
4368
|
-
oe =
|
|
4367
|
+
} catch (ze) {
|
|
4368
|
+
oe = ze;
|
|
4369
4369
|
}
|
|
4370
4370
|
oe && !(oe instanceof Error) && (Nt(le), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Y || "React class", q, ie, typeof oe), Nt(null)), oe instanceof Error && !(oe.message in Zt) && (Zt[oe.message] = !0, Nt(le), v("Failed %s type: %s", q, oe.message), Nt(null));
|
|
4371
4371
|
}
|
|
@@ -4420,7 +4420,7 @@ function pu() {
|
|
|
4420
4420
|
function Ie(y, L) {
|
|
4421
4421
|
typeof y.ref == "string" && jt.current;
|
|
4422
4422
|
}
|
|
4423
|
-
function
|
|
4423
|
+
function $e(y, L) {
|
|
4424
4424
|
{
|
|
4425
4425
|
var q = function() {
|
|
4426
4426
|
Gt || (Gt = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", L));
|
|
@@ -4478,13 +4478,13 @@ function pu() {
|
|
|
4478
4478
|
for (me in L)
|
|
4479
4479
|
pt.call(L, me) && !Lt.hasOwnProperty(me) && (ie[me] = L[me]);
|
|
4480
4480
|
if (y && y.defaultProps) {
|
|
4481
|
-
var
|
|
4482
|
-
for (me in
|
|
4483
|
-
ie[me] === void 0 && (ie[me] =
|
|
4481
|
+
var ze = y.defaultProps;
|
|
4482
|
+
for (me in ze)
|
|
4483
|
+
ie[me] === void 0 && (ie[me] = ze[me]);
|
|
4484
4484
|
}
|
|
4485
4485
|
if (oe || et) {
|
|
4486
4486
|
var Ue = typeof y == "function" ? y.displayName || y.name || "Unknown" : y;
|
|
4487
|
-
oe &&
|
|
4487
|
+
oe && $e(ie, Ue), et && _t(ie, Ue);
|
|
4488
4488
|
}
|
|
4489
4489
|
return z(y, oe, et, le, Y, jt.current, ie);
|
|
4490
4490
|
}
|
|
@@ -4608,8 +4608,8 @@ Check the top-level render call using <` + q + ">.");
|
|
|
4608
4608
|
(y === void 0 || typeof y == "object" && y !== null && Object.keys(y).length === 0) && (oe += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
4609
4609
|
var et = fe();
|
|
4610
4610
|
et ? oe += et : oe += ee();
|
|
4611
|
-
var
|
|
4612
|
-
y === null ?
|
|
4611
|
+
var ze;
|
|
4612
|
+
y === null ? ze = "null" : bt(y) ? ze = "array" : y !== void 0 && y.$$typeof === e ? (ze = "<" + (F(y.type) || "Unknown") + " />", oe = " Did you accidentally export a JSX literal instead of a component?") : ze = typeof y, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ze, oe);
|
|
4613
4613
|
}
|
|
4614
4614
|
var Ue = k(y, L, q, le, me);
|
|
4615
4615
|
if (Ue == null)
|
|
@@ -5303,16 +5303,16 @@ function Af({
|
|
|
5303
5303
|
}
|
|
5304
5304
|
const Ie = G.uid;
|
|
5305
5305
|
if (Ne.shiftKey && X !== null) {
|
|
5306
|
-
const
|
|
5306
|
+
const $e = Math.min(X, J), _t = Math.max(X, J), z = D.slice($e, _t + 1).map((K) => K.uid), k = new Set(z);
|
|
5307
5307
|
$(k), h == null || h(Array.from(k));
|
|
5308
5308
|
} else if (Ne.ctrlKey || Ne.metaKey)
|
|
5309
|
-
$((
|
|
5310
|
-
const _t = new Set(
|
|
5309
|
+
$(($e) => {
|
|
5310
|
+
const _t = new Set($e);
|
|
5311
5311
|
return _t.has(Ie) ? _t.delete(Ie) : _t.add(Ie), h == null || h(Array.from(_t)), _t;
|
|
5312
5312
|
}), de(J);
|
|
5313
5313
|
else {
|
|
5314
|
-
const
|
|
5315
|
-
$(
|
|
5314
|
+
const $e = /* @__PURE__ */ new Set([Ie]);
|
|
5315
|
+
$($e), de(J), h == null || h(Array.from($e));
|
|
5316
5316
|
}
|
|
5317
5317
|
}, [o, X, D, j, f, h, i]), it = re(async () => {
|
|
5318
5318
|
if (!ue || j.size === 0) return;
|
|
@@ -5320,7 +5320,7 @@ function Af({
|
|
|
5320
5320
|
try {
|
|
5321
5321
|
const J = await ue.trashEmails(t, Array.from(j), G);
|
|
5322
5322
|
if (console.log("Trash result:", J), J.success && J.moved > 0) {
|
|
5323
|
-
S((Ie) => Ie.filter((
|
|
5323
|
+
S((Ie) => Ie.filter(($e) => !j.has($e.uid)));
|
|
5324
5324
|
const Ne = Array.from(j);
|
|
5325
5325
|
$(/* @__PURE__ */ new Set()), g == null || g(Ne);
|
|
5326
5326
|
} else
|
|
@@ -5335,7 +5335,7 @@ function Af({
|
|
|
5335
5335
|
try {
|
|
5336
5336
|
const J = await ue.archiveEmails(t, Array.from(j), G);
|
|
5337
5337
|
if (console.log("Archive result:", J), J.success && J.archived > 0) {
|
|
5338
|
-
S((Ie) => Ie.filter((
|
|
5338
|
+
S((Ie) => Ie.filter(($e) => !j.has($e.uid)));
|
|
5339
5339
|
const Ne = Array.from(j);
|
|
5340
5340
|
$(/* @__PURE__ */ new Set()), g == null || g(Ne);
|
|
5341
5341
|
} else
|
|
@@ -13605,7 +13605,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13605
13605
|
alignItems: "center",
|
|
13606
13606
|
justifyContent: "center",
|
|
13607
13607
|
transition: "background 0.15s"
|
|
13608
|
-
},
|
|
13608
|
+
}, $e = {
|
|
13609
13609
|
...Ie,
|
|
13610
13610
|
opacity: 0.3,
|
|
13611
13611
|
cursor: "not-allowed"
|
|
@@ -13649,7 +13649,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13649
13649
|
{
|
|
13650
13650
|
onClick: ke,
|
|
13651
13651
|
disabled: a === "idle" || a === "recording",
|
|
13652
|
-
style: a === "idle" || a === "recording" ?
|
|
13652
|
+
style: a === "idle" || a === "recording" ? $e : Ie,
|
|
13653
13653
|
title: "Go to start",
|
|
13654
13654
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: "first_page" })
|
|
13655
13655
|
}
|
|
@@ -13665,7 +13665,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13665
13665
|
Lt();
|
|
13666
13666
|
},
|
|
13667
13667
|
disabled: a === "idle",
|
|
13668
|
-
style: a === "idle" ?
|
|
13668
|
+
style: a === "idle" ? $e : Ie,
|
|
13669
13669
|
title: g || a === "recording" && !C ? "Pause" : "Play",
|
|
13670
13670
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: g || a === "recording" && !C ? "pause" : "play_arrow" })
|
|
13671
13671
|
}
|
|
@@ -13675,7 +13675,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13675
13675
|
{
|
|
13676
13676
|
onClick: jt,
|
|
13677
13677
|
disabled: a === "idle" || a === "recording",
|
|
13678
|
-
style: a === "idle" || a === "recording" ?
|
|
13678
|
+
style: a === "idle" || a === "recording" ? $e : Ie,
|
|
13679
13679
|
title: "Go to end",
|
|
13680
13680
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: "last_page" })
|
|
13681
13681
|
}
|
|
@@ -13688,7 +13688,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13688
13688
|
b === "insert" ? Te() : a === "idle" ? (_("insert"), W()) : a === "editing" && (_("insert"), Gt("insert"));
|
|
13689
13689
|
},
|
|
13690
13690
|
disabled: a === "recording" && b !== "insert" || g,
|
|
13691
|
-
style: a === "recording" && b !== "insert" || g ?
|
|
13691
|
+
style: a === "recording" && b !== "insert" || g ? $e : Ie,
|
|
13692
13692
|
title: b === "insert" ? "Stop recording" : "Insert recording",
|
|
13693
13693
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: b === "insert" ? "#ef4444" : "#171717" }, children: "add" })
|
|
13694
13694
|
}
|
|
@@ -13700,7 +13700,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13700
13700
|
b === "mic" ? Te() : a === "idle" ? (_("mic"), W()) : a === "editing" && (_("mic"), Gt("replace"));
|
|
13701
13701
|
},
|
|
13702
13702
|
disabled: a === "recording" && b !== "mic" || g,
|
|
13703
|
-
style: a === "recording" && b !== "mic" || g ?
|
|
13703
|
+
style: a === "recording" && b !== "mic" || g ? $e : Ie,
|
|
13704
13704
|
title: b === "mic" ? "Stop recording" : "Record",
|
|
13705
13705
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: b === "mic" ? "#ef4444" : "#171717" }, children: "mic" })
|
|
13706
13706
|
}
|
|
@@ -13712,7 +13712,7 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13712
13712
|
b === "startover" ? Te() : a === "editing" && (_("startover"), G());
|
|
13713
13713
|
},
|
|
13714
13714
|
disabled: a === "idle" || a === "recording" && b !== "startover" || g,
|
|
13715
|
-
style: a === "idle" || a === "recording" && b !== "startover" || g ?
|
|
13715
|
+
style: a === "idle" || a === "recording" && b !== "startover" || g ? $e : Ie,
|
|
13716
13716
|
title: b === "startover" ? "Stop recording" : "Start over",
|
|
13717
13717
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: b === "startover" ? "#ef4444" : "#171717" }, children: "refresh" })
|
|
13718
13718
|
}
|
|
@@ -13734,27 +13734,58 @@ function Nf({ onComplete: r, onCancel: e, onTranscribe: t, onTranscriptionComple
|
|
|
13734
13734
|
"/",
|
|
13735
13735
|
B.total
|
|
13736
13736
|
] }),
|
|
13737
|
-
t && /* @__PURE__ */ p.
|
|
13738
|
-
"
|
|
13739
|
-
|
|
13740
|
-
|
|
13741
|
-
|
|
13742
|
-
|
|
13743
|
-
|
|
13744
|
-
|
|
13745
|
-
|
|
13746
|
-
|
|
13747
|
-
|
|
13748
|
-
|
|
13749
|
-
|
|
13750
|
-
|
|
13751
|
-
|
|
13737
|
+
t && /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
13738
|
+
/* @__PURE__ */ p.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px", marginRight: "4px" }, children: [
|
|
13739
|
+
/* @__PURE__ */ p.jsx(
|
|
13740
|
+
"button",
|
|
13741
|
+
{
|
|
13742
|
+
onClick: () => S(!D),
|
|
13743
|
+
style: {
|
|
13744
|
+
width: "28px",
|
|
13745
|
+
height: "16px",
|
|
13746
|
+
borderRadius: "8px",
|
|
13747
|
+
border: "none",
|
|
13748
|
+
background: D ? "#10b981" : "#9ca3af",
|
|
13749
|
+
cursor: "pointer",
|
|
13750
|
+
position: "relative",
|
|
13751
|
+
transition: "background 0.2s",
|
|
13752
|
+
padding: 0
|
|
13753
|
+
},
|
|
13754
|
+
title: D ? "Auto-transcribe ON" : "Auto-transcribe OFF",
|
|
13755
|
+
children: /* @__PURE__ */ p.jsx("div", { style: {
|
|
13756
|
+
width: "12px",
|
|
13757
|
+
height: "12px",
|
|
13758
|
+
borderRadius: "50%",
|
|
13759
|
+
background: "white",
|
|
13760
|
+
position: "absolute",
|
|
13761
|
+
top: "2px",
|
|
13762
|
+
left: D ? "14px" : "2px",
|
|
13763
|
+
transition: "left 0.2s",
|
|
13764
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.2)"
|
|
13765
|
+
} })
|
|
13766
|
+
}
|
|
13767
|
+
),
|
|
13768
|
+
/* @__PURE__ */ p.jsx("span", { style: { fontSize: "10px", color: "#666" }, children: "auto" })
|
|
13769
|
+
] }),
|
|
13770
|
+
/* @__PURE__ */ p.jsx(
|
|
13771
|
+
"button",
|
|
13772
|
+
{
|
|
13773
|
+
onClick: () => {
|
|
13774
|
+
a === "editing" && Se.current && Ne(Se.current);
|
|
13775
|
+
},
|
|
13776
|
+
disabled: a !== "editing",
|
|
13777
|
+
style: a !== "editing" ? $e : Ie,
|
|
13778
|
+
title: "Transcribe audio",
|
|
13779
|
+
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: D ? "#10b981" : "#171717" }, children: "subtitles" })
|
|
13780
|
+
}
|
|
13781
|
+
)
|
|
13782
|
+
] }),
|
|
13752
13783
|
!o && /* @__PURE__ */ p.jsx(
|
|
13753
13784
|
"button",
|
|
13754
13785
|
{
|
|
13755
13786
|
onClick: J,
|
|
13756
13787
|
disabled: a !== "editing",
|
|
13757
|
-
style: a !== "editing" ?
|
|
13788
|
+
style: a !== "editing" ? $e : Ie,
|
|
13758
13789
|
title: "Save recording",
|
|
13759
13790
|
children: /* @__PURE__ */ p.jsx("span", { className: "material-icons", style: { fontSize: "20px", color: "#171717" }, children: "save" })
|
|
13760
13791
|
}
|
package/package.json
CHANGED