local-operator-ui 0.48.5 → 0.48.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/renderer/assets/{agent-details-page-zCxYkFNQ.js → agent-details-page-GgPrfShb.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-Cu0a6aRJ.js → agent-hub-page-I3usSiHV.js} +1 -1
- package/out/renderer/assets/{agents-page-Cdvz8Ecb.js → agents-page-CPmGITp-.js} +3 -3
- package/out/renderer/assets/{avatar-cropper-BV9pfbSJ.js → avatar-cropper-rj_RKIQ7.js} +1 -1
- package/out/renderer/assets/{browser-page-BXHeGHJF.js → browser-page-vBYBpre2.js} +1 -1
- package/out/renderer/assets/{browser-webauthn-prompt-hBFTXi1F.js → browser-webauthn-prompt-DoeLZVK4.js} +1 -1
- package/out/renderer/assets/{index-ClKLYxFA.js → index-g9YfuNnq.js} +2 -2
- package/out/renderer/assets/{legacy-agents-page-C3fCx_4w.js → legacy-agents-page-1XoFBEfI.js} +1 -1
- package/out/renderer/assets/{library-page-BWTRx0RD.js → library-page-DFppe9y9.js} +3 -3
- package/out/renderer/assets/{mesh-page-nF_pkDfu.js → mesh-page-DDeC6bgp.js} +1 -1
- package/out/renderer/assets/{notifications-page-BrfQXjv0.js → notifications-page-D8I_jYw4.js} +1 -1
- package/out/renderer/assets/{org-access-4sUREjsN.js → org-access-B6SvzUGe.js} +1 -1
- package/out/renderer/assets/{projects-page-Ce1Ncgqc.js → projects-page-DsCBgv8z.js} +1 -1
- package/out/renderer/assets/{publication-validation-BJvhF9QM.js → publication-validation-DKoWY6xP.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-89F5YrRW.js → radient-auth-buttons-Czd77Wbr.js} +1 -1
- package/out/renderer/assets/{schedules-page-CxGBhfL5.js → schedules-page-C81U8QbW.js} +1 -1
- package/out/renderer/assets/{settings-page-DJ0aFYTv.js → settings-page-VMRgQhMG.js} +1 -1
- package/out/renderer/assets/{smartart-DWwS7qRw.js → smartart-D9TxE6Dt.js} +1 -1
- package/out/renderer/assets/{team-bridge-page-DD1d63nj.js → team-bridge-page-DwnuFW0r.js} +17 -17
- package/out/renderer/assets/{team-bridge-scope-preference-D3OA1yyw.js → team-bridge-scope-preference-BjBvsZwt.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-DmsgPFVR.js → use-download-agent-mutation-DqhxA2wI.js} +1 -1
- package/out/renderer/index.html +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,j as s,c as R}from"./index-CW7JpbBx.js";import{y as z,z as G,D as J,E as Y,G as C,H as K,I as V,J as O,K as U,L as X,M as Z,O as ee,Q as E,T as ie}from"./index-ClKLYxFA.js";import{u as j,B as g,h as te,n as se,o as ae,y as ne,p as le,z as re,F as ue}from"./error-boundary-OwA_uKkY.js";import{t as l}from"./messages-DjcNNMrL.js";import{h as w,u as y,a as M,c as F,r as B,d as I,F as D,G as oe}from"./path-utils-D8EGhun0.js";import{bA as Q,b7 as m,bu as P}from"./conversation-input-sync-CA-NlH9A.js";const _=e=>e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2),ce={available:"border-hairline",updating:"border-hairline",applied:"border-hairline",review:"border-warning-border",failed:"border-danger-border"};function de(e){const i=[];for(const t of e??[])for(const n of t.fields??[])for(const a of n.regions??[])(a.provenance==="unresolved"||_(a.local)!==_(a.remote))&&i.push({field:n.field,region:a});return i}function be({regions:e}){return j(),e.length?s.jsx("ul",{className:"space-y-3","data-testid":"hub-update-preview",children:e.map(({field:i,region:t},n)=>s.jsxs("li",{className:"space-y-1 text-meta",children:[s.jsx("p",{className:"font-medium text-ink",children:t.heading||t.name||i}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-ink-muted",children:l("ui.agents.navigation.updates.preview.local")}),s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded-sm border border-hairline p-2 text-ink",children:_(t.local)||l("ui.agents.navigation.updates.preview.nothing")})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-ink-muted",children:l("ui.agents.navigation.updates.preview.remote")}),s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded-sm border border-hairline p-2 text-ink",children:_(t.remote)||l("ui.agents.navigation.updates.preview.nothing")})]})]})]},`${i}:${t.id??n}`))}):s.jsx("p",{className:"text-meta text-ink-muted",children:l("ui.agents.navigation.updates.preview.empty")})}function Ee({kind:e,name:i,enabled:t}){j();const n=z(t),a=G(),[d,b]=v.useState(null),h=Y(e,i),k=J(n.data).get(h),o=C(k),c=a.notes[h],r=a.pending.has(h);if(!k||!o)return c?s.jsx("section",{"data-testid":"hub-update-panel","aria-label":l("ui.agents.navigation.updates.accessible"),className:"mb-8 rounded-md border border-hairline p-3 text-body-sm",children:s.jsx("p",{role:c.tone==="error"?"alert":"status",className:c.tone==="error"?"text-danger":"text-ink",children:c.message})}):null;const p=o.kind==="review",u=k.classification==="baseline-unknown",f=q=>({prefer:q,acknowledgeUnknownBaseline:u}),$=async()=>{const q=await a.applyItem(e,i,{...f(),dryRun:!0});b(q??[])};return s.jsxs("section",{"data-testid":"hub-update-panel","aria-label":l("ui.agents.navigation.updates.accessible"),className:R("mb-8 space-y-2 rounded-md border p-3 text-body-sm",ce[o.kind]),children:[s.jsxs("p",{className:"flex items-start gap-2 text-ink",children:[s.jsx(K,{mark:o,className:"mt-0.5"}),s.jsx("span",{className:R(o.kind==="failed"&&"text-danger"),children:V(k,o)})]}),a.upgradeMessage&&s.jsx("output",{className:"block text-meta text-warning","data-hub-core-upgrade":!0,children:a.upgradeMessage}),p&&u&&s.jsx("p",{className:"text-meta text-ink-muted",children:l("ui.agents.navigation.updates.baseline_unknown")}),p&&!u&&s.jsx("p",{className:"text-meta text-ink-muted",children:l("ui.agents.navigation.updates.merge_guidance")}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.kind==="available"&&s.jsx(g,{size:"sm",variant:"outline","aria-disabled":r||!a.canWrite||void 0,onClick:()=>!r&&a.canWrite&&void a.applyItem(e,i),children:r?l("ui.agents.navigation.updates.action.updating"):l("ui.agents.navigation.updates.action.update")}),o.kind==="failed"&&o.retryable&&s.jsx(g,{size:"sm",variant:"outline","aria-disabled":r||!a.canWrite||void 0,onClick:()=>!r&&a.canWrite&&void a.retryItem(e,i),children:r?l("ui.agents.navigation.updates.action.retrying"):l("ui.agents.navigation.updates.action.retry")}),p&&s.jsxs(s.Fragment,{children:[s.jsx(g,{size:"sm",variant:"outline","aria-disabled":r||!a.canWrite||void 0,onClick:()=>!r&&a.canWrite&&void $(),children:r&&!d?l("ui.agents.navigation.updates.action.loading"):l("ui.agents.navigation.updates.action.preview")}),s.jsx(g,{size:"sm",variant:"ghost","aria-disabled":r||!a.canWrite||void 0,onClick:()=>!r&&a.canWrite&&void a.applyItem(e,i,f("local")),children:l("ui.agents.navigation.updates.action.keep_local")}),s.jsx(g,{size:"sm",variant:"ghost","aria-disabled":r||!a.canWrite||void 0,onClick:()=>!r&&a.canWrite&&void a.applyItem(e,i,f("remote")),children:l("ui.agents.navigation.updates.action.use_remote")})]})]}),d&&p&&s.jsx(be,{regions:de(d)}),c&&s.jsx("p",{role:c.tone==="error"?"alert":"status",className:c.tone==="error"?"text-meta text-danger":"text-meta text-ink-muted",children:c.message})]})}const pe=/\/+$/;function W(e){const i=e.replace(pe,"");try{const{pathname:t}=new URL(i);return t===""||t==="/"?`${i}/v1`:i}catch{return`${i}/v1`}}const Fe=e=>e?.skills===1&&e.revision_cas===1;function he(e,i=1,t=20){const n=new URL(O(e,"skills"));return n.searchParams.set("page",String(i)),n.searchParams.set("per_page",String(t)),U(n.toString())}function me(e,i){return U(O(e,"skills",i))}function ke(e){return Q({operation:"org_skills.list",tenantId:e})}function ge(e,i){return Q({operation:"org_skill.get",tenantId:e,skillId:i})}const fe=12,S={all:["public-teams"],list:(e,i)=>[...S.all,"list",{page:e,perPage:i}],detail:e=>[...S.all,"detail",e]},N=(e,i)=>i instanceof X?i.status===null?!1:i.status>=500&&e<1:e<1,Te=({page:e=1,perPage:i=fe,enabled:t=!0}={})=>{const n=w({queryKey:S.list(e,i),queryFn:()=>Z(m.radientBaseUrl,e,i),select:a=>a.result,enabled:t,retry:N,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,placeholderData:a=>a});return{...n,teams:n.data?.records??[],isRefreshing:n.isFetching&&n.data!==void 0,pagination:n.data?{page:n.data.page,perPage:n.data.per_page,totalPages:n.data.total_pages,totalRecords:n.data.total_records}:void 0}},Ae=({teamId:e,enabled:i=!0})=>{const t=w({queryKey:S.detail(e??""),queryFn:()=>ee(m.radientBaseUrl,e),select:n=>n.result,enabled:i&&!!e,retry:N,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,retryOnMount:!1});return{...t,team:t.data}};function x(e){if(e.getQueryState(D.capabilities)?.status!=="success"||!F(e.getQueryData(D.capabilities),"hub_skills"))throw new Error("This backend does not support the complete Hub Skills adapter.")}function De(e,i,t){const n=y(),a=M();return w({queryKey:["hub-skills",m.radientBaseUrl,e.visibility,e.tenantId,i],enabled:t&&!a.isError&&F(a.data,"hub_skills"),queryFn:async()=>{if(x(n),e.visibility==="org"){const b=(await ke(e.tenantId)).result;return{rows:b.skills,pages:1,total:b.skills.length,contract:b.sync_contract}}const d=(await he(m.radientBaseUrl,i,20)).result;return{rows:d.records,pages:d.total_pages,total:d.total_records,contract:d.sync_contract}},staleTime:3e4,retry:e.visibility==="org"?B:N,retryOnMount:!1,refetchOnWindowFocus:!1})}function He(e,i,t){const n=y(),a=M();return w({queryKey:["hub-skill",m.radientBaseUrl,e.visibility,e.tenantId,i],enabled:t&&i!==null&&!a.isError&&F(a.data,"hub_skills"),queryFn:async()=>(x(n),(e.visibility==="org"?await ge(e.tenantId,i):await me(m.radientBaseUrl,i)).result),staleTime:3e4,retry:e.visibility==="org"?B:N,retryOnMount:!1})}function T(e,i){e.setQueryData(E,i.links)}function A(e){e.invalidateQueries({queryKey:E}),e.invalidateQueries({queryKey:["desktop","skills"]})}function Ce(e={}){const i=y();return P({...e.retry===void 0?{}:{retry:e.retry},mutationFn:t=>(x(i),I({op:"hub.skillPull",requestId:t.requestId,hubId:t.remoteId,hubSource:W(m.radientBaseUrl),visibility:t.scope.visibility,tenantId:t.scope.tenantId,localAlias:t.alias,subscribe:t.subscribe,autoPush:t.autoPush,confirmPublicEgress:t.consent})),onSuccess:t=>{T(i,t)},onSettled:()=>{A(i)}})}function Ke(){const e=y();return P({mutationFn:i=>(x(e),I({op:"hub.skillSubscribe",requestId:i.requestId,hubId:i.remoteId,hubSource:W(m.radientBaseUrl),visibility:i.scope.visibility,tenantId:i.scope.tenantId,localAlias:i.alias})),onSuccess:i=>{T(e,i)},onSettled:()=>{A(e)}})}function Oe(){const e=y();return P({mutationFn:i=>(x(e),I({op:"hub.skillUnpull",requestId:i.requestId,linkId:i.linkId})),onSuccess:i=>{T(e,i)},onSettled:()=>{A(e)}})}function Ue(){const e=y();return P({mutationFn:i=>(x(e),I({op:"hub.skillPublish",requestId:i.requestId,...i.draft,dryRun:i.previewReceipt===void 0,...i.previewReceipt?{previewReceipt:i.previewReceipt,confirmPublish:!0}:{}})),onSuccess:i=>{i.local_link_receipt?.state==="complete"&&(e.invalidateQueries({queryKey:E}),e.invalidateQueries({queryKey:["desktop","skills"]}),e.invalidateQueries({queryKey:["hub-skills"]}))}})}const ye=/\/+$/;function H(e){return e.replace(ye,"")}function Me(e,i){return i.visibility==="public"?e.visibility==="public"&&!e.tenant_id:e.visibility==="org"&&e.tenant_id===i.tenantId}function xe(e){const i=e.id??e.hub_id??"",t=e.tenantId??e.tenant_id??"";return`${i}\0${e.visibility}\0${t}`}function Be(e,i){const t=H(i),n=new Map;for(const a of e??[])a.kind==="skill"&&H(a.hub_source)===t&&n.set(xe({hub_id:a.hub_id,visibility:a.visibility,tenantId:a.tenant_id}),a);return n}function Qe(e,i,t=!0){if(!t)return{kind:"unknown"};if(!e)return{kind:"not-present"};const n=ie(e);return n==="present"&&(e.pull.state==="available"||i?.state==="available"&&!i.error_class)?{kind:"update",link:e,automatic:i?.auto_will_apply===!0||e.auto_will_apply}:n==="absent"?e.policy.subscribe?{kind:"subscribed",link:e}:{kind:"detached",link:e}:e.policy.subscribe?{kind:"pulled",link:e}:{kind:"manual",link:e}}function We(e){return e?"policy":"create"}function Le(e){return JSON.stringify({op:"pull",selected:e.selected,scope:e.scope,localAlias:e.localAlias,subscribe:e.subscribe,autoPush:e.autoPush,consent:e.consent})}const ve={available:"text-accent",applied:"text-success",failed:"text-danger",review:"text-warning",updating:"text-ink-muted"},_e={available:"ui.hub.skills.update_available",applied:"ui.hub.skills.update_applied",failed:"ui.hub.skills.update_failed",review:"ui.hub.links.mark_review",updating:"ui.hub.links.mark_busy"},Se={"not-present":"ui.hub.skills.not_downloaded",subscribed:"ui.hub.skills.subscribed_absent",pulled:"ui.hub.skills.pulled",manual:"ui.hub.skills.manual",detached:"ui.hub.skills.detached"};function $e(e,i,t){const n=i?C(i):null;return n&&(e.kind==="update"||t&&(i?.state==="applied"||i?.state==="failed"||i?.error_class))?n:e.kind==="update"?{kind:"available",auto:e.automatic}:null}function ze(e,i){return e.kind==="unknown"?i:e.kind!=="update"?l(Se[e.kind]):l(e.link.policy.subscribe?"ui.hub.skills.pulled":"ui.hub.skills.manual")}function Ge({mark:e,className:i,labels:t}){return j(),e?s.jsxs("span",{"data-hub-mark-state":e.kind,className:R("flex shrink-0 items-center gap-1 text-meta",ve[e.kind],i),children:[s.jsx(K,{mark:e}),s.jsx("span",{children:l(t?.[e.kind]??_e[e.kind])})]}):null}const Je=()=>({subscribe:!0,autoPush:!1,confirmPublicEgress:!1});function Ye({value:e,onChange:i,source:t,item:n,visibility:a,organization:d,destinationKey:b,canEnableAutoPush:h,disabled:k=!1}){j();const o=v.useId(),c=v.useRef(null),[r,p]=v.useState(null);return v.useEffect(()=>{r!==null&&r!==b&&p(null)},[r,b]),s.jsxs("div",{className:"flex flex-col gap-3","data-initial-hub-policy":!0,children:[s.jsx("p",{className:"text-meta text-ink-muted",children:l("ui.hub.skills.initial_policy_description")}),["subscribe","autoPush"].map(u=>s.jsxs("label",{htmlFor:`${o}-${u}`,className:"flex items-start gap-3 text-body-sm text-ink",children:[s.jsx(te,{id:`${o}-${u}`,checked:e[u],disabled:k||u==="autoPush"&&!h&&!e.autoPush,onCheckedChange:f=>{u==="subscribe"?i({...e,subscribe:f===!0}):f!==!0?i({...e,autoPush:!1,confirmPublicEgress:!1}):h&&p(b)}}),s.jsxs("span",{children:[s.jsx("span",{className:"block",children:l(u==="subscribe"?"ui.hub.subscriptions.subscribe":"ui.hub.subscriptions.auto_push")}),s.jsx("span",{className:"block text-meta text-ink-muted",children:l(u==="subscribe"?"ui.hub.subscriptions.subscribe_description":"ui.hub.subscriptions.auto_push_description",{source:t})})]})]},u)),!h&&s.jsx("p",{className:"text-meta text-ink-muted",children:l("ui.hub.subscriptions.unsupported")}),s.jsx(se,{open:r!==null,onOpenChange:u=>{u||p(null)},children:s.jsxs(ae,{onOpenAutoFocus:u=>{u.preventDefault(),c.current?.focus()},children:[s.jsxs(ne,{children:[s.jsx(le,{children:l("ui.hub.subscriptions.enable_title",{source:t})}),s.jsx(re,{children:a==="public"?l("ui.hub.subscriptions.enable_public",{item:n}):l("ui.hub.subscriptions.enable_private",{item:n,organization:d??t})})]}),s.jsx("p",{className:"text-body-sm text-ink-muted",children:l("ui.hub.subscriptions.enable_safety")}),s.jsxs(ue,{children:[s.jsx(g,{ref:c,"data-testid":"hub-policy-cancel",variant:"outline",onClick:()=>p(null),children:l("ui.hub.subscriptions.cancel")}),s.jsx(g,{"data-testid":"hub-policy-enable",disabled:k||!h||r!==b,onClick:()=>{i({...e,autoPush:!0,confirmPublicEgress:a==="public"}),p(null)},children:l("ui.hub.subscriptions.enable")})]})]})})]})}function Ve(e,i,t=Date.now()){return e.can_confirm===!0&&e.kind==="skill"&&e.direction==="push"&&e.publication==="create"&&e.proposal?.kind==="skill"&&e.proposal.fields?.document_version===1&&e.preview_receipt.length>0&&e.local_fingerprint.length>0&&e.draft_fingerprint.length>0&&e.proposal_fingerprint.length>0&&e.source_skill===i.sourceSkill&&e.local_alias===i.localAlias&&e.visibility===i.visibility&&e.tenant_id===i.tenantId&&e.policy?.subscribe===i.subscribe&&e.policy?.auto_push===i.autoPush&&e.policy?.confirm_public_egress===i.confirmPublicEgress&&Number.isFinite(Date.parse(e.expires_at))&&Date.parse(e.expires_at)>t}function Xe(e){return e.local_link_receipt?.state==="complete"&&!!e.link&&e.local_link_receipt.link_id===e.link.link_id&&typeof e.link.policy?.subscribe=="boolean"&&typeof e.link.policy.auto_push=="boolean"&&typeof e.link.policy.revision=="string"&&e.link.policy.revision.length>0}const je=e=>e==="active"||e==="past_due",L=e=>e.status!=="active"?"no_access":je(e.plan.status)?"available":"plan_inactive",Ze=e=>e.filter(i=>L(i)==="available"),ei=e=>e.filter(i=>L(i)==="plan_inactive"),ii=e=>{if(!(e instanceof oe))return null;switch(e.code){case"team_plan_required":return"plan";case"not_a_member":case"insufficient_role":return"no_access";default:return null}};export{Ye as H,fe as P,Ge as S,De as a,He as b,Ce as c,Ke as d,Oe as e,Be as f,W as g,Fe as h,Ve as i,xe as j,Qe as k,$e as l,ze as m,Je as n,Ee as o,Xe as p,Le as q,We as r,Me as s,ii as t,Ue as u,Te as v,Ae as w,Ze as x,ei as y};
|
|
1
|
+
import{r as v,j as s,c as R}from"./index-CW7JpbBx.js";import{y as z,z as G,D as J,E as Y,G as C,H as K,I as V,J as O,K as U,L as X,M as Z,O as ee,Q as E,T as ie}from"./index-g9YfuNnq.js";import{u as j,B as g,h as te,n as se,o as ae,y as ne,p as le,z as re,F as ue}from"./error-boundary-OwA_uKkY.js";import{t as l}from"./messages-DjcNNMrL.js";import{h as w,u as y,a as M,c as F,r as B,d as I,F as D,G as oe}from"./path-utils-D8EGhun0.js";import{bA as Q,b7 as m,bu as P}from"./conversation-input-sync-CA-NlH9A.js";const _=e=>e==null?"":typeof e=="string"?e:JSON.stringify(e,null,2),ce={available:"border-hairline",updating:"border-hairline",applied:"border-hairline",review:"border-warning-border",failed:"border-danger-border"};function de(e){const i=[];for(const t of e??[])for(const n of t.fields??[])for(const a of n.regions??[])(a.provenance==="unresolved"||_(a.local)!==_(a.remote))&&i.push({field:n.field,region:a});return i}function be({regions:e}){return j(),e.length?s.jsx("ul",{className:"space-y-3","data-testid":"hub-update-preview",children:e.map(({field:i,region:t},n)=>s.jsxs("li",{className:"space-y-1 text-meta",children:[s.jsx("p",{className:"font-medium text-ink",children:t.heading||t.name||i}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-ink-muted",children:l("ui.agents.navigation.updates.preview.local")}),s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded-sm border border-hairline p-2 text-ink",children:_(t.local)||l("ui.agents.navigation.updates.preview.nothing")})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-ink-muted",children:l("ui.agents.navigation.updates.preview.remote")}),s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded-sm border border-hairline p-2 text-ink",children:_(t.remote)||l("ui.agents.navigation.updates.preview.nothing")})]})]})]},`${i}:${t.id??n}`))}):s.jsx("p",{className:"text-meta text-ink-muted",children:l("ui.agents.navigation.updates.preview.empty")})}function Ee({kind:e,name:i,enabled:t}){j();const n=z(t),a=G(),[d,b]=v.useState(null),h=Y(e,i),k=J(n.data).get(h),o=C(k),c=a.notes[h],r=a.pending.has(h);if(!k||!o)return c?s.jsx("section",{"data-testid":"hub-update-panel","aria-label":l("ui.agents.navigation.updates.accessible"),className:"mb-8 rounded-md border border-hairline p-3 text-body-sm",children:s.jsx("p",{role:c.tone==="error"?"alert":"status",className:c.tone==="error"?"text-danger":"text-ink",children:c.message})}):null;const p=o.kind==="review",u=k.classification==="baseline-unknown",f=q=>({prefer:q,acknowledgeUnknownBaseline:u}),$=async()=>{const q=await a.applyItem(e,i,{...f(),dryRun:!0});b(q??[])};return s.jsxs("section",{"data-testid":"hub-update-panel","aria-label":l("ui.agents.navigation.updates.accessible"),className:R("mb-8 space-y-2 rounded-md border p-3 text-body-sm",ce[o.kind]),children:[s.jsxs("p",{className:"flex items-start gap-2 text-ink",children:[s.jsx(K,{mark:o,className:"mt-0.5"}),s.jsx("span",{className:R(o.kind==="failed"&&"text-danger"),children:V(k,o)})]}),a.upgradeMessage&&s.jsx("output",{className:"block text-meta text-warning","data-hub-core-upgrade":!0,children:a.upgradeMessage}),p&&u&&s.jsx("p",{className:"text-meta text-ink-muted",children:l("ui.agents.navigation.updates.baseline_unknown")}),p&&!u&&s.jsx("p",{className:"text-meta text-ink-muted",children:l("ui.agents.navigation.updates.merge_guidance")}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.kind==="available"&&s.jsx(g,{size:"sm",variant:"outline","aria-disabled":r||!a.canWrite||void 0,onClick:()=>!r&&a.canWrite&&void a.applyItem(e,i),children:r?l("ui.agents.navigation.updates.action.updating"):l("ui.agents.navigation.updates.action.update")}),o.kind==="failed"&&o.retryable&&s.jsx(g,{size:"sm",variant:"outline","aria-disabled":r||!a.canWrite||void 0,onClick:()=>!r&&a.canWrite&&void a.retryItem(e,i),children:r?l("ui.agents.navigation.updates.action.retrying"):l("ui.agents.navigation.updates.action.retry")}),p&&s.jsxs(s.Fragment,{children:[s.jsx(g,{size:"sm",variant:"outline","aria-disabled":r||!a.canWrite||void 0,onClick:()=>!r&&a.canWrite&&void $(),children:r&&!d?l("ui.agents.navigation.updates.action.loading"):l("ui.agents.navigation.updates.action.preview")}),s.jsx(g,{size:"sm",variant:"ghost","aria-disabled":r||!a.canWrite||void 0,onClick:()=>!r&&a.canWrite&&void a.applyItem(e,i,f("local")),children:l("ui.agents.navigation.updates.action.keep_local")}),s.jsx(g,{size:"sm",variant:"ghost","aria-disabled":r||!a.canWrite||void 0,onClick:()=>!r&&a.canWrite&&void a.applyItem(e,i,f("remote")),children:l("ui.agents.navigation.updates.action.use_remote")})]})]}),d&&p&&s.jsx(be,{regions:de(d)}),c&&s.jsx("p",{role:c.tone==="error"?"alert":"status",className:c.tone==="error"?"text-meta text-danger":"text-meta text-ink-muted",children:c.message})]})}const pe=/\/+$/;function W(e){const i=e.replace(pe,"");try{const{pathname:t}=new URL(i);return t===""||t==="/"?`${i}/v1`:i}catch{return`${i}/v1`}}const Fe=e=>e?.skills===1&&e.revision_cas===1;function he(e,i=1,t=20){const n=new URL(O(e,"skills"));return n.searchParams.set("page",String(i)),n.searchParams.set("per_page",String(t)),U(n.toString())}function me(e,i){return U(O(e,"skills",i))}function ke(e){return Q({operation:"org_skills.list",tenantId:e})}function ge(e,i){return Q({operation:"org_skill.get",tenantId:e,skillId:i})}const fe=12,S={all:["public-teams"],list:(e,i)=>[...S.all,"list",{page:e,perPage:i}],detail:e=>[...S.all,"detail",e]},N=(e,i)=>i instanceof X?i.status===null?!1:i.status>=500&&e<1:e<1,Te=({page:e=1,perPage:i=fe,enabled:t=!0}={})=>{const n=w({queryKey:S.list(e,i),queryFn:()=>Z(m.radientBaseUrl,e,i),select:a=>a.result,enabled:t,retry:N,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,placeholderData:a=>a});return{...n,teams:n.data?.records??[],isRefreshing:n.isFetching&&n.data!==void 0,pagination:n.data?{page:n.data.page,perPage:n.data.per_page,totalPages:n.data.total_pages,totalRecords:n.data.total_records}:void 0}},Ae=({teamId:e,enabled:i=!0})=>{const t=w({queryKey:S.detail(e??""),queryFn:()=>ee(m.radientBaseUrl,e),select:n=>n.result,enabled:i&&!!e,retry:N,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,retryOnMount:!1});return{...t,team:t.data}};function x(e){if(e.getQueryState(D.capabilities)?.status!=="success"||!F(e.getQueryData(D.capabilities),"hub_skills"))throw new Error("This backend does not support the complete Hub Skills adapter.")}function De(e,i,t){const n=y(),a=M();return w({queryKey:["hub-skills",m.radientBaseUrl,e.visibility,e.tenantId,i],enabled:t&&!a.isError&&F(a.data,"hub_skills"),queryFn:async()=>{if(x(n),e.visibility==="org"){const b=(await ke(e.tenantId)).result;return{rows:b.skills,pages:1,total:b.skills.length,contract:b.sync_contract}}const d=(await he(m.radientBaseUrl,i,20)).result;return{rows:d.records,pages:d.total_pages,total:d.total_records,contract:d.sync_contract}},staleTime:3e4,retry:e.visibility==="org"?B:N,retryOnMount:!1,refetchOnWindowFocus:!1})}function He(e,i,t){const n=y(),a=M();return w({queryKey:["hub-skill",m.radientBaseUrl,e.visibility,e.tenantId,i],enabled:t&&i!==null&&!a.isError&&F(a.data,"hub_skills"),queryFn:async()=>(x(n),(e.visibility==="org"?await ge(e.tenantId,i):await me(m.radientBaseUrl,i)).result),staleTime:3e4,retry:e.visibility==="org"?B:N,retryOnMount:!1})}function T(e,i){e.setQueryData(E,i.links)}function A(e){e.invalidateQueries({queryKey:E}),e.invalidateQueries({queryKey:["desktop","skills"]})}function Ce(e={}){const i=y();return P({...e.retry===void 0?{}:{retry:e.retry},mutationFn:t=>(x(i),I({op:"hub.skillPull",requestId:t.requestId,hubId:t.remoteId,hubSource:W(m.radientBaseUrl),visibility:t.scope.visibility,tenantId:t.scope.tenantId,localAlias:t.alias,subscribe:t.subscribe,autoPush:t.autoPush,confirmPublicEgress:t.consent})),onSuccess:t=>{T(i,t)},onSettled:()=>{A(i)}})}function Ke(){const e=y();return P({mutationFn:i=>(x(e),I({op:"hub.skillSubscribe",requestId:i.requestId,hubId:i.remoteId,hubSource:W(m.radientBaseUrl),visibility:i.scope.visibility,tenantId:i.scope.tenantId,localAlias:i.alias})),onSuccess:i=>{T(e,i)},onSettled:()=>{A(e)}})}function Oe(){const e=y();return P({mutationFn:i=>(x(e),I({op:"hub.skillUnpull",requestId:i.requestId,linkId:i.linkId})),onSuccess:i=>{T(e,i)},onSettled:()=>{A(e)}})}function Ue(){const e=y();return P({mutationFn:i=>(x(e),I({op:"hub.skillPublish",requestId:i.requestId,...i.draft,dryRun:i.previewReceipt===void 0,...i.previewReceipt?{previewReceipt:i.previewReceipt,confirmPublish:!0}:{}})),onSuccess:i=>{i.local_link_receipt?.state==="complete"&&(e.invalidateQueries({queryKey:E}),e.invalidateQueries({queryKey:["desktop","skills"]}),e.invalidateQueries({queryKey:["hub-skills"]}))}})}const ye=/\/+$/;function H(e){return e.replace(ye,"")}function Me(e,i){return i.visibility==="public"?e.visibility==="public"&&!e.tenant_id:e.visibility==="org"&&e.tenant_id===i.tenantId}function xe(e){const i=e.id??e.hub_id??"",t=e.tenantId??e.tenant_id??"";return`${i}\0${e.visibility}\0${t}`}function Be(e,i){const t=H(i),n=new Map;for(const a of e??[])a.kind==="skill"&&H(a.hub_source)===t&&n.set(xe({hub_id:a.hub_id,visibility:a.visibility,tenantId:a.tenant_id}),a);return n}function Qe(e,i,t=!0){if(!t)return{kind:"unknown"};if(!e)return{kind:"not-present"};const n=ie(e);return n==="present"&&(e.pull.state==="available"||i?.state==="available"&&!i.error_class)?{kind:"update",link:e,automatic:i?.auto_will_apply===!0||e.auto_will_apply}:n==="absent"?e.policy.subscribe?{kind:"subscribed",link:e}:{kind:"detached",link:e}:e.policy.subscribe?{kind:"pulled",link:e}:{kind:"manual",link:e}}function We(e){return e?"policy":"create"}function Le(e){return JSON.stringify({op:"pull",selected:e.selected,scope:e.scope,localAlias:e.localAlias,subscribe:e.subscribe,autoPush:e.autoPush,consent:e.consent})}const ve={available:"text-accent",applied:"text-success",failed:"text-danger",review:"text-warning",updating:"text-ink-muted"},_e={available:"ui.hub.skills.update_available",applied:"ui.hub.skills.update_applied",failed:"ui.hub.skills.update_failed",review:"ui.hub.links.mark_review",updating:"ui.hub.links.mark_busy"},Se={"not-present":"ui.hub.skills.not_downloaded",subscribed:"ui.hub.skills.subscribed_absent",pulled:"ui.hub.skills.pulled",manual:"ui.hub.skills.manual",detached:"ui.hub.skills.detached"};function $e(e,i,t){const n=i?C(i):null;return n&&(e.kind==="update"||t&&(i?.state==="applied"||i?.state==="failed"||i?.error_class))?n:e.kind==="update"?{kind:"available",auto:e.automatic}:null}function ze(e,i){return e.kind==="unknown"?i:e.kind!=="update"?l(Se[e.kind]):l(e.link.policy.subscribe?"ui.hub.skills.pulled":"ui.hub.skills.manual")}function Ge({mark:e,className:i,labels:t}){return j(),e?s.jsxs("span",{"data-hub-mark-state":e.kind,className:R("flex shrink-0 items-center gap-1 text-meta",ve[e.kind],i),children:[s.jsx(K,{mark:e}),s.jsx("span",{children:l(t?.[e.kind]??_e[e.kind])})]}):null}const Je=()=>({subscribe:!0,autoPush:!1,confirmPublicEgress:!1});function Ye({value:e,onChange:i,source:t,item:n,visibility:a,organization:d,destinationKey:b,canEnableAutoPush:h,disabled:k=!1}){j();const o=v.useId(),c=v.useRef(null),[r,p]=v.useState(null);return v.useEffect(()=>{r!==null&&r!==b&&p(null)},[r,b]),s.jsxs("div",{className:"flex flex-col gap-3","data-initial-hub-policy":!0,children:[s.jsx("p",{className:"text-meta text-ink-muted",children:l("ui.hub.skills.initial_policy_description")}),["subscribe","autoPush"].map(u=>s.jsxs("label",{htmlFor:`${o}-${u}`,className:"flex items-start gap-3 text-body-sm text-ink",children:[s.jsx(te,{id:`${o}-${u}`,checked:e[u],disabled:k||u==="autoPush"&&!h&&!e.autoPush,onCheckedChange:f=>{u==="subscribe"?i({...e,subscribe:f===!0}):f!==!0?i({...e,autoPush:!1,confirmPublicEgress:!1}):h&&p(b)}}),s.jsxs("span",{children:[s.jsx("span",{className:"block",children:l(u==="subscribe"?"ui.hub.subscriptions.subscribe":"ui.hub.subscriptions.auto_push")}),s.jsx("span",{className:"block text-meta text-ink-muted",children:l(u==="subscribe"?"ui.hub.subscriptions.subscribe_description":"ui.hub.subscriptions.auto_push_description",{source:t})})]})]},u)),!h&&s.jsx("p",{className:"text-meta text-ink-muted",children:l("ui.hub.subscriptions.unsupported")}),s.jsx(se,{open:r!==null,onOpenChange:u=>{u||p(null)},children:s.jsxs(ae,{onOpenAutoFocus:u=>{u.preventDefault(),c.current?.focus()},children:[s.jsxs(ne,{children:[s.jsx(le,{children:l("ui.hub.subscriptions.enable_title",{source:t})}),s.jsx(re,{children:a==="public"?l("ui.hub.subscriptions.enable_public",{item:n}):l("ui.hub.subscriptions.enable_private",{item:n,organization:d??t})})]}),s.jsx("p",{className:"text-body-sm text-ink-muted",children:l("ui.hub.subscriptions.enable_safety")}),s.jsxs(ue,{children:[s.jsx(g,{ref:c,"data-testid":"hub-policy-cancel",variant:"outline",onClick:()=>p(null),children:l("ui.hub.subscriptions.cancel")}),s.jsx(g,{"data-testid":"hub-policy-enable",disabled:k||!h||r!==b,onClick:()=>{i({...e,autoPush:!0,confirmPublicEgress:a==="public"}),p(null)},children:l("ui.hub.subscriptions.enable")})]})]})})]})}function Ve(e,i,t=Date.now()){return e.can_confirm===!0&&e.kind==="skill"&&e.direction==="push"&&e.publication==="create"&&e.proposal?.kind==="skill"&&e.proposal.fields?.document_version===1&&e.preview_receipt.length>0&&e.local_fingerprint.length>0&&e.draft_fingerprint.length>0&&e.proposal_fingerprint.length>0&&e.source_skill===i.sourceSkill&&e.local_alias===i.localAlias&&e.visibility===i.visibility&&e.tenant_id===i.tenantId&&e.policy?.subscribe===i.subscribe&&e.policy?.auto_push===i.autoPush&&e.policy?.confirm_public_egress===i.confirmPublicEgress&&Number.isFinite(Date.parse(e.expires_at))&&Date.parse(e.expires_at)>t}function Xe(e){return e.local_link_receipt?.state==="complete"&&!!e.link&&e.local_link_receipt.link_id===e.link.link_id&&typeof e.link.policy?.subscribe=="boolean"&&typeof e.link.policy.auto_push=="boolean"&&typeof e.link.policy.revision=="string"&&e.link.policy.revision.length>0}const je=e=>e==="active"||e==="past_due",L=e=>e.status!=="active"?"no_access":je(e.plan.status)?"available":"plan_inactive",Ze=e=>e.filter(i=>L(i)==="available"),ei=e=>e.filter(i=>L(i)==="plan_inactive"),ii=e=>{if(!(e instanceof oe))return null;switch(e.code){case"team_plan_required":return"plan";case"not_a_member":case"insufficient_role":return"no_access";default:return null}};export{Ye as H,fe as P,Ge as S,De as a,He as b,Ce as c,Ke as d,Oe as e,Be as f,W as g,Fe as h,Ve as i,xe as j,Qe as k,$e as l,ze as m,Je as n,Ee as o,Xe as p,Le as q,We as r,Me as s,ii as t,Ue as u,Te as v,Ae as w,Ze as x,ei as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,c as R,r as d,u as Fn}from"./index-CW7JpbBx.js";import{t as n}from"./messages-DjcNNMrL.js";import{bu as $e,a3 as V,c5 as Tt,a0 as qn,c$ as Us,aB as $s,d0 as zs,c3 as Bn,aA as ve,d1 as Un,a2 as Sr,aW as ft,by as Ve,d2 as $n,cI as zn,bB as Cr,bz as Rt,cc as Gn,bk as Yn,cp as Hn,cu as Kn,ct as Wn,cs as Gs,co as Vn,d3 as Xn,cZ as Jn,cK as Qn,cH as Zn,cJ as ea,aH as le,d4 as Er,d5 as Tr,cQ as Ft,d6 as Be,d7 as ta,d8 as _t,cU as sa,cV as Ys,d9 as jt,da as Rr,cR as ra,db as na,dc as Dr,bv as aa,ba as oa,bb as ia,bc as ca,bd as la,be as ua,dd as da,de as Ar,c2 as pa,df as ma,bj as fa}from"./conversation-input-sync-CA-NlH9A.js";import{h as hs,d as _e,ab as _a,r as gs,u as ja,ad as ha,ae as ga,af as Xe,ag as xa,G as qt,a as rt,c as ye,o as Bt,ah as es,w as Dt,x as ba,v as va,y as ya,C as wa,n as ka,q as Na}from"./path-utils-D8EGhun0.js";import{c as ht,u as L,R as Je,w as Ut,U as Qe,V as Ze,W as et,Y as Oe,B as G,D as xs,b as bs,S as Te,d as vs,e as be,ac as Sa,ad as Ca,ae as Ea,l as Ta,m as Ra,I as Da,i as ke,a7 as ys,ai as ws,a9 as ks,K as ue,X as $t,a as Ns,T as Pr,L as pe,$ as Or,h as Mr,n as Aa,o as Pa,p as Oa,A as ts,M as Ma,N as Ia,O as La,P as Fa,f as He}from"./error-boundary-OwA_uKkY.js";import{P as Hs}from"./page-header-C_NLT5l1.js";import{bZ as qa,bI as Ir,b_ as Ba,b$ as Ua,bP as $a,bs as za,a as dt,A as Ks,c0 as Lr,F as Ws,R as Ga}from"./index-
|
|
1
|
+
import{j as t,c as R,r as d,u as Fn}from"./index-CW7JpbBx.js";import{t as n}from"./messages-DjcNNMrL.js";import{bu as $e,a3 as V,c5 as Tt,a0 as qn,c$ as Us,aB as $s,d0 as zs,c3 as Bn,aA as ve,d1 as Un,a2 as Sr,aW as ft,by as Ve,d2 as $n,cI as zn,bB as Cr,bz as Rt,cc as Gn,bk as Yn,cp as Hn,cu as Kn,ct as Wn,cs as Gs,co as Vn,d3 as Xn,cZ as Jn,cK as Qn,cH as Zn,cJ as ea,aH as le,d4 as Er,d5 as Tr,cQ as Ft,d6 as Be,d7 as ta,d8 as _t,cU as sa,cV as Ys,d9 as jt,da as Rr,cR as ra,db as na,dc as Dr,bv as aa,ba as oa,bb as ia,bc as ca,bd as la,be as ua,dd as da,de as Ar,c2 as pa,df as ma,bj as fa}from"./conversation-input-sync-CA-NlH9A.js";import{h as hs,d as _e,ab as _a,r as gs,u as ja,ad as ha,ae as ga,af as Xe,ag as xa,G as qt,a as rt,c as ye,o as Bt,ah as es,w as Dt,x as ba,v as va,y as ya,C as wa,n as ka,q as Na}from"./path-utils-D8EGhun0.js";import{c as ht,u as L,R as Je,w as Ut,U as Qe,V as Ze,W as et,Y as Oe,B as G,D as xs,b as bs,S as Te,d as vs,e as be,ac as Sa,ad as Ca,ae as Ea,l as Ta,m as Ra,I as Da,i as ke,a7 as ys,ai as ws,a9 as ks,K as ue,X as $t,a as Ns,T as Pr,L as pe,$ as Or,h as Mr,n as Aa,o as Pa,p as Oa,A as ts,M as Ma,N as Ia,O as La,P as Fa,f as He}from"./error-boundary-OwA_uKkY.js";import{P as Hs}from"./page-header-C_NLT5l1.js";import{bZ as qa,bI as Ir,b_ as Ba,b$ as Ua,bP as $a,bs as za,a as dt,A as Ks,c0 as Lr,F as Ws,R as Ga}from"./index-g9YfuNnq.js";import{o as Fr}from"./console-mirror-1z96hWwG.js";import{P as tt}from"./project-markdown-DRTB-eF8.js";import{u as Ya}from"./use-session-snapshot-ZwSI2jWI.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{f,g as v,p as c,P as w,h as A,r as L,i as T,j as P,k as R,l as N}from"./path-utils-D8EGhun0.js";import{T as S,U as E,V as O}from"./conversation-input-sync-CA-NlH9A.js";import{t as e}from"./messages-DjcNNMrL.js";import"./index-CW7JpbBx.js";import{l as U,b as j}from"./index-ClKLYxFA.js";const h={get malware_or_exploitation(){return e("ui.agents.publication.category.malware_or_exploitation")},get credential_theft(){return e("ui.agents.publication.category.credential_theft")},get fraud_or_deception(){return e("ui.agents.publication.category.fraud_or_deception")},get harassment_or_hate(){return e("ui.agents.publication.category.harassment_or_hate")},get sexual_content_minors(){return e("ui.agents.publication.category.sexual_content_minors")},get sexual_content(){return e("ui.agents.publication.category.sexual_content")},get violence_or_weapons(){return e("ui.agents.publication.category.violence_or_weapons")},get drugs_or_controlled_substances(){return e("ui.agents.publication.category.drugs_or_controlled_substances")},get self_harm(){return e("ui.agents.publication.category.self_harm")},get mass_surveillance_or_privacy_abuse(){return e("ui.agents.publication.category.mass_surveillance_or_privacy_abuse")},get evasion_or_abuse_tooling(){return e("ui.agents.publication.category.evasion_or_abuse_tooling")},get prompt_injection(){return e("ui.agents.publication.category.prompt_injection")},get unclear_dual_use(){return e("ui.agents.publication.category.unclear_dual_use")},get other_harmful(){return e("ui.agents.publication.category.other_harmful")}},q=n=>{const t=n.trim();return t.length>12&&/\s/.test(t)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(t)};function C(n){const t=n?.categories?.[0];return t&&O(t)?h[t]:h.other_harmful}function k(n,t){const i=t?.rule?.trim()??"";switch(t?.field){case"name":return{body:i?e("ui.agents.publication.invalid.field.name_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.name"),field:"name"};case"instructions":return{body:i?e("ui.agents.publication.invalid.field.instructions_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.instructions",{max:String(w)}),field:"instructions"};case"description":return{body:i?e("ui.agents.publication.invalid.field.description_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.description"),field:"description"};case"tools":return{body:i?e("ui.agents.publication.invalid.field.tools_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.tools"),field:"tools"};case"when_to_use":return{body:i?e("ui.agents.publication.invalid.field.when_to_use_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.when_to_use"),field:"when_to_use"};case"categories":return{body:i?e("ui.agents.publication.invalid.field.categories_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.categories"),field:"categories"};case"tags":return{body:i?e("ui.agents.publication.invalid.field.tags_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.tags"),field:"tags"};default:return{body:n,field:null}}}function Y(n,t){const i=t.surface==="pull",o=t.name.trim(),a=o||(i?e("ui.agents.publication.subject.team"):e("ui.agents.publication.subject.agent"));switch(n.code){case"name_taken":return n.details?.owned_by_caller===!0?{variant:"danger",headline:e("ui.agents.publication.name_taken.owned_headline"),body:e("ui.agents.publication.name_taken.owned_body",{name:a}),note:null,actions:n.details?.existing_agent_id||t.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:e("ui.agents.publication.name_taken.headline"),body:e("ui.agents.publication.name_taken.body",{name:a}),note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:e("ui.agents.publication.name_claim_in_flight.headline"),body:e("ui.agents.publication.name_claim_in_flight.body",{name:a}),note:null,actions:["retry"]};case"name_reserved_builtin":{const u=n.details?.builtin_name,l=u?c(u)===c(a):!1;return{variant:"danger",headline:e("ui.agents.publication.name_reserved_builtin.headline"),body:u&&!l?e("ui.agents.publication.name_reserved_builtin.body",{name:a,builtin:u}):e("ui.agents.publication.name_reserved_builtin.body_same_name",{builtin:u??a}),note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:e("ui.agents.publication.moderation_rejected.headline"),body:n.details?.reason?.trim()||n.message,note:C(n.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:e("ui.agents.publication.moderation_unavailable.headline"),body:e("ui.agents.publication.moderation_unavailable.body"),note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:u,field:l}=k(n.message,n.details);return{variant:"danger",headline:e("ui.agents.publication.invalid.headline"),body:u,note:null,actions:l==="name"?["focus-name"]:l==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const u=n.details?.limit_bytes;return{variant:"danger",headline:e("ui.agents.publication.payload_too_large.headline"),body:u?e("ui.agents.publication.payload_too_large.body_with_limit",{size:String(Math.round(u/1024))}):e("ui.agents.publication.payload_too_large.body"),note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:e("ui.agents.publication.not_owner.headline"),body:e("ui.agents.publication.not_owner.body"),note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:e("ui.agents.publication.agent_not_found.headline"),body:e("ui.agents.publication.agent_not_found.body"),note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:e("ui.agents.publication.hub_unauthorized.headline"),body:i?e("ui.agents.publication.hub_unauthorized.body_pull"):e("ui.agents.publication.hub_unauthorized.body"),note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:i?e("ui.agents.publication.hub_unavailable.headline_pull"):e("ui.agents.publication.hub_unavailable.headline"),body:q(n.message)?n.message:i?e("ui.agents.publication.hub_unavailable.body_pull"):e("ui.agents.publication.hub_unavailable.body"),note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:i?e("ui.agents.publication.local_failure.headline_pull"):e("ui.agents.publication.local_failure.headline"),body:n.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:e("ui.agents.publication.team_plan_required.headline"),body:i?e("ui.agents.publication.team_plan_required.body_pull"):e("ui.agents.publication.team_plan_required.body"),note:null,actions:["retry"]};case"not_a_member":return{variant:"danger",headline:e("ui.agents.publication.not_a_member.headline"),body:i?e("ui.agents.publication.not_a_member.body_pull"):e("ui.agents.publication.not_a_member.body"),note:null,actions:[]};case"insufficient_role":{const u=n.details?.required;return{variant:"danger",headline:e("ui.agents.publication.insufficient_role.headline"),body:u?e(i?"ui.agents.publication.insufficient_role.body_with_role_pull":"ui.agents.publication.insufficient_role.body_with_role",{required:u}):e(i?"ui.agents.publication.insufficient_role.body_pull":"ui.agents.publication.insufficient_role.body"),note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:e("ui.agents.publication.team_not_found.headline"),body:e("ui.agents.publication.team_not_found.body"),note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:e("ui.agents.publication.fallback.headline"),body:n.message,note:null,actions:["retry"]}}}const x=[/^(?: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*/],F=/^(\d{3})\b/,I=new Set([404,410]),B=["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"],D=n=>{const t=n.toLowerCase();return B.some(i=>t.includes(i))||E(n)},K=(n,t)=>{const i=t.trim()?e("ui.agents.publication.subject.name",{name:t.trim()}):e("ui.agents.publication.subject.unknown");if(S(n))switch(n.code){case"agent_not_found":return e("ui.agents.publication.pull.not_found",{subject:i});case"hub_unavailable":return e("ui.agents.publication.pull.hub_unavailable",{subject:i});default:return e("ui.agents.publication.pull.refused",{subject:i,reason:n.message})}const o=x.reduce((u,l)=>u.replace(l,""),v(n,"").trim()).trim();if(!o)return e("ui.agents.publication.pull.no_reason",{subject:i});const a=Number(F.exec(o)?.[1]??Number.NaN);return I.has(a)?e("ui.agents.publication.pull.not_found",{subject:i}):D(o)||a===408?e("ui.agents.publication.pull.reach_failure",{subject:i}):a===429?e("ui.agents.publication.pull.busy",{subject:i}):a===401||a===403?e("ui.agents.publication.pull.sign_in_refused",{subject:i}):a>=500?e("ui.agents.publication.pull.incomplete",{subject:i}):a>=400?e("ui.agents.publication.pull.refused_download",{subject:i}):e("ui.agents.publication.pull.prose",{subject:i,reason:o})},M=()=>e("ui.agents.publication.other_action_lead"),Z=(n,t,i)=>n==="download"?K(t,i):f(M(),t),J={get"focus-name"(){return e("ui.agents.publication.action.focus_name")},get"update-listing"(){return e("ui.agents.publication.action.update_listing")},get"install-builtin"(){return e("ui.agents.publication.action.install_builtin")},get retry(){return e("ui.agents.publication.action.retry")},get"edit-instructions"(){return e("ui.agents.publication.action.edit_instructions")},get"edit-agent"(){return e("ui.agents.publication.action.edit_agent")},get"publish-as-new"(){return e("ui.agents.publication.action.publish_as_new")},get"sign-in"(){return e("ui.agents.publication.action.sign_in")},get"refresh-hub"(){return e("ui.agents.publication.action.refresh_hub")}},z="download_count",_={all:["public-agents"],list:n=>[..._.all,"list",{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}]},g={all:["org-agents"],list:(n,t)=>[...g.all,"list",n,{page:t.page,perPage:t.perPage,categories:t.categories?.join(",")??void 0,name:t.name??void 0,description:t.description??void 0,sort:t.sort,order:t.order}]},Q=n=>n&&n[0]===g.all[0]?String(n[2]??""):null,ee=n=>n.invalidateQueries({queryKey:_.all}),ne=(n,t)=>n.invalidateQueries({queryKey:t?[...g.all,"list",t]:g.all}),ie=({page:n=1,perPage:t=20,enabled:i=!0,categories:o,name:a,description:u,sort:l=z,order:b="desc",tenantId:d}={})=>{const p={page:n,perPage:t,categories:o,name:a,description:u,sort:l,order:b},y=d?g.list(d,p):_.list(p),r=A({queryKey:y,queryFn:async()=>{const s={};return o&&o.length>0&&(s.categories=o.join(",")),a&&(s.name=a),u&&(s.description=u),s.sort=l,s.order=b,d?await U(d,n,t,s):await j(n,t,s)},select:s=>s.result,enabled:i,retry:L,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(s,m)=>Q(m?.queryKey)===(d??null)?s:void 0});return{...r,agents:r.data?.records,isRefreshing:r.isFetching&&r.data!==void 0,pagination:r.data?{page:r.data.page,perPage:r.data.per_page,totalPages:r.data.total_pages,totalRecords:r.data.total_records}:void 0}},G={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function te(n){const t=[],i=(o,a)=>{a&&t.push({field:o,message:`${G[o]} ${a}.`})};return i("name",T(n.name)),i("description",P(n.description)),n.instructions!==null&&i("instructions",R(n.instructions)),i("tools",N(n.tools??[])),t}function ae(n,t){const i=c(n);return t.some(o=>c(o)===i)}function oe(n){for(const t of n??[]){const i=t.indexOf(":");if(i<0||t.slice(0,i).trim().toLowerCase()!=="tools")continue;const o=t.slice(i+1).split(",").map(a=>a.trim()).filter(Boolean);return o.length>0?o:null}return null}function ue(n,t){const i=c(n);return t.find(o=>c(o)===i)??null}export{J as P,Z as a,_ as b,ne as c,ae as d,te as e,ee as i,ue as l,Y as p,oe as t,ie as u};
|
|
1
|
+
import{f,g as v,p as c,P as w,h as A,r as L,i as T,j as P,k as R,l as N}from"./path-utils-D8EGhun0.js";import{T as S,U as E,V as O}from"./conversation-input-sync-CA-NlH9A.js";import{t as e}from"./messages-DjcNNMrL.js";import"./index-CW7JpbBx.js";import{l as U,b as j}from"./index-g9YfuNnq.js";const h={get malware_or_exploitation(){return e("ui.agents.publication.category.malware_or_exploitation")},get credential_theft(){return e("ui.agents.publication.category.credential_theft")},get fraud_or_deception(){return e("ui.agents.publication.category.fraud_or_deception")},get harassment_or_hate(){return e("ui.agents.publication.category.harassment_or_hate")},get sexual_content_minors(){return e("ui.agents.publication.category.sexual_content_minors")},get sexual_content(){return e("ui.agents.publication.category.sexual_content")},get violence_or_weapons(){return e("ui.agents.publication.category.violence_or_weapons")},get drugs_or_controlled_substances(){return e("ui.agents.publication.category.drugs_or_controlled_substances")},get self_harm(){return e("ui.agents.publication.category.self_harm")},get mass_surveillance_or_privacy_abuse(){return e("ui.agents.publication.category.mass_surveillance_or_privacy_abuse")},get evasion_or_abuse_tooling(){return e("ui.agents.publication.category.evasion_or_abuse_tooling")},get prompt_injection(){return e("ui.agents.publication.category.prompt_injection")},get unclear_dual_use(){return e("ui.agents.publication.category.unclear_dual_use")},get other_harmful(){return e("ui.agents.publication.category.other_harmful")}},q=n=>{const t=n.trim();return t.length>12&&/\s/.test(t)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(t)};function C(n){const t=n?.categories?.[0];return t&&O(t)?h[t]:h.other_harmful}function k(n,t){const i=t?.rule?.trim()??"";switch(t?.field){case"name":return{body:i?e("ui.agents.publication.invalid.field.name_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.name"),field:"name"};case"instructions":return{body:i?e("ui.agents.publication.invalid.field.instructions_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.instructions",{max:String(w)}),field:"instructions"};case"description":return{body:i?e("ui.agents.publication.invalid.field.description_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.description"),field:"description"};case"tools":return{body:i?e("ui.agents.publication.invalid.field.tools_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.tools"),field:"tools"};case"when_to_use":return{body:i?e("ui.agents.publication.invalid.field.when_to_use_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.when_to_use"),field:"when_to_use"};case"categories":return{body:i?e("ui.agents.publication.invalid.field.categories_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.categories"),field:"categories"};case"tags":return{body:i?e("ui.agents.publication.invalid.field.tags_with_rule",{rule:i}):e("ui.agents.publication.invalid.field.tags"),field:"tags"};default:return{body:n,field:null}}}function Y(n,t){const i=t.surface==="pull",o=t.name.trim(),a=o||(i?e("ui.agents.publication.subject.team"):e("ui.agents.publication.subject.agent"));switch(n.code){case"name_taken":return n.details?.owned_by_caller===!0?{variant:"danger",headline:e("ui.agents.publication.name_taken.owned_headline"),body:e("ui.agents.publication.name_taken.owned_body",{name:a}),note:null,actions:n.details?.existing_agent_id||t.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:e("ui.agents.publication.name_taken.headline"),body:e("ui.agents.publication.name_taken.body",{name:a}),note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:e("ui.agents.publication.name_claim_in_flight.headline"),body:e("ui.agents.publication.name_claim_in_flight.body",{name:a}),note:null,actions:["retry"]};case"name_reserved_builtin":{const u=n.details?.builtin_name,l=u?c(u)===c(a):!1;return{variant:"danger",headline:e("ui.agents.publication.name_reserved_builtin.headline"),body:u&&!l?e("ui.agents.publication.name_reserved_builtin.body",{name:a,builtin:u}):e("ui.agents.publication.name_reserved_builtin.body_same_name",{builtin:u??a}),note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:e("ui.agents.publication.moderation_rejected.headline"),body:n.details?.reason?.trim()||n.message,note:C(n.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:e("ui.agents.publication.moderation_unavailable.headline"),body:e("ui.agents.publication.moderation_unavailable.body"),note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:u,field:l}=k(n.message,n.details);return{variant:"danger",headline:e("ui.agents.publication.invalid.headline"),body:u,note:null,actions:l==="name"?["focus-name"]:l==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const u=n.details?.limit_bytes;return{variant:"danger",headline:e("ui.agents.publication.payload_too_large.headline"),body:u?e("ui.agents.publication.payload_too_large.body_with_limit",{size:String(Math.round(u/1024))}):e("ui.agents.publication.payload_too_large.body"),note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:e("ui.agents.publication.not_owner.headline"),body:e("ui.agents.publication.not_owner.body"),note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:e("ui.agents.publication.agent_not_found.headline"),body:e("ui.agents.publication.agent_not_found.body"),note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:e("ui.agents.publication.hub_unauthorized.headline"),body:i?e("ui.agents.publication.hub_unauthorized.body_pull"):e("ui.agents.publication.hub_unauthorized.body"),note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:i?e("ui.agents.publication.hub_unavailable.headline_pull"):e("ui.agents.publication.hub_unavailable.headline"),body:q(n.message)?n.message:i?e("ui.agents.publication.hub_unavailable.body_pull"):e("ui.agents.publication.hub_unavailable.body"),note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:i?e("ui.agents.publication.local_failure.headline_pull"):e("ui.agents.publication.local_failure.headline"),body:n.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:e("ui.agents.publication.team_plan_required.headline"),body:i?e("ui.agents.publication.team_plan_required.body_pull"):e("ui.agents.publication.team_plan_required.body"),note:null,actions:["retry"]};case"not_a_member":return{variant:"danger",headline:e("ui.agents.publication.not_a_member.headline"),body:i?e("ui.agents.publication.not_a_member.body_pull"):e("ui.agents.publication.not_a_member.body"),note:null,actions:[]};case"insufficient_role":{const u=n.details?.required;return{variant:"danger",headline:e("ui.agents.publication.insufficient_role.headline"),body:u?e(i?"ui.agents.publication.insufficient_role.body_with_role_pull":"ui.agents.publication.insufficient_role.body_with_role",{required:u}):e(i?"ui.agents.publication.insufficient_role.body_pull":"ui.agents.publication.insufficient_role.body"),note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:e("ui.agents.publication.team_not_found.headline"),body:e("ui.agents.publication.team_not_found.body"),note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:e("ui.agents.publication.fallback.headline"),body:n.message,note:null,actions:["retry"]}}}const x=[/^(?: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*/],F=/^(\d{3})\b/,I=new Set([404,410]),B=["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"],D=n=>{const t=n.toLowerCase();return B.some(i=>t.includes(i))||E(n)},K=(n,t)=>{const i=t.trim()?e("ui.agents.publication.subject.name",{name:t.trim()}):e("ui.agents.publication.subject.unknown");if(S(n))switch(n.code){case"agent_not_found":return e("ui.agents.publication.pull.not_found",{subject:i});case"hub_unavailable":return e("ui.agents.publication.pull.hub_unavailable",{subject:i});default:return e("ui.agents.publication.pull.refused",{subject:i,reason:n.message})}const o=x.reduce((u,l)=>u.replace(l,""),v(n,"").trim()).trim();if(!o)return e("ui.agents.publication.pull.no_reason",{subject:i});const a=Number(F.exec(o)?.[1]??Number.NaN);return I.has(a)?e("ui.agents.publication.pull.not_found",{subject:i}):D(o)||a===408?e("ui.agents.publication.pull.reach_failure",{subject:i}):a===429?e("ui.agents.publication.pull.busy",{subject:i}):a===401||a===403?e("ui.agents.publication.pull.sign_in_refused",{subject:i}):a>=500?e("ui.agents.publication.pull.incomplete",{subject:i}):a>=400?e("ui.agents.publication.pull.refused_download",{subject:i}):e("ui.agents.publication.pull.prose",{subject:i,reason:o})},M=()=>e("ui.agents.publication.other_action_lead"),Z=(n,t,i)=>n==="download"?K(t,i):f(M(),t),J={get"focus-name"(){return e("ui.agents.publication.action.focus_name")},get"update-listing"(){return e("ui.agents.publication.action.update_listing")},get"install-builtin"(){return e("ui.agents.publication.action.install_builtin")},get retry(){return e("ui.agents.publication.action.retry")},get"edit-instructions"(){return e("ui.agents.publication.action.edit_instructions")},get"edit-agent"(){return e("ui.agents.publication.action.edit_agent")},get"publish-as-new"(){return e("ui.agents.publication.action.publish_as_new")},get"sign-in"(){return e("ui.agents.publication.action.sign_in")},get"refresh-hub"(){return e("ui.agents.publication.action.refresh_hub")}},z="download_count",_={all:["public-agents"],list:n=>[..._.all,"list",{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}]},g={all:["org-agents"],list:(n,t)=>[...g.all,"list",n,{page:t.page,perPage:t.perPage,categories:t.categories?.join(",")??void 0,name:t.name??void 0,description:t.description??void 0,sort:t.sort,order:t.order}]},Q=n=>n&&n[0]===g.all[0]?String(n[2]??""):null,ee=n=>n.invalidateQueries({queryKey:_.all}),ne=(n,t)=>n.invalidateQueries({queryKey:t?[...g.all,"list",t]:g.all}),ie=({page:n=1,perPage:t=20,enabled:i=!0,categories:o,name:a,description:u,sort:l=z,order:b="desc",tenantId:d}={})=>{const p={page:n,perPage:t,categories:o,name:a,description:u,sort:l,order:b},y=d?g.list(d,p):_.list(p),r=A({queryKey:y,queryFn:async()=>{const s={};return o&&o.length>0&&(s.categories=o.join(",")),a&&(s.name=a),u&&(s.description=u),s.sort=l,s.order=b,d?await U(d,n,t,s):await j(n,t,s)},select:s=>s.result,enabled:i,retry:L,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(s,m)=>Q(m?.queryKey)===(d??null)?s:void 0});return{...r,agents:r.data?.records,isRefreshing:r.isFetching&&r.data!==void 0,pagination:r.data?{page:r.data.page,perPage:r.data.per_page,totalPages:r.data.total_pages,totalRecords:r.data.total_records}:void 0}},G={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function te(n){const t=[],i=(o,a)=>{a&&t.push({field:o,message:`${G[o]} ${a}.`})};return i("name",T(n.name)),i("description",P(n.description)),n.instructions!==null&&i("instructions",R(n.instructions)),i("tools",N(n.tools??[])),t}function ae(n,t){const i=c(n);return t.some(o=>c(o)===i)}function oe(n){for(const t of n??[]){const i=t.indexOf(":");if(i<0||t.slice(0,i).trim().toLowerCase()!=="tools")continue;const o=t.slice(i+1).split(",").map(a=>a.trim()).filter(Boolean);return o.length>0?o:null}return null}function ue(n,t){const i=c(n);return t.find(o=>c(o)===i)??null}export{J as P,Z as a,_ as b,ne as c,ae as d,te as e,ee as i,ue as l,Y as p,oe as t,ie as u};
|
package/out/renderer/assets/{radient-auth-buttons-89F5YrRW.js → radient-auth-buttons-Czd77Wbr.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./index-CW7JpbBx.js";import{P as l}from"./index-
|
|
1
|
+
import{j as t}from"./index-CW7JpbBx.js";import{P as l}from"./index-g9YfuNnq.js";import{u as p,a as b,c as x,e as h}from"./path-utils-D8EGhun0.js";import{u as f,A as c,S as v}from"./error-boundary-OwA_uKkY.js";import{b as g}from"./conversation-input-sync-CA-NlH9A.js";import{t as e}from"./messages-DjcNNMrL.js";const j="radient",A=({onSignInSuccess:u,onAfterCredentialUpdate:d,titleText:a=e("ui.common.account.radient_auth_buttons.sign_in_to_radient"),descriptionText:i=e("ui.common.account.radient_auth_buttons.connect_your_radient_account_to_use_radient_services")})=>{f();const _=p(),n=b(),s=x(n.data,"auth"),r=h(s),o=r.data?.find(m=>m.id===j);return n.isSuccess&&!s?t.jsx(c,{variant:"warning",children:e("ui.common.account.radient_auth_buttons.signing_in_needs_a_newer_local_operator_backend_update_the_backen")}):r.isLoading||n.isLoading?t.jsx("div",{className:"flex h-24 items-center justify-center",children:t.jsx(v,{size:"md",label:e("ui.common.account.radient_auth_buttons.loading_sign_in_options")})}):o?t.jsxs("div",{className:"mx-auto w-full max-w-md",children:[a&&t.jsx("p",{className:"mb-2 text-center text-heading text-ink",children:a}),i&&t.jsx("p",{className:"mb-6 text-center text-body-sm text-ink-muted",children:i}),t.jsx(l,{provider:o,onConnected:()=>{_.invalidateQueries({queryKey:g.all}),d?.(),u?.()}})]}):t.jsx(c,{variant:"warning",children:e("ui.common.account.radient_auth_buttons.radient_is_not_available_from_this_backend_s_provider_registry")})};export{A 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,h as Zr,f as ie,p as bu,b as Dt,q as ce,v as Re,w as qs,x as Ri,y as Jr,c as Le}from"./index-CW7JpbBx.js";import{dr as yu,ds as vu,dt as es,du as xu,dv as wu,dw as _i,dx as Cu,dy as ku,dz as Su,dA as Ei,dB as Pu,dC as Oi,dD as Tt,dE as yo,dF as ts,dG as Mu,dH as Ct,dI as vo,dJ as Fi,dK as Ni,dL as Du,bK as Tu,dM as Iu,S as Ru,dN as _u,p as Ai,dO as Eu,dP as $i,dQ as Ou,dR as Fu,dS as Nu,dT as Au,dU as $u,a as _r,dV as ju,dW as Lu,dX as Vu,dY as Ks,dZ as Bu,d_ as Lo,d$ as zu,e0 as Hu,e1 as Wu,e2 as Uu,e3 as Yu,e4 as qu,e5 as Ku,bp as Gu,e6 as Qu,e7 as Xu,e8 as Zu,e9 as Ju,R as ed,ea as td,bw as nd,eb as od,ec as rd,ed as sd}from"./index-
|
|
1
|
+
import{r as p,l as Ti,j as u,m as Ii,n as gu,o as Ys,h as Zr,f as ie,p as bu,b as Dt,q as ce,v as Re,w as qs,x as Ri,y as Jr,c as Le}from"./index-CW7JpbBx.js";import{dr as yu,ds as vu,dt as es,du as xu,dv as wu,dw as _i,dx as Cu,dy as ku,dz as Su,dA as Ei,dB as Pu,dC as Oi,dD as Tt,dE as yo,dF as ts,dG as Mu,dH as Ct,dI as vo,dJ as Fi,dK as Ni,dL as Du,bK as Tu,dM as Iu,S as Ru,dN as _u,p as Ai,dO as Eu,dP as $i,dQ as Ou,dR as Fu,dS as Nu,dT as Au,dU as $u,a as _r,dV as ju,dW as Lu,dX as Vu,dY as Ks,dZ as Bu,d_ as Lo,d$ as zu,e0 as Hu,e1 as Wu,e2 as Uu,e3 as Yu,e4 as qu,e5 as Ku,bp as Gu,e6 as Qu,e7 as Xu,e8 as Zu,e9 as Ju,R as ed,ea as td,bw as nd,eb as od,ec as rd,ed as sd}from"./index-g9YfuNnq.js";import{h as ji,u as ns,w as Li,o as ad,a as id,c as ld}from"./path-utils-D8EGhun0.js";import{P as cd}from"./page-header-C_NLT5l1.js";import{au as _o,aj as ud,u as Gt,w as Kt,B as yt,S as os,a6 as Gs,L as bt,T as Vi,K as Wo,R as vn,U as xn,V as wn,W as Cn,Y as et,_ as Er,a7 as dd,a8 as pd,k as fd,a9 as md,f as hd,X as gd,A as Qs}from"./error-boundary-OwA_uKkY.js";import{t as V}from"./messages-DjcNNMrL.js";import{b7 as nr,bu as Bi,fO as rs,fP as D,dl as bd,by as zi,bz as Hi,aW as Wi,aH as Pn,bv as yd,c4 as vd,a3 as Xs,fQ as xd,aA as Mn,bB as wd}from"./conversation-input-sync-CA-NlH9A.js";import{b as or,s as Or,g as Cd,c as Uo,d as Ui,e as Yi,h as kd,l as Fr,j as Sd,w as Zs,k as Pd,i as to,f as Md,m as Dd,p as Js}from"./parseISO-CxPiCKvF.js";import{t as Ce,c as at,d as qi,f as Ki,n as rr,g as ss,k as Td,a as Gi,e as Qi}from"./en-US-CW_dDnkH.js";import"./console-mirror-1z96hWwG.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,j as t,c as fe,t as Ra}from"./index-CW7JpbBx.js";import{o as Ta}from"./console-mirror-1z96hWwG.js";import{eD as ln,eE as La,eF as Bn,eG as $e,cA as Oa,b6 as As,b7 as kn,aH as Is,bu as Fa,aA as Da,eH as za,eI as $a,eJ as Pa,eK as Ua,eL as Rs,eM as jn,b4 as Ts,eN as Ka,eO as Ba,eP as At,eQ as Ls,eR as qa,bw as cn,eS as qn,eT as Va,eU as He,eV as zt,c2 as wn,eW as Nn,cP as It,cg as Ha,eX as Os,eY as Ga,eZ as Wa,aW as Fs,by as dn,bz as un,a2 as Qa,aB as gn,e_ as Ya,e$ as Za,f0 as mn,f1 as Ja,f2 as Xa,f3 as ei,f4 as Ds,f5 as ti,f6 as ni,f7 as si,dn as Ge,e9 as ai,dk as zs,dp as ii,b as Vn,f8 as ri,f9 as Sn,a1 as $s,bt as oi,fa as Ps,bx as Us,fb as Ks,fc as li,fd as ci,fe as di,ff as ui,fg as gi,b3 as mi,fh as pi,fi,c7 as Bs,cc as _i,fj as tt,fk as Hn,fl as hi,fm as xi,fn as yi,cx as vi,fo as bi,fp as ki,cC as ji,fq as wi,fr as Ni,fs as Si,ft as Mi,ed as Ht,fu as Ci,fv as Ei}from"./conversation-input-sync-CA-NlH9A.js";import{h as Ee,u as ut,ap as Ai,al as Ii,aq as Ri,ar as Ue,a as gt,c as Qe,as as Ti,a3 as Li,at as Oi,au as Fi,av as Di,aw as zi,d as xe,G as Mn,ax as $i,w as it,ay as Pi,o as qs,ac as Ui,am as we,r as Ki,q as Bi,az as pn,B as at,aA as qi,aB as Vs,$ as Vi,a0 as Hi}from"./path-utils-D8EGhun0.js";import{d2 as Hs,d3 as Gi,d4 as Wi,d5 as Gs,d6 as Qi,c8 as Yi,d7 as Oe,N as Zi,S as Ws,bE as mt,bF as he,d8 as lt,d9 as _e,da as Gt,db as Ji,R as Xi,a as Gn,dc as er,dd as tr,de as nr,df as sr,dg as bt,dh as kt,bD as ar,bO as ir,di as rr,dj as or,dk as lr,dl as cr,bt as Wn,dm as dr,b4 as ur,bA as Qn,bY as gr,bB as mr,bC as pr,dn as fr,dp as _r,bs as hr,dq as xr}from"./index-
|
|
1
|
+
import{r as o,j as t,c as fe,t as Ra}from"./index-CW7JpbBx.js";import{o as Ta}from"./console-mirror-1z96hWwG.js";import{eD as ln,eE as La,eF as Bn,eG as $e,cA as Oa,b6 as As,b7 as kn,aH as Is,bu as Fa,aA as Da,eH as za,eI as $a,eJ as Pa,eK as Ua,eL as Rs,eM as jn,b4 as Ts,eN as Ka,eO as Ba,eP as At,eQ as Ls,eR as qa,bw as cn,eS as qn,eT as Va,eU as He,eV as zt,c2 as wn,eW as Nn,cP as It,cg as Ha,eX as Os,eY as Ga,eZ as Wa,aW as Fs,by as dn,bz as un,a2 as Qa,aB as gn,e_ as Ya,e$ as Za,f0 as mn,f1 as Ja,f2 as Xa,f3 as ei,f4 as Ds,f5 as ti,f6 as ni,f7 as si,dn as Ge,e9 as ai,dk as zs,dp as ii,b as Vn,f8 as ri,f9 as Sn,a1 as $s,bt as oi,fa as Ps,bx as Us,fb as Ks,fc as li,fd as ci,fe as di,ff as ui,fg as gi,b3 as mi,fh as pi,fi,c7 as Bs,cc as _i,fj as tt,fk as Hn,fl as hi,fm as xi,fn as yi,cx as vi,fo as bi,fp as ki,cC as ji,fq as wi,fr as Ni,fs as Si,ft as Mi,ed as Ht,fu as Ci,fv as Ei}from"./conversation-input-sync-CA-NlH9A.js";import{h as Ee,u as ut,ap as Ai,al as Ii,aq as Ri,ar as Ue,a as gt,c as Qe,as as Ti,a3 as Li,at as Oi,au as Fi,av as Di,aw as zi,d as xe,G as Mn,ax as $i,w as it,ay as Pi,o as qs,ac as Ui,am as we,r as Ki,q as Bi,az as pn,B as at,aA as qi,aB as Vs,$ as Vi,a0 as Hi}from"./path-utils-D8EGhun0.js";import{d2 as Hs,d3 as Gi,d4 as Wi,d5 as Gs,d6 as Qi,c8 as Yi,d7 as Oe,N as Zi,S as Ws,bE as mt,bF as he,d8 as lt,d9 as _e,da as Gt,db as Ji,R as Xi,a as Gn,dc as er,dd as tr,de as nr,df as sr,dg as bt,dh as kt,bD as ar,bO as ir,di as rr,dj as or,dk as lr,dl as cr,bt as Wn,dm as dr,b4 as ur,bA as Qn,bY as gr,bB as mr,bC as pr,dn as fr,dp as _r,bs as hr,dq as xr}from"./index-g9YfuNnq.js";import{P as yr}from"./page-header-C_NLT5l1.js";import{c as P,u as ie,B as F,S as Me,_ as Qs,w as Ye,N as $t,O as Pt,P as Ve,A as le,q as Ut,x as Re,f as Se,R as Cn,U as En,V as An,W as In,Y as We,L as Te,K as Le,a6 as Kt,$ as Ys,i as ct,h as fn,af as vr,a as Zs,at as Yn,T as Rn,D as br,b as kr,d as jr,I as wr,e as Zn,G as Nr,E as Sr,al as Mr,aa as Cr}from"./error-boundary-OwA_uKkY.js";import{t as n,L as Wt}from"./messages-DjcNNMrL.js";import{u as Er,a as Ar,D as Ir,b as Rr,d as Tr,S as Lr}from"./team-bridge-scope-preference-BjBvsZwt.js";import{R as Or}from"./radient-auth-buttons-Czd77Wbr.js";import{u as Fr,A as Dr,d as zr}from"./avatar-cropper-rj_RKIQ7.js";import{N as $r}from"./notebook-pen-CvsQ4S5s.js";import{B as Pr}from"./book-open-4khD6B-v.js";import{i as Ur,a as Pe,b as Kr,p as Qt,f as Br}from"./parseISO-CxPiCKvF.js";import{t as qr}from"./en-US-CW_dDnkH.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-BWTRx0RD.js";import"./index-CW7JpbBx.js";import"./messages-DjcNNMrL.js";import"./console-mirror-1z96hWwG.js";import"./path-utils-D8EGhun0.js";import"./page-header-C_NLT5l1.js";import"./conversation-input-sync-CA-NlH9A.js";import"./error-boundary-OwA_uKkY.js";import"./index-ClKLYxFA.js";import"./heart-CFgkk4l0.js";import"./hash-eKapyKur.js";import"./use-session-snapshot-ZwSI2jWI.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 gn(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{gn as renderSmartArt};
|
|
1
|
+
import{g as Y,a as E,b as F}from"./library-page-DFppe9y9.js";import"./index-CW7JpbBx.js";import"./messages-DjcNNMrL.js";import"./console-mirror-1z96hWwG.js";import"./path-utils-D8EGhun0.js";import"./page-header-C_NLT5l1.js";import"./conversation-input-sync-CA-NlH9A.js";import"./error-boundary-OwA_uKkY.js";import"./index-g9YfuNnq.js";import"./heart-CFgkk4l0.js";import"./hash-eKapyKur.js";import"./use-session-snapshot-ZwSI2jWI.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 gn(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{gn as renderSmartArt};
|