"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[967,8662],{61811:function(U,d,t){t.d(d,{O:function(){return h}});var n=t(73557);function h(l){return(0,n.UO)()}},96641:function(U,d,t){t.d(d,{X2:function(){return C},h$:function(){return g}});var n=t(52322),h=t(74314),l=t(72388),E=t(29651),m=t(68993),O=t(2784);const y=(0,E.CT)("entity-context"),g=a=>{const{children:i,entity:v,loading:u,error:_,refresh:c}=a,D={entity:v,loading:u,error:_,refresh:c};return(0,n.jsx)(y.Provider,{value:(0,m.E)({1:D}),children:(0,n.jsx)(l.fC,{attributes:{...v?{entityRef:(0,h.eE)(v)}:void 0},children:i})})},j=a=>_jsx(g,{entity:a.entity,loading:!Boolean(a.entity),error:void 0,refresh:void 0,children:a.children});function C(){const a=(0,E.Vt)("entity-context");if(!a)throw new Error("Entity context is not available");const i=a.atVersion(1);if(!i)throw new Error("EntityContext v1 not available");if(!i.entity)throw new Error("useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.");return{entity:i.entity}}function B(){const a=useVersionedContext("entity-context");if(!a)throw new Error("Entity context is not available");const i=a.atVersion(1);if(!i)throw new Error("EntityContext v1 not available");const{entity:v,loading:u,error:_,refresh:c}=i;return{entity:v,loading:u,error:_,refresh:c}}},80967:function(U,d,t){t.r(d),t.d(d,{EmbeddedDocsRouter:function(){return V},Router:function(){return F},isTechDocsAvailable:function(){return H}});var n=t(52322),h=t(2784),l=t(73557),E=t(74314),m=t(4577),O=t(45902),y=t(24992);const g="backstage.io/techdocs-entity",j=({entity:e})=>{var o;let s=(0,E.iB)(e);if(!((o=e.metadata.annotations)===null||o===void 0)&&o[g])try{var r;s=(0,E.of)((r=e.metadata.annotations)===null||r===void 0?void 0:r[g])}catch{}return(0,n.jsxs)(m.I6,{entityRef:s,children:[(0,n.jsx)(y.b,{}),(0,n.jsx)(O.F,{withSearch:!1})]})};var C=t(62774),B=t(77277),a=t(79692),i=t(90436),v=t(9791),u=t(98864),_=t(70249);const c=`apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: example
  description: example.com
  annotations:
    ANNOTATION: value
spec:
  type: website
  lifecycle: production
  owner: user:guest`,D=/^.*ANNOTATION.*$/m,P=c.match(D)[0],x=c.split(`
