"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[3330],{"./public/app/features/dashboard/components/PanelEditor/OptionsPaneCategory.tsx":(e,t,s)=>{s.d(t,{u:()=>c});var i=s("./node_modules/react/index.js"),o=s("./node_modules/@emotion/css/dist/emotion-css.esm.js"),n=s("./packages/grafana-ui/src/index.ts"),a=s("./public/app/features/dashboard/components/PanelEditor/state/reducers.ts"),r=s("./node_modules/react-use/esm/useLocalStorage.js"),d=s("./packages/grafana-e2e-selectors/src/index.ts"),l=s("./node_modules/react/jsx-runtime.js");const c=i.memo((({id:e,title:t,children:s,forceOpen:a,isOpenDefault:c,renderTitle:h,className:g,itemsCount:m,isNested:f=!1})=>{var b,v;const x=!1!==c,[y,j]=(0,r.Z)(p(e),{isExpanded:x}),[C,w]=(0,i.useState)(null!==(b=null==y?void 0:y.isExpanded)&&void 0!==b?b:x),k=(0,n.useStyles2)(u);(0,i.useEffect)((()=>{!C&&a&&a>0&&w(!0)}),[a,C]);const O=(0,i.useCallback)((()=>{j({isExpanded:!C}),w(!C)}),[j,w,C]);h||(h=function(e){return e||void 0===m||0===m?t:v||(v=(0,l.jsxs)("span",{children:[t," ",(0,l.jsx)(n.Counter,{value:m})]}))});const I=(0,o.cx)({[k.box]:!0,[k.boxNestedExpanded]:f&&C},g,"options-group"),S=(0,o.cx)(k.header,{[k.headerExpanded]:C,[k.headerNested]:f}),E=(0,o.cx)(k.body,{[k.bodyNested]:f});return(0,l.jsxs)("div",{className:I,"data-testid":"options-category","aria-label":d.wl.components.OptionsGroup.group(e),children:[(0,l.jsxs)("div",{className:S,onClick:O,"aria-label":d.wl.components.OptionsGroup.toggle(e),children:[(0,l.jsx)("div",{className:(0,o.cx)(k.toggle,"editor-options-group-toggle"),children:(0,l.jsx)(n.Icon,{name:C?"angle-down":"angle-right"})}),(0,l.jsx)("div",{className:k.title,role:"heading",children:h(C)})]}),C&&(0,l.jsx)("div",{className:E,children:s})]})})),u=e=>({box:o.css`
      border-top: 1px solid ${e.colors.border.weak};
    `,boxNestedExpanded:o.css`
      margin-bottom: ${e.spacing(2)};
    `,toggle:o.css`
      color: ${e.colors.text.secondary};
      margin-right: ${e.spacing(1)};
    `,title:o.css`
      flex-grow: 1;
      overflow: hidden;
    `,header:o.css`
      display: flex;
      cursor: pointer;
      align-items: baseline;
      padding: ${e.spacing(1)};
      color: ${e.colors.text.primary};
      font-weight: ${e.typography.fontWeightMedium};

      &:hover {
        background: ${e.colors.emphasize(e.colors.background.primary,.03)};
      }
    `,headerExpanded:o.css`
      color: ${e.colors.text.primary};
    `,headerNested:o.css`
      padding: ${e.spacing(.5,0,.5,0)};
    `,body:o.css`
      padding: ${e.spacing(1,2,1,4)};
    `,bodyNested:o.css`
      position: relative;
      padding-right: 0;
      &:before {
        content: '';
        position: absolute;
        top: 0;
        left: 8px;
        width: 1px;
        height: 100%;
        background: ${e.colors.border.weak};
      }
    `}),p=e=>`${a.jy}.optionGroup[${e}]`},"./public/app/features/dashboard/components/PanelEditor/OptionsPaneCategoryDescriptor.tsx":(e,t,s)=>{s.d(t,{j:()=>a});s("./node_modules/react/index.js");var i=s("./public/app/features/dashboard/components/PanelEditor/OptionsPaneCategory.tsx"),o=s("./node_modules/react/jsx-runtime.js");function n(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class a{constructor(e){n(this,"items",[]),n(this,"categories",[]),n(this,"parent",void 0),this.props=e}addItem(e){return e.parent=this,this.items.push(e),this}addCategory(e){return e.props.isNested=!0,e.parent=this,this.categories.push(e),this}render(e){return this.props.customRender?this.props.customRender():(0,o.jsxs)(i.u,Object.assign({},this.props,{children:[this.items.map((e=>e.render())),this.categories.map((e=>e.render()))]}),this.props.title)}}},"./public/app/features/dashboard/components/PanelEditor/OptionsPaneItemDescriptor.tsx":(e,t,s)=>{s.d(t,{a:()=>d});var i=s("./packages/grafana-e2e-selectors/src/index.ts"),o=s("./packages/grafana-ui/src/index.ts"),n=(s("./node_modules/react/index.js"),s("./node_modules/react-highlight-words/dist/main.js")),a=s.n(n),r=s("./node_modules/react/jsx-runtime.js");class d{constructor(e){var t,s,i;i=void 0,(s="parent")in(t=this)?Object.defineProperty(t,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[s]=i,this.props=e}getLabel(e){const{title:t,description:s}=this.props;if(!e)return this.parent.props.title===t?null:t;const i=[];return this.parent.parent&&i.push(this.highlightWord(this.parent.parent.props.title,e)),this.parent.props.title!==t&&i.push(this.highlightWord(this.parent.props.title,e)),(0,r.jsx)(o.Label,{description:s&&this.highlightWord(s,e),category:i,children:this.highlightWord(t,e)})}highlightWord(e,t){return(0,r.jsx)(a(),{textToHighlight:e,searchWords:[t],highlightClassName:"search-fragment-highlight"})}render(e){const{title:t,description:s,render:n,showIf:a,skipField:d}=this.props,l=`${this.parent.props.id} ${t}`;return a&&!a()?null:d?n():(0,r.jsx)(o.Field,{label:this.getLabel(e),description:s,"aria-label":i.wl.components.PanelEditor.OptionsPane.fieldLabel(l),children:n()},l)}}},"./public/app/features/dashboard/components/PanelEditor/getVizualizationOptions.tsx":(e,t,s)=>{s.d(t,{m:()=>l,H:()=>c});s("./node_modules/react/index.js");var i=s("./node_modules/lodash/lodash.js"),o=s("./public/app/features/panel/panellinks/link_srv.ts"),n=s("./public/app/features/dashboard/components/PanelEditor/utils.ts"),a=s("./public/app/features/dashboard/components/PanelEditor/OptionsPaneItemDescriptor.tsx"),r=s("./public/app/features/dashboard/components/PanelEditor/OptionsPaneCategoryDescriptor.tsx"),d=s("./node_modules/react/jsx-runtime.js");function l(e){const{plugin:t,panel:s,onPanelOptionsChanged:l,onFieldConfigsChange:u,data:p,dashboard:h}=e,g=s.getOptions(),m=s.fieldConfig,f={},b={data:(null==p?void 0:p.series)||[],replaceVariables:s.replaceVariables,options:g,eventBus:h.events,getSuggestions:e=>p?(0,o.PW)(p.series,e):[]},v=e=>{var s;const i=null!==(s=e&&e[0])&&void 0!==s?s:`${t.meta.name}`,o=f[i];return o||(f[i]=new r.j({title:i,id:i}))};c(t.optionEditors.list(),v,((e,t)=>{const s=(0,n.hs)(b.options,e,t);l(s)}),b);for(const e of t.fieldConfigRegistry.list()){if(e.isCustom&&e.showIf&&!e.showIf(m.defaults.custom,null==p?void 0:p.series))continue;if(e.hideFromDefaults)continue;const t=v(e.category),s=e.editor,o=m.defaults,r=e.isCustom?o.custom?(0,i.get)(o.custom,e.path):void 0:(0,i.get)(o,e.path);e.getItemsCount&&(t.props.itemsCount=e.getItemsCount(r)),t.addItem(new a.a({title:e.name,description:e.description,render:function(){return(0,d.jsx)(s,{value:r,onChange:t=>{u((0,n.uJ)(m,e.path,t,e.isCustom))},item:e,context:b})}}))}return Object.values(f)}function c(e,t,s,o){for(const n of e){if(n.showIf&&!n.showIf(o.options,o.data))continue;const e=t(n.category),r=n.editor;e.addItem(new a.a({title:n.name,description:n.description,render:function(){return(0,d.jsx)(r,{value:(0,i.get)(o.options,n.path),onChange:e=>{s(n.path,e)},item:n,context:o})}}))}}},"./public/app/features/dashboard/components/PanelEditor/utils.ts":(e,t,s)=>{s.d(t,{jF:()=>a,sY:()=>r,uJ:()=>d,hs:()=>l});var i=s("./node_modules/lodash/lodash.js"),o=s("./public/app/features/dashboard/components/PanelEditor/types.ts"),n=s("./public/app/core/constants.ts");function a(e,t,s,i){if(e===o.d1.Fill)return{width:t,height:s};const a=(window.innerWidth-60-4*n.hD)/n.cz*i.gridPos.w,r=n.K3*i.gridPos.h+48,d=Math.min(t/a,s/r);return a<=t&&r<=s?{width:a,height:r}:{width:a*d,height:r*d}}function r(e){return!1===(null==e?void 0:e.meta.skipDataQuery)}const d=(e,t,s,o)=>{let n=Object.assign({},e.defaults);const a=null==s||""===s;return o?n.custom?n.custom=a?(0,i.omit)(n.custom,t):l(n.custom,t,s):a||(n.custom=l(n.custom,t,s)):n=a?(0,i.omit)(n,t):l(n,t,s),Object.assign({},e,{defaults:n})};function l(e,t,s){const i=Array.isArray(t)?t:t.split("."),o=i.shift();if(o.endsWith("]")){const t=o.lastIndexOf("["),n=+o.substring(t+1,o.length-1),a=o.substr(0,t);let r=e[a];const d=Array.isArray(r)?[...r]:[];return i.length&&(r=d[n],null!=r&&"object"==typeof r||(r={}),s=l(r,i,s)),d[n]=s,Object.assign({},e,{[a]:d})}if(!i.length)return Object.assign({},e,{[o]:s});let n=e[o];return null!=n&&"object"==typeof n||(n={}),Object.assign({},e,{[o]:l(n,i,s)})}},"./public/app/plugins/panel/canvas/module.tsx":(e,t,s)=>{s.r(t),s.d(t,{plugin:()=>ee});var i=s("./packages/grafana-data/src/index.ts"),o=s("./node_modules/react/index.js"),n=s("./node_modules/rxjs/dist/esm5/internal/ReplaySubject.js"),a=s("./node_modules/rxjs/dist/esm5/internal/Subscription.js"),r=s("./public/app/types/events.ts"),d=s("./node_modules/@emotion/css/dist/emotion-css.esm.js"),l=s("./public/app/core/config.ts"),c=s("./packages/grafana-ui/src/index.ts");let u;!function(e){e.Original="original",e.Contain="contain",e.Cover="cover",e.Fill="fill",e.Tile="tile"}(u||(u={}));var p=s("./public/app/features/dimensions/index.ts"),h=s("./public/app/features/dimensions/editors/index.ts"),g=s("./node_modules/react-inlinesvg/esm/index.js"),m=s("./node_modules/lodash/lodash.js"),f=s("./node_modules/react/jsx-runtime.js");const b=d.css`
  path {
    vector-effect: non-scaling-stroke;
  }
