@bodhiapp/bodhi-js-react-core 0.0.28 → 0.0.30

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react/jsx-runtime"),s=require("@bodhiapp/bodhi-js-core"),r=require("react"),M=require("@bodhiapp/setup-modal-types");function W(e){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const p in e)if(p!=="default"){const y=Object.getOwnPropertyDescriptor(e,p);Object.defineProperty(c,p,y.get?y:{enumerable:!0,get:()=>e[p]})}}return c.default=e,Object.freeze(c)}const l=W(r);function K({client:e,modalHtmlPath:c,hideSetup:p,onSetupReady:y,setupState:I,basePath:h="/",logLevel:S="warn"}){const R=I!=="ready",O=r.useMemo(()=>new s.Logger("SetupModalProcessor",S),[S]),u=r.useRef(null),f=r.useMemo(()=>new s.BodhiClientUserPrefsManager(s.createStoragePrefixWithBasePath(h,"bodhijs:")),[h]),b=r.useRef(null),m=r.useCallback(t=>t==="direct"?"lna":t==="extension"?"extension":null,[]),L=r.useCallback(t=>t.extension==="ready"?{status:"ready",version:"unknown",id:t.extensionId}:t.extension==="not-found"?{status:"not-installed",error:{message:"Extension not found",code:"ext-not-installed"}}:{status:"unreachable",error:{message:"Client not initialized",code:"ext-connection-failed"}},[]),T=r.useCallback(t=>{if(t.server.status==="pending-extension-ready")return{status:"pending-extension-ready",error:{message:"Extension not ready",code:"server-pending-ext-ready"}};const n=t.server;switch(n.status){case"ready":return{status:"ready",version:n.version||"unknown"};case"setup":return{status:"setup",version:n.version||"unknown",error:{message:n.error?.message||"Setup required",code:"server-in-setup-status"}};case"resource_admin":return{status:"resource_admin",version:n.version||"unknown",error:{message:n.error?.message||"Resource admin required",code:"server-in-admin-status"}};case"error":return{status:"error",error:{message:n.error?.message||"Unknown error",code:"server-unexpected-error"}};case"not-reachable":return{status:"unreachable",error:{message:n.error?.message||"Server not reachable",code:"server-conn-refused"}};default:return{status:"unreachable",error:{message:"Unknown server status",code:"server-unexpected-error"}}}},[]),x=r.useCallback(t=>{if(t.server.status==="not-connected")return{status:"pending-lna-ready"};const n=t.server;switch(n.status){case"ready":return{status:"ready",version:n.version||"unknown"};case"setup":return{status:"setup",version:n.version||"unknown"};case"resource_admin":return{status:"resource_admin",version:n.version||"unknown"};case"error":case"not-reachable":return{status:"error",error:{message:n.error?.message||"Connection error"}};default:return{status:"error",error:{message:"Unknown server status"}}}},[]),A=r.useCallback((t,n)=>{if(t.server.status!=="pending-extension-ready"){const o=t.server.status;if(o==="ready"||o==="setup"||o==="resource_admin")return!0}if(n.server.status!=="not-connected"){const o=n.server.status;if(o==="ready"||o==="setup"||o==="resource_admin")return!0}return!1},[]),w=r.useCallback((t,n,o)=>{if(n==="skipped")return{status:"skipped",serverUrl:o};if(t.server.status!=="not-connected"){const d=t.server;return d.status==="ready"||d.status==="setup"||d.status==="resource_admin"?{status:"granted",serverUrl:o}:{status:"unreachable",serverUrl:o,error:{message:d.error?.message||"Server unreachable",code:"lna-unreachable"}}}return n==="granted"?{status:"granted",serverUrl:o}:{status:"prompt",serverUrl:o}},[]),E=r.useCallback(async(t=!1)=>{const n=s.detectBrowser().type,o=s.detectOS().type;let d=await e.getExtensionState();(d.extension==="not-initialized"||t)&&(d=await e.testExtensionConnectivity());let C=await e.getDirectState();const _=f.getDirectStatus();_==="granted"&&(C.server.status==="not-connected"||t)&&(C=await e.testDirectConnectivity());const i=s.getServerUrl(C)||"http://localhost:1135",v=w(C,_,i);return e.getConnectionMode()===null&&(s.isDirectServerReady(C)?await e.setConnectionMode("direct"):s.isExtensionServerReady(d)&&await e.setConnectionMode("extension")),f.isServerInstallConfirmed()||A(d,C)&&f.setServerInstallConfirmed(!0),{extension:L(d),server:T(d),lna:v,lnaServer:x(C),env:{browser:n,os:o},browsers:s.BROWSER_CONFIGS,os:s.OS_CONFIGS,userConfirmations:{serverInstall:f.isServerInstallConfirmed()},selectedConnection:m(e.getConnectionMode())}},[e,f,L,T,x,m,w,A]),g=r.useCallback(()=>{if(!b.current)throw new Error("Cannot get state: currentStateRef is null");return{...b.current,userConfirmations:{serverInstall:f.isServerInstallConfirmed()},selectedConnection:m(e.getConnectionMode())}},[f,e,m]),k=r.useMemo(()=>({[M.MSG.MODAL_READY]:async()=>(O.info("MODAL_READY: returning current state or default"),b.current?{setupState:g()}:{setupState:M.DEFAULT_SETUP_STATE}),[M.MSG.MODAL_REFRESH]:async()=>{O.info("MODAL_REFRESH: refreshing state");const t=await E(!0);b.current=t;const n=g();return O.info(`MODAL_REFRESH: state refreshed
2
- `,JSON.stringify(n,null,2)),u.current?.updateState(g()),{setupState:n}},[M.MSG.MODAL_LNA_CONNECT]:async t=>{const n=t.payload.serverUrl;console.log("[SetupModalProcessor] LNA connect:",n);const o=await e.testDirectConnectivity(n);if(o.server.status!=="not-connected"){const C=o.server.status;if(C==="ready"||C==="setup"||C==="resource_admin"){f.setDirectStatus("granted"),e.getConnectionMode()===null&&await e.setConnectionMode("direct");const _=await E();return b.current=_,u.current?.updateState(g()),{success:!0}}}const d=await E();return b.current=d,u.current?.updateState(g()),{success:!1}},[M.MSG.MODAL_LNA_SKIP]:async()=>{f.setDirectStatus("skipped");const t=await E();return b.current=t,u.current?.updateState(g()),{success:!0}},[M.MSG.MODAL_CLOSE]:()=>{p()},[M.MSG.MODAL_COMPLETE]:()=>{p()},[M.MSG.MODAL_CONFIRM_SERVER_INSTALL]:t=>(f.setServerInstallConfirmed(t.payload.confirmed),u.current?.updateState(g()),{success:!0}),[M.MSG.MODAL_SELECT_CONNECTION]:async t=>{const o=t.payload.connection==="lna"?"direct":"extension";return await e.setConnectionMode(o),u.current?.updateState(g()),{success:!0}}}),[O,e,f,E,g,x,p]);return r.useEffect(()=>(u.current=new s.OnboardingModal({modalHtmlPath:c,handlers:k}),()=>{u.current?.destroy(),u.current=null}),[c,k]),r.useEffect(()=>{R&&u.current?(u.current.showLoading(),E(!0).then(t=>{b.current=t,u.current?.updateState(t),y?.()}).catch(t=>{console.error("[SetupModalProcessor] buildSetupState failed:",t)})):!R&&u.current&&u.current.destroy()},[R,E,y]),null}const j={status:"not-initialized",mode:null,extensionId:null,url:null,server:s.BACKEND_SERVER_NOT_CONNECTED,error:null},U={status:"initializing",mode:null,extensionId:null,url:null,server:s.BACKEND_SERVER_NOT_CONNECTED,error:null};function G(e){return e.status==="not-initialized"}function F(e){return e.status==="initializing"}function q(e){return e.status!=="not-initialized"&&e.status!=="initializing"}function P(e){return e.status==="ready"}function H(e){return P(e)&&e.server.status==="ready"}function V(e){return s.isExtensionState(e)?{status:e.extension==="not-initialized"?"initializing":e.extension==="not-found"?"extension-not-found":"ready",mode:"extension",extensionId:e.extensionId,url:null,server:e.server,error:e.server.error}:{status:e.url===null?"direct-not-connected":"ready",mode:"direct",extensionId:null,url:e.url,server:e.server,error:e.server.error}}const X={isNotInitialized:G,isInitializing:F,isInitialized:q,isReady:P,isOverallReady:H},z=r.createContext(null);z.displayName="BodhiContext";function Z({children:e,client:c,modalHtmlPath:p,handleCallback:y=!0,callbackPath:I,basePath:h="/",logLevel:S="warn"}){const R=h==="/"?"":h.replace(/\/$/,""),O=I??`${R}/callback`,u=r.useMemo(()=>new s.Logger("BodhiProvider",S),[S]),f=r.useRef(!1),b=r.useRef(!1),[m,L]=r.useState(j),[T,x]=r.useState(s.INITIAL_AUTH_STATE),[A,w]=r.useState(!1),[E,g]=r.useState("ready");r.useEffect(()=>{const a=i=>{switch(i.type){case"client-state":L(V(i.state));break;case"auth-state":x(i.state),w(!1);break}};return c.setStateCallback(a),()=>{c.setStateCallback(s.NOOP_STATE_CALLBACK)}},[c]);const k=r.useCallback(async()=>{g("loading")},[]),t=r.useCallback(()=>{g("ready")},[]),n=r.useCallback(()=>{g("loaded")},[]),o=r.useCallback(async a=>{L(U);try{await c.init(a||{})}catch(i){u.error("Init failed:",i)}},[c,u]);r.useEffect(()=>{if(b.current)return;b.current=!0,(async()=>{if(await o(),!y)return;const i=new URL(window.location.href);if(i.pathname!==O)return;const v=i.searchParams.get("code"),B=i.searchParams.get("state");!v||!B||f.current||(f.current=!0,s.isWebUIClient(c)&&(w(!0),c.handleOAuthCallback(v,B).then(()=>{window.history.replaceState({},"",h)}).catch(D=>{u.error("OAuth callback failed:",D),x({status:"error",user:null,accessToken:null,error:{message:D instanceof Error?D.message:"OAuth callback failed",code:"OAUTH_CALLBACK_FAILED"}}),w(!1),window.history.replaceState({},"",h)})))})()},[o,c,y,O,h]);const d=r.useCallback(async a=>{w(!0);try{const i=a?{...a.userRole&&{userRole:a.userRole},...a.requested&&{requested:a.requested},...a.flowType&&{flowType:a.flowType},...a.redirectUrl&&{redirectUrl:a.redirectUrl},...a.onProgress&&{onProgress:a.onProgress},...a.pollIntervalMs&&{pollIntervalMs:a.pollIntervalMs},...a.pollTimeoutMs&&{pollTimeoutMs:a.pollTimeoutMs}}:void 0,v=i&&Object.keys(i).length>0?i:void 0;await c.login(v)}catch(i){const v={status:"error",user:null,accessToken:null,error:{message:i instanceof Error?i.message:"Login failed",code:"LOGIN_FAILED"}};return x(v),w(!1),v}},[c]),C=r.useCallback(async()=>{try{await c.logout()}catch(a){x({status:"error",user:null,accessToken:null,error:{message:a instanceof Error?a.message:"Logout failed",code:"LOGOUT_FAILED"}})}},[c]),_=r.useMemo(()=>{const a=m.status==="ready",i=m.server.status==="ready";return{client:c,clientState:m,auth:T,isAuthLoading:A,login:d,logout:C,showSetup:k,hideSetup:t,setupState:E,isAuthenticated:T.status==="authenticated",canLogin:a&&!A,isReady:a,isServerReady:i,isOverallReady:a&&i,isInitializing:m.status==="initializing",isExtension:m.mode==="extension",isDirect:m.mode==="direct"}},[c,m,T,A,E,d,C,k,t]);return N.jsxs(z.Provider,{value:_,children:[N.jsx(K,{client:c,modalHtmlPath:p,hideSetup:t,onSetupReady:n,setupState:E,basePath:h,logLevel:S}),e]})}function J(){const e=r.useContext(z);if(!e)throw new Error("useBodhi must be used within BodhiProvider");return e}const Y=e=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 479.995 479.995",width:"480px",height:"480px",...e},l.createElement("path",{fill:"#ffa4b8",d:"M239.998,374.56l-0.01-0.01c0-0.01,0.01-0.01,0.01-0.02c-4.64-8.78-65.7-144.8-212.22-85.2 c-14.36,5.85-19.78,23.45-11.19,36.36c11.11,16.69,22.86,30.01,34.91,40.53c-27.85,7.89-45.6,33.8-43.3,61.55 c0.96,11.6,13.29,18.52,23.71,13.35c33.99-16.84,60.03-2.51,80.35,2.14c56.68,12.99,113.71,4.53,125.52-46.29 c0.52-2.22,0.95-4.51,1.28-6.89c0.01-0.04,0.01-0.08,0.02-0.12c0.066-0.492,0.126-0.978,0.181-1.458 c0.455-3.631,0.712-7.438,0.739-11.452c-0.02-1.44-0.02-2.01,0-2.25v-0.09c0-0.02,0-0.04,0.01-0.05c0-0.02,0.01-0.03,0.02-0.06 c0-0.01,0.01-0.01,0.01-0.02C240.018,374.569,240.008,374.56,239.998,374.56z"}),l.createElement("path",{fill:"#ffa4b8",d:"M471.798,427.769c-0.96,11.6-13.29,18.52-23.71,13.35c-33.99-16.84-60.03-2.51-80.35,2.14 c-63.41,14.53-127.25,2.22-127.74-66.21c0.033-2.642-0.044-2.302,0.04-2.47c-0.02-0.01-0.03-0.02-0.04-0.02l0.01-0.01 c0-0.01-0.01-0.01-0.01-0.02c4.64-8.78,65.7-144.8,212.22-85.2c14.36,5.85,19.78,23.45,11.19,36.36 c-11.11,16.69-22.86,30.01-34.91,40.53C456.348,374.109,474.098,400.019,471.798,427.769z"}),l.createElement("path",{fill:"#befa91",d:"M428.498,366.219c27.85,7.89,45.6,33.8,43.3,61.55c-0.96,11.6-13.29,18.52-23.71,13.35 c-33.99-16.84-60.03-2.51-80.35,2.14c-63.41,14.53-127.928,2.222-127.74-66.21c0.007-2.683-0.02-2.351,0.04-2.47 C248.598,379.129,345.858,438.329,428.498,366.219z"}),l.createElement("path",{fill:"#befa91",d:"M51.498,366.219c82.76,72.22,180.18,12.74,188.5,8.34c0.01,0,0.02,0.01,0.04,0.02 c-0.058,0.116-0.047-0.169-0.04,2.47c0.188,68.432-64.33,80.74-127.74,66.21c-20.32-4.65-46.36-18.98-80.35-2.14 c-10.42,5.17-22.75-1.75-23.71-13.35C5.898,400.019,23.648,374.109,51.498,366.219z"}),l.createElement("path",{fill:"#ffbfcb",d:"M235.228,365.299c-32.29-36.09-89.98-73-179.74-36.49c-1.979,0.805-3.787,1.834-5.413,3.042 c-10.569,7.856-25.473,5.765-32.82-5.164c-0.223-0.331-0.445-0.664-0.667-0.997c-8.59-12.91-3.17-30.51,11.19-36.36 C155.168,237.509,217.948,333.56,235.228,365.299z"}),l.createElement("path",{fill:"#ffa4b8",d:"M239.998,374.549c-12.85-2.2-214.54-23.33-193.03-240.71c1.49-14.99,15.86-25.15,30.48-21.55 c108.49,26.72,149.07,91.39,162.55,149.92C252.768,317.699,241.178,367.679,239.998,374.549z"}),l.createElement("path",{fill:"#ffbfcb",d:"M193.698,174.638c11.866,12.406-3.013,31.792-18.056,23.52 c-21.875-12.028-50.044-10.573-70.207,3.701c-24.832,17.579-59.398-0.365-60.013-30.784c-0.237-11.724,0.248-24.123,1.545-37.237 c1.49-14.99,15.86-25.15,30.48-21.55C131.23,125.537,168.324,148.11,193.698,174.638z"}),l.createElement("path",{fill:"#ffa4b8",d:"M221.538,39.599c9.78-11.13,27.15-11.12,36.93,0.01c157.02,178.77-7.48,323.95-18.47,334.94 C229.988,364.549,63.948,218.989,221.538,39.599z"}),l.createElement("path",{fill:"#ffbfcb",d:"M261.523,43.131c9.452,11.033,8.166,27.623-2.74,37.221c-0.784,0.69-1.535,1.439-2.245,2.247 c-35.942,40.915-55.05,80.07-63.012,116.258c-5.176,23.523-39.936,19.717-39.551-4.366c0.741-46.282,18.411-98.941,67.563-154.892 c9.78-11.13,27.15-11.12,36.93,0.01C259.5,40.785,260.518,41.959,261.523,43.131z"}),l.createElement("path",{fill:"#ffa4b8",d:"M239.998,374.549c-1.18-6.87-12.77-56.85,0-112.34c13.48-58.53,54.06-123.2,162.55-149.92 c14.62-3.6,28.99,6.56,30.48,21.55C454.538,351.219,252.848,372.349,239.998,374.549z"}),l.createElement("path",{fill:"#ff8ca5",d:"M239.998,374.549c-3.115-0.536-17.362-2.183-36.835-7.483c-3.181-0.866-6.028-2.682-8.145-5.209 c-49.098-58.608-75.675-130.75-61.047-205.793c2.165-11.107,14.881-16.444,24.408-10.337c0.756,0.485,1.506,0.972,2.249,1.462 C126.798,274.139,232.088,366.649,239.998,374.549z"}),l.createElement("path",{fill:"#ff8ca5",d:"M281.608,365.729c-21.9,6.37-38.24,8.25-41.61,8.82c8.67-8.67,112.98-100.94,79.35-227.34v-0.01 c0.742-0.489,1.49-0.975,2.244-1.459c9.551-6.123,22.265-0.733,24.422,10.406C369.565,277.734,281.608,363.204,281.608,365.729z"}),l.createElement("path",{fill:"#ff8ca5",d:"M417.451,302.932c-32.211,44.193-80.706,72.823-134.571,87.345c-3.396,0.916-6.999,0.754-10.3-0.463 c-20.772-7.664-31.911-15.254-32.583-15.254c0.826-0.825,112.667-9.463,166.4-98.31C419.37,278.279,424.743,292.927,417.451,302.932 z"}),l.createElement("path",{fill:"#ff8ca5",d:"M62.565,302.932c32.211,44.193,80.705,72.823,134.571,87.345c3.396,0.916,6.999,0.754,10.3-0.463 c20.772-7.664,31.911-15.254,32.583-15.254c-0.828-0.828-112.665-9.458-166.4-98.31C60.646,278.279,55.273,292.927,62.565,302.932z"}),l.createElement("path",{fill:"#9ceb63",d:"M433.464,393.091c-52.749,39.415-118.979,42.09-182.861,13.657 c-4.441-1.977-7.606-6.011-8.633-10.763c-1.552-7.18-1.884-14.238-1.973-21.326c0.172-0.345,9.566,5.934,26.76,12.89 c36.31,14.71,102.75,30.15,161.74-21.33C440.977,369.752,443.403,385.664,433.464,393.091z"}),l.createElement("path",{fill:"#9ceb63",d:"M240.038,374.579c0,0.01-0.01,0.01-0.01,0.02s-0.01,0.03-0.01,0.05c0,0,0,0,0,0.01 c-0.01,0.03-0.01,0.06-0.02,0.1v0.04c-0.13,1.3,0.09,7.59-0.92,15.16c-0.01,0.04-0.01,0.08-0.02,0.12 c-0.26,1.91-0.59,3.91-1.03,5.92c-0.07,0.33-0.15,0.65-0.25,0.97c-1.23,4.33-4.28,7.95-8.41,9.79 c-63.06,28.05-129.47,26.21-182.79-13.63c-9.94-7.43-7.63-23.36,4.92-26.91c13.1,11.46,28.11,20.79,44.16,26.79 c19.78,7.48,34.99,8.98,53.83,8.68c34.33-0.55,60.1-11.03,90.51-27.13C240.008,374.56,240.018,374.569,240.038,374.579z"}),l.createElement("path",{d:"M443.143,363.426c9.579-9.648,18.604-20.804,26.926-33.305c11.399-17.132,4.201-40.447-14.837-48.202 c-12.321-5.012-24.515-8.844-36.391-11.454c17.945-34.197,27.974-78.94,22.188-137.413c-1.925-19.503-20.802-33.354-40.394-28.53 c-17.952,4.421-34.806,10.063-50.093,16.768c-4.046,1.775-5.888,6.494-4.113,10.54c1.774,4.046,6.493,5.887,10.54,4.113 c14.45-6.338,30.429-11.682,47.492-15.885c9.885-2.435,19.599,4.434,20.607,14.573c9.088,90.121-21.147,164.341-99.823,205.213 c-3.921,2.037-5.448,6.866-3.411,10.787c2.043,3.933,6.879,5.442,10.787,3.411c27.191-14.125,56.267-35.849,77.701-68.994 c12.564,2.375,25.617,6.296,38.878,11.69c9.68,3.943,13.334,15.824,7.549,24.518c-10.205,15.33-21.482,28.43-33.516,38.936 c-49.396,43.107-111.979,41.39-169.834,12.419c56.638-56.971,92.247-132.34,77.074-212.524 c-8.101-42.81-30.305-85.119-65.997-125.754c-12.964-14.759-36.003-14.748-48.946-0.016 c-28.645,32.607-48.657,66.371-59.602,100.512c-21.999-13.018-47.7-23.197-76.569-30.307c-19.338-4.763-38.383,8.699-40.354,28.53 C26.197,262.501,90.89,324.677,147.416,354.042c3.92,2.036,8.75,0.51,10.787-3.411c2.037-3.921,0.51-8.75-3.411-10.787 c-52.141-27.086-111.791-84.677-99.863-205.213c1.007-10.132,10.713-17.01,20.606-14.574c31.115,7.663,58.223,19.013,80.571,33.735 c4.863,3.204,10.891,0.586,12.257-4.539c9.392-35.245,29.306-70.362,59.188-104.378c6.581-7.492,18.316-7.487,24.904,0.014 c128.735,146.565,37.449,269.122-12.476,318.519c-30.274-29.828-76.759-87.727-78.002-162.831 c-0.073-4.417-3.698-7.933-8.131-7.867c-4.417,0.073-7.939,3.714-7.867,8.131c1.382,83.483,54.096,146.516,85.999,177.099 c-0.353,20.737-7.099,36.575-20.104,47.086c-20.129,16.267-55.786,20.072-97.831,10.438c-19.181-4.396-48.632-19.874-85.688-1.511 c-5.361,2.657-11.689-0.859-12.186-6.844c-1.888-22.74,12.042-43.926,33.548-51.893c13.4,11.096,27.797,19.551,43.11,25.275 c20.238,7.653,36.036,9.525,56.788,9.196c15.85-0.254,30.814-2.572,45.747-7.085c4.229-1.278,6.622-5.743,5.343-9.972 c-1.278-4.229-5.744-6.622-9.972-5.344c-13.494,4.078-27.027,6.173-41.373,6.403c-17.347,0.275-31.911-0.993-50.901-8.174 c-31.69-11.847-56.387-35.98-75.211-64.258c-5.791-8.704-2.122-20.58,7.548-24.52c4.092-1.667,6.058-6.335,4.391-10.427 c-1.667-4.092-6.334-6.058-10.427-4.391c-19.062,7.765-26.214,31.095-14.832,48.202c8.365,12.566,17.352,23.674,26.917,33.31 C12.89,375.664-2.037,401.187,0.226,428.434c1.427,17.192,19.743,27.533,35.235,19.857c30.84-15.283,54.311-1.971,75.01,2.771 c36.708,8.411,82.166,10.086,111.461-13.59c14.777-11.943,23.305-28.715,25.489-49.937 c61.607,30.736,128.694,32.482,182.835-12.326c21.516,7.959,35.456,29.153,33.567,51.902c-0.493,5.939-6.786,9.519-12.186,6.844 c-30.339-15.034-55.535-7.379-73.932-1.791c-31.306,9.51-74.736,14.144-102.884-2.498c-3.803-2.248-8.709-0.989-10.958,2.815 c-2.249,3.803-0.989,8.709,2.815,10.958c29.214,17.272,69.817,15.19,102.844,7.622c20.72-4.747,44.177-18.05,75.01-2.771 c15.523,7.691,33.811-2.693,35.235-19.856C482.032,401.183,467.102,375.655,443.143,363.426z"})),$={sm:32,md:48,lg:64};function Q({size:e="md",variant:c="light",className:p="",style:y={}}){const I=$[e],h={display:"inline-block",cursor:"pointer",transition:"all 250ms ease",borderRadius:"50%",...c==="dark"&&{backgroundColor:"rgba(255, 255, 255, 0.05)",padding:"8px"},...y};return N.jsx("a",{href:"https://getbodhi.app",target:"_blank",rel:"noopener noreferrer",title:"Powered by Bodhi","aria-label":"Powered by Bodhi - Visit getbodhi.app",className:p,style:h,onMouseEnter:S=>{S.currentTarget.style.transform="scale(1.1)",S.currentTarget.style.boxShadow="0 0 20px rgba(255, 164, 184, 0.6)"},onMouseLeave:S=>{S.currentTarget.style.transform="scale(1)",S.currentTarget.style.boxShadow="none"},children:N.jsx(Y,{width:I,height:I,style:{display:"block"}})})}const ee="production";Object.defineProperty(exports,"BodhiApiError",{enumerable:!0,get:()=>s.BodhiApiError});Object.defineProperty(exports,"BodhiError",{enumerable:!0,get:()=>s.BodhiError});Object.defineProperty(exports,"createApiError",{enumerable:!0,get:()=>s.createApiError});Object.defineProperty(exports,"createOperationError",{enumerable:!0,get:()=>s.createOperationError});Object.defineProperty(exports,"isAuthError",{enumerable:!0,get:()=>s.isAuthError});Object.defineProperty(exports,"isAuthLoading",{enumerable:!0,get:()=>s.isAuthLoading});Object.defineProperty(exports,"isAuthenticated",{enumerable:!0,get:()=>s.isAuthenticated});Object.defineProperty(exports,"isClientReady",{enumerable:!0,get:()=>s.isClientReady});Object.defineProperty(exports,"isDirectState",{enumerable:!0,get:()=>s.isDirectState});Object.defineProperty(exports,"isExtensionState",{enumerable:!0,get:()=>s.isExtensionState});Object.defineProperty(exports,"isWebUIClient",{enumerable:!0,get:()=>s.isWebUIClient});Object.defineProperty(exports,"unwrapResponse",{enumerable:!0,get:()=>s.unwrapResponse});exports.BodhiBadge=Q;exports.BodhiProvider=Z;exports.BodhiReactContext=z;exports.ClientCtxState=X;exports.INITIALIZING_CLIENT_CONTEXT_STATE=U;exports.INITIAL_CLIENT_CONTEXT_STATE=j;exports.REACT_CORE_BUILD_MODE=ee;exports.clientStateToContextState=V;exports.isClientCtxInitialized=q;exports.isClientCtxInitializing=F;exports.isClientCtxNotInitialized=G;exports.isClientCtxReady=P;exports.isOverallReady=H;exports.useBodhi=J;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react/jsx-runtime"),s=require("@bodhiapp/bodhi-js-core"),r=require("react"),v=require("@bodhiapp/setup-modal-types");function $(e){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const S in e)if(S!=="default"){const E=Object.getOwnPropertyDescriptor(e,S);Object.defineProperty(c,S,E.get?E:{enumerable:!0,get:()=>e[S]})}}return c.default=e,Object.freeze(c)}const l=$(r);function Q({client:e,modalHtmlPath:c,hideSetup:S,onSetupReady:E,setupState:A,basePath:g="/",logLevel:b="warn"}){const L=A!=="ready",M=r.useMemo(()=>new s.Logger("SetupModalProcessor",b),[b]),u=r.useRef(null),f=r.useMemo(()=>new s.BodhiClientUserPrefsManager(s.createStoragePrefixWithBasePath(g,"bodhijs:")),[g]),m=r.useRef(null),x=r.useCallback(t=>t==="direct"?"lna":t==="extension"?"extension":null,[]),y=r.useCallback(t=>t.extension==="ready"?{status:"ready",version:"unknown",id:t.extensionId}:t.extension==="not-found"?{status:"not-installed",error:{message:"Extension not found",code:"ext-not-installed"}}:{status:"unreachable",error:{message:"Client not initialized",code:"ext-connection-failed"}},[]),N=r.useCallback(t=>{if(t.server.status==="pending-extension-ready")return{status:"pending-extension-ready",error:{message:"Extension not ready",code:"server-pending-ext-ready"}};const n=t.server;switch(n.status){case"ready":return{status:"ready",version:n.version||"unknown"};case"setup":return{status:"setup",version:n.version||"unknown",error:{message:n.error?.message||"Setup required",code:"server-in-setup-status"}};case"resource_admin":return{status:"resource_admin",version:n.version||"unknown",error:{message:n.error?.message||"Resource admin required",code:"server-in-admin-status"}};case"error":return{status:"error",error:{message:n.error?.message||"Unknown error",code:"server-unexpected-error"}};case"not-reachable":return{status:"unreachable",error:{message:n.error?.message||"Server not reachable",code:"server-conn-refused"}};default:return{status:"unreachable",error:{message:"Unknown server status",code:"server-unexpected-error"}}}},[]),_=r.useCallback(t=>{if(t.server.status==="not-connected")return{status:"pending-lna-ready"};const n=t.server;switch(n.status){case"ready":return{status:"ready",version:n.version||"unknown"};case"setup":return{status:"setup",version:n.version||"unknown"};case"resource_admin":return{status:"resource_admin",version:n.version||"unknown"};case"error":case"not-reachable":return{status:"error",error:{message:n.error?.message||"Connection error"}};default:return{status:"error",error:{message:"Unknown server status"}}}},[]),T=r.useCallback((t,n)=>{if(t.server.status!=="pending-extension-ready"){const i=t.server.status;if(i==="ready"||i==="setup"||i==="resource_admin")return!0}if(n.server.status!=="not-connected"){const i=n.server.status;if(i==="ready"||i==="setup"||i==="resource_admin")return!0}return!1},[]),k=r.useCallback((t,n,i)=>{if(n==="skipped")return{status:"skipped",serverUrl:i};if(t.server.status!=="not-connected"){const d=t.server;return d.status==="ready"||d.status==="setup"||d.status==="resource_admin"?{status:"granted",serverUrl:i}:{status:"unreachable",serverUrl:i,error:{message:d.error?.message||"Server unreachable",code:"lna-unreachable"}}}return n==="granted"?{status:"granted",serverUrl:i}:{status:"prompt",serverUrl:i}},[]),C=r.useCallback(async(t=!1)=>{const n=s.detectBrowser().type,i=s.detectOS().type;let d=await e.getExtensionState();(d.extension==="not-initialized"||t)&&(d=await e.testExtensionConnectivity());let h=await e.getDirectState();const O=f.getDirectStatus();O==="granted"&&(h.server.status==="not-connected"||t)&&(h=await e.testDirectConnectivity());const D=s.getServerUrl(h)||"http://localhost:1135",U=k(h,O,D);return e.getConnectionMode()===null&&(s.isDirectServerReady(h)?await e.setConnectionMode("direct"):s.isExtensionServerReady(d)&&await e.setConnectionMode("extension")),f.isServerInstallConfirmed()||T(d,h)&&f.setServerInstallConfirmed(!0),{extension:y(d),server:N(d),lna:U,lnaServer:_(h),env:{browser:n,os:i},browsers:s.BROWSER_CONFIGS,os:s.OS_CONFIGS,userConfirmations:{serverInstall:f.isServerInstallConfirmed()},selectedConnection:x(e.getConnectionMode())}},[e,f,y,N,_,x,k,T]),p=r.useCallback(()=>{if(!m.current)throw new Error("Cannot get state: currentStateRef is null");return{...m.current,userConfirmations:{serverInstall:f.isServerInstallConfirmed()},selectedConnection:x(e.getConnectionMode())}},[f,e,x]),R=r.useMemo(()=>({[v.MSG.MODAL_READY]:async()=>(M.info("MODAL_READY: returning current state or default"),m.current?{setupState:p()}:{setupState:v.DEFAULT_SETUP_STATE}),[v.MSG.MODAL_REFRESH]:async()=>{M.info("MODAL_REFRESH: refreshing state");const t=await C(!0);m.current=t;const n=p();return M.info(`MODAL_REFRESH: state refreshed
2
+ `,JSON.stringify(n,null,2)),u.current?.updateState(p()),{setupState:n}},[v.MSG.MODAL_LNA_CONNECT]:async t=>{const n=t.payload.serverUrl;console.log("[SetupModalProcessor] LNA connect:",n);const i=await e.testDirectConnectivity(n);if(i.server.status!=="not-connected"){const h=i.server.status;if(h==="ready"||h==="setup"||h==="resource_admin"){f.setDirectStatus("granted"),e.getConnectionMode()===null&&await e.setConnectionMode("direct");const O=await C();return m.current=O,u.current?.updateState(p()),{success:!0}}}const d=await C();return m.current=d,u.current?.updateState(p()),{success:!1}},[v.MSG.MODAL_LNA_SKIP]:async()=>{f.setDirectStatus("skipped");const t=await C();return m.current=t,u.current?.updateState(p()),{success:!0}},[v.MSG.MODAL_CLOSE]:()=>{S()},[v.MSG.MODAL_COMPLETE]:()=>{S()},[v.MSG.MODAL_CONFIRM_SERVER_INSTALL]:t=>(f.setServerInstallConfirmed(t.payload.confirmed),u.current?.updateState(p()),{success:!0}),[v.MSG.MODAL_SELECT_CONNECTION]:async t=>{const i=t.payload.connection==="lna"?"direct":"extension";return await e.setConnectionMode(i),u.current?.updateState(p()),{success:!0}}}),[M,e,f,C,p,_,S]);return r.useEffect(()=>(u.current=new s.OnboardingModal({modalHtmlPath:c,handlers:R}),()=>{u.current?.destroy(),u.current=null}),[c,R]),r.useEffect(()=>{L&&u.current?(u.current.showLoading(),C(!0).then(t=>{m.current=t,u.current?.updateState(t),E?.()}).catch(t=>{console.error("[SetupModalProcessor] buildSetupState failed:",t)})):!L&&u.current&&u.current.destroy()},[L,C,E]),null}const V={status:"not-initialized",mode:null,extensionId:null,url:null,server:s.BACKEND_SERVER_NOT_CONNECTED,error:null},W={status:"initializing",mode:null,extensionId:null,url:null,server:s.BACKEND_SERVER_NOT_CONNECTED,error:null};function H(e){return e.status==="not-initialized"}function K(e){return e.status==="initializing"}function X(e){return e.status!=="not-initialized"&&e.status!=="initializing"}function G(e){return e.status==="ready"}function Z(e){return G(e)&&e.server.status==="ready"}function J(e){return s.isExtensionState(e)?{status:e.extension==="not-initialized"?"initializing":e.extension==="not-found"?"extension-not-found":"ready",mode:"extension",extensionId:e.extensionId,url:null,server:e.server,error:e.server.error}:{status:e.url===null?"direct-not-connected":"ready",mode:"direct",extensionId:null,url:e.url,server:e.server,error:e.server.error}}const ee={isNotInitialized:H,isInitializing:K,isInitialized:X,isReady:G,isOverallReady:Z},j=r.createContext(null);j.displayName="BodhiContext";function te({children:e,client:c,modalHtmlPath:S,handleCallback:E=!0,callbackPath:A,basePath:g="/",logLevel:b="warn"}){const L=g==="/"?"":g.replace(/\/$/,""),M=A??`${L}/callback`,u=r.useMemo(()=>new s.Logger("BodhiProvider",b),[b]),f=r.useRef(!1),m=r.useRef(!1),x=r.useRef(!1),[y,N]=r.useState(V),[_,T]=r.useState(s.INITIAL_AUTH_STATE),[k,C]=r.useState(!1),[p,R]=r.useState("ready"),t=r.useCallback((a,o)=>{m.current=!0,T({status:"error",user:null,accessToken:null,error:{code:a,message:o}}),C(!1)},[]),n=r.useCallback(()=>{m.current=!1},[]);r.useEffect(()=>{const a=o=>{switch(o.type){case"client-state":N(J(o.state));break;case"auth-state":m.current||(T(o.state),C(!1));break}};return c.setStateCallback(a),()=>{c.setStateCallback(s.NOOP_STATE_CALLBACK)}},[c]);const i=r.useCallback(async()=>{R("loading")},[]),d=r.useCallback(()=>{R("ready")},[]),h=r.useCallback(()=>{R("loaded")},[]),O=r.useCallback(async a=>{N(W);try{await c.init(a||{})}catch(o){u.error("Init failed:",o)}},[c,u]);r.useEffect(()=>{if(x.current)return;x.current=!0,(async()=>{if(await O(),!E)return;const o=new URL(window.location.href);if(o.pathname!==M||f.current||!s.isWebUIClient(c))return;if(o.searchParams.get("bodhi_flow")==="access_request"){const w=o.searchParams.get("id");if(!w){u.warn("Access request callback marker present but no id parameter"),window.history.replaceState({},"",g);return}f.current=!0,C(!0);try{await c.handleAccessRequestCallback(w)}catch(I){u.error("Access request callback failed:",I);const Y=I instanceof s.BodhiError?I:null;t(Y?.code??"access_request_callback_failed",I instanceof Error?I.message:"Access request callback failed"),window.history.replaceState({},"",g)}return}const z=o.searchParams.get("code"),F=o.searchParams.get("state");if(!(!z||!F)){f.current=!0,C(!0);try{await c.handleOAuthCallback(z,F),window.history.replaceState({},"",g)}catch(w){u.error("OAuth callback failed:",w);const I=w instanceof s.BodhiError?w:null;t(I?.code??"oauth_callback_failed",w instanceof Error?w.message:"OAuth callback failed"),window.history.replaceState({},"",g)}}})()},[O,c,E,M,g]);const q=r.useCallback(async a=>{n(),C(!0);try{const o=a?{...a.userRole&&{userRole:a.userRole},...a.requested&&{requested:a.requested},...a.flowType&&{flowType:a.flowType},...a.redirectUrl&&{redirectUrl:a.redirectUrl},...a.onProgress&&{onProgress:a.onProgress},...a.pollIntervalMs&&{pollIntervalMs:a.pollIntervalMs},...a.pollTimeoutMs&&{pollTimeoutMs:a.pollTimeoutMs}}:void 0,P=o&&Object.keys(o).length>0?o:void 0;await c.login(P)}catch(o){const P=o instanceof s.BodhiError?o:null,z={status:"error",user:null,accessToken:null,error:{message:o instanceof Error?o.message:"Login failed",code:P?.code??"login_failed"}};return T(z),C(!1),z}},[c,n]),D=r.useCallback(async()=>{n();try{await c.logout()}catch(a){t("logout_failed",a instanceof Error?a.message:"Logout failed")}},[c,t,n]),U=r.useMemo(()=>{const a=y.status==="ready",o=y.server.status==="ready";return{client:c,clientState:y,auth:_,isAuthLoading:k,login:q,logout:D,showSetup:i,hideSetup:d,setupState:p,isAuthenticated:_.status==="authenticated",canLogin:a&&!k,isReady:a,isServerReady:o,isOverallReady:a&&o,isInitializing:y.status==="initializing",isExtension:y.mode==="extension",isDirect:y.mode==="direct"}},[c,y,_,k,p,q,D,i,d]);return B.jsxs(j.Provider,{value:U,children:[B.jsx(Q,{client:c,modalHtmlPath:S,hideSetup:d,onSetupReady:h,setupState:p,basePath:g,logLevel:b}),e]})}function re(){const e=r.useContext(j);if(!e)throw new Error("useBodhi must be used within BodhiProvider");return e}const ne=e=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 479.995 479.995",width:"480px",height:"480px",...e},l.createElement("path",{fill:"#ffa4b8",d:"M239.998,374.56l-0.01-0.01c0-0.01,0.01-0.01,0.01-0.02c-4.64-8.78-65.7-144.8-212.22-85.2 c-14.36,5.85-19.78,23.45-11.19,36.36c11.11,16.69,22.86,30.01,34.91,40.53c-27.85,7.89-45.6,33.8-43.3,61.55 c0.96,11.6,13.29,18.52,23.71,13.35c33.99-16.84,60.03-2.51,80.35,2.14c56.68,12.99,113.71,4.53,125.52-46.29 c0.52-2.22,0.95-4.51,1.28-6.89c0.01-0.04,0.01-0.08,0.02-0.12c0.066-0.492,0.126-0.978,0.181-1.458 c0.455-3.631,0.712-7.438,0.739-11.452c-0.02-1.44-0.02-2.01,0-2.25v-0.09c0-0.02,0-0.04,0.01-0.05c0-0.02,0.01-0.03,0.02-0.06 c0-0.01,0.01-0.01,0.01-0.02C240.018,374.569,240.008,374.56,239.998,374.56z"}),l.createElement("path",{fill:"#ffa4b8",d:"M471.798,427.769c-0.96,11.6-13.29,18.52-23.71,13.35c-33.99-16.84-60.03-2.51-80.35,2.14 c-63.41,14.53-127.25,2.22-127.74-66.21c0.033-2.642-0.044-2.302,0.04-2.47c-0.02-0.01-0.03-0.02-0.04-0.02l0.01-0.01 c0-0.01-0.01-0.01-0.01-0.02c4.64-8.78,65.7-144.8,212.22-85.2c14.36,5.85,19.78,23.45,11.19,36.36 c-11.11,16.69-22.86,30.01-34.91,40.53C456.348,374.109,474.098,400.019,471.798,427.769z"}),l.createElement("path",{fill:"#befa91",d:"M428.498,366.219c27.85,7.89,45.6,33.8,43.3,61.55c-0.96,11.6-13.29,18.52-23.71,13.35 c-33.99-16.84-60.03-2.51-80.35,2.14c-63.41,14.53-127.928,2.222-127.74-66.21c0.007-2.683-0.02-2.351,0.04-2.47 C248.598,379.129,345.858,438.329,428.498,366.219z"}),l.createElement("path",{fill:"#befa91",d:"M51.498,366.219c82.76,72.22,180.18,12.74,188.5,8.34c0.01,0,0.02,0.01,0.04,0.02 c-0.058,0.116-0.047-0.169-0.04,2.47c0.188,68.432-64.33,80.74-127.74,66.21c-20.32-4.65-46.36-18.98-80.35-2.14 c-10.42,5.17-22.75-1.75-23.71-13.35C5.898,400.019,23.648,374.109,51.498,366.219z"}),l.createElement("path",{fill:"#ffbfcb",d:"M235.228,365.299c-32.29-36.09-89.98-73-179.74-36.49c-1.979,0.805-3.787,1.834-5.413,3.042 c-10.569,7.856-25.473,5.765-32.82-5.164c-0.223-0.331-0.445-0.664-0.667-0.997c-8.59-12.91-3.17-30.51,11.19-36.36 C155.168,237.509,217.948,333.56,235.228,365.299z"}),l.createElement("path",{fill:"#ffa4b8",d:"M239.998,374.549c-12.85-2.2-214.54-23.33-193.03-240.71c1.49-14.99,15.86-25.15,30.48-21.55 c108.49,26.72,149.07,91.39,162.55,149.92C252.768,317.699,241.178,367.679,239.998,374.549z"}),l.createElement("path",{fill:"#ffbfcb",d:"M193.698,174.638c11.866,12.406-3.013,31.792-18.056,23.52 c-21.875-12.028-50.044-10.573-70.207,3.701c-24.832,17.579-59.398-0.365-60.013-30.784c-0.237-11.724,0.248-24.123,1.545-37.237 c1.49-14.99,15.86-25.15,30.48-21.55C131.23,125.537,168.324,148.11,193.698,174.638z"}),l.createElement("path",{fill:"#ffa4b8",d:"M221.538,39.599c9.78-11.13,27.15-11.12,36.93,0.01c157.02,178.77-7.48,323.95-18.47,334.94 C229.988,364.549,63.948,218.989,221.538,39.599z"}),l.createElement("path",{fill:"#ffbfcb",d:"M261.523,43.131c9.452,11.033,8.166,27.623-2.74,37.221c-0.784,0.69-1.535,1.439-2.245,2.247 c-35.942,40.915-55.05,80.07-63.012,116.258c-5.176,23.523-39.936,19.717-39.551-4.366c0.741-46.282,18.411-98.941,67.563-154.892 c9.78-11.13,27.15-11.12,36.93,0.01C259.5,40.785,260.518,41.959,261.523,43.131z"}),l.createElement("path",{fill:"#ffa4b8",d:"M239.998,374.549c-1.18-6.87-12.77-56.85,0-112.34c13.48-58.53,54.06-123.2,162.55-149.92 c14.62-3.6,28.99,6.56,30.48,21.55C454.538,351.219,252.848,372.349,239.998,374.549z"}),l.createElement("path",{fill:"#ff8ca5",d:"M239.998,374.549c-3.115-0.536-17.362-2.183-36.835-7.483c-3.181-0.866-6.028-2.682-8.145-5.209 c-49.098-58.608-75.675-130.75-61.047-205.793c2.165-11.107,14.881-16.444,24.408-10.337c0.756,0.485,1.506,0.972,2.249,1.462 C126.798,274.139,232.088,366.649,239.998,374.549z"}),l.createElement("path",{fill:"#ff8ca5",d:"M281.608,365.729c-21.9,6.37-38.24,8.25-41.61,8.82c8.67-8.67,112.98-100.94,79.35-227.34v-0.01 c0.742-0.489,1.49-0.975,2.244-1.459c9.551-6.123,22.265-0.733,24.422,10.406C369.565,277.734,281.608,363.204,281.608,365.729z"}),l.createElement("path",{fill:"#ff8ca5",d:"M417.451,302.932c-32.211,44.193-80.706,72.823-134.571,87.345c-3.396,0.916-6.999,0.754-10.3-0.463 c-20.772-7.664-31.911-15.254-32.583-15.254c0.826-0.825,112.667-9.463,166.4-98.31C419.37,278.279,424.743,292.927,417.451,302.932 z"}),l.createElement("path",{fill:"#ff8ca5",d:"M62.565,302.932c32.211,44.193,80.705,72.823,134.571,87.345c3.396,0.916,6.999,0.754,10.3-0.463 c20.772-7.664,31.911-15.254,32.583-15.254c-0.828-0.828-112.665-9.458-166.4-98.31C60.646,278.279,55.273,292.927,62.565,302.932z"}),l.createElement("path",{fill:"#9ceb63",d:"M433.464,393.091c-52.749,39.415-118.979,42.09-182.861,13.657 c-4.441-1.977-7.606-6.011-8.633-10.763c-1.552-7.18-1.884-14.238-1.973-21.326c0.172-0.345,9.566,5.934,26.76,12.89 c36.31,14.71,102.75,30.15,161.74-21.33C440.977,369.752,443.403,385.664,433.464,393.091z"}),l.createElement("path",{fill:"#9ceb63",d:"M240.038,374.579c0,0.01-0.01,0.01-0.01,0.02s-0.01,0.03-0.01,0.05c0,0,0,0,0,0.01 c-0.01,0.03-0.01,0.06-0.02,0.1v0.04c-0.13,1.3,0.09,7.59-0.92,15.16c-0.01,0.04-0.01,0.08-0.02,0.12 c-0.26,1.91-0.59,3.91-1.03,5.92c-0.07,0.33-0.15,0.65-0.25,0.97c-1.23,4.33-4.28,7.95-8.41,9.79 c-63.06,28.05-129.47,26.21-182.79-13.63c-9.94-7.43-7.63-23.36,4.92-26.91c13.1,11.46,28.11,20.79,44.16,26.79 c19.78,7.48,34.99,8.98,53.83,8.68c34.33-0.55,60.1-11.03,90.51-27.13C240.008,374.56,240.018,374.569,240.038,374.579z"}),l.createElement("path",{d:"M443.143,363.426c9.579-9.648,18.604-20.804,26.926-33.305c11.399-17.132,4.201-40.447-14.837-48.202 c-12.321-5.012-24.515-8.844-36.391-11.454c17.945-34.197,27.974-78.94,22.188-137.413c-1.925-19.503-20.802-33.354-40.394-28.53 c-17.952,4.421-34.806,10.063-50.093,16.768c-4.046,1.775-5.888,6.494-4.113,10.54c1.774,4.046,6.493,5.887,10.54,4.113 c14.45-6.338,30.429-11.682,47.492-15.885c9.885-2.435,19.599,4.434,20.607,14.573c9.088,90.121-21.147,164.341-99.823,205.213 c-3.921,2.037-5.448,6.866-3.411,10.787c2.043,3.933,6.879,5.442,10.787,3.411c27.191-14.125,56.267-35.849,77.701-68.994 c12.564,2.375,25.617,6.296,38.878,11.69c9.68,3.943,13.334,15.824,7.549,24.518c-10.205,15.33-21.482,28.43-33.516,38.936 c-49.396,43.107-111.979,41.39-169.834,12.419c56.638-56.971,92.247-132.34,77.074-212.524 c-8.101-42.81-30.305-85.119-65.997-125.754c-12.964-14.759-36.003-14.748-48.946-0.016 c-28.645,32.607-48.657,66.371-59.602,100.512c-21.999-13.018-47.7-23.197-76.569-30.307c-19.338-4.763-38.383,8.699-40.354,28.53 C26.197,262.501,90.89,324.677,147.416,354.042c3.92,2.036,8.75,0.51,10.787-3.411c2.037-3.921,0.51-8.75-3.411-10.787 c-52.141-27.086-111.791-84.677-99.863-205.213c1.007-10.132,10.713-17.01,20.606-14.574c31.115,7.663,58.223,19.013,80.571,33.735 c4.863,3.204,10.891,0.586,12.257-4.539c9.392-35.245,29.306-70.362,59.188-104.378c6.581-7.492,18.316-7.487,24.904,0.014 c128.735,146.565,37.449,269.122-12.476,318.519c-30.274-29.828-76.759-87.727-78.002-162.831 c-0.073-4.417-3.698-7.933-8.131-7.867c-4.417,0.073-7.939,3.714-7.867,8.131c1.382,83.483,54.096,146.516,85.999,177.099 c-0.353,20.737-7.099,36.575-20.104,47.086c-20.129,16.267-55.786,20.072-97.831,10.438c-19.181-4.396-48.632-19.874-85.688-1.511 c-5.361,2.657-11.689-0.859-12.186-6.844c-1.888-22.74,12.042-43.926,33.548-51.893c13.4,11.096,27.797,19.551,43.11,25.275 c20.238,7.653,36.036,9.525,56.788,9.196c15.85-0.254,30.814-2.572,45.747-7.085c4.229-1.278,6.622-5.743,5.343-9.972 c-1.278-4.229-5.744-6.622-9.972-5.344c-13.494,4.078-27.027,6.173-41.373,6.403c-17.347,0.275-31.911-0.993-50.901-8.174 c-31.69-11.847-56.387-35.98-75.211-64.258c-5.791-8.704-2.122-20.58,7.548-24.52c4.092-1.667,6.058-6.335,4.391-10.427 c-1.667-4.092-6.334-6.058-10.427-4.391c-19.062,7.765-26.214,31.095-14.832,48.202c8.365,12.566,17.352,23.674,26.917,33.31 C12.89,375.664-2.037,401.187,0.226,428.434c1.427,17.192,19.743,27.533,35.235,19.857c30.84-15.283,54.311-1.971,75.01,2.771 c36.708,8.411,82.166,10.086,111.461-13.59c14.777-11.943,23.305-28.715,25.489-49.937 c61.607,30.736,128.694,32.482,182.835-12.326c21.516,7.959,35.456,29.153,33.567,51.902c-0.493,5.939-6.786,9.519-12.186,6.844 c-30.339-15.034-55.535-7.379-73.932-1.791c-31.306,9.51-74.736,14.144-102.884-2.498c-3.803-2.248-8.709-0.989-10.958,2.815 c-2.249,3.803-0.989,8.709,2.815,10.958c29.214,17.272,69.817,15.19,102.844,7.622c20.72-4.747,44.177-18.05,75.01-2.771 c15.523,7.691,33.811-2.693,35.235-19.856C482.032,401.183,467.102,375.655,443.143,363.426z"})),se={sm:32,md:48,lg:64};function ae({size:e="md",variant:c="light",className:S="",style:E={}}){const A=se[e],g={display:"inline-block",cursor:"pointer",transition:"all 250ms ease",borderRadius:"50%",...c==="dark"&&{backgroundColor:"rgba(255, 255, 255, 0.05)",padding:"8px"},...E};return B.jsx("a",{href:"https://getbodhi.app",target:"_blank",rel:"noopener noreferrer",title:"Powered by Bodhi","aria-label":"Powered by Bodhi - Visit getbodhi.app",className:S,style:g,onMouseEnter:b=>{b.currentTarget.style.transform="scale(1.1)",b.currentTarget.style.boxShadow="0 0 20px rgba(255, 164, 184, 0.6)"},onMouseLeave:b=>{b.currentTarget.style.transform="scale(1)",b.currentTarget.style.boxShadow="none"},children:B.jsx(ne,{width:A,height:A,style:{display:"block"}})})}const ce="production";Object.defineProperty(exports,"BodhiApiError",{enumerable:!0,get:()=>s.BodhiApiError});Object.defineProperty(exports,"BodhiError",{enumerable:!0,get:()=>s.BodhiError});Object.defineProperty(exports,"createApiError",{enumerable:!0,get:()=>s.createApiError});Object.defineProperty(exports,"createOperationError",{enumerable:!0,get:()=>s.createOperationError});Object.defineProperty(exports,"isAuthError",{enumerable:!0,get:()=>s.isAuthError});Object.defineProperty(exports,"isAuthLoading",{enumerable:!0,get:()=>s.isAuthLoading});Object.defineProperty(exports,"isAuthenticated",{enumerable:!0,get:()=>s.isAuthenticated});Object.defineProperty(exports,"isClientReady",{enumerable:!0,get:()=>s.isClientReady});Object.defineProperty(exports,"isDirectState",{enumerable:!0,get:()=>s.isDirectState});Object.defineProperty(exports,"isExtensionState",{enumerable:!0,get:()=>s.isExtensionState});Object.defineProperty(exports,"isWebUIClient",{enumerable:!0,get:()=>s.isWebUIClient});Object.defineProperty(exports,"unwrapResponse",{enumerable:!0,get:()=>s.unwrapResponse});exports.BodhiBadge=ae;exports.BodhiProvider=te;exports.BodhiReactContext=j;exports.ClientCtxState=ee;exports.INITIALIZING_CLIENT_CONTEXT_STATE=W;exports.INITIAL_CLIENT_CONTEXT_STATE=V;exports.REACT_CORE_BUILD_MODE=ce;exports.clientStateToContextState=J;exports.isClientCtxInitialized=X;exports.isClientCtxInitializing=K;exports.isClientCtxNotInitialized=H;exports.isClientCtxReady=G;exports.isOverallReady=Z;exports.useBodhi=re;
@@ -1,25 +1,25 @@
1
- import { jsxs as V, jsx as P } from "react/jsx-runtime";
2
- import { Logger as G, BodhiClientUserPrefsManager as W, createStoragePrefixWithBasePath as j, detectBrowser as K, detectOS as X, getServerUrl as Y, isDirectServerReady as Z, isExtensionServerReady as $, OS_CONFIGS as J, BROWSER_CONFIGS as Q, OnboardingModal as ee, BACKEND_SERVER_NOT_CONNECTED as H, isExtensionState as te, INITIAL_AUTH_STATE as re, NOOP_STATE_CALLBACK as ne, isWebUIClient as se } from "@bodhiapp/bodhi-js-core";
3
- import { BodhiApiError as Te, BodhiError as Le, createApiError as Oe, createOperationError as Re, isAuthError as ze, isAuthLoading as ke, isAuthenticated as De, isClientReady as Ne, isDirectState as Be, isExtensionState as Pe, isWebUIClient as Ue, unwrapResponse as Fe } from "@bodhiapp/bodhi-js-core";
1
+ import { jsxs as $, jsx as W } from "react/jsx-runtime";
2
+ import { Logger as K, BodhiClientUserPrefsManager as J, createStoragePrefixWithBasePath as Q, detectBrowser as ee, detectOS as te, getServerUrl as re, isDirectServerReady as ne, isExtensionServerReady as se, OS_CONFIGS as ae, BROWSER_CONFIGS as ce, OnboardingModal as oe, BACKEND_SERVER_NOT_CONNECTED as X, isExtensionState as ie, INITIAL_AUTH_STATE as ue, NOOP_STATE_CALLBACK as le, isWebUIClient as de, BodhiError as V } from "@bodhiapp/bodhi-js-core";
3
+ import { BodhiApiError as Ne, BodhiError as Be, createApiError as Pe, createOperationError as Ue, isAuthError as qe, isAuthLoading as Fe, isAuthenticated as He, isClientReady as Ve, isDirectState as We, isExtensionState as je, isWebUIClient as Ge, unwrapResponse as Ke } from "@bodhiapp/bodhi-js-core";
4
4
  import * as i from "react";
5
- import { useMemo as z, useRef as D, useCallback as f, useEffect as N, createContext as ae, useState as k, useContext as ce } from "react";
6
- import { MSG as w, DEFAULT_SETUP_STATE as oe } from "@bodhiapp/setup-modal-types";
7
- function ie({
5
+ import { useMemo as D, useRef as N, useCallback as l, useEffect as q, createContext as fe, useState as U, useContext as he } from "react";
6
+ import { MSG as E, DEFAULT_SETUP_STATE as pe } from "@bodhiapp/setup-modal-types";
7
+ function ge({
8
8
  client: e,
9
9
  modalHtmlPath: a,
10
- hideSetup: x,
11
- onSetupReady: b,
12
- setupState: A,
10
+ hideSetup: y,
11
+ onSetupReady: w,
12
+ setupState: I,
13
13
  basePath: h = "/",
14
- logLevel: g = "warn"
14
+ logLevel: m = "warn"
15
15
  }) {
16
- const L = A !== "ready", M = z(() => new G("SetupModalProcessor", g), [g]), o = D(null), l = z(
17
- () => new W(j(h, "bodhijs:")),
16
+ const k = I !== "ready", b = D(() => new K("SetupModalProcessor", m), [m]), o = N(null), d = D(
17
+ () => new J(Q(h, "bodhijs:")),
18
18
  [h]
19
- ), S = D(null), m = f(
19
+ ), S = N(null), x = l(
20
20
  (t) => t === "direct" ? "lna" : t === "extension" ? "extension" : null,
21
21
  []
22
- ), O = f((t) => t.extension === "ready" ? {
22
+ ), C = l((t) => t.extension === "ready" ? {
23
23
  status: "ready",
24
24
  version: "unknown",
25
25
  // TODO: have ExtensionState also get extension version
@@ -30,7 +30,7 @@ function ie({
30
30
  } : {
31
31
  status: "unreachable",
32
32
  error: { message: "Client not initialized", code: "ext-connection-failed" }
33
- }, []), I = f((t) => {
33
+ }, []), L = l((t) => {
34
34
  if (t.server.status === "pending-extension-ready")
35
35
  return {
36
36
  status: "pending-extension-ready",
@@ -83,7 +83,7 @@ function ie({
83
83
  }
84
84
  };
85
85
  }
86
- }, []), E = f((t) => {
86
+ }, []), M = l((t) => {
87
87
  if (t.server.status === "not-connected")
88
88
  return { status: "pending-lna-ready" };
89
89
  const r = t.server;
@@ -106,169 +106,169 @@ function ie({
106
106
  error: { message: "Unknown server status" }
107
107
  };
108
108
  }
109
- }, []), _ = f(
109
+ }, []), T = l(
110
110
  (t, r) => {
111
111
  if (t.server.status !== "pending-extension-ready") {
112
- const s = t.server.status;
113
- if (s === "ready" || s === "setup" || s === "resource_admin")
112
+ const c = t.server.status;
113
+ if (c === "ready" || c === "setup" || c === "resource_admin")
114
114
  return !0;
115
115
  }
116
116
  if (r.server.status !== "not-connected") {
117
- const s = r.server.status;
118
- if (s === "ready" || s === "setup" || s === "resource_admin")
117
+ const c = r.server.status;
118
+ if (c === "ready" || c === "setup" || c === "resource_admin")
119
119
  return !0;
120
120
  }
121
121
  return !1;
122
122
  },
123
123
  []
124
- ), y = f(
125
- (t, r, s) => {
124
+ ), R = l(
125
+ (t, r, c) => {
126
126
  if (r === "skipped")
127
- return { status: "skipped", serverUrl: s };
127
+ return { status: "skipped", serverUrl: c };
128
128
  if (t.server.status !== "not-connected") {
129
129
  const u = t.server;
130
- return u.status === "ready" || u.status === "setup" || u.status === "resource_admin" ? { status: "granted", serverUrl: s } : {
130
+ return u.status === "ready" || u.status === "setup" || u.status === "resource_admin" ? { status: "granted", serverUrl: c } : {
131
131
  status: "unreachable",
132
- serverUrl: s,
132
+ serverUrl: c,
133
133
  error: {
134
134
  message: u.error?.message || "Server unreachable",
135
135
  code: "lna-unreachable"
136
136
  }
137
137
  };
138
138
  }
139
- return r === "granted" ? { status: "granted", serverUrl: s } : { status: "prompt", serverUrl: s };
139
+ return r === "granted" ? { status: "granted", serverUrl: c } : { status: "prompt", serverUrl: c };
140
140
  },
141
141
  []
142
- ), C = f(
142
+ ), f = l(
143
143
  async (t = !1) => {
144
- const r = K().type, s = X().type;
144
+ const r = ee().type, c = te().type;
145
145
  let u = await e.getExtensionState();
146
146
  (u.extension === "not-initialized" || t) && (u = await e.testExtensionConnectivity());
147
- let d = await e.getDirectState();
148
- const T = l.getDirectStatus();
149
- T === "granted" && (d.server.status === "not-connected" || t) && (d = await e.testDirectConnectivity());
150
- const c = Y(d) || "http://localhost:1135", v = y(d, T, c);
151
- return e.getConnectionMode() === null && (Z(d) ? await e.setConnectionMode("direct") : $(u) && await e.setConnectionMode("extension")), l.isServerInstallConfirmed() || _(u, d) && l.setServerInstallConfirmed(!0), {
152
- extension: O(u),
153
- server: I(u),
154
- lna: v,
155
- lnaServer: E(d),
156
- env: { browser: r, os: s },
157
- browsers: Q,
158
- os: J,
159
- userConfirmations: { serverInstall: l.isServerInstallConfirmed() },
160
- selectedConnection: m(e.getConnectionMode())
147
+ let g = await e.getDirectState();
148
+ const _ = d.getDirectStatus();
149
+ _ === "granted" && (g.server.status === "not-connected" || t) && (g = await e.testDirectConnectivity());
150
+ const B = re(g) || "http://localhost:1135", H = R(g, _, B);
151
+ return e.getConnectionMode() === null && (ne(g) ? await e.setConnectionMode("direct") : se(u) && await e.setConnectionMode("extension")), d.isServerInstallConfirmed() || T(u, g) && d.setServerInstallConfirmed(!0), {
152
+ extension: C(u),
153
+ server: L(u),
154
+ lna: H,
155
+ lnaServer: M(g),
156
+ env: { browser: r, os: c },
157
+ browsers: ce,
158
+ os: ae,
159
+ userConfirmations: { serverInstall: d.isServerInstallConfirmed() },
160
+ selectedConnection: x(e.getConnectionMode())
161
161
  };
162
162
  },
163
163
  [
164
164
  e,
165
- l,
166
- O,
167
- I,
168
- E,
169
- m,
170
- y,
171
- _
165
+ d,
166
+ C,
167
+ L,
168
+ M,
169
+ x,
170
+ R,
171
+ T
172
172
  ]
173
- ), p = f(() => {
173
+ ), p = l(() => {
174
174
  if (!S.current)
175
175
  throw new Error("Cannot get state: currentStateRef is null");
176
176
  return {
177
177
  ...S.current,
178
178
  // Override userConfirmations from storage (in case updated outside buildSetupState)
179
179
  userConfirmations: {
180
- serverInstall: l.isServerInstallConfirmed()
180
+ serverInstall: d.isServerInstallConfirmed()
181
181
  },
182
182
  // Override selectedConnection from client (in case changed via handler)
183
- selectedConnection: m(e.getConnectionMode())
183
+ selectedConnection: x(e.getConnectionMode())
184
184
  };
185
- }, [l, e, m]), R = z(
185
+ }, [d, e, x]), O = D(
186
186
  () => ({
187
- [w.MODAL_READY]: async () => (M.info("MODAL_READY: returning current state or default"), S.current ? { setupState: p() } : { setupState: oe }),
188
- [w.MODAL_REFRESH]: async () => {
189
- M.info("MODAL_REFRESH: refreshing state");
190
- const t = await C(!0);
187
+ [E.MODAL_READY]: async () => (b.info("MODAL_READY: returning current state or default"), S.current ? { setupState: p() } : { setupState: pe }),
188
+ [E.MODAL_REFRESH]: async () => {
189
+ b.info("MODAL_REFRESH: refreshing state");
190
+ const t = await f(!0);
191
191
  S.current = t;
192
192
  const r = p();
193
- return M.info(`MODAL_REFRESH: state refreshed
193
+ return b.info(`MODAL_REFRESH: state refreshed
194
194
  `, JSON.stringify(r, null, 2)), o.current?.updateState(p()), { setupState: r };