`).findIndex(e=>D.test(e)),N=(0,a.Z)(e=>({code:{borderRadius:6,margin:e.spacing(2,0),background:e.palette.type==="dark"?"#444":e.palette.common.white}}),{name:"BackstageMissingAnnotationEmptyState"});function R(e){return Array.from(Array(e+1).keys(),o=>o+x)}function A(e){const o=e.map(s=>P.replace("ANNOTATION",s)).join(`
`);return c.replace(P,o)}function I(e){const o=e.length<=1;return(0,n.jsxs)(n.Fragment,{children:["The ",o?"annotation":"annotations"," ",e.map(s=>(0,n.jsx)("code",{children:s})).reduce((s,r)=>(0,n.jsxs)(n.Fragment,{children:[s,", ",r]}))," ",o?"is":"are"," missing. You need to add the"," ",o?"annotation":"annotations"," to your component if you want to enable this tool."]})}function M(e){const{annotation:o,readMoreUrl:s}=e,r=Array.isArray(o)?o:[o],T=s||"https://backstage.io/docs/features/software-catalog/well-known-annotations",L=N();return(0,n.jsx)(_.u,{missing:"field",title:"Missing Annotation",description:I(r),action:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.Z,{variant:"body1",children:"Add the annotation to your component YAML as shown in the highlighted example below:"}),(0,n.jsx)(C.Z,{className:L.code,children:(0,n.jsx)(v.O,{text:A(r),language:"yaml",showLineNumbers:!0,highlightedNumbers:R(r.length),customStyle:{background:"inherit",fontSize:"115%"}})}),(0,n.jsx)(B.Z,{color:"primary",component:u.rU,to:T,children:"Read more"})]})})}var f=t(18662),W=t(31685),K=t(96641);const S="backstage.io/techdocs-ref",Z="backstage.io/techdocs-entity",H=e=>{var o,s,r,T,L,p;return Boolean((r=e)===null||r===void 0||(s=r.metadata)===null||s===void 0||(o=s.annotations)===null||o===void 0?void 0:o[S])||Boolean((p=e)===null||p===void 0||(L=p.metadata)===null||L===void 0||(T=L.annotations)===null||T===void 0?void 0:T[Z])},F=()=>(0,n.jsxs)(l.Z5,{children:[(0,n.jsx)(l.AW,{path:"/",element:(0,n.jsx)(f.TechDocsIndexPage,{})}),(0,n.jsx)(l.AW,{path:"/:namespace/:kind/:name/*",element:(0,n.jsx)(W.I,{})})]}),V=e=>{var o,s;const{children:r}=e,{entity:T}=(0,K.X2)(),L=(0,l.V$)([{path:"/*",element:(0,n.jsx)(j,{entity:T}),children:[{path:"*",element:r}]}]);return((o=T.metadata.annotations)===null||o===void 0?void 0:o[S])||((s=T.metadata.annotations)===null||s===void 0?void 0:s[Z])?L:(0,n.jsx)(M,{annotation:[S]})}},18662:function(U,d,t){t.r(d),t.d(d,{TechDocsIndexPage:function(){return m}});var n=t(52322),h=t(2784),l=t(73557),E=t(29895);const m=O=>(0,l.pC)()||(0,n.jsx)(E.u,{...O})},31685:function(U,d,t){t.d(d,{I:function(){return v},r:function(){return i}});var n=t(52322),h=t(2784),l=t(73557),E=t(67880),m=t(2296),O=t(68979),y=t(45902),g=t(65386),j=t(24992),C=t(95573),B=t(61811),a=t(62584);const i=u=>{const{withSearch:_,withHeader:c=!0}=u;return(0,n.jsxs)(E.T,{themeId:"documentation",children:[c&&(0,n.jsx)(g.S,{}),(0,n.jsx)(j.b,{}),(0,n.jsx)(y.F,{withSearch:_})]})},v=u=>{const{kind:_,name:c,namespace:D}=(0,B.O)(C.Fw),{children:P,entityRef:x={kind:_,name:c,namespace:D}}=u,N=(0,l.pC)();if(!P){const A=N?h.Children.toArray(N.props.children):[];var R;const M=A.flatMap(f=>{var W,K;return(R=(K=f)===null||K===void 0||(W=K.props)===null||W===void 0?void 0:W.children)!==null&&R!==void 0?R:[]}).find(f=>!(0,a.I)(f,m.Zz)&&!(0,a.I)(f,m.jM));return(0,n.jsx)(O.Z,{entityRef:x,children:M||(0,n.jsx)(i,{})})}return(0,n.jsx)(O.Z,{entityRef:x,children:({metadata:A,entityMetadata:I,onReady:M})=>(0,n.jsx)("div",{className:"techdocs-reader-page",children:(0,n.jsx)(E.T,{themeId:"documentation",children:P instanceof Function?P({entityRef:x,techdocsMetadataValue:A.value,entityMetadataValue:I.value,onReady:M}):P})})})}},24992:function(U,d,t){t.d(d,{b:function(){return v}});var n=t(52322),h=t(2784),l=t(79692),E=t(15223),m=t(62774),O=t(80030),y=t(61837),g=t(48348),j=t(47603),C=t(68979),B=t(2296),a=t(57058);const i=(0,l.Z)(u=>({root:{gridArea:"pageSubheader",flexDirection:"column",minHeight:"auto",padding:u.spacing(3,3,0),"@media print":{display:"none"}}})),v=u=>{const _=i(),[c,D]=(0,h.useState)(null),P=(0,h.useCallback)(f=>{D(f.currentTarget)},[]),x=(0,h.useCallback)(()=>{D(null)},[]),{entityMetadata:{value:N,loading:R}}=(0,C.x)(),A=(0,B.$L)(),I=A.renderComponentsByLocation(a.o.Subheader),M=A.renderComponentsByLocation(a.o.Settings);return!I&&!M||R===!1&&!N?null:(0,n.jsx)(E.Z,{classes:_,...u.toolbarProps,children:(0,n.jsxs)(m.Z,{display:"flex",justifyContent:"flex-end",width:"100%",flexWrap:"wrap",children:[I,M?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(O.ZP,{title:"Settings",children:(0,n.jsx)(y.Z,{"aria-controls":"tech-docs-reader-page-settings","aria-haspopup":"true",onClick:P,children:(0,n.jsx)(j.Z,{})})}),(0,n.jsx)(g.Z,{id:"tech-docs-reader-page-settings",getContentAnchorEl:null,anchorEl:c,anchorOrigin:{vertical:"bottom",horizontal:"right"},open:Boolean(c),onClose:x,keepMounted:!0,children:(0,n.jsx)("div",{children:M})})]}):null]})})}}}]);})();

//# sourceMappingURL=967.c3c74dec.chunk.js.map