`;const v={id:"icon",name:"Icon",description:"SVG Icon display",display:function(e){const{width:t,height:s,data:i}=e;if(null==i||!i.path)return null;const o={fill:null==i?void 0:i.fill,stroke:null==i?void 0:i.strokeColor,strokeWidth:null==i?void 0:i.stroke};return(0,f.jsx)(g.Z,{src:i.path,width:t,height:s,style:o,className:o.strokeWidth?b:void 0})},defaultConfig:{path:{mode:p.Q8.Fixed,fixed:"img/icons/unicons/question-circle.svg"},fill:{fixed:"#FFF899"}},defaultSize:{width:50,height:50},prepareData:(e,t)=>{var s;let i;t.path&&(i=e.getResource(t.path).value()),i&&(0,m.isString)(i)||(i=(0,p.t7)("img/icons/unicons/question-circle.svg"));const o={path:i,fill:t.fill?e.getColor(t.fill).value():"#CCC"};var n;null!==(s=t.stroke)&&void 0!==s&&s.width&&t.stroke.color&&(t.stroke.width>0&&(o.stroke=null===(n=t.stroke)||void 0===n?void 0:n.width,o.strokeColor=e.getColor(t.stroke.color).value()));return o},registerOptionsUI:e=>{e.addCustomEditor({id:"iconSelector",path:"config.path",name:"SVG Path",editor:h.Lv,settings:{resourceType:"icon"}}).addCustomEditor({id:"config.fill",path:"config.fill",name:"Icon fill color",editor:h.Lm,settings:{},defaultValue:{fixed:"grey"}}).addSliderInput({path:"config.stroke.width",name:"Stroke",defaultValue:0,settings:{min:0,max:10}}).addCustomEditor({id:"config.stroke.color",path:"config.stroke.color",name:"Icon Stroke color",editor:h.Lm,settings:{},defaultValue:{fixed:"grey"},showIf:e=>{var t,s;return Boolean(null===(t=e.config)||void 0===t||null===(s=t.stroke)||void 0===s?void 0:s.width)}})}};var x=s("./public/app/features/dimensions/editors/ColorDimensionEditor.tsx"),y=s("./public/app/features/dimensions/editors/TextDimensionEditor.tsx");let j,C;!function(e){e.Left="left",e.Center="center",e.Right="right"}(j||(j={})),function(e){e.Top="top",e.Middle="middle",e.Bottom="bottom"}(C||(C={}));class w extends o.PureComponent{render(){const{data:e}=this.props,t=k(l.vc.theme2,e);return(0,f.jsx)("div",{className:t.container,children:(0,f.jsx)("span",{className:t.span,children:null==e?void 0:e.text})})}}const k=(0,c.stylesFactory)(((e,t)=>({container:d.css`
    position: absolute;
    height: 100%;
    width: 100%;
    display: table;
  `,span:d.css`
    display: table-cell;
    vertical-align: ${t.valign};
    text-align: ${t.align};
    font-size: ${null==t?void 0:t.size}px;
    color: ${null==t?void 0:t.color};
  `}))),O={id:"text-box",name:"Text",description:"Text box",display:w,defaultConfig:{align:j.Left,valign:C.Middle},defaultSize:{width:240,height:160},prepareData:(e,t)=>{var s,i;const o={text:t.text?e.getText(t.text).value():"",align:null!==(s=t.align)&&void 0!==s?s:j.Center,valign:null!==(i=t.valign)&&void 0!==i?i:C.Middle,size:t.size};return t.color&&(o.color=e.getColor(t.color).value()),o},registerOptionsUI:e=>{e.addCustomEditor({id:"textSelector",path:"config.text",name:"Text",editor:y.$}).addCustomEditor({id:"config.color",path:"config.color",name:"Text color",editor:x.L,settings:{},defaultValue:{}}).addRadio({path:"config.align",name:"Align text",settings:{options:[{value:j.Left,label:"Left"},{value:j.Center,label:"Center"},{value:j.Right,label:"Right"}]},defaultValue:j.Left}).addRadio({path:"config.valign",name:"Vertical align",settings:{options:[{value:C.Top,label:"Top"},{value:C.Middle,label:"Middle"},{value:C.Bottom,label:"Bottom"}]},defaultValue:C.Middle}).addNumberInput({path:"config.size",name:"Text size",settings:{placeholder:"Auto"}})}},I={type:v.id,config:Object.assign({},v.defaultConfig),placement:Object.assign({},v.defaultSize)},S=new i.Registry((()=>[v,O]));var E,P=s("./public/app/features/dimensions/utils.ts");class D extends o.PureComponent{render(){const{config:e}=this.props;return(0,f.jsxs)("div",{children:[E||(E=(0,f.jsx)("h3",{children:"NOT FOUND:"})),(0,f.jsx)("pre",{children:JSON.stringify(e,null,2)})]})}}const z={id:"not-found",name:"Not found",description:"Display when element type is not found in the registry",defaultConfig:{},display:D,defaultSize:{width:100,height:100}};function $(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}let N=100;class _{constructor(e,t,s){$(this,"UID",N++),$(this,"revId",0),$(this,"style",{}),$(this,"width",100),$(this,"height",100),$(this,"data",void 0),this.item=e,this.options=t,this.parent=s,t||(this.options={type:e.id})}updateSize(e,t){this.width=e,this.height=t,this.style=Object.assign({},this.style,{width:e,height:t})}updateData(e){var t;this.item.prepareData&&(this.data=this.item.prepareData(e,this.options.config),this.revId++);const{background:s,border:i}=this.options,o={};if(s){if(s.color){const t=e.getColor(s.color);o.backgroundColor=t.value()}if(s.image){const i=e.getResource(s.image);if(i){const e=i.value();if(e)switch(o.backgroundImage=`url("${e}")`,null!==(t=s.size)&&void 0!==t?t:u.Contain){case u.Contain:o.backgroundSize="contain",o.backgroundRepeat="no-repeat";break;case u.Cover:o.backgroundSize="cover",o.backgroundRepeat="no-repeat";break;case u.Original:o.backgroundRepeat="no-repeat";break;case u.Tile:o.backgroundRepeat="repeat";break;case u.Fill:o.backgroundSize="100% 100%"}}}}if(i&&i.color&&i.width){const t=e.getColor(i.color);o.borderWidth=i.width,o.borderStyle="solid",o.borderColor=t.value(),o.backgroundImage&&(o.backgroundOrigin="padding-box")}o.width=this.width,o.height=this.height,this.style=o}visit(e){e(this)}onChange(e){var t;this.item.id!==e.type&&(this.item=null!==(t=S.getIfExists(e.type))&&void 0!==t?t:z);this.revId++,this.options=Object.assign({},e);let s=this.parent;for(;s;)s.revId++,s=s.parent}getSaveModel(){return Object.assign({},this.options)}render(){const{item:e}=this;return(0,f.jsx)("div",{style:this.style,children:(0,f.jsx)(e.display,{config:this.options.config,width:this.width,height:this.height,data:this.data})},`${this.UID}/${this.revId}`)}}var R;const F={id:"group",name:"Group",description:"Group",defaultConfig:{},display:()=>R||(R=(0,f.jsx)("div",{children:"GROUP!"}))};class T extends _{constructor(e,t){var s,i,o;super(F,e,t),o=[],(i="elements")in(s=this)?Object.defineProperty(s,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[i]=o,this.options=e,this.parent=t;let{elements:n}=this.options;n||(this.options.elements=n=[]);for(const e of n)if("group"===e.type)this.elements.push(new T(e,this));else{var a;const s=null!==(a=S.getIfExists(e.type))&&void 0!==a?a:z;this.elements.push(new _(s,e,t))}}updateSize(e,t){super.updateSize(e,t);for(const e of this.elements)e.updateSize(this.width,this.height)}updateData(e){super.updateData(e);for(const t of this.elements)t.updateData(e)}render(){return(0,f.jsx)("div",{style:this.style,children:this.elements.map((e=>e.render()))},`${this.UID}/${this.revId}`)}visit(e){super.visit(e);for(const t of this.elements)e(t)}getSaveModel(){return Object.assign({},this.options,{elements:this.elements.map((e=>e.getSaveModel()))})}}function L(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class V{constructor(e,t){L(this,"root",void 0),L(this,"lookup",new Map),L(this,"styles",M(l.vc.theme2)),L(this,"selected",new n.t(void 0)),L(this,"revId",0),L(this,"width",0),L(this,"height",0),L(this,"style",{}),L(this,"data",void 0),L(this,"context",{getColor:e=>(0,P.FP)(this.data,e),getScale:e=>(0,P.pb)(this.data,e),getText:e=>(0,P.WO)(this.data,e),getResource:e=>(0,P.Qz)(this.data,e)}),this.onSave=t,this.root=this.load(e)}load(e){return console.log("LOAD",e,this),this.root=new T(null!=e?e:{type:"group",elements:[I]}),this.lookup.clear(),this.root.visit((e=>{this.lookup.set(e.UID,e),"group"!==e.item.id&&this.selected.next(e)})),this.root}updateData(e){this.data=e,this.root.updateData(this.context)}updateSize(e,t){this.width=e,this.height=t,this.style={width:e,height:t},this.root.updateSize(e,t)}onChange(e,t){const s=this.lookup.get(e);if(!s)throw new Error("element not found: "+e+" // "+[...this.lookup.keys()]);this.revId++,s.onChange(t),s.updateData(this.context),this.save()}save(){this.onSave(this.root.getSaveModel())}render(){return(0,f.jsx)("div",{className:this.styles.wrap,style:this.style,children:this.root.render()},this.revId)}}const M=(0,c.stylesFactory)((e=>({wrap:d.css`
    overflow: hidden;
    position: relative;
  `,toolbar:d.css`
    position: absolute;
    bottom: 0;
    margin: 10px;
  `})));function U(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}const W=new n.t(1);class B extends o.Component{constructor(e){super(e),U(this,"scene",void 0),U(this,"subs",new a.w0),U(this,"needsReload",!1),U(this,"onUpdateScene",(e=>{const{onOptionsChange:t,options:s}=this.props;t(Object.assign({},s,{root:e})),this.setState({refresh:this.state.refresh+1})})),this.state={refresh:0},this.scene=new V(this.props.options.root,this.onUpdateScene),this.scene.updateSize(e.width,e.height),this.scene.updateData(e.data),W.next(this.scene),this.subs.add(this.props.eventBus.subscribe(r.Yr,(e=>{this.props.id===e.payload&&(this.needsReload=!0)})))}componentDidMount(){W.next(this.scene)}componentWillUnmount(){this.subs.unsubscribe()}shouldComponentUpdate(e){const{width:t,height:s,data:i,renderCounter:o}=this.props;let n=!1;return t===e.width&&s===e.height||(this.scene.updateSize(e.width,e.height),n=!0),i!==e.data&&(this.scene.updateData(e.data),n=!0),this.needsReload&&this.props.options!==e.options&&(this.needsReload=!1,this.scene.load(e.options.root),this.scene.updateSize(e.width,e.height),this.scene.updateData(e.data),n=!0),o!==e.renderCounter&&(n=!0),n}render(){return this.scene.render()}}var G,A=s("./public/app/features/dashboard/components/PanelEditor/OptionsPaneCategoryDescriptor.tsx"),Z=s("./public/app/features/dashboard/components/PanelEditor/utils.ts"),H=s("./public/app/features/dashboard/components/PanelEditor/getVizualizationOptions.tsx");const J=({options:e,onChange:t,data:s,filter:n})=>{const a=(0,o.useMemo)((()=>S.selectOptions(null!=e&&e.type?[e.type]:[I.type],n)),[null==e?void 0:e.type,n]),r=(0,o.useMemo)((()=>{const t=S.getIfExists(null==e?void 0:e.type);if(!t||!t.registerOptionsUI)return null;const s=new i.PanelOptionsEditorBuilder;return t.registerOptionsUI&&t.registerOptionsUI(s),function(e){e.addCustomEditor({id:"background.color",path:"background.color",name:"Background Color",editor:h.Lm,settings:{},defaultValue:{fixed:""}}).addCustomEditor({id:"background.image",path:"background.image",name:"Background Image",editor:h.Lv,settings:{resourceType:"image"}}).addRadio({path:"background.size",name:"Backround image size",settings:{options:[{value:u.Original,label:"Original"},{value:u.Contain,label:"Contain"},{value:u.Cover,label:"Cover"},{value:u.Fill,label:"Fill"},{value:u.Tile,label:"Tile"}]},defaultValue:u.Cover})}(s),function(e){e.addSliderInput({path:"border.width",name:"Border Width",defaultValue:2,settings:{min:0,max:20}}),e.addCustomEditor({id:"border.color",path:"border.color",name:"Border Color",editor:h.Lm,settings:{},defaultValue:{fixed:""},showIf:e=>{var t;return Boolean(null===(t=e.border)||void 0===t?void 0:t.width)}})}(s),s}),[null==e?void 0:e.type]),d=(0,o.useMemo)((()=>{const i=S.getIfExists(null==e?void 0:e.type);if(!r||!i)return null;const o=new A.j({id:"CanvasElement config",title:"CanvasElement config"}),n={data:s,options:e},a=Object.assign({},e,{type:i.id,config:Object.assign({},i.defaultConfig,null==e?void 0:e.config)});(!e||i.defaultConfig&&!e.config)&&t(a);const d=r.getRegistry();return(0,H.H)(d.list(),(e=>o),((e,s)=>{t((0,Z.hs)(a,e,s))}),n),(0,f.jsxs)(f.Fragment,{children:[G||(G=(0,f.jsx)("br",{})),o.items.map((e=>e.render()))]})}),[r,t,s,e]);return(0,f.jsxs)("div",{children:[(0,f.jsx)(c.Select,{menuShouldPortal:!0,options:a.options,value:a.current,onChange:s=>{var i;const o=S.getIfExists(s.value);o?t(Object.assign({},e,{type:o.id,config:(0,m.cloneDeep)(null!==(i=o.defaultConfig)&&void 0!==i?i:{})})):console.warn("layer does not exist",s)}}),d]})};var Q,q=s("./node_modules/react-use/esm/useObservable.js"),Y=s("./node_modules/rxjs/dist/esm5/internal/observable/of.js");const K=({context:e})=>{var t;const s=(0,q.Z)(W),i=(0,q.Z)(null!==(t=null==s?void 0:s.selected)&&void 0!==t?t:(0,Y.of)(void 0));return i?(0,f.jsx)(J,{options:i.options,data:e.data,onChange:e=>{s.onChange(i.UID,e)}}):Q||(Q=(0,f.jsx)("div",{children:"No item is selected"}))},X=(Object.freeze([1,0]),{root:{elements:[Object.assign({},I)]}}),ee=new i.PanelPlugin(B).setNoPadding().useFieldConfig().setPanelOptions((e=>{e.addCustomEditor({category:["Selected Element"],id:"root",path:"root",name:"Selected Element",editor:K,defaultValue:X.root})}))},"./node_modules/react-use/esm/useObservable.js":(e,t,s)=>{s.d(t,{Z:()=>n});var i=s("./node_modules/react/index.js"),o=s("./node_modules/react-use/esm/useIsomorphicLayoutEffect.js");const n=function(e,t){var s=(0,i.useState)(t),n=s[0],a=s[1];return(0,o.Z)((function(){var t=e.subscribe(a);return function(){return t.unsubscribe()}}),[e]),n}}}]);
//# sourceMappingURL=canvasPanel.8128b05ac04b15cbf98d.js.map