"use strict";(self.webpackChunktiled=self.webpackChunktiled||[]).push([[883],{76883:function(e,a,t){t.r(a),t.d(a,{default:function(){return L}});var n=t(15861),r=t(70885),i=t(87757),l=t.n(i),s=t(72791),u=t(4942),c=t(19913),o=t(85847),m=t(82839),x=t(90466),d=t(12891),h=t(35667),v=t(24296),j=t(53628),g=t(64554),p=t(80184),f=function(e){return(0,p.jsx)(g.Z,{height:300,children:(0,p.jsx)(c.h,{children:(0,p.jsxs)(o.w,{width:500,height:300,data:e.data.map((function(a,t){return(0,u.Z)({index:t+e.startingIndex},e.name,a)})),margin:{top:5,right:30,left:20,bottom:5},children:[(0,p.jsx)(m.q,{strokeDasharray:"3 3"}),(0,p.jsx)(x.K,{dataKey:"index"}),(0,p.jsx)(d.B,{}),(0,p.jsx)(h.u,{}),(0,p.jsx)(v.D,{}),(0,p.jsx)(j.x,{type:"monotone",stroke:"#000000",dataKey:e.name})]})})})},b=t(68096),Z=t(85523),y=t(17133),k=t(61419),w=t(88970),C=t(61889),P=t(4110),V=t(10889),M=t(20890),S=function(e){var a=function(){e.value[0]<e.min?e.setValue([e.min,e.value[1]]):e.value[1]>e.max&&e.setValue([e.value[0],e.max])},t=[{value:e.min,label:e.min},{value:e.max,label:e.max}];return(0,p.jsxs)(g.Z,{children:[(0,p.jsx)(M.Z,{id:"input-slider",gutterBottom:!0,children:e.max-e.min<=e.limit?"Optionally slice a range of elements from the array":"Slice a range of up to ".concat(e.limit," elements of the array")}),(0,p.jsxs)(C.ZP,{container:!0,spacing:2,alignItems:"center",children:[(0,p.jsx)(C.ZP,{item:!0,xs:!0,children:(0,p.jsx)(V.ZP,{getAriaLabel:function(){return"Array slice range"},value:e.value,min:e.min,max:e.max,marks:t,onChange:function(a,t,n){var r=t,i=[0,0];i=0===n?[r[0],Math.min(r[1],r[0]+e.limit)]:[Math.max(r[0],r[1]-e.limit),r[1]],e.setValue(i)},valueLabelDisplay:"auto"})}),(0,p.jsx)(C.ZP,{item:!0,children:(0,p.jsx)(P.Z,{value:e.value[0],size:"small",onChange:function(a){e.setValue(""===a.target.value?e.value:[Number(a.target.value),Math.min(e.value[1],Number(a.target.value)+e.limit)])},onBlur:a,inputProps:{step:1,min:e.min,max:e.max,type:"number","aria-labelledby":"min-input-slider"}})}),(0,p.jsx)(C.ZP,{item:!0,children:"\u2013"}),(0,p.jsx)(C.ZP,{item:!0,children:(0,p.jsx)(P.Z,{value:e.value[1],size:"small",onChange:function(a){e.setValue(""===a.target.value?e.value:[Math.max(e.value[0],Number(a.target.value)-e.limit),Number(a.target.value)])},onBlur:a,inputProps:{step:1,min:e.min,max:e.max,type:"number","aria-labelledby":"max-input-slider"}})})]})]})},B=t(47047),D=t(46348),N=t(93904),A=function(e){return(0,p.jsxs)(b.Z,{children:[(0,p.jsx)(y.Z,{id:"display-radio-buttons-group-label",children:"View as"}),(0,p.jsxs)(w.Z,{row:!0,"aria-labelledby":"display-radio-buttons-group-label",name:"display-radio-buttons-group",value:e.value,onChange:e.handleChange,children:[(0,p.jsx)(Z.Z,{value:"chart",control:(0,p.jsx)(k.Z,{}),label:"Chart"}),(0,p.jsx)(Z.Z,{value:"list",control:(0,p.jsx)(k.Z,{}),label:"List"})]})]})},I=function(e){var a=(0,s.useState)("chart"),t=(0,r.Z)(a,2),i=t[0],u=t[1],c=(0,s.useState)([]),o=(0,r.Z)(c,2),m=o[0],x=o[1],d=(0,s.useState)(!1),h=(0,r.Z)(d,2),v=h[0],j=h[1];(0,s.useEffect)((function(){var a=new AbortController;function t(){return t=(0,n.Z)(l().mark((function t(){var n,r;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,D.be.get("".concat(e.link,"?format=application/json&slice=").concat(e.range[0],":").concat(e.range[1]),{signal:a.signal});case 2:n=t.sent,r=n.data,x(r),j(!0);case 6:case"end":return t.stop()}}),t)}))),t.apply(this,arguments)}return function(){t.apply(this,arguments)}(),function(){a.abort()}}),[e.link,e.range]);return(0,p.jsxs)("div",{children:[(0,p.jsx)(A,{value:i,handleChange:function(e){u(e.target.value)}}),function(){switch(i){case"chart":return v?(0,p.jsx)(f,{data:m,startingIndex:e.range[0],name:e.name}):(0,p.jsx)(B.Z,{variant:"rectangular"});case"list":return v?(0,p.jsx)(K,{data:m}):(0,p.jsx)(B.Z,{variant:"rectangular"})}}()]})},K=function(e){return(0,p.jsx)("table",{children:(0,p.jsx)("tbody",{children:e.data.map((function(e,a){return(0,p.jsx)("tr",{children:(0,p.jsx)("td",{children:e},"item-td-".concat(a))},"item-tr-".concat(a))}))})})},L=function(e){var a=e.structure.macro.shape[0],t=s.useState([0,Math.min(a,1e3)]),n=(0,r.Z)(t,2),i=n[0],l=n[1];return(0,p.jsxs)("div",{children:[(0,p.jsx)(S,{value:i,setValue:(0,N.D)(l,100,{maxWait:200}),min:0,max:a,limit:1e3}),(0,p.jsx)(I,{link:e.link,range:i,name:e.item.data.id})]})}}}]);
//# sourceMappingURL=883.31ddd2ac.chunk.js.map