local-operator-ui 0.38.0 → 0.38.1

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.
Files changed (21) hide show
  1. package/out/renderer/assets/{agent-details-page-ydYZH4Kq.js → agent-details-page-A51rffCS.js} +2 -2
  2. package/out/renderer/assets/{agent-hub-page-C46GCUT2.js → agent-hub-page-DQ-tnD26.js} +1 -1
  3. package/out/renderer/assets/{agents-page-BaARss9y.js → agents-page-Bh6SGDaA.js} +3 -3
  4. package/out/renderer/assets/{browser-page-BVFs2_w9.js → browser-page-Daga5nCP.js} +1 -1
  5. package/out/renderer/assets/{browser-webauthn-prompt-Ch0P_oH9.js → browser-webauthn-prompt-CdHXLdwX.js} +1 -1
  6. package/out/renderer/assets/{index-jVCAPb0a.js → index-BZYkm39z.js} +158 -158
  7. package/out/renderer/assets/{legacy-agents-page-BovdqsXe.js → legacy-agents-page-ccL-99ea.js} +3 -3
  8. package/out/renderer/assets/{library-page-Cm-o3Z-q.js → library-page-C8ymyVUW.js} +3 -3
  9. package/out/renderer/assets/{mesh-page-ChyvMUoR.js → mesh-page-Dn77Ie1F.js} +1 -1
  10. package/out/renderer/assets/{org-access-CU1oOVqv.js → org-access-CfGyU5hi.js} +1 -1
  11. package/out/renderer/assets/{projects-page-BSvdM2gY.js → projects-page-xuLYnWBj.js} +4 -4
  12. package/out/renderer/assets/{publication-validation-g2Kk53C8.js → publication-validation-CCv7pQJH.js} +1 -1
  13. package/out/renderer/assets/{radient-auth-buttons-DP81yj6b.js → radient-auth-buttons-Huoo_kFK.js} +1 -1
  14. package/out/renderer/assets/{schedules-page-CNIApkVt.js → schedules-page-vsfnEcLJ.js} +1 -1
  15. package/out/renderer/assets/{settings-page-Cd8GUEn_.js → settings-page-CnBnFo-w.js} +1 -1
  16. package/out/renderer/assets/{smartart-DAuiyto3.js → smartart-D5HiGUV-.js} +1 -1
  17. package/out/renderer/assets/team-bridge-page-JRqkQ8jV.js +11 -0
  18. package/out/renderer/assets/{use-download-agent-mutation-B-kxWpF6.js → use-download-agent-mutation-BZhcL_Dx.js} +2 -2
  19. package/out/renderer/index.html +1 -1
  20. package/package.json +1 -1
  21. package/out/renderer/assets/team-bridge-page-CosfhCZV.js +0 -11