195
195
  },
196
- [w.MODAL_LNA_CONNECT]: async (t) => {
196
+ [E.MODAL_LNA_CONNECT]: async (t) => {
197
197
  const r = t.payload.serverUrl;
198
198
  console.log("[SetupModalProcessor] LNA connect:", r);
199
- const s = await e.testDirectConnectivity(r);
200
- if (s.server.status !== "not-connected") {
201
- const d = s.server.status;
202
- if (d === "ready" || d === "setup" || d === "resource_admin") {
203
- l.setDirectStatus("granted"), e.getConnectionMode() === null && await e.setConnectionMode("direct");
204
- const T = await C();
205
- return S.current = T, o.current?.updateState(p()), { success: !0 };
199
+ const c = await e.testDirectConnectivity(r);
200
+ if (c.server.status !== "not-connected") {
201
+ const g = c.server.status;
202
+ if (g === "ready" || g === "setup" || g === "resource_admin") {
203
+ d.setDirectStatus("granted"), e.getConnectionMode() === null && await e.setConnectionMode("direct");
204
+ const _ = await f();
205
+ return S.current = _, o.current?.updateState(p()), { success: !0 };
206
206
  }
207
207
  }
208
- const u = await C();
208
+ const u = await f();
209
209
  return S.current = u, o.current?.updateState(p()), { success: !1 };
210
210
  },
211
- [w.MODAL_LNA_SKIP]: async () => {
212
- l.setDirectStatus("skipped");
213
- const t = await C();
211
+ [E.MODAL_LNA_SKIP]: async () => {
212
+ d.setDirectStatus("skipped");
213
+ const t = await f();
214
214
  return S.current = t, o.current?.updateState(p()), { success: !0 };
215
215
  },
216
- [w.MODAL_CLOSE]: () => {
217
- x();
216
+ [E.MODAL_CLOSE]: () => {
217
+ y();
218
218
  },
219
- [w.MODAL_COMPLETE]: () => {
220
- x();
219
+ [E.MODAL_COMPLETE]: () => {
220
+ y();
221
221
  },
222
- [w.MODAL_CONFIRM_SERVER_INSTALL]: (t) => (l.setServerInstallConfirmed(t.payload.confirmed), o.current?.updateState(p()), { success: !0 }),
223
- [w.MODAL_SELECT_CONNECTION]: async (t) => {
224
- const s = t.payload.connection === "lna" ? "direct" : "extension";
225
- return await e.setConnectionMode(s), o.current?.updateState(p()), { success: !0 };
222
+ [E.MODAL_CONFIRM_SERVER_INSTALL]: (t) => (d.setServerInstallConfirmed(t.payload.confirmed), o.current?.updateState(p()), { success: !0 }),
223
+ [E.MODAL_SELECT_CONNECTION]: async (t) => {
224
+ const c = t.payload.connection === "lna" ? "direct" : "extension";
225
+ return await e.setConnectionMode(c), o.current?.updateState(p()), { success: !0 };
226
226
  }
227
227
  }),
228
- [M, e, l, C, p, E, x]
228
+ [b, e, d, f, p, M, y]
229
229
  );
230
- return N(() => (o.current = new ee({ modalHtmlPath: a, handlers: R }), () => {
230
+ return q(() => (o.current = new oe({ modalHtmlPath: a, handlers: O }), () => {
231
231
  o.current?.destroy(), o.current = null;
232
- }), [a, R]), N(() => {
233
- L && o.current ? (o.current.showLoading(), C(!0).then((t) => {
234
- S.current = t, o.current?.updateState(t), b?.();
232
+ }), [a, O]), q(() => {
233
+ k && o.current ? (o.current.showLoading(), f(!0).then((t) => {
234
+ S.current = t, o.current?.updateState(t), w?.();
235
235
  }).catch((t) => {
236
236
  console.error("[SetupModalProcessor] buildSetupState failed:", t);
237
- })) : !L && o.current && o.current.destroy();
238
- }, [L, C, b]), null;
237
+ })) : !k && o.current && o.current.destroy();
238
+ }, [k, f, w]), null;
239
239
  }
240
- const ue = {
240
+ const me = {
241
241
  status: "not-initialized",
242
242
  mode: null,
243
243
  extensionId: null,
244
244
  url: null,
245
- server: H,
245
+ server: X,
246
246
  error: null
247
- }, le = {
247
+ }, Se = {
248
248
  status: "initializing",
249
249
  mode: null,
250
250
  extensionId: null,
251
251
  url: null,
252
- server: H,
252
+ server: X,
253
253
  error: null
254
254
  };
255
- function de(e) {
255
+ function Ce(e) {
256
256
  return e.status === "not-initialized";
257
257
  }
258
- function fe(e) {
258
+ function ve(e) {
259
259
  return e.status === "initializing";
260
260
  }
261
- function pe(e) {
261
+ function Ee(e) {
262
262
  return e.status !== "not-initialized" && e.status !== "initializing";
263
263
  }
264
- function q(e) {
264
+ function Y(e) {
265
265
  return e.status === "ready";
266
266
  }
267
- function ge(e) {
268
- return q(e) && e.server.status === "ready";
267
+ function ye(e) {
268
+ return Y(e) && e.server.status === "ready";
269
269
  }
270
- function me(e) {
271
- return te(e) ? {
270
+ function we(e) {
271
+ return ie(e) ? {
272
272
  status: e.extension === "not-initialized" ? "initializing" : e.extension === "not-found" ? "extension-not-found" : "ready",
273
273
  mode: "extension",
274
274
  extensionId: e.extensionId,
@@ -284,83 +284,111 @@ function me(e) {
284
284
  error: e.server.error
285
285
  };
286
286
  }
287
- const we = {
288
- isNotInitialized: de,
289
- isInitializing: fe,
290
- isInitialized: pe,
291
- isReady: q,
292
- isOverallReady: ge
293
- }, U = ae(null);
294
- U.displayName = "BodhiContext";
295
- function xe({
287
+ const Te = {
288
+ isNotInitialized: Ce,
289
+ isInitializing: ve,
290
+ isInitialized: Ee,
291
+ isReady: Y,
292
+ isOverallReady: ye
293
+ }, j = fe(null);
294
+ j.displayName = "BodhiContext";
295
+ function Re({
296
296
  children: e,
297
297
  client: a,
298
- modalHtmlPath: x,
299
- handleCallback: b = !0,
300
- callbackPath: A,
298
+ modalHtmlPath: y,
299
+ handleCallback: w = !0,
300
+ callbackPath: I,
301
301
  basePath: h = "/",
302
- logLevel: g = "warn"
302
+ logLevel: m = "warn"
303
303
  }) {
304
- const L = h === "/" ? "" : h.replace(/\/$/, ""), M = A ?? `${L}/callback`, o = z(() => new G("BodhiProvider", g), [g]), l = D(!1), S = D(!1), [m, O] = k(ue), [I, E] = k(re), [_, y] = k(!1), [C, p] = k("ready");
305
- N(() => {
306
- const n = (c) => {
307
- switch (c.type) {
304
+ const k = h === "/" ? "" : h.replace(/\/$/, ""), b = I ?? `${k}/callback`, o = D(() => new K("BodhiProvider", m), [m]), d = N(!1), S = N(!1), x = N(!1), [C, L] = U(me), [M, T] = U(ue), [R, f] = U(!1), [p, O] = U("ready"), t = l((n, s) => {
305
+ S.current = !0, T({
306
+ status: "error",
307
+ user: null,
308
+ accessToken: null,
309
+ error: { code: n, message: s }
310
+ }), f(!1);
311
+ }, []), r = l(() => {
312
+ S.current = !1;
313
+ }, []);
314
+ q(() => {
315
+ const n = (s) => {
316
+ switch (s.type) {
308
317
  case "client-state":
309
- O(me(c.state));
318
+ L(we(s.state));
310
319
  break;
311
320
  case "auth-state":
312
- E(c.state), y(!1);
321
+ S.current || (T(s.state), f(!1));
313
322
  break;
314
323
  }
315
324
  };
316
325
  return a.setStateCallback(n), () => {
317
- a.setStateCallback(ne);
326
+ a.setStateCallback(le);
318
327
  };
319
328
  }, [a]);
320
- const R = f(async () => {
321
- p("loading");
322
- }, []), t = f(() => {
323
- p("ready");
324
- }, []), r = f(() => {
325
- p("loaded");
326
- }, []), s = f(
329
+ const c = l(async () => {
330
+ O("loading");
331
+ }, []), u = l(() => {
332
+ O("ready");
333
+ }, []), g = l(() => {
334
+ O("loaded");
335
+ }, []), _ = l(
327
336
  async (n) => {
328
- O(le);
337
+ L(Se);
329
338
  try {
330
339
  await a.init(n || {});
331
- } catch (c) {
332
- o.error("Init failed:", c);
340
+ } catch (s) {
341
+ o.error("Init failed:", s);
333
342
  }
334
343
  },
335
344
  [a, o]
336
345
  );
337
- N(() => {
338
- if (S.current) return;
339
- S.current = !0, (async () => {
340
- if (await s(), !b) return;
341
- const c = new URL(window.location.href);
342
- if (c.pathname !== M) return;
343
- const v = c.searchParams.get("code"), F = c.searchParams.get("state");
344
- !v || !F || l.current || (l.current = !0, se(a) && (y(!0), a.handleOAuthCallback(v, F).then(() => {
345
- window.history.replaceState({}, "", h);
346
- }).catch((B) => {
347
- o.error("OAuth callback failed:", B), E({
348
- status: "error",
349
- user: null,
350
- accessToken: null,
351
- error: {
352
- message: B instanceof Error ? B.message : "OAuth callback failed",
353
- code: "OAUTH_CALLBACK_FAILED"
354
- }
355
- }), y(!1), window.history.replaceState({}, "", h);
356
- })));
346
+ q(() => {
347
+ if (x.current) return;
348
+ x.current = !0, (async () => {
349
+ if (await _(), !w) return;
350
+ const s = new URL(window.location.href);
351
+ if (s.pathname !== b || d.current || !de(a)) return;
352
+ if (s.searchParams.get("bodhi_flow") === "access_request") {
353
+ const v = s.searchParams.get("id");
354
+ if (!v) {
355
+ o.warn("Access request callback marker present but no id parameter"), window.history.replaceState({}, "", h);
356
+ return;
357
+ }
358
+ d.current = !0, f(!0);
359
+ try {
360
+ await a.handleAccessRequestCallback(v);
361
+ } catch (A) {
362
+ o.error("Access request callback failed:", A);
363
+ const Z = A instanceof V ? A : null;
364
+ t(
365
+ Z?.code ?? "access_request_callback_failed",
366
+ A instanceof Error ? A.message : "Access request callback failed"
367
+ ), window.history.replaceState({}, "", h);
368
+ }
369
+ return;
370
+ }
371
+ const z = s.searchParams.get("code"), G = s.searchParams.get("state");
372
+ if (!(!z || !G)) {
373
+ d.current = !0, f(!0);
374
+ try {
375
+ await a.handleOAuthCallback(z, G), window.history.replaceState({}, "", h);
376
+ } catch (v) {
377
+ o.error("OAuth callback failed:", v);
378
+ const A = v instanceof V ? v : null;
379
+ t(
380
+ A?.code ?? "oauth_callback_failed",
381
+ v instanceof Error ? v.message : "OAuth callback failed"
382
+ ), window.history.replaceState({}, "", h);
383
+ }
384
+ }
357
385
  })();
358
- }, [s, a, b, M, h]);
359
- const u = f(
386
+ }, [_, a, w, b, h]);
387
+ const F = l(
360
388
  async (n) => {
361
- y(!0);
389
+ r(), f(!0);
362
390
  try {
363
- const c = n ? {
391
+ const s = n ? {
364
392
  ...n.userRole && { userRole: n.userRole },
365
393
  ...n.requested && { requested: n.requested },
366
394
  ...n.flowType && { flowType: n.flowType },
@@ -368,93 +396,86 @@ function xe({
368
396
  ...n.onProgress && { onProgress: n.onProgress },
369
397
  ...n.pollIntervalMs && { pollIntervalMs: n.pollIntervalMs },
370
398
  ...n.pollTimeoutMs && { pollTimeoutMs: n.pollTimeoutMs }
371
- } : void 0, v = c && Object.keys(c).length > 0 ? c : void 0;
372
- await a.login(v);
373
- } catch (c) {
374
- const v = {
399
+ } : void 0, P = s && Object.keys(s).length > 0 ? s : void 0;
400
+ await a.login(P);
401
+ } catch (s) {
402
+ const P = s instanceof V ? s : null, z = {
375
403
  status: "error",
376
404
  user: null,
377
405
  accessToken: null,
378
406
  error: {
379
- message: c instanceof Error ? c.message : "Login failed",
380
- code: "LOGIN_FAILED"
407
+ message: s instanceof Error ? s.message : "Login failed",
408
+ code: P?.code ?? "login_failed"
381
409
  }
382
410
  };
383
- return E(v), y(!1), v;
411
+ return T(z), f(!1), z;
384
412
  }
385
413
  },
386
- [a]
387
- ), d = f(async () => {
414
+ [a, r]
415
+ ), B = l(async () => {
416
+ r();
388
417
  try {
389
418
  await a.logout();
390
419
  } catch (n) {
391
- E({
392
- status: "error",
393
- user: null,
394
- accessToken: null,
395
- error: {
396
- message: n instanceof Error ? n.message : "Logout failed",
397
- code: "LOGOUT_FAILED"
398
- }
399
- });
420
+ t("logout_failed", n instanceof Error ? n.message : "Logout failed");
400
421
  }
401
- }, [a]), T = z(() => {
402
- const n = m.status === "ready", c = m.server.status === "ready";
422
+ }, [a, t, r]), H = D(() => {
423
+ const n = C.status === "ready", s = C.server.status === "ready";
403
424
  return {
404
425
  client: a,
405
- clientState: m,
406
- auth: I,
407
- isAuthLoading: _,
408
- login: u,
409
- logout: d,
410
- showSetup: R,
411
- hideSetup: t,
412
- setupState: C,
426
+ clientState: C,
427
+ auth: M,
428
+ isAuthLoading: R,
429
+ login: F,
430
+ logout: B,
431
+ showSetup: c,
432
+ hideSetup: u,
433
+ setupState: p,
413
434
  // Computed auth properties
414
- isAuthenticated: I.status === "authenticated",
415
- canLogin: n && !_,
435
+ isAuthenticated: M.status === "authenticated",
436
+ canLogin: n && !R,
416
437
  // Computed connection properties
417
438
  isReady: n,
418
- isServerReady: c,
419
- isOverallReady: n && c,
420
- isInitializing: m.status === "initializing",
421
- isExtension: m.mode === "extension",
422
- isDirect: m.mode === "direct"
439
+ isServerReady: s,
440
+ isOverallReady: n && s,
441
+ isInitializing: C.status === "initializing",
442
+ isExtension: C.mode === "extension",
443
+ isDirect: C.mode === "direct"
423
444
  };
424
- }, [a, m, I, _, C, u, d, R, t]);
425
- return /* @__PURE__ */ V(U.Provider, { value: T, children: [
426
- /* @__PURE__ */ P(
427
- ie,
445
+ }, [a, C, M, R, p, F, B, c, u]);
446
+ return /* @__PURE__ */ $(j.Provider, { value: H, children: [
447
+ /* @__PURE__ */ W(
448
+ ge,
428
449
  {
429
450
  client: a,
430
- modalHtmlPath: x,
431
- hideSetup: t,
432
- onSetupReady: r,
433
- setupState: C,
451
+ modalHtmlPath: y,
452
+ hideSetup: u,
453
+ onSetupReady: g,
454
+ setupState: p,
434
455
  basePath: h,
435
- logLevel: g
456
+ logLevel: m
436
457
  }
437
458
  ),
438
459
  e
439
460
  ] });
440
461
  }
441
- function be() {
442
- const e = ce(U);
462
+ function Oe() {
463
+ const e = he(j);
443
464
  if (!e) throw new Error("useBodhi must be used within BodhiProvider");
444
465
  return e;
445
466
  }
446
- const he = (e) => /* @__PURE__ */ i.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 479.995 479.995", width: "480px", height: "480px", ...e }, /* @__PURE__ */ i.createElement("path", { fill: "#ffa4b8", d: "M239.998,374.56l-0.01-0.01c0-0.01,0.01-0.01,0.01-0.02c-4.64-8.78-65.7-144.8-212.22-85.2 c-14.36,5.85-19.78,23.45-11.19,36.36c11.11,16.69,22.86,30.01,34.91,40.53c-27.85,7.89-45.6,33.8-43.3,61.55 c0.96,11.6,13.29,18.52,23.71,13.35c33.99-16.84,60.03-2.51,80.35,2.14c56.68,12.99,113.71,4.53,125.52-46.29 c0.52-2.22,0.95-4.51,1.28-6.89c0.01-0.04,0.01-0.08,0.02-0.12c0.066-0.492,0.126-0.978,0.181-1.458 c0.455-3.631,0.712-7.438,0.739-11.452c-0.02-1.44-0.02-2.01,0-2.25v-0.09c0-0.02,0-0.04,0.01-0.05c0-0.02,0.01-0.03,0.02-0.06 c0-0.01,0.01-0.01,0.01-0.02C240.018,374.569,240.008,374.56,239.998,374.56z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffa4b8", d: "M471.798,427.769c-0.96,11.6-13.29,18.52-23.71,13.35c-33.99-16.84-60.03-2.51-80.35,2.14 c-63.41,14.53-127.25,2.22-127.74-66.21c0.033-2.642-0.044-2.302,0.04-2.47c-0.02-0.01-0.03-0.02-0.04-0.02l0.01-0.01 c0-0.01-0.01-0.01-0.01-0.02c4.64-8.78,65.7-144.8,212.22-85.2c14.36,5.85,19.78,23.45,11.19,36.36 c-11.11,16.69-22.86,30.01-34.91,40.53C456.348,374.109,474.098,400.019,471.798,427.769z" }), /* @__PURE__ */ i.createElement("path", { fill: "#befa91", d: "M428.498,366.219c27.85,7.89,45.6,33.8,43.3,61.55c-0.96,11.6-13.29,18.52-23.71,13.35 c-33.99-16.84-60.03-2.51-80.35,2.14c-63.41,14.53-127.928,2.222-127.74-66.21c0.007-2.683-0.02-2.351,0.04-2.47 C248.598,379.129,345.858,438.329,428.498,366.219z" }), /* @__PURE__ */ i.createElement("path", { fill: "#befa91", d: "M51.498,366.219c82.76,72.22,180.18,12.74,188.5,8.34c0.01,0,0.02,0.01,0.04,0.02 c-0.058,0.116-0.047-0.169-0.04,2.47c0.188,68.432-64.33,80.74-127.74,66.21c-20.32-4.65-46.36-18.98-80.35-2.14 c-10.42,5.17-22.75-1.75-23.71-13.35C5.898,400.019,23.648,374.109,51.498,366.219z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffbfcb", d: "M235.228,365.299c-32.29-36.09-89.98-73-179.74-36.49c-1.979,0.805-3.787,1.834-5.413,3.042 c-10.569,7.856-25.473,5.765-32.82-5.164c-0.223-0.331-0.445-0.664-0.667-0.997c-8.59-12.91-3.17-30.51,11.19-36.36 C155.168,237.509,217.948,333.56,235.228,365.299z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffa4b8", d: "M239.998,374.549c-12.85-2.2-214.54-23.33-193.03-240.71c1.49-14.99,15.86-25.15,30.48-21.55 c108.49,26.72,149.07,91.39,162.55,149.92C252.768,317.699,241.178,367.679,239.998,374.549z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffbfcb", d: "M193.698,174.638c11.866,12.406-3.013,31.792-18.056,23.52 c-21.875-12.028-50.044-10.573-70.207,3.701c-24.832,17.579-59.398-0.365-60.013-30.784c-0.237-11.724,0.248-24.123,1.545-37.237 c1.49-14.99,15.86-25.15,30.48-21.55C131.23,125.537,168.324,148.11,193.698,174.638z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffa4b8", d: "M221.538,39.599c9.78-11.13,27.15-11.12,36.93,0.01c157.02,178.77-7.48,323.95-18.47,334.94 C229.988,364.549,63.948,218.989,221.538,39.599z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffbfcb", d: "M261.523,43.131c9.452,11.033,8.166,27.623-2.74,37.221c-0.784,0.69-1.535,1.439-2.245,2.247 c-35.942,40.915-55.05,80.07-63.012,116.258c-5.176,23.523-39.936,19.717-39.551-4.366c0.741-46.282,18.411-98.941,67.563-154.892 c9.78-11.13,27.15-11.12,36.93,0.01C259.5,40.785,260.518,41.959,261.523,43.131z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffa4b8", d: "M239.998,374.549c-1.18-6.87-12.77-56.85,0-112.34c13.48-58.53,54.06-123.2,162.55-149.92 c14.62-3.6,28.99,6.56,30.48,21.55C454.538,351.219,252.848,372.349,239.998,374.549z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ff8ca5", d: "M239.998,374.549c-3.115-0.536-17.362-2.183-36.835-7.483c-3.181-0.866-6.028-2.682-8.145-5.209 c-49.098-58.608-75.675-130.75-61.047-205.793c2.165-11.107,14.881-16.444,24.408-10.337c0.756,0.485,1.506,0.972,2.249,1.462 C126.798,274.139,232.088,366.649,239.998,374.549z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ff8ca5", d: "M281.608,365.729c-21.9,6.37-38.24,8.25-41.61,8.82c8.67-8.67,112.98-100.94,79.35-227.34v-0.01 c0.742-0.489,1.49-0.975,2.244-1.459c9.551-6.123,22.265-0.733,24.422,10.406C369.565,277.734,281.608,363.204,281.608,365.729z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ff8ca5", d: "M417.451,302.932c-32.211,44.193-80.706,72.823-134.571,87.345c-3.396,0.916-6.999,0.754-10.3-0.463 c-20.772-7.664-31.911-15.254-32.583-15.254c0.826-0.825,112.667-9.463,166.4-98.31C419.37,278.279,424.743,292.927,417.451,302.932 z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ff8ca5", d: "M62.565,302.932c32.211,44.193,80.705,72.823,134.571,87.345c3.396,0.916,6.999,0.754,10.3-0.463 c20.772-7.664,31.911-15.254,32.583-15.254c-0.828-0.828-112.665-9.458-166.4-98.31C60.646,278.279,55.273,292.927,62.565,302.932z" }), /* @__PURE__ */ i.createElement("path", { fill: "#9ceb63", d: "M433.464,393.091c-52.749,39.415-118.979,42.09-182.861,13.657 c-4.441-1.977-7.606-6.011-8.633-10.763c-1.552-7.18-1.884-14.238-1.973-21.326c0.172-0.345,9.566,5.934,26.76,12.89 c36.31,14.71,102.75,30.15,161.74-21.33C440.977,369.752,443.403,385.664,433.464,393.091z" }), /* @__PURE__ */ i.createElement("path", { fill: "#9ceb63", d: "M240.038,374.579c0,0.01-0.01,0.01-0.01,0.02s-0.01,0.03-0.01,0.05c0,0,0,0,0,0.01 c-0.01,0.03-0.01,0.06-0.02,0.1v0.04c-0.13,1.3,0.09,7.59-0.92,15.16c-0.01,0.04-0.01,0.08-0.02,0.12 c-0.26,1.91-0.59,3.91-1.03,5.92c-0.07,0.33-0.15,0.65-0.25,0.97c-1.23,4.33-4.28,7.95-8.41,9.79 c-63.06,28.05-129.47,26.21-182.79-13.63c-9.94-7.43-7.63-23.36,4.92-26.91c13.1,11.46,28.11,20.79,44.16,26.79 c19.78,7.48,34.99,8.98,53.83,8.68c34.33-0.55,60.1-11.03,90.51-27.13C240.008,374.56,240.018,374.569,240.038,374.579z" }), /* @__PURE__ */ i.createElement("path", { d: "M443.143,363.426c9.579-9.648,18.604-20.804,26.926-33.305c11.399-17.132,4.201-40.447-14.837-48.202 c-12.321-5.012-24.515-8.844-36.391-11.454c17.945-34.197,27.974-78.94,22.188-137.413c-1.925-19.503-20.802-33.354-40.394-28.53 c-17.952,4.421-34.806,10.063-50.093,16.768c-4.046,1.775-5.888,6.494-4.113,10.54c1.774,4.046,6.493,5.887,10.54,4.113 c14.45-6.338,30.429-11.682,47.492-15.885c9.885-2.435,19.599,4.434,20.607,14.573c9.088,90.121-21.147,164.341-99.823,205.213 c-3.921,2.037-5.448,6.866-3.411,10.787c2.043,3.933,6.879,5.442,10.787,3.411c27.191-14.125,56.267-35.849,77.701-68.994 c12.564,2.375,25.617,6.296,38.878,11.69c9.68,3.943,13.334,15.824,7.549,24.518c-10.205,15.33-21.482,28.43-33.516,38.936 c-49.396,43.107-111.979,41.39-169.834,12.419c56.638-56.971,92.247-132.34,77.074-212.524 c-8.101-42.81-30.305-85.119-65.997-125.754c-12.964-14.759-36.003-14.748-48.946-0.016 c-28.645,32.607-48.657,66.371-59.602,100.512c-21.999-13.018-47.7-23.197-76.569-30.307c-19.338-4.763-38.383,8.699-40.354,28.53 C26.197,262.501,90.89,324.677,147.416,354.042c3.92,2.036,8.75,0.51,10.787-3.411c2.037-3.921,0.51-8.75-3.411-10.787 c-52.141-27.086-111.791-84.677-99.863-205.213c1.007-10.132,10.713-17.01,20.606-14.574c31.115,7.663,58.223,19.013,80.571,33.735 c4.863,3.204,10.891,0.586,12.257-4.539c9.392-35.245,29.306-70.362,59.188-104.378c6.581-7.492,18.316-7.487,24.904,0.014 c128.735,146.565,37.449,269.122-12.476,318.519c-30.274-29.828-76.759-87.727-78.002-162.831 c-0.073-4.417-3.698-7.933-8.131-7.867c-4.417,0.073-7.939,3.714-7.867,8.131c1.382,83.483,54.096,146.516,85.999,177.099 c-0.353,20.737-7.099,36.575-20.104,47.086c-20.129,16.267-55.786,20.072-97.831,10.438c-19.181-4.396-48.632-19.874-85.688-1.511 c-5.361,2.657-11.689-0.859-12.186-6.844c-1.888-22.74,12.042-43.926,33.548-51.893c13.4,11.096,27.797,19.551,43.11,25.275 c20.238,7.653,36.036,9.525,56.788,9.196c15.85-0.254,30.814-2.572,45.747-7.085c4.229-1.278,6.622-5.743,5.343-9.972 c-1.278-4.229-5.744-6.622-9.972-5.344c-13.494,4.078-27.027,6.173-41.373,6.403c-17.347,0.275-31.911-0.993-50.901-8.174 c-31.69-11.847-56.387-35.98-75.211-64.258c-5.791-8.704-2.122-20.58,7.548-24.52c4.092-1.667,6.058-6.335,4.391-10.427 c-1.667-4.092-6.334-6.058-10.427-4.391c-19.062,7.765-26.214,31.095-14.832,48.202c8.365,12.566,17.352,23.674,26.917,33.31 C12.89,375.664-2.037,401.187,0.226,428.434c1.427,17.192,19.743,27.533,35.235,19.857c30.84-15.283,54.311-1.971,75.01,2.771 c36.708,8.411,82.166,10.086,111.461-13.59c14.777-11.943,23.305-28.715,25.489-49.937 c61.607,30.736,128.694,32.482,182.835-12.326c21.516,7.959,35.456,29.153,33.567,51.902c-0.493,5.939-6.786,9.519-12.186,6.844 c-30.339-15.034-55.535-7.379-73.932-1.791c-31.306,9.51-74.736,14.144-102.884-2.498c-3.803-2.248-8.709-0.989-10.958,2.815 c-2.249,3.803-0.989,8.709,2.815,10.958c29.214,17.272,69.817,15.19,102.844,7.622c20.72-4.747,44.177-18.05,75.01-2.771 c15.523,7.691,33.811-2.693,35.235-19.856C482.032,401.183,467.102,375.655,443.143,363.426z" })), Se = {
467
+ const be = (e) => /* @__PURE__ */ i.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 479.995 479.995", width: "480px", height: "480px", ...e }, /* @__PURE__ */ i.createElement("path", { fill: "#ffa4b8", d: "M239.998,374.56l-0.01-0.01c0-0.01,0.01-0.01,0.01-0.02c-4.64-8.78-65.7-144.8-212.22-85.2 c-14.36,5.85-19.78,23.45-11.19,36.36c11.11,16.69,22.86,30.01,34.91,40.53c-27.85,7.89-45.6,33.8-43.3,61.55 c0.96,11.6,13.29,18.52,23.71,13.35c33.99-16.84,60.03-2.51,80.35,2.14c56.68,12.99,113.71,4.53,125.52-46.29 c0.52-2.22,0.95-4.51,1.28-6.89c0.01-0.04,0.01-0.08,0.02-0.12c0.066-0.492,0.126-0.978,0.181-1.458 c0.455-3.631,0.712-7.438,0.739-11.452c-0.02-1.44-0.02-2.01,0-2.25v-0.09c0-0.02,0-0.04,0.01-0.05c0-0.02,0.01-0.03,0.02-0.06 c0-0.01,0.01-0.01,0.01-0.02C240.018,374.569,240.008,374.56,239.998,374.56z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffa4b8", d: "M471.798,427.769c-0.96,11.6-13.29,18.52-23.71,13.35c-33.99-16.84-60.03-2.51-80.35,2.14 c-63.41,14.53-127.25,2.22-127.74-66.21c0.033-2.642-0.044-2.302,0.04-2.47c-0.02-0.01-0.03-0.02-0.04-0.02l0.01-0.01 c0-0.01-0.01-0.01-0.01-0.02c4.64-8.78,65.7-144.8,212.22-85.2c14.36,5.85,19.78,23.45,11.19,36.36 c-11.11,16.69-22.86,30.01-34.91,40.53C456.348,374.109,474.098,400.019,471.798,427.769z" }), /* @__PURE__ */ i.createElement("path", { fill: "#befa91", d: "M428.498,366.219c27.85,7.89,45.6,33.8,43.3,61.55c-0.96,11.6-13.29,18.52-23.71,13.35 c-33.99-16.84-60.03-2.51-80.35,2.14c-63.41,14.53-127.928,2.222-127.74-66.21c0.007-2.683-0.02-2.351,0.04-2.47 C248.598,379.129,345.858,438.329,428.498,366.219z" }), /* @__PURE__ */ i.createElement("path", { fill: "#befa91", d: "M51.498,366.219c82.76,72.22,180.18,12.74,188.5,8.34c0.01,0,0.02,0.01,0.04,0.02 c-0.058,0.116-0.047-0.169-0.04,2.47c0.188,68.432-64.33,80.74-127.74,66.21c-20.32-4.65-46.36-18.98-80.35-2.14 c-10.42,5.17-22.75-1.75-23.71-13.35C5.898,400.019,23.648,374.109,51.498,366.219z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffbfcb", d: "M235.228,365.299c-32.29-36.09-89.98-73-179.74-36.49c-1.979,0.805-3.787,1.834-5.413,3.042 c-10.569,7.856-25.473,5.765-32.82-5.164c-0.223-0.331-0.445-0.664-0.667-0.997c-8.59-12.91-3.17-30.51,11.19-36.36 C155.168,237.509,217.948,333.56,235.228,365.299z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffa4b8", d: "M239.998,374.549c-12.85-2.2-214.54-23.33-193.03-240.71c1.49-14.99,15.86-25.15,30.48-21.55 c108.49,26.72,149.07,91.39,162.55,149.92C252.768,317.699,241.178,367.679,239.998,374.549z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffbfcb", d: "M193.698,174.638c11.866,12.406-3.013,31.792-18.056,23.52 c-21.875-12.028-50.044-10.573-70.207,3.701c-24.832,17.579-59.398-0.365-60.013-30.784c-0.237-11.724,0.248-24.123,1.545-37.237 c1.49-14.99,15.86-25.15,30.48-21.55C131.23,125.537,168.324,148.11,193.698,174.638z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffa4b8", d: "M221.538,39.599c9.78-11.13,27.15-11.12,36.93,0.01c157.02,178.77-7.48,323.95-18.47,334.94 C229.988,364.549,63.948,218.989,221.538,39.599z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffbfcb", d: "M261.523,43.131c9.452,11.033,8.166,27.623-2.74,37.221c-0.784,0.69-1.535,1.439-2.245,2.247 c-35.942,40.915-55.05,80.07-63.012,116.258c-5.176,23.523-39.936,19.717-39.551-4.366c0.741-46.282,18.411-98.941,67.563-154.892 c9.78-11.13,27.15-11.12,36.93,0.01C259.5,40.785,260.518,41.959,261.523,43.131z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ffa4b8", d: "M239.998,374.549c-1.18-6.87-12.77-56.85,0-112.34c13.48-58.53,54.06-123.2,162.55-149.92 c14.62-3.6,28.99,6.56,30.48,21.55C454.538,351.219,252.848,372.349,239.998,374.549z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ff8ca5", d: "M239.998,374.549c-3.115-0.536-17.362-2.183-36.835-7.483c-3.181-0.866-6.028-2.682-8.145-5.209 c-49.098-58.608-75.675-130.75-61.047-205.793c2.165-11.107,14.881-16.444,24.408-10.337c0.756,0.485,1.506,0.972,2.249,1.462 C126.798,274.139,232.088,366.649,239.998,374.549z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ff8ca5", d: "M281.608,365.729c-21.9,6.37-38.24,8.25-41.61,8.82c8.67-8.67,112.98-100.94,79.35-227.34v-0.01 c0.742-0.489,1.49-0.975,2.244-1.459c9.551-6.123,22.265-0.733,24.422,10.406C369.565,277.734,281.608,363.204,281.608,365.729z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ff8ca5", d: "M417.451,302.932c-32.211,44.193-80.706,72.823-134.571,87.345c-3.396,0.916-6.999,0.754-10.3-0.463 c-20.772-7.664-31.911-15.254-32.583-15.254c0.826-0.825,112.667-9.463,166.4-98.31C419.37,278.279,424.743,292.927,417.451,302.932 z" }), /* @__PURE__ */ i.createElement("path", { fill: "#ff8ca5", d: "M62.565,302.932c32.211,44.193,80.705,72.823,134.571,87.345c3.396,0.916,6.999,0.754,10.3-0.463 c20.772-7.664,31.911-15.254,32.583-15.254c-0.828-0.828-112.665-9.458-166.4-98.31C60.646,278.279,55.273,292.927,62.565,302.932z" }), /* @__PURE__ */ i.createElement("path", { fill: "#9ceb63", d: "M433.464,393.091c-52.749,39.415-118.979,42.09-182.861,13.657 c-4.441-1.977-7.606-6.011-8.633-10.763c-1.552-7.18-1.884-14.238-1.973-21.326c0.172-0.345,9.566,5.934,26.76,12.89 c36.31,14.71,102.75,30.15,161.74-21.33C440.977,369.752,443.403,385.664,433.464,393.091z" }), /* @__PURE__ */ i.createElement("path", { fill: "#9ceb63", d: "M240.038,374.579c0,0.01-0.01,0.01-0.01,0.02s-0.01,0.03-0.01,0.05c0,0,0,0,0,0.01 c-0.01,0.03-0.01,0.06-0.02,0.1v0.04c-0.13,1.3,0.09,7.59-0.92,15.16c-0.01,0.04-0.01,0.08-0.02,0.12 c-0.26,1.91-0.59,3.91-1.03,5.92c-0.07,0.33-0.15,0.65-0.25,0.97c-1.23,4.33-4.28,7.95-8.41,9.79 c-63.06,28.05-129.47,26.21-182.79-13.63c-9.94-7.43-7.63-23.36,4.92-26.91c13.1,11.46,28.11,20.79,44.16,26.79 c19.78,7.48,34.99,8.98,53.83,8.68c34.33-0.55,60.1-11.03,90.51-27.13C240.008,374.56,240.018,374.569,240.038,374.579z" }), /* @__PURE__ */ i.createElement("path", { d: "M443.143,363.426c9.579-9.648,18.604-20.804,26.926-33.305c11.399-17.132,4.201-40.447-14.837-48.202 c-12.321-5.012-24.515-8.844-36.391-11.454c17.945-34.197,27.974-78.94,22.188-137.413c-1.925-19.503-20.802-33.354-40.394-28.53 c-17.952,4.421-34.806,10.063-50.093,16.768c-4.046,1.775-5.888,6.494-4.113,10.54c1.774,4.046,6.493,5.887,10.54,4.113 c14.45-6.338,30.429-11.682,47.492-15.885c9.885-2.435,19.599,4.434,20.607,14.573c9.088,90.121-21.147,164.341-99.823,205.213 c-3.921,2.037-5.448,6.866-3.411,10.787c2.043,3.933,6.879,5.442,10.787,3.411c27.191-14.125,56.267-35.849,77.701-68.994 c12.564,2.375,25.617,6.296,38.878,11.69c9.68,3.943,13.334,15.824,7.549,24.518c-10.205,15.33-21.482,28.43-33.516,38.936 c-49.396,43.107-111.979,41.39-169.834,12.419c56.638-56.971,92.247-132.34,77.074-212.524 c-8.101-42.81-30.305-85.119-65.997-125.754c-12.964-14.759-36.003-14.748-48.946-0.016 c-28.645,32.607-48.657,66.371-59.602,100.512c-21.999-13.018-47.7-23.197-76.569-30.307c-19.338-4.763-38.383,8.699-40.354,28.53 C26.197,262.501,90.89,324.677,147.416,354.042c3.92,2.036,8.75,0.51,10.787-3.411c2.037-3.921,0.51-8.75-3.411-10.787 c-52.141-27.086-111.791-84.677-99.863-205.213c1.007-10.132,10.713-17.01,20.606-14.574c31.115,7.663,58.223,19.013,80.571,33.735 c4.863,3.204,10.891,0.586,12.257-4.539c9.392-35.245,29.306-70.362,59.188-104.378c6.581-7.492,18.316-7.487,24.904,0.014 c128.735,146.565,37.449,269.122-12.476,318.519c-30.274-29.828-76.759-87.727-78.002-162.831 c-0.073-4.417-3.698-7.933-8.131-7.867c-4.417,0.073-7.939,3.714-7.867,8.131c1.382,83.483,54.096,146.516,85.999,177.099 c-0.353,20.737-7.099,36.575-20.104,47.086c-20.129,16.267-55.786,20.072-97.831,10.438c-19.181-4.396-48.632-19.874-85.688-1.511 c-5.361,2.657-11.689-0.859-12.186-6.844c-1.888-22.74,12.042-43.926,33.548-51.893c13.4,11.096,27.797,19.551,43.11,25.275 c20.238,7.653,36.036,9.525,56.788,9.196c15.85-0.254,30.814-2.572,45.747-7.085c4.229-1.278,6.622-5.743,5.343-9.972 c-1.278-4.229-5.744-6.622-9.972-5.344c-13.494,4.078-27.027,6.173-41.373,6.403c-17.347,0.275-31.911-0.993-50.901-8.174 c-31.69-11.847-56.387-35.98-75.211-64.258c-5.791-8.704-2.122-20.58,7.548-24.52c4.092-1.667,6.058-6.335,4.391-10.427 c-1.667-4.092-6.334-6.058-10.427-4.391c-19.062,7.765-26.214,31.095-14.832,48.202c8.365,12.566,17.352,23.674,26.917,33.31 C12.89,375.664-2.037,401.187,0.226,428.434c1.427,17.192,19.743,27.533,35.235,19.857c30.84-15.283,54.311-1.971,75.01,2.771 c36.708,8.411,82.166,10.086,111.461-13.59c14.777-11.943,23.305-28.715,25.489-49.937 c61.607,30.736,128.694,32.482,182.835-12.326c21.516,7.959,35.456,29.153,33.567,51.902c-0.493,5.939-6.786,9.519-12.186,6.844 c-30.339-15.034-55.535-7.379-73.932-1.791c-31.306,9.51-74.736,14.144-102.884-2.498c-3.803-2.248-8.709-0.989-10.958,2.815 c-2.249,3.803-0.989,8.709,2.815,10.958c29.214,17.272,69.817,15.19,102.844,7.622c20.72-4.747,44.177-18.05,75.01-2.771 c15.523,7.691,33.811-2.693,35.235-19.856C482.032,401.183,467.102,375.655,443.143,363.426z" })), xe = {
447
468
  sm: 32,
448
469
  md: 48,
449
470
  lg: 64
450
471
  };
451
- function Me({
472
+ function ke({
452
473
  size: e = "md",
453
474
  variant: a = "light",
454
- className: x = "",
455
- style: b = {}
475
+ className: y = "",
476
+ style: w = {}
456
477
  }) {
457
- const A = Se[e], h = {
478
+ const I = xe[e], h = {
458
479
  display: "inline-block",
459
480
  cursor: "pointer",
460
481
  transition: "all 250ms ease",
@@ -463,9 +484,9 @@ function Me({
463
484
  backgroundColor: "rgba(255, 255, 255, 0.05)",
464
485
  padding: "8px"
465
486
  },
466
- ...b
487
+ ...w
467
488
  };
468
- return /* @__PURE__ */ P(
489
+ return /* @__PURE__ */ W(
469
490
  "a",
470
491
  {
471
492
  href: "https://getbodhi.app",
@@ -473,44 +494,44 @@ function Me({
473
494
  rel: "noopener noreferrer",
474
495
  title: "Powered by Bodhi",
475
496
  "aria-label": "Powered by Bodhi - Visit getbodhi.app",
476
- className: x,
497
+ className: y,
477
498
  style: h,
478
- onMouseEnter: (g) => {
479
- g.currentTarget.style.transform = "scale(1.1)", g.currentTarget.style.boxShadow = "0 0 20px rgba(255, 164, 184, 0.6)";
499
+ onMouseEnter: (m) => {
500
+ m.currentTarget.style.transform = "scale(1.1)", m.currentTarget.style.boxShadow = "0 0 20px rgba(255, 164, 184, 0.6)";
480
501
  },
481
- onMouseLeave: (g) => {
482
- g.currentTarget.style.transform = "scale(1)", g.currentTarget.style.boxShadow = "none";
502
+ onMouseLeave: (m) => {
503
+ m.currentTarget.style.transform = "scale(1)", m.currentTarget.style.boxShadow = "none";
483
504
  },
484
- children: /* @__PURE__ */ P(he, { width: A, height: A, style: { display: "block" } })
505
+ children: /* @__PURE__ */ W(be, { width: I, height: I, style: { display: "block" } })
485
506
  }
486
507
  );
487
508
  }
488
- const Ae = "production";
509
+ const Le = "production";
489
510
  export {
490
- Te as BodhiApiError,
491
- Me as BodhiBadge,
492
- Le as BodhiError,
493
- xe as BodhiProvider,
494
- U as BodhiReactContext,
495
- we as ClientCtxState,
496
- le as INITIALIZING_CLIENT_CONTEXT_STATE,
497
- ue as INITIAL_CLIENT_CONTEXT_STATE,
498
- Ae as REACT_CORE_BUILD_MODE,
499
- me as clientStateToContextState,
500
- Oe as createApiError,
501
- Re as createOperationError,
502
- ze as isAuthError,
503
- ke as isAuthLoading,
504
- De as isAuthenticated,
505
- pe as isClientCtxInitialized,
506
- fe as isClientCtxInitializing,
507
- de as isClientCtxNotInitialized,
508
- q as isClientCtxReady,
509
- Ne as isClientReady,
510
- Be as isDirectState,
511
- Pe as isExtensionState,
512
- ge as isOverallReady,
513
- Ue as isWebUIClient,
514
- Fe as unwrapResponse,
515
- be as useBodhi
511
+ Ne as BodhiApiError,
512
+ ke as BodhiBadge,
513
+ Be as BodhiError,
514
+ Re as BodhiProvider,
515
+ j as BodhiReactContext,
516
+ Te as ClientCtxState,
517
+ Se as INITIALIZING_CLIENT_CONTEXT_STATE,
518
+ me as INITIAL_CLIENT_CONTEXT_STATE,
519
+ Le as REACT_CORE_BUILD_MODE,
520
+ we as clientStateToContextState,
521
+ Pe as createApiError,
522
+ Ue as createOperationError,
523
+ qe as isAuthError,
524
+ Fe as isAuthLoading,
525
+ He as isAuthenticated,
526
+ Ee as isClientCtxInitialized,
527
+ ve as isClientCtxInitializing,
528
+ Ce as isClientCtxNotInitialized,
529
+ Y as isClientCtxReady,
530
+ Ve as isClientReady,
531
+ We as isDirectState,
532
+ je as isExtensionState,
533
+ ye as isOverallReady,
534
+ Ge as isWebUIClient,
535
+ Ke as unwrapResponse,
536
+ Oe as useBodhi
516
537
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bodhiapp/bodhi-js-react-core",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "description": "Core React bindings for Bodhi Browser SDK (dependency injection)",
5
5
  "type": "module",
6
6
  "main": "dist/bodhi-react-core.cjs.js",
@@ -42,10 +42,10 @@
42
42
  "typecheck": "tsc --noEmit"
43
43
  },
44
44
  "dependencies": {
45
- "@bodhiapp/bodhi-browser-types": "0.0.28",
46
- "@bodhiapp/setup-modal-types": "0.0.28",
47
- "@bodhiapp/bodhi-js-core": "0.0.28",
48
- "@bodhiapp/ts-client": "0.1.23"
45
+ "@bodhiapp/bodhi-browser-types": "0.0.30",
46
+ "@bodhiapp/setup-modal-types": "0.0.30",
47
+ "@bodhiapp/bodhi-js-core": "0.0.30",
48
+ "@bodhiapp/ts-client": "0.1.24"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": "^18.3.0 || ^19.0.0"