1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9005],{59005:(e,t,l)=>{l.r(t),l.d(t,{CodeEditor:()=>m});var r=l(97726),n=l(88301),o=l(80521),s=l(27779),a=l(3965),u=l(27537),c=l(18414),i=l(30065),d=l(73715),f=l(7102);function m(e){let{value:t,onChange:i,language:m="yaml",readOnly:p=!1,placeholder:b="",minHeight:y="200px",className:v,formatLabel:w}=e,x=(0,c.useRef)(null),C=(0,c.useRef)(null),g=(0,c.useRef)(i);g.current=i;let[k,j]=(0,c.useState)(null);(0,c.useEffect)(()=>{let e=!1;return(async()=>{let t;if("json"===m){let{json:e}=await Promise.all([l.e(9434),l.e(5321)]).then(l.bind(l,25321));t=e()}else{let{yaml:e}=await Promise.all([l.e(9434),l.e(3065)]).then(l.bind(l,13065));t=e()}e||j(t)})(),()=>{e=!0}},[m]);let z=(0,c.useCallback)(()=>{let e=[(0,u.$K)(),a.bM,u.Lz.theme({"&":{minHeight:y,fontSize:"13px"},".cm-scroller":{overflow:"auto"},".cm-content":{fontFamily:"monospace"},".cm-gutters":{minHeight:y}}),u.w4.of([])];return k&&e.push(k),b&&e.push((0,u.qf)(b)),p?(e.push(s.$t.readOnly.of(!0)),e.push(u.Lz.editable.of(!1))):e.push(u.Lz.updateListener.of(e=>{if(e.docChanged){var t;null==(t=g.current)||t.call(g,e.state.doc.toString())}})),e},[k,p,b,y]);(0,c.useEffect)(()=>{if(!x.current||null===k)return;let e=s.$t.create({doc:t,extensions:z()}),l=new u.Lz({state:e,parent:x.current});return C.current=l,()=>{l.destroy(),C.current=null}},[k,p,z]),(0,c.useEffect)(()=>{let e=C.current;if(!e)return;let l=e.state.doc.toString();l!==t&&e.dispatch({changes:{from:0,to:l.length,insert:t}})},[t]);let E=!!w&&"yaml"===m&&!!i&&!p,L=(0,c.useCallback)(()=>{let e=(0,f.Ph)(t);
1if(!e.ok)return void(0,n.toast)({id:"code-editor-format-yaml",variant:"error",title:"Couldn't format",description:e.message});e.yaml!==t&&(null==i||i(e.yaml))},[t,i]);return(0,r.jsxs)("div",{className:(0,d.t$)({gap:"8",width:"full"}),children:[E?(0,r.jsx)("div",{className:(0,d.Uu)({justify:"flex-end"}),children:(0,r.jsx)(o.Button,{type:"button",variant:"secondary",size:"sm",onClick:L,children:w})}):null,(0,r.jsx)("div",{ref:x,className:"".concat(h," ").concat(null!=v?v:"")})]})}let h=(0,i.AH)({border:"1px solid",borderColor:"border.secondary",borderRadius:"300",overflow:"hidden","& .cm-editor":{outline:"none"},"& .cm-focused":{outline:"none"}})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.