@@ -1 +1 @@
1
- import{V as y,W as w,X as f,Y as T,Z as v,_ as $,$ as A}from"./conversation-input-sync-bgD4kyw3.js";import{p as d,P as R,a as L,b as I,c as N,d as P}from"./ui-preferences-store-C91RrpgH.js";import{l as S,a as E}from"./index-jVCAPb0a.js";const p={malware_or_exploitation:"Instructions to build or spread malware, or to attack systems you do not own, cannot be published.",credential_theft:"Instructions to obtain someone else's credentials or tokens cannot be published.",fraud_or_deception:"Instructions to deceive or defraud people cannot be published.",harassment_or_hate:"Instructions to harass, threaten or target people cannot be published.",sexual_content_minors:"This agent cannot be published. If you believe this is a mistake, contact support.",sexual_content:"Explicit sexual content cannot be published.",violence_or_weapons:"Instructions to build weapons or to injure people cannot be published.",drugs_or_controlled_substances:"Instructions to make or traffic illegal drugs cannot be published.",self_harm:"This agent cannot be published. If you believe this is a mistake, contact support.",mass_surveillance_or_privacy_abuse:"Instructions to surveil or profile people without their consent cannot be published.",evasion_or_abuse_tooling:"Instructions to evade or defeat safety and anti-abuse systems cannot be published.",prompt_injection:"This instruction set tries to instruct the reviewer rather than describe an agent, so it cannot be published.",unclear_dual_use:"We could not tell whether this is aimed at your own systems or someone else's. Add a sentence stating the scope and target, then publish again.",other_harmful:"This agent was rejected because its instructions would cause harm."},O=e=>{const n=e.trim();return n.length>12&&/\s/.test(n)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(n)};function z(e){const n=e?.categories?.[0];return n&&v(n)?p[n]:p.other_harmful}function k(e,n){const t=n?.rule?` ${n.rule}`:"";switch(n?.field){case"name":return{body:`Name${t||" is not acceptable"}.`,field:"name"};case"instructions":return{body:t?`The instruction body${t}.`:`The instruction body must be between 1 and ${R} characters.`,field:"instructions"};case"description":return{body:`Description${t}.`,field:"description"};case"tools":return{body:`Tools${t}.`,field:"tools"};case"when_to_use":return{body:`When to use${t}.`,field:"when_to_use"};case"categories":return{body:`Categories${t}.`,field:"categories"};case"tags":return{body:`Tags${t}.`,field:"tags"};default:return{body:e,field:null}}}function H(e,n){const t=n.surface==="pull",a=t?"Nothing was pulled.":"Nothing was published.",o=t?"pull again":"publish again",s=n.name.trim()||(t?"this team":"this agent");switch(e.code){case"name_taken":return e.details?.owned_by_caller===!0?{variant:"danger",headline:"You already published this agent",body:`You published "${s}" already. Update that listing instead of publishing a second one.`,note:null,actions:e.details?.existing_agent_id||n.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:"That name is taken",body:`"${s}" is already published on the hub by another account. Agent names are unique across the hub.`,note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:"That name is being published right now",body:`Someone is publishing an agent called "${s}" at this moment. It is not claimed — try again in a moment.`,note:null,actions:["retry"]};case"name_reserved_builtin":{const i=e.details?.builtin_name,u=i?d(i)===d(s):!1;return{variant:"danger",headline:"That name is reserved",body:i&&!u?`"${s}" is reserved by the built-in agent "${i}". Built-in names cannot be published to the hub.`:`"${i??s}" is the name of a built-in agent. Built-in names cannot be published to the hub.`,note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:"This agent was not accepted",body:e.details?.reason?.trim()||e.message,note:z(e.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:"Review is temporarily unavailable",body:"We could not review this agent just now. Nothing was published. Try again in a minute.",note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:i,field:u}=k(e.message,e.details);return{variant:"danger",headline:"The agent document is not valid",body:i,note:null,actions:u==="name"?["focus-name"]:u==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const i=e.details?.limit_bytes;return{variant:"danger",headline:"This agent is too large to publish",body:i?`The instruction set is larger than ${Math.round(i/1024)} KiB. Shorten the instructions.`:"The instruction set is larger than the hub accepts. Shorten the instructions.",note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:"You cannot update this listing",body:"This listing belongs to another account.",note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:"That listing no longer exists",body:"It may have been delisted.",note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:"The hub refused this machine's sign-in",body:`${a} Sign in to Radient again to replace the credential the hub refused, then ${o}.`,note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:t?"The pull did not go through":"The publication did not go through",body:O(e.message)?e.message:`${a} Try again in a moment, or update the backend if the hub has moved.`,note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:t?"The team could not be pulled from this machine":"The agent could not be published from this machine",body:e.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:"That organization needs an active Team plan",body:t?"Reading an organization's teams is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then pull again.":"Sharing agents inside an organization is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then publish again.",note:null,actions:["retry"]};case"not_a_member":return{variant:"danger",headline:"You are not a member of that organization",body:`${a} Ask an owner of the organization to invite you, then ${o}.`,note:null,actions:[]};case"insufficient_role":{const i=e.details?.required;return{variant:"danger",headline:"Your organization role does not allow this",body:i?`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} the ${i} role. Ask an owner of the organization to change your role, then ${o}.`:`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} a higher role than yours. Ask an owner of the organization to change your role, then ${o}.`,note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:"That team is no longer published",body:"It may have been delisted since this page was loaded.",note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:"The agent could not be published",body:e.message,note:null,actions:["retry"]}}}const C=[/^(?:Download agent from Radient failed: )?(?:Error downloading agent from Radient: )?\s*/,/^Failed to download agent(?: [^\s]+)? from Radient Agent Hub(?: due to a requests error)?:\s*/,/^[A-Za-z_][\w.]*\([^)]*\):\s*/],U=/^(\d{3})\b/,B=new Set([404,410]),q=["read timed out","connection timed out","connection refused","connection aborted","connection reset","connectionerror","connecttimeout","remote end closed connection","max retries exceeded","temporary failure in name resolution","name or service not known","no route to host"],x=e=>{const n=e.toLowerCase();return q.some(t=>n.includes(t))||T(e)},D=(e,n)=>{const t=n.trim()?`"${n.trim()}"`:"That agent";if(w(e))switch(e.code){case"agent_not_found":return`${t} is no longer on the hub, so nothing was downloaded.`;case"hub_unavailable":return`The hub did not complete the download, so ${t} was not downloaded.`;default:return`${t} was not downloaded: ${e.message}`}const a=C.reduce((s,i)=>s.replace(i,""),f(e,"").trim()).trim();if(!a)return`${t} could not be downloaded.`;const o=Number(U.exec(a)?.[1]??Number.NaN);return B.has(o)?`${t} is no longer on the hub, so nothing was downloaded.`:x(a)||o===408?`The hub could not be reached, so ${t} was not downloaded.`:o===429?`The hub is busy, so ${t} was not downloaded. Try again in a moment.`:o===401||o===403?`The hub refused this machine's sign-in, so ${t} was not downloaded.`:o>=500?`The hub could not complete the download, so ${t} was not downloaded. Try again in a moment.`:o>=400?`The hub refused the download, so ${t} is not here.`:`${t} was not downloaded: ${a}`},F="The action did not complete.",G=(e,n,t)=>e==="download"?D(n,t):y(F,n),X={"focus-name":"Choose another name","update-listing":"Update the existing listing","install-builtin":"Install the built-in instead",retry:"Try again","edit-instructions":"Edit the instructions","edit-agent":"Edit the agent","publish-as-new":"Publish as a new listing","sign-in":"Sign in again","refresh-hub":"Refresh the hub"},j="download_count",g={all:["public-agents"],list:e=>[...g.all,"list",{page:e.page,perPage:e.perPage,categories:e.categories?.join(",")??void 0,name:e.name??void 0,description:e.description??void 0,sort:e.sort,order:e.order}]},h={all:["org-agents"],list:(e,n)=>[...h.all,"list",e,{page:n.page,perPage:n.perPage,categories:n.categories?.join(",")??void 0,name:n.name??void 0,description:n.description??void 0,sort:n.sort,order:n.order}]},K=e=>e&&e[0]===h.all[0]?String(e[2]??""):null,Z=e=>e.invalidateQueries({queryKey:g.all}),V=(e,n)=>e.invalidateQueries({queryKey:n?[...h.all,"list",n]:h.all}),J=({page:e=1,perPage:n=20,enabled:t=!0,categories:a,name:o,description:s,sort:i=j,order:u="desc",tenantId:c}={})=>{const b={page:e,perPage:n,categories:a,name:o,description:s,sort:i,order:u},_=c?h.list(c,b):g.list(b),l=$({queryKey:_,queryFn:async()=>{const r={};return a&&a.length>0&&(r.categories=a.join(",")),o&&(r.name=o),s&&(r.description=s),r.sort=i,r.order=u,c?await S(c,e,n,r):await E(e,n,r)},select:r=>r.result,enabled:t,retry:A,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(r,m)=>K(m?.queryKey)===(c??null)?r:void 0});return{...l,agents:l.data?.records,isRefreshing:l.isFetching&&l.data!==void 0,pagination:l.data?{page:l.data.page,perPage:l.data.per_page,totalPages:l.data.total_pages,totalRecords:l.data.total_records}:void 0}},M={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function ee(e){const n=[],t=(a,o)=>{o&&n.push({field:a,message:`${M[a]} ${o}.`})};return t("name",L(e.name)),t("description",I(e.description)),e.instructions!==null&&t("instructions",N(e.instructions)),t("tools",P(e.tools??[])),n}function ne(e,n){const t=d(e);return n.some(a=>d(a)===t)}function te(e){for(const n of e??[]){const t=n.indexOf(":");if(t<0||n.slice(0,t).trim().toLowerCase()!=="tools")continue;const a=n.slice(t+1).split(",").map(o=>o.trim()).filter(Boolean);return a.length>0?a:null}return null}function ae(e,n){const t=d(e);return n.find(a=>d(a)===t)??null}export{X as P,G as a,g as b,V as c,ne as d,ee as e,Z as i,ae as l,H as p,te as t,J as u};
1
+ import{V as y,W as w,X as f,Y as T,Z as v,_ as $,$ as A}from"./conversation-input-sync-bgD4kyw3.js";import{p as d,P as R,a as L,b as I,c as N,d as P}from"./ui-preferences-store-C91RrpgH.js";import{l as S,a as E}from"./index-BZYkm39z.js";const p={malware_or_exploitation:"Instructions to build or spread malware, or to attack systems you do not own, cannot be published.",credential_theft:"Instructions to obtain someone else's credentials or tokens cannot be published.",fraud_or_deception:"Instructions to deceive or defraud people cannot be published.",harassment_or_hate:"Instructions to harass, threaten or target people cannot be published.",sexual_content_minors:"This agent cannot be published. If you believe this is a mistake, contact support.",sexual_content:"Explicit sexual content cannot be published.",violence_or_weapons:"Instructions to build weapons or to injure people cannot be published.",drugs_or_controlled_substances:"Instructions to make or traffic illegal drugs cannot be published.",self_harm:"This agent cannot be published. If you believe this is a mistake, contact support.",mass_surveillance_or_privacy_abuse:"Instructions to surveil or profile people without their consent cannot be published.",evasion_or_abuse_tooling:"Instructions to evade or defeat safety and anti-abuse systems cannot be published.",prompt_injection:"This instruction set tries to instruct the reviewer rather than describe an agent, so it cannot be published.",unclear_dual_use:"We could not tell whether this is aimed at your own systems or someone else's. Add a sentence stating the scope and target, then publish again.",other_harmful:"This agent was rejected because its instructions would cause harm."},O=e=>{const n=e.trim();return n.length>12&&/\s/.test(n)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(n)};function z(e){const n=e?.categories?.[0];return n&&v(n)?p[n]:p.other_harmful}function k(e,n){const t=n?.rule?` ${n.rule}`:"";switch(n?.field){case"name":return{body:`Name${t||" is not acceptable"}.`,field:"name"};case"instructions":return{body:t?`The instruction body${t}.`:`The instruction body must be between 1 and ${R} characters.`,field:"instructions"};case"description":return{body:`Description${t}.`,field:"description"};case"tools":return{body:`Tools${t}.`,field:"tools"};case"when_to_use":return{body:`When to use${t}.`,field:"when_to_use"};case"categories":return{body:`Categories${t}.`,field:"categories"};case"tags":return{body:`Tags${t}.`,field:"tags"};default:return{body:e,field:null}}}function H(e,n){const t=n.surface==="pull",a=t?"Nothing was pulled.":"Nothing was published.",o=t?"pull again":"publish again",s=n.name.trim()||(t?"this team":"this agent");switch(e.code){case"name_taken":return e.details?.owned_by_caller===!0?{variant:"danger",headline:"You already published this agent",body:`You published "${s}" already. Update that listing instead of publishing a second one.`,note:null,actions:e.details?.existing_agent_id||n.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:"That name is taken",body:`"${s}" is already published on the hub by another account. Agent names are unique across the hub.`,note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:"That name is being published right now",body:`Someone is publishing an agent called "${s}" at this moment. It is not claimed — try again in a moment.`,note:null,actions:["retry"]};case"name_reserved_builtin":{const i=e.details?.builtin_name,u=i?d(i)===d(s):!1;return{variant:"danger",headline:"That name is reserved",body:i&&!u?`"${s}" is reserved by the built-in agent "${i}". Built-in names cannot be published to the hub.`:`"${i??s}" is the name of a built-in agent. Built-in names cannot be published to the hub.`,note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:"This agent was not accepted",body:e.details?.reason?.trim()||e.message,note:z(e.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:"Review is temporarily unavailable",body:"We could not review this agent just now. Nothing was published. Try again in a minute.",note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:i,field:u}=k(e.message,e.details);return{variant:"danger",headline:"The agent document is not valid",body:i,note:null,actions:u==="name"?["focus-name"]:u==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const i=e.details?.limit_bytes;return{variant:"danger",headline:"This agent is too large to publish",body:i?`The instruction set is larger than ${Math.round(i/1024)} KiB. Shorten the instructions.`:"The instruction set is larger than the hub accepts. Shorten the instructions.",note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:"You cannot update this listing",body:"This listing belongs to another account.",note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:"That listing no longer exists",body:"It may have been delisted.",note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:"The hub refused this machine's sign-in",body:`${a} Sign in to Radient again to replace the credential the hub refused, then ${o}.`,note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:t?"The pull did not go through":"The publication did not go through",body:O(e.message)?e.message:`${a} Try again in a moment, or update the backend if the hub has moved.`,note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:t?"The team could not be pulled from this machine":"The agent could not be published from this machine",body:e.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:"That organization needs an active Team plan",body:t?"Reading an organization's teams is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then pull again.":"Sharing agents inside an organization is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then publish again.",note:null,actions:["retry"]};case"not_a_member":return{variant:"danger",headline:"You are not a member of that organization",body:`${a} Ask an owner of the organization to invite you, then ${o}.`,note:null,actions:[]};case"insufficient_role":{const i=e.details?.required;return{variant:"danger",headline:"Your organization role does not allow this",body:i?`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} the ${i} role. Ask an owner of the organization to change your role, then ${o}.`:`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} a higher role than yours. Ask an owner of the organization to change your role, then ${o}.`,note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:"That team is no longer published",body:"It may have been delisted since this page was loaded.",note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:"The agent could not be published",body:e.message,note:null,actions:["retry"]}}}const C=[/^(?:Download agent from Radient failed: )?(?:Error downloading agent from Radient: )?\s*/,/^Failed to download agent(?: [^\s]+)? from Radient Agent Hub(?: due to a requests error)?:\s*/,/^[A-Za-z_][\w.]*\([^)]*\):\s*/],U=/^(\d{3})\b/,B=new Set([404,410]),q=["read timed out","connection timed out","connection refused","connection aborted","connection reset","connectionerror","connecttimeout","remote end closed connection","max retries exceeded","temporary failure in name resolution","name or service not known","no route to host"],x=e=>{const n=e.toLowerCase();return q.some(t=>n.includes(t))||T(e)},D=(e,n)=>{const t=n.trim()?`"${n.trim()}"`:"That agent";if(w(e))switch(e.code){case"agent_not_found":return`${t} is no longer on the hub, so nothing was downloaded.`;case"hub_unavailable":return`The hub did not complete the download, so ${t} was not downloaded.`;default:return`${t} was not downloaded: ${e.message}`}const a=C.reduce((s,i)=>s.replace(i,""),f(e,"").trim()).trim();if(!a)return`${t} could not be downloaded.`;const o=Number(U.exec(a)?.[1]??Number.NaN);return B.has(o)?`${t} is no longer on the hub, so nothing was downloaded.`:x(a)||o===408?`The hub could not be reached, so ${t} was not downloaded.`:o===429?`The hub is busy, so ${t} was not downloaded. Try again in a moment.`:o===401||o===403?`The hub refused this machine's sign-in, so ${t} was not downloaded.`:o>=500?`The hub could not complete the download, so ${t} was not downloaded. Try again in a moment.`:o>=400?`The hub refused the download, so ${t} is not here.`:`${t} was not downloaded: ${a}`},F="The action did not complete.",G=(e,n,t)=>e==="download"?D(n,t):y(F,n),X={"focus-name":"Choose another name","update-listing":"Update the existing listing","install-builtin":"Install the built-in instead",retry:"Try again","edit-instructions":"Edit the instructions","edit-agent":"Edit the agent","publish-as-new":"Publish as a new listing","sign-in":"Sign in again","refresh-hub":"Refresh the hub"},j="download_count",g={all:["public-agents"],list:e=>[...g.all,"list",{page:e.page,perPage:e.perPage,categories:e.categories?.join(",")??void 0,name:e.name??void 0,description:e.description??void 0,sort:e.sort,order:e.order}]},h={all:["org-agents"],list:(e,n)=>[...h.all,"list",e,{page:n.page,perPage:n.perPage,categories:n.categories?.join(",")??void 0,name:n.name??void 0,description:n.description??void 0,sort:n.sort,order:n.order}]},K=e=>e&&e[0]===h.all[0]?String(e[2]??""):null,Z=e=>e.invalidateQueries({queryKey:g.all}),V=(e,n)=>e.invalidateQueries({queryKey:n?[...h.all,"list",n]:h.all}),J=({page:e=1,perPage:n=20,enabled:t=!0,categories:a,name:o,description:s,sort:i=j,order:u="desc",tenantId:c}={})=>{const b={page:e,perPage:n,categories:a,name:o,description:s,sort:i,order:u},_=c?h.list(c,b):g.list(b),l=$({queryKey:_,queryFn:async()=>{const r={};return a&&a.length>0&&(r.categories=a.join(",")),o&&(r.name=o),s&&(r.description=s),r.sort=i,r.order=u,c?await S(c,e,n,r):await E(e,n,r)},select:r=>r.result,enabled:t,retry:A,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(r,m)=>K(m?.queryKey)===(c??null)?r:void 0});return{...l,agents:l.data?.records,isRefreshing:l.isFetching&&l.data!==void 0,pagination:l.data?{page:l.data.page,perPage:l.data.per_page,totalPages:l.data.total_pages,totalRecords:l.data.total_records}:void 0}},M={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function ee(e){const n=[],t=(a,o)=>{o&&n.push({field:a,message:`${M[a]} ${o}.`})};return t("name",L(e.name)),t("description",I(e.description)),e.instructions!==null&&t("instructions",N(e.instructions)),t("tools",P(e.tools??[])),n}function ne(e,n){const t=d(e);return n.some(a=>d(a)===t)}function te(e){for(const n of e??[]){const t=n.indexOf(":");if(t<0||n.slice(0,t).trim().toLowerCase()!=="tools")continue;const a=n.slice(t+1).split(",").map(o=>o.trim()).filter(Boolean);return a.length>0?a:null}return null}function ae(e,n){const t=d(e);return n.find(a=>d(a)===t)??null}export{X as P,G as a,g as b,V as c,ne as d,ee as e,Z as i,ae as l,H as p,te as t,J as u};
@@ -1 +1 @@
1
- import{j as e,t}from"./index-N0lyyVVo.js";import{P as l}from"./index-jVCAPb0a.js";import{u as p,a as x,c as b,e as h,r as v}from"./conversation-input-sync-bgD4kyw3.js";import{u as f,A as c,S as g}from"./error-boundary-DJAF_aYL.js";const j="radient",w=({onSignInSuccess:u,onAfterCredentialUpdate:d,titleText:a=t("ui.common.account.radient_auth_buttons.sign_in_to_radient"),descriptionText:i=t("ui.common.account.radient_auth_buttons.connect_your_radient_account_to_use_radient_services")})=>{f();const _=p(),n=x(),s=b(n.data,"auth"),r=h(s),o=r.data?.find(m=>m.id===j);return n.isSuccess&&!s?e.jsx(c,{variant:"warning",children:t("ui.common.account.radient_auth_buttons.signing_in_needs_a_newer_local_operator_backend_update_the_backen")}):r.isLoading||n.isLoading?e.jsx("div",{className:"flex h-24 items-center justify-center",children:e.jsx(g,{size:"md",label:t("ui.common.account.radient_auth_buttons.loading_sign_in_options")})}):o?e.jsxs("div",{className:"mx-auto w-full max-w-md",children:[a&&e.jsx("p",{className:"mb-2 text-center text-heading text-ink",children:a}),i&&e.jsx("p",{className:"mb-6 text-center text-body-sm text-ink-muted",children:i}),e.jsx(l,{provider:o,onConnected:()=>{_.invalidateQueries({queryKey:v.all}),d?.(),u?.()}})]}):e.jsx(c,{variant:"warning",children:t("ui.common.account.radient_auth_buttons.radient_is_not_available_from_this_backend_s_provider_registry")})};export{w as R};
1
+ import{j as e,t}from"./index-N0lyyVVo.js";import{P as l}from"./index-BZYkm39z.js";import{u as p,a as x,c as b,e as h,r as v}from"./conversation-input-sync-bgD4kyw3.js";import{u as f,A as c,S as g}from"./error-boundary-DJAF_aYL.js";const j="radient",w=({onSignInSuccess:u,onAfterCredentialUpdate:d,titleText:a=t("ui.common.account.radient_auth_buttons.sign_in_to_radient"),descriptionText:i=t("ui.common.account.radient_auth_buttons.connect_your_radient_account_to_use_radient_services")})=>{f();const _=p(),n=x(),s=b(n.data,"auth"),r=h(s),o=r.data?.find(m=>m.id===j);return n.isSuccess&&!s?e.jsx(c,{variant:"warning",children:t("ui.common.account.radient_auth_buttons.signing_in_needs_a_newer_local_operator_backend_update_the_backen")}):r.isLoading||n.isLoading?e.jsx("div",{className:"flex h-24 items-center justify-center",children:e.jsx(g,{size:"md",label:t("ui.common.account.radient_auth_buttons.loading_sign_in_options")})}):o?e.jsxs("div",{className:"mx-auto w-full max-w-md",children:[a&&e.jsx("p",{className:"mb-2 text-center text-heading text-ink",children:a}),i&&e.jsx("p",{className:"mb-6 text-center text-body-sm text-ink-muted",children:i}),e.jsx(l,{provider:o,onConnected:()=>{_.invalidateQueries({queryKey:v.all}),d?.(),u?.()}})]}):e.jsx(c,{variant:"warning",children:t("ui.common.account.radient_auth_buttons.radient_is_not_available_from_this_backend_s_provider_registry")})};export{w as R};
@@ -1,4 +1,4 @@
1
- import{r as p,l as Ti,j as u,m as Ii,n as gu,o as Ys,i as Zr,h as ie,p as bu,b as Dt,q as ce,u as Re,v as qs,w as Ri,x as Jr,c as Le,t as B}from"./index-N0lyyVVo.js";import{cD as yu,cE as vu,cF as es,cG as xu,cH as wu,cI as _i,cJ as Cu,cK as ku,cL as Su,cM as Ei,cN as Pu,cO as Oi,cP as Tt,cQ as yo,cR as ts,cS as Mu,cT as Ct,cU as vo,cV as Fi,cW as Ni,cX as Du,bY as Tu,cY as Iu,a8 as Ru,a9 as Ai,cZ as _u,c_ as $i,c$ as Eu,d0 as Ou,p as _r,d1 as Fu,d2 as Nu,d3 as Au,d4 as $u,d5 as ju,d6 as Lu,bk as Vu,d7 as Bu,d8 as zu,cd as Hu,bK as Wu,d9 as Uu,da as Yu,db as qu}from"./index-jVCAPb0a.js";import{ag as nr,_ as ji,u as ns,aO as Li,eb as os,ec as D,ed as Ku,aV as Vi,aW as Bi,a1 as zi,a2 as Pn,ee as Gu,aQ as Qu,bU as Xu,ap as Hi,ef as Zu,eg as Ju,eh as ed,cu as Ks,ei as td,ej as nd,ek as od,el as rd,em as Gs,en as sd,aP as Mn,eo as Lo,aX as ad,ep as id,aR as ld,a as cd,c as ud,eq as dd,er as pd,es as fd}from"./conversation-input-sync-bgD4kyw3.js";import{P as md}from"./page-header-CZcbRwLy.js";import{aj as _o,ak as hd,y as Kt,B as yt,u as fn,S as rs,a4 as Qs,L as bt,T as Wi,I as Wo,K as vn,M as xn,N as wn,O as Cn,P as et,Q as Er,a5 as gd,a6 as bd,p as yd,a7 as vd,x as xd,X as wd,A as Xs}from"./error-boundary-DJAF_aYL.js";import"./ui-preferences-store-C91RrpgH.js";import{s as Or,g as Cd,b as Uo,c as Ui,d as Yi,e as kd,l as Fr,h as Sd,w as Zs,j as Pd,i as to,f as Md,k as Dd}from"./format-esAOn2VS.js";import{a as or,p as Js}from"./parseISO-BHJWTxrA.js";import{t as Ce,c as at,m as qi,a as Ki,n as rr,g as ss,k as Td,b as Gi,e as Qi}from"./en-US-CHJkXXr4.js";import"./console-mirror-CkCxHgcU.js";var Id=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Rd=yu(function(e){return Id.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),_d=Rd,Ed=function(t){return t!=="theme"},ea=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?_d:Ed},ta=function(t,n,o){var r;if(n){var s=n.shouldForwardProp;r=t.__emotion_forwardProp&&s?function(a){return t.__emotion_forwardProp(a)&&s(a)}:s}return typeof r!="function"&&o&&(r=t.__emotion_forwardProp),r},Od=function(t){var n=t.cache,o=t.serialized,r=t.isStringTag;return Cu(n,o,r),ku(function(){return Su(n,o,r)}),null},Fd=function e(t,n){var o=t.__emotion_real===t,r=o&&t.__emotion_base||t,s,a;n!==void 0&&(s=n.label,a=n.target);var i=ta(t,n,o),l=i||ea(r),c=!l("as");return function(){var d=arguments,m=o&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(s!==void 0&&m.push("label:"+s+";"),d[0]==null||d[0].raw===void 0)m.push.apply(m,d);else{var y=d[0];m.push(y[0]);for(var g=d.length,h=1;h<g;h++)m.push(d[h],y[h])}var v=vu(function(f,b,C){var w=c&&f.as||r,x="",S=[],P=f;if(f.theme==null){P={};for(var k in f)P[k]=f[k];P.theme=p.useContext(xu)}typeof f.className=="string"?x=wu(b.registered,S,f.className):f.className!=null&&(x=f.className+" ");var R=_i(m.concat(S),b.registered,P);x+=b.key+"-"+R.name,a!==void 0&&(x+=" "+a);var _=c&&i===void 0?ea(w):l,O={};for(var $ in f)c&&$==="as"||_($)&&(O[$]=f[$]);return O.className=x,C&&(O.ref=C),p.createElement(p.Fragment,null,p.createElement(Od,{cache:b,serialized:R,isStringTag:typeof w=="string"}),p.createElement(w,O))});return v.displayName=s!==void 0?s:"Styled("+(typeof r=="string"?r:r.displayName||r.name||"Component")+")",v.defaultProps=t.defaultProps,v.__emotion_real=v,v.__emotion_base=r,v.__emotion_styles=m,v.__emotion_forwardProp=i,Object.defineProperty(v,"toString",{value:function(){return"."+a}}),v.withComponent=function(f,b){var C=e(f,es({},n,b,{shouldForwardProp:ta(v,b,!0)}));return C.apply(void 0,m)},v}},Nd=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],Nr=Fd.bind(null);Nd.forEach(function(e){Nr[e]=Nr(e)});/**
1
+ import{r as p,l as Ti,j as u,m as Ii,n as gu,o as Ys,i as Zr,h as ie,p as bu,b as Dt,q as ce,u as Re,v as qs,w as Ri,x as Jr,c as Le,t as B}from"./index-N0lyyVVo.js";import{cF as yu,cG as vu,cH as es,cI as xu,cJ as wu,cK as _i,cL as Cu,cM as ku,cN as Su,cO as Ei,cP as Pu,cQ as Oi,cR as Tt,cS as yo,cT as ts,cU as Mu,cV as Ct,cW as vo,cX as Fi,cY as Ni,cZ as Du,b_ as Tu,c_ as Iu,aa as Ru,ab as Ai,c$ as _u,d0 as $i,d1 as Eu,d2 as Ou,p as _r,d3 as Fu,d4 as Nu,d5 as Au,d6 as $u,d7 as ju,d8 as Lu,bm as Vu,d9 as Bu,da as zu,cf as Hu,bM as Wu,db as Uu,dc as Yu,dd as qu}from"./index-BZYkm39z.js";import{ag as nr,_ as ji,u as ns,aO as Li,eb as os,ec as D,ed as Ku,aV as Vi,aW as Bi,a1 as zi,a2 as Pn,ee as Gu,aQ as Qu,bU as Xu,ap as Hi,ef as Zu,eg as Ju,eh as ed,cu as Ks,ei as td,ej as nd,ek as od,el as rd,em as Gs,en as sd,aP as Mn,eo as Lo,aX as ad,ep as id,aR as ld,a as cd,c as ud,eq as dd,er as pd,es as fd}from"./conversation-input-sync-bgD4kyw3.js";import{P as md}from"./page-header-CZcbRwLy.js";import{aj as _o,ak as hd,y as Kt,B as yt,u as fn,S as rs,a4 as Qs,L as bt,T as Wi,I as Wo,K as vn,M as xn,N as wn,O as Cn,P as et,Q as Er,a5 as gd,a6 as bd,p as yd,a7 as vd,x as xd,X as wd,A as Xs}from"./error-boundary-DJAF_aYL.js";import"./ui-preferences-store-C91RrpgH.js";import{s as Or,g as Cd,b as Uo,c as Ui,d as Yi,e as kd,l as Fr,h as Sd,w as Zs,j as Pd,i as to,f as Md,k as Dd}from"./format-esAOn2VS.js";import{a as or,p as Js}from"./parseISO-BHJWTxrA.js";import{t as Ce,c as at,m as qi,a as Ki,n as rr,g as ss,k as Td,b as Gi,e as Qi}from"./en-US-CHJkXXr4.js";import"./console-mirror-CkCxHgcU.js";var Id=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Rd=yu(function(e){return Id.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),_d=Rd,Ed=function(t){return t!=="theme"},ea=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?_d:Ed},ta=function(t,n,o){var r;if(n){var s=n.shouldForwardProp;r=t.__emotion_forwardProp&&s?function(a){return t.__emotion_forwardProp(a)&&s(a)}:s}return typeof r!="function"&&o&&(r=t.__emotion_forwardProp),r},Od=function(t){var n=t.cache,o=t.serialized,r=t.isStringTag;return Cu(n,o,r),ku(function(){return Su(n,o,r)}),null},Fd=function e(t,n){var o=t.__emotion_real===t,r=o&&t.__emotion_base||t,s,a;n!==void 0&&(s=n.label,a=n.target);var i=ta(t,n,o),l=i||ea(r),c=!l("as");return function(){var d=arguments,m=o&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(s!==void 0&&m.push("label:"+s+";"),d[0]==null||d[0].raw===void 0)m.push.apply(m,d);else{var y=d[0];m.push(y[0]);for(var g=d.length,h=1;h<g;h++)m.push(d[h],y[h])}var v=vu(function(f,b,C){var w=c&&f.as||r,x="",S=[],P=f;if(f.theme==null){P={};for(var k in f)P[k]=f[k];P.theme=p.useContext(xu)}typeof f.className=="string"?x=wu(b.registered,S,f.className):f.className!=null&&(x=f.className+" ");var R=_i(m.concat(S),b.registered,P);x+=b.key+"-"+R.name,a!==void 0&&(x+=" "+a);var _=c&&i===void 0?ea(w):l,O={};for(var $ in f)c&&$==="as"||_($)&&(O[$]=f[$]);return O.className=x,C&&(O.ref=C),p.createElement(p.Fragment,null,p.createElement(Od,{cache:b,serialized:R,isStringTag:typeof w=="string"}),p.createElement(w,O))});return v.displayName=s!==void 0?s:"Styled("+(typeof r=="string"?r:r.displayName||r.name||"Component")+")",v.defaultProps=t.defaultProps,v.__emotion_real=v,v.__emotion_base=r,v.__emotion_styles=m,v.__emotion_forwardProp=i,Object.defineProperty(v,"toString",{value:function(){return"."+a}}),v.withComponent=function(f,b){var C=e(f,es({},n,b,{shouldForwardProp:ta(v,b,!0)}));return C.apply(void 0,m)},v}},Nd=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],Nr=Fd.bind(null);Nd.forEach(function(e){Nr[e]=Nr(e)});/**
2
2
  * @mui/styled-engine v6.4.11
3
3
  *
4
4
  * @license MIT
@@ -1,4 +1,4 @@
1
- import{r as o,t as n,j as t,c as _e,e as Ks,L as Us}from"./index-N0lyyVVo.js";import{cQ as Dt,cR as Bs,cS as xn,cT as Ke,b$ as Vs,_ as Re,af as Wn,ag as Xt,a2 as Zn,u as en,aO as Hs,aP as qs,cU as Gs,cV as Ys,cW as Qs,cX as Ws,cY as Jn,cZ as tn,ad as Xn,c_ as Zs,c$ as Js,aT as zt,d0 as yn,d1 as Ge,a as nn,c as $t,d2 as Xs,d3 as pt,d4 as ea,by as ta,d5 as na,d6 as sa,d7 as aa,d8 as ia,d as pe,d9 as Pt,bO as es,da as sn,ci as ht,bC as ra,db as ts,ab as oa,dc as la,dd as ca,de as da,df as ua,a0 as an,dg as ga,dh as ma,a1 as ns,aV as Kt,aW as Ut,di as _a,aI as pa,cy as Bt,ap as st,dj as ha,dk as fa,dl as xa,dm as Vt,dn as ya,dp as va,dq as ba,aR as ka,dr as ss,ds as ja,dt as wa,du as Na,aN as Sa,dv as as,aU as is,dw as rs,dx as Ma,dy as Ca,dz as Aa,dA as Ea,dB as Ia,dC as Ra,dD as Ta,dE as La,$ as Oa,bW as os,b7 as Fa,bx as Da,dF as et,dG as Ht,dH as vn,dI as za,dJ as $a,dK as Pa,dL as Ka,dM as Ua,bJ as Ba,dN as Va,c2 as Ha,dO as qa,c1 as Ga,dP as Ya,dQ as Qa,dR as bn,dS as Wa,dT as Za,dU as Ja,cn as Xa}from"./conversation-input-sync-bgD4kyw3.js";import{n as ei,K as ti,u as Ue,o as ni,q as si,r as ai,T as ii,s as ls}from"./ui-preferences-store-C91RrpgH.js";import{cj as cs,ck as ri,cl as oi,cm as ds,cn as li,co as ci,cp as Fe,a8 as us,bS as ot,bT as me,cq as ce,cr as di,cd as ui,cs as gi,p as kn,ct as mi,cu as _i,cv as dt,bR as pi,c1 as hi,cw as fi,cx as xi,cy as yi,cz as vi,bH as jn,cA as bi,bx as ki,bO as wn,cc as ji,bP as wi,bQ as Ni,cB as Si,bG as Mi,cC as Ci}from"./index-jVCAPb0a.js";import{P as Ai}from"./page-header-CZcbRwLy.js";import{c as A,u as ne,B as F,S as ve,Q as gs,y as Je,a0 as kt,a1 as jt,a2 as We,A as ae,z as wt,E as Ee,x as ye,K as rn,M as on,N as ln,O as cn,P as Ze,L as Ie,I as De,a4 as Nt,R as Ei,q as it,C as qt,ac as Ii,g as ms,ah as Nn,T as _s,h as Ri,i as Ti,j as Li,l as Oi,k as Sn,H as Fi,G as Di,ai as zi,a8 as $i}from"./error-boundary-DJAF_aYL.js";import{R as Pi}from"./radient-auth-buttons-DP81yj6b.js";import{N as Ki}from"./notebook-pen-CKr2WSrK.js";import{B as Ui}from"./book-open-yjstLkVS.js";import{a as Bi,p as Ct}from"./parseISO-BHJWTxrA.js";import{i as Vi,a as qe,f as Hi}from"./format-esAOn2VS.js";import{t as qi}from"./en-US-CHJkXXr4.js";import"./console-mirror-CkCxHgcU.js";/**
1
+ import{r as o,t as n,j as t,c as _e,e as Ks,L as Us}from"./index-N0lyyVVo.js";import{cQ as Dt,cR as Bs,cS as xn,cT as Ke,b$ as Vs,_ as Re,af as Wn,ag as Xt,a2 as Zn,u as en,aO as Hs,aP as qs,cU as Gs,cV as Ys,cW as Qs,cX as Ws,cY as Jn,cZ as tn,ad as Xn,c_ as Zs,c$ as Js,aT as zt,d0 as yn,d1 as Ge,a as nn,c as $t,d2 as Xs,d3 as pt,d4 as ea,by as ta,d5 as na,d6 as sa,d7 as aa,d8 as ia,d as pe,d9 as Pt,bO as es,da as sn,ci as ht,bC as ra,db as ts,ab as oa,dc as la,dd as ca,de as da,df as ua,a0 as an,dg as ga,dh as ma,a1 as ns,aV as Kt,aW as Ut,di as _a,aI as pa,cy as Bt,ap as st,dj as ha,dk as fa,dl as xa,dm as Vt,dn as ya,dp as va,dq as ba,aR as ka,dr as ss,ds as ja,dt as wa,du as Na,aN as Sa,dv as as,aU as is,dw as rs,dx as Ma,dy as Ca,dz as Aa,dA as Ea,dB as Ia,dC as Ra,dD as Ta,dE as La,$ as Oa,bW as os,b7 as Fa,bx as Da,dF as et,dG as Ht,dH as vn,dI as za,dJ as $a,dK as Pa,dL as Ka,dM as Ua,bJ as Ba,dN as Va,c2 as Ha,dO as qa,c1 as Ga,dP as Ya,dQ as Qa,dR as bn,dS as Wa,dT as Za,dU as Ja,cn as Xa}from"./conversation-input-sync-bgD4kyw3.js";import{n as ei,K as ti,u as Ue,o as ni,q as si,r as ai,T as ii,s as ls}from"./ui-preferences-store-C91RrpgH.js";import{cl as cs,cm as ri,cn as oi,co as ds,cp as li,cq as ci,cr as Fe,aa as us,bU as ot,bV as me,cs as ce,ct as di,cf as ui,cu as gi,p as kn,cv as mi,cw as _i,cx as dt,bT as pi,c3 as hi,cy as fi,cz as xi,cA as yi,cB as vi,bJ as jn,cC as bi,bz as ki,bQ as wn,ce as ji,bR as wi,bS as Ni,cD as Si,bI as Mi,cE as Ci}from"./index-BZYkm39z.js";import{P as Ai}from"./page-header-CZcbRwLy.js";import{c as A,u as ne,B as F,S as ve,Q as gs,y as Je,a0 as kt,a1 as jt,a2 as We,A as ae,z as wt,E as Ee,x as ye,K as rn,M as on,N as ln,O as cn,P as Ze,L as Ie,I as De,a4 as Nt,R as Ei,q as it,C as qt,ac as Ii,g as ms,ah as Nn,T as _s,h as Ri,i as Ti,j as Li,l as Oi,k as Sn,H as Fi,G as Di,ai as zi,a8 as $i}from"./error-boundary-DJAF_aYL.js";import{R as Pi}from"./radient-auth-buttons-Huoo_kFK.js";import{N as Ki}from"./notebook-pen-CKr2WSrK.js";import{B as Ui}from"./book-open-yjstLkVS.js";import{a as Bi,p as Ct}from"./parseISO-BHJWTxrA.js";import{i as Vi,a as qe,f as Hi}from"./format-esAOn2VS.js";import{t as qi}from"./en-US-CHJkXXr4.js";import"./console-mirror-CkCxHgcU.js";/**
2
2
  * @license lucide-react v0.507.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{g as Y,a as E,b as F}from"./library-page-Cm-o3Z-q.js";import"./index-N0lyyVVo.js";import"./index-jVCAPb0a.js";import"./conversation-input-sync-bgD4kyw3.js";import"./ui-preferences-store-C91RrpgH.js";import"./error-boundary-DJAF_aYL.js";import"./console-mirror-CkCxHgcU.js";import"./page-header-CZcbRwLy.js";import"./hash-BLfEUuGg.js";import"./arrow-up-JQ86w8h2.js";const B=["#4472C4","#ED7D31","#A9D18E","#FF0000","#FFC000","#5B9BD5","#70AD47","#C00000","#7030A0","#00B0F0"];function W(n,t){const c=`accent${n%6+1}`;return t[c]?"#"+t[c]:B[n%B.length]}function j(n,t=.45){const c=parseInt(n.slice(1,3),16),s=parseInt(n.slice(3,5),16),a=parseInt(n.slice(5,7),16),p=Math.round(c+(255-c)*t),M=Math.round(s+(255-s)*t),o=Math.round(a+(255-a)*t);return`rgb(${p},${M},${o})`}function G(n){const t=[];for(const c of E(n,"t")){const s=c.textContent.trim();s&&t.push(s)}return t.join(" ")}function V(n){if(!n)return[];const t=Y(n,"ptLst");if(!t)return[];const c=[];for(const s of E(t,"pt")){const a=F(s,"type","node");if(a==="parTrans"||a==="sibTrans")continue;const p=G(s);(p||a==="node")&&c.push({id:F(s,"modelId",""),type:a,text:p})}return c.filter(s=>s.text)}function z(n){if(!n)return"list";const t=Y(n,"layoutDef")||n,s=(F(t,"uniqueId","")||F(t,"defStyle","")||"").toLowerCase();return s.includes("chevron")||s.includes("arrowprocess")||s.includes("process")?"process":s.includes("cycle")||s.includes("continuouscycle")?"cycle":s.includes("hierarchy")||s.includes("orgchart")||s.includes("org")?"hierarchy":s.includes("radial")||s.includes("diverging")?"radial":s.includes("pyramid")||s.includes("invertedpyramid")?"pyramid":s.includes("funnel")?"funnel":s.includes("venn")?"venn":s.includes("matrix")?"matrix":s.includes("list")||s.includes("bullet")?"list":s.includes("relationship")||s.includes("balance")?"relationship":"list"}function $(n,t,c,s,a,p,M,o="#fff",f="center"){if(!t)return;n.save(),n.fillStyle=o,n.textAlign=f,n.textBaseline="middle";const l=t.split(" "),g=M*1.3;let h=[],r="";for(const u of l){const y=r?r+" "+u:u;n.measureText(y).width>a-4&&r?(h.push(r),r=u):r=y}r&&h.push(r);const i=Math.max(1,Math.floor(p/g));h.length>i&&(h=h.slice(0,i));const e=s-(h.length-1)*g/2;for(let u=0;u<h.length;u++)n.fillText(h[u],c,e+u*g);n.restore()}function I(n,t,c,s=14){const a=Math.floor(t/(s*.55)),p=n.split(" "),M=Math.ceil(p.join(" ").length/Math.max(a,1)),o=c/(M*1.4);return Math.max(8,Math.min(s,o))}function L(n,t,c,s,a,p,M,o){n.save(),n.beginPath(),p=Math.min(p,s/2,a/2),n.moveTo(t+p,c),n.arcTo(t+s,c,t+s,c+a,p),n.arcTo(t+s,c+a,t,c+a,p),n.arcTo(t,c+a,t,c,p),n.arcTo(t,c,t+s,c,p),n.closePath(),M&&(n.fillStyle=M,n.fill()),n.restore()}function X(n,t,c,s,a,p,M=1.5){const o=Math.atan2(a-c,s-t),f=8;n.save(),n.strokeStyle=p,n.fillStyle=p,n.lineWidth=M,n.beginPath(),n.moveTo(t,c),n.lineTo(s,a),n.stroke(),n.beginPath(),n.moveTo(s,a),n.lineTo(s-f*Math.cos(o-.4),a-f*Math.sin(o-.4)),n.lineTo(s-f*Math.cos(o+.4),a-f*Math.sin(o+.4)),n.closePath(),n.fill(),n.restore()}function J(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=a/f,g=Math.min(l*.08,10*o),h=Math.min(l*.12,18*o),r=l-h-g,i=p*.7,e=s+(p-i)/2;for(let u=0;u<f;u++){const y=W(u,M),d=c+l*u+g/2,b=u===f-1;n.save(),n.beginPath();const P=d+r+(b?0:h);n.moveTo(d,e),n.lineTo(d+r,e),b||n.lineTo(P,e+i/2),n.lineTo(d+r,e+i),n.lineTo(d,e+i),u>0&&n.lineTo(d+h,e+i/2),n.closePath(),n.fillStyle=y,n.fill(),n.restore();const m=I(t[u].text,r-h,i)*o;n.font=`${m}px sans-serif`;const T=d+(r+(u>0?h:0))/2;$(n,t[u].text,T,e+i/2,r,i,m)}}function K(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=c+a/2,g=s+p/2,h=Math.min(a,p)*.33,r=Math.min(h*.32,40*o);n.save(),n.strokeStyle="#ccc",n.lineWidth=2*o,n.setLineDash([4*o,4*o]),n.beginPath(),n.arc(l,g,h,0,Math.PI*2),n.stroke(),n.setLineDash([]),n.restore();for(let i=0;i<f;i++){const e=i/f*Math.PI*2-Math.PI/2,u=l+h*Math.cos(e),y=g+h*Math.sin(e),d=W(i,M);if(n.save(),n.beginPath(),n.arc(u,y,r,0,Math.PI*2),n.fillStyle=d,n.fill(),n.restore(),f>1){const P=(i+1)/f*Math.PI*2-Math.PI/2,m=(e+P)/2,T=l+h*Math.cos(e+.15),v=g+h*Math.sin(e+.15),k=l+h*Math.cos(P-.15),S=g+h*Math.sin(P-.15);n.save(),n.strokeStyle=d+"99",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(T,v),n.quadraticCurveTo(l+h*1.1*Math.cos(m),g+h*1.1*Math.sin(m),k,S),n.stroke(),n.restore()}const b=I(t[i].text,r*1.7,r*1.2)*o;n.font=`${b}px sans-serif`,$(n,t[i].text,u,y,r*2,r*1.8,b)}}function O(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t[0],l=t.slice(1),g=Math.max(l.length,1),h=p/(l.length>0?2.8:1.2),r=h*.75,i=Math.min(a*.3,160*o),e=r,u=c+(a-i)/2,y=s+(h-e)/2,d=W(0,M);L(n,u,y,i,e,6*o,d);const b=I(f.text,i-10*o,e)*o;if(n.font=`bold ${b}px sans-serif`,$(n,f.text,u+i/2,y+e/2,i-10,e,b),!l.length)return;const P=(a-20*o)/g,m=s+h*1.5,T=y+e,v=m-4*o;n.save(),n.strokeStyle="#999",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(u+i/2,T),n.lineTo(u+i/2,(T+v)/2),n.lineTo(c+10*o,(T+v)/2),n.lineTo(c+a-10*o,(T+v)/2),n.stroke(),n.restore();for(let k=0;k<l.length;k++){const S=c+P*k+8*o,R=m,A=P-16*o,H=r,N=W(k+1,M);n.save(),n.strokeStyle="#999",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(S+A/2,(T+v)/2),n.lineTo(S+A/2,R),n.stroke(),n.restore(),L(n,S,R,A,H,5*o,N);const D=I(l[k].text,A-8*o,H)*o;n.font=`${D}px sans-serif`,$(n,l[k].text,S+A/2,R+H/2,A-8,H,D)}}function Q(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t[0],l=t.slice(1),g=c+a/2,h=s+p/2,r=Math.min(a,p)*.18,i=Math.min(a,p)*.36,e=Math.min(i*.28,38*o),u=l.length||1,y=W(0,M);n.save(),n.beginPath(),n.arc(g,h,r,0,Math.PI*2),n.fillStyle=y,n.fill(),n.restore();const d=I(f.text,r*1.6,r*1.2)*o;n.font=`bold ${d}px sans-serif`,$(n,f.text,g,h,r*2,r*2,d);for(let b=0;b<u;b++){const P=b/u*Math.PI*2-Math.PI/2,m=g+i*Math.cos(P),T=h+i*Math.sin(P),v=W(b+1,M),k=g+r*Math.cos(P),S=h+r*Math.sin(P),R=m-e*Math.cos(P),A=T-e*Math.sin(P);X(n,k,S,R,A,v+"99",1.5*o),n.save(),n.beginPath(),n.arc(m,T,e,0,Math.PI*2),n.fillStyle=v,n.fill(),n.restore();const H=I(l[b].text,e*1.7,e*1.2)*o;n.font=`${H}px sans-serif`,$(n,l[b].text,m,T,e*2,e*1.8,H)}}function U(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f;for(let g=0;g<f;g++){const h=(f-g)/f,r=a*h,i=c+(a-r)/2,e=s+g*l,u=W(g,M);n.save(),n.beginPath(),n.moveTo(i,e+l),n.lineTo(i+r,e+l);const y=a*((f-g-1)/f);n.lineTo(c+(a+y)/2,e),n.lineTo(c+(a-y)/2,e),n.closePath(),n.fillStyle=u,n.strokeStyle="#fff",n.lineWidth=2*o,n.fill(),n.stroke(),n.restore();const d=I(t[g].text,r*.6,l*.7)*o;n.font=`${d}px sans-serif`,$(n,t[g].text,c+a/2,e+l/2,r*.6,l*.7,d)}}function Z(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f;for(let g=0;g<f;g++){const h=1-g/f*.55,r=1-(g+1)/f*.55,i=a*h,e=a*r,u=c+(a-i)/2,y=c+(a-e)/2,d=s+g*l,b=W(g,M);n.save(),n.beginPath(),n.moveTo(u,d),n.lineTo(u+i,d),n.lineTo(y+e,d+l),n.lineTo(y,d+l),n.closePath(),n.fillStyle=b,n.strokeStyle="#fff",n.lineWidth=2*o,n.fill(),n.stroke(),n.restore();const P=(i+e)/2,m=I(t[g].text,P*.8,l*.7)*o;n.font=`${m}px sans-serif`,$(n,t[g].text,c+a/2,d+l/2,P*.8,l*.7,m)}}function _(n,t,c,s,a,p,M,o){if(!t.length)return;const f=Math.min(t.length,4),l=c+a/2,g=s+p/2,h=Math.min(a,p)*(f<=2?.32:.28),r=h*.65,i=[];for(let e=0;e<f;e++)i.push(e/f*Math.PI*2-Math.PI/2);for(let e=0;e<f;e++){const u=f>1?l+r*Math.cos(i[e]):l,y=f>1?g+r*Math.sin(i[e]):g,d=W(e,M);n.save(),n.globalAlpha=.55,n.beginPath(),n.arc(u,y,h,0,Math.PI*2),n.fillStyle=d,n.fill(),n.globalAlpha=1,n.strokeStyle="#fff",n.lineWidth=1.5*o,n.stroke(),n.restore();const b=f>1?l+(r+h*.45)*Math.cos(i[e]):l,P=f>1?g+(r+h*.45)*Math.sin(i[e]):g,m=I(t[e].text,h*1.2,h*.7)*o;n.font=`${m}px sans-serif`,$(n,t[e].text,b,P,h*1.2,h*.7,m,"#333")}}function w(n,t,c,s,a,p,M,o){const f=[t[0]||{text:""},t[1]||{text:""},t[2]||{text:""},t[3]||{text:""}],l=a/2,g=p/2,h=8*o;for(let r=0;r<2;r++)for(let i=0;i<2;i++){const e=r*2+i,u=c+i*l+h,y=s+r*g+h,d=l-h*2,b=g-h*2,P=W(e,M);L(n,u,y,d,b,8*o,P);const m=I(f[e].text,d-10,b)*o;n.font=`${m}px sans-serif`,$(n,f[e].text,u+d/2,y+b/2,d-10,b,m)}}function q(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f,g=Math.min(l*.2,14*o),h=g*3;for(let r=0;r<f;r++){const i=s+r*l,e=i+l/2,u=W(r,M);n.save(),n.beginPath(),n.arc(c+g,e,g,0,Math.PI*2),n.fillStyle=u,n.fill(),n.restore(),L(n,c+h,i+l*.1,a-h-4*o,l*.8,4*o,u+"22");const y=I(t[r].text,a-h-20*o,l*.7)*o;n.font=`${y}px sans-serif`,n.fillStyle="#333",n.textAlign="left",n.textBaseline="middle",n.fillText(t[r].text,c+h+8*o,e)}}function C(n,t,c,s,a,p,M,o){if(t.length<2){q(n,t,c,s,a,p,M,o);return}const f=t[Math.floor(t.length/2)],l=t.slice(0,Math.floor(t.length/2)),g=t.slice(Math.floor(t.length/2)+1),h=c+a/2,r=s+p/2,i=Math.min(a*.14,p*.25),e=W(Math.floor(t.length/2),M);n.save(),n.beginPath(),n.arc(h,r,i,0,Math.PI*2),n.fillStyle=e,n.fill(),n.restore();const u=I(f.text,i*1.6,i*1.2)*o;n.font=`bold ${u}px sans-serif`,$(n,f.text,h,r,i*2,i*1.8,u);const y=p/Math.max(l.length,g.length,1),d=a*.3,b=y*.7,P=(m,T)=>{const v=T==="left"?c:c+a-d,k=T==="left"?h-i:h+i;for(let S=0;S<m.length;S++){const R=s+y*S+(y-b)/2,A=W(S+(T==="right"?l.length+1:0),M);L(n,v,R,d,b,5*o,A);const H=I(m[S].text,d-8,b)*o;n.font=`${H}px sans-serif`,$(n,m[S].text,v+d/2,R+b/2,d-8,b,H);const N=T==="left"?v+d:v;X(n,N,R+b/2,k,r,A+"88",1.5*o)}};P(l,"left"),P(g,"right")}function x(n,t,c,s,a,p,M,o){const f=t.length;if(!f)return;const l=Math.ceil(Math.sqrt(f)),g=Math.ceil(f/l),h=a/l,r=p/g,i=Math.min(h,r)*.1;for(let e=0;e<f;e++){const u=e%l,y=Math.floor(e/l),d=c+u*h+i,b=s+y*r+i,P=h-i*2,m=r-i*2,T=W(e,M);L(n,d,b,P,m,8*o,T),j(T),n.save();const v=n.createLinearGradient(d,b,d,b+m*.5);v.addColorStop(0,"rgba(255,255,255,0.18)"),v.addColorStop(1,"rgba(255,255,255,0)"),n.fillStyle=v,n.beginPath(),n.roundRect?.(d,b,P,m,8*o),n.fill(),n.restore();const k=I(t[e].text,P-12*o,m)*o;n.font=`${k}px sans-serif`,$(n,t[e].text,d+P/2,b+m/2,P-12*o,m,k)}}function cn(n,t,c,s,a,p,M,o,f){const l=V(t),g=z(c),h=16*f;n.save(),n.fillStyle="#f7f9fc",n.strokeStyle="#e0e4ec",n.lineWidth=1,n.beginPath(),n.roundRect?.(s,a,p,M,6*f)||n.rect(s,a,p,M),n.fill(),n.stroke();const r=s+h,i=a+h,e=p-h*2,u=M-h*2;if(!l.length){n.fillStyle="#aaa",n.font=`${12*f}px sans-serif`,n.textAlign="center",n.textBaseline="middle",n.fillText("SmartArt Diagram",s+p/2,a+M/2),n.restore();return}switch(g){case"process":J(n,l,r,i,e,u,o,f);break;case"cycle":K(n,l,r,i,e,u,o,f);break;case"hierarchy":O(n,l,r,i,e,u,o,f);break;case"radial":Q(n,l,r,i,e,u,o,f);break;case"pyramid":U(n,l,r,i,e,u,o,f);break;case"funnel":Z(n,l,r,i,e,u,o,f);break;case"venn":_(n,l,r,i,e,u,o,f);break;case"matrix":w(n,l,r,i,e,u,o,f);break;case"list":q(n,l,r,i,e,u,o,f);break;case"relationship":C(n,l,r,i,e,u,o,f);break;default:x(n,l,r,i,e,u,o,f)}n.restore()}export{cn as renderSmartArt};
1
+ import{g as Y,a as E,b as F}from"./library-page-C8ymyVUW.js";import"./index-N0lyyVVo.js";import"./index-BZYkm39z.js";import"./conversation-input-sync-bgD4kyw3.js";import"./ui-preferences-store-C91RrpgH.js";import"./error-boundary-DJAF_aYL.js";import"./console-mirror-CkCxHgcU.js";import"./page-header-CZcbRwLy.js";import"./hash-BLfEUuGg.js";import"./arrow-up-JQ86w8h2.js";const B=["#4472C4","#ED7D31","#A9D18E","#FF0000","#FFC000","#5B9BD5","#70AD47","#C00000","#7030A0","#00B0F0"];function W(n,t){const c=`accent${n%6+1}`;return t[c]?"#"+t[c]:B[n%B.length]}function j(n,t=.45){const c=parseInt(n.slice(1,3),16),s=parseInt(n.slice(3,5),16),a=parseInt(n.slice(5,7),16),p=Math.round(c+(255-c)*t),M=Math.round(s+(255-s)*t),o=Math.round(a+(255-a)*t);return`rgb(${p},${M},${o})`}function G(n){const t=[];for(const c of E(n,"t")){const s=c.textContent.trim();s&&t.push(s)}return t.join(" ")}function V(n){if(!n)return[];const t=Y(n,"ptLst");if(!t)return[];const c=[];for(const s of E(t,"pt")){const a=F(s,"type","node");if(a==="parTrans"||a==="sibTrans")continue;const p=G(s);(p||a==="node")&&c.push({id:F(s,"modelId",""),type:a,text:p})}return c.filter(s=>s.text)}function z(n){if(!n)return"list";const t=Y(n,"layoutDef")||n,s=(F(t,"uniqueId","")||F(t,"defStyle","")||"").toLowerCase();return s.includes("chevron")||s.includes("arrowprocess")||s.includes("process")?"process":s.includes("cycle")||s.includes("continuouscycle")?"cycle":s.includes("hierarchy")||s.includes("orgchart")||s.includes("org")?"hierarchy":s.includes("radial")||s.includes("diverging")?"radial":s.includes("pyramid")||s.includes("invertedpyramid")?"pyramid":s.includes("funnel")?"funnel":s.includes("venn")?"venn":s.includes("matrix")?"matrix":s.includes("list")||s.includes("bullet")?"list":s.includes("relationship")||s.includes("balance")?"relationship":"list"}function $(n,t,c,s,a,p,M,o="#fff",f="center"){if(!t)return;n.save(),n.fillStyle=o,n.textAlign=f,n.textBaseline="middle";const l=t.split(" "),g=M*1.3;let h=[],r="";for(const u of l){const y=r?r+" "+u:u;n.measureText(y).width>a-4&&r?(h.push(r),r=u):r=y}r&&h.push(r);const i=Math.max(1,Math.floor(p/g));h.length>i&&(h=h.slice(0,i));const e=s-(h.length-1)*g/2;for(let u=0;u<h.length;u++)n.fillText(h[u],c,e+u*g);n.restore()}function I(n,t,c,s=14){const a=Math.floor(t/(s*.55)),p=n.split(" "),M=Math.ceil(p.join(" ").length/Math.max(a,1)),o=c/(M*1.4);return Math.max(8,Math.min(s,o))}function L(n,t,c,s,a,p,M,o){n.save(),n.beginPath(),p=Math.min(p,s/2,a/2),n.moveTo(t+p,c),n.arcTo(t+s,c,t+s,c+a,p),n.arcTo(t+s,c+a,t,c+a,p),n.arcTo(t,c+a,t,c,p),n.arcTo(t,c,t+s,c,p),n.closePath(),M&&(n.fillStyle=M,n.fill()),n.restore()}function X(n,t,c,s,a,p,M=1.5){const o=Math.atan2(a-c,s-t),f=8;n.save(),n.strokeStyle=p,n.fillStyle=p,n.lineWidth=M,n.beginPath(),n.moveTo(t,c),n.lineTo(s,a),n.stroke(),n.beginPath(),n.moveTo(s,a),n.lineTo(s-f*Math.cos(o-.4),a-f*Math.sin(o-.4)),n.lineTo(s-f*Math.cos(o+.4),a-f*Math.sin(o+.4)),n.closePath(),n.fill(),n.restore()}function J(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=a/f,g=Math.min(l*.08,10*o),h=Math.min(l*.12,18*o),r=l-h-g,i=p*.7,e=s+(p-i)/2;for(let u=0;u<f;u++){const y=W(u,M),d=c+l*u+g/2,b=u===f-1;n.save(),n.beginPath();const P=d+r+(b?0:h);n.moveTo(d,e),n.lineTo(d+r,e),b||n.lineTo(P,e+i/2),n.lineTo(d+r,e+i),n.lineTo(d,e+i),u>0&&n.lineTo(d+h,e+i/2),n.closePath(),n.fillStyle=y,n.fill(),n.restore();const m=I(t[u].text,r-h,i)*o;n.font=`${m}px sans-serif`;const T=d+(r+(u>0?h:0))/2;$(n,t[u].text,T,e+i/2,r,i,m)}}function K(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=c+a/2,g=s+p/2,h=Math.min(a,p)*.33,r=Math.min(h*.32,40*o);n.save(),n.strokeStyle="#ccc",n.lineWidth=2*o,n.setLineDash([4*o,4*o]),n.beginPath(),n.arc(l,g,h,0,Math.PI*2),n.stroke(),n.setLineDash([]),n.restore();for(let i=0;i<f;i++){const e=i/f*Math.PI*2-Math.PI/2,u=l+h*Math.cos(e),y=g+h*Math.sin(e),d=W(i,M);if(n.save(),n.beginPath(),n.arc(u,y,r,0,Math.PI*2),n.fillStyle=d,n.fill(),n.restore(),f>1){const P=(i+1)/f*Math.PI*2-Math.PI/2,m=(e+P)/2,T=l+h*Math.cos(e+.15),v=g+h*Math.sin(e+.15),k=l+h*Math.cos(P-.15),S=g+h*Math.sin(P-.15);n.save(),n.strokeStyle=d+"99",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(T,v),n.quadraticCurveTo(l+h*1.1*Math.cos(m),g+h*1.1*Math.sin(m),k,S),n.stroke(),n.restore()}const b=I(t[i].text,r*1.7,r*1.2)*o;n.font=`${b}px sans-serif`,$(n,t[i].text,u,y,r*2,r*1.8,b)}}function O(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t[0],l=t.slice(1),g=Math.max(l.length,1),h=p/(l.length>0?2.8:1.2),r=h*.75,i=Math.min(a*.3,160*o),e=r,u=c+(a-i)/2,y=s+(h-e)/2,d=W(0,M);L(n,u,y,i,e,6*o,d);const b=I(f.text,i-10*o,e)*o;if(n.font=`bold ${b}px sans-serif`,$(n,f.text,u+i/2,y+e/2,i-10,e,b),!l.length)return;const P=(a-20*o)/g,m=s+h*1.5,T=y+e,v=m-4*o;n.save(),n.strokeStyle="#999",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(u+i/2,T),n.lineTo(u+i/2,(T+v)/2),n.lineTo(c+10*o,(T+v)/2),n.lineTo(c+a-10*o,(T+v)/2),n.stroke(),n.restore();for(let k=0;k<l.length;k++){const S=c+P*k+8*o,R=m,A=P-16*o,H=r,N=W(k+1,M);n.save(),n.strokeStyle="#999",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(S+A/2,(T+v)/2),n.lineTo(S+A/2,R),n.stroke(),n.restore(),L(n,S,R,A,H,5*o,N);const D=I(l[k].text,A-8*o,H)*o;n.font=`${D}px sans-serif`,$(n,l[k].text,S+A/2,R+H/2,A-8,H,D)}}function Q(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t[0],l=t.slice(1),g=c+a/2,h=s+p/2,r=Math.min(a,p)*.18,i=Math.min(a,p)*.36,e=Math.min(i*.28,38*o),u=l.length||1,y=W(0,M);n.save(),n.beginPath(),n.arc(g,h,r,0,Math.PI*2),n.fillStyle=y,n.fill(),n.restore();const d=I(f.text,r*1.6,r*1.2)*o;n.font=`bold ${d}px sans-serif`,$(n,f.text,g,h,r*2,r*2,d);for(let b=0;b<u;b++){const P=b/u*Math.PI*2-Math.PI/2,m=g+i*Math.cos(P),T=h+i*Math.sin(P),v=W(b+1,M),k=g+r*Math.cos(P),S=h+r*Math.sin(P),R=m-e*Math.cos(P),A=T-e*Math.sin(P);X(n,k,S,R,A,v+"99",1.5*o),n.save(),n.beginPath(),n.arc(m,T,e,0,Math.PI*2),n.fillStyle=v,n.fill(),n.restore();const H=I(l[b].text,e*1.7,e*1.2)*o;n.font=`${H}px sans-serif`,$(n,l[b].text,m,T,e*2,e*1.8,H)}}function U(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f;for(let g=0;g<f;g++){const h=(f-g)/f,r=a*h,i=c+(a-r)/2,e=s+g*l,u=W(g,M);n.save(),n.beginPath(),n.moveTo(i,e+l),n.lineTo(i+r,e+l);const y=a*((f-g-1)/f);n.lineTo(c+(a+y)/2,e),n.lineTo(c+(a-y)/2,e),n.closePath(),n.fillStyle=u,n.strokeStyle="#fff",n.lineWidth=2*o,n.fill(),n.stroke(),n.restore();const d=I(t[g].text,r*.6,l*.7)*o;n.font=`${d}px sans-serif`,$(n,t[g].text,c+a/2,e+l/2,r*.6,l*.7,d)}}function Z(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f;for(let g=0;g<f;g++){const h=1-g/f*.55,r=1-(g+1)/f*.55,i=a*h,e=a*r,u=c+(a-i)/2,y=c+(a-e)/2,d=s+g*l,b=W(g,M);n.save(),n.beginPath(),n.moveTo(u,d),n.lineTo(u+i,d),n.lineTo(y+e,d+l),n.lineTo(y,d+l),n.closePath(),n.fillStyle=b,n.strokeStyle="#fff",n.lineWidth=2*o,n.fill(),n.stroke(),n.restore();const P=(i+e)/2,m=I(t[g].text,P*.8,l*.7)*o;n.font=`${m}px sans-serif`,$(n,t[g].text,c+a/2,d+l/2,P*.8,l*.7,m)}}function _(n,t,c,s,a,p,M,o){if(!t.length)return;const f=Math.min(t.length,4),l=c+a/2,g=s+p/2,h=Math.min(a,p)*(f<=2?.32:.28),r=h*.65,i=[];for(let e=0;e<f;e++)i.push(e/f*Math.PI*2-Math.PI/2);for(let e=0;e<f;e++){const u=f>1?l+r*Math.cos(i[e]):l,y=f>1?g+r*Math.sin(i[e]):g,d=W(e,M);n.save(),n.globalAlpha=.55,n.beginPath(),n.arc(u,y,h,0,Math.PI*2),n.fillStyle=d,n.fill(),n.globalAlpha=1,n.strokeStyle="#fff",n.lineWidth=1.5*o,n.stroke(),n.restore();const b=f>1?l+(r+h*.45)*Math.cos(i[e]):l,P=f>1?g+(r+h*.45)*Math.sin(i[e]):g,m=I(t[e].text,h*1.2,h*.7)*o;n.font=`${m}px sans-serif`,$(n,t[e].text,b,P,h*1.2,h*.7,m,"#333")}}function w(n,t,c,s,a,p,M,o){const f=[t[0]||{text:""},t[1]||{text:""},t[2]||{text:""},t[3]||{text:""}],l=a/2,g=p/2,h=8*o;for(let r=0;r<2;r++)for(let i=0;i<2;i++){const e=r*2+i,u=c+i*l+h,y=s+r*g+h,d=l-h*2,b=g-h*2,P=W(e,M);L(n,u,y,d,b,8*o,P);const m=I(f[e].text,d-10,b)*o;n.font=`${m}px sans-serif`,$(n,f[e].text,u+d/2,y+b/2,d-10,b,m)}}function q(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f,g=Math.min(l*.2,14*o),h=g*3;for(let r=0;r<f;r++){const i=s+r*l,e=i+l/2,u=W(r,M);n.save(),n.beginPath(),n.arc(c+g,e,g,0,Math.PI*2),n.fillStyle=u,n.fill(),n.restore(),L(n,c+h,i+l*.1,a-h-4*o,l*.8,4*o,u+"22");const y=I(t[r].text,a-h-20*o,l*.7)*o;n.font=`${y}px sans-serif`,n.fillStyle="#333",n.textAlign="left",n.textBaseline="middle",n.fillText(t[r].text,c+h+8*o,e)}}function C(n,t,c,s,a,p,M,o){if(t.length<2){q(n,t,c,s,a,p,M,o);return}const f=t[Math.floor(t.length/2)],l=t.slice(0,Math.floor(t.length/2)),g=t.slice(Math.floor(t.length/2)+1),h=c+a/2,r=s+p/2,i=Math.min(a*.14,p*.25),e=W(Math.floor(t.length/2),M);n.save(),n.beginPath(),n.arc(h,r,i,0,Math.PI*2),n.fillStyle=e,n.fill(),n.restore();const u=I(f.text,i*1.6,i*1.2)*o;n.font=`bold ${u}px sans-serif`,$(n,f.text,h,r,i*2,i*1.8,u);const y=p/Math.max(l.length,g.length,1),d=a*.3,b=y*.7,P=(m,T)=>{const v=T==="left"?c:c+a-d,k=T==="left"?h-i:h+i;for(let S=0;S<m.length;S++){const R=s+y*S+(y-b)/2,A=W(S+(T==="right"?l.length+1:0),M);L(n,v,R,d,b,5*o,A);const H=I(m[S].text,d-8,b)*o;n.font=`${H}px sans-serif`,$(n,m[S].text,v+d/2,R+b/2,d-8,b,H);const N=T==="left"?v+d:v;X(n,N,R+b/2,k,r,A+"88",1.5*o)}};P(l,"left"),P(g,"right")}function x(n,t,c,s,a,p,M,o){const f=t.length;if(!f)return;const l=Math.ceil(Math.sqrt(f)),g=Math.ceil(f/l),h=a/l,r=p/g,i=Math.min(h,r)*.1;for(let e=0;e<f;e++){const u=e%l,y=Math.floor(e/l),d=c+u*h+i,b=s+y*r+i,P=h-i*2,m=r-i*2,T=W(e,M);L(n,d,b,P,m,8*o,T),j(T),n.save();const v=n.createLinearGradient(d,b,d,b+m*.5);v.addColorStop(0,"rgba(255,255,255,0.18)"),v.addColorStop(1,"rgba(255,255,255,0)"),n.fillStyle=v,n.beginPath(),n.roundRect?.(d,b,P,m,8*o),n.fill(),n.restore();const k=I(t[e].text,P-12*o,m)*o;n.font=`${k}px sans-serif`,$(n,t[e].text,d+P/2,b+m/2,P-12*o,m,k)}}function cn(n,t,c,s,a,p,M,o,f){const l=V(t),g=z(c),h=16*f;n.save(),n.fillStyle="#f7f9fc",n.strokeStyle="#e0e4ec",n.lineWidth=1,n.beginPath(),n.roundRect?.(s,a,p,M,6*f)||n.rect(s,a,p,M),n.fill(),n.stroke();const r=s+h,i=a+h,e=p-h*2,u=M-h*2;if(!l.length){n.fillStyle="#aaa",n.font=`${12*f}px sans-serif`,n.textAlign="center",n.textBaseline="middle",n.fillText("SmartArt Diagram",s+p/2,a+M/2),n.restore();return}switch(g){case"process":J(n,l,r,i,e,u,o,f);break;case"cycle":K(n,l,r,i,e,u,o,f);break;case"hierarchy":O(n,l,r,i,e,u,o,f);break;case"radial":Q(n,l,r,i,e,u,o,f);break;case"pyramid":U(n,l,r,i,e,u,o,f);break;case"funnel":Z(n,l,r,i,e,u,o,f);break;case"venn":_(n,l,r,i,e,u,o,f);break;case"matrix":w(n,l,r,i,e,u,o,f);break;case"list":q(n,l,r,i,e,u,o,f);break;case"relationship":C(n,l,r,i,e,u,o,f);break;default:x(n,l,r,i,e,u,o,f)}n.restore()}export{cn as renderSmartArt};
@@ -0,0 +1,11 @@
1
+ import{j as e,t as a,r as p,c as N}from"./index-N0lyyVVo.js";import{m as Se,t as Pe,T as Re,o as Le,p as le,q as qe,s as D,v as Fe,x as Oe,y as oe,z as Be,A as be,C as Ne,D as Ue,E as Ve,F as P,G as ke,I as ve,J as Ae,K as Ge,L as Ke,M as He,N as Qe,O as $e,Q as Je,R as We,S as Xe,U as Ye,V as Ze,W as ea,X as aa,Y as ta,Z as ia,_ as sa,$ as na,a0 as ra,a1 as la,a2 as da,a3 as ca,a4 as oa,a5 as ua}from"./index-BZYkm39z.js";import{c as we,u as M,h as _e,i as Ce,B as w,j as Me,k as Te,l as Ie,m as Q,n as ze,o as de,D as ma,a as xa,d as pa,e as ha,I as ne,X as ga,p as fa,q as $,r as ce,s as ye,S as Z}from"./error-boundary-DJAF_aYL.js";import{aI as ja,aJ as De,aK as ba,aL as va,aM as re}from"./conversation-input-sync-bgD4kyw3.js";import"./ui-preferences-store-C91RrpgH.js";import{B as ya}from"./building-2-Cupv31tS.js";import{H as Ba}from"./hash-BLfEUuGg.js";import"./console-mirror-CkCxHgcU.js";/**
2
+ * @license lucide-react v0.507.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Na=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],Ee=we("bell-off",Na);/**
7
+ * @license lucide-react v0.507.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const ka=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],wa=we("bell",ka),_a=({conversation:t,onNotifyChange:s,defaultOpen:n=!1})=>{M();const i=Se(t),r=i==="mute";return e.jsxs(_e,{defaultOpen:n,children:[e.jsx(Ce,{asChild:!0,children:e.jsx(w,{type:"button",size:"icon-sm",variant:"ghost","aria-label":a("ui.teamBridge.menu.label"),title:a("ui.teamBridge.menu.label"),children:e.jsx(ja,{size:16,"aria-hidden":"true"})})}),e.jsxs(Me,{align:"end",className:"w-60",children:[e.jsxs(Te,{onSelect:()=>s(Pe(i)),children:[r?e.jsx(wa,{size:16,"aria-hidden":"true"}):e.jsx(Ee,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:r?a("ui.teamBridge.menu.unmute"):a("ui.teamBridge.menu.mute")})]}),e.jsx(Ie,{}),e.jsx(Q,{children:a("ui.teamBridge.notify.label")}),e.jsx(ze,{value:i,"aria-label":a("ui.teamBridge.notify.label"),onValueChange:c=>s(Le(c)),children:Re.map(c=>e.jsx(de,{value:c.value,children:e.jsx("span",{className:"min-w-0 flex-1 truncate",children:a(c.labelKey)})},c.value))})]})]})},Ca=({open:t,seed:s,onClose:n,onCreate:i,pending:r=!1,error:c})=>{M();const[x,f]=p.useState("dm"),[j,h]=p.useState(""),[l,b]=p.useState([{account_id:"",kind:"human",display_label:"",rowId:crypto.randomUUID()}]),B=s?.accountId??"",m=s?.displayLabel??"";p.useEffect(()=>{t&&(f("dm"),h(""),b([{account_id:B,kind:"human",display_label:m,rowId:crypto.randomUUID()}]))},[t,B,m]);const v=(d,y)=>{b(k=>k.map((_,z)=>z===d?{..._,...y}:_))},I=l.some(d=>d.account_id.trim()&&d.display_label.trim())&&(x==="dm"||j.trim().length>0||x==="group");return e.jsx(ma,{open:t,onOpenChange:d=>{d||n()},children:e.jsxs(xa,{className:"gap-4",children:[e.jsx(pa,{children:a("ui.teamBridge.create.title")}),e.jsx(ha,{className:"sr-only",children:a("ui.teamBridge.page.subtitle")}),e.jsxs("fieldset",{className:"flex gap-1",children:[e.jsx("legend",{className:"sr-only",children:a("ui.teamBridge.create.title")}),["dm","group","channel"].map(d=>e.jsx(w,{type:"button",size:"sm",variant:x===d?"primary":"ghost",onClick:()=>f(d),children:a(`ui.teamBridge.kind.${d}`)},d))]}),x!=="dm"&&e.jsxs("span",{className:"flex flex-col gap-1 text-[13px] text-ink-muted",children:[a("ui.teamBridge.create.name"),e.jsx(ne,{value:j,onChange:d=>h(d.target.value),"aria-label":a("ui.teamBridge.create.name"),maxLength:128})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] text-ink-muted",children:a("ui.teamBridge.create.members")}),l.map((d,y)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{value:d.account_id,onChange:k=>v(y,{account_id:k.target.value}),placeholder:a("ui.teamBridge.create.account_placeholder"),"aria-label":a("ui.teamBridge.create.member_account"),className:"flex-1"}),e.jsx(ne,{value:d.display_label,onChange:k=>v(y,{display_label:k.target.value}),placeholder:a("ui.teamBridge.create.member_name"),"aria-label":a("ui.teamBridge.create.member_name"),maxLength:64,className:"flex-1"}),e.jsxs("select",{value:d.kind,onChange:k=>v(y,{kind:k.target.value}),"aria-label":a("ui.teamBridge.create.member_kind"),className:"h-8 rounded-md border border-hairline bg-surface px-1 text-[13px]",children:[e.jsx("option",{value:"human",children:a("ui.teamBridge.create.member_person")}),e.jsx("option",{value:"agent",children:a("ui.teamBridge.create.member_agent")})]}),e.jsx(w,{type:"button",size:"icon-sm",variant:"ghost","aria-label":a("ui.teamBridge.create.remove_member"),onClick:()=>b(k=>k.filter((_,z)=>z!==y)),children:e.jsx(ga,{size:14})})]},d.rowId)),e.jsxs(w,{type:"button",size:"sm",variant:"ghost",onClick:()=>b(d=>[...d,{account_id:"",kind:"human",display_label:"",rowId:crypto.randomUUID()}]),children:[e.jsx(le,{size:14}),a("ui.teamBridge.create.add_member")]})]}),c&&e.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:c}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(w,{type:"button",variant:"ghost",onClick:n,children:a("ui.teamBridge.create.cancel")}),e.jsx(w,{type:"button",variant:"primary",disabled:!I||r,onClick:()=>i({kind:x,...j.trim()?{name:j.trim()}:{},visibility:x==="channel"?"tenant":"private",agentCapable:l.some(d=>d.kind==="agent"),members:l.filter(d=>d.account_id.trim()&&d.display_label.trim())}),children:a("ui.teamBridge.create.confirm")})]})]})})},Ma=({organizations:t,scope:s,onScopeChange:n,totalUnread:i,membershipsLoading:r=!1,organizationsFailed:c=!1,defaultOpen:x=!1,onRetry:f})=>{M();const j=qe(t,s),h=s===D?a("ui.teamBridge.scope.all"):j?.name??a("ui.teamBridge.scope.unknown");return e.jsxs(_e,{defaultOpen:x,children:[e.jsx(Ce,{asChild:!0,children:e.jsxs("button",{type:"button","aria-label":a("ui.teamBridge.scope.trigger",{name:h}),title:h,className:N("group flex h-[30px] min-w-0 flex-1 items-center gap-2 rounded-md px-2","text-left text-[13px] text-ink transition-colors duration-fast","hover:bg-row-hover data-[state=open]:bg-row-hover"),children:[e.jsx(ya,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-muted"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:h}),e.jsx(fa,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim"})]})}),e.jsxs(Me,{align:"start",className:"w-64",children:[e.jsx(Q,{children:a("ui.teamBridge.scope.label")}),e.jsxs(ze,{value:s,onValueChange:l=>n(Fe(l)),children:[e.jsxs(de,{value:D,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:a("ui.teamBridge.scope.all")}),i>0&&e.jsx($,{variant:"attentionQuiet",size:"count","aria-label":a("ui.teamBridge.unread.count",{count:i}),title:a("ui.teamBridge.unread.count",{count:i}),children:ce(i,99)})]}),t.length>0&&e.jsx(Ie,{}),t.map(l=>e.jsxs(de,{value:l.tenantId,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:l.name}),e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim capitalize",children:l.role}),l.unread>0&&e.jsx($,{variant:"attentionQuiet",size:"count","aria-label":a("ui.teamBridge.unread.count",{count:l.unread}),title:a("ui.teamBridge.unread.count",{count:l.unread}),children:ce(l.unread,99)})]},l.tenantId))]}),r&&e.jsx(Q,{children:a("ui.teamBridge.scope.loading")}),!r&&c&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{children:a("ui.teamBridge.scope.error")}),f&&e.jsx(Te,{onSelect:()=>f(),children:a("ui.teamBridge.list.retry")})]}),!r&&!c&&t.length===0&&e.jsx(Q,{children:a("ui.teamBridge.scope.empty")})]})]})},Ta=({member:t,selfAccountId:s,identityKnown:n,listState:i,readOnly:r,existingDm:c,onOpenConversation:x,onComposeToPerson:f})=>{M();const j=p.useId(),h=n?ca(t,s):"unknown",l="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-left text-[13px]",b=e.jsx("span",{"aria-hidden":"true",className:N("flex size-5 shrink-0 items-center justify-center rounded-full bg-sunken text-[10px] font-medium",h==="unavailable"?"text-ink-disabled":"text-ink-muted"),children:oa(P(t))}),B=ua(t.role)&&h!=="self"?e.jsx("span",{className:"shrink-0 text-meta-sm capitalize text-ink-dim",children:t.role}):null;if(h==="self")return e.jsx("li",{children:e.jsxs("div",{className:N(l,"cursor-default text-ink-muted"),children:[b,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:a("ui.teamBridge.people.self")}),B]})});const m=h==="unavailable"?a("ui.teamBridge.people.bridge_off"):n?i==="loading"?a("ui.teamBridge.people.list_loading"):i==="error"?a("ui.teamBridge.people.list_error"):r&&!c?a("ui.teamBridge.read_only.person"):null:a("ui.teamBridge.people.identity_loading");if(m)return e.jsx("li",{children:e.jsxs("button",{type:"button","aria-disabled":"true","aria-describedby":j,title:m,className:N(l,"cursor-default",h==="unavailable"?"text-ink-disabled":"text-ink-muted"),children:[b,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:P(t)}),B,e.jsx("span",{id:j,className:"sr-only",children:m})]})});const v=h==="paused";return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>c?x(c.id):f?.(t),"aria-label":v?a("ui.teamBridge.people.message_paused",{name:P(t)}):a("ui.teamBridge.people.message",{name:P(t)}),className:N(l,"text-ink-muted transition-colors duration-fast ease-out-quart hover:bg-row-hover hover:text-ink"),children:[b,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:P(t)}),B,v&&e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim",children:a("ui.teamBridge.people.paused")})]})})},Ia=({error:t,onRetry:s})=>{M();const n=da(t),i=n==="sign_in"?a("ui.teamBridge.plan.sign_in_reason"):n==="plan"?a("ui.teamBridge.plan.reason"):n==="outdated"?a("ui.teamBridge.plan.update_reason"):a("ui.teamBridge.plan.unavailable_reason"),r=n==="unreachable"||n==="server";return e.jsxs("div",{className:"flex flex-col items-start gap-2 px-2 py-1",children:[e.jsx("p",{className:"text-[12px] leading-snug text-ink-muted",children:a("ui.teamBridge.people.error")}),e.jsx("p",{className:"text-[12px] leading-snug text-ink-dim",children:i}),r&&s&&e.jsx(w,{type:"button",size:"sm",variant:"outline",onClick:s,children:a("ui.teamBridge.list.retry")})]})},za=({scope:t,people:s,peopleState:n,peopleError:i,peopleIncomplete:r=!1,selfAccountId:c,identityKnown:x,listState:f,readOnly:j,conversations:h,onSelect:l,onRetry:b,onComposeToPerson:B})=>{M();const m=t===D;return e.jsxs("section",{"aria-labelledby":"team-bridge-people-heading",className:"px-1 pb-3",children:[e.jsx("h2",{id:"team-bridge-people-heading",className:"px-2 pb-1 pt-3 text-meta font-medium tracking-wide text-ink-dim",children:a("ui.teamBridge.people.title")}),m?e.jsx("p",{className:"px-2 py-1 text-[12px] leading-snug text-ink-dim",children:a("ui.teamBridge.people.all_scope")}):n==="loading"?e.jsx("div",{className:"flex h-[30px] items-center px-2",children:e.jsx(Z,{size:"sm",label:a("ui.teamBridge.people.loading")})}):n==="error"?e.jsx(Ia,{error:i,onRetry:b}):s.length===0&&r?e.jsx("p",{className:"px-2 py-1 text-[12px] leading-snug text-ink-muted",children:a("ui.teamBridge.people.error")}):s.length===0?e.jsx("p",{className:"px-2 py-1 text-[12px] leading-snug text-ink-dim",children:a("ui.teamBridge.people.empty")}):e.jsx("ul",{className:"flex flex-col",children:s.map(v=>e.jsx(Ta,{member:v,selfAccountId:c,identityKnown:x,listState:f,readOnly:j,existingDm:la(h,v.account_id,c),onOpenConversation:l,onComposeToPerson:B},v.account_id))})]})},Da=()=>(M(),e.jsx("div",{"data-glass-region":"canvas",className:"flex h-full min-h-0 w-full items-center justify-center overflow-hidden bg-canvas px-6",children:e.jsx(Z,{size:"sm",label:a("ui.teamBridge.plan.checking")})})),Ea=({reason:t})=>{M();const s={plan_required:{title:"ui.teamBridge.plan.title",reason:"ui.teamBridge.plan.reason"},signed_out:{title:"ui.teamBridge.plan.sign_in_title",reason:"ui.teamBridge.plan.sign_in_reason"},update_required:{title:"ui.teamBridge.plan.update_title",reason:"ui.teamBridge.plan.update_reason"},unavailable:{title:"ui.teamBridge.plan.unavailable_title",reason:"ui.teamBridge.plan.unavailable_reason"}};return e.jsx("div",{"data-glass-region":"canvas",className:"flex h-full min-h-0 w-full items-center justify-center overflow-hidden bg-canvas px-6",children:e.jsxs("div",{className:"max-w-lg text-center",children:[e.jsx(De,{size:20,"aria-hidden":"true",className:"mx-auto mb-3 text-ink-dim"}),e.jsx("h1",{className:"text-balance text-[16px] font-medium text-ink",children:a(s[t].title)}),e.jsxs("div",{className:"mt-2",children:[e.jsx("p",{className:"text-pretty text-[13px] leading-relaxed text-ink-muted",children:a("ui.teamBridge.plan.body")}),e.jsx("p",{className:"mt-4 text-[12px] leading-snug text-ink-dim",children:a(s[t].reason)})]})]})})},Sa=({conversation:t,selected:s,selfAccountId:n,organizationName:i,showOrganization:r,onSelect:c})=>{const x=M(),f=sa(t),j=f==="hash"?Ba:f==="users"?De:ra,h=Ne(t,n)??a("ui.teamBridge.list.untitled"),l=t.unread_count,b=oe(t),B=na(t),m=t.last_message_at?Pa(t.last_message_at,x):"";return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:c,"aria-current":s?"page":void 0,"data-conversation-id":t.id,"data-conversation-tenant":t.tenant_id,className:N("flex w-full items-center gap-2 rounded-md px-2 text-left","transition-colors duration-fast ease-out-quart",r?"min-h-[38px] py-1":"h-[30px]",s?"bg-row-selected text-ink":"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[e.jsx(j,{size:16,"aria-hidden":"true",className:"shrink-0"}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px]",children:h}),b&&e.jsx($,{variant:"attentionQuiet",className:"shrink-0",children:a("ui.teamBridge.preview.chip")}),B&&e.jsxs("span",{className:"shrink-0 text-ink-dim",title:a("ui.teamBridge.notify.muted"),children:[e.jsx(Ee,{size:12,"aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:a("ui.teamBridge.notify.muted")})]}),m&&!r&&e.jsx("span",{className:"min-w-0 truncate text-meta-sm text-ink-dim",children:m}),l>0&&e.jsx("span",{className:"ml-1 inline-flex shrink-0",children:e.jsx($,{variant:"attentionQuiet",shape:"pill",size:"count","aria-label":a("ui.teamBridge.unread.count",{count:l}),children:ce(l,99)})})]}),r&&e.jsxs("span",{className:"mt-0.5 flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"truncate rounded-sm border border-control bg-elevated px-1 text-meta-sm text-ink-dim",children:i??a("ui.teamBridge.scope.unknown")}),m&&e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim",children:m})]})]})]})})};function Pa(t,s){const n=Date.parse(t);if(Number.isNaN(n))return"";const i=Math.round((n-Date.now())/6e4);if(Math.abs(i)<60)return re(i,"minute",{numeric:"auto"},s);const r=Math.round(i/60);return Math.abs(r)<24?re(r,"hour",{numeric:"auto"},s):re(Math.round(r/24),"day",{numeric:"auto"},s)}const Ra=({message:t,selfAccountId:s})=>{const n=t.sender.account_id===s,i=t.sender.kind==="agent",r=new Date(t.created_at);return e.jsxs("li",{className:N("flex gap-2 px-1",n&&"flex-row-reverse text-right"),children:[e.jsx("span",{className:N("mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-full",i?"bg-accent-wash text-accent":"bg-sunken text-ink-muted"),"aria-hidden":"true",children:i?e.jsx(ke,{size:14}):t.sender.display_label[0]??"?"}),e.jsxs("div",{className:N("min-w-0 max-w-[min(72ch,80%)]",n&&"items-end"),children:[e.jsxs("div",{className:N("flex items-baseline gap-2 text-[12px] text-ink-dim",n&&"justify-end"),children:[e.jsx("span",{className:"truncate font-medium text-ink-muted",children:t.sender.display_label}),i&&e.jsx($,{variant:"accent",shape:"pill",size:"count",children:a("ui.teamBridge.member.agent")}),e.jsx("time",{dateTime:t.created_at,children:Number.isNaN(r.getTime())?"":r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})})]}),e.jsx("p",{className:N("mt-0.5 whitespace-pre-wrap break-words rounded-md text-[13px] leading-relaxed",n?"bg-accent-wash px-2.5 py-1.5 text-ink":"text-ink"),children:t.body??e.jsx("span",{className:"text-ink-dim italic",children:a("ui.teamBridge.thread.withheld")})})]})]})},La=({listState:t,messageState:s,conversations:n,selected:i,messages:r,organizations:c,scope:x,totalUnread:f,membershipsLoading:j=!1,organizationsFailed:h=!1,selfAccountId:l,sending:b=!1,sendFailed:B=!1,joining:m=!1,joinFailed:v=!1,notifyFailed:I=!1,onJoin:d,onNotifyChange:y,defaultMenuOpen:k=!1,initialDraft:_="",people:z=[],peopleState:R="ready",peopleError:ee,peopleIncomplete:E=!1,onRetryPeople:G,onComposeToPerson:J,eligibility:W=null,gatePending:O=!1,readOnly:u=!1,onSelect:X,onSend:U,onNewConversation:L,onRetry:V,onScopeChange:ae,onRetryMemberships:A})=>{M();const[q,F]=p.useState(_),g=p.useRef(null),C=p.useMemo(()=>Oe(r),[r]),S=x===D,te=i!==null&&oe(i),K=p.useMemo(()=>Be(n,x,c),[n,x,c]),ie=i?be(i,c):null,se=S&&i!==null&&ie===null,Y="team-bridge-create-hint",T=S||u,ue=T,me=u?a("ui.teamBridge.read_only.note"):a("ui.teamBridge.scope.create_needs_org");p.useEffect(()=>{g.current?.scrollIntoView({block:"end"})},[i?.id,C.length]);const H=p.useRef(null),xe=()=>{const o=q.trim();if(!o||b)return;const pe=H.current?.body===o?H.current.clientRef:crypto.randomUUID(),he={body:o,clientRef:pe};H.current=he;const ge=U(o,pe),fe=()=>{H.current===he&&(H.current=null),F(je=>je.trim()===o?"":je)};ge instanceof Promise?ge.then(fe).catch(()=>{}):fe()};return O?e.jsx(Da,{}):W?e.jsx(Ea,{reason:W}):e.jsxs("div",{"data-glass-region":"canvas",className:"flex h-full min-h-0 w-full overflow-hidden bg-canvas",children:[e.jsxs("aside",{"data-glass-region":"page-sidebar",className:"flex w-72 shrink-0 flex-col pt-[var(--panel-top-pad,0px)]",children:[e.jsx("h1",{className:"sr-only",children:a("ui.teamBridge.page.title")}),e.jsxs("header",{className:"flex h-11 shrink-0 items-center gap-2 px-3",children:[e.jsx(Ma,{organizations:c,scope:x,onScopeChange:ae,totalUnread:f,membershipsLoading:j,organizationsFailed:h,onRetry:A}),e.jsx(w,{size:"icon-sm",variant:"ghost","aria-label":a("ui.teamBridge.page.new_conversation"),"aria-disabled":T||void 0,"aria-describedby":ue?Y:void 0,className:T?"text-ink-disabled hover:bg-transparent":void 0,onClick:()=>{T||L()},children:e.jsx(le,{size:16})})]}),T&&(K.length>0||t!=="ready")&&e.jsx("p",{id:Y,className:"px-3 pb-2 text-[12px] text-ink-dim",children:me}),e.jsxs(ye,{className:"min-h-0 flex-1",children:[t==="loading"&&e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Z,{size:"sm",label:a("ui.teamBridge.list.loading")})}),t==="error"&&e.jsxs("div",{className:"flex flex-col items-start gap-2 px-3 py-6",children:[e.jsx("p",{className:"text-[13px] text-ink-muted",children:a("ui.teamBridge.list.error")}),V&&e.jsx(w,{size:"sm",variant:"outline",onClick:V,children:a("ui.teamBridge.list.retry")})]}),t==="ready"&&K.length>0&&e.jsx("ul",{className:"flex flex-col gap-0.5 px-1 pb-2",children:K.map(o=>e.jsx(Sa,{conversation:o,selected:i?.id===o.id,selfAccountId:l,showOrganization:S,organizationName:S?be(o,c):void 0,onSelect:()=>X(o.id)},o.id))}),e.jsx(za,{scope:x,people:z,peopleState:R,peopleError:ee,peopleIncomplete:E,selfAccountId:l,identityKnown:l!==void 0,listState:t,readOnly:u,conversations:n,onSelect:X,onRetry:G,onComposeToPerson:J})]})]}),e.jsx("section",{className:"flex min-w-0 flex-1 flex-col bg-surface pt-[var(--panel-top-pad,0px)]",children:i===null?t==="ready"?e.jsx("div",{className:"flex flex-1 items-center justify-center px-6",children:e.jsxs("div",{className:"max-w-sm text-center",children:[e.jsx("p",{className:"font-medium text-[13px] text-ink",children:a("ui.teamBridge.list.empty.title")}),e.jsx("p",{id:T&&t==="ready"&&K.length===0?Y:void 0,className:"mt-1 text-[13px] text-ink-muted",children:T&&t==="ready"&&K.length===0?me:a("ui.teamBridge.list.empty.body")}),e.jsxs(w,{size:"sm",variant:"primary",className:T?"mt-3 opacity-60":"mt-3","aria-disabled":T||void 0,"aria-describedby":ue?Y:void 0,onClick:()=>{T||L()},children:[e.jsx(le,{size:14}),a("ui.teamBridge.page.new_conversation")]})]})}):null:e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"flex h-11 shrink-0 items-center gap-2 px-3",children:[e.jsx("h2",{className:"min-w-0 truncate font-medium text-[13px] text-ink",children:Ne(i,l)??a("ui.teamBridge.list.untitled")}),S&&ie&&e.jsx("span",{className:"shrink-0 rounded-sm bg-elevated px-1.5 py-0.5 text-meta-sm text-ink-dim",children:ie}),e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim",children:a("ui.teamBridge.member.count",{count:Ue(i)})}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[Ve(i).filter(o=>o.state==="active").slice(0,6).map(o=>e.jsx("span",{className:N("flex size-5 items-center justify-center rounded-full text-[10px]",o.kind==="agent"?"bg-accent-wash text-accent":"bg-sunken text-ink-muted"),title:P(o),children:o.kind==="agent"?e.jsx(ke,{size:12,"aria-hidden":"true"}):P(o)[0]??"?"},`${o.kind}:${o.account_id}`)),!te&&!u&&y&&e.jsx(_a,{conversation:i,onNotifyChange:y,defaultOpen:k})]})]}),I&&e.jsx("p",{role:"alert",className:"px-3 pb-1 text-[12px] text-danger",children:a("ui.teamBridge.notify.error")}),e.jsx(ye,{className:"min-h-0 flex-1 [&_[data-radix-scroll-area-viewport]>div]:block [&_[data-radix-scroll-area-viewport]>div]:h-full",children:e.jsx("div",{className:"flex h-full flex-col",children:te?e.jsx(qa,{joining:m,joinFailed:v,readOnly:u,onJoin:d}):e.jsxs(e.Fragment,{children:[s==="loading"&&e.jsx("div",{className:"flex items-center justify-center py-10",children:e.jsx(Z,{size:"sm",label:a("ui.teamBridge.thread.loading")})}),s==="error"&&e.jsx("p",{className:"px-4 py-8 text-[13px] text-ink-muted",children:a("ui.teamBridge.thread.error")}),se&&e.jsx("p",{className:"px-4 py-8 text-[13px] text-ink-muted",children:a("ui.teamBridge.scope.thread_unknown")}),!se&&s==="ready"&&C.length===0&&e.jsx("p",{className:"px-4 py-10 text-center text-[13px] text-ink-muted",children:a("ui.teamBridge.thread.empty")}),!se&&s==="ready"&&C.length>0&&e.jsxs("ul",{className:"mt-auto flex flex-col gap-3 px-4 py-4",children:[C.map(o=>e.jsx(Ra,{message:o,selfAccountId:l},o.id)),e.jsx("div",{ref:g})]})]})})}),!te&&(u?e.jsx("p",{className:"shrink-0 px-5 pb-4 text-[12px] leading-snug text-ink-dim",children:a("ui.teamBridge.read_only.composer")}):e.jsxs("div",{className:"shrink-0 px-3 pb-3",children:[B&&e.jsx("p",{role:"alert",className:"px-2 pb-1 text-[12px] text-danger",children:a("ui.teamBridge.composer.error")}),e.jsxs("div",{className:N("rounded-xl bg-elevated","transition-colors duration-fast ease-out-quart","has-[textarea:focus-visible]:outline-solid has-[textarea:focus-visible]:outline-2","has-[textarea:focus-visible]:outline-accent has-[textarea:focus-visible]:outline-offset-2"),children:[e.jsx("textarea",{value:q,onChange:o=>F(o.target.value),onKeyDown:o=>{o.key==="Enter"&&!o.shiftKey&&!o.nativeEvent.isComposing&&(o.preventDefault(),xe())},rows:1,placeholder:a("ui.teamBridge.composer.placeholder"),"aria-label":a("ui.teamBridge.composer.placeholder"),className:N("block max-h-40 min-h-9 w-full resize-none bg-transparent px-3 pt-2.5 pb-1","text-[13px] text-ink placeholder:text-ink-dim","outline-none")}),e.jsxs("div",{className:"flex items-center gap-2 px-2 pb-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate pl-1 text-meta-sm text-ink-dim",children:a("ui.teamBridge.composer.hint")}),e.jsx(w,{size:"icon-sm",variant:"primary",className:"rounded-full",disabled:!q.trim()||b,"aria-label":a("ui.teamBridge.composer.send"),onClick:xe,children:e.jsx(ba,{size:16})})]})]})]}))]})})]})},qa=({joining:t=!1,joinFailed:s=!1,readOnly:n=!1,onJoin:i})=>(M(),e.jsx("div",{className:"flex flex-1 items-center justify-center px-6 py-10",children:e.jsxs("div",{className:"flex max-w-md flex-col items-center gap-3 text-center",children:[e.jsx("p",{className:"text-[13px] text-ink",children:a("ui.teamBridge.preview.banner")}),s&&e.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:a("ui.teamBridge.preview.join_error")}),n?e.jsx("p",{className:"text-[12px] leading-snug text-ink-dim",children:a("ui.teamBridge.read_only.note")}):e.jsx(w,{type:"button",size:"sm",variant:"primary",disabled:t,onClick:i,children:a("ui.teamBridge.preview.join")})]})})),Qa=()=>{const[t,s]=va(),n=t.get("conversation"),i=t.get("tenant"),[r,c]=p.useState(()=>i?ve(i):D),x=p.useRef(!!i),f=Ae(),j=f.data?Ge(f.data):null,h=f.isPending,l=!h&&j===null,b=f.data?.account_id??void 0,B=f.data?.read_only===!0,m=Ke({enabled:l}),v=He(l,D),I=p.useMemo(()=>Qe(m.memberships,v.data?.organizations),[m.memberships,v.data]),d=$e(r,l),y=Je(r===D?null:r,l),[k,_]=p.useState(null),[z,R]=p.useState(()=>n),[ee,E]=p.useState(!1),G=d.data?.conversations??[],J=r===D;p.useEffect(()=>{!n||!i||(x.current=!0,c(ve(i)),R(n),E(!1),s({},{replace:!0}))},[n,i,s]);const W=g=>{x.current=!0,c(g),R(null),E(!1),_(null)};p.useEffect(()=>{c(g=>We(I,g,x.current))},[I]);const O=p.useMemo(()=>Be(G,r,I),[G,r,I]);p.useEffect(()=>{z===null&&O.length>0&&R(O[0].id)},[O,z]);const u=O.find(g=>g.id===z)??null,X=u!==null&&oe(u),U=Xe(X?null:u?.id??null,u?.tenant_id,l),L=Ye(u?.id??"",u?.tenant_id),V=Ze(r===D?void 0:r),ae=ea(u?.id??"",u?.tenant_id),A=aa(u?.id??"",u?.tenant_id),q=ta();p.useEffect(()=>{L.reset(),A.reset(),q.reset()},[u?.id]);const F=U.data?.messages.reduce((g,C)=>g===void 0||C.seq>g?C.seq:g,void 0);return p.useEffect(()=>{u===null||F===void 0||F<=u.last_read_seq||ae.mutate({seq:F})},[u?.id,F]),e.jsxs(e.Fragment,{children:[e.jsx(La,{listState:d.isPending||J&&m.isLoading?"loading":d.isError||J&&m.isError?"error":"ready",messageState:u===null?"idle":U.isPending?"loading":U.isError?"error":"ready",conversations:G,selected:u,messages:U.data?.messages??[],organizations:I,scope:r,totalUnread:v.data?.total??0,membershipsLoading:m.isLoading,organizationsFailed:m.isError,selfAccountId:b,sending:L.isPending,sendFailed:L.isError,joining:A.isPending,joinFailed:A.isError,notifyFailed:ia(q,u?.id??null),onJoin:()=>A.mutate(),onNotifyChange:g=>{u!==null&&q.mutate({conversationId:u.id,tenantId:u.tenant_id,notify:g})},onSelect:R,onSend:(g,C)=>{if(u!==null)return L.mutateAsync({clientRef:C,body:g})},onNewConversation:()=>{B||(_(null),E(!0))},people:y.data?.members??[],peopleState:y.isPending?"loading":y.isError?"error":"ready",peopleError:y.error,peopleIncomplete:(y.data?.unavailable_count??0)>0,onRetryPeople:()=>{y.refetch()},onComposeToPerson:g=>{_({accountId:g.account_id,displayLabel:P(g)}),E(!0)},eligibility:j,gatePending:h,readOnly:B,onRetry:()=>{d.refetch(),m.isError&&m.refetch()},onScopeChange:W,onRetryMemberships:()=>{m.refetch()}}),e.jsx(Ca,{open:ee,seed:k,pending:V.isPending,error:V.isError?a("ui.teamBridge.create.error"):void 0,onClose:()=>{E(!1),_(null)},onCreate:g=>{V.mutate(g,{onSuccess:C=>{E(!1),_(null);const S=C;S.id&&R(S.id)}})}})]})};export{Ea as TeamBridgeEligibilityPanel,Qa as TeamBridgePage,La as TeamBridgePageView,qa as TeamBridgePreviewBanner};
@@ -1,4 +1,4 @@
1
- import{c as d,u as O,q as F}from"./error-boundary-DJAF_aYL.js";import{t as z,c as U,n as Q,b as N,g as B,e as V,h as S,i as C,j as D,a as v}from"./en-US-CHJkXXr4.js";import{j as i,c as p,t as c,r as P}from"./index-N0lyyVVo.js";import{bY as T,aJ as $,bZ as Y,aN as w,_ as Z,u as M,aO as A,aR as G,aP as q,bT as W,ap as J,ag as I,bU as X}from"./conversation-input-sync-bgD4kyw3.js";import{bx as ee,by as te,bz as ae,bA as ne,bB as se,bC as oe,bD as re,bE as E}from"./index-jVCAPb0a.js";import{B as ie}from"./book-open-yjstLkVS.js";import{b as ce,l as ue}from"./publication-validation-g2Kk53C8.js";/**
1
+ import{c as d,u as O,q as K}from"./error-boundary-DJAF_aYL.js";import{t as z,c as U,n as Q,b as N,g as B,e as V,h as S,i as C,j as D,a as v}from"./en-US-CHJkXXr4.js";import{j as i,c as p,t as c,r as P}from"./index-N0lyyVVo.js";import{bY as T,aJ as $,bZ as Y,aN as w,_ as Z,u as M,aO as A,aR as G,aP as q,bT as W,ap as J,ag as I,bU as X}from"./conversation-input-sync-bgD4kyw3.js";import{bz as ee,bA as te,bB as ae,bC as ne,bD as se,bE as oe,bF as re,bG as E}from"./index-BZYkm39z.js";import{B as ie}from"./book-open-yjstLkVS.js";import{b as ce,l as ue}from"./publication-validation-CCv7pQJH.js";/**
2
2
  * @license lucide-react v0.507.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -58,4 +58,4 @@ import{c as d,u as O,q as F}from"./error-boundary-DJAF_aYL.js";import{t as z,c a
58
58
  *
59
59
  * This source code is licensed under the ISC license.
60
60
  * See the LICENSE file in the root directory of this source tree.
61
- */const ve=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],qe=d("shopping-cart",ve);function Ie(e,t){const o=+z(e)-+z(t);return o<0?-1:o>0?1:o}function Le(e){return U(e,Date.now())}function Oe(e){return t=>{const a=(e?Math[e]:Math.trunc)(t);return a===0?0:a}}function Te(e,t,o){const a=B(),n=o?.locale??a.locale??V,s=Ie(e,t);if(isNaN(s))throw new RangeError("Invalid time value");const r=Object.assign({},o,{addSuffix:o?.addSuffix,comparison:s}),[m,y]=Q(o?.in,...s>0?[t,e]:[e,t]),h=Oe(o?.roundingMethod??"round"),b=y.getTime()-m.getTime(),g=b/v,K=N(y)-N(m),f=(b-K)/v,k=o?.unit;let u;if(k?u=k:g<1?u="second":g<60?u="minute":g<S?u="hour":f<C?u="day":f<D?u="month":u="year",u==="second"){const l=h(b/1e3);return n.formatDistance("xSeconds",l,r)}else if(u==="minute"){const l=h(g);return n.formatDistance("xMinutes",l,r)}else if(u==="hour"){const l=h(g/60);return n.formatDistance("xHours",l,r)}else if(u==="day"){const l=h(f/S);return n.formatDistance("xDays",l,r)}else if(u==="month"){const l=h(f/C);return l===12&&k!=="month"?n.formatDistance("xYears",1,r):n.formatDistance("xMonths",l,r)}else{const l=h(f/D);return n.formatDistance("xYears",l,r)}}function We(e,t){return Te(e,Le(e),t)}const $e={investment:{icon:i.jsx(de,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.investment")}},accounting:{icon:i.jsx(ie,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.accounting")}},healthcare:{icon:i.jsx(je,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.healthcare")}},legal:{icon:i.jsx(De,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.legal")}},software:{icon:i.jsx(Y,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.software")}},security:{icon:i.jsx(te,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.security")}},role_play:{icon:i.jsx($,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.role_play")}},personal_assistance:{icon:i.jsx(ee,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.personal_assistance")}},education:{icon:i.jsx(Ae,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.education")}},marketing:{icon:i.jsx(Se,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.marketing")}},sales:{icon:i.jsx(qe,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.sales")}},research:{icon:i.jsx(we,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.research")}},analysis:{icon:i.jsx(me,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.analysis")}},management:{icon:i.jsx(ge,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.management")}},social_media:{icon:i.jsx(pe,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.social_media")}},other:{icon:i.jsx(be,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.other")}}};function x(e){const t=e.split("_").join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}const Ee=e=>$e[e]??{icon:i.jsx(T,{size:14,"aria-hidden":"true"}),label:x(e)},L="inline-flex min-h-5.5 items-center rounded-full border border-hairline bg-sunken px-2 text-meta leading-none",Je=({tags:e,categories:t,className:o})=>{if(O(),(!e||e.length===0)&&(!t||t.length===0))return null;const a=new Set((t??[]).map(s=>x(s).toLowerCase())),n=(e??[]).filter(s=>!a.has(x(s).toLowerCase()));return i.jsxs("div",{className:p("relative flex flex-wrap items-center gap-1.5 overflow-hidden",o),"data-testid":"agent-tags-and-categories",children:[t?.map(s=>{const r=Ee(s);return i.jsxs("span",{className:p(L,"gap-1 font-medium text-ink-muted"),children:[r.icon,r.label]},s)}),n.map(s=>i.jsxs("span",{className:p(L,"gap-1 font-normal text-ink-dim"),children:[i.jsx(T,{size:12,"aria-hidden":"true"}),x(s)]},s))]})},Xe=({orgName:e,className:t})=>(O(),i.jsxs(F,{variant:"neutral",className:p("gap-1",t),"data-testid":"agent-org-badge",title:e?c("ui.hub.taxonomy.origin.named",{name:e}):c("ui.hub.taxonomy.origin.unnamed"),children:[i.jsx($,{"aria-hidden":"true"}),e??c("ui.hub.taxonomy.origin.organization")]})),He=new Set(["qa","ai","api","tui","ux","ui"]),H=/[._-]+/,et=e=>e.toLowerCase().replace(H," "),Re=e=>e.split(H).filter(Boolean).map(t=>He.has(t.toLowerCase())?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1)).join(" "),tt=e=>Re(e),_={all:["agent-statuses"],page:e=>[..._.all,"page",[...e]]},Ke=e=>[...new Set(e)].sort(),at=({agentIds:e,enabled:t=!0})=>{const{isAuthenticated:o}=w(),a=e.join(","),n=P.useMemo(()=>Ke(e),[a]),s=Z({queryKey:_.page(n),queryFn:async()=>(await ae(n)).result?.statuses??{},enabled:t&&o&&n.length>0,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,retry:!1});return{...s,statuses:s.data??{},isKnown:s.isSuccess}},nt=(e,t,o)=>o?e&&t[o]!==void 0:!1,R=(e,t,o)=>{e.setQueriesData({queryKey:_.all},a=>{if(!a)return a;const n=a[t]??{liked:!1,favourited:!1};return{...a,[t]:{...n,...o}}})},j=(e,{agentId:t,field:o,delta:a})=>{e.setQueriesData({queryKey:ce.all},n=>{if(!n)return n;const s=n.result?.records??[];return s.some(r=>r.id===t)?{...n,result:{...n.result,records:s.map(r=>r.id===t?{...r,[o]:Math.max(0,(r[o]??0)+a)}:r)}}:n})},st=()=>{const e=M(),{isAuthenticated:t}=w();return A({mutationFn:async({agentId:a,isCurrentlyFavourited:n})=>{if(!t)throw new Error("Authentication required to favourite/unfavourite an agent.");if(!a)throw new Error("Agent ID is required.");return n?(await ne(a),{favourited:!1,changed:!0}):{favourited:!0,changed:(await se(a)).result?.already_favourited!==!0}},onSuccess:({favourited:a,changed:n},s)=>{R(e,s.agentId,{favourited:a}),n&&j(e,{agentId:s.agentId,field:"favourite_count",delta:a?1:-1})}})},ot=()=>{const e=M(),{isAuthenticated:t}=w();return A({mutationFn:async({agentId:a,isCurrentlyLiked:n})=>{if(!t)throw new Error("Authentication required to like/unlike an agent.");if(!a)throw new Error("Agent ID is required.");return n?(await oe(a),{liked:!1,changed:!0}):{liked:!0,changed:(await re(a)).result?.already_liked!==!0}},onSuccess:({liked:a,changed:n},s)=>{R(e,s.agentId,{liked:a}),n&&j(e,{agentId:s.agentId,field:"like_count",delta:a?1:-1})}})},Fe=(e,t)=>{const o=[];for(const[,a]of e.getQueriesData({queryKey:E}))for(const n of a?.agents??[])n.id!==t&&o.push(n.name);return o},rt=()=>{const e=M(),t=G();return A({mutationFn:async({agentId:a})=>{if(!I.baseUrl)throw new Error("Local Operator API URL is not configured.");return X.downloadAgentFromRadient(I.baseUrl,a)},onSuccess:(a,n)=>{const s=a.result,r=s?.name?.trim()||n.agentName?.trim()||"Agent",m=s?.renamed_from?.trim()||null,y=s?.id?ue(r,Fe(e,s.id)):null;m?q(`Downloaded "${r}" — you already have an agent called "${m}".`):y?W(`Downloaded "${r}". You already have an agent called "${y}", so two agents now answer to that name and either may be picked. Rename one of them.`):q(`Downloaded "${r}" from the hub.`),e.invalidateQueries({queryKey:E}),j(e,{agentId:n.agentId,field:"download_count",delta:1}),a.result?.id?(J.getState().stageDraft({kind:"agent",name:r}),t("/chat")):console.warn("Downloaded agent ID not found in response, cannot navigate to chat.")}})};export{Je as A,$e as C,Ge as H,Xe as O,ot as a,st as b,rt as c,We as d,Ee as e,Te as f,tt as h,nt as i,et as n,at as u};
61
+ */const ve=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],qe=d("shopping-cart",ve);function Ie(e,t){const o=+z(e)-+z(t);return o<0?-1:o>0?1:o}function Le(e){return U(e,Date.now())}function Oe(e){return t=>{const a=(e?Math[e]:Math.trunc)(t);return a===0?0:a}}function Te(e,t,o){const a=B(),n=o?.locale??a.locale??V,s=Ie(e,t);if(isNaN(s))throw new RangeError("Invalid time value");const r=Object.assign({},o,{addSuffix:o?.addSuffix,comparison:s}),[m,y]=Q(o?.in,...s>0?[t,e]:[e,t]),h=Oe(o?.roundingMethod??"round"),b=y.getTime()-m.getTime(),g=b/v,F=N(y)-N(m),f=(b-F)/v,k=o?.unit;let u;if(k?u=k:g<1?u="second":g<60?u="minute":g<S?u="hour":f<C?u="day":f<D?u="month":u="year",u==="second"){const l=h(b/1e3);return n.formatDistance("xSeconds",l,r)}else if(u==="minute"){const l=h(g);return n.formatDistance("xMinutes",l,r)}else if(u==="hour"){const l=h(g/60);return n.formatDistance("xHours",l,r)}else if(u==="day"){const l=h(f/S);return n.formatDistance("xDays",l,r)}else if(u==="month"){const l=h(f/C);return l===12&&k!=="month"?n.formatDistance("xYears",1,r):n.formatDistance("xMonths",l,r)}else{const l=h(f/D);return n.formatDistance("xYears",l,r)}}function We(e,t){return Te(e,Le(e),t)}const $e={investment:{icon:i.jsx(de,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.investment")}},accounting:{icon:i.jsx(ie,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.accounting")}},healthcare:{icon:i.jsx(je,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.healthcare")}},legal:{icon:i.jsx(De,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.legal")}},software:{icon:i.jsx(Y,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.software")}},security:{icon:i.jsx(te,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.security")}},role_play:{icon:i.jsx($,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.role_play")}},personal_assistance:{icon:i.jsx(ee,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.personal_assistance")}},education:{icon:i.jsx(Ae,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.education")}},marketing:{icon:i.jsx(Se,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.marketing")}},sales:{icon:i.jsx(qe,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.sales")}},research:{icon:i.jsx(we,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.research")}},analysis:{icon:i.jsx(me,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.analysis")}},management:{icon:i.jsx(ge,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.management")}},social_media:{icon:i.jsx(pe,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.social_media")}},other:{icon:i.jsx(be,{size:14,"aria-hidden":"true"}),get label(){return c("ui.hub.taxonomy.category.other")}}};function x(e){const t=e.split("_").join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}const Ee=e=>$e[e]??{icon:i.jsx(T,{size:14,"aria-hidden":"true"}),label:x(e)},L="inline-flex min-h-5.5 items-center rounded-full border border-hairline bg-sunken px-2 text-meta leading-none",Je=({tags:e,categories:t,className:o})=>{if(O(),(!e||e.length===0)&&(!t||t.length===0))return null;const a=new Set((t??[]).map(s=>x(s).toLowerCase())),n=(e??[]).filter(s=>!a.has(x(s).toLowerCase()));return i.jsxs("div",{className:p("relative flex flex-wrap items-center gap-1.5 overflow-hidden",o),"data-testid":"agent-tags-and-categories",children:[t?.map(s=>{const r=Ee(s);return i.jsxs("span",{className:p(L,"gap-1 font-medium text-ink-muted"),children:[r.icon,r.label]},s)}),n.map(s=>i.jsxs("span",{className:p(L,"gap-1 font-normal text-ink-dim"),children:[i.jsx(T,{size:12,"aria-hidden":"true"}),x(s)]},s))]})},Xe=({orgName:e,className:t})=>(O(),i.jsxs(K,{variant:"neutral",className:p("gap-1",t),"data-testid":"agent-org-badge",title:e?c("ui.hub.taxonomy.origin.named",{name:e}):c("ui.hub.taxonomy.origin.unnamed"),children:[i.jsx($,{"aria-hidden":"true"}),e??c("ui.hub.taxonomy.origin.organization")]})),He=new Set(["qa","ai","api","tui","ux","ui"]),H=/[._-]+/,et=e=>e.toLowerCase().replace(H," "),Re=e=>e.split(H).filter(Boolean).map(t=>He.has(t.toLowerCase())?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1)).join(" "),tt=e=>Re(e),_={all:["agent-statuses"],page:e=>[..._.all,"page",[...e]]},Fe=e=>[...new Set(e)].sort(),at=({agentIds:e,enabled:t=!0})=>{const{isAuthenticated:o}=w(),a=e.join(","),n=P.useMemo(()=>Fe(e),[a]),s=Z({queryKey:_.page(n),queryFn:async()=>(await ae(n)).result?.statuses??{},enabled:t&&o&&n.length>0,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,retry:!1});return{...s,statuses:s.data??{},isKnown:s.isSuccess}},nt=(e,t,o)=>o?e&&t[o]!==void 0:!1,R=(e,t,o)=>{e.setQueriesData({queryKey:_.all},a=>{if(!a)return a;const n=a[t]??{liked:!1,favourited:!1};return{...a,[t]:{...n,...o}}})},j=(e,{agentId:t,field:o,delta:a})=>{e.setQueriesData({queryKey:ce.all},n=>{if(!n)return n;const s=n.result?.records??[];return s.some(r=>r.id===t)?{...n,result:{...n.result,records:s.map(r=>r.id===t?{...r,[o]:Math.max(0,(r[o]??0)+a)}:r)}}:n})},st=()=>{const e=M(),{isAuthenticated:t}=w();return A({mutationFn:async({agentId:a,isCurrentlyFavourited:n})=>{if(!t)throw new Error("Authentication required to favourite/unfavourite an agent.");if(!a)throw new Error("Agent ID is required.");return n?(await ne(a),{favourited:!1,changed:!0}):{favourited:!0,changed:(await se(a)).result?.already_favourited!==!0}},onSuccess:({favourited:a,changed:n},s)=>{R(e,s.agentId,{favourited:a}),n&&j(e,{agentId:s.agentId,field:"favourite_count",delta:a?1:-1})}})},ot=()=>{const e=M(),{isAuthenticated:t}=w();return A({mutationFn:async({agentId:a,isCurrentlyLiked:n})=>{if(!t)throw new Error("Authentication required to like/unlike an agent.");if(!a)throw new Error("Agent ID is required.");return n?(await oe(a),{liked:!1,changed:!0}):{liked:!0,changed:(await re(a)).result?.already_liked!==!0}},onSuccess:({liked:a,changed:n},s)=>{R(e,s.agentId,{liked:a}),n&&j(e,{agentId:s.agentId,field:"like_count",delta:a?1:-1})}})},Ke=(e,t)=>{const o=[];for(const[,a]of e.getQueriesData({queryKey:E}))for(const n of a?.agents??[])n.id!==t&&o.push(n.name);return o},rt=()=>{const e=M(),t=G();return A({mutationFn:async({agentId:a})=>{if(!I.baseUrl)throw new Error("Local Operator API URL is not configured.");return X.downloadAgentFromRadient(I.baseUrl,a)},onSuccess:(a,n)=>{const s=a.result,r=s?.name?.trim()||n.agentName?.trim()||"Agent",m=s?.renamed_from?.trim()||null,y=s?.id?ue(r,Ke(e,s.id)):null;m?q(`Downloaded "${r}" — you already have an agent called "${m}".`):y?W(`Downloaded "${r}". You already have an agent called "${y}", so two agents now answer to that name and either may be picked. Rename one of them.`):q(`Downloaded "${r}" from the hub.`),e.invalidateQueries({queryKey:E}),j(e,{agentId:n.agentId,field:"download_count",delta:1}),a.result?.id?(J.getState().stageDraft({kind:"agent",name:r}),t("/chat")):console.warn("Downloaded agent ID not found in response, cannot navigate to chat.")}})};export{Je as A,$e as C,Ge as H,Xe as O,ot as a,st as b,rt as c,We as d,Ee as e,Te as f,tt as h,nt as i,et as n,at as u};
@@ -41,7 +41,7 @@
41
41
  <meta http-equiv="Content-Security-Policy"
42
42
  content="default-src 'self'; connect-src 'self' http://localhost:1111 http://127.0.0.1:1111 http://localhost:8080 http://127.0.0.1:8080 https://api.radienthq.com https://us.i.posthog.com https://login.microsoftonline.com https://accounts.google.com; script-src 'self' https://us-assets.i.posthog.com https://accounts.google.com https://login.microsoftonline.com; style-src 'self' 'unsafe-inline' data:; img-src 'self' data: blob: http://localhost:1111 http://127.0.0.1:1111; media-src 'self' blob: http://localhost:1111 http://127.0.0.1:1111; font-src 'self' data:; frame-src 'self' data: blob: lo-supplement: http://localhost:1111 http://127.0.0.1:1111 https://accounts.google.com https://login.microsoftonline.com" />
43
43
  <meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin-allow-popups" />
44
- <script type="module" crossorigin src="./assets/index-jVCAPb0a.js"></script>
44
+ <script type="module" crossorigin src="./assets/index-BZYkm39z.js"></script>
45
45
  <link rel="modulepreload" crossorigin href="./assets/index-N0lyyVVo.js">
46
46
  <link rel="modulepreload" crossorigin href="./assets/ui-preferences-store-C91RrpgH.js">
47
47
  <link rel="modulepreload" crossorigin href="./assets/error-boundary-DJAF_aYL.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-operator-ui",
3
- "version": "0.38.0",
3
+ "version": "0.38.1",
4
4
  "productName": "Local Operator",
5
5
  "description": "User interface for AI agent assistants that run Python code safely on your device through an intuitive chat interface. Supports local and cloud LLM models with built-in security features.",
6
6
  "main": "./out/main/index.js",
@@ -1,11 +0,0 @@
1
- import{j as e,t as a,r as g,c as B}from"./index-N0lyyVVo.js";import{m as Ie,t as Se,T as De,o as Ee,p as ie,q as Pe,s as D,v as Re,x as Le,y as le,z as be,A as ge,C as ve,D as qe,E as Fe,F as ye,G as fe,I as Oe,J as Ue,K as Ve,L as Ae,M as Ge,N as He,O as Ke,Q as Qe,R as $e,S as Je,U as We,V as Xe,W as Ye,X as Ze,Y as ea,Z as aa,_ as ta,$ as sa,a0 as ia,a1 as na,a2 as ra,a3 as la}from"./index-jVCAPb0a.js";import{c as Be,u as T,h as Ne,i as ke,B as w,j as we,k as _e,l as Ce,m as Q,n as Me,o as ne,D as da,a as ca,d as oa,e as ma,I as te,X as ua,p as xa,q as $,r as re,s as je,S as Y}from"./error-boundary-DJAF_aYL.js";import{aI as pa,aJ as Te,aK as ha,aL as ga,aM as se}from"./conversation-input-sync-bgD4kyw3.js";import"./ui-preferences-store-C91RrpgH.js";import{B as fa}from"./building-2-Cupv31tS.js";import{H as ja}from"./hash-BLfEUuGg.js";import"./console-mirror-CkCxHgcU.js";/**
2
- * @license lucide-react v0.507.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const ba=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],ze=Be("bell-off",ba);/**
7
- * @license lucide-react v0.507.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const va=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],ya=Be("bell",va),Ba=({conversation:t,onNotifyChange:n,defaultOpen:l=!1})=>{T();const s=Ie(t),r=s==="mute";return e.jsxs(Ne,{defaultOpen:l,children:[e.jsx(ke,{asChild:!0,children:e.jsx(w,{type:"button",size:"icon-sm",variant:"ghost","aria-label":a("ui.teamBridge.menu.label"),title:a("ui.teamBridge.menu.label"),children:e.jsx(pa,{size:16,"aria-hidden":"true"})})}),e.jsxs(we,{align:"end",className:"w-60",children:[e.jsxs(_e,{onSelect:()=>n(Se(s)),children:[r?e.jsx(ya,{size:16,"aria-hidden":"true"}):e.jsx(ze,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:r?a("ui.teamBridge.menu.unmute"):a("ui.teamBridge.menu.mute")})]}),e.jsx(Ce,{}),e.jsx(Q,{children:a("ui.teamBridge.notify.label")}),e.jsx(Me,{value:s,"aria-label":a("ui.teamBridge.notify.label"),onValueChange:o=>n(Ee(o)),children:De.map(o=>e.jsx(ne,{value:o.value,children:e.jsx("span",{className:"min-w-0 flex-1 truncate",children:a(o.labelKey)})},o.value))})]})]})},Na=({open:t,seed:n,onClose:l,onCreate:s,pending:r=!1,error:o})=>{T();const[m,f]=g.useState("dm"),[j,x]=g.useState(""),[i,b]=g.useState([{account_id:"",kind:"human",display_label:"",rowId:crypto.randomUUID()}]),v=n?.accountId??"",p=n?.displayLabel??"";g.useEffect(()=>{t&&(f("dm"),x(""),b([{account_id:v,kind:"human",display_label:p,rowId:crypto.randomUUID()}]))},[t,v,p]);const k=(d,y)=>{b(N=>N.map((_,I)=>I===d?{..._,...y}:_))},z=i.some(d=>d.account_id.trim()&&d.display_label.trim())&&(m==="dm"||j.trim().length>0||m==="group");return e.jsx(da,{open:t,onOpenChange:d=>{d||l()},children:e.jsxs(ca,{className:"gap-4",children:[e.jsx(oa,{children:a("ui.teamBridge.create.title")}),e.jsx(ma,{className:"sr-only",children:a("ui.teamBridge.page.subtitle")}),e.jsxs("fieldset",{className:"flex gap-1",children:[e.jsx("legend",{className:"sr-only",children:a("ui.teamBridge.create.title")}),["dm","group","channel"].map(d=>e.jsx(w,{type:"button",size:"sm",variant:m===d?"primary":"ghost",onClick:()=>f(d),children:a(`ui.teamBridge.kind.${d}`)},d))]}),m!=="dm"&&e.jsxs("span",{className:"flex flex-col gap-1 text-[13px] text-ink-muted",children:[a("ui.teamBridge.create.name"),e.jsx(te,{value:j,onChange:d=>x(d.target.value),"aria-label":a("ui.teamBridge.create.name"),maxLength:128})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-[13px] text-ink-muted",children:a("ui.teamBridge.create.members")}),i.map((d,y)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(te,{value:d.account_id,onChange:N=>k(y,{account_id:N.target.value}),placeholder:a("ui.teamBridge.create.account_placeholder"),"aria-label":a("ui.teamBridge.create.member_account"),className:"flex-1"}),e.jsx(te,{value:d.display_label,onChange:N=>k(y,{display_label:N.target.value}),placeholder:a("ui.teamBridge.create.member_name"),"aria-label":a("ui.teamBridge.create.member_name"),maxLength:64,className:"flex-1"}),e.jsxs("select",{value:d.kind,onChange:N=>k(y,{kind:N.target.value}),"aria-label":a("ui.teamBridge.create.member_kind"),className:"h-8 rounded-md border border-hairline bg-surface px-1 text-[13px]",children:[e.jsx("option",{value:"human",children:a("ui.teamBridge.create.member_person")}),e.jsx("option",{value:"agent",children:a("ui.teamBridge.create.member_agent")})]}),e.jsx(w,{type:"button",size:"icon-sm",variant:"ghost","aria-label":a("ui.teamBridge.create.remove_member"),onClick:()=>b(N=>N.filter((_,I)=>I!==y)),children:e.jsx(ua,{size:14})})]},d.rowId)),e.jsxs(w,{type:"button",size:"sm",variant:"ghost",onClick:()=>b(d=>[...d,{account_id:"",kind:"human",display_label:"",rowId:crypto.randomUUID()}]),children:[e.jsx(ie,{size:14}),a("ui.teamBridge.create.add_member")]})]}),o&&e.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:o}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(w,{type:"button",variant:"ghost",onClick:l,children:a("ui.teamBridge.create.cancel")}),e.jsx(w,{type:"button",variant:"primary",disabled:!z||r,onClick:()=>s({kind:m,...j.trim()?{name:j.trim()}:{},visibility:m==="channel"?"tenant":"private",agentCapable:i.some(d=>d.kind==="agent"),members:i.filter(d=>d.account_id.trim()&&d.display_label.trim())}),children:a("ui.teamBridge.create.confirm")})]})]})})},ka=({organizations:t,scope:n,onScopeChange:l,totalUnread:s,membershipsLoading:r=!1,organizationsFailed:o=!1,defaultOpen:m=!1,onRetry:f})=>{T();const j=Pe(t,n),x=n===D?a("ui.teamBridge.scope.all"):j?.name??a("ui.teamBridge.scope.unknown");return e.jsxs(Ne,{defaultOpen:m,children:[e.jsx(ke,{asChild:!0,children:e.jsxs("button",{type:"button","aria-label":a("ui.teamBridge.scope.trigger",{name:x}),title:x,className:B("group flex h-[30px] min-w-0 flex-1 items-center gap-2 rounded-md px-2","text-left text-[13px] text-ink transition-colors duration-fast","hover:bg-row-hover data-[state=open]:bg-row-hover"),children:[e.jsx(fa,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-muted"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:x}),e.jsx(xa,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim"})]})}),e.jsxs(we,{align:"start",className:"w-64",children:[e.jsx(Q,{children:a("ui.teamBridge.scope.label")}),e.jsxs(Me,{value:n,onValueChange:i=>l(Re(i)),children:[e.jsxs(ne,{value:D,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:a("ui.teamBridge.scope.all")}),s>0&&e.jsx($,{variant:"attentionQuiet",size:"count","aria-label":a("ui.teamBridge.unread.count",{count:s}),title:a("ui.teamBridge.unread.count",{count:s}),children:re(s,99)})]}),t.length>0&&e.jsx(Ce,{}),t.map(i=>e.jsxs(ne,{value:i.tenantId,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:i.name}),e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim capitalize",children:i.role}),i.unread>0&&e.jsx($,{variant:"attentionQuiet",size:"count","aria-label":a("ui.teamBridge.unread.count",{count:i.unread}),title:a("ui.teamBridge.unread.count",{count:i.unread}),children:re(i.unread,99)})]},i.tenantId))]}),r&&e.jsx(Q,{children:a("ui.teamBridge.scope.loading")}),!r&&o&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{children:a("ui.teamBridge.scope.error")}),f&&e.jsx(_e,{onSelect:()=>f(),children:a("ui.teamBridge.list.retry")})]}),!r&&!o&&t.length===0&&e.jsx(Q,{children:a("ui.teamBridge.scope.empty")})]})]})},wa=({member:t,selfAccountId:n,identityKnown:l,listState:s,readOnly:r,existingDm:o,onOpenConversation:m,onComposeToPerson:f})=>{T();const j=g.useId(),x=l?na(t,n):"unknown",i="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-left text-[13px]",b=e.jsx("span",{"aria-hidden":"true",className:B("flex size-5 shrink-0 items-center justify-center rounded-full bg-sunken text-[10px] font-medium",x==="unavailable"?"text-ink-disabled":"text-ink-muted"),children:ra(t.display_label)}),v=la(t.role)&&x!=="self"?e.jsx("span",{className:"shrink-0 text-meta-sm capitalize text-ink-dim",children:t.role}):null;if(x==="self")return e.jsx("li",{children:e.jsxs("div",{className:B(i,"cursor-default text-ink-muted"),children:[b,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:a("ui.teamBridge.people.self")}),v]})});const p=x==="unavailable"?a("ui.teamBridge.people.bridge_off"):l?s==="loading"?a("ui.teamBridge.people.list_loading"):s==="error"?a("ui.teamBridge.people.list_error"):r&&!o?a("ui.teamBridge.read_only.person"):null:a("ui.teamBridge.people.identity_loading");if(p)return e.jsx("li",{children:e.jsxs("button",{type:"button","aria-disabled":"true","aria-describedby":j,title:p,className:B(i,"cursor-default",x==="unavailable"?"text-ink-disabled":"text-ink-muted"),children:[b,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.display_label}),v,e.jsx("span",{id:j,className:"sr-only",children:p})]})});const k=x==="paused";return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>o?m(o.id):f?.(t),"aria-label":k?a("ui.teamBridge.people.message_paused",{name:t.display_label}):a("ui.teamBridge.people.message",{name:t.display_label}),className:B(i,"text-ink-muted transition-colors duration-fast ease-out-quart hover:bg-row-hover hover:text-ink"),children:[b,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.display_label}),v,k&&e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim",children:a("ui.teamBridge.people.paused")})]})})},_a=({scope:t,people:n,peopleState:l,selfAccountId:s,identityKnown:r,listState:o,readOnly:m,conversations:f,onSelect:j,onRetry:x,onComposeToPerson:i})=>{T();const b=t===D;return e.jsxs("section",{"aria-labelledby":"team-bridge-people-heading",className:"px-1 pb-3",children:[e.jsx("h2",{id:"team-bridge-people-heading",className:"px-2 pb-1 pt-3 text-meta font-medium tracking-wide text-ink-dim",children:a("ui.teamBridge.people.title")}),b?e.jsx("p",{className:"px-2 py-1 text-[12px] leading-snug text-ink-dim",children:a("ui.teamBridge.people.all_scope")}):l==="loading"?e.jsx("div",{className:"flex h-[30px] items-center px-2",children:e.jsx(Y,{size:"sm",label:a("ui.teamBridge.people.loading")})}):l==="error"?e.jsxs("div",{className:"flex flex-col items-start gap-2 px-2 py-1",children:[e.jsx("p",{className:"text-[12px] leading-snug text-ink-muted",children:a("ui.teamBridge.people.error")}),x&&e.jsx(w,{type:"button",size:"sm",variant:"outline",onClick:x,children:a("ui.teamBridge.list.retry")})]}):n.length===0?e.jsx("p",{className:"px-2 py-1 text-[12px] leading-snug text-ink-dim",children:a("ui.teamBridge.people.empty")}):e.jsx("ul",{className:"flex flex-col",children:n.map(v=>e.jsx(wa,{member:v,selfAccountId:s,identityKnown:r,listState:o,readOnly:m,existingDm:ia(f,v.account_id,s),onOpenConversation:j,onComposeToPerson:i},v.account_id))})]})},Ca=()=>(T(),e.jsx("div",{"data-glass-region":"canvas",className:"flex h-full min-h-0 w-full items-center justify-center overflow-hidden bg-canvas px-6",children:e.jsx(Y,{size:"sm",label:a("ui.teamBridge.plan.checking")})})),Ma=({reason:t})=>{T();const n={plan_required:{title:"ui.teamBridge.plan.title",reason:"ui.teamBridge.plan.reason"},signed_out:{title:"ui.teamBridge.plan.sign_in_title",reason:"ui.teamBridge.plan.sign_in_reason"},update_required:{title:"ui.teamBridge.plan.update_title",reason:"ui.teamBridge.plan.update_reason"},unavailable:{title:"ui.teamBridge.plan.unavailable_title",reason:"ui.teamBridge.plan.unavailable_reason"}};return e.jsx("div",{"data-glass-region":"canvas",className:"flex h-full min-h-0 w-full items-center justify-center overflow-hidden bg-canvas px-6",children:e.jsxs("div",{className:"max-w-lg text-center",children:[e.jsx(Te,{size:20,"aria-hidden":"true",className:"mx-auto mb-3 text-ink-dim"}),e.jsx("h1",{className:"text-balance text-[16px] font-medium text-ink",children:a(n[t].title)}),e.jsxs("div",{className:"mt-2",children:[e.jsx("p",{className:"text-pretty text-[13px] leading-relaxed text-ink-muted",children:a("ui.teamBridge.plan.body")}),e.jsx("p",{className:"mt-4 text-[12px] leading-snug text-ink-dim",children:a(n[t].reason)})]})]})})},Ta=({conversation:t,selected:n,selfAccountId:l,organizationName:s,showOrganization:r,onSelect:o})=>{const m=T(),f=aa(t),j=f==="hash"?ja:f==="users"?Te:sa,x=ve(t,l)??a("ui.teamBridge.list.untitled"),i=t.unread_count,b=le(t),v=ta(t),p=t.last_message_at?za(t.last_message_at,m):"";return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:o,"aria-current":n?"page":void 0,"data-conversation-id":t.id,"data-conversation-tenant":t.tenant_id,className:B("flex w-full items-center gap-2 rounded-md px-2 text-left","transition-colors duration-fast ease-out-quart",r?"min-h-[38px] py-1":"h-[30px]",n?"bg-row-selected text-ink":"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[e.jsx(j,{size:16,"aria-hidden":"true",className:"shrink-0"}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px]",children:x}),b&&e.jsx($,{variant:"attentionQuiet",className:"shrink-0",children:a("ui.teamBridge.preview.chip")}),v&&e.jsxs("span",{className:"shrink-0 text-ink-dim",title:a("ui.teamBridge.notify.muted"),children:[e.jsx(ze,{size:12,"aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:a("ui.teamBridge.notify.muted")})]}),p&&!r&&e.jsx("span",{className:"min-w-0 truncate text-meta-sm text-ink-dim",children:p}),i>0&&e.jsx("span",{className:"ml-1 inline-flex shrink-0",children:e.jsx($,{variant:"attentionQuiet",shape:"pill",size:"count","aria-label":a("ui.teamBridge.unread.count",{count:i}),children:re(i,99)})})]}),r&&e.jsxs("span",{className:"mt-0.5 flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"truncate rounded-sm border border-control bg-elevated px-1 text-meta-sm text-ink-dim",children:s??a("ui.teamBridge.scope.unknown")}),p&&e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim",children:p})]})]})]})})};function za(t,n){const l=Date.parse(t);if(Number.isNaN(l))return"";const s=Math.round((l-Date.now())/6e4);if(Math.abs(s)<60)return se(s,"minute",{numeric:"auto"},n);const r=Math.round(s/60);return Math.abs(r)<24?se(r,"hour",{numeric:"auto"},n):se(Math.round(r/24),"day",{numeric:"auto"},n)}const Ia=({message:t,selfAccountId:n})=>{const l=t.sender.account_id===n,s=t.sender.kind==="agent",r=new Date(t.created_at);return e.jsxs("li",{className:B("flex gap-2 px-1",l&&"flex-row-reverse text-right"),children:[e.jsx("span",{className:B("mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-full",s?"bg-accent-wash text-accent":"bg-sunken text-ink-muted"),"aria-hidden":"true",children:s?e.jsx(ye,{size:14}):t.sender.display_label[0]??"?"}),e.jsxs("div",{className:B("min-w-0 max-w-[min(72ch,80%)]",l&&"items-end"),children:[e.jsxs("div",{className:B("flex items-baseline gap-2 text-[12px] text-ink-dim",l&&"justify-end"),children:[e.jsx("span",{className:"truncate font-medium text-ink-muted",children:t.sender.display_label}),s&&e.jsx($,{variant:"accent",shape:"pill",size:"count",children:a("ui.teamBridge.member.agent")}),e.jsx("time",{dateTime:t.created_at,children:Number.isNaN(r.getTime())?"":r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})})]}),e.jsx("p",{className:B("mt-0.5 whitespace-pre-wrap break-words rounded-md text-[13px] leading-relaxed",l?"bg-accent-wash px-2.5 py-1.5 text-ink":"text-ink"),children:t.body??e.jsx("span",{className:"text-ink-dim italic",children:a("ui.teamBridge.thread.withheld")})})]})]})},Sa=({listState:t,messageState:n,conversations:l,selected:s,messages:r,organizations:o,scope:m,totalUnread:f,membershipsLoading:j=!1,organizationsFailed:x=!1,selfAccountId:i,sending:b=!1,sendFailed:v=!1,joining:p=!1,joinFailed:k=!1,notifyFailed:z=!1,onJoin:d,onNotifyChange:y,defaultMenuOpen:N=!1,initialDraft:_="",people:I=[],peopleState:L="ready",onRetryPeople:Z,onComposeToPerson:E,eligibility:U=null,gatePending:J=!1,readOnly:P=!1,onSelect:q,onSend:h,onNewConversation:W,onRetry:F,onScopeChange:V,onRetryMemberships:G})=>{T();const[H,O]=g.useState(_),A=g.useRef(null),S=g.useMemo(()=>Le(r),[r]),u=m===D,C=s!==null&&le(s),R=g.useMemo(()=>be(l,m,o),[l,m,o]),ee=s?ge(s,o):null,ae=u&&s!==null&&ee===null,X="team-bridge-create-hint",M=u||P,de=M,ce=P?a("ui.teamBridge.read_only.note"):a("ui.teamBridge.scope.create_needs_org");g.useEffect(()=>{A.current?.scrollIntoView({block:"end"})},[s?.id,S.length]);const K=g.useRef(null),oe=()=>{const c=H.trim();if(!c||b)return;const me=K.current?.body===c?K.current.clientRef:crypto.randomUUID(),ue={body:c,clientRef:me};K.current=ue;const xe=h(c,me),pe=()=>{K.current===ue&&(K.current=null),O(he=>he.trim()===c?"":he)};xe instanceof Promise?xe.then(pe).catch(()=>{}):pe()};return J?e.jsx(Ca,{}):U?e.jsx(Ma,{reason:U}):e.jsxs("div",{"data-glass-region":"canvas",className:"flex h-full min-h-0 w-full overflow-hidden bg-canvas",children:[e.jsxs("aside",{"data-glass-region":"page-sidebar",className:"flex w-72 shrink-0 flex-col pt-[var(--panel-top-pad,0px)]",children:[e.jsx("h1",{className:"sr-only",children:a("ui.teamBridge.page.title")}),e.jsxs("header",{className:"flex h-11 shrink-0 items-center gap-2 px-3",children:[e.jsx(ka,{organizations:o,scope:m,onScopeChange:V,totalUnread:f,membershipsLoading:j,organizationsFailed:x,onRetry:G}),e.jsx(w,{size:"icon-sm",variant:"ghost","aria-label":a("ui.teamBridge.page.new_conversation"),"aria-disabled":M||void 0,"aria-describedby":de?X:void 0,className:M?"text-ink-disabled hover:bg-transparent":void 0,onClick:()=>{M||W()},children:e.jsx(ie,{size:16})})]}),M&&(R.length>0||t!=="ready")&&e.jsx("p",{id:X,className:"px-3 pb-2 text-[12px] text-ink-dim",children:ce}),e.jsxs(je,{className:"min-h-0 flex-1",children:[t==="loading"&&e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Y,{size:"sm",label:a("ui.teamBridge.list.loading")})}),t==="error"&&e.jsxs("div",{className:"flex flex-col items-start gap-2 px-3 py-6",children:[e.jsx("p",{className:"text-[13px] text-ink-muted",children:a("ui.teamBridge.list.error")}),F&&e.jsx(w,{size:"sm",variant:"outline",onClick:F,children:a("ui.teamBridge.list.retry")})]}),t==="ready"&&R.length>0&&e.jsx("ul",{className:"flex flex-col gap-0.5 px-1 pb-2",children:R.map(c=>e.jsx(Ta,{conversation:c,selected:s?.id===c.id,selfAccountId:i,showOrganization:u,organizationName:u?ge(c,o):void 0,onSelect:()=>q(c.id)},c.id))}),e.jsx(_a,{scope:m,people:I,peopleState:L,selfAccountId:i,identityKnown:i!==void 0,listState:t,readOnly:P,conversations:l,onSelect:q,onRetry:Z,onComposeToPerson:E})]})]}),e.jsx("section",{className:"flex min-w-0 flex-1 flex-col bg-surface pt-[var(--panel-top-pad,0px)]",children:s===null?t==="ready"?e.jsx("div",{className:"flex flex-1 items-center justify-center px-6",children:e.jsxs("div",{className:"max-w-sm text-center",children:[e.jsx("p",{className:"font-medium text-[13px] text-ink",children:a("ui.teamBridge.list.empty.title")}),e.jsx("p",{id:M&&t==="ready"&&R.length===0?X:void 0,className:"mt-1 text-[13px] text-ink-muted",children:M&&t==="ready"&&R.length===0?ce:a("ui.teamBridge.list.empty.body")}),e.jsxs(w,{size:"sm",variant:"primary",className:M?"mt-3 opacity-60":"mt-3","aria-disabled":M||void 0,"aria-describedby":de?X:void 0,onClick:()=>{M||W()},children:[e.jsx(ie,{size:14}),a("ui.teamBridge.page.new_conversation")]})]})}):null:e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"flex h-11 shrink-0 items-center gap-2 px-3",children:[e.jsx("h2",{className:"min-w-0 truncate font-medium text-[13px] text-ink",children:ve(s,i)??a("ui.teamBridge.list.untitled")}),u&&ee&&e.jsx("span",{className:"shrink-0 rounded-sm bg-elevated px-1.5 py-0.5 text-meta-sm text-ink-dim",children:ee}),e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim",children:a("ui.teamBridge.member.count",{count:qe(s)})}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[Fe(s).filter(c=>c.state==="active").slice(0,6).map(c=>e.jsx("span",{className:B("flex size-5 items-center justify-center rounded-full text-[10px]",c.kind==="agent"?"bg-accent-wash text-accent":"bg-sunken text-ink-muted"),title:c.display_label,children:c.kind==="agent"?e.jsx(ye,{size:12,"aria-hidden":"true"}):c.display_label[0]??"?"},`${c.kind}:${c.account_id}`)),!C&&!P&&y&&e.jsx(Ba,{conversation:s,onNotifyChange:y,defaultOpen:N})]})]}),z&&e.jsx("p",{role:"alert",className:"px-3 pb-1 text-[12px] text-danger",children:a("ui.teamBridge.notify.error")}),e.jsx(je,{className:"min-h-0 flex-1 [&_[data-radix-scroll-area-viewport]>div]:block [&_[data-radix-scroll-area-viewport]>div]:h-full",children:e.jsx("div",{className:"flex h-full flex-col",children:C?e.jsx(Da,{joining:p,joinFailed:k,readOnly:P,onJoin:d}):e.jsxs(e.Fragment,{children:[n==="loading"&&e.jsx("div",{className:"flex items-center justify-center py-10",children:e.jsx(Y,{size:"sm",label:a("ui.teamBridge.thread.loading")})}),n==="error"&&e.jsx("p",{className:"px-4 py-8 text-[13px] text-ink-muted",children:a("ui.teamBridge.thread.error")}),ae&&e.jsx("p",{className:"px-4 py-8 text-[13px] text-ink-muted",children:a("ui.teamBridge.scope.thread_unknown")}),!ae&&n==="ready"&&S.length===0&&e.jsx("p",{className:"px-4 py-10 text-center text-[13px] text-ink-muted",children:a("ui.teamBridge.thread.empty")}),!ae&&n==="ready"&&S.length>0&&e.jsxs("ul",{className:"mt-auto flex flex-col gap-3 px-4 py-4",children:[S.map(c=>e.jsx(Ia,{message:c,selfAccountId:i},c.id)),e.jsx("div",{ref:A})]})]})})}),!C&&(P?e.jsx("p",{className:"shrink-0 px-5 pb-4 text-[12px] leading-snug text-ink-dim",children:a("ui.teamBridge.read_only.composer")}):e.jsxs("div",{className:"shrink-0 px-3 pb-3",children:[v&&e.jsx("p",{role:"alert",className:"px-2 pb-1 text-[12px] text-danger",children:a("ui.teamBridge.composer.error")}),e.jsxs("div",{className:B("rounded-xl bg-elevated","transition-colors duration-fast ease-out-quart","has-[textarea:focus-visible]:outline-solid has-[textarea:focus-visible]:outline-2","has-[textarea:focus-visible]:outline-accent has-[textarea:focus-visible]:outline-offset-2"),children:[e.jsx("textarea",{value:H,onChange:c=>O(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&!c.nativeEvent.isComposing&&(c.preventDefault(),oe())},rows:1,placeholder:a("ui.teamBridge.composer.placeholder"),"aria-label":a("ui.teamBridge.composer.placeholder"),className:B("block max-h-40 min-h-9 w-full resize-none bg-transparent px-3 pt-2.5 pb-1","text-[13px] text-ink placeholder:text-ink-dim","outline-none")}),e.jsxs("div",{className:"flex items-center gap-2 px-2 pb-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate pl-1 text-meta-sm text-ink-dim",children:a("ui.teamBridge.composer.hint")}),e.jsx(w,{size:"icon-sm",variant:"primary",className:"rounded-full",disabled:!H.trim()||b,"aria-label":a("ui.teamBridge.composer.send"),onClick:oe,children:e.jsx(ha,{size:16})})]})]})]}))]})})]})},Da=({joining:t=!1,joinFailed:n=!1,readOnly:l=!1,onJoin:s})=>(T(),e.jsx("div",{className:"flex flex-1 items-center justify-center px-6 py-10",children:e.jsxs("div",{className:"flex max-w-md flex-col items-center gap-3 text-center",children:[e.jsx("p",{className:"text-[13px] text-ink",children:a("ui.teamBridge.preview.banner")}),n&&e.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:a("ui.teamBridge.preview.join_error")}),l?e.jsx("p",{className:"text-[12px] leading-snug text-ink-dim",children:a("ui.teamBridge.read_only.note")}):e.jsx(w,{type:"button",size:"sm",variant:"primary",disabled:t,onClick:s,children:a("ui.teamBridge.preview.join")})]})})),Va=()=>{const[t,n]=ga(),l=t.get("conversation"),s=t.get("tenant"),[r,o]=g.useState(()=>s?fe(s):D),m=g.useRef(!!s),f=Oe(),j=f.data?Ue(f.data):null,x=f.isPending,i=!x&&j===null,b=f.data?.account_id??void 0,v=f.data?.read_only===!0,p=Ve({enabled:i}),k=Ae(i,D),z=g.useMemo(()=>Ge(p.memberships,k.data?.organizations),[p.memberships,k.data]),d=He(r,i),y=Ke(r===D?null:r,i),[N,_]=g.useState(null),[I,L]=g.useState(()=>l),[Z,E]=g.useState(!1),U=d.data?.conversations??[],J=r===D;g.useEffect(()=>{!l||!s||(m.current=!0,o(fe(s)),L(l),E(!1),n({},{replace:!0}))},[l,s,n]);const P=u=>{m.current=!0,o(u),L(null),E(!1),_(null)};g.useEffect(()=>{o(u=>Qe(z,u,m.current))},[z]);const q=g.useMemo(()=>be(U,r,z),[U,r,z]);g.useEffect(()=>{I===null&&q.length>0&&L(q[0].id)},[q,I]);const h=q.find(u=>u.id===I)??null,W=h!==null&&le(h),F=$e(W?null:h?.id??null,h?.tenant_id,i),V=Je(h?.id??"",h?.tenant_id),G=We(r===D?void 0:r),H=Xe(h?.id??"",h?.tenant_id),O=Ye(h?.id??"",h?.tenant_id),A=Ze();g.useEffect(()=>{V.reset(),O.reset(),A.reset()},[h?.id]);const S=F.data?.messages.reduce((u,C)=>u===void 0||C.seq>u?C.seq:u,void 0);return g.useEffect(()=>{h===null||S===void 0||S<=h.last_read_seq||H.mutate({seq:S})},[h?.id,S]),e.jsxs(e.Fragment,{children:[e.jsx(Sa,{listState:d.isPending||J&&p.isLoading?"loading":d.isError||J&&p.isError?"error":"ready",messageState:h===null?"idle":F.isPending?"loading":F.isError?"error":"ready",conversations:U,selected:h,messages:F.data?.messages??[],organizations:z,scope:r,totalUnread:k.data?.total??0,membershipsLoading:p.isLoading,organizationsFailed:p.isError,selfAccountId:b,sending:V.isPending,sendFailed:V.isError,joining:O.isPending,joinFailed:O.isError,notifyFailed:ea(A,h?.id??null),onJoin:()=>O.mutate(),onNotifyChange:u=>{h!==null&&A.mutate({conversationId:h.id,tenantId:h.tenant_id,notify:u})},onSelect:L,onSend:(u,C)=>{if(h!==null)return V.mutateAsync({clientRef:C,body:u})},onNewConversation:()=>{v||(_(null),E(!0))},people:y.data?.members??[],peopleState:y.isPending?"loading":y.isError?"error":"ready",onRetryPeople:()=>{y.refetch()},onComposeToPerson:u=>{_({accountId:u.account_id,displayLabel:u.display_label}),E(!0)},eligibility:j,gatePending:x,readOnly:v,onRetry:()=>{d.refetch(),p.isError&&p.refetch()},onScopeChange:P,onRetryMemberships:()=>{p.refetch()}}),e.jsx(Na,{open:Z,seed:N,pending:G.isPending,error:G.isError?a("ui.teamBridge.create.error"):void 0,onClose:()=>{E(!1),_(null)},onCreate:u=>{G.mutate(u,{onSuccess:C=>{E(!1),_(null);const R=C;R.id&&L(R.id)}})}})]})};export{Ma as TeamBridgeEligibilityPanel,Va as TeamBridgePage,Sa as TeamBridgePageView,Da as TeamBridgePreviewBanner};